Skip to content

feat(notify): add one-tap notification presets - #618

Merged
whes1015 merged 3 commits into
mainfrom
feat/notification-presets
Oct 16, 2026
Merged

whes1015 merged 3 commits into
mainfrom
feat/notification-presets

Conversation

@whes1015

@whes1015 whes1015 commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Stack 第 2/5 層:#615 → #618 → #619 → #620 → #621,請由下往上合併(#614、#616 已合併)。base 是 fix/notification-delivery,所以這裡只顯示這一層的 commit。下面那層合併後 GitHub 會自動把 base 改成 main,這時要再 rebase 到 main 一次(只開放 rebase 合併,合併後 SHA 會變)。

這個 PR 做了什麼

通知有 9 個頻道,原本新使用者要在設定頁一個一個決定。這個 PR 加上通知預設組合(建議/全部/僅緊急/自訂),放在通知設定頁最上方,並在新手引導最後新增一步,讓第一次使用的人只做一個決定。

各組合開了什麼

  • 地震速報永遠開著:伺服器沒有提供關閉選項。「僅緊急」把它限縮在本地震度 4 級以上,和 app 既有的緊急速報頻道同一條線。
  • 三個天氣頻道(雷雨、天氣警特報、防災資訊)在每個組合都開著:它們都夾帶緊急警報(山區暴雨、紅色警戒、土石流警戒),而伺服器只能整個頻道開關,關掉就會連緊急的一起漏掉。
  • 建議:伺服器的初始預設,扣掉「地震報告」(它重複幾分鐘前震度速報說過的內容)。強震監視、震度速報、海嘯消息和公告都開著。
  • 僅緊急:只留有緊急警報的頻道:4 級以上的速報、三個天氣頻道、只有海嘯警報。強震監視、兩種地震報告和公告都關掉。
  • 全部:每個頻道設成最廣的選項。
  • 自訂:目前設定不符合上面三種時顯示。伺服器初始預設會顯示為自訂(因為地震報告是開著的)。

改動內容

正式程式碼

  • cfbac05b 通知設定頁加上一鍵預設組合
    • 套用組合就是對每個不同的頻道呼叫一次 NotifyRepository.setChannel,和逐頻道設定走同一條路,包括既有的 401 復原。
    • api.md 沒有寫這些端點的限制,沿用 NotifyRepositoryImpl 遇到連續呼叫被 429 後採用的 2 秒間隔;9 個頻道全改約 16 秒。
    • 先送「打開」的變更,再送「關掉」的:中途失敗時,裝置收到的通知只會比原本多,不會變少。
    • 失敗就停下,顯示和單頻道失敗相同的 snackbar;已經存好的保留,畫面如實顯示(通常變成自訂)。再選一次只會送還沒改到的頻道。
    • 組合是設定頁最上方的一組 radio;從自訂切出去會先確認;套用中所有列都鎖住。
  • 36f54595 新手引導最後選擇通知組合
    • 放在權限之後:新安裝的第一次寫入需要權限那一步完成的位置註冊。
    • 預選「建議」。失敗或還沒有推播 token 時,可以重試或「之後再說」,不會卡住。
    • 權限那一步的按鈕從「開始使用」改成「下一步」。
    • 既有使用者不受影響:只有點了組合才會寫入設定;新手引導仍只在未完成時出現,升級不會改到任何設定。

無障礙:真正的 radio group(念出選取狀態和位置);自訂只在目前狀態符合時可選;套用中會念出「套用中…」。有測試確認 2 倍字級、320 px 寬的螢幕排得下。

測試

  • 組合對照表(每個安全相關的頻道逐一檢查)、請求間隔 2 秒、失敗停止、續傳、取消、controller,以及兩個頁面(radio 語意、確認框、部分失敗、重試、沒有 token、大字級)。
  • 既有的新手引導流程測試改成走過新的一步,並確認伺服器最後存的是「建議」。

相關 issue

沒有對應的 issue。

怎麼驗

  • tool/commit.sh --push 通過(analyze、codegen、全部 Dart 測試、l10n)。
  • 16 個新字串,12 個語系都有翻譯。
  • 合併前建議在實機上看: 新安裝走一次新手引導,選「建議」後到通知設定頁確認各頻道狀態;在設定頁切換「全部」→「僅緊急」,確認過程中列被鎖住、約 16 秒內完成。

檢查清單

  • 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 99.59350% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 94.50%. Comparing base (c8ca126) to head (d03a69c).

Files with missing lines Patch % Lines
...res/notification/domain/notify_preset_applier.dart 94.11% 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

whes1015 commented Oct 16, 2026 •

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 除了 ARB 檔尾那一行補上逗號以外,內容沒有變。

@whes1015
whes1015 added this pull request to stack #626 October 16, 2026 19:21
@whes1015
whes1015 force-pushed the feat/notification-presets branch from d03a69c to 26f30e8 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 feat/notification-presets branch from 26f30e8 to 36f5459 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 全過。

Base automatically changed from fix/notification-delivery to main October 16, 2026 19:43
Platform: ios

New(zh-Hant): iOS「設定」裡 DPIP 的通知頁面多了一個連結,點了會直接打開 app 內的通知設定
New(en-US): iOS Settings now links from DPIP's notification page straight to the app's own notification settings
Platform: all

New(zh-Hant): 通知設定新增「建議」「全部」「僅緊急」三種快速設定,一次調整所有頻道,並標示目前設定屬於哪一種或為「自訂」
New(en-US): notification settings gain Recommended, All and Emergency-only presets that set every channel at once, and show which one your settings match or that they are custom
Platform: all

New(zh-Hant): 首次啟動新增「通知偏好」步驟,可直接選擇建議、全部或僅緊急,不必逐項設定九個頻道
New(en-US): first launch adds a step to pick Recommended, All or Emergency-only alerts instead of setting nine channels one by one
@whes1015
whes1015 force-pushed the feat/notification-presets branch from 36f5459 to f65d012 Compare October 16, 2026 19:44
@whes1015
whes1015 merged commit 690e746 into main Oct 16, 2026
2 checks passed
@whes1015
whes1015 deleted the feat/notification-presets branch October 16, 2026 19:44
@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