@gromozeqa/react-native-apple-health-kit 0.1.4 → 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/{RNAppleHealthKitSpec/RNAppleHealthKitSpecJSI.h → RNReactNativeAppleHealthKitSpec/RNReactNativeAppleHealthKitSpecJSI.h} +69 -21
- 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/{RNAppleHealthKitSpecJSI.h → RNReactNativeAppleHealthKitSpecJSI.h} +69 -21
- package/lib/commonjs/{NativeAppleHealthKit.js → NativeReactNativeAppleHealthKit.js} +2 -2
- package/lib/commonjs/NativeReactNativeAppleHealthKit.js.map +1 -0
- package/lib/commonjs/index.js +16 -11
- 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 -7
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/{module/src/NativeAppleHealthKit.d.ts → commonjs/src/NativeReactNativeAppleHealthKit.d.ts} +6 -5
- package/lib/typescript/commonjs/src/NativeReactNativeAppleHealthKit.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +5 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/{commonjs/src/NativeAppleHealthKit.d.ts → module/src/NativeReactNativeAppleHealthKit.d.ts} +6 -5
- package/lib/typescript/module/src/NativeReactNativeAppleHealthKit.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +5 -1
- 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} +7 -5
- package/src/index.tsx +23 -8
- package/android/generated/jni/react/renderer/components/RNAppleHealthKitSpec/RNAppleHealthKitSpecJSI-generated.cpp +0 -46
- package/ios/AppleHealthKit.h +0 -6
- package/ios/generated/RNAppleHealthKitSpecJSI-generated.cpp +0 -46
- package/lib/commonjs/NativeAppleHealthKit.js.map +0 -1
- package/lib/module/NativeAppleHealthKit.js.map +0 -1
- package/lib/typescript/commonjs/src/NativeAppleHealthKit.d.ts.map +0 -1
- package/lib/typescript/module/src/NativeAppleHealthKit.d.ts.map +0 -1
@@ -0,0 +1,46 @@
|
|
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 "RNReactNativeAppleHealthKitSpecJSI.h"
|
11
|
+
|
12
|
+
namespace facebook::react {
|
13
|
+
|
14
|
+
static jsi::Value __hostFunction_NativeReactNativeAppleHealthKitCxxSpecJSI_requestHealthKitPermissions(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
15
|
+
return static_cast<NativeReactNativeAppleHealthKitCxxSpecJSI *>(&turboModule)->requestHealthKitPermissions(
|
16
|
+
rt
|
17
|
+
);
|
18
|
+
}
|
19
|
+
static jsi::Value __hostFunction_NativeReactNativeAppleHealthKitCxxSpecJSI_getSteps(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
20
|
+
return static_cast<NativeReactNativeAppleHealthKitCxxSpecJSI *>(&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_NativeReactNativeAppleHealthKitCxxSpecJSI_getHeartRate(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
26
|
+
return static_cast<NativeReactNativeAppleHealthKitCxxSpecJSI *>(&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_NativeReactNativeAppleHealthKitCxxSpecJSI_getMeasurement(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
32
|
+
return static_cast<NativeReactNativeAppleHealthKitCxxSpecJSI *>(&turboModule)->getMeasurement(
|
33
|
+
rt
|
34
|
+
);
|
35
|
+
}
|
36
|
+
|
37
|
+
NativeReactNativeAppleHealthKitCxxSpecJSI::NativeReactNativeAppleHealthKitCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
38
|
+
: TurboModule("ReactNativeAppleHealthKit", jsInvoker) {
|
39
|
+
methodMap_["requestHealthKitPermissions"] = MethodMetadata {0, __hostFunction_NativeReactNativeAppleHealthKitCxxSpecJSI_requestHealthKitPermissions};
|
40
|
+
methodMap_["getSteps"] = MethodMetadata {1, __hostFunction_NativeReactNativeAppleHealthKitCxxSpecJSI_getSteps};
|
41
|
+
methodMap_["getHeartRate"] = MethodMetadata {1, __hostFunction_NativeReactNativeAppleHealthKitCxxSpecJSI_getHeartRate};
|
42
|
+
methodMap_["getMeasurement"] = MethodMetadata {0, __hostFunction_NativeReactNativeAppleHealthKitCxxSpecJSI_getMeasurement};
|
43
|
+
}
|
44
|
+
|
45
|
+
|
46
|
+
} // namespace facebook::react
|
@@ -16,19 +16,19 @@ namespace facebook::react {
|
|
16
16
|
|
17
17
|
|
18
18
|
|
19
|
-
#pragma mark -
|
19
|
+
#pragma mark - NativeReactNativeAppleHealthKitHeartRate
|
20
20
|
|
21
21
|
template <typename P0, typename P1>
|
22
|
-
struct
|
22
|
+
struct NativeReactNativeAppleHealthKitHeartRate {
|
23
23
|
P0 date;
|
24
24
|
P1 value;
|
25
|
-
bool operator==(const
|
25
|
+
bool operator==(const NativeReactNativeAppleHealthKitHeartRate &other) const {
|
26
26
|
return date == other.date && value == other.value;
|
27
27
|
}
|
28
28
|
};
|
29
29
|
|
30
30
|
template <typename T>
|
31
|
-
struct
|
31
|
+
struct NativeReactNativeAppleHealthKitHeartRateBridging {
|
32
32
|
static T types;
|
33
33
|
|
34
34
|
static T fromJs(
|
@@ -64,21 +64,69 @@ struct NativeAppleHealthKitHeartRateBridging {
|
|
64
64
|
|
65
65
|
|
66
66
|
|
67
|
-
#pragma mark -
|
67
|
+
#pragma mark - NativeReactNativeAppleHealthKitHeartRateValue
|
68
|
+
|
69
|
+
template <typename P0, typename P1>
|
70
|
+
struct NativeReactNativeAppleHealthKitHeartRateValue {
|
71
|
+
P0 time;
|
72
|
+
P1 heartRate;
|
73
|
+
bool operator==(const NativeReactNativeAppleHealthKitHeartRateValue &other) const {
|
74
|
+
return time == other.time && heartRate == other.heartRate;
|
75
|
+
}
|
76
|
+
};
|
77
|
+
|
78
|
+
template <typename T>
|
79
|
+
struct NativeReactNativeAppleHealthKitHeartRateValueBridging {
|
80
|
+
static T types;
|
81
|
+
|
82
|
+
static T fromJs(
|
83
|
+
jsi::Runtime &rt,
|
84
|
+
const jsi::Object &value,
|
85
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
86
|
+
T result{
|
87
|
+
bridging::fromJs<decltype(types.time)>(rt, value.getProperty(rt, "time"), jsInvoker),
|
88
|
+
bridging::fromJs<decltype(types.heartRate)>(rt, value.getProperty(rt, "heartRate"), jsInvoker)};
|
89
|
+
return result;
|
90
|
+
}
|
91
|
+
|
92
|
+
#ifdef DEBUG
|
93
|
+
static jsi::String timeToJs(jsi::Runtime &rt, decltype(types.time) value) {
|
94
|
+
return bridging::toJs(rt, value);
|
95
|
+
}
|
96
|
+
|
97
|
+
static double heartRateToJs(jsi::Runtime &rt, decltype(types.heartRate) value) {
|
98
|
+
return bridging::toJs(rt, value);
|
99
|
+
}
|
100
|
+
#endif
|
101
|
+
|
102
|
+
static jsi::Object toJs(
|
103
|
+
jsi::Runtime &rt,
|
104
|
+
const T &value,
|
105
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
106
|
+
auto result = facebook::jsi::Object(rt);
|
107
|
+
result.setProperty(rt, "time", bridging::toJs(rt, value.time, jsInvoker));
|
108
|
+
result.setProperty(rt, "heartRate", bridging::toJs(rt, value.heartRate, jsInvoker));
|
109
|
+
return result;
|
110
|
+
}
|
111
|
+
};
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
#pragma mark - NativeReactNativeAppleHealthKitMeasurement
|
68
116
|
|
69
117
|
template <typename P0, typename P1, typename P2, typename P3>
|
70
|
-
struct
|
118
|
+
struct NativeReactNativeAppleHealthKitMeasurement {
|
71
119
|
P0 bodyMass;
|
72
120
|
P1 height;
|
73
121
|
P2 biologicalSex;
|
74
122
|
P3 dateOfBirth;
|
75
|
-
bool operator==(const
|
123
|
+
bool operator==(const NativeReactNativeAppleHealthKitMeasurement &other) const {
|
76
124
|
return bodyMass == other.bodyMass && height == other.height && biologicalSex == other.biologicalSex && dateOfBirth == other.dateOfBirth;
|
77
125
|
}
|
78
126
|
};
|
79
127
|
|
80
128
|
template <typename T>
|
81
|
-
struct
|
129
|
+
struct NativeReactNativeAppleHealthKitMeasurementBridging {
|
82
130
|
static T types;
|
83
131
|
|
84
132
|
static T fromJs(
|
@@ -126,19 +174,19 @@ struct NativeAppleHealthKitMeasurementBridging {
|
|
126
174
|
|
127
175
|
|
128
176
|
|
129
|
-
#pragma mark -
|
177
|
+
#pragma mark - NativeReactNativeAppleHealthKitStep
|
130
178
|
|
131
179
|
template <typename P0, typename P1>
|
132
|
-
struct
|
180
|
+
struct NativeReactNativeAppleHealthKitStep {
|
133
181
|
P0 dateString;
|
134
182
|
P1 stepCount;
|
135
|
-
bool operator==(const
|
183
|
+
bool operator==(const NativeReactNativeAppleHealthKitStep &other) const {
|
136
184
|
return dateString == other.dateString && stepCount == other.stepCount;
|
137
185
|
}
|
138
186
|
};
|
139
187
|
|
140
188
|
template <typename T>
|
141
|
-
struct
|
189
|
+
struct NativeReactNativeAppleHealthKitStepBridging {
|
142
190
|
static T types;
|
143
191
|
|
144
192
|
static T fromJs(
|
@@ -172,9 +220,9 @@ struct NativeAppleHealthKitStepBridging {
|
|
172
220
|
}
|
173
221
|
};
|
174
222
|
|
175
|
-
class JSI_EXPORT
|
223
|
+
class JSI_EXPORT NativeReactNativeAppleHealthKitCxxSpecJSI : public TurboModule {
|
176
224
|
protected:
|
177
|
-
|
225
|
+
NativeReactNativeAppleHealthKitCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
178
226
|
|
179
227
|
public:
|
180
228
|
virtual jsi::Value requestHealthKitPermissions(jsi::Runtime &rt) = 0;
|
@@ -185,7 +233,7 @@ public:
|
|
185
233
|
};
|
186
234
|
|
187
235
|
template <typename T>
|
188
|
-
class JSI_EXPORT
|
236
|
+
class JSI_EXPORT NativeReactNativeAppleHealthKitCxxSpec : public TurboModule {
|
189
237
|
public:
|
190
238
|
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
191
239
|
return delegate_.create(rt, propName);
|
@@ -195,19 +243,19 @@ public:
|
|
195
243
|
return delegate_.getPropertyNames(runtime);
|
196
244
|
}
|
197
245
|
|
198
|
-
static constexpr std::string_view kModuleName = "
|
246
|
+
static constexpr std::string_view kModuleName = "ReactNativeAppleHealthKit";
|
199
247
|
|
200
248
|
protected:
|
201
|
-
|
202
|
-
: TurboModule(std::string{
|
249
|
+
NativeReactNativeAppleHealthKitCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
250
|
+
: TurboModule(std::string{NativeReactNativeAppleHealthKitCxxSpec::kModuleName}, jsInvoker),
|
203
251
|
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
204
252
|
|
205
253
|
|
206
254
|
private:
|
207
|
-
class Delegate : public
|
255
|
+
class Delegate : public NativeReactNativeAppleHealthKitCxxSpecJSI {
|
208
256
|
public:
|
209
257
|
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
210
|
-
|
258
|
+
NativeReactNativeAppleHealthKitCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
211
259
|
|
212
260
|
}
|
213
261
|
|
@@ -245,7 +293,7 @@ private:
|
|
245
293
|
}
|
246
294
|
|
247
295
|
private:
|
248
|
-
friend class
|
296
|
+
friend class NativeReactNativeAppleHealthKitCxxSpec;
|
249
297
|
T *instance_;
|
250
298
|
};
|
251
299
|
|
@@ -19,5 +19,5 @@ const NoOpSpec = {
|
|
19
19
|
return Promise.reject(new Error('HealthKit is not available on Android.'));
|
20
20
|
}
|
21
21
|
};
|
22
|
-
var _default = exports.default = _reactNative.Platform.OS === 'android' ? NoOpSpec : _reactNative.TurboModuleRegistry.getEnforcing('
|
23
|
-
//# sourceMappingURL=
|
22
|
+
var _default = exports.default = _reactNative.Platform.OS === 'android' ? NoOpSpec : _reactNative.TurboModuleRegistry.getEnforcing('ReactNativeAppleHealthKit');
|
23
|
+
//# sourceMappingURL=NativeReactNativeAppleHealthKit.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_reactNative","require","NoOpSpec","requestHealthKitPermissions","Promise","reject","Error","getSteps","getHeartRate","getMeasurement","_default","exports","default","Platform","OS","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeReactNativeAppleHealthKit.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AA+BA,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,2BAA2B,CAAC","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
@@ -3,17 +3,22 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.requestHealthKitPermissions = exports.getSteps = exports.getMeasurement = exports.getHeartRate = void 0;
|
7
|
-
var _NativeAppleHealthKit = _interopRequireDefault(require("./NativeAppleHealthKit.js"));
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
9
|
-
const {
|
10
|
-
requestHealthKitPermissions,
|
11
|
-
getHeartRate,
|
12
|
-
getMeasurement,
|
13
|
-
getSteps
|
14
|
-
} = _NativeAppleHealthKit.default;
|
15
|
-
exports.getSteps = getSteps;
|
16
|
-
exports.getMeasurement = getMeasurement;
|
17
6
|
exports.getHeartRate = getHeartRate;
|
7
|
+
exports.getMeasurement = getMeasurement;
|
8
|
+
exports.getSteps = getSteps;
|
18
9
|
exports.requestHealthKitPermissions = requestHealthKitPermissions;
|
10
|
+
var _NativeReactNativeAppleHealthKit = _interopRequireDefault(require("./NativeReactNativeAppleHealthKit.js"));
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
12
|
+
async function requestHealthKitPermissions() {
|
13
|
+
return await _NativeReactNativeAppleHealthKit.default.requestHealthKitPermissions();
|
14
|
+
}
|
15
|
+
async function getMeasurement() {
|
16
|
+
return await _NativeReactNativeAppleHealthKit.default.getMeasurement();
|
17
|
+
}
|
18
|
+
async function getSteps(forNumberOfDay) {
|
19
|
+
return await _NativeReactNativeAppleHealthKit.default.getSteps(forNumberOfDay);
|
20
|
+
}
|
21
|
+
async function getHeartRate(forNumberOfDay) {
|
22
|
+
return await _NativeReactNativeAppleHealthKit.default.getHeartRate(forNumberOfDay);
|
23
|
+
}
|
19
24
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["_NativeReactNativeAppleHealthKit","_interopRequireDefault","require","e","__esModule","default","requestHealthKitPermissions","ReactNativeAppleHealthKit","getMeasurement","getSteps","forNumberOfDay","getHeartRate"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;AAAA,IAAAA,gCAAA,GAAAC,sBAAA,CAAAC,OAAA;AAI2C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,eAAeG,2BAA2BA,CAAA,EAAoB;EACnE,OAAO,MAAMC,wCAAyB,CAACD,2BAA2B,CAAC,CAAC;AACtE;AAEO,eAAeE,cAAcA,CAAA,EAAyB;EAC3D,OAAO,MAAMD,wCAAyB,CAACC,cAAc,CAAC,CAAC;AACzD;AAEO,eAAeC,QAAQA,CAACC,cAAsB,EAAmB;EACtE,OAAO,MAAMH,wCAAyB,CAACE,QAAQ,CAACC,cAAc,CAAC;AACjE;AAEO,eAAeC,YAAYA,CAChCD,cAAsB,EACA;EACtB,OAAO,MAAMH,wCAAyB,CAACI,YAAY,CAACD,cAAc,CAAC;AACrE","ignoreList":[]}
|
@@ -15,5 +15,5 @@ const NoOpSpec = {
|
|
15
15
|
return Promise.reject(new Error('HealthKit is not available on Android.'));
|
16
16
|
}
|
17
17
|
};
|
18
|
-
export default Platform.OS === 'android' ? NoOpSpec : TurboModuleRegistry.getEnforcing('
|
19
|
-
//# sourceMappingURL=
|
18
|
+
export default Platform.OS === 'android' ? NoOpSpec : TurboModuleRegistry.getEnforcing('ReactNativeAppleHealthKit');
|
19
|
+
//# sourceMappingURL=NativeReactNativeAppleHealthKit.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["Platform","TurboModuleRegistry","NoOpSpec","requestHealthKitPermissions","Promise","reject","Error","getSteps","getHeartRate","getMeasurement","OS","getEnforcing"],"sourceRoot":"../../src","sources":["NativeReactNativeAppleHealthKit.ts"],"mappings":";;AACA,SAASA,QAAQ,EAAEC,mBAAmB,QAAQ,cAAc;AA+B5D,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,2BAA2B,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
import
|
4
|
-
export
|
5
|
-
requestHealthKitPermissions
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
}
|
3
|
+
import ReactNativeAppleHealthKit from "./NativeReactNativeAppleHealthKit.js";
|
4
|
+
export async function requestHealthKitPermissions() {
|
5
|
+
return await ReactNativeAppleHealthKit.requestHealthKitPermissions();
|
6
|
+
}
|
7
|
+
export async function getMeasurement() {
|
8
|
+
return await ReactNativeAppleHealthKit.getMeasurement();
|
9
|
+
}
|
10
|
+
export async function getSteps(forNumberOfDay) {
|
11
|
+
return await ReactNativeAppleHealthKit.getSteps(forNumberOfDay);
|
12
|
+
}
|
13
|
+
export async function getHeartRate(forNumberOfDay) {
|
14
|
+
return await ReactNativeAppleHealthKit.getHeartRate(forNumberOfDay);
|
15
|
+
}
|
10
16
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["ReactNativeAppleHealthKit","requestHealthKitPermissions","getMeasurement","getSteps","forNumberOfDay","getHeartRate"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,yBAAyB,MAIzB,sCAAmC;AAE1C,OAAO,eAAeC,2BAA2BA,CAAA,EAAoB;EACnE,OAAO,MAAMD,yBAAyB,CAACC,2BAA2B,CAAC,CAAC;AACtE;AAEA,OAAO,eAAeC,cAAcA,CAAA,EAAyB;EAC3D,OAAO,MAAMF,yBAAyB,CAACE,cAAc,CAAC,CAAC;AACzD;AAEA,OAAO,eAAeC,QAAQA,CAACC,cAAsB,EAAmB;EACtE,OAAO,MAAMJ,yBAAyB,CAACG,QAAQ,CAACC,cAAc,CAAC;AACjE;AAEA,OAAO,eAAeC,YAAYA,CAChCD,cAAsB,EACA;EACtB,OAAO,MAAMJ,yBAAyB,CAACK,YAAY,CAACD,cAAc,CAAC;AACrE","ignoreList":[]}
|
@@ -3,12 +3,13 @@ export interface Step {
|
|
3
3
|
dateString: string;
|
4
4
|
stepCount: number;
|
5
5
|
}
|
6
|
+
export interface HeartRateValue {
|
7
|
+
time: string;
|
8
|
+
heartRate: number;
|
9
|
+
}
|
6
10
|
export interface HeartRate {
|
7
11
|
date: string;
|
8
|
-
value:
|
9
|
-
time: string;
|
10
|
-
heartRate: number;
|
11
|
-
}[];
|
12
|
+
value: HeartRateValue[];
|
12
13
|
}
|
13
14
|
export interface Measurement {
|
14
15
|
bodyMass: number | null;
|
@@ -24,4 +25,4 @@ export interface Spec extends TurboModule {
|
|
24
25
|
}
|
25
26
|
declare const _default: Spec;
|
26
27
|
export default _default;
|
27
|
-
//# sourceMappingURL=
|
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,2 +1,6 @@
|
|
1
|
-
|
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[]>;
|
2
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"}
|
@@ -3,12 +3,13 @@ export interface Step {
|
|
3
3
|
dateString: string;
|
4
4
|
stepCount: number;
|
5
5
|
}
|
6
|
+
export interface HeartRateValue {
|
7
|
+
time: string;
|
8
|
+
heartRate: number;
|
9
|
+
}
|
6
10
|
export interface HeartRate {
|
7
11
|
date: string;
|
8
|
-
value:
|
9
|
-
time: string;
|
10
|
-
heartRate: number;
|
11
|
-
}[];
|
12
|
+
value: HeartRateValue[];
|
12
13
|
}
|
13
14
|
export interface Measurement {
|
14
15
|
bodyMass: number | null;
|
@@ -24,4 +25,4 @@ export interface Spec extends TurboModule {
|
|
24
25
|
}
|
25
26
|
declare const _default: Spec;
|
26
27
|
export default _default;
|
27
|
-
//# sourceMappingURL=
|
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,2 +1,6 @@
|
|
1
|
-
|
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[]>;
|
2
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
@@ -6,12 +6,14 @@ export interface Step {
|
|
6
6
|
stepCount: number;
|
7
7
|
}
|
8
8
|
|
9
|
+
export interface HeartRateValue {
|
10
|
+
time: string;
|
11
|
+
heartRate: number;
|
12
|
+
}
|
13
|
+
|
9
14
|
export interface HeartRate {
|
10
15
|
date: string;
|
11
|
-
value:
|
12
|
-
time: string;
|
13
|
-
heartRate: number;
|
14
|
-
}[];
|
16
|
+
value: HeartRateValue[];
|
15
17
|
}
|
16
18
|
|
17
19
|
export interface Measurement {
|
@@ -45,4 +47,4 @@ const NoOpSpec: Spec = {
|
|
45
47
|
|
46
48
|
export default Platform.OS === 'android'
|
47
49
|
? NoOpSpec
|
48
|
-
: TurboModuleRegistry.getEnforcing<Spec>('
|
50
|
+
: TurboModuleRegistry.getEnforcing<Spec>('ReactNativeAppleHealthKit');
|
package/src/index.tsx
CHANGED
@@ -1,8 +1,23 @@
|
|
1
|
-
import
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
import ReactNativeAppleHealthKit, {
|
2
|
+
type HeartRate,
|
3
|
+
type Measurement,
|
4
|
+
type Step,
|
5
|
+
} from './NativeReactNativeAppleHealthKit';
|
6
|
+
|
7
|
+
export async function requestHealthKitPermissions(): Promise<string> {
|
8
|
+
return await ReactNativeAppleHealthKit.requestHealthKitPermissions();
|
9
|
+
}
|
10
|
+
|
11
|
+
export async function getMeasurement(): Promise<Measurement> {
|
12
|
+
return await ReactNativeAppleHealthKit.getMeasurement();
|
13
|
+
}
|
14
|
+
|
15
|
+
export async function getSteps(forNumberOfDay: number): Promise<Step[]> {
|
16
|
+
return await ReactNativeAppleHealthKit.getSteps(forNumberOfDay);
|
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
|
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
|