fix: exclude managed special-dates calendars from .ics export
The contact special-dates mirror calendars (birthdays/anniversaries) are derived from contacts and re-materialise from the contact sync, so backing them up only duplicates events on restore. Skip managed calendars in exportableEvents — covers both the manual export and the auto-backup, which share this path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -613,10 +613,13 @@ class AndroidCalendarDataSource @Inject constructor(
|
|||||||
|
|
||||||
override fun exportableEvents(): List<IcsEvent> {
|
override fun exportableEvents(): List<IcsEvent> {
|
||||||
// Only the local calendars the app owns and can write — synced calendars
|
// Only the local calendars the app owns and can write — synced calendars
|
||||||
// already have a backup (their server). Map id → display name for the
|
// already have a backup (their server). Exclude the managed special-dates
|
||||||
|
// mirror calendars: their events are derived from contacts, not authored
|
||||||
|
// here, and re-materialise from the contact sync — backing them up would
|
||||||
|
// just duplicate them on restore. Map id → display name for the
|
||||||
// X-CALENDULA-CALENDAR tag a restore uses to fan back out.
|
// X-CALENDULA-CALENDAR tag a restore uses to fan back out.
|
||||||
val names = calendars()
|
val names = calendars()
|
||||||
.filter { it.isLocal && it.canModifyContents }
|
.filter { it.isLocal && it.canModifyContents && !it.isManaged }
|
||||||
.associate { it.id to it.displayName }
|
.associate { it.id to it.displayName }
|
||||||
if (names.isEmpty()) return emptyList()
|
if (names.isEmpty()) return emptyList()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user