@gromozeqa/react-native-apple-health-kit 0.1.5 → 0.3.0

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.
Files changed (58) hide show
  1. package/README.md +14 -3
  2. package/{AppleHealthKit.podspec → ReactNativeAppleHealthKit.podspec} +1 -1
  3. package/android/generated/java/com/{applehealthkit/NativeAppleHealthKitSpec.java → gromozeqa/reactnativeapplehealthkit/NativeReactNativeAppleHealthKitSpec.java} +4 -4
  4. package/android/generated/jni/CMakeLists.txt +22 -9
  5. package/android/generated/jni/{RNAppleHealthKitSpec-generated.cpp → RNReactNativeAppleHealthKitSpec-generated.cpp} +13 -13
  6. package/android/generated/jni/{RNAppleHealthKitSpec.h → RNReactNativeAppleHealthKitSpec.h} +4 -4
  7. package/android/generated/jni/react/renderer/components/RNReactNativeAppleHealthKitSpec/RNReactNativeAppleHealthKitSpecJSI-generated.cpp +46 -0
  8. package/android/generated/jni/react/renderer/components/RNReactNativeAppleHealthKitSpec/RNReactNativeAppleHealthKitSpecJSI.h +299 -0
  9. package/ios/{AppleHealthKitManager.swift → HealthKitManager.swift} +8 -1
  10. package/ios/{AppleHealthKitPermissions.swift → HealthKitPermissions.swift} +8 -1
  11. package/ios/{AppleHealthKitQueries.swift → HealthKitQueries.swift} +8 -0
  12. package/ios/ReactNativeAppleHealthKit.h +6 -0
  13. package/ios/{AppleHealthKit.mm → ReactNativeAppleHealthKit.mm} +8 -8
  14. package/ios/{HealthKitUtils.swift → Utils.swift} +2 -2
  15. package/ios/generated/{RNAppleHealthKitSpec/RNAppleHealthKitSpec-generated.mm → RNReactNativeAppleHealthKitSpec/RNReactNativeAppleHealthKitSpec-generated.mm} +10 -20
  16. package/ios/generated/{RNAppleHealthKitSpec/RNAppleHealthKitSpec.h → RNReactNativeAppleHealthKitSpec/RNReactNativeAppleHealthKitSpec.h} +8 -21
  17. package/ios/generated/RNReactNativeAppleHealthKitSpecJSI-generated.cpp +46 -0
  18. package/ios/generated/RNReactNativeAppleHealthKitSpecJSI.h +299 -0
  19. package/lib/commonjs/{NativeAppleHealthKit.js → NativeReactNativeAppleHealthKit.js} +2 -2
  20. package/lib/commonjs/NativeReactNativeAppleHealthKit.js.map +1 -0
  21. package/lib/commonjs/index.js +16 -35
  22. package/lib/commonjs/index.js.map +1 -1
  23. package/lib/module/{NativeAppleHealthKit.js → NativeReactNativeAppleHealthKit.js} +2 -2
  24. package/lib/module/NativeReactNativeAppleHealthKit.js.map +1 -0
  25. package/lib/module/index.js +13 -14
  26. package/lib/module/index.js.map +1 -1
  27. package/lib/typescript/commonjs/src/NativeReactNativeAppleHealthKit.d.ts +28 -0
  28. package/lib/typescript/commonjs/src/NativeReactNativeAppleHealthKit.d.ts.map +1 -0
  29. package/lib/typescript/commonjs/src/index.d.ts +5 -5
  30. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  31. package/lib/typescript/module/src/NativeReactNativeAppleHealthKit.d.ts +28 -0
  32. package/lib/typescript/module/src/NativeReactNativeAppleHealthKit.d.ts.map +1 -0
  33. package/lib/typescript/module/src/index.d.ts +5 -5
  34. package/lib/typescript/module/src/index.d.ts.map +1 -1
  35. package/package.json +14 -12
  36. package/react-native.config.js +3 -2
  37. package/src/{NativeAppleHealthKit.ts → NativeReactNativeAppleHealthKit.ts} +23 -2
  38. package/src/index.tsx +19 -14
  39. package/android/generated/jni/react/renderer/components/RNAppleHealthKitSpec/RNAppleHealthKitSpecJSI-generated.cpp +0 -46
  40. package/android/generated/jni/react/renderer/components/RNAppleHealthKitSpec/RNAppleHealthKitSpecJSI.h +0 -98
  41. package/ios/AppleHealthKit.h +0 -6
  42. package/ios/generated/RNAppleHealthKitSpecJSI-generated.cpp +0 -46
  43. package/ios/generated/RNAppleHealthKitSpecJSI.h +0 -98
  44. package/lib/commonjs/NativeAppleHealthKit.js.map +0 -1
  45. package/lib/commonjs/types.js +0 -2
  46. package/lib/commonjs/types.js.map +0 -1
  47. package/lib/module/NativeAppleHealthKit.js.map +0 -1
  48. package/lib/module/types.js +0 -2
  49. package/lib/module/types.js.map +0 -1
  50. package/lib/typescript/commonjs/src/NativeAppleHealthKit.d.ts +0 -11
  51. package/lib/typescript/commonjs/src/NativeAppleHealthKit.d.ts.map +0 -1
  52. package/lib/typescript/commonjs/src/types.d.ts +0 -19
  53. package/lib/typescript/commonjs/src/types.d.ts.map +0 -1
  54. package/lib/typescript/module/src/NativeAppleHealthKit.d.ts +0 -11
  55. package/lib/typescript/module/src/NativeAppleHealthKit.d.ts.map +0 -1
  56. package/lib/typescript/module/src/types.d.ts +0 -19
  57. package/lib/typescript/module/src/types.d.ts.map +0 -1
  58. package/src/types.ts +0 -21
@@ -0,0 +1,28 @@
1
+ import type { TurboModule } from 'react-native';
2
+ export interface Step {
3
+ dateString: string;
4
+ stepCount: number;
5
+ }
6
+ export interface HeartRateValue {
7
+ time: string;
8
+ heartRate: number;
9
+ }
10
+ export interface HeartRate {
11
+ date: string;
12
+ value: HeartRateValue[];
13
+ }
14
+ export interface Measurement {
15
+ bodyMass: number | null;
16
+ height: number | null;
17
+ biologicalSex: string | null;
18
+ dateOfBirth: string | null;
19
+ }
20
+ export interface Spec extends TurboModule {
21
+ requestHealthKitPermissions(): Promise<string>;
22
+ getSteps(daysBefore: number): Promise<Step[]>;
23
+ getHeartRate(daysBefore: number): Promise<HeartRate[]>;
24
+ getMeasurement(): Promise<Measurement>;
25
+ }
26
+ declare const _default: Spec;
27
+ export default _default;
28
+ //# sourceMappingURL=NativeReactNativeAppleHealthKit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeReactNativeAppleHealthKit.d.ts","sourceRoot":"","sources":["../../../../src/NativeReactNativeAppleHealthKit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAI;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,2BAA2B,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9C,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IACvD,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;CACxC;;AAiBD,wBAEwE"}
@@ -1,6 +1,6 @@
1
- export * from './types';
2
- export declare const requestHealthKitPermissions: () => Promise<void>;
3
- export declare const getHeartRate: (days: number) => Promise<void>;
4
- export declare const getSteps: (days: number) => Promise<void>;
5
- export declare const getMeasurement: () => Promise<void>;
1
+ import { type HeartRate, type Measurement, type Step } from './NativeReactNativeAppleHealthKit';
2
+ export declare function requestHealthKitPermissions(): Promise<string>;
3
+ export declare function getMeasurement(): Promise<Measurement>;
4
+ export declare function getSteps(forNumberOfDay: number): Promise<Step[]>;
5
+ export declare function getHeartRate(forNumberOfDay: number): Promise<HeartRate[]>;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC;AAExB,eAAO,MAAM,2BAA2B,qBAEvC,CAAC;AAEF,eAAO,MAAM,YAAY,SAAgB,MAAM,kBAE9C,CAAC;AAEF,eAAO,MAAM,QAAQ,SAAgB,MAAM,kBAE1C,CAAC;AAEF,eAAO,MAAM,cAAc,qBAE1B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAkC,EAChC,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,IAAI,EACV,MAAM,mCAAmC,CAAC;AAE3C,wBAAsB,2BAA2B,IAAI,OAAO,CAAC,MAAM,CAAC,CAEnE;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAE3D;AAED,wBAAsB,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAEtE;AAED,wBAAsB,YAAY,CAChC,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,SAAS,EAAE,CAAC,CAEtB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gromozeqa/react-native-apple-health-kit",
3
- "version": "0.1.5",
4
- "description": "IOS module for Apple Healhkit",
3
+ "version": "0.3.0",
4
+ "description": "IOS module for react native to enable health kit",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",
7
7
  "module": "./lib/module/index.js",
