Start disappearing after sent

This commit is contained in:
charles 2022-12-21 12:46:43 +11:00
parent 92b30739f0
commit 7d25fd9f4c
2 changed files with 3 additions and 2 deletions

View File

@ -554,7 +554,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
val recipient = viewModel.recipient ?: return
if (viewModel.recipient?.disappearingState == DisappearingState.LEGACY &&
viewModel.expirationConfiguration?.isEnabled == true &&
!ExpirationConfiguration.isNewConfigEnabled
ExpirationConfiguration.isNewConfigEnabled
) {
binding?.outdatedBannerTextView?.text =
resources.getString(R.string.activity_conversation_outdated_client_banner_text, recipient.name)

View File

@ -161,7 +161,7 @@ class Storage(context: Context, helper: SQLCipherOpenHelper) : Database(context,
val expirationConfig = getExpirationConfiguration(message.threadID ?: -1)
val expiresIn = expirationConfig?.durationSeconds ?: 0
val expireStartedAt = if (expirationConfig?.expirationType == ExpirationType.DELETE_AFTER_SEND) {
message.sentTimestamp!! + (expirationConfig.durationSeconds * 1000L)
message.sentTimestamp!! + (expiresIn * 1000L)
} else 0
if (message.isMediaMessage() || attachments.isNotEmpty()) {
val quote: Optional<QuoteModel> = if (quotes != null) Optional.of(quotes) else Optional.absent()
@ -212,6 +212,7 @@ class Storage(context: Context, helper: SQLCipherOpenHelper) : Database(context,
DatabaseComponent.get(context).lokiMessageDatabase().setMessageServerHash(id, serverHash)
}
}
SSKEnvironment.shared.messageExpirationManager.startAnyExpiration(message.sentTimestamp!!, message.sender!!, expireStartedAt)
return messageID
}