Only notify call observer if read status changed.

This commit is contained in:
Greyson Parrelli
2024-10-17 11:18:21 -04:00
parent 4c9bdd16b0
commit 65996bca19

View File

@@ -112,12 +112,15 @@ class CallTable(context: Context, databaseHelper: SignalDatabase) : DatabaseTabl
}
fun markAllCallEventsRead(timestamp: Long = Long.MAX_VALUE) {
writableDatabase.update(TABLE_NAME)
val updateCount = writableDatabase
.update(TABLE_NAME)
.values(READ to ReadState.serialize(ReadState.READ))
.where("$TIMESTAMP <= ?", timestamp)
.where("$TIMESTAMP <= ? AND $READ != ?", timestamp, ReadState.serialize(ReadState.READ))
.run()
notifyConversationListListeners()
if (updateCount > 0) {
notifyConversationListListeners()
}
}
fun markAllCallEventsWithPeerBeforeTimestampRead(peer: RecipientId, timestamp: Long): Call? {