Make sure sent chat message will be visible
This commit is contained in:
parent
c18230faf5
commit
359645dc4e
2 changed files with 16 additions and 0 deletions
|
@ -307,6 +307,16 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
|
|||
}
|
||||
}
|
||||
|
||||
chatSendingViewModel.messageSentEvent.observe(
|
||||
viewLifecycleOwner
|
||||
) {
|
||||
it.consume {
|
||||
Log.i("[Chat Room] Message sent")
|
||||
// Reset this to ensure sent message will be visible
|
||||
viewModel.isUserScrollingUp.value = false
|
||||
}
|
||||
}
|
||||
|
||||
listViewModel.events.observe(
|
||||
viewLifecycleOwner
|
||||
) { events ->
|
||||
|
|
|
@ -76,6 +76,10 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
|
|||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
val messageSentEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
val voiceRecordingProgressBarMax = 10000
|
||||
|
||||
val isPendingVoiceRecord = MutableLiveData<Boolean>()
|
||||
|
@ -261,6 +265,8 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
|
|||
attachments.value.orEmpty().forEach(ChatMessageAttachmentData::destroy)
|
||||
attachments.value = arrayListOf()
|
||||
textToSend.value = ""
|
||||
|
||||
messageSentEvent.value = Event(true)
|
||||
}
|
||||
|
||||
fun transferMessage(chatMessage: ChatMessage) {
|
||||
|
|
Loading…
Reference in a new issue