feat(app): 新增HRV压力提醒设置与锻炼记录分享功能

- 通知设置页面新增 HRV 压力提醒开关,支持自定义开启或关闭压力监测推送
- 锻炼详情页集成分享功能,支持将运动数据生成精美长图并分享
- 优化 HRV 监测服务逻辑,在发送通知前检查用户偏好设置
- 更新多语言配置文件,添加相关文案翻译
- 将应用版本号更新至 1.1.5
This commit is contained in:
richarjiang
2025-12-16 11:27:11 +08:00
parent 409f125db1
commit 5e11da34ee
9 changed files with 569 additions and 122 deletions

View File

@@ -2,6 +2,7 @@ import { analyzeHRVData, fetchHRVWithStatus } from '@/utils/health';
import AsyncStorage from '@/utils/kvStore';
import { logger } from '@/utils/logger';
import { convertHrvToStressIndex, getStressLevelInfo, StressLevel } from '@/utils/stress';
import { getHRVReminderEnabled, getNotificationEnabled } from '@/utils/userPreferences';
import { NativeEventEmitter, NativeModules } from 'react-native';
import { sendHRVStressNotification } from './hrvNotificationService';
@@ -88,6 +89,16 @@ class HRVMonitorService {
this.lastProcessedTime = now;
try {
const [notificationsEnabled, hrvReminderEnabled] = await Promise.all([
getNotificationEnabled(),
getHRVReminderEnabled(),
]);
if (!notificationsEnabled || !hrvReminderEnabled) {
logger.info('[HRVMonitor] Notification preference disabled, skip HRV push');
return;
}
const canNotify = await this.canSendNotification(now);
if (!canNotify) {
logger.info('[HRVMonitor] Notification recently sent, skipping');