Skip to content

fix(weather): keep iOS widget forecast warnings readable - #657

Open
YinCheng0106 wants to merge 7 commits into
mainfrom
fix/ios-widget-stale-forecast-layout
Open

YinCheng0106 wants to merge 7 commits into
mainfrom
fix/ios-widget-stale-forecast-layout

Conversation

@YinCheng0106

@YinCheng0106 YinCheng0106 commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

這個 PR 做了什麼

改善 iOS 天氣小工具在預報資料過舊時的資訊呈現,避免警示文字擠壓每小時預報區域,並統一 Medium 與 Large Widget 的警示位置、字體樣式及無障礙語意。

本次以保留既有 UI 設計為原則,調整過期提示的版面配置,補強不同語系、字級及固定卡片尺寸下的回歸測試。

正式程式碼

  • ios/DPIPWidgets/DPIPWidgets.swift

    • Medium Widget:
      • 將過期預報提示移至標頭的觀測時間左側。
      • 使用 ViewThatFits,空間不足時切換為警示圖示。
      • 將提示字級統一為 .caption2,與觀測時間保持一致。
      • 保留 iOS 15 的警示圖示備援。
    • Large Widget:
      • 將一般字級下的過期提示從預報區下方移至觀測時間左側。
      • 過期提示與觀測時間統一使用 .caption2。
      • 空間不足時切換為帶有本地化無障礙標籤的警示圖示。
      • 避免同一個過期狀態重複顯示警示。
    • 保留既有輔助使用版面的警示呈現方式。
    • 保留五欄預報內容、天氣圖示及更新行為。
    • 統一重新整理圖示為 18 pt、medium 字重,維持 44 × 44 pt 按鈕範圍。
    • 補充過舊、過期、無預報及長地名等預覽情境。
  • ios/DPIPWidgetIntentsExtension/Localizable.xcstrings

    • 補齊 Current Location 的日文、韓文及簡體中文翻譯。

測試與驗證

  • ios/RunnerTests/ForecastWidgetTests.swift

    • 補充不同語系與字級的版面診斷。
    • 驗證過期預報提示、觀測時間、預報內容及更新按鈕。
    • 驗證 Fresh、Expired、Unavailable 狀態不會錯誤顯示過期警示。
  • ios/WidgetFixture/

    • 建立使用正式 Widget View 的測試 Fixture。
    • 支援固定預報資料、語系、字級、地名及卡片尺寸設定。
    • 提供可重現的 UI 截圖與幾何驗證環境。
  • ios/WidgetFixtureUITests/MediumWeatherUITests.swift

    • 驗證 Medium Widget 的警示位置、本地化文字、圖示備援及更新按鈕。
    • 新增 4 項 Large Widget 測試,涵蓋:
      • 繁體中文及英文警示文字。
      • 日文窄標頭的圖示備援。
      • 過期警示僅出現一次。
      • 警示位於觀測時間之前。
      • 更新按鈕的無障礙標籤及操作區域。
      • 非過期狀態不顯示錯誤警示。
  • .github/workflows/ios.yml

    • 補強 iOS Widget 相關測試與 CI 驗證流程。
  • ios/Runner.xcodeproj/project.pbxproj

    • 加入 Widget Fixture 與 UI Test 所需的 Xcode 專案設定。
  • tool/dev/test_widget_ui.sh

    • 提供 Widget UI 測試執行入口。

Rebase

已將分支 Rebase 至更新後的 main。

  • Base:19ae25bff798584c0c714b18f71259c40cbf4f41
  • Rebase 後 HEAD:31c3ebe281fab33c187ec28f9121b4c4e62dc594
  • 使用 git range-diff 確認原有 6 筆提交的修改內容等價。
  • 保留既有 UI 修正,並額外新增無障礙測試提交。
  • 確認上游 Xcode 專案變更與 Widget Fixture 設定均已保留。

已知限制

  • Large Widget 在窄卡尺寸及部分較大的 Dynamic Type 字級下,仍可能發生底部明細裁切。
  • 極大輔助使用字級下,更新按鈕可能超出 Widget 可視範圍。
  • 本次未調整 Large Widget 的 Dynamic Type 切換條件或重新設計無障礙版面。
  • 尚未完成 iOS 實體裝置、WidgetKit 主畫面 VoiceOver、iOS 15/16 執行階段備援及線上重新整理互動驗證。

上述問題將獨立追蹤,避免擴大本次 PR 的修改範圍。

相關 issue

沒有對應的 issue。

已搜尋既有 Widget、預報及無障礙相關議題,未找到直接對應本次修復的項目。

怎麼驗

自動化測試

驗證項目 結果
RunnerTests 421 項通過
WidgetFixtureUITests 19 項通過
Flutter Tests 3,696 項通過、11 項跳過
Xcode 專案解析 通過
Runner / Widget Extension 建置 通過
本機專案 Gates 通過

WidgetKit 實際畫面

測試環境:

  • iPhone 17 Pro Simulator
  • iOS 26.5
  • Medium / Large Widget
  • 繁體中文
  • 淺色與深色外觀
  • Fresh / Stale 預報狀態

