Calendar groups first in the manager, switched-off calendars kept but not offered (#166)

This commit is contained in:
makiolaj committed 2026-11-30 22:02:52 +01:00
1 parent 04281e79a7
commit f7329e45e3
2 files changed
+13 -11

No files matched your search

@@ -84,7 +84,7 @@ internal fun CalendarGroupsSection(
}
/**
* Create or edit a calendar group: its name over every calendar by account,
* Create or edit a calendar group: its name over [calendars] by account,
* checked ones being the members; the commit sits in the title bar.
*/
@Composable
@@ -222,9 +222,11 @@ fun CalendarsScreen(
isNew = editing == null,
initialName = editing?.name.orEmpty(),
initialMembers = editing?.resolve(calendars)?.mapTo(mutableSetOf()) { it.id }.orEmpty(),
calendars = calendars,
// Switched-off calendars aren't offered, but stay members.
calendars = calendars.filter { it.isVisibleInSystem },
onSave = { name, members ->
viewModel.saveGroup(editing?.id, name, members)
val switchedOff = editing?.resolve(calendars).orEmpty().filterNot { it.isVisibleInSystem }
viewModel.saveGroup(editing?.id, name, members + switchedOff)
groupEditorId = null
},
onDelete = {
@@ -297,6 +299,14 @@ private fun CalendarsList(
predictiveBack = true,
visible = visible,
) {
CalendarGroupsSection(
groups = calendarGroups,
calendars = local + synced,
onEdit = onEditGroup,
onAdd = onAddGroup,
)
Spacer(Modifier.height(16.dp))
// What the per-calendar / per-account switches below actually do.
GroupedHint(stringResource(R.string.calendars_visibility_hint), style = MaterialTheme.typography.bodySmall)
@@ -350,14 +360,6 @@ private fun CalendarsList(
onClick = onOpenBackup,
)
Spacer(Modifier.height(16.dp))
CalendarGroupsSection(
groups = calendarGroups,
calendars = local + synced,
onEdit = onEditGroup,
onAdd = onAddGroup,
)
Spacer(Modifier.height(16.dp))
// Synced calendars — read-only, grouped by account. Each account is a