From d3177f9f1a85ca772873fd4ec4f14d0d84c58e73 Mon Sep 17 00:00:00 2001 From: alansley Date: Tue, 30 Jul 2024 16:27:06 +1000 Subject: [PATCH] Added a 1 second kludge to the mute for subtitle so that it initially shows 1 hour not 59 minutes etc. --- .../main/java/org/thoughtcrime/securesms/MuteDialog.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/MuteDialog.kt b/app/src/main/java/org/thoughtcrime/securesms/MuteDialog.kt index e4cc9bdf1a..64b076effb 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/MuteDialog.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/MuteDialog.kt @@ -11,6 +11,7 @@ import org.session.libsignal.utilities.Log import java.time.Duration import java.util.concurrent.TimeUnit import kotlin.time.Duration.Companion.milliseconds +import kotlin.time.Duration.Companion.seconds fun showMuteDialog( context: Context, @@ -31,7 +32,12 @@ fun showMuteDialog( }.toTypedArray()) { // Note: We add the current timestamp to the mute duration to get the un-mute timestamp // that gets stored in the database via ConversationMenuHelper.mute(). - onMuteDuration(Option.entries[it].getTime() + System.currentTimeMillis()) + // Also: This is a kludge, but we ADD one second to the mute duration because otherwise by + // the time the view for how long the conversation is muted for gets set then it's actually + // less than the entire duration - so 1 hour becomes 59 minutes, 1 day becomes 23 hours etc. + // As we really want to see the actual set time (1 hour / 1 day etc.) then we'll bump it by + // 1 second which is neither here nor there in the grand scheme of things. + onMuteDuration(Option.entries[it].getTime() + System.currentTimeMillis() + 1.seconds.inWholeMilliseconds) } }