Repository navigation
fix(weather): show complete weather widget gallery previews - #604
Merged
Merged
Conversation
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
October 11, 2026 15:45
PiscesXD
force-pushed
the
fix/ios-widget-gallery-forecast-preview
branch
from
October 11, 2026 16:50
3faf4ee to
09f4e8a
Compare
Member
PiscesXD
approved these changes
Oct 11, 2026
whes1015
approved these changes
Oct 11, 2026
Platform: ios Fix(zh-Hant): 修正首次加入天氣小工具時預覽缺少逐小時預報的問題 Fix(en-US): fix missing hourly forecasts in first-time weather widget gallery previews
Platform: ios Fix(zh-Hant): 修正首次加入小尺寸天氣小工具時預覽只顯示「尚無天氣資料」的問題 Fix(en-US): fix the small weather widget gallery preview showing "no weather data" when first added
whes1015
force-pushed
the
fix/ios-widget-gallery-forecast-preview
branch
from
October 11, 2026 21:51
09f4e8a to
2c623ba
Compare
whes1015
enabled auto-merge (rebase)
October 11, 2026 21:51
4 of 5 tasks
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 天氣小工具首次開啟 Gallery 時,Medium/Large 預覽可能缺少逐小時預報的問題。預覽優先採用符合設定地點且仍可顯示的有效快取;資料不足時,整組改用標示「預覽地點」的代表性資料,避免將模擬預報混入真實觀測。
正式程式碼:
ios/DPIPWidgets/DPIPWidgetProviderSupport.swift:加入純記憶體預覽資料與 snapshot 選擇邏輯。fallback 限於isPreview、Medium/Large 與有效地點;有效且符合來源、行政區、期限及可見時段的快取仍優先使用。範例預報依 Asia/Taipei 的下一個整點產生五個時段,支援跨午夜。ios/DPIPWidgets/DPIPWidgets.swift:傳入context.isPreview;Medium/Large placeholder 與 Canvas 共用完整範例。Small 原有快取與 placeholder 行為維持原樣。ios/DPIPWidgets/Localizable.xcstrings:新增widget.preview_location,涵蓋繁體中文、簡體中文、英文、日文與韓文。測試:
ios/RunnerTests/ForecastWidgetTests.swift:新增 11 個 Gallery 測試,涵蓋無快取、有效快取優先、過期/無可見時段、Small、一般 snapshot/timeline、地點切換、無效地點、跨午夜/不同裝置時區,以及持久化檔案不變。差異僅上述四檔(434 行新增、101 行刪除),一則提交
3faf4eef655ee313d627a18d26be04553f06f2ce,base 為1271afb31ddcab7e22b804db125239d115044c69。沒有修改正式getTimeline、網路更新、快取寫入、Forecast Expiry、EEW 或build_info.g.dart的提交內容;預覽資料不寫入 App Group。相關 issue
無
怎麼驗
已核對指定 HEAD 的既有最終驗證紀錄與完整日誌,並確認目前 1,821 個追蹤檔案的實體 SHA-256 與驗證基準一致(包含 skip-worktree 的檔案)。下列完整測試與建置為該次既有執行結果,本次準備 PR 沒有宣稱重新執行 Swift 測試或裝置建置。
DPIP_NO_CACHE=1 tool/check.shtool/dev/test_ios.sh.xcresulttool/dev/build.sh ios --debugRunner.app/PlugIns/DPIPWidgetsExtension.appex已包含,arm64 Mach-O 執行檔存在tool/check/commits.sh origin/main..HEADtool/commit.sh --pushgit diff --check通過;四檔限定差異;無 merge commit;未落後遠端 main環境:Xcode 27.0(27A266a),Swift 測試使用 iPhone 16 Pro/iOS 18.6 Simulator(arm64)。本機原始驗證檔案保留於
/tmp/dpip-gallery-final-20261011-lncbgz34/;此路徑為本機證據,不是可供 GitHub 讀者下載的附件。略過與警告:
intensity_ml_v1.onnx的選用模型測試;沒有額外排除案例。--delete-conflicting-outputs,寫入 0 outputs)。Flutter 測試有 3 筆既有 tap 未命中警告,相關測試仍通過;另有 323 筆測試[WARN]輸出,包含 session-only settings 與故障情境。.xcresult記錄 89 筆建置警告、0 errors、0 analyzer warnings、0 執行期 warnings,涵蓋第三方 API 棄用、Sendable 與 XCTest 最低版本連結提示;沒有來自本 PR 四檔的編譯警告。unsigned 裝置建置另有停用 codesigning 提示。待補證據與限制:
ios.yml結果待本 PR 建立後確認;本機成功不代表遠端已通過。以 Draft 保留這些待驗項目。檢查清單
tool/check/commits.sh origin/main..HEAD通過tool/check.sh完成格式/分析與完整 Dart 測試;本次推送前檢查通過(部分採內容雜湊快取)tool/dev/test_ios.sh:338 通過、0 失敗;Gallery 11 項包含其中String(localized:)與Localizable.xcstrings,本地化 gate 通過;原生 Widget 不適用 Flutter 的AppLocalizationsAppSpacing/AppRadius/AppMotion不適用