mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Fixed muted state in conversations list cell when updated from conversation
This commit is contained in:
parent
4cbad5308c
commit
6893d35a93
4 changed files with 25 additions and 0 deletions
|
|
@ -1049,12 +1049,14 @@ open class ConversationFragment : SlidingPaneChildFragment() {
|
|||
Log.i("$TAG Muting conversation")
|
||||
viewModel.mute()
|
||||
popupWindow.dismiss()
|
||||
sharedViewModel.forceRefreshDisplayedConversation.value = Event(true)
|
||||
}
|
||||
|
||||
popupView.setUnmuteClickListener {
|
||||
Log.i("$TAG Un-muting conversation")
|
||||
viewModel.unMute()
|
||||
popupWindow.dismiss()
|
||||
sharedViewModel.forceRefreshDisplayedConversation.value = Event(true)
|
||||
}
|
||||
|
||||
popupView.setConfigureEphemeralMessagesClickListener {
|
||||
|
|
|
|||
|
|
@ -281,6 +281,18 @@ class ConversationsListFragment : AbstractMainFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
sharedViewModel.forceRefreshDisplayedConversation.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
val displayChatRoom = sharedViewModel.displayedChatRoom
|
||||
if (displayChatRoom != null) {
|
||||
val found = listViewModel.conversations.value.orEmpty().find { model ->
|
||||
model.chatRoom == displayChatRoom
|
||||
}
|
||||
found?.updateMuteState()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sharedViewModel.updateUnreadMessageCountForCurrentConversationEvent.observe(
|
||||
viewLifecycleOwner
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -206,6 +206,13 @@ class ConversationModel @WorkerThread constructor(val chatRoom: ChatRoom) {
|
|||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun updateMuteState() {
|
||||
coreContext.postOnCoreThread {
|
||||
isMuted.postValue(chatRoom.muted)
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun toggleMute() {
|
||||
coreContext.postOnCoreThread {
|
||||
|
|
|
|||
|
|
@ -127,6 +127,10 @@ class SharedMainViewModel @UiThread constructor() : ViewModel() {
|
|||
MutableLiveData<Event<Bundle>>()
|
||||
}
|
||||
|
||||
val forceRefreshDisplayedConversation: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
val forceRefreshConversations: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue