refactor: start looking at how to incorporate the user config changes to the expiry message update times and where to read values from

pull/1313/head
0x330a 11 months ago
parent 6998ae7c88
commit 0e30d14b96
No known key found for this signature in database
GPG Key ID: 267811D6E6A2698C

@ -1671,6 +1671,19 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co
}
override fun getExpirationConfiguration(threadId: Long): ExpirationConfiguration? {
val recipient = getRecipientForThread(threadId) ?: return null
return if (recipient.isContactRecipient && recipient.address.serialize().startsWith(IdPrefix.STANDARD.value)) {
// read it from contacts config if exists
configFactory.contacts?.get(recipient.address.serialize())?.let { contact ->
contact.expiryMode
}
} else if (recipient.isClosedGroupRecipient) {
// read it from group config if exists
val groupPublicKey = GroupUtil.doubleDecodeGroupId(recipient.address.serialize())
configFactory.userGroups?.getLegacyGroupInfo(groupPublicKey)?.let {
}
} else null
return DatabaseComponent.get(context).expirationConfigurationDatabase().getExpirationConfiguration(threadId)
}

@ -152,7 +152,7 @@ class BatchMessageReceiveJob(
try {
when (message) {
is VisibleMessage -> {
MessageReceiver.updateExpiryIfNeeded(message, proto, openGroupID)
MessageReceiver.updateExpiryIfNeeded(message, proto, openGroupID, newLastSeen)
val isUserBlindedSender =
message.sender == serverPublicKey?.let {
SodiumUtilities.blindedKeyPair(

@ -270,7 +270,7 @@ fun handleMessageRequestResponse(message: MessageRequestResponse) {
}
//endregion
fun MessageReceiver.updateExpiryIfNeeded(message: Message, proto: SignalServiceProtos.Content, openGroupID: String?) {
fun MessageReceiver.updateExpiryIfNeeded(message: Message, proto: SignalServiceProtos.Content, openGroupID: String?, lastSeen: Long) {
val storage = MessagingModuleConfiguration.shared.storage
val sentTime = message.sentTimestamp ?: throw MessageReceiver.Error.InvalidMessage

Loading…
Cancel
Save