@@ -37,7 +37,7 @@
37
37
  "!**/.*"
38
38
  ],
39
39
  "scripts": {
40
- "example": "yarn workspace react-native-apple-health-kit-example",
40
+ "example": "yarn workspace @gromozeqa/react-native-apple-health-kit-example",
41
41
  "test": "jest",
42
42
  "typecheck": "tsc",
43
43
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
@@ -54,7 +54,7 @@
54
54
  "type": "git",
55
55
  "url": "git+https://github.com/Luxlorys/react-native-apple-health-kit.git"
56
56
  },
57
- "author": "gromozeqa <a.burcev.dev@gmail.com> (https://github.com/Luxlorys)",
57
+ "author": "gromozeqa <a.burcev.dev@gmail.com> (https://www.npmjs.com/~gromozeqa)",
58
58
  "license": "MIT",
59
59
  "bugs": {
60
60
  "url": "https://github.com/Luxlorys/react-native-apple-health-kit/issues"
@@ -64,22 +64,22 @@
64
64
  "registry": "https://registry.npmjs.org/"
65
65
  },
66
66
  "devDependencies": {
67
- "@commitlint/config-conventional": "^17.0.2",
67
+ "@commitlint/config-conventional": "^19.6.0",
68
68
  "@evilmartians/lefthook": "^1.5.0",
69
69
  "@react-native-community/cli": "15.0.1",
70
70
  "@react-native/eslint-config": "^0.73.1",
71
- "@release-it/conventional-changelog": "10.0.0",
71
+ "@release-it/conventional-changelog": "^9.0.2",
72
72
  "@types/jest": "^29.5.5",
73
73
  "@types/react": "^18.2.44",
74
- "commitlint": "^17.0.2",
74
+ "commitlint": "^19.6.1",
75
75
  "del-cli": "^5.1.0",
76
76
  "eslint": "^8.51.0",
77
77
  "eslint-config-prettier": "^9.0.0",
78
78
  "eslint-plugin-prettier": "^5.0.1",
79
79
  "jest": "^29.7.0",
80
80
  "prettier": "^3.0.3",
81
- "react": "19.0.0",
82
- "react-native": "0.78.0",
81
+ "react": "18.2.0",
82
+ "react-native": "0.75.3",
83
83
  "react-native-builder-bob": "^0.37.0",
84
84
  "release-it": "^17.10.0",
85
85
  "turbo": "^1.10.7",
@@ -121,7 +121,9 @@
121
121
  },
122
122
  "plugins": {
123
123
  "@release-it/conventional-changelog": {
124
- "preset": "angular"
124
+ "preset": {
125
+ "name": "angular"
126
+ }
125
127
  }
126
128
  }
127
129
  },
@@ -183,7 +185,7 @@
183
185
  ]
184
186
  },
185
187
  "codegenConfig": {
186
- "name": "RNAppleHealthKitSpec",
188
+ "name": "RNReactNativeAppleHealthKitSpec",
187
189
  "type": "modules",
188
190
  "jsSrcsDir": "src",
189
191
  "outputDir": {
@@ -191,7 +193,7 @@
191
193
  "android": "android/generated"
192
194
  },
193
195
  "android": {
194
- "javaPackageName": "com.applehealthkit"
196
+ "javaPackageName": "com.gromozeqa.reactnativeapplehealthkit"
195
197
  },
196
198
  "includesGeneratedCode": true
197
199
  },
@@ -4,8 +4,9 @@
4
4
  module.exports = {
5
5
  dependency: {
6
6
  platforms: {
7
- android: {},
8
- ios: {},
7
+ android: {
8
+ cmakeListsPath: 'generated/jni/CMakeLists.txt',
9
+ },
9
10
  },
10
11
  },
11
12
  };
@@ -1,6 +1,27 @@
1
1
  import type { TurboModule } from 'react-native';
