Skip to content

feat(reminder): add native alarm and Baidu location modules - #258

Closed
LUPENGHAN wants to merge 2 commits into
1024XEngineer:mainfrom
LUPENGHAN:feature/reminder-native-modules
Closed

feat(reminder): add native alarm and Baidu location modules#258
LUPENGHAN wants to merge 2 commits into
1024XEngineer:mainfrom
LUPENGHAN:feature/reminder-native-modules

Conversation

@LUPENGHAN

Copy link
Copy Markdown
Contributor

Closes #254

拆分 #245 的第 1/4 层:原生 Android 模块 + 构建脚手架,不依赖其它层,可以直接合。

顺带捎带一个跟提醒功能无关的小修复(语音握手复用最近定位、TTS 打断后保留新流、清理失效的按住说话监听器),已经在这个分支的第二个 commit 里,跟第一个 commit 完全独立。

纯新增,未接入 app 代码,不影响现有功能。

拆分顺序(依赖链)

  1. 这个 PR — 原生模块 + 脚手架
  2. 拆分提醒功能 2/4:提醒引擎核心(domain + application) #255 — 提醒引擎核心
  3. 拆分提醒功能 3/4:设备适配器 + SQLite 数据层 #256 — 设备适配器 + SQLite 数据层
  4. 拆分提醒功能 4/4:接线 + 呈现层(替代 #245) #257 — 接线 + 呈现层(替代 feat(reminder): merge gac0812 reminder engine, wire real local data + native-ring race fix #245

后面三个都已经开出来了,标了 draft,因为它们的分支历史包含这个 PR 还没合的提交,diff 会显示多余内容,等这个合了它们会自动瘦身。

Native Android modules for the reminder engine's device layer:
timeflow-alarm (AlarmManager scheduling, ring UI, boot rescheduling)
and timeflow-baidu-location (continuous positioning bridge). Includes
the Expo config plugins that wire them into the native build,
app.config.js (replaces static app.json so the Baidu API key can come
from an env var), and the new package deps/patches these modules need.

No app code references these yet -- pure addition, nothing wired in.
Three unrelated bugs in the already-merged voice/location-search path
(PR 1024XEngineer#243), fixed together since they're small and independent of the
reminder engine work in this stack:
- reuse a recent position during voice handshake instead of blocking
  on a fresh fix (backend location tools + realtime agent)
- preserve newly-started TTS after an interruption instead of letting
  the old stream clobber it
- remove stale push-to-talk listeners left on the shared WebSocket
  connection after a session ends
@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
timeflow Ready Ready Preview Aug 17, 2026 12:29am

@LUPENGHAN

Copy link
Copy Markdown
Contributor Author

拆分粒度还是太粗(这个都还有 55 个文件改动),先撤回去重新想怎么拆,关掉这个。

@LUPENGHAN LUPENGHAN closed this Aug 17, 2026

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

审阅结论

原生模块的整体脚手架、前端 TTS 打断处理和后端定位握手链路已完整检查。当前有两处会影响真实设备行为的生命周期/隐私问题:重叠闹钟会丢失原生事件状态,百度定位桥会绕过显式隐私同意。

验证方面,前端 lint、格式、类型检查以及 5 个 Vitest 文件(47 个测试)和 36 个 Jest 套件(286 个测试)均通过;Jest 最后报告存在未关闭异步句柄,因此进程未自行退出。

Comment on lines +80 to +82
LocationClient.setAgreePrivacy(true)
if (client == null) {
client = LocationClient(reactContext.applicationContext)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P1] 不要在初始化定位时自动代表用户同意隐私条款

init()(以及下面的 startUpdating())无条件调用 LocationClient.setAgreePrivacy(true),所以调用方即使尚未展示/获得用户同意,甚至刚调用过 setAgreePrivacy(false),仍会被模块自动改回同意并创建、启动百度定位客户端。这使公开的 setAgreePrivacy 接口失去约束作用,并可能在取得授权前开始第三方定位处理。请只在调用方显式传入同意后保存该状态;未同意时 init/startUpdating 应拒绝或保持不可用。

Comment on lines +83 to +85
if (!firedNotified) {
firedNotified = true;
AlarmNativeBridge.notifyFired(this, scheduleId, alarmId, alarmTitle);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P1] 为每次闹钟触发分别记录 fired 状态

Android 的 Service 是单实例的,第二个闹钟在第一个仍响铃时会再次进入同一个 onStartCommand()。这里的 alarmId/scheduleId/requestCode 会被第二次启动覆盖,但 firedNotified 仍为 true,因此第二条日程不会调用 notifyFired,后续停止和通知清理也只围绕最后一次启动的字段执行。AlarmScheduler 明确允许不同 scheduleId 同时存在,所以两条提醒同一时刻或第一条尚未关闭时第二条到点,就会造成原生 disposition 丢失或通知状态不一致。请为每个 start 独立发出/保存事件,并明确排队或合并多个正在响铃的闹钟,而不要用服务级布尔值屏蔽后续触发。

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/4:原生模块 + 构建脚手架

1 participant