@kingstinct/react-native-healthkit 15.1.0 → 16.0.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 +5 -1
- package/ReactNativeHealthkit.podspec +11 -7
- package/app.plugin.js +18 -34
- package/app.plugin.ts +25 -50
- package/ios/CategoryTypeModule.swift +1 -0
- package/ios/CharacteristicTypeModule.swift +7 -6
- package/ios/Constants.swift +9 -34
- package/ios/CoreModule.swift +72 -41
- package/ios/CorrelationTypeModule.swift +3 -2
- package/ios/ElectrocardiogramModule.swift +4 -3
- package/ios/HeartbeatSeriesModule.swift +4 -3
- package/ios/Helpers.swift +10 -243
- package/ios/MedicationModule.swift +9 -8
- package/ios/MemoryEstimation.swift +1 -0
- package/ios/PredicateHelpers.swift +16 -86
- package/ios/QuantityTypeModule.swift +3 -2
- package/ios/Serializers.swift +16 -67
- package/ios/SourceProxy.swift +1 -0
- package/ios/StateOfMindModule.swift +3 -2
- package/ios/WorkoutProxy.swift +3 -2
- package/ios/WorkoutsModule.swift +4 -3
- package/lib/commonjs/generated/healthkit.generated.js +2 -0
- package/lib/commonjs/healthkit.ios.js +4 -2
- package/lib/commonjs/healthkit.js +21 -78
- package/lib/commonjs/types/Auth.js +3 -18
- package/lib/commonjs/types/Background.js +2 -10
- package/lib/commonjs/types/QueryOptions.js +2 -17
- package/lib/module/generated/healthkit.generated.js +2 -0
- package/lib/module/healthkit.ios.js +2 -0
- package/lib/module/healthkit.js +20 -77
- package/lib/module/types/Auth.js +1 -18
- package/lib/module/types/Background.js +1 -10
- package/lib/module/types/QueryOptions.js +1 -17
- package/lib/typescript/generated/healthkit.generated.d.ts +4 -1
- package/lib/typescript/healthkit.d.ts +3 -2
- package/lib/typescript/healthkit.ios.d.ts +11 -9
- package/lib/typescript/specs/CoreModule.nitro.d.ts +16 -0
- package/lib/typescript/specs/SourceProxy.nitro.d.ts +2 -4
- package/lib/typescript/types/Auth.d.ts +1 -16
- package/lib/typescript/types/Background.d.ts +1 -9
- package/lib/typescript/types/Device.d.ts +1 -13
- package/lib/typescript/types/QuantityType.d.ts +1 -1
- package/lib/typescript/types/QueryOptions.d.ts +3 -37
- package/lib/typescript/types/Shared.d.ts +2 -25
- package/lib/typescript/types/Source.d.ts +1 -10
- package/lib/typescript/types/Subscriptions.d.ts +2 -3
- package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.cpp +8 -0
- package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.hpp +68 -0
- package/nitrogen/generated/ios/c++/HybridCategoryTypeModuleSpecSwift.hpp +1 -1
- package/nitrogen/generated/ios/c++/HybridCoreModuleSpecSwift.hpp +8 -0
- package/nitrogen/generated/ios/c++/HybridCorrelationTypeModuleSpecSwift.hpp +1 -1
- package/nitrogen/generated/ios/c++/HybridElectrocardiogramModuleSpecSwift.hpp +1 -1
- package/nitrogen/generated/ios/c++/HybridHeartbeatSeriesModuleSpecSwift.hpp +1 -1
- package/nitrogen/generated/ios/c++/HybridMedicationModuleSpecSwift.hpp +1 -1
- package/nitrogen/generated/ios/c++/HybridQuantityTypeModuleSpecSwift.hpp +1 -1
- package/nitrogen/generated/ios/c++/HybridStateOfMindModuleSpecSwift.hpp +1 -1
- package/nitrogen/generated/ios/swift/CategorySample.swift +8 -8
- package/nitrogen/generated/ios/swift/CorrelationSample.swift +8 -8
- package/nitrogen/generated/ios/swift/ElectrocardiogramSample.swift +8 -8
- package/nitrogen/generated/ios/swift/Func_void_std__unordered_map_std__string__std__chrono__system_clock__time_point_.swift +54 -0
- package/nitrogen/generated/ios/swift/HeartbeatSeriesSample.swift +8 -8
- package/nitrogen/generated/ios/swift/HybridCoreModuleSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridCoreModuleSpec_cxx.swift +25 -0
- package/nitrogen/generated/ios/swift/MedicationDoseEvent.swift +8 -8
- package/nitrogen/generated/ios/swift/ObjectTypeIdentifier.swift +4 -0
- package/nitrogen/generated/ios/swift/QuantitySample.swift +8 -8
- package/nitrogen/generated/ios/swift/QuantityTypeIdentifier.swift +4 -0
- package/nitrogen/generated/ios/swift/QuantityTypeIdentifierWriteable.swift +4 -0
- package/nitrogen/generated/ios/swift/SampleTypeIdentifier.swift +4 -0
- package/nitrogen/generated/ios/swift/SampleTypeIdentifierWriteable.swift +4 -0
- package/nitrogen/generated/ios/swift/StateOfMindSample.swift +8 -8
- package/nitrogen/generated/shared/c++/CategorySample.hpp +7 -7
- package/nitrogen/generated/shared/c++/CorrelationSample.hpp +7 -7
- package/nitrogen/generated/shared/c++/ElectrocardiogramSample.hpp +7 -7
- package/nitrogen/generated/shared/c++/HeartbeatSeriesSample.hpp +7 -7
- package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.hpp +3 -1
- package/nitrogen/generated/shared/c++/MedicationDoseEvent.hpp +7 -7
- package/nitrogen/generated/shared/c++/ObjectTypeIdentifier.hpp +49 -45
- package/nitrogen/generated/shared/c++/QuantitySample.hpp +7 -7
- package/nitrogen/generated/shared/c++/QuantityTypeIdentifier.hpp +42 -38
- package/nitrogen/generated/shared/c++/QuantityTypeIdentifierWriteable.hpp +42 -38
- package/nitrogen/generated/shared/c++/SampleTypeIdentifier.hpp +48 -44
- package/nitrogen/generated/shared/c++/SampleTypeIdentifierWriteable.hpp +47 -43
- package/nitrogen/generated/shared/c++/StateOfMindSample.hpp +7 -7
- package/package.json +4 -1
- package/src/generated/healthkit-schema.json +8 -0
- package/src/generated/healthkit.generated.ts +4 -0
- package/src/healthkit.ios.ts +3 -0
- package/src/healthkit.ts +27 -84
- package/src/specs/CoreModule.nitro.ts +19 -0
- package/src/specs/SourceProxy.nitro.ts +2 -4
- package/src/test-setup.ts +1 -0
- package/src/types/Auth.ts +4 -17
- package/src/types/Background.ts +1 -9
- package/src/types/Device.ts +1 -13
- package/src/types/QuantityType.ts +1 -1
- package/src/types/QueryOptions.ts +7 -65
- package/src/types/Shared.ts +7 -28
- package/src/types/Source.ts +1 -11
- package/src/types/Subscriptions.ts +2 -3
- package/ios/BackgroundDeliveryManager.swift +0 -284
- package/ios/BackgroundLaunchHook.mm +0 -41
- package/ios/Bridge.h +0 -10
- package/ios/ExceptionCatcher.h +0 -5
- package/ios/ExceptionCatcher.mm +0 -32
- package/ios/module.modulemap +0 -5
package/ios/WorkoutsModule.swift
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import CoreLocation
|
|
2
2
|
import HealthKit
|
|
3
3
|
import NitroModules
|
|
4
|
+
import ReactNativeHealthkitCore
|
|
4
5
|
|
|
5
6
|
#if canImport(WorkoutKit)
|
|
6
7
|
import WorkoutKit
|
|
@@ -42,7 +43,7 @@ class WorkoutsModule: HybridWorkoutsModuleSpec {
|
|
|
42
43
|
|
|
43
44
|
return Promise.async {
|
|
44
45
|
try await withCheckedThrowingContinuation { continuation in
|
|
45
|
-
|
|
46
|
+
healthStore.startWatchApp(with: configuration) { success, error in
|
|
46
47
|
DispatchQueue.main.async {
|
|
47
48
|
if let error {
|
|
48
49
|
continuation.resume(
|
|
@@ -193,12 +194,12 @@ class WorkoutsModule: HybridWorkoutsModuleSpec {
|
|
|
193
194
|
}
|
|
194
195
|
try await withCheckedThrowingContinuation({ continuation in
|
|
195
196
|
// saving workout, samples and route
|
|
196
|
-
|
|
197
|
+
healthStore.save(workout) { (_: Bool, error: Error?) in
|
|
197
198
|
DispatchQueue.main.async {
|
|
198
199
|
if let error = error {
|
|
199
200
|
return continuation.resume(throwing: error)
|
|
200
201
|
} else if !initializedSamples.isEmpty {
|
|
201
|
-
|
|
202
|
+
healthStore.add(initializedSamples, to: workout) { (_, error: Error?) in
|
|
202
203
|
DispatchQueue.main.async {
|
|
203
204
|
if let error = error {
|
|
204
205
|
return continuation.resume(throwing: error)
|
|
@@ -87,6 +87,7 @@ exports.QUANTITY_IDENTIFIER_IOS_AVAILABILITY = {
|
|
|
87
87
|
HKQuantityTypeIdentifierHeadphoneAudioExposure: '13.0',
|
|
88
88
|
HKQuantityTypeIdentifierHeartRate: '8.0',
|
|
89
89
|
HKQuantityTypeIdentifierHeartRateRecoveryOneMinute: '16.0',
|
|
90
|
+
HKQuantityTypeIdentifierHeartRateVariabilityRMSSD: '27.0',
|
|
90
91
|
HKQuantityTypeIdentifierHeartRateVariabilitySDNN: '11.0',
|
|
91
92
|
HKQuantityTypeIdentifierHeight: '8.0',
|
|
92
93
|
HKQuantityTypeIdentifierInhalerUsage: '8.0',
|
|
@@ -283,6 +284,7 @@ exports.QUANTITY_IDENTIFIER_CANONICAL_UNITS = {
|
|
|
283
284
|
HKQuantityTypeIdentifierHeadphoneAudioExposure: 'dBASPL',
|
|
284
285
|
HKQuantityTypeIdentifierHeartRate: 'count/s',
|
|
285
286
|
HKQuantityTypeIdentifierHeartRateRecoveryOneMinute: 'count/min',
|
|
287
|
+
HKQuantityTypeIdentifierHeartRateVariabilityRMSSD: 'ms',
|
|
286
288
|
HKQuantityTypeIdentifierHeartRateVariabilitySDNN: 'ms',
|
|
287
289
|
HKQuantityTypeIdentifierHeight: 'm',
|
|
288
290
|
HKQuantityTypeIdentifierInhalerUsage: 'count',
|
|
@@ -17,8 +17,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
21
|
-
exports.getWheelchairUseAsync = exports.getFitzpatrickSkinTypeAsync = exports.getDateOfBirthAsync = exports.getBloodTypeAsync = exports.getBiologicalSexAsync = exports.currentAppSource = exports.queryMedicationEventsWithAnchor = exports.queryMedicationEvents = exports.queryMedications = exports.requestMedicationsAuthorization = exports.areObjectTypesAvailableAsync = exports.areObjectTypesAvailable = exports.isObjectTypeAvailableAsync = exports.isObjectTypeAvailable = exports.isQuantityCompatibleWithUnit = exports.saveStateOfMindSample = exports.queryStateOfMindSamplesWithAnchor = exports.queryStateOfMindSamples = exports.isProtectedDataAvailableAsync = exports.isProtectedDataAvailable = exports.startWatchApp = exports.saveWorkoutSample = exports.saveQuantitySample = exports.saveCorrelationSample = exports.saveCategorySample = exports.deleteObjects = exports.requestAuthorization = void 0;
|
|
20
|
+
exports.queryWorkoutSamplesWithAnchor = exports.queryWorkoutSamples = exports.queryStatisticsCollectionForQuantitySeparateBySource = exports.queryStatisticsForQuantitySeparateBySource = exports.queryStatisticsCollectionForQuantity = exports.queryStatisticsForQuantity = exports.queryQuantitySamplesWithAnchor = exports.queryQuantitySamples = exports.queryElectrocardiogramSamplesWithAnchor = exports.queryElectrocardiogramSamples = exports.queryHeartbeatSeriesSamplesWithAnchor = exports.queryHeartbeatSeriesSamples = exports.queryCorrelationSamplesWithAnchor = exports.queryCorrelationSamples = exports.queryCategorySamplesWithAnchor = exports.queryCategorySamples = exports.isHealthDataAvailableAsync = exports.isHealthDataAvailable = exports.getWheelchairUse = exports.getRequestStatusForAuthorization = exports.getPreferredUnits = exports.getFitzpatrickSkinType = exports.getDateOfBirth = exports.getBloodType = exports.getBiologicalSex = exports.clearBackgroundTypes = exports.configureBackgroundTypes = exports.enableBackgroundDelivery = exports.disableBackgroundDelivery = exports.disableAllBackgroundDelivery = exports.getEarliestAuthorizedSampleDates = exports.requestPerObjectReadAuthorization = exports.authorizationStatusFor = exports.useSubscribeToQuantitySamples = exports.useSubscribeToChanges = exports.useSubscribeToCategorySamples = exports.useStatisticsForQuantity = exports.useSources = exports.useMostRecentWorkout = exports.useMostRecentQuantitySample = exports.useMostRecentCategorySample = exports.useIsHealthDataAvailable = exports.useHealthkitAuthorization = exports.subscribeToQuantitySamples = exports.subscribeToChanges = exports.subscribeToCategorySamples = exports.getPreferredUnit = exports.getMostRecentWorkout = exports.getMostRecentQuantitySample = exports.getMostRecentCategorySample = void 0;
|
|
21
|
+
exports.getWheelchairUseAsync = exports.getFitzpatrickSkinTypeAsync = exports.getDateOfBirthAsync = exports.getBloodTypeAsync = exports.getBiologicalSexAsync = exports.currentAppSource = exports.queryMedicationEventsWithAnchor = exports.queryMedicationEvents = exports.queryMedications = exports.requestMedicationsAuthorization = exports.areObjectTypesAvailableAsync = exports.areObjectTypesAvailable = exports.isObjectTypeAvailableAsync = exports.isObjectTypeAvailable = exports.isQuantityCompatibleWithUnit = exports.saveStateOfMindSample = exports.queryStateOfMindSamplesWithAnchor = exports.queryStateOfMindSamples = exports.isProtectedDataAvailableAsync = exports.isProtectedDataAvailable = exports.startWatchApp = exports.saveWorkoutSample = exports.saveQuantitySample = exports.saveCorrelationSample = exports.saveCategorySample = exports.deleteObjects = exports.requestAuthorization = exports.querySources = void 0;
|
|
22
22
|
const react_native_1 = require("react-native");
|
|
23
23
|
const useHealthkitAuthorization_1 = __importDefault(require("./hooks/useHealthkitAuthorization"));
|
|
24
24
|
exports.useHealthkitAuthorization = useHealthkitAuthorization_1.default;
|
|
@@ -90,6 +90,7 @@ const MedicationBindings = {
|
|
|
90
90
|
// Named exports - all functions bound to their respective modules
|
|
91
91
|
exports.authorizationStatusFor = modules_1.Core.authorizationStatusFor.bind(modules_1.Core);
|
|
92
92
|
exports.requestPerObjectReadAuthorization = modules_1.Core.requestPerObjectReadAuthorization.bind(modules_1.Core);
|
|
93
|
+
exports.getEarliestAuthorizedSampleDates = modules_1.Core.getEarliestAuthorizedSampleDates.bind(modules_1.Core);
|
|
93
94
|
exports.disableAllBackgroundDelivery = modules_1.Core.disableAllBackgroundDelivery.bind(modules_1.Core);
|
|
94
95
|
exports.disableBackgroundDelivery = modules_1.Core.disableBackgroundDelivery.bind(modules_1.Core);
|
|
95
96
|
exports.enableBackgroundDelivery = modules_1.Core.enableBackgroundDelivery.bind(modules_1.Core);
|
|
@@ -197,6 +198,7 @@ exports.default = {
|
|
|
197
198
|
querySources: exports.querySources,
|
|
198
199
|
requestAuthorization: exports.requestAuthorization,
|
|
199
200
|
requestPerObjectReadAuthorization: exports.requestPerObjectReadAuthorization,
|
|
201
|
+
getEarliestAuthorizedSampleDates: exports.getEarliestAuthorizedSampleDates,
|
|
200
202
|
deleteObjects: exports.deleteObjects,
|
|
201
203
|
saveCategorySample: exports.saveCategorySample,
|
|
202
204
|
saveCorrelationSample: exports.saveCorrelationSample,
|
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.getFitzpatrickSkinTypeAsync = exports.getDateOfBirthAsync = exports.getBloodTypeAsync = exports.getBiologicalSexAsync = exports.useStatisticsForQuantity = exports.useSources = exports.useIsHealthDataAvailable = exports.useHealthkitAuthorization = exports.useSubscribeToChanges = exports.useMostRecentWorkout = exports.getMostRecentWorkout = exports.saveStateOfMindSample = exports.queryCorrelationSamplesWithAnchor = exports.queryStateOfMindSamplesWithAnchor = exports.queryStateOfMindSamples = exports.startWatchApp = exports.saveWorkoutSample = exports.queryWorkoutSamplesWithAnchor = exports.queryWorkoutSamples = exports.queryElectrocardiogramSamplesWithAnchor = exports.queryElectrocardiogramSamples = exports.queryHeartbeatSeriesSamplesWithAnchor = exports.queryHeartbeatSeriesSamples = exports.saveCorrelationSample = exports.queryCorrelationSamples = exports.getWheelchairUse = exports.getFitzpatrickSkinType = exports.getDateOfBirth = exports.getBloodType = exports.getBiologicalSex = exports.areObjectTypesAvailableAsync = exports.areObjectTypesAvailable = exports.isObjectTypeAvailableAsync = exports.isObjectTypeAvailable = exports.isProtectedDataAvailableAsync = exports.isProtectedDataAvailable = exports.subscribeToChanges = exports.deleteObjects = exports.requestAuthorization = exports.querySources = exports.isHealthDataAvailableAsync = exports.isHealthDataAvailable = exports.getRequestStatusForAuthorization = exports.getPreferredUnits = exports.clearBackgroundTypes = exports.configureBackgroundTypes = exports.enableBackgroundDelivery = exports.disableBackgroundDelivery = exports.disableAllBackgroundDelivery = exports.authorizationStatusFor = void 0;
|
|
18
|
-
exports.requestMedicationsAuthorization = exports.subscribeToCategorySamples = exports.requestPerObjectReadAuthorization = exports.useSubscribeToCategorySamples = exports.useSubscribeToQuantitySamples = exports.queryMedicationEventsWithAnchor = exports.queryMedicationEvents = exports.queryMedications = exports.currentAppSource = exports.subscribeToQuantitySamples = exports.getWheelchairUseAsync = void 0;
|
|
18
|
+
exports.requestMedicationsAuthorization = exports.subscribeToCategorySamples = exports.getEarliestAuthorizedSampleDates = exports.requestPerObjectReadAuthorization = exports.useSubscribeToCategorySamples = exports.useSubscribeToQuantitySamples = exports.queryMedicationEventsWithAnchor = exports.queryMedicationEvents = exports.queryMedications = exports.currentAppSource = exports.subscribeToQuantitySamples = exports.getWheelchairUseAsync = void 0;
|
|
19
19
|
exports.queryQuantitySamples = queryQuantitySamples;
|
|
20
20
|
exports.queryQuantitySamplesWithAnchor = queryQuantitySamplesWithAnchor;
|
|
21
21
|
exports.queryStatisticsForQuantity = queryStatisticsForQuantity;
|
|
@@ -32,22 +32,11 @@ exports.getMostRecentQuantitySample = getMostRecentQuantitySample;
|
|
|
32
32
|
exports.getPreferredUnit = getPreferredUnit;
|
|
33
33
|
exports.useMostRecentCategorySample = useMostRecentCategorySample;
|
|
34
34
|
exports.useMostRecentQuantitySample = useMostRecentQuantitySample;
|
|
35
|
-
const
|
|
35
|
+
const core_1 = require("@react-native-healthkit/core");
|
|
36
36
|
const Auth_1 = require("./types/Auth");
|
|
37
37
|
const Characteristics_1 = require("./types/Characteristics");
|
|
38
38
|
__exportStar(require("./types"), exports);
|
|
39
|
-
const
|
|
40
|
-
let hasWarned = false;
|
|
41
|
-
function UnavailableFnFromModule(_fn, defaultValue) {
|
|
42
|
-
// @ts-expect-error
|
|
43
|
-
return () => {
|
|
44
|
-
if (react_native_1.Platform.OS !== 'ios' && !hasWarned) {
|
|
45
|
-
console.warn(notAvailableError);
|
|
46
|
-
hasWarned = true;
|
|
47
|
-
}
|
|
48
|
-
return defaultValue;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
39
|
+
const { unavailableFn: UnavailableFnFromModule, warnIfUnavailable } = (0, core_1.createUnavailableHelpers)('@kingstinct/react-native-healthkit');
|
|
51
40
|
// --- Mock Implementations for exported functions ---
|
|
52
41
|
// CoreModule functions
|
|
53
42
|
exports.authorizationStatusFor = UnavailableFnFromModule('authorizationStatusFor', Auth_1.AuthorizationStatus.notDetermined);
|
|
@@ -80,17 +69,11 @@ exports.getFitzpatrickSkinType = UnavailableFnFromModule('getFitzpatrickSkinType
|
|
|
80
69
|
exports.getWheelchairUse = UnavailableFnFromModule('getWheelchairUse', Characteristics_1.WheelchairUse.notSet);
|
|
81
70
|
// QuantityTypeModule functions
|
|
82
71
|
function queryQuantitySamples(_identifier, _options) {
|
|
83
|
-
|
|
84
|
-
console.warn(notAvailableError);
|
|
85
|
-
hasWarned = true;
|
|
86
|
-
}
|
|
72
|
+
warnIfUnavailable();
|
|
87
73
|
return Promise.resolve([]);
|
|
88
74
|
}
|
|
89
75
|
function queryQuantitySamplesWithAnchor(_identifier, _options) {
|
|
90
|
-
|
|
91
|
-
console.warn(notAvailableError);
|
|
92
|
-
hasWarned = true;
|
|
93
|
-
}
|
|
76
|
+
warnIfUnavailable();
|
|
94
77
|
return Promise.resolve({
|
|
95
78
|
samples: [],
|
|
96
79
|
deletedSamples: [],
|
|
@@ -98,62 +81,38 @@ function queryQuantitySamplesWithAnchor(_identifier, _options) {
|
|
|
98
81
|
});
|
|
99
82
|
}
|
|
100
83
|
function queryStatisticsForQuantity(_identifier, _statistics, _options) {
|
|
101
|
-
|
|
102
|
-
console.warn(notAvailableError);
|
|
103
|
-
hasWarned = true;
|
|
104
|
-
}
|
|
84
|
+
warnIfUnavailable();
|
|
105
85
|
return Promise.resolve({
|
|
106
86
|
sources: [],
|
|
107
87
|
});
|
|
108
88
|
}
|
|
109
89
|
function queryStatisticsCollectionForQuantity(_identifier, _statistics, _anchorDate, _intervalComponents, _options) {
|
|
110
|
-
|
|
111
|
-
console.warn(notAvailableError);
|
|
112
|
-
hasWarned = true;
|
|
113
|
-
}
|
|
90
|
+
warnIfUnavailable();
|
|
114
91
|
return Promise.resolve([]);
|
|
115
92
|
}
|
|
116
93
|
function queryStatisticsForQuantitySeparateBySource(_identifier, _statistics, _options) {
|
|
117
|
-
|
|
118
|
-
console.warn(notAvailableError);
|
|
119
|
-
hasWarned = true;
|
|
120
|
-
}
|
|
94
|
+
warnIfUnavailable();
|
|
121
95
|
return Promise.resolve([]);
|
|
122
96
|
}
|
|
123
97
|
function queryStatisticsCollectionForQuantitySeparateBySource(_identifier, _statistics, _anchorDate, _intervalComponents, _options) {
|
|
124
|
-
|
|
125
|
-
console.warn(notAvailableError);
|
|
126
|
-
hasWarned = true;
|
|
127
|
-
}
|
|
98
|
+
warnIfUnavailable();
|
|
128
99
|
return Promise.resolve([]);
|
|
129
100
|
}
|
|
130
101
|
function saveQuantitySample(_identifier, _unit, _value, _start, _end, _metadata) {
|
|
131
|
-
|
|
132
|
-
console.warn(notAvailableError);
|
|
133
|
-
hasWarned = true;
|
|
134
|
-
}
|
|
102
|
+
warnIfUnavailable();
|
|
135
103
|
return Promise.resolve(undefined);
|
|
136
104
|
}
|
|
137
105
|
function isQuantityCompatibleWithUnit(_identifier, _unit) {
|
|
138
|
-
|
|
139
|
-
console.warn(notAvailableError);
|
|
140
|
-
hasWarned = true;
|
|
141
|
-
}
|
|
106
|
+
warnIfUnavailable();
|
|
142
107
|
return false;
|
|
143
108
|
}
|
|
144
109
|
// CategoryTypeModule functions
|
|
145
110
|
function queryCategorySamples(_categoryTypeIdentifier, _options) {
|
|
146
|
-
|
|
147
|
-
console.warn(notAvailableError);
|
|
148
|
-
hasWarned = true;
|
|
149
|
-
}
|
|
111
|
+
warnIfUnavailable();
|
|
150
112
|
return Promise.resolve([]);
|
|
151
113
|
}
|
|
152
114
|
function queryCategorySamplesWithAnchor(_categoryTypeIdentifier, _options) {
|
|
153
|
-
|
|
154
|
-
console.warn(notAvailableError);
|
|
155
|
-
hasWarned = true;
|
|
156
|
-
}
|
|
115
|
+
warnIfUnavailable();
|
|
157
116
|
return Promise.resolve({
|
|
158
117
|
samples: [],
|
|
159
118
|
deletedSamples: [],
|
|
@@ -161,10 +120,7 @@ function queryCategorySamplesWithAnchor(_categoryTypeIdentifier, _options) {
|
|
|
161
120
|
});
|
|
162
121
|
}
|
|
163
122
|
function saveCategorySample(_identifier, _value, _startDate, _endDate, _metadata) {
|
|
164
|
-
|
|
165
|
-
console.warn(notAvailableError);
|
|
166
|
-
hasWarned = true;
|
|
167
|
-
}
|
|
123
|
+
warnIfUnavailable();
|
|
168
124
|
return Promise.resolve(undefined);
|
|
169
125
|
}
|
|
170
126
|
// CorrelationTypeModule functions
|
|
@@ -209,42 +165,27 @@ exports.queryCorrelationSamplesWithAnchor = UnavailableFnFromModule('queryCorrel
|
|
|
209
165
|
exports.saveStateOfMindSample = UnavailableFnFromModule('saveStateOfMindSample', Promise.resolve(undefined));
|
|
210
166
|
// Utility functions (from original export list)
|
|
211
167
|
function getMostRecentCategorySample(_identifier) {
|
|
212
|
-
|
|
213
|
-
console.warn(notAvailableError);
|
|
214
|
-
hasWarned = true;
|
|
215
|
-
}
|
|
168
|
+
warnIfUnavailable();
|
|
216
169
|
return Promise.resolve(undefined);
|
|
217
170
|
}
|
|
218
171
|
function getMostRecentQuantitySample(_identifier, _unit) {
|
|
219
|
-
|
|
220
|
-
console.warn(notAvailableError);
|
|
221
|
-
hasWarned = true;
|
|
222
|
-
}
|
|
172
|
+
warnIfUnavailable();
|
|
223
173
|
return Promise.resolve(undefined);
|
|
224
174
|
}
|
|
225
175
|
exports.getMostRecentWorkout = UnavailableFnFromModule('getMostRecentWorkout',
|
|
226
176
|
// biome-ignore lint/suspicious/noExplicitAny: it works
|
|
227
177
|
Promise.resolve(undefined));
|
|
228
178
|
function getPreferredUnit(_quantityType) {
|
|
229
|
-
|
|
230
|
-
console.warn(notAvailableError);
|
|
231
|
-
hasWarned = true;
|
|
232
|
-
}
|
|
179
|
+
warnIfUnavailable();
|
|
233
180
|
return Promise.resolve('count');
|
|
234
181
|
}
|
|
235
182
|
// Hooks (from original export list)
|
|
236
183
|
function useMostRecentCategorySample(_categoryTypeIdentifier) {
|
|
237
|
-
|
|
238
|
-
console.warn(notAvailableError);
|
|
239
|
-
hasWarned = true;
|
|
240
|
-
}
|
|
184
|
+
warnIfUnavailable();
|
|
241
185
|
return undefined;
|
|
242
186
|
}
|
|
243
187
|
function useMostRecentQuantitySample(_identifier, _unit) {
|
|
244
|
-
|
|
245
|
-
console.warn(notAvailableError);
|
|
246
|
-
hasWarned = true;
|
|
247
|
-
}
|
|
188
|
+
warnIfUnavailable();
|
|
248
189
|
return undefined;
|
|
249
190
|
}
|
|
250
191
|
exports.useMostRecentWorkout = UnavailableFnFromModule('useMostRecentWorkout', undefined);
|
|
@@ -275,6 +216,7 @@ exports.queryMedicationEventsWithAnchor = UnavailableFnFromModule('queryMedicati
|
|
|
275
216
|
exports.useSubscribeToQuantitySamples = UnavailableFnFromModule('useSubscribeToQuantitySamples', undefined);
|
|
276
217
|
exports.useSubscribeToCategorySamples = UnavailableFnFromModule('useSubscribeToCategorySamples', undefined);
|
|
277
218
|
exports.requestPerObjectReadAuthorization = UnavailableFnFromModule('requestPerObjectReadAuthorization', Promise.resolve(undefined)); // Mocking callback structure
|
|
219
|
+
exports.getEarliestAuthorizedSampleDates = UnavailableFnFromModule('getEarliestAuthorizedSampleDates', Promise.resolve({}));
|
|
278
220
|
exports.subscribeToCategorySamples = UnavailableFnFromModule('subscribeToCategorySamples', {
|
|
279
221
|
remove: () => false,
|
|
280
222
|
}); // Mocking the observer query UUID
|
|
@@ -344,6 +286,7 @@ const HealthkitModule = {
|
|
|
344
286
|
queryMedicationEventsWithAnchor: exports.queryMedicationEventsWithAnchor,
|
|
345
287
|
requestMedicationsAuthorization: exports.requestMedicationsAuthorization,
|
|
346
288
|
requestPerObjectReadAuthorization: exports.requestPerObjectReadAuthorization,
|
|
289
|
+
getEarliestAuthorizedSampleDates: exports.getEarliestAuthorizedSampleDates,
|
|
347
290
|
subscribeToCategorySamples: exports.subscribeToCategorySamples,
|
|
348
291
|
currentAppSource: exports.currentAppSource,
|
|
349
292
|
// Hooks
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AuthorizationStatus = exports.AuthorizationRequestStatus = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var AuthorizationRequestStatus;
|
|
8
|
-
(function (AuthorizationRequestStatus) {
|
|
9
|
-
AuthorizationRequestStatus[AuthorizationRequestStatus["unknown"] = 0] = "unknown";
|
|
10
|
-
AuthorizationRequestStatus[AuthorizationRequestStatus["shouldRequest"] = 1] = "shouldRequest";
|
|
11
|
-
AuthorizationRequestStatus[AuthorizationRequestStatus["unnecessary"] = 2] = "unnecessary";
|
|
12
|
-
})(AuthorizationRequestStatus || (exports.AuthorizationRequestStatus = AuthorizationRequestStatus = {}));
|
|
13
|
-
/**
|
|
14
|
-
* @see {@link https://developer.apple.com/documentation/healthkit/hkauthorizationstatus Apple Docs }
|
|
15
|
-
*/
|
|
16
|
-
var AuthorizationStatus;
|
|
17
|
-
(function (AuthorizationStatus) {
|
|
18
|
-
AuthorizationStatus[AuthorizationStatus["notDetermined"] = 0] = "notDetermined";
|
|
19
|
-
AuthorizationStatus[AuthorizationStatus["sharingDenied"] = 1] = "sharingDenied";
|
|
20
|
-
AuthorizationStatus[AuthorizationStatus["sharingAuthorized"] = 2] = "sharingAuthorized";
|
|
21
|
-
})(AuthorizationStatus || (exports.AuthorizationStatus = AuthorizationStatus = {}));
|
|
4
|
+
var core_1 = require("@react-native-healthkit/core");
|
|
5
|
+
Object.defineProperty(exports, "AuthorizationRequestStatus", { enumerable: true, get: function () { return core_1.AuthorizationRequestStatus; } });
|
|
6
|
+
Object.defineProperty(exports, "AuthorizationStatus", { enumerable: true, get: function () { return core_1.AuthorizationStatus; } });
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UpdateFrequency = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
var UpdateFrequency;
|
|
8
|
-
(function (UpdateFrequency) {
|
|
9
|
-
UpdateFrequency[UpdateFrequency["immediate"] = 1] = "immediate";
|
|
10
|
-
UpdateFrequency[UpdateFrequency["hourly"] = 2] = "hourly";
|
|
11
|
-
UpdateFrequency[UpdateFrequency["daily"] = 3] = "daily";
|
|
12
|
-
UpdateFrequency[UpdateFrequency["weekly"] = 4] = "weekly";
|
|
13
|
-
})(UpdateFrequency || (exports.UpdateFrequency = UpdateFrequency = {}));
|
|
4
|
+
var core_1 = require("@react-native-healthkit/core");
|
|
5
|
+
Object.defineProperty(exports, "UpdateFrequency", { enumerable: true, get: function () { return core_1.UpdateFrequency; } });
|
|
@@ -1,20 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ComparisonPredicateOperator = void 0;
|
|
4
|
-
var
|
|
5
|
-
(function (
|
|
6
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["lessThan"] = 0] = "lessThan";
|
|
7
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["lessThanOrEqualTo"] = 1] = "lessThanOrEqualTo";
|
|
8
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["greaterThan"] = 2] = "greaterThan";
|
|
9
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["greaterThanOrEqualTo"] = 3] = "greaterThanOrEqualTo";
|
|
10
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["equalTo"] = 4] = "equalTo";
|
|
11
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["notEqualTo"] = 5] = "notEqualTo";
|
|
12
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["matches"] = 6] = "matches";
|
|
13
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["like"] = 7] = "like";
|
|
14
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["beginsWith"] = 8] = "beginsWith";
|
|
15
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["endsWith"] = 9] = "endsWith";
|
|
16
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["IN"] = 10] = "IN";
|
|
17
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["customSelector"] = 11] = "customSelector";
|
|
18
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["contains"] = 99] = "contains";
|
|
19
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["between"] = 100] = "between";
|
|
20
|
-
})(ComparisonPredicateOperator || (exports.ComparisonPredicateOperator = ComparisonPredicateOperator = {}));
|
|
4
|
+
var core_1 = require("@react-native-healthkit/core");
|
|
5
|
+
Object.defineProperty(exports, "ComparisonPredicateOperator", { enumerable: true, get: function () { return core_1.ComparisonPredicateOperator; } });
|
|
@@ -84,6 +84,7 @@ export const QUANTITY_IDENTIFIER_IOS_AVAILABILITY = {
|
|
|
84
84
|
HKQuantityTypeIdentifierHeadphoneAudioExposure: '13.0',
|
|
85
85
|
HKQuantityTypeIdentifierHeartRate: '8.0',
|
|
86
86
|
HKQuantityTypeIdentifierHeartRateRecoveryOneMinute: '16.0',
|
|
87
|
+
HKQuantityTypeIdentifierHeartRateVariabilityRMSSD: '27.0',
|
|
87
88
|
HKQuantityTypeIdentifierHeartRateVariabilitySDNN: '11.0',
|
|
88
89
|
HKQuantityTypeIdentifierHeight: '8.0',
|
|
89
90
|
HKQuantityTypeIdentifierInhalerUsage: '8.0',
|
|
@@ -280,6 +281,7 @@ export const QUANTITY_IDENTIFIER_CANONICAL_UNITS = {
|
|
|
280
281
|
HKQuantityTypeIdentifierHeadphoneAudioExposure: 'dBASPL',
|
|
281
282
|
HKQuantityTypeIdentifierHeartRate: 'count/s',
|
|
282
283
|
HKQuantityTypeIdentifierHeartRateRecoveryOneMinute: 'count/min',
|
|
284
|
+
HKQuantityTypeIdentifierHeartRateVariabilityRMSSD: 'ms',
|
|
283
285
|
HKQuantityTypeIdentifierHeartRateVariabilitySDNN: 'ms',
|
|
284
286
|
HKQuantityTypeIdentifierHeight: 'm',
|
|
285
287
|
HKQuantityTypeIdentifierInhalerUsage: 'count',
|
|
@@ -53,6 +53,7 @@ const MedicationBindings = {
|
|
|
53
53
|
// Named exports - all functions bound to their respective modules
|
|
54
54
|
export const authorizationStatusFor = Core.authorizationStatusFor.bind(Core);
|
|
55
55
|
export const requestPerObjectReadAuthorization = Core.requestPerObjectReadAuthorization.bind(Core);
|
|
56
|
+
export const getEarliestAuthorizedSampleDates = Core.getEarliestAuthorizedSampleDates.bind(Core);
|
|
56
57
|
export const disableAllBackgroundDelivery = Core.disableAllBackgroundDelivery.bind(Core);
|
|
57
58
|
export const disableBackgroundDelivery = Core.disableBackgroundDelivery.bind(Core);
|
|
58
59
|
export const enableBackgroundDelivery = Core.enableBackgroundDelivery.bind(Core);
|
|
@@ -160,6 +161,7 @@ export default {
|
|
|
160
161
|
querySources,
|
|
161
162
|
requestAuthorization,
|
|
162
163
|
requestPerObjectReadAuthorization,
|
|
164
|
+
getEarliestAuthorizedSampleDates,
|
|
163
165
|
deleteObjects,
|
|
164
166
|
saveCategorySample,
|
|
165
167
|
saveCorrelationSample,
|
package/lib/module/healthkit.js
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createUnavailableHelpers } from '@react-native-healthkit/core';
|
|
2
2
|
import { AuthorizationRequestStatus, AuthorizationStatus } from './types/Auth';
|
|
3
3
|
import { BiologicalSex, BloodType, FitzpatrickSkinType, WheelchairUse, } from './types/Characteristics';
|
|
4
4
|
export * from './types';
|
|
5
|
-
const
|
|
6
|
-
let hasWarned = false;
|
|
7
|
-
function UnavailableFnFromModule(_fn, defaultValue) {
|
|
8
|
-
// @ts-expect-error
|
|
9
|
-
return () => {
|
|
10
|
-
if (Platform.OS !== 'ios' && !hasWarned) {
|
|
11
|
-
console.warn(notAvailableError);
|
|
12
|
-
hasWarned = true;
|
|
13
|
-
}
|
|
14
|
-
return defaultValue;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
5
|
+
const { unavailableFn: UnavailableFnFromModule, warnIfUnavailable } = createUnavailableHelpers('@kingstinct/react-native-healthkit');
|
|
17
6
|
// --- Mock Implementations for exported functions ---
|
|
18
7
|
// CoreModule functions
|
|
19
8
|
export const authorizationStatusFor = UnavailableFnFromModule('authorizationStatusFor', AuthorizationStatus.notDetermined);
|
|
@@ -46,17 +35,11 @@ export const getFitzpatrickSkinType = UnavailableFnFromModule('getFitzpatrickSki
|
|
|
46
35
|
export const getWheelchairUse = UnavailableFnFromModule('getWheelchairUse', WheelchairUse.notSet);
|
|
47
36
|
// QuantityTypeModule functions
|
|
48
37
|
export function queryQuantitySamples(_identifier, _options) {
|
|
49
|
-
|
|
50
|
-
console.warn(notAvailableError);
|
|
51
|
-
hasWarned = true;
|
|
52
|
-
}
|
|
38
|
+
warnIfUnavailable();
|
|
53
39
|
return Promise.resolve([]);
|
|
54
40
|
}
|
|
55
41
|
export function queryQuantitySamplesWithAnchor(_identifier, _options) {
|
|
56
|
-
|
|
57
|
-
console.warn(notAvailableError);
|
|
58
|
-
hasWarned = true;
|
|
59
|
-
}
|
|
42
|
+
warnIfUnavailable();
|
|
60
43
|
return Promise.resolve({
|
|
61
44
|
samples: [],
|
|
62
45
|
deletedSamples: [],
|
|
@@ -64,62 +47,38 @@ export function queryQuantitySamplesWithAnchor(_identifier, _options) {
|
|
|
64
47
|
});
|
|
65
48
|
}
|
|
66
49
|
export function queryStatisticsForQuantity(_identifier, _statistics, _options) {
|
|
67
|
-
|
|
68
|
-
console.warn(notAvailableError);
|
|
69
|
-
hasWarned = true;
|
|
70
|
-
}
|
|
50
|
+
warnIfUnavailable();
|
|
71
51
|
return Promise.resolve({
|
|
72
52
|
sources: [],
|
|
73
53
|
});
|
|
74
54
|
}
|
|
75
55
|
export function queryStatisticsCollectionForQuantity(_identifier, _statistics, _anchorDate, _intervalComponents, _options) {
|
|
76
|
-
|
|
77
|
-
console.warn(notAvailableError);
|
|
78
|
-
hasWarned = true;
|
|
79
|
-
}
|
|
56
|
+
warnIfUnavailable();
|
|
80
57
|
return Promise.resolve([]);
|
|
81
58
|
}
|
|
82
59
|
export function queryStatisticsForQuantitySeparateBySource(_identifier, _statistics, _options) {
|
|
83
|
-
|
|
84
|
-
console.warn(notAvailableError);
|
|
85
|
-
hasWarned = true;
|
|
86
|
-
}
|
|
60
|
+
warnIfUnavailable();
|
|
87
61
|
return Promise.resolve([]);
|
|
88
62
|
}
|
|
89
63
|
export function queryStatisticsCollectionForQuantitySeparateBySource(_identifier, _statistics, _anchorDate, _intervalComponents, _options) {
|
|
90
|
-
|
|
91
|
-
console.warn(notAvailableError);
|
|
92
|
-
hasWarned = true;
|
|
93
|
-
}
|
|
64
|
+
warnIfUnavailable();
|
|
94
65
|
return Promise.resolve([]);
|
|
95
66
|
}
|
|
96
67
|
export function saveQuantitySample(_identifier, _unit, _value, _start, _end, _metadata) {
|
|
97
|
-
|
|
98
|
-
console.warn(notAvailableError);
|
|
99
|
-
hasWarned = true;
|
|
100
|
-
}
|
|
68
|
+
warnIfUnavailable();
|
|
101
69
|
return Promise.resolve(undefined);
|
|
102
70
|
}
|
|
103
71
|
export function isQuantityCompatibleWithUnit(_identifier, _unit) {
|
|
104
|
-
|
|
105
|
-
console.warn(notAvailableError);
|
|
106
|
-
hasWarned = true;
|
|
107
|
-
}
|
|
72
|
+
warnIfUnavailable();
|
|
108
73
|
return false;
|
|
109
74
|
}
|
|
110
75
|
// CategoryTypeModule functions
|
|
111
76
|
export function queryCategorySamples(_categoryTypeIdentifier, _options) {
|
|
112
|
-
|
|
113
|
-
console.warn(notAvailableError);
|
|
114
|
-
hasWarned = true;
|
|
115
|
-
}
|
|
77
|
+
warnIfUnavailable();
|
|
116
78
|
return Promise.resolve([]);
|
|
117
79
|
}
|
|
118
80
|
export function queryCategorySamplesWithAnchor(_categoryTypeIdentifier, _options) {
|
|
119
|
-
|
|
120
|
-
console.warn(notAvailableError);
|
|
121
|
-
hasWarned = true;
|
|
122
|
-
}
|
|
81
|
+
warnIfUnavailable();
|
|
123
82
|
return Promise.resolve({
|
|
124
83
|
samples: [],
|
|
125
84
|
deletedSamples: [],
|
|
@@ -127,10 +86,7 @@ export function queryCategorySamplesWithAnchor(_categoryTypeIdentifier, _options
|
|
|
127
86
|
});
|
|
128
87
|
}
|
|
129
88
|
export function saveCategorySample(_identifier, _value, _startDate, _endDate, _metadata) {
|
|
130
|
-
|
|
131
|
-
console.warn(notAvailableError);
|
|
132
|
-
hasWarned = true;
|
|
133
|
-
}
|
|
89
|
+
warnIfUnavailable();
|
|
134
90
|
return Promise.resolve(undefined);
|
|
135
91
|
}
|
|
136
92
|
// CorrelationTypeModule functions
|
|
@@ -175,42 +131,27 @@ export const queryCorrelationSamplesWithAnchor = UnavailableFnFromModule('queryC
|
|
|
175
131
|
export const saveStateOfMindSample = UnavailableFnFromModule('saveStateOfMindSample', Promise.resolve(undefined));
|
|
176
132
|
// Utility functions (from original export list)
|
|
177
133
|
export function getMostRecentCategorySample(_identifier) {
|
|
178
|
-
|
|
179
|
-
console.warn(notAvailableError);
|
|
180
|
-
hasWarned = true;
|
|
181
|
-
}
|
|
134
|
+
warnIfUnavailable();
|
|
182
135
|
return Promise.resolve(undefined);
|
|
183
136
|
}
|
|
184
137
|
export function getMostRecentQuantitySample(_identifier, _unit) {
|
|
185
|
-
|
|
186
|
-
console.warn(notAvailableError);
|
|
187
|
-
hasWarned = true;
|
|
188
|
-
}
|
|
138
|
+
warnIfUnavailable();
|
|
189
139
|
return Promise.resolve(undefined);
|
|
190
140
|
}
|
|
191
141
|
export const getMostRecentWorkout = UnavailableFnFromModule('getMostRecentWorkout',
|
|
192
142
|
// biome-ignore lint/suspicious/noExplicitAny: it works
|
|
193
143
|
Promise.resolve(undefined));
|
|
194
144
|
export function getPreferredUnit(_quantityType) {
|
|
195
|
-
|
|
196
|
-
console.warn(notAvailableError);
|
|
197
|
-
hasWarned = true;
|
|
198
|
-
}
|
|
145
|
+
warnIfUnavailable();
|
|
199
146
|
return Promise.resolve('count');
|
|
200
147
|
}
|
|
201
148
|
// Hooks (from original export list)
|
|
202
149
|
export function useMostRecentCategorySample(_categoryTypeIdentifier) {
|
|
203
|
-
|
|
204
|
-
console.warn(notAvailableError);
|
|
205
|
-
hasWarned = true;
|
|
206
|
-
}
|
|
150
|
+
warnIfUnavailable();
|
|
207
151
|
return undefined;
|
|
208
152
|
}
|
|
209
153
|
export function useMostRecentQuantitySample(_identifier, _unit) {
|
|
210
|
-
|
|
211
|
-
console.warn(notAvailableError);
|
|
212
|
-
hasWarned = true;
|
|
213
|
-
}
|
|
154
|
+
warnIfUnavailable();
|
|
214
155
|
return undefined;
|
|
215
156
|
}
|
|
216
157
|
export const useMostRecentWorkout = UnavailableFnFromModule('useMostRecentWorkout', undefined);
|
|
@@ -241,6 +182,7 @@ export const queryMedicationEventsWithAnchor = UnavailableFnFromModule('queryMed
|
|
|
241
182
|
export const useSubscribeToQuantitySamples = UnavailableFnFromModule('useSubscribeToQuantitySamples', undefined);
|
|
242
183
|
export const useSubscribeToCategorySamples = UnavailableFnFromModule('useSubscribeToCategorySamples', undefined);
|
|
243
184
|
export const requestPerObjectReadAuthorization = UnavailableFnFromModule('requestPerObjectReadAuthorization', Promise.resolve(undefined)); // Mocking callback structure
|
|
185
|
+
export const getEarliestAuthorizedSampleDates = UnavailableFnFromModule('getEarliestAuthorizedSampleDates', Promise.resolve({}));
|
|
244
186
|
export const subscribeToCategorySamples = UnavailableFnFromModule('subscribeToCategorySamples', {
|
|
245
187
|
remove: () => false,
|
|
246
188
|
}); // Mocking the observer query UUID
|
|
@@ -310,6 +252,7 @@ const HealthkitModule = {
|
|
|
310
252
|
queryMedicationEventsWithAnchor,
|
|
311
253
|
requestMedicationsAuthorization,
|
|
312
254
|
requestPerObjectReadAuthorization,
|
|
255
|
+
getEarliestAuthorizedSampleDates,
|
|
313
256
|
subscribeToCategorySamples,
|
|
314
257
|
currentAppSource,
|
|
315
258
|
// Hooks
|
package/lib/module/types/Auth.js
CHANGED
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* @see {@link https://developer.apple.com/documentation/healthkit/hkauthorizationrequeststatus Apple Docs }
|
|
3
|
-
*/
|
|
4
|
-
export var AuthorizationRequestStatus;
|
|
5
|
-
(function (AuthorizationRequestStatus) {
|
|
6
|
-
AuthorizationRequestStatus[AuthorizationRequestStatus["unknown"] = 0] = "unknown";
|
|
7
|
-
AuthorizationRequestStatus[AuthorizationRequestStatus["shouldRequest"] = 1] = "shouldRequest";
|
|
8
|
-
AuthorizationRequestStatus[AuthorizationRequestStatus["unnecessary"] = 2] = "unnecessary";
|
|
9
|
-
})(AuthorizationRequestStatus || (AuthorizationRequestStatus = {}));
|
|
10
|
-
/**
|
|
11
|
-
* @see {@link https://developer.apple.com/documentation/healthkit/hkauthorizationstatus Apple Docs }
|
|
12
|
-
*/
|
|
13
|
-
export var AuthorizationStatus;
|
|
14
|
-
(function (AuthorizationStatus) {
|
|
15
|
-
AuthorizationStatus[AuthorizationStatus["notDetermined"] = 0] = "notDetermined";
|
|
16
|
-
AuthorizationStatus[AuthorizationStatus["sharingDenied"] = 1] = "sharingDenied";
|
|
17
|
-
AuthorizationStatus[AuthorizationStatus["sharingAuthorized"] = 2] = "sharingAuthorized";
|
|
18
|
-
})(AuthorizationStatus || (AuthorizationStatus = {}));
|
|
1
|
+
export { AuthorizationRequestStatus, AuthorizationStatus, } from '@react-native-healthkit/core';
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* @see {@link https://developer.apple.com/documentation/healthkit/hkupdatefrequency Apple Docs }
|
|
3
|
-
*/
|
|
4
|
-
export var UpdateFrequency;
|
|
5
|
-
(function (UpdateFrequency) {
|
|
6
|
-
UpdateFrequency[UpdateFrequency["immediate"] = 1] = "immediate";
|
|
7
|
-
UpdateFrequency[UpdateFrequency["hourly"] = 2] = "hourly";
|
|
8
|
-
UpdateFrequency[UpdateFrequency["daily"] = 3] = "daily";
|
|
9
|
-
UpdateFrequency[UpdateFrequency["weekly"] = 4] = "weekly";
|
|
10
|
-
})(UpdateFrequency || (UpdateFrequency = {}));
|
|
1
|
+
export { UpdateFrequency } from '@react-native-healthkit/core';
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
(function (ComparisonPredicateOperator) {
|
|
3
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["lessThan"] = 0] = "lessThan";
|
|
4
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["lessThanOrEqualTo"] = 1] = "lessThanOrEqualTo";
|
|
5
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["greaterThan"] = 2] = "greaterThan";
|
|
6
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["greaterThanOrEqualTo"] = 3] = "greaterThanOrEqualTo";
|
|
7
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["equalTo"] = 4] = "equalTo";
|
|
8
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["notEqualTo"] = 5] = "notEqualTo";
|
|
9
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["matches"] = 6] = "matches";
|
|
10
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["like"] = 7] = "like";
|
|
11
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["beginsWith"] = 8] = "beginsWith";
|
|
12
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["endsWith"] = 9] = "endsWith";
|
|
13
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["IN"] = 10] = "IN";
|
|
14
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["customSelector"] = 11] = "customSelector";
|
|
15
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["contains"] = 99] = "contains";
|
|
16
|
-
ComparisonPredicateOperator[ComparisonPredicateOperator["between"] = 100] = "between";
|
|
17
|
-
})(ComparisonPredicateOperator || (ComparisonPredicateOperator = {}));
|
|
1
|
+
export { ComparisonPredicateOperator } from '@react-native-healthkit/core';
|