Skip to content

fix: region search, timeline a11y, bad links, offline lists - #619

Merged
whes1015 merged 9 commits into
mainfrom
fix/small-ux-and-perf
Oct 16, 2026
Merged

whes1015 merged 9 commits into
mainfrom
fix/small-ux-and-perf

Conversation

@whes1015

@whes1015 whes1015 commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Stack 第 1/3 層:#619 → #620 → #621,請由下往上合併(#614、#616、#615、#618 已合併)。這是最底層,base 是 main。

這個 PR 做了什麼

六個彼此獨立的小修正:地區搜尋找不到「台北」和鄉鎮、時間軸無法用螢幕閱讀器操作、格式錯誤的連結會讓 app 崩潰、低階手機上波前圈寫入塞車、校正時間每次同步都跳動,以及離線時報告列表只顯示錯誤。

改動內容

正式程式碼

  • 8f0cc662 地區搜尋支援「台/臺」和鄉鎮
    • 資料用「臺北市」,原本輸入「台北」找不到;第一頁也搜不到鄉鎮(例如「板橋」)。
    • 新增純函式的正規化與搜尋索引(lib/core/geo/place_search.dart):臺→台、去掉所有空白、全形轉半形、轉小寫。
    • 第一頁輸入鄉鎮名會列出「新北市 板橋區」,點了直接選定;輸入「台北」只顯示城市,不會列出全部 12 個區。
    • 鄉鎮列和點擊邏輯抽成兩頁共用的元件;第一頁改成延遲建構列表(一個字就可能命中上百個鄉鎮)。
  • abe2c7fc 螢幕閱讀器可以逐格操作地圖時間軸
    • 時間軸對螢幕閱讀器來說是一個 slider,會念出例如「過去 07:50,2026/07/13」;上下滑動走和短距離拖動相同的對齊流程,到第一格和最後一格就停。
  • 907ecd51 格式錯誤的連結開啟最接近的頁面,不再崩潰
    • 原本例如 int.parse(state.uri.queryParameters['t']!),缺參數或格式錯就直接丟例外。
    • 每個帶參數的路由改在 route 層 redirect 驗證,builder 讀參數時不會丟例外:重播連結缺 t 或格式錯 → 開對應的報告;錯誤的回報 id → 回報列表;空白的報告 id 或城市 → 上一層列表。
    • 有測試走過實際的路由表、帶各種錯誤參數。沒有改用 typed routes。
  • b7a832e0 上一次波前圈寫入還沒完成就跳過這一格
    • 原本 16 ms 的計時器每次都送 GeoJSON,不檢查上一次是否完成,fork 又會依序排隊不丟舊的,低階手機上會越積越多、波前圈越來越落後。
    • 一次寫入超過約 1 秒沒回應視為遺失,避免地圖被拆掉時波前圈永遠卡住。快的手機行為不變。
  • 32ee0c27 低階 Android 手機的波前圈改成 5 Hz
    • 共用、快取的裝置等級判斷,驅動 16 ms/200 ms 兩種節奏,即時監視和重播頁都適用。
    • 取捨寫在 wavefront_cadence.dart:放大到城市時圈會一格一格前進而不是平滑移動,但和模型的落差在 1.2 km 以內。iOS 一律不降級。
  • f4e80350 校正時間在雜訊大的同步下保持穩定
    • 保留最近 5 個偏移樣本,去掉最大和最小後取平均作為基準;HTTP 備援的 ±RTT/2 雜訊不再讓時鐘每次同步都跳。
    • 如果新樣本和窗口內每個樣本都差超過 2 秒(例如裝置睡眠後),就重新開始窗口。單調時鐘錨定方式不變。
  • 6baf52bf、e4f0f91a 離線時顯示最後的報告列表和事件紀錄,並標示資料時間
    • GET 可以選擇 stale-if-error:請求失敗時 interceptor 附上快取的內容,但錯誤照樣往下傳,讓 client 先試其他區域;所有 host 都失敗後,getOrSaved 才回傳那份快取並標記為舊資料。
    • Ok 新增可選的 stale 欄位(Staleness:失敗原因,加上伺服器最後確認資料的時間)。
    • HTTP 快取新增可為 null 的 fetched 欄位,原地新增、不清掉既有快取;200 時寫入,304 只對有選擇的請求寫入。
    • RealtimeView 的狀態橫幅抽成共用的 FreshnessBanner,顯示「無法連線・顯示 3 小時前的資料」。
    • 有選擇的只有:報告列表(所有頁)和事件紀錄。進行中的事件和海嘯刻意不選,它們是警報資料,不能拿舊的當現在的。
  • a63962fc 文件:說明 stale-if-error 和舊資料橫幅。

測試

每一項都有對應的單元或 widget 測試:搜尋正規化、時間軸語意、錯誤連結、in-flight 跳過、節奏、時鐘截尾平均、stale-if-error 與橫幅。

相關 issue

沒有對應的 issue。

怎麼驗

  • tool/commit.sh --push 通過(analyze、codegen、全部 Dart 測試、l10n)。新字串 12 個語系都有翻譯。
  • 需要決定: Ok.stale 改變了核心 Result 的契約。忽略這個欄位的使用端會把舊資料當成現在的;目前只有上面兩個列表會產生它,而且兩者都會顯示橫幅。請確認可以接受。
  • 建議在實機上看:
    • 4 GB 以下的 Android 手機上,示範或重播時 5 Hz 的波前圈放大後是否可接受。
    • TalkBack 和 VoiceOver 在時間軸上下滑動。
    • 有大量快取的既有安裝,fetched 欄位的遷移。
    • 飛航模式下,報告列表和事件分頁顯示橫幅和正確的時間。

