feat: 增加睡眠分析通知功能,支持睡眠质量评估与建议
This commit is contained in:
@@ -265,6 +265,15 @@ export class NotificationService {
|
||||
console.log('用户点击了 HRV 压力通知', data);
|
||||
const targetUrl = (data?.url as string) || '/(tabs)/statistics';
|
||||
router.push(targetUrl as any);
|
||||
} else if (data?.type === NotificationTypes.SLEEP_ANALYSIS || data?.type === NotificationTypes.SLEEP_REMINDER) {
|
||||
// 处理睡眠分析通知
|
||||
console.log('用户点击了睡眠分析通知', data);
|
||||
// 从通知数据中获取日期,如果没有则使用今天
|
||||
const sleepDate = data?.date as string || new Date().toISOString().split('T')[0];
|
||||
router.push({
|
||||
pathname: ROUTES.SLEEP_DETAIL,
|
||||
params: { date: sleepDate },
|
||||
} as any);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -607,6 +616,8 @@ export const NotificationTypes = {
|
||||
FASTING_START: 'fasting_start',
|
||||
FASTING_END: 'fasting_end',
|
||||
HRV_STRESS_ALERT: 'hrv_stress_alert',
|
||||
SLEEP_ANALYSIS: 'sleep_analysis',
|
||||
SLEEP_REMINDER: 'sleep_reminder',
|
||||
} as const;
|
||||
|
||||
// 便捷方法
|
||||
|
||||
Reference in New Issue
Block a user