feat(weather): add configurable iOS weather widget locations - #579
Open
YinCheng0106 wants to merge 1 commit into
Open
YinCheng0106 wants to merge 1 commit into
YinCheng0106 wants to merge 1 commit into
Conversation
Platform: ios New(zh-Hant): 天氣小工具支援每個實例選擇所在地或已儲存地區,並使用獨立地區快取 New(en-US): Allow each iOS weather widget to select Current Location or a saved region with independent per-location snapshots
Codecov Report✅ All modified and coverable lines are covered by tests. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
YinCheng0106
marked this pull request as ready for review
September 22, 2026 03:01
This branch has not been deployed
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.
這個 PR 做了什麼
讓每個 iOS Weather Widget instance 可以獨立選擇:
並將目前天氣 snapshot 從單一全域檔案擴充為 per-location cache,使多個 Widget 可以同時顯示不同地點。
此 PR 是 Widget 開發堆疊的第三階段,建立可設定 Widget 與 per-location snapshot contract;Widget Extension 自行抓取天氣則由後續 PR 處理。
主要變更
Widget configuration
WeatherWidgetConfigurationIntentIntentConfigurationLocation target
穩定 identifier:
current-locationregion:<regionCode>無效或未知 identifier 會 fail closed,不會自動 fallback 到所在地。
Per-location snapshot
目前天氣 snapshot schema 升級至 v5,新增:
sourceIdentifier檔案範例:
WidgetSnapshots/current-weather/current-location.jsonWidgetSnapshots/current-weather/region-242.json每個 Widget instance 只讀取與自身 target 相符的 snapshot。
Migration
舊的:
WidgetSnapshots/current-weather.json暫時保留 migration fallback,但只有來源可以被證明與 Widget target 相符時才會顯示。
安全與一致性
sourceIdentifier與 payloadregionCode。sourceIdentifier會拒絕。sourceIdentifier寫入對應 per-location cache。已人工驗證
可同時建立多個 Widget,分別顯示不同地點,例如:
且彼此 snapshot 不會互相覆蓋。
測試涵蓋
不包含
目前 Widget Extension 尚不會自行向天氣 API 取得資料。
若該地點尚未由 DPIP App 載入並發布 snapshot,Widget 不會自行更新。
此 PR 不包含:
Native self-refresh 將由下一支 PR:
feat/ios-widget-weather-refresh處理。
PR Stack
依賴:
feat/ios-widget-configurationfeat/ios-widget-current-weather後續:
feat/ios-widget-weather-refresh檢查清單