驗證結果:

  • Medium 與 Large 的過期警示位置符合預期。
  • Large 預報區下方不再重複顯示過期提示。
  • 原有五欄預報、更新按鈕及天氣資訊維持不變。
  • 以修正前版本為基準,8 組 Medium / Large 一般字級 Fixture 截圖逐像素相同。

無障礙驗證

  • iOS 27.2 Simulator 的英文 Large Fixture 已使用系統 VoiceOver 驗證。
  • VoiceOver 會先朗讀預報過期警示,再朗讀觀測時間。
  • 警示圖示備援具有完整的本地化無障礙標籤。
  • 更新按鈕保留 Button 角色及本地化標籤。
  • 輔助使用版面的原有顯示行為未變更。

尚未驗證

  • iOS 實體裝置。
  • WidgetKit 主畫面的 VoiceOver 操作。
  • iOS 15/16 執行階段備援。
  • 線上預報重新整理互動。

檢查清單

  • tool/check/commits.sh origin/main..HEAD 通過
    —— commit 訊息就是更新日誌,格式見 commit.md
    (本機報告顯示 Gates 全過,合併前仍需核對此項)
  • 一個 commit 一件事(這條 gate 驗不了,靠自己和 review)
  • mise exec -- flutter analyze 與 mise exec -- flutter test 通過
    (Flutter 測試已通過;需確認 analyze 的獨立執行結果)
  • 新的使用者可見字串都走本地化資源,沒有寫死
    (iOS 原生 Widget 使用 String Catalog,不適用 Flutter AppLocalizations)
  • CI 全部通過(gh pr checks:每一項都是 pass 或 skipped)
    —— 沒過不能合併
  • 有 UI 變更的話:用的是 AppSpacing / AppRadius / AppMotion,
    深色模式看過,文字對比度可接受
    (本次為原生 SwiftUI,不適用 Flutter UI Tokens;深色模式已檢視,
    仍需確認完整文字對比度驗收)

@YinCheng0106
YinCheng0106 marked this pull request as ready for review November 4, 2026 17:46
Copilot AI balanced review requested due to automatic review settings November 4, 2026 17:46

This comment was marked as low quality.

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

codecov Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.40%. Comparing base (19ae25b) to head (31c3ebe).

☔ 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.

Platform: ios

Fix(zh-Hant): 舊預報提示移至中型天氣小工具標頭,保留觀測時間並調整重新整理圖示大小
Fix(en-US): move stale forecast warnings into the Medium weather widget header, preserve observation times and balance refresh icons
Fix(zh-Hant): 補齊天氣小工具「所在地」設定的日文、韓文及簡體中文翻譯
Fix(en-US): complete Japanese, Korean and Simplified Chinese translations for the widget's Current Location option
Platform: ios

Fix(zh-Hant): 將大型天氣小工具的預報過期警示移到觀測時間旁,並統一中型小工具的警示與時間字級
Fix(en-US): Move the large weather widget's stale forecast warning beside the observation time and match the medium widget's warning and time text sizes
@YinCheng0106
YinCheng0106 force-pushed the fix/ios-widget-stale-forecast-layout branch from 3e37184 to 31c3ebe Compare November 12, 2026 15:51
@YinCheng0106 YinCheng0106 changed the title fix(weather): keep iOS widget forecast presentation readable fix(weather): keep iOS widget forecast warnings readable Nov 12, 2026
@YinCheng0106

YinCheng0106 commented Nov 13, 2026 •

Copy link
Copy Markdown
Member Author

Widget UI Preview

本次調整 Medium 與 Large Widget 的預報狀態呈現,統一過期提示的位置與字體樣式,並兼顧不同語系及輔助使用情境下的可讀性。

Medium

Medium (Stale) Medium (Expired Forecast) Medium (Stale, JA, Accessibility)
Medium (Stale) Medium (Expired Forecast) Medium (Stale, JA, Accessibility)
過期預報提示:將警示移至觀測時間左側,避免占用預報區域,維持五欄預報的完整性與可讀性。 預報失效狀態:停止顯示失效的逐時預報,改以狀態提示與重新整理按鈕,引導使用者取得最新資料。 日文輔助使用版面:以警示圖示節省標頭空間,保留完整的無障礙朗讀標籤,並以精簡排列呈現預報資訊。

Large

Large (Stale) Large (Expired Forecast) Large (Stale, JA, Accessibility)
Large (Stale) Large (Expired Forecast) Large (Stale, JA, Accessibility)
過期預報提示:與 Medium 統一設計,將警示移至觀測時間左側,移除預報下方的重複文字,保留完整的天氣明細區域。 預報失效狀態:以明確的狀態提示取代失效預報,同時保留目前天氣、濕度、降雨量等觀測資訊及重新整理功能。 日文輔助使用版面:將警示圖示整合至觀測時間旁,搭配本地化無障礙標籤,減少文字放大及長語系造成的版面壓力。

This branch has not been deployed

No deployments
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/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants