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 Code
|
||||||
/CLAUDE.md
|
/CLAUDE.md
|
||||||
|
.kotlin/
|
||||||
@@ -2,6 +2,7 @@ package de.jeanlucmakiola.calendula.ui.common
|
|||||||
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.ColumnScope
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
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
|
* 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]
|
* set time edited in place — and, on a per-calendar picker ([inheritedLabel]
|
||||||
* non-null), deferring to the global default, [inherited], which also seeds the
|
* 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
|
@Composable
|
||||||
fun FixedTimeReminderPicker(
|
fun FixedTimeReminderPicker(
|
||||||
@@ -141,6 +143,7 @@ fun FixedTimeReminderPicker(
|
|||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
inheritedLabel: String? = null,
|
inheritedLabel: String? = null,
|
||||||
inherited: FixedTimeReminder? = null,
|
inherited: FixedTimeReminder? = null,
|
||||||
|
footer: @Composable ColumnScope.(dismiss: () -> Unit) -> Unit = {},
|
||||||
) {
|
) {
|
||||||
var current by rememberSaveable(stateSaver = FixedTimeOverrideSaver) { mutableStateOf(selected) }
|
var current by rememberSaveable(stateSaver = FixedTimeOverrideSaver) { mutableStateOf(selected) }
|
||||||
var editing by rememberSaveable { mutableStateOf(false) }
|
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 de.jeanlucmakiola.floret.identity.expandEnter
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
|
import androidx.compose.animation.EnterExitState
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
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.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
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.Icons
|
||||||
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight
|
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight
|
||||||
import androidx.compose.material.icons.automirrored.filled.OpenInNew
|
import androidx.compose.material.icons.automirrored.filled.OpenInNew
|
||||||
import androidx.compose.material.icons.outlined.Info
|
import androidx.compose.material.icons.outlined.Info
|
||||||
|
import androidx.compose.material.icons.outlined.NotificationsActive
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
@@ -108,6 +112,7 @@ internal fun NotificationsScreen(
|
|||||||
var showFixedDefault by remember { mutableStateOf(false) }
|
var showFixedDefault by remember { mutableStateOf(false) }
|
||||||
var showDigestDay by remember { mutableStateOf(false) }
|
var showDigestDay by remember { mutableStateOf(false) }
|
||||||
var showDigestTime by remember { mutableStateOf(false) }
|
var showDigestTime by remember { mutableStateOf(false) }
|
||||||
|
var revealDigest by rememberSaveable { mutableStateOf(false) }
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
val channelStatus by viewModel.channelStatus.collectAsStateWithLifecycle()
|
val channelStatus by viewModel.channelStatus.collectAsStateWithLifecycle()
|
||||||
val digestBlocked by viewModel.digestBlocked.collectAsStateWithLifecycle()
|
val digestBlocked by viewModel.digestBlocked.collectAsStateWithLifecycle()
|
||||||
@@ -193,9 +198,14 @@ internal fun NotificationsScreen(
|
|||||||
|
|
||||||
Spacer(Modifier.height(24.dp))
|
Spacer(Modifier.height(24.dp))
|
||||||
DailyDigestRows(
|
DailyDigestRows(
|
||||||
|
reveal = revealDigest,
|
||||||
|
onRevealed = { revealDigest = false },
|
||||||
digest = state.dailyDigest,
|
digest = state.dailyDigest,
|
||||||
blocked = channelStatus.appBlocked || digestBlocked,
|
blocked = channelStatus.appBlocked || digestBlocked,
|
||||||
onEnable = toggleDigest,
|
onEnable = {
|
||||||
|
revealDigest = false
|
||||||
|
toggleDigest(it)
|
||||||
|
},
|
||||||
onPickDay = { showDigestDay = true },
|
onPickDay = { showDigestDay = true },
|
||||||
onPickTime = { showDigestTime = true },
|
onPickTime = { showDigestTime = true },
|
||||||
onOpenSound = {
|
onOpenSound = {
|
||||||
@@ -257,6 +267,29 @@ internal fun NotificationsScreen(
|
|||||||
selected = state.defaultFixedTimeReminder?.let { FixedTimeOverride.At(it) } ?: FixedTimeOverride.Off,
|
selected = state.defaultFixedTimeReminder?.let { FixedTimeOverride.At(it) } ?: FixedTimeOverride.Off,
|
||||||
onSelect = { viewModel.setDefaultFixedTimeReminder((it as? FixedTimeOverride.At)?.reminder) },
|
onSelect = { viewModel.setDefaultFixedTimeReminder((it as? FixedTimeOverride.At)?.reminder) },
|
||||||
onDismiss = { showFixedDefault = false },
|
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) {
|
if (showDigestDay) {
|
||||||
@@ -328,7 +361,8 @@ internal fun NotificationsScreen(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The daily summary (#459): its switch, and once on, which day it lists, when,
|
* 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
|
@Composable
|
||||||
private fun DailyDigestRows(
|
private fun DailyDigestRows(
|
||||||
@@ -338,47 +372,59 @@ private fun DailyDigestRows(
|
|||||||
onPickDay: () -> Unit,
|
onPickDay: () -> Unit,
|
||||||
onPickTime: () -> Unit,
|
onPickTime: () -> Unit,
|
||||||
onOpenSound: () -> Unit,
|
onOpenSound: () -> Unit,
|
||||||
|
reveal: Boolean,
|
||||||
|
onRevealed: () -> Unit,
|
||||||
) {
|
) {
|
||||||
GroupedSwitchRow(
|
val requester = remember { BringIntoViewRequester() }
|
||||||
title = stringResource(R.string.settings_digest),
|
Column(Modifier.bringIntoViewRequester(requester)) {
|
||||||
checked = digest.enabled,
|
GroupedSwitchRow(
|
||||||
onCheckedChange = onEnable,
|
title = stringResource(R.string.settings_digest),
|
||||||
summary = if (digest.enabled) {
|
checked = digest.enabled,
|
||||||
stringResource(
|
onCheckedChange = onEnable,
|
||||||
R.string.settings_digest_summary,
|
summary = if (digest.enabled) {
|
||||||
stringResource(digestDayLabel(digest.day)),
|
stringResource(
|
||||||
settingsTimeOfDay(digest.timeMinutes),
|
R.string.settings_digest_summary,
|
||||||
)
|
stringResource(digestDayLabel(digest.day)),
|
||||||
} else {
|
settingsTimeOfDay(digest.timeMinutes),
|
||||||
stringResource(R.string.settings_digest_hint)
|
)
|
||||||
},
|
} else {
|
||||||
position = if (digest.enabled) Position.Top else Position.Alone,
|
stringResource(R.string.settings_digest_hint)
|
||||||
)
|
},
|
||||||
AnimatedVisibility(visible = digest.enabled, enter = expandEnter(), exit = collapseExit()) {
|
position = if (digest.enabled) Position.Top else Position.Alone,
|
||||||
Column {
|
)
|
||||||
GroupedRow(
|
AnimatedVisibility(visible = digest.enabled, enter = expandEnter(), exit = collapseExit()) {
|
||||||
title = stringResource(R.string.settings_digest_day),
|
val settled = !transition.isRunning && transition.currentState == EnterExitState.Visible
|
||||||
summary = stringResource(digestDayLabel(digest.day)),
|
LaunchedEffect(settled, reveal) {
|
||||||
position = Position.Middle,
|
if (settled && reveal) {
|
||||||
onClick = onPickDay,
|
requester.bringIntoView()
|
||||||
)
|
onRevealed()
|
||||||
GroupedRow(
|
}
|
||||||
title = stringResource(R.string.settings_digest_time),
|
}
|
||||||
summary = settingsTimeOfDay(digest.timeMinutes),
|
Column {
|
||||||
position = Position.Middle,
|
GroupedRow(
|
||||||
onClick = onPickTime,
|
title = stringResource(R.string.settings_digest_day),
|
||||||
)
|
summary = stringResource(digestDayLabel(digest.day)),
|
||||||
GroupedRow(
|
position = Position.Middle,
|
||||||
title = stringResource(R.string.settings_notification_sound),
|
onClick = onPickDay,
|
||||||
summary = if (blocked) {
|
)
|
||||||
stringResource(R.string.settings_notifications_blocked_hint)
|
GroupedRow(
|
||||||
} else {
|
title = stringResource(R.string.settings_digest_time),
|
||||||
stringResource(R.string.settings_digest_sound_hint)
|
summary = settingsTimeOfDay(digest.timeMinutes),
|
||||||
},
|
position = Position.Middle,
|
||||||
position = Position.Bottom,
|
onClick = onPickTime,
|
||||||
trailing = { ExternalLinkIcon() },
|
)
|
||||||
onClick = onOpenSound,
|
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>
|
<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) -->
|
<!-- Daily summary notification (#459) -->
|
||||||
<string name="settings_digest">Daily summary</string>
|
<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>
|
<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. -->
|
<!-- %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_summary">%1$s at %2$s</string>
|
||||||
|
|||||||
Reference in new issue
Block a user