feat(challenges): 新增挑战鼓励提醒后台任务与通知支持
- 在 backgroundTaskManager 中增加 executeChallengeReminderTask,每日检查已加入且未打卡的挑战并发送鼓励通知 - 扩展 ChallengeNotificationHelpers 提供 sendEncouragementNotification 方法 - 新增 NotificationTypes.CHALLENGE_ENCOURAGEMENT 及对应点击跳转处理 - challengesApi 补充 checkedInToday 字段用于判断今日是否已打卡 - 临时注释掉挑战列表与详情页头部的礼物/分享按钮,避免干扰主流程
This commit is contained in:
@@ -161,6 +161,10 @@ export class NotificationService {
|
||||
if (data?.url) {
|
||||
router.push(data.url as any);
|
||||
}
|
||||
} else if (data?.type === NotificationTypes.CHALLENGE_ENCOURAGEMENT) {
|
||||
console.log('用户点击了挑战提醒通知', data);
|
||||
const targetUrl = (data?.url as string) || '/(tabs)/challenges';
|
||||
router.push(targetUrl as any);
|
||||
} else if (data?.type === 'mood_reminder') {
|
||||
// 处理心情提醒通知
|
||||
console.log('用户点击了心情提醒通知', data);
|
||||
@@ -506,6 +510,7 @@ export const NotificationTypes = {
|
||||
MOOD_REMINDER: 'mood_reminder',
|
||||
WATER_REMINDER: 'water_reminder',
|
||||
REGULAR_WATER_REMINDER: 'regular_water_reminder',
|
||||
CHALLENGE_ENCOURAGEMENT: 'challenge_encouragement',
|
||||
} as const;
|
||||
|
||||
// 便捷方法
|
||||
|
||||
Reference in New Issue
Block a user