Skip to content

[codex] Build countdown alert MVP#2

Draft
EnsueCollectR wants to merge 3 commits into
mainfrom
codex/mvp-countdown-app
Draft

[codex] Build countdown alert MVP#2
EnsueCollectR wants to merge 3 commits into
mainfrom
codex/mvp-countdown-app

Conversation

@EnsueCollectR
Copy link
Copy Markdown
Contributor

Summary

  • Scaffold React Native + Expo + TypeScript app for issue MVP: local countdown app with scheduled sound/popup alerts #1
  • Add local-first countdown workbench with multiple timers, presets, pause/resume/reset/delete, AsyncStorage persistence, and light/dark themes
  • Use expo-notifications scheduled local notifications with sound for warning and finish alerts
  • Add README and validation scripts

Validation

  • npm run typecheck
  • npm run export:web
  • Manual web preview at http://127.0.0.1:8088: created a Focus timer and verified countdown updates

Notes

  • Native background notification sound still needs device/emulator validation by reviewer, because web preview cannot prove OS-level mobile notification behavior.
  • npm audit reports moderate Expo transitive dependency advisories; the suggested force fix would downgrade Expo and is not applied.

@EnsueCollectR
Copy link
Copy Markdown
Contributor Author

架构 / spec 复核(Claude)— PR #2 vs issue #1

总体:✅ 实现扎实,符合 spec 关键要求。 代码层面我的重点检查项全部通过:

告警机制正确(最关键):用 scheduleNotificationAsync + DATE trigger(new Date(triggerAt))排系统级本地通知;setInterval 仅用于 UI 每秒刷新,不负责触发告警 → 后台/关闭也能响的前提成立。
绝对时间戳:targetAt 存绝对时间,剩余 = targetAt - now 实时重算(getRemainingMs);重启从 targetAt 恢复,且不重复排程(OS 已持有排程)。
暂停/重置/删除cancelScheduledNotificationAsync → 不会有"已暂停仍响"的孤儿告警。
权限 + Android 渠道:HIGH importance、sound、锁屏 PUBLIC、震动。
前台:handler shouldPlaySound / shouldShowBanner = true + 应用内 Alert 弹窗 + 震动 → 声音+弹窗齐全。
多档提醒 + 结束提醒(offset 0 = finished)、浅/深色、多 timer、presets、AsyncStorage 持久化。

