Repository navigation
feat(eew): add iOS EEW Live Activity prototype - #610
Draft
YinCheng0106 wants to merge 7 commits into
Draft
YinCheng0106 wants to merge 7 commits into
YinCheng0106 wants to merge 7 commits into
Conversation
Platform: ios New(zh-Hant): 開發者頁面可測試地震速報即時動態,檢視鎖定畫面與動態島的震度、倒數及資料未提供狀態 New(en-US): preview mock EEW Live Activities from the developer page with intensity, countdown, and unavailable states on the Lock Screen and Dynamic Island
Platform: ios New(zh-Hant): 開發者頁面可立即或延遲 8 秒測試地震速報即時動態的到波提醒 New(en-US): test EEW Live Activity arrival alerts immediately or after an 8-second delay from the developer page
Platform: ios Fix(zh-Hant): 修正地震速報延遲抵達提醒的背景工作處理 Fix(en-US): fix background task handling for delayed EEW arrival alerts
Platform: ios Fix(zh-Hant): 地震速報動態島依可用寬度顯示彩色震度徽章與完整倒數,空間不足時改用時鐘圖示,避免文字裁切 Fix(en-US): show colored intensity badges and complete countdowns in the EEW Dynamic Island, with a clock fallback when space is limited to prevent clipping
Codecov Report✅ All modified and coverable lines are covered by tests. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Platform: ios Fix(zh-Hant): 修正地震速報動態島在 iOS 26 SDK 的建置相容性 Fix(en-US): restore earthquake alert Dynamic Island build compatibility with the iOS 26 SDK
|
🔍 OpenCodeReview found 4 issue(s) in this PR.
|
Platform: ios Fix(zh-Hant): 修正地震速報開發者測試遇到非預期錯誤時無法正常顯示錯誤與恢復操作的問題 Fix(en-US): fix error reporting and recovery when EEW developer mock controls encounter unexpected failures
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 地震速報 Live Activity 用戶端原型,讓團隊先審查 ActivityKit 狀態、鎖定畫面、動態島及明確到波提醒。所有操作都來自 DEBUG 開發者頁面的本機 mock;這份 PR 保持 Draft,尚不具備正式 EEW 服務能力。
正式程式碼:
ios/Shared/EEWActivityAttributes.swift定義活動與內容狀態;ios/Runner/EEWLiveActivityManager.swift、EEWLiveActivityPlugin.swift及lib/core/platform/eew_live_activity.dart提供 mock 開始、報數更新、明確到波、結束與重啟後辨識既有活動。ios/DPIPWidgets/EEWLiveActivity.swift提供 Lock Screen、Dynamic Island Expanded、Compact/Minimal,以及當地震度/報告最大震度、ETA 缺漏、TEST 提示與無障礙語意。ios/Runner/AppDelegate.swift僅在 DEBUG 註冊 Flutter bridge;Info.plist宣告 Live Activities 支援。沿用DPIPWidgetsBundle.swift的既有 extension,project.pbxproj將 EEW 共用檔案加入 Runner 與 DPIPWidgetsExtension,並加入原生測試及提醒字串資源;沒有新增 extension target。ios/DPIPWidgets/Localizable.xcstrings僅新增 EEW 使用的字串,既有 Weather Widget 字串未變動。waveArrived更新可附帶AlertConfiguration,提醒文案由ios/Runner/EEWLiveActivityAlerts.xcstrings提供。lib/features/settings/presentation/pages/developer_page.dart提供 DEBUG 立即與延遲 8 秒到波提醒 QA;延遲工作處理重複排程、取消、活動結束及背景工作到期,背景工作只結束一次。Triggered代表 ActivityKit 更新已送出,不等於系統已呈現提醒、展開動態島或播放音效。ios/Shared/EEWIslandLayout.swift依系統提議的寬度選擇完整候選;iOS 27 寬度限制提示有 availability guard,較舊版本使用尺寸選擇。Compact/Minimal 依序減少裝飾及資訊,保留完整弱/強分類,最後退為圖示,避免裁切文字。ios/Shared/EEWPresentation.swift沿用 DPIP 標準視覺的 0–9 離散震度色票,保留 5弱、5強、6弱、6強,依背景選擇黑/白文字。徽章、完整純文字及波形圖示依可用寬度退讓;TEST 裝飾退讓時仍保留測試用途的無障礙提示。倒數保留系統管理的 m:ss:
Text(timerInterval:)已在受測情境中呈現可靠的自動倒數更新。秒數限定格式曾被調查,但其背景更新、總秒數格式、零點停止及 OS 相容性未獲充分驗證,因此保留已驗證的系統 timer。完整倒數放不下時,自適應佈局改用時鐘圖示。0:00 與時鐘圖示都不表示地震波已抵達;到波必須由明確狀態更新設定waveArrived。 沒有新增每秒 Timer、每秒Activity.update迴圈或每秒推播。測試與正式程式碼分開:
ios/RunnerTests/EEWPresentationTests.swift涵蓋震度色票、至少 4.5:1 的徽章文字對比、弱/強與 spoken mapping、正常/受限/極窄寬度、大字級、ETA 缺漏、明確到波、9:59/10:00、小數秒進位、時鐘 fallback 與倒數置中。timer 字形以 ImageRenderer 比較受限與完整參考圖,另用獨立 m:ss 對照確保 fixture 未退化為只有零秒。ios/RunnerTests/EEWLiveActivityManagerTests.swift涵蓋 silent/alert 到波、重複與非有效活動拒絕、到波保留、提醒資源,以及可控制延遲的排程、取消、背景到期與清理。倒數過期不會自動推導到波或觸發提醒。本 PR 未實作:正式 EEW 事件串接、伺服器端活動生命週期、push-to-start token 註冊、遠端 ActivityKit 更新、正式 APNs 傳送、正式端到端驗證。
Activity.request使用pushType: nil;沒有後端 API 變更,也沒有修改無關 Weather Widget 功能、相依套件或生成檔。相關 issue
怎麼驗
本次於 2026-10-15,針對 HEAD
19317cfd926e1f105cf60fee8338637a4fff0e19執行:origin/main(9645d7b07c9b43653e0bbb95c2275eada880f6b5);分支領先 4、落後 0,沒有 merge commit。DPIP_NO_CACHE=1 tool/commit.sh --push通過,實際執行完整tool/check.sh:格式檢查 1,090 個檔案、0 變更,靜態分析無問題;tooling、l10n、lockfile、通知音效、build info、Widget 鄉鎮資源、layering、storage、codegen 全部通過;codegen 寫入 0 個輸出;Flutter coverage 測試 3,151 通過、10 跳過。tool/check/commits.sh origin/main..HEAD獨立重跑通過,四則 commit 訊息有效。git diff --check、staged 及origin/main...HEAD的 whitespace 檢查通過。tool/dev/build.sh ios --debug --simulator建置成功;產物包含 DPIPWidgetsExtension 與 DPIPWidgetIntentsExtension,Live Activities 宣告正確。已核對共用 EEW sources、Widget 同步群組、原生 tests 及提醒資源的 target membership。tool/dev/test_ios.sh於 iPhone 18 Pro/iOS 27.0 模擬器完整執行,使用獨立 DerivedData 與 result bundle;xcresulttool get test-results summary確認 400 通過、0 失敗、0 跳過。未將既有 iOS 18.6 紀錄當成本次重跑結果。build_info.g.dart已還原原始位元組,SHA-256、index blob 與 skip-worktree 旗標核對一致。沒有提交生成檔、QA 產物或建置輸出。既有手動模擬器 QA(2026-10-14 草稿紀錄):使用者回報在 iPhone 18 Pro/iOS 27 模擬器確認彩色震度徽章、雙/三活動佈局、系統倒數持續更新與窄幅時鐘 fallback,受測組合中原有裁切已排除。本次 PR 準備未重做這些手動情境。像素/尺寸測試不等同於 SpringBoard 自主更新、提醒自動展開或 VoiceOver 實際操作驗證。沒有實機測試。
本次 diff 未修改 EEW 推估、警報門檻、一般通知路徑或背景定位;完整 Dart 回歸檢查涵蓋既有測試。提醒自動展開、音效、VoiceOver 操作、實機背景行為及正式 APNs 仍待驗證。UI 前後及深色模式截圖尚未附上,列為 Draft 審查待補項目。
遠端 GitHub Actions 需在 PR 建立後另行核對;這份說明不把本機成功當成遠端 CI 已通過。
檢查清單
tool/check/commits.sh origin/main..HEAD通過mise exec -- flutter analyze與mise exec -- flutter test通過—— 實際依 repository 規範使用
tool/腳本。AppLocalizations,沒有寫死—— 原生文字使用 String Catalog;DEBUG QA 控制明確標示
l10n-ignore,尚未完成 Flutter 文案正式化。AppSpacing/AppRadius/AppMotion,深色模式看過,文字對比度可接受—— Flutter 開發者頁沿用 tokens,原生 SwiftUI 徽章對比有測試;未取得獨立深色模式 QA 與 UI 前後截圖證據。