feat: 更新 UI 样式以及消息通知

This commit is contained in:
2025-09-14 21:41:33 +08:00
parent 24b144a0d1
commit 55d133c470
12 changed files with 801 additions and 610 deletions

View File

@@ -80,13 +80,6 @@ async function executeStandReminderTask(): Promise<void> {
const state = store.getState();
const userProfile = state.user.profile;
// 检查时间限制(工作时间内提醒,避免深夜或清晨打扰)
const currentHour = new Date().getHours();
if (currentHour < 9 || currentHour >= 21) {
console.log(`当前时间${currentHour}点,不在站立提醒时间范围内,跳过站立提醒`);
return;
}
// 获取用户名
const userName = userProfile?.name || '朋友';

View File

@@ -58,6 +58,7 @@ type CalendarTrigger = DailyTrigger | WeeklyTrigger | MonthlyTrigger;
export class NotificationService {
private static instance: NotificationService;
private isInitialized = false;
private isIniting = false
private constructor() { }
@@ -72,9 +73,10 @@ export class NotificationService {
* 初始化推送通知服务
*/
async initialize(): Promise<void> {
if (this.isInitialized) return;
if (this.isInitialized || this.isIniting) return;
try {
this.isIniting = true
// 请求通知权限
const { status: existingStatus } = await Notifications.getPermissionsAsync();
let finalStatus = existingStatus;
@@ -89,13 +91,6 @@ export class NotificationService {
return;
}
// 获取推送令牌(用于远程推送,本地推送不需要)
// if (Platform.OS !== 'web') {
// const token = await Notifications.getExpoPushTokenAsync({
// projectId: 'your-project-id', // 需要替换为实际的Expo项目ID
// });
// console.log('推送令牌:', token.data);
// }
// 设置通知监听器
this.setupNotificationListeners();
@@ -107,6 +102,8 @@ export class NotificationService {
console.log('推送通知服务初始化成功');
} catch (error) {
console.error('推送通知服务初始化失败:', error);
} finally {
this.isIniting = false
}
}