@gromozeqa/react-native-apple-health-kit 0.1.5 → 0.2.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.
- package/README.md +14 -3
- package/{AppleHealthKit.podspec → ReactNativeAppleHealthKit.podspec} +1 -1
- package/android/generated/java/com/{applehealthkit/NativeAppleHealthKitSpec.java → gromozeqa/reactnativeapplehealthkit/NativeReactNativeAppleHealthKitSpec.java} +4 -4
- package/android/generated/jni/CMakeLists.txt +5 -5
- package/android/generated/jni/{RNAppleHealthKitSpec-generated.cpp → RNReactNativeAppleHealthKitSpec-generated.cpp} +13 -13
- package/android/generated/jni/{RNAppleHealthKitSpec.h → RNReactNativeAppleHealthKitSpec.h} +4 -4
- package/android/generated/jni/react/renderer/components/RNReactNativeAppleHealthKitSpec/RNReactNativeAppleHealthKitSpecJSI-generated.cpp +46 -0
- package/android/generated/jni/react/renderer/components/RNReactNativeAppleHealthKitSpec/RNReactNativeAppleHealthKitSpecJSI.h +303 -0
- package/ios/{AppleHealthKitManager.swift → HealthKitManager.swift} +8 -1
- package/ios/{AppleHealthKitPermissions.swift → HealthKitPermissions.swift} +8 -1
- package/ios/{AppleHealthKitQueries.swift → HealthKitQueries.swift} +8 -0
- package/ios/ReactNativeAppleHealthKit.h +6 -0
- package/ios/{AppleHealthKit.mm → ReactNativeAppleHealthKit.mm} +8 -8
- package/ios/{HealthKitUtils.swift → Utils.swift} +2 -2
- package/ios/generated/{RNAppleHealthKitSpec/RNAppleHealthKitSpec-generated.mm → RNReactNativeAppleHealthKitSpec/RNReactNativeAppleHealthKitSpec-generated.mm} +11 -11
- package/ios/generated/{RNAppleHealthKitSpec/RNAppleHealthKitSpec.h → RNReactNativeAppleHealthKitSpec/RNReactNativeAppleHealthKitSpec.h} +9 -9
- package/ios/generated/RNReactNativeAppleHealthKitSpecJSI-generated.cpp +46 -0
- package/ios/generated/RNReactNativeAppleHealthKitSpecJSI.h +303 -0
- package/lib/commonjs/{NativeAppleHealthKit.js → NativeReactNativeAppleHealthKit.js} +2 -2
- package/lib/commonjs/NativeReactNativeAppleHealthKit.js.map +1 -0
- package/lib/commonjs/index.js +16 -35
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/{NativeAppleHealthKit.js → NativeReactNativeAppleHealthKit.js} +2 -2
- package/lib/module/NativeReactNativeAppleHealthKit.js.map +1 -0
- package/lib/module/index.js +13 -14
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/NativeReactNativeAppleHealthKit.d.ts +28 -0
- package/lib/typescript/commonjs/src/NativeReactNativeAppleHealthKit.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +5 -5
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/NativeReactNativeAppleHealthKit.d.ts +28 -0
- package/lib/typescript/module/src/NativeReactNativeAppleHealthKit.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +5 -5
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +8 -8
- package/react-native.config.js +3 -2
- package/src/{NativeAppleHealthKit.ts → NativeReactNativeAppleHealthKit.ts} +23 -2
- package/src/index.tsx +19 -14
- package/android/generated/jni/react/renderer/components/RNAppleHealthKitSpec/RNAppleHealthKitSpecJSI-generated.cpp +0 -46
- package/android/generated/jni/react/renderer/components/RNAppleHealthKitSpec/RNAppleHealthKitSpecJSI.h +0 -98
- package/ios/AppleHealthKit.h +0 -6
- package/ios/generated/RNAppleHealthKitSpecJSI-generated.cpp +0 -46
- package/ios/generated/RNAppleHealthKitSpecJSI.h +0 -98
- package/lib/commonjs/NativeAppleHealthKit.js.map +0 -1
- package/lib/commonjs/types.js +0 -2
- package/lib/commonjs/types.js.map +0 -1
- package/lib/module/NativeAppleHealthKit.js.map +0 -1
- package/lib/module/types.js +0 -2
- package/lib/module/types.js.map +0 -1
- package/lib/typescript/commonjs/src/NativeAppleHealthKit.d.ts +0 -11
- package/lib/typescript/commonjs/src/NativeAppleHealthKit.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types.d.ts +0 -19
- package/lib/typescript/commonjs/src/types.d.ts.map +0 -1
- package/lib/typescript/module/src/NativeAppleHealthKit.d.ts +0 -11
- package/lib/typescript/module/src/NativeAppleHealthKit.d.ts.map +0 -1
- package/lib/typescript/module/src/types.d.ts +0 -19
- package/lib/typescript/module/src/types.d.ts.map +0 -1
- 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
|
-
|
2
|
-
export declare
|
3
|
-
export declare
|
4
|
-
export declare
|
5
|
-
export declare
|
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":"
|
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.
|
4
|
-
"description": "IOS module for
|
3
|
+
"version": "0.2.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://
|
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"
|
@@ -68,7 +68,7 @@
|
|
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": "
|
71
|
+
"@release-it/conventional-changelog": "latest",
|
72
72
|
"@types/jest": "^29.5.5",
|
73
73
|
"@types/react": "^18.2.44",
|
74
74
|
"commitlint": "^17.0.2",
|
@@ -121,7 +121,7 @@
|
|
121
121
|
},
|
122
122
|
"plugins": {
|
123
123
|
"@release-it/conventional-changelog": {
|
124
|
-
"preset": "
|
124
|
+
"preset": "conventionalcommits"
|
125
125
|
}
|
126
126
|
}
|
127
127
|
},
|
@@ -183,7 +183,7 @@
|
|
183
183
|
]
|
184
184
|
},
|
185
185
|
"codegenConfig": {
|
186
|
-
"name": "
|
186
|
+
"name": "RNReactNativeAppleHealthKitSpec",
|
187
187
|
"type": "modules",
|
188
188
|
"jsSrcsDir": "src",
|
189
189
|
"outputDir": {
|
@@ -191,7 +191,7 @@
|
|
191
191
|
"android": "android/generated"
|
192
192
|
},
|
193
193
|
"android": {
|
194
|
-
"javaPackageName": "com.
|
194
|
+
"javaPackageName": "com.gromozeqa.reactnativeapplehealthkit"
|
195
195
|
},
|
196
196
|
"includesGeneratedCode": true
|
197
197
|
},
|
package/react-native.config.js
CHANGED
@@ -1,6 +1,27 @@
|
|
1
1
|
import type { TurboModule } from 'react-native';
|
2
2
|
import { Platform, TurboModuleRegistry } from 'react-native';
|
3
|
-
|
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>('
|
50
|
+
: TurboModuleRegistry.getEnforcing<Spec>('ReactNativeAppleHealthKit');
|
package/src/index.tsx
CHANGED
@@ -1,18 +1,23 @@
|
|
1
|
-
import
|
2
|
-
|
1
|
+
import ReactNativeAppleHealthKit, {
|
2
|
+
type HeartRate,
|
3
|
+
type Measurement,
|
4
|
+
type Step,
|
5
|
+
} from './NativeReactNativeAppleHealthKit';
|
3
6
|
|
4
|
-
export
|
5
|
-
await
|
6
|
-
}
|
7
|
+
export async function requestHealthKitPermissions(): Promise<string> {
|
8
|
+
return await ReactNativeAppleHealthKit.requestHealthKitPermissions();
|
9
|
+
}
|
7
10
|
|
8
|
-
export
|
9
|
-
await
|
10
|
-
}
|
11
|
+
export async function getMeasurement(): Promise<Measurement> {
|
12
|
+
return await ReactNativeAppleHealthKit.getMeasurement();
|
13
|
+
}
|
11
14
|
|
12
|
-
export
|
13
|
-
await
|
14
|
-
}
|
15
|
+
export async function getSteps(forNumberOfDay: number): Promise<Step[]> {
|
16
|
+
return await ReactNativeAppleHealthKit.getSteps(forNumberOfDay);
|
17
|
+
}
|
15
18
|
|
16
|
-
export
|
17
|
-
|
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
|
package/ios/AppleHealthKit.h
DELETED
@@ -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":[]}
|
package/lib/commonjs/types.js
DELETED
@@ -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":[]}
|
package/lib/module/types.js
DELETED
package/lib/module/types.js.map
DELETED
@@ -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
|
-
}
|