⚠️ 唯一未验证、且是核心验收项(criteria #2):真机后台/锁屏到点是否准时带声音响(Android/iOS)。web export 证明不了(Codex 也已指出)。建议在 Android 设备/模拟器跑一次再标 done。

非阻塞建议(可后续):

  • 进前台时(AppState)校验/补排一次通知,防 OS 偶发丢弃排程。
  • iOS 真机验证默认声音与权限弹窗行为。
  • 前台改用自定义 modal 替代原生 Alert,观感更统一(MVP 可不做)。

结论:approach + 代码 approve ✅;合并/标 done 前请补一次真机后台告警验证。 Draft 状态合适。

@EnsueCollectR
Copy link
Copy Markdown
Contributor Author

Desktop/Tauri update pushed in a364872.\n\nWhat changed:\n- Added Tauri desktop wrapper for Alertboard with Linux bundles, tray menu, and close-to-tray behavior.\n- Reused the existing Expo Web UI inside Tauri.\n- Added desktop local notification scheduling/cancelation via @tauri-apps/plugin-notification.\n- Kept mobile Expo notification path intact; desktop-only foreground due-alert fallback is gated behind Tauri runtime detection.\n- Excluded Tauri build output from TypeScript and git.\n\nValidation:\n- npm run typecheck\n- npm run export:web\n- npm run desktop:build\n\nBuild artifacts produced locally:\n- src-tauri/target/release/bundle/deb/Alertboard_0.1.0_amd64.deb\n- src-tauri/target/release/bundle/rpm/Alertboard-0.1.0-1.x86_64.rpm\n- src-tauri/target/release/bundle/appimage/Alertboard_0.1.0_amd64.AppImage\n\nRemaining manual verification: run the desktop app in a real GUI session and confirm tray visibility, close-to-tray, and scheduled notification sound/popup behavior. The headless build host can compile/package it but cannot prove desktop notification UX.

@EnsueCollectR
Copy link
Copy Markdown
Contributor Author

桌面 / Tauri 复核(Claude)— PR #2

总体:✅ 桌面实现结构清晰、approve。 重点项都对位:

  • 托盘:src-tauri/src/lib.rs 建了 tray + 菜单(Show / Quit),左键点托盘恢复窗口。
  • 关窗进托盘(核心要求):App.tsx onCloseRequested → preventDefault() + hide(),仅桌面生效 → 进程/webview 不销毁,计时继续。
  • 桌面告警走系统计划通知:sendDesktopNotification({ schedule: Schedule.at(triggerAt), sound, autoCancel }),按绝对时间排程(和手机端一致的可靠思路),不靠 JS 计时器触发。
  • ✅ 桌面/手机路径干净分流(isDesktopRuntime());暂停/重置/删除会 cancelDesktopNotifications(无孤儿告警)。
  • ✅ 权限处理覆盖桌面;capabilitiesnotification:default;Linux 产物 deb/rpm/AppImage 已出。

⚠️ 一个必须在真机桌面验的关键点(可能是隐患)

Tauri v2 的 Schedule.at 计划通知在桌面(Linux/Win/macOS)上的支持历来不稳——计划排程主要是移动端能力。若桌面忽略 schedule(立即弹 / 不弹),到点告警就不准。
请在真实桌面验一次:设 1–2 分钟倒计时 → 关窗进托盘 → 看到点是否准时弹窗 + 响

  • 若桌面不认 schedule:加个 JS 计时器兜底——关窗后 webview 仍存活(托盘常驻),可在每秒 tick 里检测到点后 sendDesktopNotification(立即)补发。成本很低,正好用上"托盘常驻"这个前提。

非阻塞小项

  • sound: 'message-new-instant' 是 freedesktop 主题音,确认目标 Linux 桌面能解析;Win/macOS 给默认音。
  • Win/macOS bundle 本机未构建/验证,留 CI 或后续。

结论:代码 approve;合并 / 标 done 前请做那次真机桌面验证(尤其 Schedule.at 是否准时触发)。 托盘常驻 + 关窗进托盘的可靠性前提已满足。

@EnsueCollectR
Copy link
Copy Markdown
Contributor Author

Follow-up fix pushed in d8cf03b.\n\nRoot cause: Tauri dev was configured to wait for http://localhost:8088, while Expo web dev normally serves on http://localhost:8081. That made

timer-alert-app@1.0.0 desktop
tauri dev

timer-alert-app@1.0.0 web:desktop
expo start --web --no-open wait for the wrong frontend URL and could leave users looking only at the browser/web server.\n\nFix:\n- now points at .\n- Tauri dev starts Expo with via
timer-alert-app@1.0.0 web:desktop
expo start --web --no-open, so it does not auto-open a browser tab.\n\nValidation rerun:\n- npm run typecheck\n- npm run export:web\n- npm run desktop:build

@EnsueCollectR EnsueCollectR force-pushed the codex/mvp-countdown-app branch from d8cf03b to 38d0001 Compare May 24, 2026 05:39
@EnsueCollectR
Copy link
Copy Markdown
Contributor Author

Follow-up fix pushed in 38d0001.

Root cause: Tauri dev was configured to wait for http://localhost:8088, while Expo web dev serves on http://localhost:8081 here. That made npm run desktop wait for the wrong frontend URL and could leave users looking only at the browser/web server.

Fix:

  • devUrl now points at http://localhost:8081.
  • Tauri dev starts Expo with BROWSER=none expo start --web via npm run web:desktop, so it does not auto-open a browser tab.

Validation rerun:

  • npm run typecheck
  • npm run export:web
  • npm run desktop:build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant