fix(vibrate): 修复旧用户震动失效 + 新增震动强度选项

根因:user_settings 早期无 vibrate 字段,getSettings 未兜底,
_remind 的 !s.vibrate 误判 undefined 为关闭,导致震动静默失效,
需手动操作开关才恢复。

- storage: getSettings 兜底 vibrate/voiceGuide/vibrateIntensity 默认值
- timer: !s.vibrate 改 === false,字段缺失视为开(与 voiceGuide 一致)
- timer: vibrate 按 vibrateIntensity 选 API(light/medium=vibrateShort,
  heavy=vibrateLong),fail 回调辅助排查
- settings: 新增"震动强度"三档(短促/标准/强烈),默认强烈

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-09 10:36:14 +08:00
parent a7ed017267
commit ed16ac5efd
5 changed files with 58 additions and 5 deletions
+9 -1
View File
@@ -170,13 +170,21 @@ const getSettings = () => {
// Backfill voiceGender for existing users (added with the male/female
// voice option). Defaults to female, the prior behavior.
if (!s.voiceGender) s.voiceGender = 'female'
// Backfill vibrate/voiceGuide for users whose settings predate these
// toggles. Without this, s.vibrate is undefined and `!s.vibrate` in
// the timer reads it as "off" - vibration silently no-ops until the
// user manually toggles the switch (which writes a real boolean).
if (s.vibrate == null) s.vibrate = true
if (s.voiceGuide == null) s.voiceGuide = true
if (!s.vibrateIntensity) s.vibrateIntensity = 'heavy'
return s
}
return {
planId: 'beginner',
voiceGuide: true,
vibrate: true,
voiceGender: 'female'
voiceGender: 'female',
vibrateIntensity: 'heavy'
}
}