feat(challenges): 新增挑战鼓励提醒后台任务与通知支持

- 在 backgroundTaskManager 中增加 executeChallengeReminderTask,每日检查已加入且未打卡的挑战并发送鼓励通知
- 扩展 ChallengeNotificationHelpers 提供 sendEncouragementNotification 方法
- 新增 NotificationTypes.CHALLENGE_ENCOURAGEMENT 及对应点击跳转处理
- challengesApi 补充 checkedInToday 字段用于判断今日是否已打卡
- 临时注释掉挑战列表与详情页头部的礼物/分享按钮,避免干扰主流程
This commit is contained in:
richarjiang
2025-09-29 17:24:07 +08:00
parent d74bd214ed
commit 8f847465ef
6 changed files with 95 additions and 10 deletions

View File

@@ -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;
// 便捷方法