mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-23 02:56:21 +00:00
fix: finally fix the darn unread count issue by
This commit is contained in:
@@ -155,7 +155,8 @@ class BatchMessageReceiveJob(
|
||||
// The LinkedHashMap should preserve insertion order
|
||||
val messageIds = linkedMapOf<Long, Pair<Boolean, Boolean>>()
|
||||
val myLastSeen = storage.getLastSeen(threadId)
|
||||
var newLastSeen = myLastSeen
|
||||
var newLastSeen = if (myLastSeen == -1L) 0 else myLastSeen
|
||||
Log.d("Loki-DBG", "myLastSeen = $newLastSeen")
|
||||
messages.forEach { (parameters, message, proto) ->
|
||||
try {
|
||||
when (message) {
|
||||
@@ -224,10 +225,12 @@ class BatchMessageReceiveJob(
|
||||
// increment unreads, notify, and update thread
|
||||
// last seen will be the current last seen if not changed (re-computes the read counts for thread record)
|
||||
// might have been updated from a different thread at this point
|
||||
val currentLastSeen = storage.getLastSeen(threadId)
|
||||
val currentLastSeen = storage.getLastSeen(threadId).let { if (it == -1L) 0 else it }
|
||||
Log.d("Loki-DBG", "currentLastSeen = $currentLastSeen")
|
||||
if (currentLastSeen > newLastSeen) {
|
||||
newLastSeen = currentLastSeen
|
||||
}
|
||||
Log.d("Loki-DBG", "newLastSeen = $newLastSeen")
|
||||
storage.markConversationAsRead(threadId, newLastSeen)
|
||||
storage.updateThread(threadId, true)
|
||||
SSKEnvironment.shared.notificationManager.updateNotification(context, threadId)
|
||||
|
||||
Reference in New Issue
Block a user