Update meeting details after successfull edit

This commit is contained in:
Sylvain Berfini 2024-05-23 13:55:05 +02:00
parent 5d58b2a0fd
commit e83afdf436
5 changed files with 27 additions and 6 deletions

View file

@ -165,12 +165,6 @@ class ConversationViewModel @UiThread constructor() : AbstractConversationViewMo
addEvents(arrayOf(eventLog))
}
@WorkerThread
override fun onChatMessageSent(chatRoom: ChatRoom, eventLog: EventLog) {
val message = eventLog.chatMessage
Log.i("$TAG Message [$message] has been sent")
}
@WorkerThread
override fun onChatMessagesReceived(chatRoom: ChatRoom, eventLogs: Array<EventLog>) {
Log.i("$TAG Received [${eventLogs.size}] new message(s)")

View file

@ -181,6 +181,7 @@ class EditMeetingFragment : SlidingPaneChildFragment() {
getString(R.string.meeting_info_updated_toast),
R.drawable.check
)
sharedViewModel.meetingEditedEvent.value = Event(true)
sharedViewModel.forceRefreshMeetingsListEvent.value = Event(true)
goBack()
}

View file

@ -151,6 +151,13 @@ class MeetingFragment : SlidingPaneChildFragment() {
viewModel.showBackButton.value = slideable
}
sharedViewModel.meetingEditedEvent.observe(viewLifecycleOwner) {
it.consume {
Log.i("$TAG Meeting with URI [$uri] has been edited, reloading info")
viewModel.refreshInfo(uri)
}
}
viewModel.conferenceInfoFoundEvent.observe(viewLifecycleOwner) {
it.consume { found ->
if (found) {

View file

@ -192,6 +192,21 @@ class MeetingViewModel @UiThread constructor() : GenericViewModel() {
}
}
@UiThread
fun refreshInfo(uri: String) {
coreContext.postOnCoreThread { core ->
val address = Factory.instance().createAddress(uri)
if (address != null) {
val found = core.findConferenceInformationFromUri(address)
if (found != null) {
Log.i("$TAG Conference info with SIP URI [$uri] was found, updating info")
conferenceInfo = found
configureConferenceInfo()
}
}
}
}
@WorkerThread
private fun configureConferenceInfo() {
if (::conferenceInfo.isInitialized) {

View file

@ -144,6 +144,10 @@ class SharedMainViewModel @UiThread constructor() : ViewModel() {
var displayedMeeting: ConferenceInfo? = null // Prevents the need to go look for the conference info
val meetingEditedEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
val forceRefreshMeetingsListEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}