Minor notification updates.

This commit is contained in:
Michelle Tang
2026-09-02 16:11:26 -03:00
committed by Alex Hart
parent 44f40d50bd
commit 2109ada5cf
3 changed files with 22 additions and 20 deletions
@@ -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()
}
}
)
@@ -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])
}
+14 -4
View File
@@ -3272,6 +3272,8 @@
<string name="MuteUntilTimePickerBottomSheet__mute_notifications">Mute notifications</string>
<!-- Subtitle in a dialog that describes the timezone the user is picking times in. The first placeholder is a UTC offset, and the second placeholder is a user-friendly name for the timezone, e.g. "All times in (GMT-05:00) Eastern Standard Time" -->
<string name="MuteUntilTimePickerBottomSheet__timezone_disclaimer">All times in (%1$s) %2$s</string>
<!-- Toast shown when choosing an invalid date to mute until (eg a date in the past) -->
<string name="MuteUntilTimePickerBottomSheet__invalid">Invalid time</string>
<!-- KeyCachingService -->
<string name="KeyCachingService_signal_passphrase_cached">Touch to open.</string>
@@ -9990,15 +9992,23 @@
<!-- Notification placeholder that sums up a single unread mention. Placeholder is the name of the person who sent the message -->
<string name="UnreadReminderJob__mentions_one">a mention of you by %1$s</string>
<!-- Notification placeholder that sums up unread mentions from two people. First placeholder is the number of mentions, second and third are the names of the people who sent them -->
<string name="UnreadReminderJob__mentions_two">%1$d mentions of you by %2$s and %3$s</string>
<plurals name="UnreadReminderJob__mentions_two">
<item quantity="other">%1$d mentions of you by %2$s and %3$s</item>
</plurals>
<!-- Notification placeholder that sums up unread mentions from three or more people. First placeholder is the number of mentions, second is the name of one person who sent them -->
<string name="UnreadReminderJob__mentions_many">%1$d mentions of you by %2$s and others</string>
<plurals name="UnreadReminderJob__mentions_many">
<item quantity="other">%1$d mentions of you by %2$s and others</item>
</plurals>
<!-- Notification placeholder that sums up a single unread reply. Placeholder is the name of the person who sent the message -->
<string name="UnreadReminderJob__replies_one">a reply from %1$s</string>
<!-- Notification placeholder that sums up unread replies from two people. First placeholder is the number of replies, second and third are the names of the people who sent them -->
<string name="UnreadReminderJob__replies_two">%1$d replies from %2$s and %3$s</string>
<plurals name="UnreadReminderJob__replies_two">
<item quantity="other">%1$d replies from %2$s and %3$s</item>
</plurals>
<!-- Notification placeholder that sums up unread replies from three or more people. First placeholder is the number of replies, second is the name of one person who sent them -->
<string name="UnreadReminderJob__replies_many">%1$d replies from %2$s and others</string>
<plurals name="UnreadReminderJob__replies_many">
<item quantity="other">%1$d replies from %2$s and others</item>
</plurals>
<!-- Title of the screen where the user chooses which parts of a contact to share -->
<string name="ShareContactScreen__share_contact">Share contact</string>