Skip to content

fix(weather): show complete weather widget gallery previews - #604

Merged
whes1015 merged 2 commits into
mainfrom
fix/ios-widget-gallery-forecast-preview
Oct 11, 2026
Merged

whes1015 merged 2 commits into
mainfrom
fix/ios-widget-gallery-forecast-preview

Conversation

@YinCheng0106

@YinCheng0106 YinCheng0106 commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

這個 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.sh 全部 gate 通過;Dart coverage 測試 3,115 通過、0 失敗、10 略過
tool/dev/test_ios.sh 338 通過、0 失敗、0 略過;結果來自完成的 .xcresult
Gallery Preview 測試 11 通過,包含於上述 338 項,沒有重複加總
tool/dev/build.sh ios --debug PASS;77.1 秒,unsigned 裝置建置
Widget Extension Runner.app/PlugIns/DPIPWidgetsExtension.appex 已包含,arm64 Mach-O 執行檔存在
本次 tool/check/commits.sh origin/main..HEAD 1 則提交通過
本次 tool/commit.sh --push 通過,0 blockers;格式/分析、codegen 與 coverage 等沿用內容雜湊快取,其他 gate 重新執行
本次差異/分支核對 git 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 讀者下載的附件。

略過與警告:

  • 10 項略過為 5 個開發預覽套件,以及 5 個缺少 intensity_ml_v1.onnx 的選用模型測試;沒有額外排除案例。
  • codegen 有 1 筆已移除參數提示(--delete-conflicting-outputs,寫入 0 outputs)。Flutter 測試有 3 筆既有 tap 未命中警告,相關測試仍通過;另有 323 筆測試 [WARN] 輸出,包含 session-only settings 與故障情境。
  • Swift .xcresult 記錄 89 筆建置警告、0 errors、0 analyzer warnings、0 執行期 warnings,涵蓋第三方 API 棄用、Sendable 與 XCTest 最低版本連結提示;沒有來自本 PR 四檔的編譯警告。unsigned 裝置建置另有停用 codesigning 提示。

待補證據與限制:

  • 現有 Gallery QA 資料夾沒有可用的前後截圖或深色模式截圖,因此本 PR 未附圖,也不把單元測試或建置成功當成視覺驗收。
  • 實體 iPhone Gallery、深色模式/文字對比度、輔助使用與不同系統版本的視覺驗收仍待補。
  • 本次沒有執行 EEW 實機驗收;提交差異沒有涉及 EEW 推估、警報門檻、通知路徑或背景定位。
  • 遠端 CI 與 ios.yml 結果待本 PR 建立後確認;本機成功不代表遠端已通過。以 Draft 保留這些待驗項目。

檢查清單

  • tool/check/commits.sh origin/main..HEAD 通過
  • 一個 commit 一件事:僅處理 Gallery 預覽與相應測試
  • 透過官方 tool/check.sh 完成格式/分析與完整 Dart 測試;本次推送前檢查通過(部分採內容雜湊快取)
  • tool/dev/test_ios.sh:338 通過、0 失敗;Gallery 11 項包含其中
  • 新的原生使用者可見標示走 String(localized:) 與 Localizable.xcstrings,本地化 gate 通過;原生 Widget 不適用 Flutter 的 AppLocalizations
  • UI 深色模式與文字對比度、前後截圖及深色模式截圖待補;沿用原生 Widget 版面,Flutter AppSpacing/AppRadius/AppMotion 不適用

@YinCheng0106 YinCheng0106 added the ios Issues or pull requests related to the iOS platform. label Oct 11, 2026
@YinCheng0106 YinCheng0106 self-assigned this Oct 11, 2026
@YinCheng0106 YinCheng0106 added this to the v26.4 milestone Oct 11, 2026
@codecov

codecov Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.42%. Comparing base (a89ec77) to head (2c623ba).

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@YinCheng0106
YinCheng0106 marked this pull request as ready for review October 11, 2026 15:45
Copilot AI balanced review requested due to automatic review settings October 11, 2026 15:45

This comment was marked as low quality.

@PiscesXD
PiscesXD force-pushed the fix/ios-widget-gallery-forecast-preview branch from 3faf4ee to 09f4e8a Compare October 11, 2026 16:50
@PiscesXD

Copy link
Copy Markdown
Member

我新增 small 的預覽,讓介面統一都有預覽

file-8f65c5b2fb47480520be87706a647869

YinCheng0106 and others added 2 commits October 12, 2026 05:51
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
whes1015 force-pushed the fix/ios-widget-gallery-forecast-preview branch from 09f4e8a to 2c623ba Compare October 11, 2026 21:51
@whes1015
whes1015 enabled auto-merge (rebase) October 11, 2026 21:51
@whes1015
whes1015 merged commit 5bd3388 into main Oct 11, 2026
8 checks passed
@whes1015
whes1015 deleted the fix/ios-widget-gallery-forecast-preview branch October 11, 2026 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ios Issues or pull requests related to the iOS platform. size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants