Skip to content

Fix widget showing 'London' when current location fails to load#112

Merged
daneden merged 17 commits intomainfrom
claude/fix-widget-location-bug-2I7il
Jan 28, 2026
Merged

Fix widget showing 'London' when current location fails to load#112
daneden merged 17 commits intomainfrom
claude/fix-widget-location-bug-2I7il

Conversation

@daneden
Copy link
Owner

@daneden daneden commented Jan 19, 2026

When users configure widgets to use their current location but the location fetch fails, the widget was incorrectly falling back to displaying "London" as the location. This fix changes the behavior to return nil instead, which causes the widget to properly display the placeholder/null state (WidgetMissingLocationView) until the location can be successfully fetched on the next update.

The fix maintains backward compatibility - .defaultLocation is still used for actual placeholders and preview contexts where isRealLocation is false.

Fixes the bug introduced in PR #109.

claude and others added 17 commits January 19, 2026 14:14
When users configure widgets to use their current location but the
location fetch fails, the widget was incorrectly falling back to
displaying "London" as the location. This fix changes the behavior
to return nil instead, which causes the widget to properly display
the placeholder/null state (WidgetMissingLocationView) until the
location can be successfully fetched on the next update.

The fix maintains backward compatibility - .defaultLocation is still
used for actual placeholders and preview contexts where isRealLocation
is false.

Fixes the bug introduced in PR #109.
Refresh only at the end of the day as opposed to refreshing after the next solar event
The timeline refreshes 15 minutes after the most recent failure
Generate timeline entries for today plus the next 2 days instead of
only the current day. This prevents the widget from exhausting its
timeline entries by end of day.

Each day gets its own Solar object for accurate sunrise/sunset times,
and the relevance calculation uses the correct solar data for that
specific day.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace three nearly-identical timeline provider structs with a single
SolsticeTimelineProvider that accepts widgetKind and recommendation
description as parameters.

This removes ~40 lines of duplicated boilerplate while maintaining
the same functionality.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
With only one concrete timeline provider implementation, the protocol
adds no value. Inline conformance to IntentTimelineProvider directly
in SolsticeTimelineProvider struct.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Make CountdownWidgetView, SolarChartWidgetView, and SundialWidgetView
conform to SolsticeWidgetView protocol, removing duplicated computed
properties for solar and location that are now provided by the
protocol extension.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add hasValidData and shouldShowPlaceholder helpers to SolsticeWidgetView
protocol. All widget views now consistently:
- Show normal content when location/solar data is available
- Show a redacted placeholder for temporary failures (location update
  or reverse geocoding failed)
- Show WidgetMissingLocationView for authorization issues

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Unbelievably it's a bug that occurs when scenePhase and backgroundTask are both present in the App struct: https://stackoverflow.com/questions/78967079/adding-backgroundtask-to-windowgroup-breaks-accentcolor
Base the day loop on startOfDay instead of currentDate so the timeline
generates entries for 3 complete days rather than starting partway
through the first day.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@daneden daneden merged commit b02ecad into main Jan 28, 2026
4 checks passed
@daneden daneden deleted the claude/fix-widget-location-bug-2I7il branch January 28, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants