Skip to content

fix(eew): limit replay availability - #670

Merged
whes1015 merged 2 commits into
mainfrom
fix/eew-replay-archive-cutoff
Nov 20, 2026
Merged

whes1015 merged 2 commits into
mainfrom
fix/eew-replay-archive-cutoff

Conversation

@lowrt

@lowrt lowrt commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

這個 PR 做了什麼

讓地震報告的重播按鈕依實際還在不在封存裡決定,不再用固定日期。

正式程式碼:

  • 移除 EarthquakeReport.canReplay 與 2024/02/20 的固定邊界。
  • 每次進入報告詳情頁時探測一次(不輪詢):
    • 先問 EEW 封存在事件後 60 秒的當下有沒有警示,有就顯示重播。
    • EEW 沒有時再問 RTS 封存在重播起點那一秒;200 顯示,404/400 隱藏。
  • 只有封存明確回答「沒有」才隱藏;其他網路錯誤保留按鈕,避免一次逾時被當成永遠不能重播。
  • 探測結果只存在這個頁面的 state,離開再進來會重新探測,因為封存保留範圍會變。

測試:

  • 移除固定日期下限的測試。
  • 補上 EEW 命中、RTS 404、400(位數不足的舊時間)、其他錯誤往上拋的 API 測試。
  • 詳情頁補上 404 隱藏、暫時性錯誤保留、每次進入都重新探測的測試。

範圍限制:

  • 深連結直接進重播頁仍不擋;這次只決定詳情頁那顆按鈕要不要出現。
  • 不變更既有重播流程。

相關 issue

怎麼驗

  • 開 921(或 2024/02/20 以前的報告)詳情頁:不應出現重播按鈕。
  • 開 2024/04/03 或近期的報告:應出現重播按鈕。
  • 離開詳情頁再進來:探測會重新打一次(可用網路紀錄確認只有一次,不是輪詢)。

檢查清單

  • tool/check/commits.sh origin/main..HEAD 通過
    —— commit 訊息就是更新日誌,格式見 commit.md
  • 一個 commit 一件事
  • mise exec -- flutter analyze 與 mise exec -- flutter test 通過(本機沒有 mise/Flutter,交給 CI)
  • 新的使用者可見字串都走 AppLocalizations,沒有寫死
  • CI 全部通過(gh pr checks)
  • 有 UI 變更的話:用的是 AppSpacing / AppRadius / AppMotion,深色模式看過,文字對比度可接受

@lowrt lowrt added this to the v27.1 milestone Nov 19, 2026
@lowrt lowrt added android Issues or pull requests related to the Android platform. ios Issues or pull requests related to the iOS platform. labels Nov 19, 2026
@lowrt
lowrt requested a review from a team November 19, 2026 13:44
@codecov

codecov Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.75000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.67%. Comparing base (3b1020d) to head (4e18e42).

Files with missing lines Patch % Lines
...atures/earthquake/data/report_repository_impl.dart 0.00% 2 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.

@lowrt
lowrt force-pushed the fix/eew-replay-archive-cutoff branch from dfa8f57 to 2783e4f Compare November 20, 2026 06:23
whes1015
whes1015 previously approved these changes Nov 20, 2026

@whes1015 whes1015 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

程式沒有要改的。canReplay 用 UTC 2024-02-19 16:00(台北 2024-02-20 00:00,含當天)藏起重播按鈕,只擋詳情頁那顆;測試含下限前 1ms。build、Android、iOS 都過了。深連結仍可帶封存日前的 t,這次不擋。作者是 lowrt,可以核准。

Agent 代 whes1015 審核(Discord 靈靈 ⇛ 臺南新營 要求)

@whes1015

Copy link
Copy Markdown
Member

改成探測了,不再用固定日期:

  • 每次進報告詳情頁探測一次(不輪詢):先看 EEW 封存在事件後 60 秒有沒有資料,有就顯示重播;沒有再問 RTS 封存的重播起點,200 顯示、404/400 隱藏。
  • 其他網路錯誤保留按鈕,避免一次逾時被當成永遠不能重播。
  • 離開再進來會重新探測,封存保留範圍變了就跟著變。

build(含 format、analyze、test)已過,Android/iOS 還在跑。

lowrt and others added 2 commits November 21, 2026 03:56
Platform: all

Fix(zh-Hant): 隱藏不支援重播的地震報告重播按鈕
Fix(en-US): hide replay for unsupported earthquake reports
Platform: all

Fix(zh-Hant): 依重播資料是否還在決定顯示重播按鈕
Fix(en-US): show replay only when the archive still has the event
@whes1015
whes1015 force-pushed the fix/eew-replay-archive-cutoff branch from 4e18e42 to 490f6b6 Compare November 20, 2026 19:56
@whes1015
whes1015 merged commit 868b605 into main Nov 20, 2026
3 of 4 checks passed
@whes1015
whes1015 deleted the fix/eew-replay-archive-cutoff branch November 20, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

android Issues or pull requests related to the Android platform. ios Issues or pull requests related to the iOS platform. size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 921 地震無法重播

2 participants