mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 09:20:19 +01:00
Improved missed call state handling.
This commit is contained in:
committed by
Greyson Parrelli
parent
95fbd7a31c
commit
e60b32202e
@@ -1246,20 +1246,20 @@ object SyncMessageProcessor {
|
||||
|
||||
if (call != null) {
|
||||
log(envelopeTimestamp, "Synchronizing call log event with exact call data.")
|
||||
synchronizeCallLogEventViaTimestamp(envelopeTimestamp, callLogEvent.type, call.timestamp)
|
||||
synchronizeCallLogEventViaTimestamp(envelopeTimestamp, callLogEvent.type, call.timestamp, peer)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (timestamp != null) {
|
||||
warn(envelopeTimestamp, "Synchronize call log event using timestamp instead of exact values")
|
||||
synchronizeCallLogEventViaTimestamp(envelopeTimestamp, callLogEvent.type, timestamp)
|
||||
synchronizeCallLogEventViaTimestamp(envelopeTimestamp, callLogEvent.type, timestamp, peer)
|
||||
} else {
|
||||
log(envelopeTimestamp, "Failed to synchronize call log event, not enough information.")
|
||||
}
|
||||
}
|
||||
|
||||
private fun synchronizeCallLogEventViaTimestamp(envelopeTimestamp: Long, eventType: CallLogEvent.Type?, timestamp: Long) {
|
||||
private fun synchronizeCallLogEventViaTimestamp(envelopeTimestamp: Long, eventType: CallLogEvent.Type?, timestamp: Long, peer: RecipientId?) {
|
||||
when (eventType) {
|
||||
CallLogEvent.Type.CLEAR -> {
|
||||
SignalDatabase.calls.deleteNonAdHocCallEventsOnOrBefore(timestamp)
|
||||
@@ -1270,6 +1270,15 @@ object SyncMessageProcessor {
|
||||
SignalDatabase.calls.markAllCallEventsRead(timestamp)
|
||||
}
|
||||
|
||||
CallLogEvent.Type.MARKED_AS_READ_IN_CONVERSATION -> {
|
||||
if (peer == null) {
|
||||
warn(envelopeTimestamp, "Cannot synchronize conversation calls, missing peer.")
|
||||
return
|
||||
}
|
||||
|
||||
SignalDatabase.calls.markAllCallEventsWithPeerBeforeTimestampRead(peer, timestamp)
|
||||
}
|
||||
|
||||
else -> log(envelopeTimestamp, "Synchronize call log event has an invalid type $eventType, ignoring.")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user