feat: 移除目标管理功能模块
删除了完整的目标管理功能,包括目标创建、编辑、任务管理等相关页面和组件。同时移除了相关的API服务、Redux状态管理、类型定义和通知功能。应用版本从1.0.20升级到1.0.21。
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { notificationService, NotificationData, NotificationTypes } from '../services/notifications';
|
||||
import * as Notifications from 'expo-notifications';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { NotificationData, notificationService, NotificationTypes } from '../services/notifications';
|
||||
|
||||
export interface UseNotificationsReturn {
|
||||
isInitialized: boolean;
|
||||
@@ -25,9 +25,7 @@ export interface UseNotificationsReturn {
|
||||
cancelAllNotifications: () => Promise<void>;
|
||||
getAllScheduledNotifications: () => Promise<Notifications.NotificationRequest[]>;
|
||||
sendWorkoutReminder: (title: string, body: string, date?: Date) => Promise<string>;
|
||||
sendGoalAchievement: (title: string, body: string) => Promise<string>;
|
||||
sendMoodCheckinReminder: (title: string, body: string, date?: Date) => Promise<string>;
|
||||
debugNotificationStatus: () => Promise<void>;
|
||||
}
|
||||
|
||||
export const useNotifications = (): UseNotificationsReturn => {
|
||||
@@ -99,7 +97,7 @@ export const useNotifications = (): UseNotificationsReturn => {
|
||||
sound: true,
|
||||
priority: 'high',
|
||||
};
|
||||
|
||||
|
||||
if (date) {
|
||||
return notificationService.scheduleNotificationAtDate(notification, date);
|
||||
} else {
|
||||
@@ -107,17 +105,7 @@ export const useNotifications = (): UseNotificationsReturn => {
|
||||
}
|
||||
}, []);
|
||||
|
||||
const sendGoalAchievement = useCallback(async (title: string, body: string) => {
|
||||
const notification: NotificationData = {
|
||||
title,
|
||||
body,
|
||||
data: { type: NotificationTypes.GOAL_ACHIEVEMENT },
|
||||
sound: true,
|
||||
priority: 'high',
|
||||
};
|
||||
|
||||
return notificationService.sendImmediateNotification(notification);
|
||||
}, []);
|
||||
// sendGoalAchievement 函数已删除,因为目标功能已移除
|
||||
|
||||
const sendMoodCheckinReminder = useCallback(async (title: string, body: string, date?: Date) => {
|
||||
const notification: NotificationData = {
|
||||
@@ -127,7 +115,7 @@ export const useNotifications = (): UseNotificationsReturn => {
|
||||
sound: true,
|
||||
priority: 'normal',
|
||||
};
|
||||
|
||||
|
||||
if (date) {
|
||||
return notificationService.scheduleNotificationAtDate(notification, date);
|
||||
} else {
|
||||
@@ -135,10 +123,6 @@ export const useNotifications = (): UseNotificationsReturn => {
|
||||
}
|
||||
}, []);
|
||||
|
||||
const debugNotificationStatus = useCallback(async () => {
|
||||
return notificationService.debugNotificationStatus();
|
||||
}, []);
|
||||
|
||||
// 组件挂载时自动初始化
|
||||
useEffect(() => {
|
||||
initialize();
|
||||
@@ -156,8 +140,6 @@ export const useNotifications = (): UseNotificationsReturn => {
|
||||
cancelAllNotifications,
|
||||
getAllScheduledNotifications,
|
||||
sendWorkoutReminder,
|
||||
sendGoalAchievement,
|
||||
sendMoodCheckinReminder,
|
||||
debugNotificationStatus,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user