Fixed missing composing notifications

This commit is contained in:
Sylvain Berfini 2025-01-28 16:55:49 +01:00
parent a5b8a8a683
commit 37c23066f0
2 changed files with 21 additions and 13 deletions

View file

@ -275,15 +275,21 @@ open class ConversationFragment : SlidingPaneChildFragment() {
}
override fun afterTextChanged(p0: Editable?) {
sendMessageViewModel.closeParticipantsList()
if (viewModel.isGroup.value == true) {
sendMessageViewModel.closeParticipantsList()
val split = p0.toString().split(" ")
for (part in split) {
if (part == "@") {
Log.i("$TAG '@' found, opening participants list")
sendMessageViewModel.openParticipantsList()
val split = p0.toString().split(" ")
for (part in split) {
if (part == "@") {
Log.i("$TAG '@' found, opening participants list")
sendMessageViewModel.openParticipantsList()
}
}
}
if (p0.toString().isNotEmpty()) {
sendMessageViewModel.notifyChatMessageIsBeingComposed()
}
}
}
@ -786,13 +792,6 @@ open class ConversationFragment : SlidingPaneChildFragment() {
}
}
viewModel.isGroup.observe(viewLifecycleOwner) { group ->
if (group) {
Log.i("$TAG Adding text observer to message sending area")
binding.sendArea.messageToSend.addTextChangedListener(textObserver)
}
}
viewModel.messageDeletedEvent.observe(viewLifecycleOwner) {
it.consume {
val message = getString(R.string.conversation_message_deleted_toast)
@ -946,6 +945,8 @@ open class ConversationFragment : SlidingPaneChildFragment() {
}
}
binding.sendArea.messageToSend.addTextChangedListener(textObserver)
scrollListener = object : ConversationScrollListener(layoutManager) {
@UiThread
override fun onLoadMore(totalItemsCount: Int) {

View file

@ -321,6 +321,13 @@ class SendMessageInConversationViewModel
}
}
@UiThread
fun notifyChatMessageIsBeingComposed() {
coreContext.postOnCoreThread {
chatRoom.compose()
}
}
@UiThread
fun openParticipantsList() {
isParticipantsListOpen.value = true