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
This commit is contained in:
richarjiang
2025-09-22 09:02:42 +08:00
parent fb85a5f30c
commit dbe460a084
5 changed files with 3 additions and 10 deletions

View File

@@ -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,

View File

@@ -13,7 +13,6 @@ export interface FitnessRingsData {
export interface HealthData {
activeCalories: number | null;
hrv: number | null;
heartRate: number | null;
activeEnergyBurned: number;
activeCaloriesGoal: number;

View File

@@ -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();

View File

@@ -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<TodayHealthDat
// 并行获取所有健康数据
const [
activeEnergyBurned,
hrv,
activitySummary,
heartRate
] = await Promise.all([
fetchActiveEnergyBurned(options),
fetchHeartRateVariability(options),
fetchActivitySummary(options),
fetchHeartRate(options)
]);
return {
activeEnergyBurned,
hrv,
activeCalories: Math.round(activitySummary?.activeEnergyBurned || 0),
activeCaloriesGoal: Math.round(activitySummary?.activeEnergyBurnedGoal || 350),
exerciseMinutes: Math.round(activitySummary?.appleExerciseTime || 0),

View File

@@ -803,7 +803,7 @@ export class WaterNotificationHelpers {
priority: 'normal',
},
{
type: 'DAILY' as any,
type: Notifications.SchedulableTriggerInputTypes.DAILY,
hour: hour,
minute: 0,
}
@@ -1278,7 +1278,7 @@ export class DailySummaryNotificationHelpers {
priority: 'normal',
},
{
type: 'DAILY' as any,
type: Notifications.SchedulableTriggerInputTypes.DAILY,
hour: hour,
minute: minute,
}