Add tappable cloud cover override - #27
Open
JWAY21 wants to merge 4 commits into
Open
Conversation
Tapping the "xx% clouds" label on the home screen now presents a confirmation dialog with five presets (0/25/50/75/100 %). Selecting one stores the choice in a new `cloudCoverOverride` published property and proportionally adjusts `currentUV` using a linear cloud-transmission model (0 % → 1.00×, 100 % → 0.15×), back-calculated through the API cloud cover at fetch time. The override clears automatically on the next successful API fetch. When active the label turns yellow and shows a pencil indicator; a "Reset to weather data" option restores the original values. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move .confirmationDialog from the cloud Button to its parent VStack so it reliably presents on iOS. Also add .contentShape(Rectangle()) and vertical padding to the Button label to give a larger tap target. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Two improvements to the cloud cover override calculation: 1. Anchor to real clear-sky UV — the API returns uvIndexClearSkyMax alongside uvIndexMax. The ratio between them gives the actual cloud transmission factor Open-Meteo computed, so we scale the current hourly UV by (clearSkyMax / cloudMax) to get an accurate clear-sky hourly estimate, rather than back-calculating through a guessed model. 2. Non-linear transmission lookup — cloud cover vs UV attenuation is not linear (WMO empirical data: 50% clouds ≈ 28% reduction, not 42%). Replace the linear formula with a 5-point interpolated lookup: 0%→1.00, 25%→0.90, 50%→0.72, 75%→0.45, 100%→0.17. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… ratio The uvIndexClearSkyMax/uvIndexMax daily ratio was ≈1.0 because the daily peak UV typically occurs when clouds are thinnest — making the ratio useless for non-peak hours. Drop the clearSkyUV stored property and instead compute clear-sky on demand: clearSkyUV = apiUV / cloudTransmission(apiCloudCover). Self-consistent with the override table and works correctly per hour. Result: at 59% cloud / UV 8.2, selecting 0% now gives UV 13.1 (correct), and 100% gives UV 1.4 (correct). Previously 0% was stuck at 8.2. Co-Authored-By: Claude Sonnet 4.6 <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.
Summary
The "xx% clouds" label on the home screen is now tappable. Tapping presents a sheet with five preset cloud cover levels; selecting one proportionally adjusts the displayed UV index to match actual observed conditions, overriding the API value.
Buttonwraps the existing cloud/iconHStack; no layout change when inactiveVerified in simulator
At 59 % clouds / UV 8.2:
Files changed
Test plan
🤖 Generated with Claude Code