feat: 支持原生模块健康数据
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* React Native TypeScript bindings for iOS HealthKit access
|
||||
*/
|
||||
|
||||
import { NativeModules } from 'react-native';
|
||||
import { requireNativeModule } from 'expo-modules-core';
|
||||
|
||||
export interface HealthKitPermissions {
|
||||
[key: string]: 'notDetermined' | 'denied' | 'authorized' | 'unknown';
|
||||
@@ -50,6 +50,12 @@ export interface HealthKitManagerInterface {
|
||||
*/
|
||||
requestAuthorization(): Promise<HealthKitAuthorizationResult>;
|
||||
|
||||
/**
|
||||
* Get current authorization status for HealthKit data types
|
||||
* This checks the current permission status without prompting the user
|
||||
*/
|
||||
getAuthorizationStatus(): Promise<HealthKitAuthorizationResult>;
|
||||
|
||||
/**
|
||||
* Get sleep analysis data from HealthKit
|
||||
* @param options Query options including date range and limit
|
||||
@@ -57,11 +63,8 @@ export interface HealthKitManagerInterface {
|
||||
getSleepData(options?: SleepDataOptions): Promise<SleepDataResult>;
|
||||
}
|
||||
|
||||
console.log('NativeModules', NativeModules);
|
||||
|
||||
|
||||
// Native module interface
|
||||
const HealthKitManager: HealthKitManagerInterface = NativeModules.HealthKitManager;
|
||||
const HealthKitManager: HealthKitManagerInterface = requireNativeModule('HealthKitManager');
|
||||
|
||||
export default HealthKitManager;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user