fix: keep typing indicator in sync with realtime messages
Some checks failed
Android CI / android (push) Has started running
Android Release / release (push) Has been cancelled
CI / test (push) Has been cancelled

fix: clear typing state when message arrives and ignore self typing events
This commit is contained in:
2026-04-05 14:57:55 +03:00
parent af53048013
commit ab391ec475

View File

@@ -826,6 +826,7 @@ class ChatViewModel @Inject constructor(
when (event) {
is RealtimeEvent.TypingStart -> {
if (event.chatId != chatId) return@collectLatest
if (event.userId != null && event.userId == uiState.value.selfUserId) return@collectLatest
typingResetJob?.cancel()
_uiState.update {
it.copy(
@@ -867,6 +868,21 @@ class ChatViewModel @Inject constructor(
}
}
is RealtimeEvent.ReceiveMessage -> {
if (event.chatId != chatId) return@collectLatest
typingResetJob?.cancel()
_uiState.update {
it.copy(
isTyping = false,
chatSubtitle = resolveDisplayedSubtitle(
baseSubtitle = it.baseChatSubtitle,
isRealtimeConnecting = it.isRealtimeConnecting,
isTyping = false,
),
)
}
}
else -> Unit
}
}