From ac736744f6dd79786496951c0d00c584571fb712 Mon Sep 17 00:00:00 2001 From: 0x330a <92654767+0x330a@users.noreply.github.com> Date: Mon, 1 May 2023 09:15:03 +1000 Subject: [PATCH] refactor: mark as read on open and use less buffer time --- .../securesms/conversation/v2/ConversationActivityV2.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt index 10298c3fd8..8ca153cd64 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt @@ -440,8 +440,10 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe lifecycle.repeatOnLifecycle(Lifecycle.State.RESUMED) { // only update the conversation every 3 seconds maximum // channel is rendezvous and shouldn't block on try send calls as often as we want + withContext(Dispatchers.IO) { + storage.markConversationAsRead(viewModel.threadId, SnodeAPI.nowWithOffset) + } val bufferedFlow = bufferedLastSeenChannel.consumeAsFlow() - .debounce(30.seconds) bufferedFlow.collectLatest { withContext(Dispatchers.IO) { storage.markConversationAsRead(viewModel.threadId, SnodeAPI.nowWithOffset) @@ -496,7 +498,6 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe if (author != null && messageTimestamp >= 0) { jumpToMessage(author, messageTimestamp, null) } - // TODO: buffer this bufferedLastSeenChannel.trySend(Unit) } updatePlaceholder()