Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c14775d4e5 | ||
|
|
47e737f8ec | ||
|
|
c4926145f3 | ||
|
|
770a4756a4 | ||
|
|
f14f6f32f4 |
No files matched your search
@@ -74,3 +74,4 @@ Gemfile.lock
|
||||
|
||||
# Claude Code
|
||||
/CLAUDE.md
|
||||
.kotlin/
|
||||
@@ -2,6 +2,7 @@ package de.jeanlucmakiola.calendula.ui.common
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ColumnScope
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
@@ -131,7 +132,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, or through [footer], which
|
||||
* follows the options and gets [onDismiss].
|
||||
*/
|
||||
@Composable
|
||||
fun FixedTimeReminderPicker(
|
||||
@@ -141,6 +143,7 @@ fun FixedTimeReminderPicker(
|
||||
onDismiss: () -> Unit,
|
||||
inheritedLabel: String? = null,
|
||||
inherited: FixedTimeReminder? = null,
|
||||
footer: @Composable ColumnScope.(dismiss: () -> Unit) -> Unit = {},
|
||||
) {
|
||||
var current by rememberSaveable(stateSaver = FixedTimeOverrideSaver) { mutableStateOf(selected) }
|
||||
var editing by rememberSaveable { mutableStateOf(false) }
|
||||
@@ -192,6 +195,7 @@ fun FixedTimeReminderPicker(
|
||||
},
|
||||
)
|
||||
}
|
||||
footer(onDismiss)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import de.jeanlucmakiola.floret.identity.collapseExit
|
||||
import de.jeanlucmakiola.floret.identity.expandEnter
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.EnterExitState
|
||||
import android.Manifest
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
@@ -19,10 +20,13 @@ import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.relocation.BringIntoViewRequester
|
||||
import androidx.compose.foundation.relocation.bringIntoViewRequester
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight
|
||||
import androidx.compose.material.icons.automirrored.filled.OpenInNew
|
||||
import androidx.compose.material.icons.outlined.Info
|
||||
import androidx.compose.material.icons.outlined.NotificationsActive
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
@@ -108,6 +112,7 @@ internal fun NotificationsScreen(
|
||||
var showFixedDefault by remember { mutableStateOf(false) }
|
||||
var showDigestDay by remember { mutableStateOf(false) }
|
||||
var showDigestTime by remember { mutableStateOf(false) }
|
||||
var revealDigest by rememberSaveable { mutableStateOf(false) }
|
||||
val scope = rememberCoroutineScope()
|
||||
val channelStatus by viewModel.channelStatus.collectAsStateWithLifecycle()
|
||||
val digestBlocked by viewModel.digestBlocked.collectAsStateWithLifecycle()
|
||||
@@ -193,9 +198,14 @@ internal fun NotificationsScreen(
|
||||
|
||||
Spacer(Modifier.height(24.dp))
|
||||
DailyDigestRows(
|
||||
reveal = revealDigest,
|
||||
onRevealed = { revealDigest = false },
|
||||
digest = state.dailyDigest,
|
||||
blocked = channelStatus.appBlocked || digestBlocked,
|
||||
onEnable = toggleDigest,
|
||||
onEnable = {
|
||||
revealDigest = false
|
||||
toggleDigest(it)
|
||||
},
|
||||
onPickDay = { showDigestDay = true },
|
||||
onPickTime = { showDigestTime = true },
|
||||
onOpenSound = {
|
||||
@@ -257,6 +267,29 @@ internal fun NotificationsScreen(
|
||||
selected = state.defaultFixedTimeReminder?.let { FixedTimeOverride.At(it) } ?: FixedTimeOverride.Off,
|
||||
onSelect = { viewModel.setDefaultFixedTimeReminder((it as? FixedTimeOverride.At)?.reminder) },
|
||||
onDismiss = { showFixedDefault = false },
|
||||
footer = { dismiss ->
|
||||
// For those after one list of the day's events (#459).
|
||||
if (!state.dailyDigest.enabled) {
|
||||
Spacer(Modifier.height(24.dp))
|
||||
GroupedRow(
|
||||
title = stringResource(R.string.settings_digest_turn_on),
|
||||
summary = stringResource(R.string.settings_digest_hint),
|
||||
position = Position.Alone,
|
||||
leading = {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.NotificationsActive,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
},
|
||||
onClick = {
|
||||
revealDigest = true
|
||||
toggleDigest(true)
|
||||
dismiss()
|
||||
},
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
if (showDigestDay) {
|
||||
@@ -328,7 +361,8 @@ internal fun NotificationsScreen(
|
||||
|
||||
/**
|
||||
* The daily summary (#459): its switch, and once on, which day it lists, when,
|
||||
* and its channel's system settings.
|
||||
* and its channel's system settings. With [reveal], the block scrolls into view
|
||||
* once those rows have expanded, then reports [onRevealed].
|
||||
*/
|
||||
@Composable
|
||||
private fun DailyDigestRows(
|
||||
@@ -338,47 +372,59 @@ private fun DailyDigestRows(
|
||||
onPickDay: () -> Unit,
|
||||
onPickTime: () -> Unit,
|
||||
onOpenSound: () -> Unit,
|
||||
reveal: Boolean,
|
||||
onRevealed: () -> Unit,
|
||||
) {
|
||||
GroupedSwitchRow(
|
||||
title = stringResource(R.string.settings_digest),
|
||||
checked = digest.enabled,
|
||||
onCheckedChange = onEnable,
|
||||
summary = if (digest.enabled) {
|
||||
stringResource(
|
||||
R.string.settings_digest_summary,
|
||||
stringResource(digestDayLabel(digest.day)),
|
||||
settingsTimeOfDay(digest.timeMinutes),
|
||||
)
|
||||
} else {
|
||||
stringResource(R.string.settings_digest_hint)
|
||||
},
|
||||
position = if (digest.enabled) Position.Top else Position.Alone,
|
||||
)
|
||||
AnimatedVisibility(visible = digest.enabled, enter = expandEnter(), exit = collapseExit()) {
|
||||
Column {
|
||||
GroupedRow(
|
||||
title = stringResource(R.string.settings_digest_day),
|
||||
summary = stringResource(digestDayLabel(digest.day)),
|
||||
position = Position.Middle,
|
||||
onClick = onPickDay,
|
||||
)
|
||||
GroupedRow(
|
||||
title = stringResource(R.string.settings_digest_time),
|
||||
summary = settingsTimeOfDay(digest.timeMinutes),
|
||||
position = Position.Middle,
|
||||
onClick = onPickTime,
|
||||
)
|
||||
GroupedRow(
|
||||
title = stringResource(R.string.settings_notification_sound),
|
||||
summary = if (blocked) {
|
||||
stringResource(R.string.settings_notifications_blocked_hint)
|
||||
} else {
|
||||
stringResource(R.string.settings_digest_sound_hint)
|
||||
},
|
||||
position = Position.Bottom,
|
||||
trailing = { ExternalLinkIcon() },
|
||||
onClick = onOpenSound,
|
||||
)
|
||||
val requester = remember { BringIntoViewRequester() }
|
||||
Column(Modifier.bringIntoViewRequester(requester)) {
|
||||
GroupedSwitchRow(
|
||||
title = stringResource(R.string.settings_digest),
|
||||
checked = digest.enabled,
|
||||
onCheckedChange = onEnable,
|
||||
summary = if (digest.enabled) {
|
||||
stringResource(
|
||||
R.string.settings_digest_summary,
|
||||
stringResource(digestDayLabel(digest.day)),
|
||||
settingsTimeOfDay(digest.timeMinutes),
|
||||
)
|
||||
} else {
|
||||
stringResource(R.string.settings_digest_hint)
|
||||
},
|
||||
position = if (digest.enabled) Position.Top else Position.Alone,
|
||||
)
|
||||
AnimatedVisibility(visible = digest.enabled, enter = expandEnter(), exit = collapseExit()) {
|
||||
val settled = !transition.isRunning && transition.currentState == EnterExitState.Visible
|
||||
LaunchedEffect(settled, reveal) {
|
||||
if (settled && reveal) {
|
||||
requester.bringIntoView()
|
||||
onRevealed()
|
||||
}
|
||||
}
|
||||
Column {
|
||||
GroupedRow(
|
||||
title = stringResource(R.string.settings_digest_day),
|
||||
summary = stringResource(digestDayLabel(digest.day)),
|
||||
position = Position.Middle,
|
||||
onClick = onPickDay,
|
||||
)
|
||||
GroupedRow(
|
||||
title = stringResource(R.string.settings_digest_time),
|
||||
summary = settingsTimeOfDay(digest.timeMinutes),
|
||||
position = Position.Middle,
|
||||
onClick = onPickTime,
|
||||
)
|
||||
GroupedRow(
|
||||
title = stringResource(R.string.settings_notification_sound),
|
||||
summary = if (blocked) {
|
||||
stringResource(R.string.settings_notifications_blocked_hint)
|
||||
} else {
|
||||
stringResource(R.string.settings_digest_sound_hint)
|
||||
},
|
||||
position = Position.Bottom,
|
||||
trailing = { ExternalLinkIcon() },
|
||||
onClick = onOpenSound,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -808,6 +808,7 @@
|
||||
<string name="settings_fixed_reminder_hint">Added to new timed events, e.g. the evening before. It follows the event when you move it to another time.</string>
|
||||
<!-- Daily summary notification (#459) -->
|
||||
<string name="settings_digest">Daily summary</string>
|
||||
<string name="settings_digest_turn_on">Turn on daily summary</string>
|
||||
<string name="settings_digest_hint">One notification listing a day\'s events</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>
|
||||
|
||||
Reference in new issue
Block a user