From dbe460a084ab94a66a541a379c29bef3f7f4ad81 Mon Sep 17 00:00:00 2001 From: richarjiang Date: Mon, 22 Sep 2025 09:02:42 +0800 Subject: [PATCH] refactor(health): remove HRV field and improve notification types - Remove heart rate variability (hrv) field from health data interfaces and implementations - Update default member name to Chinese localization - Replace type assertions with proper enum types in notification schedulers --- app/(tabs)/statistics.tsx | 1 - store/healthSlice.ts | 1 - store/userSlice.ts | 2 +- utils/health.ts | 5 ----- utils/notificationHelpers.ts | 4 ++-- 5 files changed, 3 insertions(+), 10 deletions(-) diff --git a/app/(tabs)/statistics.tsx b/app/(tabs)/statistics.tsx index 2b6eb71..e84bbcf 100644 --- a/app/(tabs)/statistics.tsx +++ b/app/(tabs)/statistics.tsx @@ -229,7 +229,6 @@ export default function ExploreScreen() { date: dateString, data: { activeCalories: data.activeEnergyBurned, - hrv: data.hrv, heartRate: data.heartRate, activeEnergyBurned: data.activeEnergyBurned, activeCaloriesGoal: data.activeCaloriesGoal, diff --git a/store/healthSlice.ts b/store/healthSlice.ts index fbc25a6..85dfac4 100644 --- a/store/healthSlice.ts +++ b/store/healthSlice.ts @@ -13,7 +13,6 @@ export interface FitnessRingsData { export interface HealthData { activeCalories: number | null; - hrv: number | null; heartRate: number | null; activeEnergyBurned: number; activeCaloriesGoal: number; diff --git a/store/userSlice.ts b/store/userSlice.ts index af2e60f..cbd3cb9 100644 --- a/store/userSlice.ts +++ b/store/userSlice.ts @@ -92,7 +92,7 @@ export type UserState = { activityHistory: ActivityHistoryItem[]; }; -export const DEFAULT_MEMBER_NAME = ''; +export const DEFAULT_MEMBER_NAME = '朋友'; const getInitialState = (): UserState => { const preloaded = getPreloadedUserData(); diff --git a/utils/health.ts b/utils/health.ts index 8ce53a3..81cdb48 100644 --- a/utils/health.ts +++ b/utils/health.ts @@ -207,7 +207,6 @@ export type HourlyStandData = { export type TodayHealthData = { activeEnergyBurned: number; // kilocalories - hrv: number | null; // 心率变异性 (ms) // 健身圆环数据 activeCalories: number; activeCaloriesGoal: number; @@ -607,7 +606,6 @@ export async function fetchMaximumHeartRate(_options: HealthDataOptions): Promis function getDefaultHealthData(): TodayHealthData { return { activeEnergyBurned: 0, - hrv: null, activeCalories: 0, activeCaloriesGoal: 350, exerciseMinutes: 0, @@ -628,19 +626,16 @@ export async function fetchHealthDataForDate(date: Date): Promise