feat: 支持健康数据上报
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { CompleteSleepData, fetchCompleteSleepData } from '@/utils/sleepHealthKit';
|
||||
import dayjs from 'dayjs';
|
||||
import { AppState, AppStateStatus, NativeModules } from 'react-native';
|
||||
import i18n from '../i18n';
|
||||
@@ -599,7 +600,7 @@ async function fetchHourlyStandHours(date: Date): Promise<number[]> {
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchActiveEnergyBurned(options: HealthDataOptions): Promise<number> {
|
||||
export async function fetchActiveEnergyBurned(options: HealthDataOptions): Promise<number> {
|
||||
try {
|
||||
const result = await HealthKitManager.getActiveEnergyBurned(options);
|
||||
|
||||
@@ -1484,10 +1485,14 @@ export async function fetchHourlyStandHoursForDate(date: Date): Promise<HourlySt
|
||||
const hourlyStandData = await fetchHourlyStandHours(date);
|
||||
return hourlyStandData.map((hasStood, hour) => ({
|
||||
hour,
|
||||
hasStood
|
||||
hasStood: typeof hasStood === 'number' ? hasStood : (hasStood ? 1 : 0)
|
||||
}));
|
||||
}
|
||||
|
||||
// 导出获取完整睡眠数据的函数 (代理到 sleepHealthKit)
|
||||
export { fetchCompleteSleepData };
|
||||
export type { CompleteSleepData };
|
||||
|
||||
// 专门为活动圆环详情页获取精简的数据
|
||||
export async function fetchActivityRingsForDate(date: Date): Promise<ActivityRingsData | null> {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user