From b8a7191fbe4a9023597b812aa1ab610896c22923 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Tue, 23 Jun 2026 09:59:44 +0200 Subject: [PATCH] fix(nav): bring external new-event/open-date to the front The create form and Settings/calendar-manager are sibling overlays in one Box, with Settings drawn above the form. An external 'new event' request (QS tile, launcher shortcut, widget) set the create state correctly but rendered the form underneath an open Settings, forcing the user to back out first. Dismiss the covering overlays (Settings, calendar manager, detail/edit, import) when handling a Create or OpenDate nav request, so the requested destination is revealed on top. Fixes the same latent bug for the shortcut and widget. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../calendula/ui/CalendarHost.kt | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/ui/CalendarHost.kt b/app/src/main/java/de/jeanlucmakiola/calendula/ui/CalendarHost.kt index 941f80f..9629464 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/ui/CalendarHost.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/ui/CalendarHost.kt @@ -137,16 +137,37 @@ fun CalendarHost( } } + // Close every overlay that can sit over the calendar, so an externally + // requested destination (a widget/shortcut/QS-tile launch) is revealed on + // top instead of underneath whatever the user had open. + fun dismissCoveringOverlays() { + showSettings = false + showCalendars = false + detailKey = null + editKey = null + importUri = null + importForm = null + } + // A home-screen widget launch asks to open a date (→ day view) or start a // create. Handled once and cleared, mirroring [requestedDetailKey]. LaunchedEffect(widgetNavRequest) { when (val req = widgetNavRequest) { is WidgetNavRequest.OpenDate -> { + // Reveal the day view: drop any overlay that would cover it, so + // an external date-open doesn't land under an open Settings/form. + dismissCoveringOverlays() + createDateIso = null pendingDayIso = req.dateIso view = CalendarView.Day onWidgetNavConsumed() } is WidgetNavRequest.Create -> { + // External "new event" entries (QS tile / launcher shortcut / + // widget) must land on top of whatever is open — the form overlay + // sits below Settings/calendars in the Box, so without this it + // would open hidden underneath them. + dismissCoveringOverlays() val iso = req.dateIso ?: Clock.System.now() .toLocalDateTime(TimeZone.currentSystemDefault()).date.toString() heldCreateIso = iso