mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-23 00:17:34 +00:00
Cleanup MarkReadReceiver
This commit is contained in:
parent
66dcae04f6
commit
2e50dc08bb
@ -35,10 +35,9 @@ class MarkReadReceiver : BroadcastReceiver() {
|
|||||||
object : AsyncTask<Void?, Void?, Void?>() {
|
object : AsyncTask<Void?, Void?, Void?>() {
|
||||||
override fun doInBackground(vararg params: Void?): Void? {
|
override fun doInBackground(vararg params: Void?): Void? {
|
||||||
val currentTime = nowWithOffset
|
val currentTime = nowWithOffset
|
||||||
for (threadId in threadIds) {
|
threadIds.forEach {
|
||||||
Log.i(TAG, "Marking as read: $threadId")
|
Log.i(TAG, "Marking as read: $it")
|
||||||
val storage = shared.storage
|
shared.storage.markConversationAsRead(it, currentTime, true)
|
||||||
storage.markConversationAsRead(threadId, currentTime, true)
|
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@ -59,8 +58,6 @@ class MarkReadReceiver : BroadcastReceiver() {
|
|||||||
context: Context,
|
context: Context,
|
||||||
markedReadMessages: List<MarkedMessageInfo>
|
markedReadMessages: List<MarkedMessageInfo>
|
||||||
) {
|
) {
|
||||||
Log.d(TAG, "process() called with: markedReadMessages = $markedReadMessages")
|
|
||||||
|
|
||||||
if (markedReadMessages.isEmpty()) return
|
if (markedReadMessages.isEmpty()) return
|
||||||
|
|
||||||
sendReadReceipts(context, markedReadMessages)
|
sendReadReceipts(context, markedReadMessages)
|
||||||
@ -131,8 +128,6 @@ class MarkReadReceiver : BroadcastReceiver() {
|
|||||||
context: Context,
|
context: Context,
|
||||||
hashToMessage: Map<String, MarkedMessageInfo>
|
hashToMessage: Map<String, MarkedMessageInfo>
|
||||||
) {
|
) {
|
||||||
Log.d(TAG, "fetchUpdatedExpiriesAndScheduleDeletion() called with: context = $context, hashToMessage = $hashToMessage")
|
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
val expiries = SnodeAPI.getExpiries(hashToMessage.keys.toList(), TextSecurePreferences.getLocalNumber(context)!!).get()["expiries"] as Map<String, Long>
|
val expiries = SnodeAPI.getExpiries(hashToMessage.keys.toList(), TextSecurePreferences.getLocalNumber(context)!!).get()["expiries"] as Map<String, Long>
|
||||||
hashToMessage.forEach { (hash, info) -> expiries[hash]?.let { scheduleDeletion(context, info.expirationInfo, it - info.expirationInfo.expireStarted) } }
|
hashToMessage.forEach { (hash, info) -> expiries[hash]?.let { scheduleDeletion(context, info.expirationInfo, it - info.expirationInfo.expireStarted) } }
|
||||||
@ -143,8 +138,6 @@ class MarkReadReceiver : BroadcastReceiver() {
|
|||||||
expirationInfo: ExpirationInfo,
|
expirationInfo: ExpirationInfo,
|
||||||
expiresIn: Long = expirationInfo.expiresIn
|
expiresIn: Long = expirationInfo.expiresIn
|
||||||
) {
|
) {
|
||||||
Log.d(TAG, "MarkReadReceiver#scheduleDeletion() called with: expirationInfo = $expirationInfo, expiresIn = $expiresIn")
|
|
||||||
|
|
||||||
if (expiresIn == 0L) return
|
if (expiresIn == 0L) return
|
||||||
|
|
||||||
val now = nowWithOffset
|
val now = nowWithOffset
|
||||||
|
Loading…
x
Reference in New Issue
Block a user