feat: 增强通知功能及用户体验

- 在 Bootstrapper 组件中新增通知服务初始化逻辑,注册每日午餐提醒
- 在 CoachScreen 中优化欢迎消息生成逻辑,整合用户配置文件数据
- 更新 GoalsScreen 组件,优化目标创建时的通知设置逻辑
- 在 NotificationTest 组件中添加调试通知状态功能,提升开发便利性
- 新增 NutritionNotificationHelpers 中的午餐提醒功能,支持每日提醒设置
- 更新相关文档,详细描述新功能和使用方法
This commit is contained in:
richarjiang
2025-08-26 09:56:23 +08:00
parent e6bbda9d0f
commit 7f2afdf671
8 changed files with 472 additions and 185 deletions

View File

@@ -24,6 +24,7 @@ export const NotificationTest: React.FC = () => {
sendWorkoutReminder,
sendGoalAchievement,
sendMoodCheckinReminder,
debugNotificationStatus,
} = useNotifications();
const [scheduledNotifications, setScheduledNotifications] = useState<any[]>([]);
@@ -132,6 +133,15 @@ export const NotificationTest: React.FC = () => {
}
};
const handleDebugNotificationStatus = async () => {
try {
await debugNotificationStatus();
Alert.alert('调试完成', '请查看控制台输出');
} catch (error) {
Alert.alert('错误', '调试失败');
}
};
return (
<ThemedView style={styles.container}>
<ScrollView showsVerticalScrollIndicator={false}>
@@ -203,6 +213,13 @@ export const NotificationTest: React.FC = () => {
<ThemedText style={styles.buttonText}></ThemedText>
</TouchableOpacity>
<TouchableOpacity
style={[styles.button, styles.debugButton]}
onPress={handleDebugNotificationStatus}
>
<ThemedText style={styles.buttonText}></ThemedText>
</TouchableOpacity>
<TouchableOpacity
style={[styles.button, styles.dangerButton]}
onPress={handleCancelAllNotifications}
@@ -267,6 +284,9 @@ const styles = StyleSheet.create({
dangerButton: {
backgroundColor: '#FF3B30',
},
debugButton: {
backgroundColor: '#FF9500',
},
buttonText: {
color: 'white',
fontSize: 16,