Fix legacy expiration timer update handling

This commit is contained in:
charles 2022-12-19 08:47:42 +11:00
parent 9e004cd09a
commit 8a51c8882c

View File

@ -157,11 +157,11 @@ fun MessageReceiver.cancelTypingIndicatorsIfNeeded(senderPublicKey: String) {
} }
private fun MessageReceiver.handleExpirationTimerUpdate(message: ExpirationTimerUpdate) { private fun MessageReceiver.handleExpirationTimerUpdate(message: ExpirationTimerUpdate) {
if (!ExpirationConfiguration.isNewConfigEnabled) return if (ExpirationConfiguration.isNewConfigEnabled) return
val recipient = Recipient.from(MessagingModuleConfiguration.shared.context, Address.fromSerialized(message.sender!!), false) val recipient = Recipient.from(MessagingModuleConfiguration.shared.context, Address.fromSerialized(message.sender!!), false)
val type = when { val type = when {
recipient.isLocalNumber -> ExpirationType.DELETE_AFTER_READ recipient.isContactRecipient -> ExpirationType.DELETE_AFTER_READ
recipient.isContactRecipient || recipient.isGroupRecipient -> ExpirationType.DELETE_AFTER_SEND recipient.isGroupRecipient -> ExpirationType.DELETE_AFTER_SEND
else -> null else -> null
} }
SSKEnvironment.shared.messageExpirationManager.setExpirationTimer(message, type?.number) SSKEnvironment.shared.messageExpirationManager.setExpirationTimer(message, type?.number)