From 2109ada5cf81b828c27d6cf475e908675bcea49f Mon Sep 17 00:00:00 2001 From: Michelle Tang Date: Fri, 28 Aug 2026 17:27:07 -0400 Subject: [PATCH] Minor notification updates. --- .../MuteUntilTimePickerBottomSheet.kt | 16 ++++------------ .../securesms/jobs/UnreadReminderJob.kt | 8 ++++---- app/src/main/res/values/strings.xml | 18 ++++++++++++++---- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/settings/conversation/MuteUntilTimePickerBottomSheet.kt b/app/src/main/java/org/thoughtcrime/securesms/components/settings/conversation/MuteUntilTimePickerBottomSheet.kt index b0267fc6db..6b035b475c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/settings/conversation/MuteUntilTimePickerBottomSheet.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/settings/conversation/MuteUntilTimePickerBottomSheet.kt @@ -1,6 +1,7 @@ package org.thoughtcrime.securesms.components.settings.conversation import android.text.format.DateFormat +import android.widget.Toast import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -44,14 +45,12 @@ import org.thoughtcrime.securesms.util.atUTC import org.thoughtcrime.securesms.util.formatHours import org.thoughtcrime.securesms.util.toLocalDateTime import org.thoughtcrime.securesms.util.toMillis -import java.time.DayOfWeek import java.time.LocalDateTime import java.time.LocalTime import java.time.ZoneId import java.time.ZoneOffset import java.time.ZonedDateTime import java.time.format.DateTimeFormatter -import java.time.temporal.TemporalAdjusters import java.util.Locale class MuteUntilTimePickerBottomSheet : ComposeBottomSheetDialogFragment() { @@ -75,16 +74,7 @@ class MuteUntilTimePickerBottomSheet : ComposeBottomSheetDialogFragment() { val now = remember { LocalDateTime.now() } val defaultDateTime = remember { - if (now.hour < 17) { - now.withHour(17).withMinute(0).withSecond(0).withNano(0) - } else { - val nextMorning = if (now.dayOfWeek == DayOfWeek.FRIDAY || now.dayOfWeek == DayOfWeek.SATURDAY || now.dayOfWeek == DayOfWeek.SUNDAY) { - now.with(TemporalAdjusters.next(DayOfWeek.MONDAY)) - } else { - now.plusDays(1) - } - nextMorning.withHour(8).withMinute(0).withSecond(0).withNano(0) - } + now.plusDays(1).withHour(8).withMinute(0).withSecond(0).withNano(0) } var selectedDate by remember { mutableLongStateOf(defaultDateTime.toMillis()) } @@ -164,6 +154,8 @@ class MuteUntilTimePickerBottomSheet : ComposeBottomSheetDialogFragment() { if (timestamp > System.currentTimeMillis()) { setFragmentResult(REQUEST_KEY, bundleOf(RESULT_TIMESTAMP to timestamp)) dismissAllowingStateLoss() + } else { + Toast.makeText(context, R.string.MuteUntilTimePickerBottomSheet__invalid, Toast.LENGTH_SHORT).show() } } ) diff --git a/app/src/main/java/org/thoughtcrime/securesms/jobs/UnreadReminderJob.kt b/app/src/main/java/org/thoughtcrime/securesms/jobs/UnreadReminderJob.kt index 9a293239d3..47bc071a1a 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/jobs/UnreadReminderJob.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/jobs/UnreadReminderJob.kt @@ -228,20 +228,20 @@ class UnreadReminderJob(private val threadId: Long, private val lastReminderTime val (oneRes, twoRes, manyRes) = when (reminderType) { ReminderType.MESSAGES, ReminderType.CALLS -> Triple(R.string.UnreadReminderJob__authors_one, R.string.UnreadReminderJob__authors_two, R.string.UnreadReminderJob__authors_many) - ReminderType.MENTIONS -> Triple(R.string.UnreadReminderJob__mentions_one, R.string.UnreadReminderJob__mentions_two, R.string.UnreadReminderJob__mentions_many) - ReminderType.REPLIES -> Triple(R.string.UnreadReminderJob__replies_one, R.string.UnreadReminderJob__replies_two, R.string.UnreadReminderJob__replies_many) + ReminderType.MENTIONS -> Triple(R.string.UnreadReminderJob__mentions_one, R.plurals.UnreadReminderJob__mentions_two, R.plurals.UnreadReminderJob__mentions_many) + ReminderType.REPLIES -> Triple(R.string.UnreadReminderJob__replies_one, R.plurals.UnreadReminderJob__replies_two, R.plurals.UnreadReminderJob__replies_many) } val includesCount = reminderType == ReminderType.MENTIONS || reminderType == ReminderType.REPLIES return when (authors.size) { 1 -> context.getString(oneRes, authors[0]) 2 -> if (includesCount) { - context.getString(twoRes, count, authors[0], authors[1]) + context.resources.getQuantityString(twoRes, count, count, authors[0], authors[1]) } else { context.getString(twoRes, authors[0], authors[1]) } else -> if (includesCount) { - context.getString(manyRes, count, authors[0]) + context.resources.getQuantityString(manyRes, count, count, authors[0]) } else { context.getString(manyRes, authors[0]) } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 07d92491f6..93fb6bb1f4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -3272,6 +3272,8 @@ Mute notifications All times in (%1$s) %2$s + + Invalid time Touch to open. @@ -9990,15 +9992,23 @@ a mention of you by %1$s - %1$d mentions of you by %2$s and %3$s + + %1$d mentions of you by %2$s and %3$s + - %1$d mentions of you by %2$s and others + + %1$d mentions of you by %2$s and others + a reply from %1$s - %1$d replies from %2$s and %3$s + + %1$d replies from %2$s and %3$s + - %1$d replies from %2$s and others + + %1$d replies from %2$s and others + Share contact