From 2e50dc08bb6d4599baa5d037686f85f573e9147a Mon Sep 17 00:00:00 2001 From: Andrew Date: Sun, 18 Feb 2024 02:27:47 +1030 Subject: [PATCH] Cleanup MarkReadReceiver --- .../securesms/notifications/MarkReadReceiver.kt | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/notifications/MarkReadReceiver.kt b/app/src/main/java/org/thoughtcrime/securesms/notifications/MarkReadReceiver.kt index b2fd0db760..f4032bc8c4 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/notifications/MarkReadReceiver.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/MarkReadReceiver.kt @@ -35,10 +35,9 @@ class MarkReadReceiver : BroadcastReceiver() { object : AsyncTask() { override fun doInBackground(vararg params: Void?): Void? { val currentTime = nowWithOffset - for (threadId in threadIds) { - Log.i(TAG, "Marking as read: $threadId") - val storage = shared.storage - storage.markConversationAsRead(threadId, currentTime, true) + threadIds.forEach { + Log.i(TAG, "Marking as read: $it") + shared.storage.markConversationAsRead(it, currentTime, true) } return null } @@ -59,8 +58,6 @@ class MarkReadReceiver : BroadcastReceiver() { context: Context, markedReadMessages: List ) { - Log.d(TAG, "process() called with: markedReadMessages = $markedReadMessages") - if (markedReadMessages.isEmpty()) return sendReadReceipts(context, markedReadMessages) @@ -131,8 +128,6 @@ class MarkReadReceiver : BroadcastReceiver() { context: Context, hashToMessage: Map ) { - Log.d(TAG, "fetchUpdatedExpiriesAndScheduleDeletion() called with: context = $context, hashToMessage = $hashToMessage") - @Suppress("UNCHECKED_CAST") val expiries = SnodeAPI.getExpiries(hashToMessage.keys.toList(), TextSecurePreferences.getLocalNumber(context)!!).get()["expiries"] as Map hashToMessage.forEach { (hash, info) -> expiries[hash]?.let { scheduleDeletion(context, info.expirationInfo, it - info.expirationInfo.expireStarted) } } @@ -143,8 +138,6 @@ class MarkReadReceiver : BroadcastReceiver() { expirationInfo: ExpirationInfo, expiresIn: Long = expirationInfo.expiresIn ) { - Log.d(TAG, "MarkReadReceiver#scheduleDeletion() called with: expirationInfo = $expirationInfo, expiresIn = $expiresIn") - if (expiresIn == 0L) return val now = nowWithOffset