feat(reminder): Use system TTS to announce schedule details when the reminder rings - #344
Conversation
- 新增 ReminderSpeechFormatter / reminderSpeech:按「标题,时间到了,现在已经X点X分了」生成播报文案 - speech_text 贯穿 JS → 闹钟模块 → 持久化 → 触发全链路 - 安卓端把原打包音频循环播放换成系统 TextToSpeech 合成播报(优先中文,缺失回退系统默认),按闹钟声道循环 - 新增 ReminderSpeechFormatterTest 覆盖整点/格式/超长标题等边界
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Review
The JS-to-native scheduling and persistence additions are wired consistently, and the formatter coverage is focused. One Android intent handoff still drops the new speech payload, so the advertised schedule-specific TTS text is not used on the normal firing path (and on snooze retries). The fixed-range diff is clean under git diff --check; the advertised Gradle test could not be run because this checkout has no Gradle wrapper, and the JS test command is blocked by a non-executable local vitest binary.
Forward the JS-generated reminder speech through receiver, full-screen activity, service, and snooze rescheduling paths. Add regression coverage for native intent forwarding and the JS formatter fallback branches.
|
Codecov follow-up: commit |
改动内容
响铃语音从"打包音频循环播放"改为系统 TextToSpeech 合成播报日程内容,按闹钟声道(STREAM_ALARM)循环播报,可被媒体音量独立控制。
播报文案
ReminderSpeechFormatter(安卓)与reminderSpeech.ts(JS),生成如「晨会,时间到了。现在已经9点0分了。」的文案数据链路
speech_text贯穿全链路:JS 端LocalReminderApplication计算 →NativeAlarmScheduler/TimeflowAlarmBridge→ 安卓AlarmModule→AlarmScheduler持久化 → 触发时AlarmSoundService取出并 TTS 播报speech_text时,由ExtractedExtras.from按当前时间回退生成安卓侧
TextToSpeech优先简体中文语音,缺失回退系统默认语言USAGE_ALARM,播报完成后 1.5s 循环测试
ReminderSpeechFormatterTest(安卓单测)覆盖整点/非整点/跨天/超长标题/空标题ReminderSpeechFormatterTest对应的 JS 文案格式测试nativeAlarmScheduler.test.ts适配native.schedule新增的第 4 个speechText参数,并新增一条断言 speech_text 被正确转发本地验证
./gradlew :timeflow-alarm:testDebugUnitTest✅npm run check(lint + format + typecheck + 64 套件 597 测试)✅npx expo export --platform android✅Closes #350