檢查清單

  • tool/check/commits.sh 通過
  • 一個 commit 一件事
  • analyze 與測試通過(tool/commit.sh --push)
  • 新的使用者可見字串都走 AppLocalizations,12 個語系都有翻譯
  • 使用設計 token;深色模式待實機確認

@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.60789% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.55%. Comparing base (d03a69c) to head (a8a73cf).

Files with missing lines Patch % Lines
lib/core/network/stale_if_error.dart 93.33% 2 Missing ⚠️
lib/shared/map/map_timeline.dart 97.05% 2 Missing ⚠️
lib/app/router/route_params.dart 96.00% 1 Missing ⚠️
lib/shared/widgets/async_view.dart 93.75% 1 Missing ⚠️

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

@whes1015

Copy link
Copy Markdown
Member Author

Force-push:rebase 到目前的 main(807f5d9d),並把開著的 PR 排成 stack:#614 → #616 → #615 → #618 → #619 → #620 → #621,base 改成下面那一層的分支。

和 main 及其他 PR 的衝突都是兩邊各自新增的內容,雙方都保留;ARB 在檔尾補逗號後重新產生 l10n。每一層都單獨跑過 analyze 和完整測試,頂端跑過 tool/commit.sh --push。

這一層的 commit 內容沒有變,只有上下文不同。

@whes1015
whes1015 added this pull request to stack #626 October 16, 2026 19:21
@whes1015
whes1015 force-pushed the fix/small-ux-and-perf branch from a8a73cf to 88d7d6a Compare October 16, 2026 19:31
@whes1015

Copy link
Copy Markdown
Member Author

Force-push:#614 合併後 rebase 到新的 main(238297ea),拿掉 #614 合併前的舊 commit。

內容沒有變:main 上合併進來的 tree 和 stack 第一層完全相同,搬過去之後每一層的 tree 也都和之前一樣,所以先前各層的 analyze 和測試結果仍然有效。

@whes1015
whes1015 force-pushed the fix/small-ux-and-perf branch from 88d7d6a to 71ca9de Compare October 16, 2026 19:37
@whes1015

Copy link
Copy Markdown
Member Author

Force-push:#616 合併後 rebase 到新的 main(34336fb6),拿掉 #616 合併前的舊 commit。

內容沒有變:main 上合併進來的 tree 和 stack 第一層完全相同,搬過去之後每一層的 tree 也都和之前一樣。push 前 gate 全過。

@whes1015
whes1015 force-pushed the fix/small-ux-and-perf branch from 71ca9de to 1db3972 Compare October 16, 2026 19:44
Base automatically changed from feat/notification-presets to main October 16, 2026 19:44
Platform: all

Fix(zh-Hant): 地區搜尋輸入「台北」也找得到臺北市,並可在第一頁直接搜尋並加入鄉鎮市區(例如「板橋」)
Fix(en-US): region search treats 台 and 臺 alike and finds townships such as 板橋 straight from the first page
Platform: all

Fix(zh-Hant): 地圖時間軸可用螢幕閱讀器操作:會讀出目前的時間,並可上下滑動逐格切換
Fix(en-US): screen readers can now use the map timeline, which reads out the current time and steps one frame per swipe
Platform: all

Fix(zh-Hant): 修正開啟格式錯誤的連結(如缺少時間的地震重播)會出現錯誤畫面,現在會改開最接近的頁面
Fix(en-US): a malformed link, such as an earthquake replay without its start time, now opens the nearest working page instead of an error screen
Platform: all

Optimization(zh-Hant): 低階手機上強震監視器的地震波圈不再越畫越慢、落後於實際時間
Optimization(en-US): on slower phones the seismic monitor's wave rings no longer fall further and further behind real time
Platform: android

Optimization(zh-Hant): 記憶體 4 GB 以下的 Android 手機在地震速報時降低地震波圈的更新頻率,地圖與速報畫面更順暢
Optimization(en-US): Android phones under 4 GB of memory redraw the earthquake wave rings less often during an alert, keeping the map and alert screens responsive
Platform: all

Fix(zh-Hant): 校時改為取最近幾次結果的平均,地震速報倒數與震波圈不再因網路延遲每分鐘跳動
Fix(en-US): time calibration now averages its recent readings, so alert countdowns and wave rings no longer jump every minute with network delay
Platform: all

Fix(zh-Hant): 離線時地震報告列表改為顯示上次的資料,並標示無法連線與資料時間,不再只出現錯誤畫面
Fix(en-US): offline, the earthquake report list shows the last reports it loaded, labelled as saved with their age, instead of an error screen
Platform: all

Fix(zh-Hant): 離線時事件頁改為顯示上次的歷史事件,並標示無法連線與資料時間,不再只出現錯誤畫面
Fix(en-US): offline, the Events tab shows the event history it last loaded, labelled as saved with its age, instead of an error screen
@whes1015
whes1015 force-pushed the fix/small-ux-and-perf branch from 1db3972 to a63962f Compare October 16, 2026 19:48
@whes1015

Copy link
Copy Markdown
Member Author

Force-push:#615、#618 合併後 rebase 到新的 main(690e746f)。

「Update branch」會把這一層疊在下面那層 commit 的副本上,所以先前多出 #615、#618 的重複 commit;這次 rebase 把它們拿掉了。內容沒有變:每一層的 tree 和之前相同,push 前 gate 全過。

@whes1015
whes1015 merged commit 15abd92 into main Oct 16, 2026
3 of 4 checks passed
@whes1015
whes1015 deleted the fix/small-ux-and-perf branch October 16, 2026 19:50
@lowrt lowrt added this to the v26.4 milestone Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants