From f14f6f32f4a29c8270bb40725dbd439072f5b878 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Wed, 25 Nov 2026 12:04:13 +0100 Subject: [PATCH] fix(#459): point the set-time reminder picker to the daily summary --- .../ui/common/FixedTimeReminderUi.kt | 23 ++++++++++++++++++- .../ui/settings/NotificationSettings.kt | 18 ++++++++++++++- app/src/main/res/values/strings.xml | 1 + 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/ui/common/FixedTimeReminderUi.kt b/app/src/main/java/de/jeanlucmakiola/calendula/ui/common/FixedTimeReminderUi.kt index 111dad8f..f78fe9e9 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/ui/common/FixedTimeReminderUi.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/ui/common/FixedTimeReminderUi.kt @@ -9,7 +9,10 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight import androidx.compose.material3.FilledTonalButton +import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.material3.Text @@ -131,7 +134,8 @@ fun FixedTimeReminderEditor( * Picker for a fixed-time default (#459), full-screen: off, or a reminder at a * set time edited in place — and, on a per-calendar picker ([inheritedLabel] * non-null), deferring to the global default, [inherited], which also seeds the - * editor. Applies live; the user leaves via back. + * editor. Applies live; the user leaves via back. A non-null [onOpenDailySummary] + * adds a row leading to the daily summary, for a list of the day's events instead. */ @Composable fun FixedTimeReminderPicker( @@ -141,6 +145,7 @@ fun FixedTimeReminderPicker( onDismiss: () -> Unit, inheritedLabel: String? = null, inherited: FixedTimeReminder? = null, + onOpenDailySummary: (() -> Unit)? = null, ) { var current by rememberSaveable(stateSaver = FixedTimeOverrideSaver) { mutableStateOf(selected) } var editing by rememberSaveable { mutableStateOf(false) } @@ -192,6 +197,22 @@ fun FixedTimeReminderPicker( }, ) } + if (onOpenDailySummary != null) { + Spacer(Modifier.height(24.dp)) + GroupedRow( + title = stringResource(R.string.settings_digest), + summary = stringResource(R.string.settings_fixed_reminder_digest_link), + position = Position.Alone, + trailing = { + Icon( + imageVector = Icons.AutoMirrored.Filled.KeyboardArrowRight, + contentDescription = null, + tint = MaterialTheme.colorScheme.onSurfaceVariant, + ) + }, + onClick = onOpenDailySummary, + ) + } } } diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/NotificationSettings.kt b/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/NotificationSettings.kt index ac60a9b1..6079e765 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/NotificationSettings.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/NotificationSettings.kt @@ -15,6 +15,8 @@ import android.widget.Toast import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.contract.ActivityResultContracts import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.relocation.BringIntoViewRequester +import androidx.compose.foundation.relocation.bringIntoViewRequester import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth @@ -108,6 +110,14 @@ internal fun NotificationsScreen( var showFixedDefault by remember { mutableStateOf(false) } var showDigestDay by remember { mutableStateOf(false) } var showDigestTime by remember { mutableStateOf(false) } + var revealDigest by remember { mutableStateOf(false) } + val digestRequester = remember { BringIntoViewRequester() } + LaunchedEffect(revealDigest) { + if (revealDigest) { + digestRequester.bringIntoView() + revealDigest = false + } + } val scope = rememberCoroutineScope() val channelStatus by viewModel.channelStatus.collectAsStateWithLifecycle() val digestBlocked by viewModel.digestBlocked.collectAsStateWithLifecycle() @@ -193,6 +203,7 @@ internal fun NotificationsScreen( Spacer(Modifier.height(24.dp)) DailyDigestRows( + modifier = Modifier.bringIntoViewRequester(digestRequester), digest = state.dailyDigest, blocked = channelStatus.appBlocked || digestBlocked, onEnable = toggleDigest, @@ -257,6 +268,10 @@ internal fun NotificationsScreen( selected = state.defaultFixedTimeReminder?.let { FixedTimeOverride.At(it) } ?: FixedTimeOverride.Off, onSelect = { viewModel.setDefaultFixedTimeReminder((it as? FixedTimeOverride.At)?.reminder) }, onDismiss = { showFixedDefault = false }, + onOpenDailySummary = { + showFixedDefault = false + revealDigest = true + }, ) } if (showDigestDay) { @@ -338,7 +353,8 @@ private fun DailyDigestRows( onPickDay: () -> Unit, onPickTime: () -> Unit, onOpenSound: () -> Unit, -) { + modifier: Modifier = Modifier, +) = Column(modifier) { GroupedSwitchRow( title = stringResource(R.string.settings_digest), checked = digest.enabled, diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 11c2e328..3ae3eb25 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -809,6 +809,7 @@ Daily summary One notification listing a day\'s events + Want one list of tomorrow\'s events instead? %1$s at %2$s Lists