@gromozeqa/react-native-apple-health-kit 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AppleHealthKit.podspec +42 -0
- package/LICENSE +20 -0
- package/README.md +22 -0
- package/android/generated/java/com/applehealthkit/NativeAppleHealthKitSpec.java +50 -0
- package/android/generated/jni/CMakeLists.txt +36 -0
- package/android/generated/jni/RNAppleHealthKitSpec-generated.cpp +50 -0
- package/android/generated/jni/RNAppleHealthKitSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNAppleHealthKitSpec/RNAppleHealthKitSpecJSI-generated.cpp +46 -0
- package/android/generated/jni/react/renderer/components/RNAppleHealthKitSpec/RNAppleHealthKitSpecJSI.h +255 -0
- package/ios/AppleHealthKit.h +6 -0
- package/ios/AppleHealthKit.mm +61 -0
- package/ios/AppleHealthKitManager.swift +48 -0
- package/ios/AppleHealthKitPermissions.swift +26 -0
- package/ios/AppleHealthKitQueries.swift +200 -0
- package/ios/HealthKitUtils.swift +61 -0
- package/ios/generated/RNAppleHealthKitSpec/RNAppleHealthKitSpec-generated.mm +60 -0
- package/ios/generated/RNAppleHealthKitSpec/RNAppleHealthKitSpec.h +71 -0
- package/ios/generated/RNAppleHealthKitSpecJSI-generated.cpp +46 -0
- package/ios/generated/RNAppleHealthKitSpecJSI.h +255 -0
- package/lib/commonjs/NativeAppleHealthKit.js +23 -0
- package/lib/commonjs/NativeAppleHealthKit.js.map +1 -0
- package/lib/commonjs/index.js +19 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/NativeAppleHealthKit.js +19 -0
- package/lib/module/NativeAppleHealthKit.js.map +1 -0
- package/lib/module/index.js +10 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/NativeAppleHealthKit.d.ts +27 -0
- package/lib/typescript/commonjs/src/NativeAppleHealthKit.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +2 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/NativeAppleHealthKit.d.ts +27 -0
- package/lib/typescript/module/src/NativeAppleHealthKit.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +2 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +203 -0
- package/react-native.config.js +11 -0
- package/src/NativeAppleHealthKit.ts +48 -0
- package/src/index.tsx +8 -0
@@ -0,0 +1,48 @@
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
2
|
+
import { Platform, TurboModuleRegistry } from 'react-native';
|
3
|
+
|
4
|
+
export interface Step {
|
5
|
+
dateString: string;
|
6
|
+
stepCount: number;
|
7
|
+
}
|
8
|
+
|
9
|
+
export interface HeartRate {
|
10
|
+
date: string;
|
11
|
+
value: {
|
12
|
+
time: string;
|
13
|
+
heartRate: number;
|
14
|
+
}[];
|
15
|
+
}
|
16
|
+
|
17
|
+
export interface Measurement {
|
18
|
+
bodyMass: number | null;
|
19
|
+
height: number | null;
|
20
|
+
biologicalSex: string | null;
|
21
|
+
dateOfBirth: string | null;
|
22
|
+
}
|
23
|
+
|
24
|
+
export interface Spec extends TurboModule {
|
25
|
+
requestHealthKitPermissions(): Promise<string>;
|
26
|
+
getSteps(daysBefore: number): Promise<Step[]>;
|
27
|
+
getHeartRate(daysBefore: number): Promise<HeartRate[]>;
|
28
|
+
getMeasurement(): Promise<Measurement>;
|
29
|
+
}
|
30
|
+
|
31
|
+
const NoOpSpec: Spec = {
|
32
|
+
requestHealthKitPermissions(): Promise<string> {
|
33
|
+
return Promise.reject(new Error('HealthKit is not available on Android.'));
|
34
|
+
},
|
35
|
+
getSteps(): Promise<Step[]> {
|
36
|
+
return Promise.reject(new Error('HealthKit is not available on Android.'));
|
37
|
+
},
|
38
|
+
getHeartRate(): Promise<HeartRate[]> {
|
39
|
+
return Promise.reject(new Error('HealthKit is not available on Android.'));
|
40
|
+
},
|
41
|
+
getMeasurement(): Promise<Measurement> {
|
42
|
+
return Promise.reject(new Error('HealthKit is not available on Android.'));
|
43
|
+
},
|
44
|
+
};
|
45
|
+
|
46
|
+
export default Platform.OS === 'android'
|
47
|
+
? NoOpSpec
|
48
|
+
: TurboModuleRegistry.getEnforcing<Spec>('AppleHealthKit');
|