2
2
  import { Platform, TurboModuleRegistry } from 'react-native';
3
- import type { HeartRate, Measurement, Step } from './types';
3
+
4
+ export interface Step {
5
+ dateString: string;
6
+ stepCount: number;
7
+ }
8
+
9
+ export interface HeartRateValue {
10
+ time: string;
11
+ heartRate: number;
12
+ }
13
+
14
+ export interface HeartRate {
15
+ date: string;
16
+ value: HeartRateValue[];
17
+ }
18
+
19
+ export interface Measurement {
20
+ bodyMass: number | null;
21
+ height: number | null;
22
+ biologicalSex: string | null;
23
+ dateOfBirth: string | null;
24
+ }
4
25
 
5
26
  export interface Spec extends TurboModule {
6
27
  requestHealthKitPermissions(): Promise<string>;
@@ -26,4 +47,4 @@ const NoOpSpec: Spec = {
26
47
 
27
48
  export default Platform.OS === 'android'
28
49
  ? NoOpSpec
29
- : TurboModuleRegistry.getEnforcing<Spec>('AppleHealthKit');
50
+ : TurboModuleRegistry.getEnforcing<Spec>('ReactNativeAppleHealthKit');
package/src/index.tsx CHANGED
@@ -1,18 +1,23 @@
1
- import NativeAppleHealthKit from './NativeAppleHealthKit';
2
- export * from './types';
1
+ import ReactNativeAppleHealthKit, {
2
+ type HeartRate,
3
+ type Measurement,
4
+ type Step,
5
+ } from './NativeReactNativeAppleHealthKit';
3
6
 
4
- export const requestHealthKitPermissions = async () => {
5
- await NativeAppleHealthKit.requestHealthKitPermissions();
6
- };
7
+ export async function requestHealthKitPermissions(): Promise<string> {
8
+ return await ReactNativeAppleHealthKit.requestHealthKitPermissions();
9
+ }
7
10
 
8
- export const getHeartRate = async (days: number) => {
9
- await NativeAppleHealthKit.getHeartRate(days);
10
- };
11
+ export async function getMeasurement(): Promise<Measurement> {
12
+ return await ReactNativeAppleHealthKit.getMeasurement();
13
+ }
11
14
 
12
- export const getSteps = async (days: number) => {
13
- await NativeAppleHealthKit.getSteps(days);
14
- };
15
+ export async function getSteps(forNumberOfDay: number): Promise<Step[]> {
16
+ return await ReactNativeAppleHealthKit.getSteps(forNumberOfDay);
17
+ }
15
18
 
16
- export const getMeasurement = async () => {
17
- await NativeAppleHealthKit.getMeasurement();
18
- };
19
+ export async function getHeartRate(
20
+ forNumberOfDay: number
21
+ ): Promise<HeartRate[]> {
22
+ return await ReactNativeAppleHealthKit.getHeartRate(forNumberOfDay);
23
+ }
@@ -1,46 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateModuleCpp.js
8
- */
9
-
10
- #include "RNAppleHealthKitSpecJSI.h"
11
-
12
- namespace facebook::react {
13
-
14
- static jsi::Value __hostFunction_NativeAppleHealthKitCxxSpecJSI_requestHealthKitPermissions(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
15
- return static_cast<NativeAppleHealthKitCxxSpecJSI *>(&turboModule)->requestHealthKitPermissions(
16
- rt
17
- );
18
- }
19
- static jsi::Value __hostFunction_NativeAppleHealthKitCxxSpecJSI_getSteps(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
20
- return static_cast<NativeAppleHealthKitCxxSpecJSI *>(&turboModule)->getSteps(
21
- rt,
22
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
23
- );
24
- }
25
- static jsi::Value __hostFunction_NativeAppleHealthKitCxxSpecJSI_getHeartRate(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
26
- return static_cast<NativeAppleHealthKitCxxSpecJSI *>(&turboModule)->getHeartRate(
27
- rt,
28
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
29
- );
30
- }
31
- static jsi::Value __hostFunction_NativeAppleHealthKitCxxSpecJSI_getMeasurement(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
32
- return static_cast<NativeAppleHealthKitCxxSpecJSI *>(&turboModule)->getMeasurement(
33
- rt
34
- );
35
- }
36
-
37
- NativeAppleHealthKitCxxSpecJSI::NativeAppleHealthKitCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
38
- : TurboModule("AppleHealthKit", jsInvoker) {
39
- methodMap_["requestHealthKitPermissions"] = MethodMetadata {0, __hostFunction_NativeAppleHealthKitCxxSpecJSI_requestHealthKitPermissions};
40
- methodMap_["getSteps"] = MethodMetadata {1, __hostFunction_NativeAppleHealthKitCxxSpecJSI_getSteps};
41
- methodMap_["getHeartRate"] = MethodMetadata {1, __hostFunction_NativeAppleHealthKitCxxSpecJSI_getHeartRate};
42
- methodMap_["getMeasurement"] = MethodMetadata {0, __hostFunction_NativeAppleHealthKitCxxSpecJSI_getMeasurement};
43
- }
44
-
45
-
46
- } // namespace facebook::react
@@ -1,98 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateModuleH.js
8
- */
9
-
10
- #pragma once
11
-
12
- #include <ReactCommon/TurboModule.h>
13
- #include <react/bridging/Bridging.h>
14
-
15
- namespace facebook::react {
16
-
17
-
18
- class JSI_EXPORT NativeAppleHealthKitCxxSpecJSI : public TurboModule {
19
- protected:
20
- NativeAppleHealthKitCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
21
-
22
- public:
23
- virtual jsi::Value requestHealthKitPermissions(jsi::Runtime &rt) = 0;
24
- virtual jsi::Value getSteps(jsi::Runtime &rt, double daysBefore) = 0;
25
- virtual jsi::Value getHeartRate(jsi::Runtime &rt, double daysBefore) = 0;
26
- virtual jsi::Value getMeasurement(jsi::Runtime &rt) = 0;
27
-
28
- };
29
-
30
- template <typename T>
31
- class JSI_EXPORT NativeAppleHealthKitCxxSpec : public TurboModule {
32
- public:
33
- jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
34
- return delegate_.create(rt, propName);
35
- }
36
-
37
- std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
38
- return delegate_.getPropertyNames(runtime);
39
- }
40
-
41
- static constexpr std::string_view kModuleName = "AppleHealthKit";
42
-
43
- protected:
44
- NativeAppleHealthKitCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
45
- : TurboModule(std::string{NativeAppleHealthKitCxxSpec::kModuleName}, jsInvoker),
46
- delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
47
-
48
-
49
- private:
50
- class Delegate : public NativeAppleHealthKitCxxSpecJSI {
51
- public:
52
- Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
53
- NativeAppleHealthKitCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
54
-
55
- }
56
-
57
- jsi::Value requestHealthKitPermissions(jsi::Runtime &rt) override {
58
- static_assert(
59
- bridging::getParameterCount(&T::requestHealthKitPermissions) == 1,
60
- "Expected requestHealthKitPermissions(...) to have 1 parameters");
61
-
62
- return bridging::callFromJs<jsi::Value>(
63
- rt, &T::requestHealthKitPermissions, jsInvoker_, instance_);
64
- }
65
- jsi::Value getSteps(jsi::Runtime &rt, double daysBefore) override {
66
- static_assert(
67
- bridging::getParameterCount(&T::getSteps) == 2,
68
- "Expected getSteps(...) to have 2 parameters");
69
-
70
- return bridging::callFromJs<jsi::Value>(
71
- rt, &T::getSteps, jsInvoker_, instance_, std::move(daysBefore));
72
- }
73
- jsi::Value getHeartRate(jsi::Runtime &rt, double daysBefore) override {
74
- static_assert(
75
- bridging::getParameterCount(&T::getHeartRate) == 2,
76
- "Expected getHeartRate(...) to have 2 parameters");
77
-
78
- return bridging::callFromJs<jsi::Value>(
79
- rt, &T::getHeartRate, jsInvoker_, instance_, std::move(daysBefore));
80
- }
81
- jsi::Value getMeasurement(jsi::Runtime &rt) override {
82
- static_assert(
83
- bridging::getParameterCount(&T::getMeasurement) == 1,
84
- "Expected getMeasurement(...) to have 1 parameters");
85
-
86
- return bridging::callFromJs<jsi::Value>(
87
- rt, &T::getMeasurement, jsInvoker_, instance_);
88
- }
89
-
90
- private:
91
- friend class NativeAppleHealthKitCxxSpec;
92
- T *instance_;
93
- };
94
-
95
- Delegate delegate_;
96
- };
97
-
98
- } // namespace facebook::react
@@ -1,6 +0,0 @@
1
-
2
- #import "generated/RNAppleHealthKitSpec/RNAppleHealthKitSpec.h"
3
-
4
- @interface AppleHealthKit : NSObject <NativeAppleHealthKitSpec>
5
-
6
- @end
@@ -1,46 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateModuleCpp.js
8
- */
9
-
10
- #include "RNAppleHealthKitSpecJSI.h"
11
-
12
- namespace facebook::react {
13
-
14
- static jsi::Value __hostFunction_NativeAppleHealthKitCxxSpecJSI_requestHealthKitPermissions(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
15
- return static_cast<NativeAppleHealthKitCxxSpecJSI *>(&turboModule)->requestHealthKitPermissions(
16
- rt
17
- );
18
- }
19
- static jsi::Value __hostFunction_NativeAppleHealthKitCxxSpecJSI_getSteps(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
20
- return static_cast<NativeAppleHealthKitCxxSpecJSI *>(&turboModule)->getSteps(
21
- rt,
22
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
23
- );
24
- }
25
- static jsi::Value __hostFunction_NativeAppleHealthKitCxxSpecJSI_getHeartRate(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
26
- return static_cast<NativeAppleHealthKitCxxSpecJSI *>(&turboModule)->getHeartRate(
27
- rt,
28
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
29
- );
30
- }
31
- static jsi::Value __hostFunction_NativeAppleHealthKitCxxSpecJSI_getMeasurement(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
32
- return static_cast<NativeAppleHealthKitCxxSpecJSI *>(&turboModule)->getMeasurement(
33
- rt
34
- );
35
- }
36
-
37
- NativeAppleHealthKitCxxSpecJSI::NativeAppleHealthKitCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
38
- : TurboModule("AppleHealthKit", jsInvoker) {
39
- methodMap_["requestHealthKitPermissions"] = MethodMetadata {0, __hostFunction_NativeAppleHealthKitCxxSpecJSI_requestHealthKitPermissions};
40
- methodMap_["getSteps"] = MethodMetadata {1, __hostFunction_NativeAppleHealthKitCxxSpecJSI_getSteps};
41
- methodMap_["getHeartRate"] = MethodMetadata {1, __hostFunction_NativeAppleHealthKitCxxSpecJSI_getHeartRate};
42
- methodMap_["getMeasurement"] = MethodMetadata {0, __hostFunction_NativeAppleHealthKitCxxSpecJSI_getMeasurement};
43
- }
44
-
45
-
46
- } // namespace facebook::react
@@ -1,98 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateModuleH.js
8
- */
9
-
10
- #pragma once
11
-
12
- #include <ReactCommon/TurboModule.h>
13
- #include <react/bridging/Bridging.h>
14
-
15
- namespace facebook::react {
16
-
17
-
18
- class JSI_EXPORT NativeAppleHealthKitCxxSpecJSI : public TurboModule {
19
- protected:
20
- NativeAppleHealthKitCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
21
-
22
- public:
23
- virtual jsi::Value requestHealthKitPermissions(jsi::Runtime &rt) = 0;
24
- virtual jsi::Value getSteps(jsi::Runtime &rt, double daysBefore) = 0;
25
- virtual jsi::Value getHeartRate(jsi::Runtime &rt, double daysBefore) = 0;
26
- virtual jsi::Value getMeasurement(jsi::Runtime &rt) = 0;
27
-
28
- };
29
-
30
- template <typename T>
31
- class JSI_EXPORT NativeAppleHealthKitCxxSpec : public TurboModule {
32
- public:
33
- jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
34
- return delegate_.create(rt, propName);
35
- }
36
-
37
- std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
38
- return delegate_.getPropertyNames(runtime);
39
- }
40
-
41
- static constexpr std::string_view kModuleName = "AppleHealthKit";
42
-
43
- protected:
44
- NativeAppleHealthKitCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
45
- : TurboModule(std::string{NativeAppleHealthKitCxxSpec::kModuleName}, jsInvoker),
46
- delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
47
-
48
-
49
- private:
50
- class Delegate : public NativeAppleHealthKitCxxSpecJSI {
51
- public:
52
- Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
53
- NativeAppleHealthKitCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
54
-
55
- }
56
-
57
- jsi::Value requestHealthKitPermissions(jsi::Runtime &rt) override {
58
- static_assert(
59
- bridging::getParameterCount(&T::requestHealthKitPermissions) == 1,
60
- "Expected requestHealthKitPermissions(...) to have 1 parameters");
61
-
62
- return bridging::callFromJs<jsi::Value>(
63
- rt, &T::requestHealthKitPermissions, jsInvoker_, instance_);
64
- }
65
- jsi::Value getSteps(jsi::Runtime &rt, double daysBefore) override {
66
- static_assert(
67
- bridging::getParameterCount(&T::getSteps) == 2,
68
- "Expected getSteps(...) to have 2 parameters");
69
-
70
- return bridging::callFromJs<jsi::Value>(
71
- rt, &T::getSteps, jsInvoker_, instance_, std::move(daysBefore));
72
- }
73
- jsi::Value getHeartRate(jsi::Runtime &rt, double daysBefore) override {
74
- static_assert(
75
- bridging::getParameterCount(&T::getHeartRate) == 2,
76
- "Expected getHeartRate(...) to have 2 parameters");
77
-
78
- return bridging::callFromJs<jsi::Value>(
79
- rt, &T::getHeartRate, jsInvoker_, instance_, std::move(daysBefore));
80
- }
81
- jsi::Value getMeasurement(jsi::Runtime &rt) override {
82
- static_assert(
83
- bridging::getParameterCount(&T::getMeasurement) == 1,
84
- "Expected getMeasurement(...) to have 1 parameters");
85
-
86
- return bridging::callFromJs<jsi::Value>(
87
- rt, &T::getMeasurement, jsInvoker_, instance_);
88
- }
89
-
90
- private:
91
- friend class NativeAppleHealthKitCxxSpec;
92
- T *instance_;
93
- };
94
-
95
- Delegate delegate_;
96
- };
97
-
98
- } // namespace facebook::react
@@ -1 +0,0 @@
1
- {"version":3,"names":["_reactNative","require","NoOpSpec","requestHealthKitPermissions","Promise","reject","Error","getSteps","getHeartRate","getMeasurement","_default","exports","default","Platform","OS","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeAppleHealthKit.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAUA,MAAMC,QAAc,GAAG;EACrBC,2BAA2BA,CAAA,EAAoB;IAC7C,OAAOC,OAAO,CAACC,MAAM,CAAC,IAAIC,KAAK,CAAC,wCAAwC,CAAC,CAAC;EAC5E,CAAC;EACDC,QAAQA,CAAA,EAAoB;IAC1B,OAAOH,OAAO,CAACC,MAAM,CAAC,IAAIC,KAAK,CAAC,wCAAwC,CAAC,CAAC;EAC5E,CAAC;EACDE,YAAYA,CAAA,EAAyB;IACnC,OAAOJ,OAAO,CAACC,MAAM,CAAC,IAAIC,KAAK,CAAC,wCAAwC,CAAC,CAAC;EAC5E,CAAC;EACDG,cAAcA,CAAA,EAAyB;IACrC,OAAOL,OAAO,CAACC,MAAM,CAAC,IAAIC,KAAK,CAAC,wCAAwC,CAAC,CAAC;EAC5E;AACF,CAAC;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaC,qBAAQ,CAACC,EAAE,KAAK,SAAS,GACpCZ,QAAQ,GACRa,gCAAmB,CAACC,YAAY,CAAO,gBAAgB,CAAC","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["Platform","TurboModuleRegistry","NoOpSpec","requestHealthKitPermissions","Promise","reject","Error","getSteps","getHeartRate","getMeasurement","OS","getEnforcing"],"sourceRoot":"../../src","sources":["NativeAppleHealthKit.ts"],"mappings":";;AACA,SAASA,QAAQ,EAAEC,mBAAmB,QAAQ,cAAc;AAU5D,MAAMC,QAAc,GAAG;EACrBC,2BAA2BA,CAAA,EAAoB;IAC7C,OAAOC,OAAO,CAACC,MAAM,CAAC,IAAIC,KAAK,CAAC,wCAAwC,CAAC,CAAC;EAC5E,CAAC;EACDC,QAAQA,CAAA,EAAoB;IAC1B,OAAOH,OAAO,CAACC,MAAM,CAAC,IAAIC,KAAK,CAAC,wCAAwC,CAAC,CAAC;EAC5E,CAAC;EACDE,YAAYA,CAAA,EAAyB;IACnC,OAAOJ,OAAO,CAACC,MAAM,CAAC,IAAIC,KAAK,CAAC,wCAAwC,CAAC,CAAC;EAC5E,CAAC;EACDG,cAAcA,CAAA,EAAyB;IACrC,OAAOL,OAAO,CAACC,MAAM,CAAC,IAAIC,KAAK,CAAC,wCAAwC,CAAC,CAAC;EAC5E;AACF,CAAC;AAED,eAAeN,QAAQ,CAACU,EAAE,KAAK,SAAS,GACpCR,QAAQ,GACRD,mBAAmB,CAACU,YAAY,CAAO,gBAAgB,CAAC","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
@@ -1,11 +0,0 @@
1
- import type { TurboModule } from 'react-native';
2
- import type { HeartRate, Measurement, Step } from './types';
3
- export interface Spec extends TurboModule {
4
- requestHealthKitPermissions(): Promise<string>;
5
- getSteps(daysBefore: number): Promise<Step[]>;
6
- getHeartRate(daysBefore: number): Promise<HeartRate[]>;
7
- getMeasurement(): Promise<Measurement>;
8
- }
9
- declare const _default: Spec;
10
- export default _default;
11
- //# sourceMappingURL=NativeAppleHealthKit.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NativeAppleHealthKit.d.ts","sourceRoot":"","sources":["../../../../src/NativeAppleHealthKit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5D,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,2BAA2B,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9C,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IACvD,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;CACxC;;AAiBD,wBAE6D"}
@@ -1,19 +0,0 @@
1
- export interface Step {
2
- dateString: string;
3
- stepCount: number;
4
- }
5
- export interface HeartRateValue {
6
- time: string;
7
- heartRate: number;
8
- }
9
- export interface HeartRate {
10
- date: string;
11
- value: HeartRateValue[];
12
- }
13
- export interface Measurement {
14
- bodyMass: number | null;
15
- height: number | null;
16
- biologicalSex: string | null;
17
- dateOfBirth: string | null;
18
- }
19
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B"}
@@ -1,11 +0,0 @@
1
- import type { TurboModule } from 'react-native';
2
- import type { HeartRate, Measurement, Step } from './types';
3
- export interface Spec extends TurboModule {
4
- requestHealthKitPermissions(): Promise<string>;
5
- getSteps(daysBefore: number): Promise<Step[]>;
6
- getHeartRate(daysBefore: number): Promise<HeartRate[]>;
7
- getMeasurement(): Promise<Measurement>;
8
- }
9
- declare const _default: Spec;
10
- export default _default;
11
- //# sourceMappingURL=NativeAppleHealthKit.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NativeAppleHealthKit.d.ts","sourceRoot":"","sources":["../../../../src/NativeAppleHealthKit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5D,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,2BAA2B,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9C,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IACvD,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;CACxC;;AAiBD,wBAE6D"}
@@ -1,19 +0,0 @@
1
- export interface Step {
2
- dateString: string;
3
- stepCount: number;
4
- }
5
- export interface HeartRateValue {
6
- time: string;
7
- heartRate: number;
8
- }
9
- export interface HeartRate {
10
- date: string;
11
- value: HeartRateValue[];
12
- }
13
- export interface Measurement {
14
- bodyMass: number | null;
15
- height: number | null;
16
- biologicalSex: string | null;
17
- dateOfBirth: string | null;
18
- }
19
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B"}
package/src/types.ts DELETED
@@ -1,21 +0,0 @@
1
- export interface Step {
2
- dateString: string;
3
- stepCount: number;
4
- }
5
-
6
- export interface HeartRateValue {
7
- time: string;
8
- heartRate: number;
9
- }
10
-
11
- export interface HeartRate {
12
- date: string;
13
- value: HeartRateValue[];
14
- }
15
-
16
- export interface Measurement {
17
- bodyMass: number | null;
18
- height: number | null;
19
- biologicalSex: string | null;
20
- dateOfBirth: string | null;
21
- }