mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-26 14:27:20 +00:00
wip: add more logs for initial last Read sync of communities
This commit is contained in:
@@ -40,6 +40,7 @@ class BackgroundGroupAddJob(val joinUrl: String): Job {
|
||||
}
|
||||
storage.addOpenGroup(openGroup.joinUrl())
|
||||
Log.d(KEY, "onOpenGroupAdded(${openGroup.server})")
|
||||
Log.d("Loki-DBG", "added group $joinUrl")
|
||||
storage.onOpenGroupAdded(openGroup.server, openGroup.room)
|
||||
} catch (e: Exception) {
|
||||
Log.e("OpenGroupDispatcher", "Failed to add group because",e)
|
||||
|
||||
@@ -147,6 +147,9 @@ class BatchMessageReceiveJob(
|
||||
val messageIds = linkedMapOf<Long, Pair<Boolean, Boolean>>()
|
||||
val myLastSeen = storage.getLastSeen(threadId)
|
||||
var newLastSeen = if (myLastSeen == -1L) 0 else myLastSeen
|
||||
if (!openGroupID.isNullOrEmpty()) {
|
||||
Log.d("Loki-DBG", "pre-lastSeen for: $openGroupID is $newLastSeen")
|
||||
}
|
||||
messages.forEach { (parameters, message, proto) ->
|
||||
try {
|
||||
when (message) {
|
||||
@@ -217,9 +220,15 @@ class BatchMessageReceiveJob(
|
||||
// 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).let { if (it == -1L) 0 else it }
|
||||
if (!openGroupID.isNullOrEmpty()) {
|
||||
Log.d("Loki-DBG", "current-lastSeen (w/ my message read) for: $openGroupID is $currentLastSeen")
|
||||
}
|
||||
if (currentLastSeen > newLastSeen) {
|
||||
newLastSeen = currentLastSeen
|
||||
}
|
||||
if (!openGroupID.isNullOrEmpty()) {
|
||||
Log.d("Loki-DBG", "new-lastSeen for: $openGroupID is $currentLastSeen")
|
||||
}
|
||||
storage.markConversationAsRead(threadId, newLastSeen)
|
||||
storage.updateThread(threadId, true)
|
||||
SSKEnvironment.shared.notificationManager.updateNotification(context, threadId)
|
||||
|
||||
Reference in New Issue
Block a user