fix(#459): point the set-time reminder picker to the daily summary

This commit is contained in:
makiolaj committed 2026-11-25 12:04:13 +01:00
1 parent a24420edfb
commit f14f6f32f4
3 files changed
+40 -2

No files matched your search

@@ -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,
)
}
}
}
@@ -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,
+1
View File
@@ -809,6 +809,7 @@
<!-- Daily summary notification (#459) -->
<string name="settings_digest">Daily summary</string>
<string name="settings_digest_hint">One notification listing a day\'s events</string>
<string name="settings_fixed_reminder_digest_link">Want one list of tomorrow\'s events instead?</string>
<!-- %1$s is settings_digest_day_today/tomorrow, %2$s a clock time. -->
<string name="settings_digest_summary">%1$s at %2$s</string>
<string name="settings_digest_day">Lists</string>