remove previous logic for expiring control messages indicating disappearing messages turned off

This commit is contained in:
Ryan ZHAO 2023-12-07 13:48:44 +11:00
parent 362dcd3528
commit 4ec1d730cd
46 changed files with 91 additions and 17 deletions

View file

@ -909,7 +909,7 @@ extension ConversationVC:
) :
"FOLLOW_SETTING_EXPLAINATION_TURNING_OFF".localized()
)
let modalConfirmTitle: String = messageDisappearingConfig.isEnabled ? "DISAPPERING_MESSAGES_SAVE_TITLE".localized() : ""
let modalConfirmTitle: String = messageDisappearingConfig.isEnabled ? "DISAPPERING_MESSAGES_SAVE_TITLE".localized() : "CONFIRM_BUTTON_TITLE".localized()
let confirmationModal: ConfirmationModal = ConfirmationModal(
info: ConfirmationModal.Info(
title: "FOLLOW_SETTING_TITLE".localized(),

View file

@ -474,19 +474,12 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel, Naviga
dependencies.storage.writeAsync(using: dependencies) { [threadId, threadVariant, dependencies] db in
_ = try updatedConfig.saved(db)
let currentOffsetTimestampMs: Int64 = SnodeAPI.currentOffsetTimestampMs()
var expiresInSeconds: TimeInterval? = 0
var expiresStartedAtMs: Double? = nil
if Features.useNewDisappearingMessagesConfig {
_ = try Interaction
.filter(Interaction.Columns.threadId == threadId)
.filter(Interaction.Columns.variant == Interaction.Variant.infoDisappearingMessagesUpdate)
.deleteAll(db)
expiresInSeconds = (updatedConfig.isEnabled ? nil : self.config.durationSeconds)
expiresStartedAtMs = (!updatedConfig.isEnabled && self.config.type == .disappearAfterSend ? Double(currentOffsetTimestampMs) : nil)
}
let interaction: Interaction = try Interaction(
@ -494,9 +487,7 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel, Naviga
authorId: getUserHexEncodedPublicKey(db, using: dependencies),
variant: .infoDisappearingMessagesUpdate,
body: updatedConfig.messageInfoString(with: nil, isPreviousOff: !self.config.isEnabled),
timestampMs: currentOffsetTimestampMs,
expiresInSeconds: expiresInSeconds,
expiresStartedAtMs: expiresStartedAtMs
timestampMs: SnodeAPI.currentOffsetTimestampMs()
)
.inserted(db)

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -843,3 +843,5 @@ The point that a message will disappear in a disappearing message update message
"YOU_DISAPPEARING_MESSAGES_INFO_ENABLE" = "You set your messages to disappear %@ after they have been %@.";
"YOU_DISAPPEARING_MESSAGES_INFO_DISABLE" = "You turned off disappearing messages. Messages you send will no longer disappear.";
"CONFIRM_BUTTON_TITLE" = "Confirm";

View file

@ -238,11 +238,8 @@ extension MessageReceiver {
isPreviousOff: !localConfig.isEnabled
),
timestampMs: Int64(timestampMs),
expiresInSeconds: (remoteConfig.isEnabled ? remoteConfig.durationSeconds : localConfig.durationSeconds),
expiresStartedAtMs: (!remoteConfig.isEnabled && localConfig.type == .disappearAfterSend ?
Double(timestampMs) :
nil
)
expiresInSeconds: remoteConfig.durationSeconds,
expiresStartedAtMs: (remoteConfig.type == .disappearAfterSend ? Double(timestampMs) : nil)
).inserted(db)
}