Fix widget showing 'London' when current location fails to load#112
Merged
Fix widget showing 'London' when current location fails to load#112
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.