mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-03-04 00:08:35 +00:00
Fix unnecessary timer change message insert on sync messages.
This commit is contained in:
@@ -343,7 +343,7 @@ class InternalConversationSettingsFragment : DSLSettingsFragment(
|
||||
TextUtils.concat(
|
||||
colorize("DeleteSync", capabilities.deleteSync),
|
||||
", ",
|
||||
colorize("Expire Timer Version", capabilities.versionedExpirationTimer)
|
||||
colorize("VersionedExpirationTimer", capabilities.versionedExpirationTimer)
|
||||
)
|
||||
} else {
|
||||
"Recipient not found!"
|
||||
|
||||
@@ -35,6 +35,7 @@ public final class LogSectionCapabilities implements LogSection {
|
||||
|
||||
StringBuilder builder = new StringBuilder().append("-- Local").append("\n")
|
||||
.append("DeleteSync: ").append(localCapabilities.getDeleteSync()).append("\n")
|
||||
.append("VersionedExpirationTimer: ").append(localCapabilities.getVersionedExpirationTimer()).append("\n")
|
||||
.append("\n")
|
||||
.append("-- Global").append("\n");
|
||||
|
||||
|
||||
@@ -130,6 +130,7 @@ import java.util.Optional
|
||||
import java.util.UUID
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.time.Duration
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
object SyncMessageProcessor {
|
||||
|
||||
@@ -669,7 +670,7 @@ object SyncMessageProcessor {
|
||||
|
||||
@Throws(MmsException::class)
|
||||
private fun handleSynchronizeSentExpirationUpdate(sent: Sent, sideEffect: Boolean = false): Long {
|
||||
log(sent.timestamp!!, "Synchronize sent expiration update.")
|
||||
log(sent.timestamp!!, "Synchronize sent expiration update. sideEffect: $sideEffect")
|
||||
|
||||
val groupId: GroupId? = getSyncMessageDestination(sent).groupId.orNull()
|
||||
|
||||
@@ -694,8 +695,12 @@ object SyncMessageProcessor {
|
||||
SignalDatabase.messages.markAsSent(messageId, true)
|
||||
} else if (sent.message!!.expireTimerVersion!! >= recipient.expireTimerVersion) {
|
||||
SignalDatabase.recipients.setExpireMessages(recipient.id, sent.message!!.expireTimerDuration.inWholeSeconds.toInt(), sent.message!!.expireTimerVersion!!)
|
||||
val messageId: Long = SignalDatabase.messages.insertMessageOutbox(expirationUpdateMessage, threadId, false, null)
|
||||
SignalDatabase.messages.markAsSent(messageId, true)
|
||||
|
||||
if (sent.message!!.expireTimerDuration != recipient.expiresInSeconds.seconds) {
|
||||
log(sent.timestamp!!, "Not inserted update message as timer value did not change")
|
||||
val messageId: Long = SignalDatabase.messages.insertMessageOutbox(expirationUpdateMessage, threadId, false, null)
|
||||
SignalDatabase.messages.markAsSent(messageId, true)
|
||||
}
|
||||
} else {
|
||||
warn(sent.timestamp!!, "[SynchronizeExpiration] Ignoring expire timer update with old version. Received: ${sent.message!!.expireTimerVersion}, Current: ${recipient.expireTimerVersion}")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user