feat(reminder): add timeflow-alarm native module and Expo wiring - #237
feat(reminder): add timeflow-alarm native module and Expo wiring#237gac0812 wants to merge 4 commits into
Conversation
Give Android an actual TimeflowAlarm library and thicken the JS bridge so exact alarms can be scheduled, cancelled, and observed from the app.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
compileSdk 35 does not ship MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS; use the documented integer on API 36+ instead.
|
@fennoai /review |
Review Complete
|
Last-wins replacement now emits a fired event for each alarm id instead of collapsing concurrent rings into one.
|
@fennoai /review |
Review Complete
|
| // Singleton service: overlapping alarms are serialized last-wins so each | ||
| // schedule still gets its own `fired` event and the previous UI/audio is torn down. | ||
| boolean isNewAlarm = notifiedAlarmId == null || !nextAlarmId.equals(notifiedAlarmId); | ||
| if (isNewAlarm && notifiedAlarmId != null) { |
There was a problem hiding this comment.
P1 — The previous RingActivity is not torn down when replacing an overlapping alarm. RingActivity is launched with FLAG_ACTIVITY_MULTIPLE_TASK and keeps its own alarmId/requestCode, while this replacement block only releases the service audio and overlay. If alarm B fires while alarm A’s activity is visible, the visible UI still belongs to A but the service now plays B; pressing confirm/snooze on A calls AlarmNativeBridge.notify* with A’s IDs and AlarmSoundService.stop() stops B as well. RingActivity.finishIfOpen() already exists, so close the current activity before switching the service to the new alarm (or otherwise make the activity/service state atomic).
Summary
frontend/modules/timeflow-alarmAndroid 原生库(精确闹钟、响铃 UI、停铃、原生事件)withTimeflowAlarm与react-native.config.jsautolinkingTimeflowAlarmBridge/NativeAlarmScheduler:三参 schedule、cancelAll、stopRinging、subscribe、consumeNativeDispositionsExpoSystemNotification(expo-notifications懒加载),并补 scheduler / 系统通知单测Merge Order
Scope
frontend/modules/timeflow-alarm/**frontend/plugins/withTimeflowAlarm.jsfrontend/react-native.config.jsfrontend/app.json、frontend/package.json、frontend/eslint.config.js、frontend/.prettierignorefrontend/src/infrastructure/notifications/native/TimeflowAlarmBridge.tsfrontend/src/infrastructure/notifications/NativeAlarmScheduler.tsfrontend/src/infrastructure/notifications/ExpoSystemNotification.tsfrontend/src/features/reminder/application/interfaces/AlarmSchedulerPort.ts(可选原生事件方法)frontend/tests/unit/infrastructure/notifications/nativeAlarmScheduler.test.tsfrontend/tests/unit/infrastructure/notifications/expoSystemNotification.test.tsOut of scope
LocalReminderApplication(见 feat(reminder): wire LocalReminderApplication with in-memory adapters #238)Verification
npm run checknpm ciCloses #232