mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-25 11:05:25 +00:00
refactor: mark as read on open and use less buffer time
This commit is contained in:
parent
d207d00423
commit
ac736744f6
@ -440,8 +440,10 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
lifecycle.repeatOnLifecycle(Lifecycle.State.RESUMED) {
|
lifecycle.repeatOnLifecycle(Lifecycle.State.RESUMED) {
|
||||||
// only update the conversation every 3 seconds maximum
|
// only update the conversation every 3 seconds maximum
|
||||||
// channel is rendezvous and shouldn't block on try send calls as often as we want
|
// 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()
|
val bufferedFlow = bufferedLastSeenChannel.consumeAsFlow()
|
||||||
.debounce(30.seconds)
|
|
||||||
bufferedFlow.collectLatest {
|
bufferedFlow.collectLatest {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
storage.markConversationAsRead(viewModel.threadId, SnodeAPI.nowWithOffset)
|
storage.markConversationAsRead(viewModel.threadId, SnodeAPI.nowWithOffset)
|
||||||
@ -496,7 +498,6 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
if (author != null && messageTimestamp >= 0) {
|
if (author != null && messageTimestamp >= 0) {
|
||||||
jumpToMessage(author, messageTimestamp, null)
|
jumpToMessage(author, messageTimestamp, null)
|
||||||
}
|
}
|
||||||
// TODO: buffer this
|
|
||||||
bufferedLastSeenChannel.trySend(Unit)
|
bufferedLastSeenChannel.trySend(Unit)
|
||||||
}
|
}
|
||||||
updatePlaceholder()
|
updatePlaceholder()
|
||||||
|
Loading…
Reference in New Issue
Block a user