Compare commits

..
2 changed files with 25 additions and 2 deletions

No files matched your search

@@ -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,7 @@ 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. [footer] follows the options.
*/
@Composable
fun FixedTimeReminderPicker(
@@ -141,6 +142,7 @@ fun FixedTimeReminderPicker(
onDismiss: () -> Unit,
inheritedLabel: String? = null,
inherited: FixedTimeReminder? = null,
footer: @Composable ColumnScope.() -> Unit = {},
) {
var current by rememberSaveable(stateSaver = FixedTimeOverrideSaver) { mutableStateOf(selected) }
var editing by rememberSaveable { mutableStateOf(false) }
@@ -192,6 +194,7 @@ fun FixedTimeReminderPicker(
},
)
}
footer()
}
}
@@ -19,6 +19,8 @@ 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
@@ -108,6 +110,7 @@ internal fun NotificationsScreen(
var showFixedDefault by remember { mutableStateOf(false) }
var showDigestDay by remember { mutableStateOf(false) }
var showDigestTime by remember { mutableStateOf(false) }
val digestRequester = remember { BringIntoViewRequester() }
val scope = rememberCoroutineScope()
val channelStatus by viewModel.channelStatus.collectAsStateWithLifecycle()
val digestBlocked by viewModel.digestBlocked.collectAsStateWithLifecycle()
@@ -193,6 +196,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 +261,21 @@ internal fun NotificationsScreen(
selected = state.defaultFixedTimeReminder?.let { FixedTimeOverride.At(it) } ?: FixedTimeOverride.Off,
onSelect = { viewModel.setDefaultFixedTimeReminder((it as? FixedTimeOverride.At)?.reminder) },
onDismiss = { showFixedDefault = false },
footer = {
// A pointer 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),
summary = stringResource(R.string.settings_digest_hint),
position = Position.Alone,
onClick = {
showFixedDefault = false
scope.launch { digestRequester.bringIntoView() }
},
)
}
},
)
}
if (showDigestDay) {
@@ -338,7 +357,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,