feat(nutrition): 添加营养数据保存功能到HealthKit,包括蛋白质、脂肪和碳水化合物
This commit is contained in:
@@ -187,49 +187,6 @@ export class NutritionNotificationHelpers {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送午餐记录提醒
|
||||
*/
|
||||
static async sendLunchReminder(userName: string) {
|
||||
const coachUrl = buildCoachDeepLink({
|
||||
action: 'diet',
|
||||
subAction: 'card',
|
||||
meal: 'lunch'
|
||||
});
|
||||
|
||||
return notificationService.sendImmediateNotification({
|
||||
title: '午餐记录提醒',
|
||||
body: `${userName},记得记录今天的午餐情况哦!`,
|
||||
data: {
|
||||
type: 'lunch_reminder',
|
||||
meal: '午餐',
|
||||
url: coachUrl
|
||||
},
|
||||
sound: true,
|
||||
priority: 'normal',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消午餐提醒
|
||||
*/
|
||||
static async cancelLunchReminder(): Promise<void> {
|
||||
try {
|
||||
const notifications = await notificationService.getAllScheduledNotifications();
|
||||
|
||||
for (const notification of notifications) {
|
||||
if (notification.content.data?.type === 'lunch_reminder' &&
|
||||
notification.content.data?.isDailyReminder === true) {
|
||||
await notificationService.cancelNotification(notification.identifier);
|
||||
console.log('已取消午餐提醒:', notification.identifier);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('取消午餐提醒失败:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 安排每日晚餐提醒
|
||||
* @param userName 用户名
|
||||
|
||||
Reference in New Issue
Block a user