@gromozeqa/react-native-apple-health-kit 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AppleHealthKit.podspec +42 -0
- package/LICENSE +20 -0
- package/README.md +22 -0
- package/android/generated/java/com/applehealthkit/NativeAppleHealthKitSpec.java +50 -0
- package/android/generated/jni/CMakeLists.txt +36 -0
- package/android/generated/jni/RNAppleHealthKitSpec-generated.cpp +50 -0
- package/android/generated/jni/RNAppleHealthKitSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNAppleHealthKitSpec/RNAppleHealthKitSpecJSI-generated.cpp +46 -0
- package/android/generated/jni/react/renderer/components/RNAppleHealthKitSpec/RNAppleHealthKitSpecJSI.h +255 -0
- package/ios/AppleHealthKit.h +6 -0
- package/ios/AppleHealthKit.mm +61 -0
- package/ios/AppleHealthKitManager.swift +48 -0
- package/ios/AppleHealthKitPermissions.swift +26 -0
- package/ios/AppleHealthKitQueries.swift +200 -0
- package/ios/HealthKitUtils.swift +61 -0
- package/ios/generated/RNAppleHealthKitSpec/RNAppleHealthKitSpec-generated.mm +60 -0
- package/ios/generated/RNAppleHealthKitSpec/RNAppleHealthKitSpec.h +71 -0
- package/ios/generated/RNAppleHealthKitSpecJSI-generated.cpp +46 -0
- package/ios/generated/RNAppleHealthKitSpecJSI.h +255 -0
- package/lib/commonjs/NativeAppleHealthKit.js +23 -0
- package/lib/commonjs/NativeAppleHealthKit.js.map +1 -0
- package/lib/commonjs/index.js +19 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/NativeAppleHealthKit.js +19 -0
- package/lib/module/NativeAppleHealthKit.js.map +1 -0
- package/lib/module/index.js +10 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/NativeAppleHealthKit.d.ts +27 -0
- package/lib/typescript/commonjs/src/NativeAppleHealthKit.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +2 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/NativeAppleHealthKit.d.ts +27 -0
- package/lib/typescript/module/src/NativeAppleHealthKit.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +2 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +203 -0
- package/react-native.config.js +11 -0
- package/src/NativeAppleHealthKit.ts +48 -0
- package/src/index.tsx +8 -0
@@ -0,0 +1,255 @@
|
|
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
|
+
|
19
|
+
#pragma mark - NativeAppleHealthKitHeartRate
|
20
|
+
|
21
|
+
template <typename P0, typename P1>
|
22
|
+
struct NativeAppleHealthKitHeartRate {
|
23
|
+
P0 date;
|
24
|
+
P1 value;
|
25
|
+
bool operator==(const NativeAppleHealthKitHeartRate &other) const {
|
26
|
+
return date == other.date && value == other.value;
|
27
|
+
}
|
28
|
+
};
|
29
|
+
|
30
|
+
template <typename T>
|
31
|
+
struct NativeAppleHealthKitHeartRateBridging {
|
32
|
+
static T types;
|
33
|
+
|
34
|
+
static T fromJs(
|
35
|
+
jsi::Runtime &rt,
|
36
|
+
const jsi::Object &value,
|
37
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
38
|
+
T result{
|
39
|
+
bridging::fromJs<decltype(types.date)>(rt, value.getProperty(rt, "date"), jsInvoker),
|
40
|
+
bridging::fromJs<decltype(types.value)>(rt, value.getProperty(rt, "value"), jsInvoker)};
|
41
|
+
return result;
|
42
|
+
}
|
43
|
+
|
44
|
+
#ifdef DEBUG
|
45
|
+
static jsi::String dateToJs(jsi::Runtime &rt, decltype(types.date) value) {
|
46
|
+
return bridging::toJs(rt, value);
|
47
|
+
}
|
48
|
+
|
49
|
+
static jsi::Array valueToJs(jsi::Runtime &rt, decltype(types.value) value) {
|
50
|
+
return bridging::toJs(rt, value);
|
51
|
+
}
|
52
|
+
#endif
|
53
|
+
|
54
|
+
static jsi::Object toJs(
|
55
|
+
jsi::Runtime &rt,
|
56
|
+
const T &value,
|
57
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
58
|
+
auto result = facebook::jsi::Object(rt);
|
59
|
+
result.setProperty(rt, "date", bridging::toJs(rt, value.date, jsInvoker));
|
60
|
+
result.setProperty(rt, "value", bridging::toJs(rt, value.value, jsInvoker));
|
61
|
+
return result;
|
62
|
+
}
|
63
|
+
};
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
#pragma mark - NativeAppleHealthKitMeasurement
|
68
|
+
|
69
|
+
template <typename P0, typename P1, typename P2, typename P3>
|
70
|
+
struct NativeAppleHealthKitMeasurement {
|
71
|
+
P0 bodyMass;
|
72
|
+
P1 height;
|
73
|
+
P2 biologicalSex;
|
74
|
+
P3 dateOfBirth;
|
75
|
+
bool operator==(const NativeAppleHealthKitMeasurement &other) const {
|
76
|
+
return bodyMass == other.bodyMass && height == other.height && biologicalSex == other.biologicalSex && dateOfBirth == other.dateOfBirth;
|
77
|
+
}
|
78
|
+
};
|
79
|
+
|
80
|
+
template <typename T>
|
81
|
+
struct NativeAppleHealthKitMeasurementBridging {
|
82
|
+
static T types;
|
83
|
+
|
84
|
+
static T fromJs(
|
85
|
+
jsi::Runtime &rt,
|
86
|
+
const jsi::Object &value,
|
87
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
88
|
+
T result{
|
89
|
+
bridging::fromJs<decltype(types.bodyMass)>(rt, value.getProperty(rt, "bodyMass"), jsInvoker),
|
90
|
+
bridging::fromJs<decltype(types.height)>(rt, value.getProperty(rt, "height"), jsInvoker),
|
91
|
+
bridging::fromJs<decltype(types.biologicalSex)>(rt, value.getProperty(rt, "biologicalSex"), jsInvoker),
|
92
|
+
bridging::fromJs<decltype(types.dateOfBirth)>(rt, value.getProperty(rt, "dateOfBirth"), jsInvoker)};
|
93
|
+
return result;
|
94
|
+
}
|
95
|
+
|
96
|
+
#ifdef DEBUG
|
97
|
+
static std::optional<double> bodyMassToJs(jsi::Runtime &rt, decltype(types.bodyMass) value) {
|
98
|
+
return bridging::toJs(rt, value);
|
99
|
+
}
|
100
|
+
|
101
|
+
static std::optional<double> heightToJs(jsi::Runtime &rt, decltype(types.height) value) {
|
102
|
+
return bridging::toJs(rt, value);
|
103
|
+
}
|
104
|
+
|
105
|
+
static std::optional<jsi::String> biologicalSexToJs(jsi::Runtime &rt, decltype(types.biologicalSex) value) {
|
106
|
+
return bridging::toJs(rt, value);
|
107
|
+
}
|
108
|
+
|
109
|
+
static std::optional<jsi::String> dateOfBirthToJs(jsi::Runtime &rt, decltype(types.dateOfBirth) value) {
|
110
|
+
return bridging::toJs(rt, value);
|
111
|
+
}
|
112
|
+
#endif
|
113
|
+
|
114
|
+
static jsi::Object toJs(
|
115
|
+
jsi::Runtime &rt,
|
116
|
+
const T &value,
|
117
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
118
|
+
auto result = facebook::jsi::Object(rt);
|
119
|
+
result.setProperty(rt, "bodyMass", bridging::toJs(rt, value.bodyMass, jsInvoker));
|
120
|
+
result.setProperty(rt, "height", bridging::toJs(rt, value.height, jsInvoker));
|
121
|
+
result.setProperty(rt, "biologicalSex", bridging::toJs(rt, value.biologicalSex, jsInvoker));
|
122
|
+
result.setProperty(rt, "dateOfBirth", bridging::toJs(rt, value.dateOfBirth, jsInvoker));
|
123
|
+
return result;
|
124
|
+
}
|
125
|
+
};
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
#pragma mark - NativeAppleHealthKitStep
|
130
|
+
|
131
|
+
template <typename P0, typename P1>
|
132
|
+
struct NativeAppleHealthKitStep {
|
133
|
+
P0 dateString;
|
134
|
+
P1 stepCount;
|
135
|
+
bool operator==(const NativeAppleHealthKitStep &other) const {
|
136
|
+
return dateString == other.dateString && stepCount == other.stepCount;
|
137
|
+
}
|
138
|
+
};
|
139
|
+
|
140
|
+
template <typename T>
|
141
|
+
struct NativeAppleHealthKitStepBridging {
|
142
|
+
static T types;
|
143
|
+
|
144
|
+
static T fromJs(
|
145
|
+
jsi::Runtime &rt,
|
146
|
+
const jsi::Object &value,
|
147
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
148
|
+
T result{
|
149
|
+
bridging::fromJs<decltype(types.dateString)>(rt, value.getProperty(rt, "dateString"), jsInvoker),
|
150
|
+
bridging::fromJs<decltype(types.stepCount)>(rt, value.getProperty(rt, "stepCount"), jsInvoker)};
|
151
|
+
return result;
|
152
|
+
}
|
153
|
+
|
154
|
+
#ifdef DEBUG
|
155
|
+
static jsi::String dateStringToJs(jsi::Runtime &rt, decltype(types.dateString) value) {
|
156
|
+
return bridging::toJs(rt, value);
|
157
|
+
}
|
158
|
+
|
159
|
+
static double stepCountToJs(jsi::Runtime &rt, decltype(types.stepCount) value) {
|
160
|
+
return bridging::toJs(rt, value);
|
161
|
+
}
|
162
|
+
#endif
|
163
|
+
|
164
|
+
static jsi::Object toJs(
|
165
|
+
jsi::Runtime &rt,
|
166
|
+
const T &value,
|
167
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
168
|
+
auto result = facebook::jsi::Object(rt);
|
169
|
+
result.setProperty(rt, "dateString", bridging::toJs(rt, value.dateString, jsInvoker));
|
170
|
+
result.setProperty(rt, "stepCount", bridging::toJs(rt, value.stepCount, jsInvoker));
|
171
|
+
return result;
|
172
|
+
}
|
173
|
+
};
|
174
|
+
|
175
|
+
class JSI_EXPORT NativeAppleHealthKitCxxSpecJSI : public TurboModule {
|
176
|
+
protected:
|
177
|
+
NativeAppleHealthKitCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
178
|
+
|
179
|
+
public:
|
180
|
+
virtual jsi::Value requestHealthKitPermissions(jsi::Runtime &rt) = 0;
|
181
|
+
virtual jsi::Value getSteps(jsi::Runtime &rt, double daysBefore) = 0;
|
182
|
+
virtual jsi::Value getHeartRate(jsi::Runtime &rt, double daysBefore) = 0;
|
183
|
+
virtual jsi::Value getMeasurement(jsi::Runtime &rt) = 0;
|
184
|
+
|
185
|
+
};
|
186
|
+
|
187
|
+
template <typename T>
|
188
|
+
class JSI_EXPORT NativeAppleHealthKitCxxSpec : public TurboModule {
|
189
|
+
public:
|
190
|
+
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
191
|
+
return delegate_.create(rt, propName);
|
192
|
+
}
|
193
|
+
|
194
|
+
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
195
|
+
return delegate_.getPropertyNames(runtime);
|
196
|
+
}
|
197
|
+
|
198
|
+
static constexpr std::string_view kModuleName = "AppleHealthKit";
|
199
|
+
|
200
|
+
protected:
|
201
|
+
NativeAppleHealthKitCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
202
|
+
: TurboModule(std::string{NativeAppleHealthKitCxxSpec::kModuleName}, jsInvoker),
|
203
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
204
|
+
|
205
|
+
|
206
|
+
private:
|
207
|
+
class Delegate : public NativeAppleHealthKitCxxSpecJSI {
|
208
|
+
public:
|
209
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
210
|
+
NativeAppleHealthKitCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
211
|
+
|
212
|
+
}
|
213
|
+
|
214
|
+
jsi::Value requestHealthKitPermissions(jsi::Runtime &rt) override {
|
215
|
+
static_assert(
|
216
|
+
bridging::getParameterCount(&T::requestHealthKitPermissions) == 1,
|
217
|
+
"Expected requestHealthKitPermissions(...) to have 1 parameters");
|
218
|
+
|
219
|
+
return bridging::callFromJs<jsi::Value>(
|
220
|
+
rt, &T::requestHealthKitPermissions, jsInvoker_, instance_);
|
221
|
+
}
|
222
|
+
jsi::Value getSteps(jsi::Runtime &rt, double daysBefore) override {
|
223
|
+
static_assert(
|
224
|
+
bridging::getParameterCount(&T::getSteps) == 2,
|
225
|
+
"Expected getSteps(...) to have 2 parameters");
|
226
|
+
|
227
|
+
return bridging::callFromJs<jsi::Value>(
|
228
|
+
rt, &T::getSteps, jsInvoker_, instance_, std::move(daysBefore));
|
229
|
+
}
|
230
|
+
jsi::Value getHeartRate(jsi::Runtime &rt, double daysBefore) override {
|
231
|
+
static_assert(
|
232
|
+
bridging::getParameterCount(&T::getHeartRate) == 2,
|
233
|
+
"Expected getHeartRate(...) to have 2 parameters");
|
234
|
+
|
235
|
+
return bridging::callFromJs<jsi::Value>(
|
236
|
+
rt, &T::getHeartRate, jsInvoker_, instance_, std::move(daysBefore));
|
237
|
+
}
|
238
|
+
jsi::Value getMeasurement(jsi::Runtime &rt) override {
|
239
|
+
static_assert(
|
240
|
+
bridging::getParameterCount(&T::getMeasurement) == 1,
|
241
|
+
"Expected getMeasurement(...) to have 1 parameters");
|
242
|
+
|
243
|
+
return bridging::callFromJs<jsi::Value>(
|
244
|
+
rt, &T::getMeasurement, jsInvoker_, instance_);
|
245
|
+
}
|
246
|
+
|
247
|
+
private:
|
248
|
+
friend class NativeAppleHealthKitCxxSpec;
|
249
|
+
T *instance_;
|
250
|
+
};
|
251
|
+
|
252
|
+
Delegate delegate_;
|
253
|
+
};
|
254
|
+
|
255
|
+
} // namespace facebook::react
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
var _reactNative = require("react-native");
|
8
|
+
const NoOpSpec = {
|
9
|
+
requestHealthKitPermissions() {
|
10
|
+
return Promise.reject(new Error('HealthKit is not available on Android.'));
|
11
|
+
},
|
12
|
+
getSteps() {
|
13
|
+
return Promise.reject(new Error('HealthKit is not available on Android.'));
|
14
|
+
},
|
15
|
+
getHeartRate() {
|
16
|
+
return Promise.reject(new Error('HealthKit is not available on Android.'));
|
17
|
+
},
|
18
|
+
getMeasurement() {
|
19
|
+
return Promise.reject(new Error('HealthKit is not available on Android.'));
|
20
|
+
}
|
21
|
+
};
|
22
|
+
var _default = exports.default = _reactNative.Platform.OS === 'android' ? NoOpSpec : _reactNative.TurboModuleRegistry.getEnforcing('AppleHealthKit');
|
23
|
+
//# sourceMappingURL=NativeAppleHealthKit.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":["NativeAppleHealthKit.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AA6BA,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":[]}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
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
|
+
exports.getHeartRate = getHeartRate;
|
18
|
+
exports.requestHealthKitPermissions = requestHealthKitPermissions;
|
19
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_NativeAppleHealthKit","_interopRequireDefault","require","e","__esModule","default","requestHealthKitPermissions","getHeartRate","getMeasurement","getSteps","NativeAppleHealthKit","exports"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA0D,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnD,MAAM;EACXG,2BAA2B;EAC3BC,YAAY;EACZC,cAAc;EACdC;AACF,CAAC,GAAGC,6BAAoB;AAACC,OAAA,CAAAF,QAAA,GAAAA,QAAA;AAAAE,OAAA,CAAAH,cAAA,GAAAA,cAAA;AAAAG,OAAA,CAAAJ,YAAA,GAAAA,YAAA;AAAAI,OAAA,CAAAL,2BAAA,GAAAA,2BAAA","ignoreList":[]}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import { Platform, TurboModuleRegistry } from 'react-native';
|
4
|
+
const NoOpSpec = {
|
5
|
+
requestHealthKitPermissions() {
|
6
|
+
return Promise.reject(new Error('HealthKit is not available on Android.'));
|
7
|
+
},
|
8
|
+
getSteps() {
|
9
|
+
return Promise.reject(new Error('HealthKit is not available on Android.'));
|
10
|
+
},
|
11
|
+
getHeartRate() {
|
12
|
+
return Promise.reject(new Error('HealthKit is not available on Android.'));
|
13
|
+
},
|
14
|
+
getMeasurement() {
|
15
|
+
return Promise.reject(new Error('HealthKit is not available on Android.'));
|
16
|
+
}
|
17
|
+
};
|
18
|
+
export default Platform.OS === 'android' ? NoOpSpec : TurboModuleRegistry.getEnforcing('AppleHealthKit');
|
19
|
+
//# sourceMappingURL=NativeAppleHealthKit.js.map
|
@@ -0,0 +1 @@
|
|
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;AA6B5D,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":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["NativeAppleHealthKit","requestHealthKitPermissions","getHeartRate","getMeasurement","getSteps"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,oBAAoB,MAAM,2BAAwB;AAEzD,OAAO,MAAM;EACXC,2BAA2B;EAC3BC,YAAY;EACZC,cAAc;EACdC;AACF,CAAC,GAAGJ,oBAAoB","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"type":"commonjs"}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
2
|
+
export interface Step {
|
3
|
+
dateString: string;
|
4
|
+
stepCount: number;
|
5
|
+
}
|
6
|
+
export interface HeartRate {
|
7
|
+
date: string;
|
8
|
+
value: {
|
9
|
+
time: string;
|
10
|
+
heartRate: number;
|
11
|
+
}[];
|
12
|
+
}
|
13
|
+
export interface Measurement {
|
14
|
+
bodyMass: number | null;
|
15
|
+
height: number | null;
|
16
|
+
biologicalSex: string | null;
|
17
|
+
dateOfBirth: string | null;
|
18
|
+
}
|
19
|
+
export interface Spec extends TurboModule {
|
20
|
+
requestHealthKitPermissions(): Promise<string>;
|
21
|
+
getSteps(daysBefore: number): Promise<Step[]>;
|
22
|
+
getHeartRate(daysBefore: number): Promise<HeartRate[]>;
|
23
|
+
getMeasurement(): Promise<Measurement>;
|
24
|
+
}
|
25
|
+
declare const _default: Spec;
|
26
|
+
export default _default;
|
27
|
+
//# sourceMappingURL=NativeAppleHealthKit.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"NativeAppleHealthKit.d.ts","sourceRoot":"","sources":["../../../../src/NativeAppleHealthKit.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,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;KACnB,EAAE,CAAC;CACL;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,wBAE6D"}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
export declare const requestHealthKitPermissions: () => Promise<string>, getHeartRate: (daysBefore: number) => Promise<import("./NativeAppleHealthKit").HeartRate[]>, getMeasurement: () => Promise<import("./NativeAppleHealthKit").Measurement>, getSteps: (daysBefore: number) => Promise<import("./NativeAppleHealthKit").Step[]>;
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAEA,eAAO,MACL,2BAA2B,yBAC3B,YAAY,iFACZ,cAAc,+DACd,QAAQ,0EACc,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"type":"module"}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
2
|
+
export interface Step {
|
3
|
+
dateString: string;
|
4
|
+
stepCount: number;
|
5
|
+
}
|
6
|
+
export interface HeartRate {
|
7
|
+
date: string;
|
8
|
+
value: {
|
9
|
+
time: string;
|
10
|
+
heartRate: number;
|
11
|
+
}[];
|
12
|
+
}
|
13
|
+
export interface Measurement {
|
14
|
+
bodyMass: number | null;
|
15
|
+
height: number | null;
|
16
|
+
biologicalSex: string | null;
|
17
|
+
dateOfBirth: string | null;
|
18
|
+
}
|
19
|
+
export interface Spec extends TurboModule {
|
20
|
+
requestHealthKitPermissions(): Promise<string>;
|
21
|
+
getSteps(daysBefore: number): Promise<Step[]>;
|
22
|
+
getHeartRate(daysBefore: number): Promise<HeartRate[]>;
|
23
|
+
getMeasurement(): Promise<Measurement>;
|
24
|
+
}
|
25
|
+
declare const _default: Spec;
|
26
|
+
export default _default;
|
27
|
+
//# sourceMappingURL=NativeAppleHealthKit.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"NativeAppleHealthKit.d.ts","sourceRoot":"","sources":["../../../../src/NativeAppleHealthKit.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,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;KACnB,EAAE,CAAC;CACL;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,wBAE6D"}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
export declare const requestHealthKitPermissions: () => Promise<string>, getHeartRate: (daysBefore: number) => Promise<import("./NativeAppleHealthKit").HeartRate[]>, getMeasurement: () => Promise<import("./NativeAppleHealthKit").Measurement>, getSteps: (daysBefore: number) => Promise<import("./NativeAppleHealthKit").Step[]>;
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAEA,eAAO,MACL,2BAA2B,yBAC3B,YAAY,iFACZ,cAAc,+DACd,QAAQ,0EACc,CAAC"}
|
package/package.json
ADDED
@@ -0,0 +1,203 @@
|
|
1
|
+
{
|
2
|
+
"name": "@gromozeqa/react-native-apple-health-kit",
|
3
|
+
"version": "0.1.3",
|
4
|
+
"description": "IOS module for Apple Healhkit",
|
5
|
+
"source": "./src/index.tsx",
|
6
|
+
"main": "./lib/commonjs/index.js",
|
7
|
+
"module": "./lib/module/index.js",
|
8
|
+
"exports": {
|
9
|
+
".": {
|
10
|
+
"import": {
|
11
|
+
"types": "./lib/typescript/module/src/index.d.ts",
|
12
|
+
"default": "./lib/module/index.js"
|
13
|
+
},
|
14
|
+
"require": {
|
15
|
+
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
16
|
+
"default": "./lib/commonjs/index.js"
|
17
|
+
}
|
18
|
+
}
|
19
|
+
},
|
20
|
+
"files": [
|
21
|
+
"src",
|
22
|
+
"lib",
|
23
|
+
"android",
|
24
|
+
"ios",
|
25
|
+
"cpp",
|
26
|
+
"*.podspec",
|
27
|
+
"react-native.config.js",
|
28
|
+
"!ios/build",
|
29
|
+
"!android/build",
|
30
|
+
"!android/gradle",
|
31
|
+
"!android/gradlew",
|
32
|
+
"!android/gradlew.bat",
|
33
|
+
"!android/local.properties",
|
34
|
+
"!**/__tests__",
|
35
|
+
"!**/__fixtures__",
|
36
|
+
"!**/__mocks__",
|
37
|
+
"!**/.*"
|
38
|
+
],
|
39
|
+
"scripts": {
|
40
|
+
"example": "yarn workspace react-native-apple-health-kit-example",
|
41
|
+
"test": "jest",
|
42
|
+
"typecheck": "tsc",
|
43
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
44
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
45
|
+
"prepare": "bob build",
|
46
|
+
"release": "release-it"
|
47
|
+
},
|
48
|
+
"keywords": [
|
49
|
+
"react-native",
|
50
|
+
"ios",
|
51
|
+
"android"
|
52
|
+
],
|
53
|
+
"repository": {
|
54
|
+
"type": "git",
|
55
|
+
"url": "git+https://github.com/Luxlorys/react-native-apple-health-kit.git"
|
56
|
+
},
|
57
|
+
"author": "gromozeqa <a.burcev.dev@gmail.com> (https://github.com/Luxlorys)",
|
58
|
+
"license": "MIT",
|
59
|
+
"bugs": {
|
60
|
+
"url": "https://github.com/Luxlorys/react-native-apple-health-kit/issues"
|
61
|
+
},
|
62
|
+
"homepage": "https://github.com/Luxlorys/react-native-apple-health-kit#readme",
|
63
|
+
"publishConfig": {
|
64
|
+
"registry": "https://registry.npmjs.org/"
|
65
|
+
},
|
66
|
+
"devDependencies": {
|
67
|
+
"@commitlint/config-conventional": "^17.0.2",
|
68
|
+
"@evilmartians/lefthook": "^1.5.0",
|
69
|
+
"@react-native-community/cli": "15.0.1",
|
70
|
+
"@react-native/eslint-config": "^0.73.1",
|
71
|
+
"@release-it/conventional-changelog": "^9.0.2",
|
72
|
+
"@types/jest": "^29.5.5",
|
73
|
+
"@types/react": "^18.2.44",
|
74
|
+
"commitlint": "^17.0.2",
|
75
|
+
"del-cli": "^5.1.0",
|
76
|
+
"eslint": "^8.51.0",
|
77
|
+
"eslint-config-prettier": "^9.0.0",
|
78
|
+
"eslint-plugin-prettier": "^5.0.1",
|
79
|
+
"jest": "^29.7.0",
|
80
|
+
"prettier": "^3.0.3",
|
81
|
+
"react": "19.0.0",
|
82
|
+
"react-native": "0.78.0",
|
83
|
+
"react-native-builder-bob": "^0.37.0",
|
84
|
+
"release-it": "^17.10.0",
|
85
|
+
"turbo": "^1.10.7",
|
86
|
+
"typescript": "^5.2.2"
|
87
|
+
},
|
88
|
+
"resolutions": {
|
89
|
+
"@types/react": "^18.2.44"
|
90
|
+
},
|
91
|
+
"peerDependencies": {
|
92
|
+
"react": "*",
|
93
|
+
"react-native": "*"
|
94
|
+
},
|
95
|
+
"workspaces": [
|
96
|
+
"example"
|
97
|
+
],
|
98
|
+
"packageManager": "yarn@3.6.1",
|
99
|
+
"jest": {
|
100
|
+
"preset": "react-native",
|
101
|
+
"modulePathIgnorePatterns": [
|
102
|
+
"<rootDir>/example/node_modules",
|
103
|
+
"<rootDir>/lib/"
|
104
|
+
]
|
105
|
+
},
|
106
|
+
"commitlint": {
|
107
|
+
"extends": [
|
108
|
+
"@commitlint/config-conventional"
|
109
|
+
]
|
110
|
+
},
|
111
|
+
"release-it": {
|
112
|
+
"git": {
|
113
|
+
"commitMessage": "chore: release ${version}",
|
114
|
+
"tagName": "v${version}"
|
115
|
+
},
|
116
|
+
"npm": {
|
117
|
+
"publish": true
|
118
|
+
},
|
119
|
+
"github": {
|
120
|
+
"release": true
|
121
|
+
},
|
122
|
+
"plugins": {
|
123
|
+
"@release-it/conventional-changelog": {
|
124
|
+
"preset": "angular"
|
125
|
+
}
|
126
|
+
}
|
127
|
+
},
|
128
|
+
"eslintConfig": {
|
129
|
+
"root": true,
|
130
|
+
"extends": [
|
131
|
+
"@react-native",
|
132
|
+
"prettier"
|
133
|
+
],
|
134
|
+
"rules": {
|
135
|
+
"react/react-in-jsx-scope": "off",
|
136
|
+
"prettier/prettier": [
|
137
|
+
"error",
|
138
|
+
{
|
139
|
+
"quoteProps": "consistent",
|
140
|
+
"singleQuote": true,
|
141
|
+
"tabWidth": 2,
|
142
|
+
"trailingComma": "es5",
|
143
|
+
"useTabs": false
|
144
|
+
}
|
145
|
+
]
|
146
|
+
}
|
147
|
+
},
|
148
|
+
"eslintIgnore": [
|
149
|
+
"node_modules/",
|
150
|
+
"lib/"
|
151
|
+
],
|
152
|
+
"prettier": {
|
153
|
+
"quoteProps": "consistent",
|
154
|
+
"singleQuote": true,
|
155
|
+
"tabWidth": 2,
|
156
|
+
"trailingComma": "es5",
|
157
|
+
"useTabs": false
|
158
|
+
},
|
159
|
+
"react-native-builder-bob": {
|
160
|
+
"source": "src",
|
161
|
+
"output": "lib",
|
162
|
+
"targets": [
|
163
|
+
"codegen",
|
164
|
+
[
|
165
|
+
"commonjs",
|
166
|
+
{
|
167
|
+
"esm": true
|
168
|
+
}
|
169
|
+
],
|
170
|
+
[
|
171
|
+
"module",
|
172
|
+
{
|
173
|
+
"esm": true
|
174
|
+
}
|
175
|
+
],
|
176
|
+
[
|
177
|
+
"typescript",
|
178
|
+
{
|
179
|
+
"project": "tsconfig.build.json",
|
180
|
+
"esm": true
|
181
|
+
}
|
182
|
+
]
|
183
|
+
]
|
184
|
+
},
|
185
|
+
"codegenConfig": {
|
186
|
+
"name": "RNAppleHealthKitSpec",
|
187
|
+
"type": "modules",
|
188
|
+
"jsSrcsDir": "src",
|
189
|
+
"outputDir": {
|
190
|
+
"ios": "ios/generated",
|
191
|
+
"android": "android/generated"
|
192
|
+
},
|
193
|
+
"android": {
|
194
|
+
"javaPackageName": "com.applehealthkit"
|
195
|
+
},
|
196
|
+
"includesGeneratedCode": true
|
197
|
+
},
|
198
|
+
"create-react-native-library": {
|
199
|
+
"type": "turbo-module",
|
200
|
+
"languages": "kotlin-objc",
|
201
|
+
"version": "0.48.2"
|
202
|
+
}
|
203
|
+
}
|