@kingstinct/react-native-healthkit 9.0.6 → 9.0.8
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/ios/CategoryTypeModule.swift +18 -21
- package/ios/CharacteristicTypeModule.swift +36 -21
- package/ios/CorrelationTypeModule.swift +18 -18
- package/ios/HeartbeatSeriesModule.swift +32 -32
- package/ios/QuantityTypeModule.swift +56 -57
- package/ios/Serializers.swift +12 -16
- package/ios/StateOfMindModule.swift +17 -17
- package/ios/WorkoutsModule.swift +59 -110
- package/lib/commonjs/healthkit.js +225 -0
- package/lib/commonjs/hooks/useStatisticsForQuantity.js +1 -1
- package/lib/commonjs/index.js +6 -209
- package/lib/module/healthkit.js +203 -0
- package/lib/module/hooks/useStatisticsForQuantity.js +1 -1
- package/lib/module/index.js +3 -203
- package/lib/typescript/healthkit.d.ts +69 -0
- package/lib/typescript/{index.ios.d.ts → healthkit.ios.d.ts} +11 -11
- package/lib/typescript/hooks/useHealthkitAuthorization.d.ts +1 -1
- package/lib/typescript/index.d.ts +3 -69
- package/lib/typescript/specs/CategoryTypeModule.nitro.d.ts +1 -1
- package/lib/typescript/specs/CharacteristicTypeModule.nitro.d.ts +2 -2
- package/lib/typescript/specs/CoreModule.nitro.d.ts +3 -3
- package/lib/typescript/specs/WorkoutsModule.nitro.d.ts +3 -0
- package/lib/typescript/types/Shared.d.ts +3 -3
- package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.cpp +7 -48
- package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.hpp +54 -154
- package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Umbrella.hpp +0 -14
- package/nitrogen/generated/ios/c++/HybridCharacteristicTypeModuleSpecSwift.hpp +3 -2
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__chrono__system_clock__time_point_.swift +52 -0
- package/nitrogen/generated/ios/swift/HybridCharacteristicTypeModuleSpec.swift +2 -2
- package/nitrogen/generated/ios/swift/HybridCharacteristicTypeModuleSpec_cxx.swift +23 -11
- package/nitrogen/generated/shared/c++/HybridCharacteristicTypeModuleSpec.hpp +3 -2
- package/package.json +2 -2
- package/src/healthkit.ts +422 -0
- package/src/hooks/useHealthkitAuthorization.ts +2 -2
- package/src/hooks/useStatisticsForQuantity.ts +1 -3
- package/src/index.ts +3 -419
- package/src/specs/CategoryTypeModule.nitro.ts +1 -1
- package/src/specs/CharacteristicTypeModule.nitro.ts +2 -2
- package/src/specs/CoreModule.nitro.ts +5 -5
- package/src/specs/WorkoutsModule.nitro.ts +3 -0
- package/src/test-setup.ts +0 -1
- package/src/types/QueryOptions.ts +3 -3
- package/src/types/Shared.ts +6 -8
- package/ios/WorkoutSessionModule.swift +0 -182
- package/lib/commonjs/specs/WorkoutSessionModule.nitro.js +0 -19
- package/lib/module/specs/WorkoutSessionModule.nitro.js +0 -16
- package/lib/typescript/specs/WorkoutSessionModule.nitro.d.ts +0 -47
- package/nitrogen/generated/ios/c++/HybridWorkoutSessionModuleSpecSwift.cpp +0 -11
- package/nitrogen/generated/ios/c++/HybridWorkoutSessionModuleSpecSwift.hpp +0 -107
- package/nitrogen/generated/ios/swift/Func_void_WorkoutEventType.swift +0 -46
- package/nitrogen/generated/ios/swift/Func_void_WorkoutSessionState_WorkoutSessionState_std__chrono__system_clock__time_point.swift +0 -46
- package/nitrogen/generated/ios/swift/Func_void_std__chrono__system_clock__time_point.swift +0 -46
- package/nitrogen/generated/ios/swift/Func_void_std__vector_RemoteSessionSharableData_.swift +0 -46
- package/nitrogen/generated/ios/swift/HybridWorkoutSessionModuleSpec.swift +0 -49
- package/nitrogen/generated/ios/swift/HybridWorkoutSessionModuleSpec_cxx.swift +0 -133
- package/nitrogen/generated/ios/swift/RemoteSessionSharableData.swift +0 -46
- package/nitrogen/generated/ios/swift/WorkoutSessionMirroringStartHandlerOptions.swift +0 -118
- package/nitrogen/generated/ios/swift/WorkoutSessionState.swift +0 -56
- package/nitrogen/generated/shared/c++/HybridWorkoutSessionModuleSpec.cpp +0 -22
- package/nitrogen/generated/shared/c++/HybridWorkoutSessionModuleSpec.hpp +0 -68
- package/nitrogen/generated/shared/c++/RemoteSessionSharableData.hpp +0 -75
- package/nitrogen/generated/shared/c++/WorkoutSessionMirroringStartHandlerOptions.hpp +0 -92
- package/nitrogen/generated/shared/c++/WorkoutSessionState.hpp +0 -68
- package/src/specs/WorkoutSessionModule.nitro.ts +0 -71
- /package/lib/commonjs/{index.ios.js → healthkit.ios.js} +0 -0
- /package/lib/module/{index.ios.js → healthkit.ios.js} +0 -0
- /package/src/{index.ios.ts → healthkit.ios.ts} +0 -0
package/lib/commonjs/index.js
CHANGED
|
@@ -13,213 +13,10 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
exports.unsubscribeQueries = exports.getWheelchairUseAsync = exports.getFitzpatrickSkinTypeAsync = exports.getDateOfBirthAsync = exports.getBloodTypeAsync = void 0;
|
|
19
|
-
exports.queryCategorySamples = queryCategorySamples;
|
|
20
|
-
exports.queryCategorySamplesWithAnchor = queryCategorySamplesWithAnchor;
|
|
21
|
-
exports.getMostRecentCategorySample = getMostRecentCategorySample;
|
|
22
|
-
exports.useMostRecentCategorySample = useMostRecentCategorySample;
|
|
23
|
-
const react_native_1 = require("react-native");
|
|
24
|
-
const Auth_1 = require("./types/Auth");
|
|
25
|
-
const Characteristics_1 = require("./types/Characteristics");
|
|
26
|
-
__exportStar(require("./types"), exports);
|
|
27
|
-
const notAvailableError = `[@kingstinct/react-native-healthkit] Platform "${react_native_1.Platform.OS}" not supported. HealthKit is only available on iOS.`;
|
|
28
|
-
let hasWarned = false;
|
|
29
|
-
// @ts-ignore
|
|
30
|
-
function UnavailableFnFromModule(fn, defaultValue) {
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
return () => {
|
|
33
|
-
if (react_native_1.Platform.OS !== 'ios' && !hasWarned) {
|
|
34
|
-
console.warn(notAvailableError);
|
|
35
|
-
hasWarned = true;
|
|
36
|
-
}
|
|
37
|
-
return defaultValue;
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
// --- Mock Implementations for exported functions ---
|
|
41
|
-
// CoreModule functions
|
|
42
|
-
exports.authorizationStatusFor = UnavailableFnFromModule('authorizationStatusFor', Auth_1.AuthorizationStatus.notDetermined);
|
|
43
|
-
exports.disableAllBackgroundDelivery = UnavailableFnFromModule('disableAllBackgroundDelivery', Promise.resolve(false));
|
|
44
|
-
exports.disableBackgroundDelivery = UnavailableFnFromModule('disableBackgroundDelivery', Promise.resolve(false));
|
|
45
|
-
exports.enableBackgroundDelivery = UnavailableFnFromModule('enableBackgroundDelivery', Promise.resolve(false));
|
|
46
|
-
exports.getPreferredUnits = UnavailableFnFromModule('getPreferredUnits', Promise.resolve([]));
|
|
47
|
-
exports.getRequestStatusForAuthorization = UnavailableFnFromModule('getRequestStatusForAuthorization', Promise.resolve(Auth_1.AuthorizationRequestStatus.unknown));
|
|
48
|
-
exports.isHealthDataAvailable = UnavailableFnFromModule('isHealthDataAvailable', false); // Original was synchronous
|
|
49
|
-
exports.isHealthDataAvailableAsync = UnavailableFnFromModule('isHealthDataAvailableAsync', Promise.resolve(false)); // Added for consistency if needed
|
|
50
|
-
exports.querySources = UnavailableFnFromModule('querySources', Promise.resolve([]));
|
|
51
|
-
exports.requestAuthorization = UnavailableFnFromModule('requestAuthorization', Promise.resolve(false));
|
|
52
|
-
exports.deleteObjects = UnavailableFnFromModule('deleteObjects', Promise.resolve(0));
|
|
53
|
-
exports.subscribeToChanges = UnavailableFnFromModule('subscribeToChanges', 'dummy-query-uuid'); // Mocking the observer query UUID
|
|
54
|
-
exports.isProtectedDataAvailable = UnavailableFnFromModule('isProtectedDataAvailable', false);
|
|
55
|
-
exports.isObjectTypeAvailable = UnavailableFnFromModule('isObjectTypeAvailable', false);
|
|
56
|
-
exports.isObjectTypeAvailableAsync = UnavailableFnFromModule('isObjectTypeAvailableAsync', Promise.resolve(false));
|
|
57
|
-
exports.areObjectTypesAvailable = UnavailableFnFromModule('areObjectTypesAvailable', {});
|
|
58
|
-
exports.areObjectTypesAvailableAsync = UnavailableFnFromModule('areObjectTypesAvailableAsync', Promise.resolve({}));
|
|
59
|
-
// CharacteristicTypeModule functions
|
|
60
|
-
exports.getBiologicalSex = UnavailableFnFromModule('getBiologicalSex', Characteristics_1.BiologicalSex.notSet);
|
|
61
|
-
exports.getBloodType = UnavailableFnFromModule('getBloodType', Characteristics_1.BloodType.notSet);
|
|
62
|
-
exports.getDateOfBirth = UnavailableFnFromModule('getDateOfBirth', new Date(0)); // Assuming string for date
|
|
63
|
-
exports.getFitzpatrickSkinType = UnavailableFnFromModule('getFitzpatrickSkinType', Characteristics_1.FitzpatrickSkinType.notSet);
|
|
64
|
-
exports.getWheelchairUse = UnavailableFnFromModule('getWheelchairUse', Characteristics_1.WheelchairUse.notSet);
|
|
65
|
-
// QuantityTypeModule functions
|
|
66
|
-
exports.queryQuantitySamples = UnavailableFnFromModule('queryQuantitySamples', Promise.resolve([]));
|
|
67
|
-
exports.queryQuantitySamplesWithAnchor = UnavailableFnFromModule('queryQuantitySamplesWithAnchor', Promise.resolve({
|
|
68
|
-
samples: [],
|
|
69
|
-
deletedSamples: [],
|
|
70
|
-
newAnchor: '',
|
|
71
|
-
}));
|
|
72
|
-
exports.queryStatisticsForQuantity = UnavailableFnFromModule('queryStatisticsForQuantity', Promise.resolve({}));
|
|
73
|
-
exports.queryStatisticsCollectionForQuantity = UnavailableFnFromModule('queryStatisticsCollectionForQuantity', Promise.resolve([]));
|
|
74
|
-
exports.saveQuantitySample = UnavailableFnFromModule('saveQuantitySample', Promise.resolve(false));
|
|
75
|
-
exports.isQuantityCompatibleWithUnit = UnavailableFnFromModule('isQuantityCompatibleWithUnit', false);
|
|
76
|
-
// CategoryTypeModule functions
|
|
77
|
-
function queryCategorySamples(categoryTypeIdentifier) {
|
|
78
|
-
if (react_native_1.Platform.OS !== 'ios' && !hasWarned) {
|
|
79
|
-
console.warn(notAvailableError);
|
|
80
|
-
hasWarned = true;
|
|
81
|
-
}
|
|
82
|
-
return Promise.resolve([]);
|
|
83
|
-
}
|
|
84
|
-
function queryCategorySamplesWithAnchor(categoryTypeIdentifier) {
|
|
85
|
-
if (react_native_1.Platform.OS !== 'ios' && !hasWarned) {
|
|
86
|
-
console.warn(notAvailableError);
|
|
87
|
-
hasWarned = true;
|
|
88
|
-
}
|
|
89
|
-
return Promise.resolve({
|
|
90
|
-
samples: [],
|
|
91
|
-
deletedSamples: [],
|
|
92
|
-
newAnchor: '',
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
exports.saveCategorySample = UnavailableFnFromModule('saveCategorySample', Promise.resolve(false));
|
|
96
|
-
// CorrelationTypeModule functions
|
|
97
|
-
exports.queryCorrelationSamples = UnavailableFnFromModule('queryCorrelationSamples', Promise.resolve([]));
|
|
98
|
-
exports.saveCorrelationSample = UnavailableFnFromModule('saveCorrelationSample', Promise.resolve(false));
|
|
99
|
-
// HeartbeatSeriesModule functions
|
|
100
|
-
exports.queryHeartbeatSeriesSamples = UnavailableFnFromModule('queryHeartbeatSeriesSamples', Promise.resolve([]));
|
|
101
|
-
exports.queryHeartbeatSeriesSamplesWithAnchor = UnavailableFnFromModule('queryHeartbeatSeriesSamplesWithAnchor', Promise.resolve({
|
|
102
|
-
samples: [],
|
|
103
|
-
deletedSamples: [],
|
|
104
|
-
newAnchor: '',
|
|
105
|
-
}));
|
|
106
|
-
// WorkoutsModule functions
|
|
107
|
-
exports.queryWorkoutSamples = UnavailableFnFromModule('queryWorkoutSamples', Promise.resolve([]));
|
|
108
|
-
exports.queryWorkoutSamplesWithAnchor = UnavailableFnFromModule('queryWorkoutSamplesWithAnchor', Promise.resolve({
|
|
109
|
-
workouts: [],
|
|
110
|
-
deletedSamples: [],
|
|
111
|
-
newAnchor: '',
|
|
112
|
-
}));
|
|
113
|
-
exports.saveWorkoutSample = UnavailableFnFromModule('saveWorkoutSample', Promise.resolve(''));
|
|
114
|
-
exports.startWatchApp = UnavailableFnFromModule('startWatchApp', Promise.resolve(false));
|
|
115
|
-
// StateOfMindModule functions
|
|
116
|
-
exports.queryStateOfMindSamples = UnavailableFnFromModule('queryStateOfMindSamples', Promise.resolve([]));
|
|
117
|
-
exports.saveStateOfMindSample = UnavailableFnFromModule('saveStateOfMindSample', Promise.resolve(false));
|
|
118
|
-
// Utility functions (from original export list)
|
|
119
|
-
function getMostRecentCategorySample(identifier) {
|
|
120
|
-
if (react_native_1.Platform.OS !== 'ios' && !hasWarned) {
|
|
121
|
-
console.warn(notAvailableError);
|
|
122
|
-
hasWarned = true;
|
|
123
|
-
}
|
|
124
|
-
return Promise.resolve(undefined);
|
|
125
|
-
}
|
|
126
|
-
exports.getMostRecentQuantitySample = UnavailableFnFromModule('getMostRecentQuantitySample',
|
|
127
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
128
|
-
Promise.resolve(undefined));
|
|
129
|
-
exports.getMostRecentWorkout = UnavailableFnFromModule('getMostRecentWorkout',
|
|
130
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
131
|
-
Promise.resolve(undefined));
|
|
132
|
-
exports.getPreferredUnit = UnavailableFnFromModule('getPreferredUnit', Promise.resolve('count')); // Defaulting to 'count'
|
|
133
|
-
// Hooks (from original export list)
|
|
134
|
-
function useMostRecentCategorySample(categoryTypeIdentifier) {
|
|
135
|
-
if (react_native_1.Platform.OS !== 'ios' && !hasWarned) {
|
|
136
|
-
console.warn(notAvailableError);
|
|
137
|
-
hasWarned = true;
|
|
138
|
-
}
|
|
139
|
-
return undefined;
|
|
140
|
-
}
|
|
141
|
-
exports.useMostRecentQuantitySample = UnavailableFnFromModule('useMostRecentQuantitySample', undefined);
|
|
142
|
-
exports.useMostRecentWorkout = UnavailableFnFromModule('useMostRecentWorkout', undefined);
|
|
143
|
-
exports.useSubscribeToChanges = UnavailableFnFromModule('useSubscribeToChanges', undefined); // Mocking callback structure
|
|
144
|
-
exports.useHealthkitAuthorization = UnavailableFnFromModule('useHealthkitAuthorization', [
|
|
145
|
-
Auth_1.AuthorizationRequestStatus.unknown,
|
|
146
|
-
() => Promise.resolve(Auth_1.AuthorizationRequestStatus.unknown),
|
|
147
|
-
]);
|
|
148
|
-
exports.useIsHealthDataAvailable = UnavailableFnFromModule('useIsHealthDataAvailable', false);
|
|
149
|
-
exports.useSources = UnavailableFnFromModule('useSources', null);
|
|
150
|
-
exports.useStatisticsForQuantity = UnavailableFnFromModule('useStatisticsForQuantity', null);
|
|
151
|
-
exports.getBiologicalSexAsync = UnavailableFnFromModule('getBiologicalSexAsync', Promise.resolve(Characteristics_1.BiologicalSex.notSet));
|
|
152
|
-
exports.getBloodTypeAsync = UnavailableFnFromModule('getBloodTypeAsync', Promise.resolve(Characteristics_1.BloodType.notSet));
|
|
153
|
-
exports.getDateOfBirthAsync = UnavailableFnFromModule('getDateOfBirthAsync', Promise.resolve(new Date(0))); // Assuming string for date
|
|
154
|
-
exports.getFitzpatrickSkinTypeAsync = UnavailableFnFromModule('getFitzpatrickSkinTypeAsync', Promise.resolve(Characteristics_1.FitzpatrickSkinType.notSet));
|
|
155
|
-
exports.getWheelchairUseAsync = UnavailableFnFromModule('getWheelchairUseAsync', Promise.resolve(Characteristics_1.WheelchairUse.notSet));
|
|
156
|
-
exports.unsubscribeQueries = UnavailableFnFromModule('unsubscribeQueries', 0);
|
|
157
|
-
// --- Default Export ---
|
|
158
|
-
// This attempts to match the structure of the default export from index.ios.ts
|
|
159
|
-
const HealthkitModule = {
|
|
160
|
-
// All named exports are also part of the default export object
|
|
161
|
-
authorizationStatusFor: exports.authorizationStatusFor,
|
|
162
|
-
isObjectTypeAvailable: exports.isObjectTypeAvailable,
|
|
163
|
-
unsubscribeQueries: exports.unsubscribeQueries,
|
|
164
|
-
isObjectTypeAvailableAsync: exports.isObjectTypeAvailableAsync,
|
|
165
|
-
areObjectTypesAvailable: exports.areObjectTypesAvailable,
|
|
166
|
-
areObjectTypesAvailableAsync: exports.areObjectTypesAvailableAsync,
|
|
167
|
-
isQuantityCompatibleWithUnit: exports.isQuantityCompatibleWithUnit,
|
|
168
|
-
disableAllBackgroundDelivery: exports.disableAllBackgroundDelivery,
|
|
169
|
-
disableBackgroundDelivery: exports.disableBackgroundDelivery,
|
|
170
|
-
enableBackgroundDelivery: exports.enableBackgroundDelivery,
|
|
171
|
-
getBiologicalSex: exports.getBiologicalSex,
|
|
172
|
-
getBloodType: exports.getBloodType,
|
|
173
|
-
getDateOfBirth: exports.getDateOfBirth,
|
|
174
|
-
getFitzpatrickSkinType: exports.getFitzpatrickSkinType,
|
|
175
|
-
getMostRecentCategorySample,
|
|
176
|
-
getMostRecentQuantitySample: exports.getMostRecentQuantitySample,
|
|
177
|
-
getMostRecentWorkout: exports.getMostRecentWorkout,
|
|
178
|
-
getPreferredUnits: exports.getPreferredUnits,
|
|
179
|
-
getPreferredUnit: exports.getPreferredUnit,
|
|
180
|
-
getRequestStatusForAuthorization: exports.getRequestStatusForAuthorization,
|
|
181
|
-
getWheelchairUse: exports.getWheelchairUse,
|
|
182
|
-
isHealthDataAvailable: exports.isHealthDataAvailable,
|
|
183
|
-
isHealthDataAvailableAsync: exports.isHealthDataAvailableAsync,
|
|
184
|
-
queryCategorySamples,
|
|
185
|
-
queryCategorySamplesWithAnchor,
|
|
186
|
-
queryCorrelationSamples: exports.queryCorrelationSamples,
|
|
187
|
-
queryHeartbeatSeriesSamples: exports.queryHeartbeatSeriesSamples,
|
|
188
|
-
queryHeartbeatSeriesSamplesWithAnchor: exports.queryHeartbeatSeriesSamplesWithAnchor,
|
|
189
|
-
queryQuantitySamples: exports.queryQuantitySamples,
|
|
190
|
-
queryQuantitySamplesWithAnchor: exports.queryQuantitySamplesWithAnchor,
|
|
191
|
-
queryStatisticsForQuantity: exports.queryStatisticsForQuantity,
|
|
192
|
-
queryStatisticsCollectionForQuantity: exports.queryStatisticsCollectionForQuantity,
|
|
193
|
-
queryWorkoutSamples: exports.queryWorkoutSamples,
|
|
194
|
-
queryWorkoutSamplesWithAnchor: exports.queryWorkoutSamplesWithAnchor,
|
|
195
|
-
querySources: exports.querySources,
|
|
196
|
-
requestAuthorization: exports.requestAuthorization,
|
|
197
|
-
deleteObjects: exports.deleteObjects,
|
|
198
|
-
saveCategorySample: exports.saveCategorySample,
|
|
199
|
-
saveCorrelationSample: exports.saveCorrelationSample,
|
|
200
|
-
saveQuantitySample: exports.saveQuantitySample,
|
|
201
|
-
saveWorkoutSample: exports.saveWorkoutSample,
|
|
202
|
-
subscribeToChanges: exports.subscribeToChanges,
|
|
203
|
-
startWatchApp: exports.startWatchApp,
|
|
204
|
-
isProtectedDataAvailable: exports.isProtectedDataAvailable,
|
|
205
|
-
queryStateOfMindSamples: exports.queryStateOfMindSamples,
|
|
206
|
-
saveStateOfMindSample: exports.saveStateOfMindSample,
|
|
207
|
-
// Hooks
|
|
208
|
-
useMostRecentCategorySample,
|
|
209
|
-
useMostRecentQuantitySample: exports.useMostRecentQuantitySample,
|
|
210
|
-
useMostRecentWorkout: exports.useMostRecentWorkout,
|
|
211
|
-
useSubscribeToChanges: exports.useSubscribeToChanges,
|
|
212
|
-
useHealthkitAuthorization: exports.useHealthkitAuthorization,
|
|
213
|
-
useIsHealthDataAvailable: exports.useIsHealthDataAvailable,
|
|
214
|
-
useSources: exports.useSources,
|
|
215
|
-
useStatisticsForQuantity: exports.useStatisticsForQuantity,
|
|
216
|
-
getBiologicalSexAsync: exports.getBiologicalSexAsync,
|
|
217
|
-
getBloodTypeAsync: exports.getBloodTypeAsync,
|
|
218
|
-
getDateOfBirthAsync: exports.getDateOfBirthAsync,
|
|
219
|
-
getFitzpatrickSkinTypeAsync: exports.getFitzpatrickSkinTypeAsync,
|
|
220
|
-
getWheelchairUseAsync: exports.getWheelchairUseAsync,
|
|
221
|
-
};
|
|
222
|
-
exports.default = {
|
|
223
|
-
...HealthkitModule,
|
|
224
|
-
default: HealthkitModule,
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
225
18
|
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
const healthkit_1 = __importDefault(require("./healthkit"));
|
|
21
|
+
__exportStar(require("./healthkit"), exports);
|
|
22
|
+
exports.default = healthkit_1.default;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import { AuthorizationRequestStatus, AuthorizationStatus } from './types/Auth';
|
|
3
|
+
import { BiologicalSex, BloodType, FitzpatrickSkinType, WheelchairUse, } from './types/Characteristics';
|
|
4
|
+
export * from './types';
|
|
5
|
+
const notAvailableError = `[@kingstinct/react-native-healthkit] Platform "${Platform.OS}" not supported. HealthKit is only available on iOS.`;
|
|
6
|
+
let hasWarned = false;
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
function UnavailableFnFromModule(_fn, defaultValue) {
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
return () => {
|
|
11
|
+
if (Platform.OS !== 'ios' && !hasWarned) {
|
|
12
|
+
console.warn(notAvailableError);
|
|
13
|
+
hasWarned = true;
|
|
14
|
+
}
|
|
15
|
+
return defaultValue;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
// --- Mock Implementations for exported functions ---
|
|
19
|
+
// CoreModule functions
|
|
20
|
+
export const authorizationStatusFor = UnavailableFnFromModule('authorizationStatusFor', AuthorizationStatus.notDetermined);
|
|
21
|
+
export const disableAllBackgroundDelivery = UnavailableFnFromModule('disableAllBackgroundDelivery', Promise.resolve(false));
|
|
22
|
+
export const disableBackgroundDelivery = UnavailableFnFromModule('disableBackgroundDelivery', Promise.resolve(false));
|
|
23
|
+
export const enableBackgroundDelivery = UnavailableFnFromModule('enableBackgroundDelivery', Promise.resolve(false));
|
|
24
|
+
export const getPreferredUnits = UnavailableFnFromModule('getPreferredUnits', Promise.resolve([]));
|
|
25
|
+
export const getRequestStatusForAuthorization = UnavailableFnFromModule('getRequestStatusForAuthorization', Promise.resolve(AuthorizationRequestStatus.unknown));
|
|
26
|
+
export const isHealthDataAvailable = UnavailableFnFromModule('isHealthDataAvailable', false); // Original was synchronous
|
|
27
|
+
export const isHealthDataAvailableAsync = UnavailableFnFromModule('isHealthDataAvailableAsync', Promise.resolve(false)); // Added for consistency if needed
|
|
28
|
+
export const querySources = UnavailableFnFromModule('querySources', Promise.resolve([]));
|
|
29
|
+
export const requestAuthorization = UnavailableFnFromModule('requestAuthorization', Promise.resolve(false));
|
|
30
|
+
export const deleteObjects = UnavailableFnFromModule('deleteObjects', Promise.resolve(0));
|
|
31
|
+
export const subscribeToChanges = UnavailableFnFromModule('subscribeToChanges', 'dummy-query-uuid'); // Mocking the observer query UUID
|
|
32
|
+
export const isProtectedDataAvailable = UnavailableFnFromModule('isProtectedDataAvailable', false);
|
|
33
|
+
export const isObjectTypeAvailable = UnavailableFnFromModule('isObjectTypeAvailable', false);
|
|
34
|
+
export const isObjectTypeAvailableAsync = UnavailableFnFromModule('isObjectTypeAvailableAsync', Promise.resolve(false));
|
|
35
|
+
export const areObjectTypesAvailable = UnavailableFnFromModule('areObjectTypesAvailable', {});
|
|
36
|
+
export const areObjectTypesAvailableAsync = UnavailableFnFromModule('areObjectTypesAvailableAsync', Promise.resolve({}));
|
|
37
|
+
// CharacteristicTypeModule functions
|
|
38
|
+
export const getBiologicalSex = UnavailableFnFromModule('getBiologicalSex', BiologicalSex.notSet);
|
|
39
|
+
export const getBloodType = UnavailableFnFromModule('getBloodType', BloodType.notSet);
|
|
40
|
+
export const getDateOfBirth = UnavailableFnFromModule('getDateOfBirth', new Date(0)); // Assuming string for date
|
|
41
|
+
export const getFitzpatrickSkinType = UnavailableFnFromModule('getFitzpatrickSkinType', FitzpatrickSkinType.notSet);
|
|
42
|
+
export const getWheelchairUse = UnavailableFnFromModule('getWheelchairUse', WheelchairUse.notSet);
|
|
43
|
+
// QuantityTypeModule functions
|
|
44
|
+
export const queryQuantitySamples = UnavailableFnFromModule('queryQuantitySamples', Promise.resolve([]));
|
|
45
|
+
export const queryQuantitySamplesWithAnchor = UnavailableFnFromModule('queryQuantitySamplesWithAnchor', Promise.resolve({
|
|
46
|
+
samples: [],
|
|
47
|
+
deletedSamples: [],
|
|
48
|
+
newAnchor: '',
|
|
49
|
+
}));
|
|
50
|
+
export const queryStatisticsForQuantity = UnavailableFnFromModule('queryStatisticsForQuantity', Promise.resolve({}));
|
|
51
|
+
export const queryStatisticsCollectionForQuantity = UnavailableFnFromModule('queryStatisticsCollectionForQuantity', Promise.resolve([]));
|
|
52
|
+
export const saveQuantitySample = UnavailableFnFromModule('saveQuantitySample', Promise.resolve(false));
|
|
53
|
+
export const isQuantityCompatibleWithUnit = UnavailableFnFromModule('isQuantityCompatibleWithUnit', false);
|
|
54
|
+
// CategoryTypeModule functions
|
|
55
|
+
export function queryCategorySamples(_categoryTypeIdentifier) {
|
|
56
|
+
if (Platform.OS !== 'ios' && !hasWarned) {
|
|
57
|
+
console.warn(notAvailableError);
|
|
58
|
+
hasWarned = true;
|
|
59
|
+
}
|
|
60
|
+
return Promise.resolve([]);
|
|
61
|
+
}
|
|
62
|
+
export function queryCategorySamplesWithAnchor(_categoryTypeIdentifier) {
|
|
63
|
+
if (Platform.OS !== 'ios' && !hasWarned) {
|
|
64
|
+
console.warn(notAvailableError);
|
|
65
|
+
hasWarned = true;
|
|
66
|
+
}
|
|
67
|
+
return Promise.resolve({
|
|
68
|
+
samples: [],
|
|
69
|
+
deletedSamples: [],
|
|
70
|
+
newAnchor: '',
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
export const saveCategorySample = UnavailableFnFromModule('saveCategorySample', Promise.resolve(false));
|
|
74
|
+
// CorrelationTypeModule functions
|
|
75
|
+
export const queryCorrelationSamples = UnavailableFnFromModule('queryCorrelationSamples', Promise.resolve([]));
|
|
76
|
+
export const saveCorrelationSample = UnavailableFnFromModule('saveCorrelationSample', Promise.resolve(false));
|
|
77
|
+
// HeartbeatSeriesModule functions
|
|
78
|
+
export const queryHeartbeatSeriesSamples = UnavailableFnFromModule('queryHeartbeatSeriesSamples', Promise.resolve([]));
|
|
79
|
+
export const queryHeartbeatSeriesSamplesWithAnchor = UnavailableFnFromModule('queryHeartbeatSeriesSamplesWithAnchor', Promise.resolve({
|
|
80
|
+
samples: [],
|
|
81
|
+
deletedSamples: [],
|
|
82
|
+
newAnchor: '',
|
|
83
|
+
}));
|
|
84
|
+
// WorkoutsModule functions
|
|
85
|
+
export const queryWorkoutSamples = UnavailableFnFromModule('queryWorkoutSamples', Promise.resolve([]));
|
|
86
|
+
export const queryWorkoutSamplesWithAnchor = UnavailableFnFromModule('queryWorkoutSamplesWithAnchor', Promise.resolve({
|
|
87
|
+
workouts: [],
|
|
88
|
+
deletedSamples: [],
|
|
89
|
+
newAnchor: '',
|
|
90
|
+
}));
|
|
91
|
+
export const saveWorkoutSample = UnavailableFnFromModule('saveWorkoutSample', Promise.resolve(''));
|
|
92
|
+
export const startWatchApp = UnavailableFnFromModule('startWatchApp', Promise.resolve(false));
|
|
93
|
+
// StateOfMindModule functions
|
|
94
|
+
export const queryStateOfMindSamples = UnavailableFnFromModule('queryStateOfMindSamples', Promise.resolve([]));
|
|
95
|
+
export const saveStateOfMindSample = UnavailableFnFromModule('saveStateOfMindSample', Promise.resolve(false));
|
|
96
|
+
// Utility functions (from original export list)
|
|
97
|
+
export function getMostRecentCategorySample(_identifier) {
|
|
98
|
+
if (Platform.OS !== 'ios' && !hasWarned) {
|
|
99
|
+
console.warn(notAvailableError);
|
|
100
|
+
hasWarned = true;
|
|
101
|
+
}
|
|
102
|
+
return Promise.resolve(undefined);
|
|
103
|
+
}
|
|
104
|
+
export const getMostRecentQuantitySample = UnavailableFnFromModule('getMostRecentQuantitySample',
|
|
105
|
+
// biome-ignore lint/suspicious/noExplicitAny: it works
|
|
106
|
+
Promise.resolve(undefined));
|
|
107
|
+
export const getMostRecentWorkout = UnavailableFnFromModule('getMostRecentWorkout',
|
|
108
|
+
// biome-ignore lint/suspicious/noExplicitAny: it works
|
|
109
|
+
Promise.resolve(undefined));
|
|
110
|
+
export const getPreferredUnit = UnavailableFnFromModule('getPreferredUnit', Promise.resolve('count')); // Defaulting to 'count'
|
|
111
|
+
// Hooks (from original export list)
|
|
112
|
+
export function useMostRecentCategorySample(_categoryTypeIdentifier) {
|
|
113
|
+
if (Platform.OS !== 'ios' && !hasWarned) {
|
|
114
|
+
console.warn(notAvailableError);
|
|
115
|
+
hasWarned = true;
|
|
116
|
+
}
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
export const useMostRecentQuantitySample = UnavailableFnFromModule('useMostRecentQuantitySample', undefined);
|
|
120
|
+
export const useMostRecentWorkout = UnavailableFnFromModule('useMostRecentWorkout', undefined);
|
|
121
|
+
export const useSubscribeToChanges = UnavailableFnFromModule('useSubscribeToChanges', undefined); // Mocking callback structure
|
|
122
|
+
export const useHealthkitAuthorization = UnavailableFnFromModule('useHealthkitAuthorization', [
|
|
123
|
+
AuthorizationRequestStatus.unknown,
|
|
124
|
+
() => Promise.resolve(AuthorizationRequestStatus.unknown),
|
|
125
|
+
]);
|
|
126
|
+
export const useIsHealthDataAvailable = UnavailableFnFromModule('useIsHealthDataAvailable', false);
|
|
127
|
+
export const useSources = UnavailableFnFromModule('useSources', null);
|
|
128
|
+
export const useStatisticsForQuantity = UnavailableFnFromModule('useStatisticsForQuantity', null);
|
|
129
|
+
export const getBiologicalSexAsync = UnavailableFnFromModule('getBiologicalSexAsync', Promise.resolve(BiologicalSex.notSet));
|
|
130
|
+
export const getBloodTypeAsync = UnavailableFnFromModule('getBloodTypeAsync', Promise.resolve(BloodType.notSet));
|
|
131
|
+
export const getDateOfBirthAsync = UnavailableFnFromModule('getDateOfBirthAsync', Promise.resolve(new Date(0))); // Assuming string for date
|
|
132
|
+
export const getFitzpatrickSkinTypeAsync = UnavailableFnFromModule('getFitzpatrickSkinTypeAsync', Promise.resolve(FitzpatrickSkinType.notSet));
|
|
133
|
+
export const getWheelchairUseAsync = UnavailableFnFromModule('getWheelchairUseAsync', Promise.resolve(WheelchairUse.notSet));
|
|
134
|
+
export const unsubscribeQueries = UnavailableFnFromModule('unsubscribeQueries', 0);
|
|
135
|
+
// --- Default Export ---
|
|
136
|
+
// This attempts to match the structure of the default export from index.ios.ts
|
|
137
|
+
const HealthkitModule = {
|
|
138
|
+
// All named exports are also part of the default export object
|
|
139
|
+
authorizationStatusFor,
|
|
140
|
+
isObjectTypeAvailable,
|
|
141
|
+
unsubscribeQueries,
|
|
142
|
+
isObjectTypeAvailableAsync,
|
|
143
|
+
areObjectTypesAvailable,
|
|
144
|
+
areObjectTypesAvailableAsync,
|
|
145
|
+
isQuantityCompatibleWithUnit,
|
|
146
|
+
disableAllBackgroundDelivery,
|
|
147
|
+
disableBackgroundDelivery,
|
|
148
|
+
enableBackgroundDelivery,
|
|
149
|
+
getBiologicalSex,
|
|
150
|
+
getBloodType,
|
|
151
|
+
getDateOfBirth,
|
|
152
|
+
getFitzpatrickSkinType,
|
|
153
|
+
getMostRecentCategorySample,
|
|
154
|
+
getMostRecentQuantitySample,
|
|
155
|
+
getMostRecentWorkout,
|
|
156
|
+
getPreferredUnits,
|
|
157
|
+
getPreferredUnit,
|
|
158
|
+
getRequestStatusForAuthorization,
|
|
159
|
+
getWheelchairUse,
|
|
160
|
+
isHealthDataAvailable,
|
|
161
|
+
isHealthDataAvailableAsync,
|
|
162
|
+
queryCategorySamples,
|
|
163
|
+
queryCategorySamplesWithAnchor,
|
|
164
|
+
queryCorrelationSamples,
|
|
165
|
+
queryHeartbeatSeriesSamples,
|
|
166
|
+
queryHeartbeatSeriesSamplesWithAnchor,
|
|
167
|
+
queryQuantitySamples,
|
|
168
|
+
queryQuantitySamplesWithAnchor,
|
|
169
|
+
queryStatisticsForQuantity,
|
|
170
|
+
queryStatisticsCollectionForQuantity,
|
|
171
|
+
queryWorkoutSamples,
|
|
172
|
+
queryWorkoutSamplesWithAnchor,
|
|
173
|
+
querySources,
|
|
174
|
+
requestAuthorization,
|
|
175
|
+
deleteObjects,
|
|
176
|
+
saveCategorySample,
|
|
177
|
+
saveCorrelationSample,
|
|
178
|
+
saveQuantitySample,
|
|
179
|
+
saveWorkoutSample,
|
|
180
|
+
subscribeToChanges,
|
|
181
|
+
startWatchApp,
|
|
182
|
+
isProtectedDataAvailable,
|
|
183
|
+
queryStateOfMindSamples,
|
|
184
|
+
saveStateOfMindSample,
|
|
185
|
+
// Hooks
|
|
186
|
+
useMostRecentCategorySample,
|
|
187
|
+
useMostRecentQuantitySample,
|
|
188
|
+
useMostRecentWorkout,
|
|
189
|
+
useSubscribeToChanges,
|
|
190
|
+
useHealthkitAuthorization,
|
|
191
|
+
useIsHealthDataAvailable,
|
|
192
|
+
useSources,
|
|
193
|
+
useStatisticsForQuantity,
|
|
194
|
+
getBiologicalSexAsync,
|
|
195
|
+
getBloodTypeAsync,
|
|
196
|
+
getDateOfBirthAsync,
|
|
197
|
+
getFitzpatrickSkinTypeAsync,
|
|
198
|
+
getWheelchairUseAsync,
|
|
199
|
+
};
|
|
200
|
+
export default {
|
|
201
|
+
...HealthkitModule,
|
|
202
|
+
default: HealthkitModule,
|
|
203
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import useSubscribeToChanges from './useSubscribeToChanges';
|
|
3
2
|
import { QuantityTypes } from '../modules';
|
|
3
|
+
import useSubscribeToChanges from './useSubscribeToChanges';
|
|
4
4
|
export function useStatisticsForQuantity(identifier, options, from, to, unit) {
|
|
5
5
|
const [result, setResult] = useState(null);
|
|
6
6
|
const optionsRef = useRef(options);
|
package/lib/module/index.js
CHANGED
|
@@ -1,203 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export * from './types';
|
|
5
|
-
const notAvailableError = `[@kingstinct/react-native-healthkit] Platform "${Platform.OS}" not supported. HealthKit is only available on iOS.`;
|
|
6
|
-
let hasWarned = false;
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
function UnavailableFnFromModule(fn, defaultValue) {
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
return () => {
|
|
11
|
-
if (Platform.OS !== 'ios' && !hasWarned) {
|
|
12
|
-
console.warn(notAvailableError);
|
|
13
|
-
hasWarned = true;
|
|
14
|
-
}
|
|
15
|
-
return defaultValue;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
// --- Mock Implementations for exported functions ---
|
|
19
|
-
// CoreModule functions
|
|
20
|
-
export const authorizationStatusFor = UnavailableFnFromModule('authorizationStatusFor', AuthorizationStatus.notDetermined);
|
|
21
|
-
export const disableAllBackgroundDelivery = UnavailableFnFromModule('disableAllBackgroundDelivery', Promise.resolve(false));
|
|
22
|
-
export const disableBackgroundDelivery = UnavailableFnFromModule('disableBackgroundDelivery', Promise.resolve(false));
|
|
23
|
-
export const enableBackgroundDelivery = UnavailableFnFromModule('enableBackgroundDelivery', Promise.resolve(false));
|
|
24
|
-
export const getPreferredUnits = UnavailableFnFromModule('getPreferredUnits', Promise.resolve([]));
|
|
25
|
-
export const getRequestStatusForAuthorization = UnavailableFnFromModule('getRequestStatusForAuthorization', Promise.resolve(AuthorizationRequestStatus.unknown));
|
|
26
|
-
export const isHealthDataAvailable = UnavailableFnFromModule('isHealthDataAvailable', false); // Original was synchronous
|
|
27
|
-
export const isHealthDataAvailableAsync = UnavailableFnFromModule('isHealthDataAvailableAsync', Promise.resolve(false)); // Added for consistency if needed
|
|
28
|
-
export const querySources = UnavailableFnFromModule('querySources', Promise.resolve([]));
|
|
29
|
-
export const requestAuthorization = UnavailableFnFromModule('requestAuthorization', Promise.resolve(false));
|
|
30
|
-
export const deleteObjects = UnavailableFnFromModule('deleteObjects', Promise.resolve(0));
|
|
31
|
-
export const subscribeToChanges = UnavailableFnFromModule('subscribeToChanges', 'dummy-query-uuid'); // Mocking the observer query UUID
|
|
32
|
-
export const isProtectedDataAvailable = UnavailableFnFromModule('isProtectedDataAvailable', false);
|
|
33
|
-
export const isObjectTypeAvailable = UnavailableFnFromModule('isObjectTypeAvailable', false);
|
|
34
|
-
export const isObjectTypeAvailableAsync = UnavailableFnFromModule('isObjectTypeAvailableAsync', Promise.resolve(false));
|
|
35
|
-
export const areObjectTypesAvailable = UnavailableFnFromModule('areObjectTypesAvailable', {});
|
|
36
|
-
export const areObjectTypesAvailableAsync = UnavailableFnFromModule('areObjectTypesAvailableAsync', Promise.resolve({}));
|
|
37
|
-
// CharacteristicTypeModule functions
|
|
38
|
-
export const getBiologicalSex = UnavailableFnFromModule('getBiologicalSex', BiologicalSex.notSet);
|
|
39
|
-
export const getBloodType = UnavailableFnFromModule('getBloodType', BloodType.notSet);
|
|
40
|
-
export const getDateOfBirth = UnavailableFnFromModule('getDateOfBirth', new Date(0)); // Assuming string for date
|
|
41
|
-
export const getFitzpatrickSkinType = UnavailableFnFromModule('getFitzpatrickSkinType', FitzpatrickSkinType.notSet);
|
|
42
|
-
export const getWheelchairUse = UnavailableFnFromModule('getWheelchairUse', WheelchairUse.notSet);
|
|
43
|
-
// QuantityTypeModule functions
|
|
44
|
-
export const queryQuantitySamples = UnavailableFnFromModule('queryQuantitySamples', Promise.resolve([]));
|
|
45
|
-
export const queryQuantitySamplesWithAnchor = UnavailableFnFromModule('queryQuantitySamplesWithAnchor', Promise.resolve({
|
|
46
|
-
samples: [],
|
|
47
|
-
deletedSamples: [],
|
|
48
|
-
newAnchor: '',
|
|
49
|
-
}));
|
|
50
|
-
export const queryStatisticsForQuantity = UnavailableFnFromModule('queryStatisticsForQuantity', Promise.resolve({}));
|
|
51
|
-
export const queryStatisticsCollectionForQuantity = UnavailableFnFromModule('queryStatisticsCollectionForQuantity', Promise.resolve([]));
|
|
52
|
-
export const saveQuantitySample = UnavailableFnFromModule('saveQuantitySample', Promise.resolve(false));
|
|
53
|
-
export const isQuantityCompatibleWithUnit = UnavailableFnFromModule('isQuantityCompatibleWithUnit', false);
|
|
54
|
-
// CategoryTypeModule functions
|
|
55
|
-
export function queryCategorySamples(categoryTypeIdentifier) {
|
|
56
|
-
if (Platform.OS !== 'ios' && !hasWarned) {
|
|
57
|
-
console.warn(notAvailableError);
|
|
58
|
-
hasWarned = true;
|
|
59
|
-
}
|
|
60
|
-
return Promise.resolve([]);
|
|
61
|
-
}
|
|
62
|
-
export function queryCategorySamplesWithAnchor(categoryTypeIdentifier) {
|
|
63
|
-
if (Platform.OS !== 'ios' && !hasWarned) {
|
|
64
|
-
console.warn(notAvailableError);
|
|
65
|
-
hasWarned = true;
|
|
66
|
-
}
|
|
67
|
-
return Promise.resolve({
|
|
68
|
-
samples: [],
|
|
69
|
-
deletedSamples: [],
|
|
70
|
-
newAnchor: '',
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
export const saveCategorySample = UnavailableFnFromModule('saveCategorySample', Promise.resolve(false));
|
|
74
|
-
// CorrelationTypeModule functions
|
|
75
|
-
export const queryCorrelationSamples = UnavailableFnFromModule('queryCorrelationSamples', Promise.resolve([]));
|
|
76
|
-
export const saveCorrelationSample = UnavailableFnFromModule('saveCorrelationSample', Promise.resolve(false));
|
|
77
|
-
// HeartbeatSeriesModule functions
|
|
78
|
-
export const queryHeartbeatSeriesSamples = UnavailableFnFromModule('queryHeartbeatSeriesSamples', Promise.resolve([]));
|
|
79
|
-
export const queryHeartbeatSeriesSamplesWithAnchor = UnavailableFnFromModule('queryHeartbeatSeriesSamplesWithAnchor', Promise.resolve({
|
|
80
|
-
samples: [],
|
|
81
|
-
deletedSamples: [],
|
|
82
|
-
newAnchor: '',
|
|
83
|
-
}));
|
|
84
|
-
// WorkoutsModule functions
|
|
85
|
-
export const queryWorkoutSamples = UnavailableFnFromModule('queryWorkoutSamples', Promise.resolve([]));
|
|
86
|
-
export const queryWorkoutSamplesWithAnchor = UnavailableFnFromModule('queryWorkoutSamplesWithAnchor', Promise.resolve({
|
|
87
|
-
workouts: [],
|
|
88
|
-
deletedSamples: [],
|
|
89
|
-
newAnchor: '',
|
|
90
|
-
}));
|
|
91
|
-
export const saveWorkoutSample = UnavailableFnFromModule('saveWorkoutSample', Promise.resolve(''));
|
|
92
|
-
export const startWatchApp = UnavailableFnFromModule('startWatchApp', Promise.resolve(false));
|
|
93
|
-
// StateOfMindModule functions
|
|
94
|
-
export const queryStateOfMindSamples = UnavailableFnFromModule('queryStateOfMindSamples', Promise.resolve([]));
|
|
95
|
-
export const saveStateOfMindSample = UnavailableFnFromModule('saveStateOfMindSample', Promise.resolve(false));
|
|
96
|
-
// Utility functions (from original export list)
|
|
97
|
-
export function getMostRecentCategorySample(identifier) {
|
|
98
|
-
if (Platform.OS !== 'ios' && !hasWarned) {
|
|
99
|
-
console.warn(notAvailableError);
|
|
100
|
-
hasWarned = true;
|
|
101
|
-
}
|
|
102
|
-
return Promise.resolve(undefined);
|
|
103
|
-
}
|
|
104
|
-
export const getMostRecentQuantitySample = UnavailableFnFromModule('getMostRecentQuantitySample',
|
|
105
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
106
|
-
Promise.resolve(undefined));
|
|
107
|
-
export const getMostRecentWorkout = UnavailableFnFromModule('getMostRecentWorkout',
|
|
108
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
109
|
-
Promise.resolve(undefined));
|
|
110
|
-
export const getPreferredUnit = UnavailableFnFromModule('getPreferredUnit', Promise.resolve('count')); // Defaulting to 'count'
|
|
111
|
-
// Hooks (from original export list)
|
|
112
|
-
export function useMostRecentCategorySample(categoryTypeIdentifier) {
|
|
113
|
-
if (Platform.OS !== 'ios' && !hasWarned) {
|
|
114
|
-
console.warn(notAvailableError);
|
|
115
|
-
hasWarned = true;
|
|
116
|
-
}
|
|
117
|
-
return undefined;
|
|
118
|
-
}
|
|
119
|
-
export const useMostRecentQuantitySample = UnavailableFnFromModule('useMostRecentQuantitySample', undefined);
|
|
120
|
-
export const useMostRecentWorkout = UnavailableFnFromModule('useMostRecentWorkout', undefined);
|
|
121
|
-
export const useSubscribeToChanges = UnavailableFnFromModule('useSubscribeToChanges', undefined); // Mocking callback structure
|
|
122
|
-
export const useHealthkitAuthorization = UnavailableFnFromModule('useHealthkitAuthorization', [
|
|
123
|
-
AuthorizationRequestStatus.unknown,
|
|
124
|
-
() => Promise.resolve(AuthorizationRequestStatus.unknown),
|
|
125
|
-
]);
|
|
126
|
-
export const useIsHealthDataAvailable = UnavailableFnFromModule('useIsHealthDataAvailable', false);
|
|
127
|
-
export const useSources = UnavailableFnFromModule('useSources', null);
|
|
128
|
-
export const useStatisticsForQuantity = UnavailableFnFromModule('useStatisticsForQuantity', null);
|
|
129
|
-
export const getBiologicalSexAsync = UnavailableFnFromModule('getBiologicalSexAsync', Promise.resolve(BiologicalSex.notSet));
|
|
130
|
-
export const getBloodTypeAsync = UnavailableFnFromModule('getBloodTypeAsync', Promise.resolve(BloodType.notSet));
|
|
131
|
-
export const getDateOfBirthAsync = UnavailableFnFromModule('getDateOfBirthAsync', Promise.resolve(new Date(0))); // Assuming string for date
|
|
132
|
-
export const getFitzpatrickSkinTypeAsync = UnavailableFnFromModule('getFitzpatrickSkinTypeAsync', Promise.resolve(FitzpatrickSkinType.notSet));
|
|
133
|
-
export const getWheelchairUseAsync = UnavailableFnFromModule('getWheelchairUseAsync', Promise.resolve(WheelchairUse.notSet));
|
|
134
|
-
export const unsubscribeQueries = UnavailableFnFromModule('unsubscribeQueries', 0);
|
|
135
|
-
// --- Default Export ---
|
|
136
|
-
// This attempts to match the structure of the default export from index.ios.ts
|
|
137
|
-
const HealthkitModule = {
|
|
138
|
-
// All named exports are also part of the default export object
|
|
139
|
-
authorizationStatusFor,
|
|
140
|
-
isObjectTypeAvailable,
|
|
141
|
-
unsubscribeQueries,
|
|
142
|
-
isObjectTypeAvailableAsync,
|
|
143
|
-
areObjectTypesAvailable,
|
|
144
|
-
areObjectTypesAvailableAsync,
|
|
145
|
-
isQuantityCompatibleWithUnit,
|
|
146
|
-
disableAllBackgroundDelivery,
|
|
147
|
-
disableBackgroundDelivery,
|
|
148
|
-
enableBackgroundDelivery,
|
|
149
|
-
getBiologicalSex,
|
|
150
|
-
getBloodType,
|
|
151
|
-
getDateOfBirth,
|
|
152
|
-
getFitzpatrickSkinType,
|
|
153
|
-
getMostRecentCategorySample,
|
|
154
|
-
getMostRecentQuantitySample,
|
|
155
|
-
getMostRecentWorkout,
|
|
156
|
-
getPreferredUnits,
|
|
157
|
-
getPreferredUnit,
|
|
158
|
-
getRequestStatusForAuthorization,
|
|
159
|
-
getWheelchairUse,
|
|
160
|
-
isHealthDataAvailable,
|
|
161
|
-
isHealthDataAvailableAsync,
|
|
162
|
-
queryCategorySamples,
|
|
163
|
-
queryCategorySamplesWithAnchor,
|
|
164
|
-
queryCorrelationSamples,
|
|
165
|
-
queryHeartbeatSeriesSamples,
|
|
166
|
-
queryHeartbeatSeriesSamplesWithAnchor,
|
|
167
|
-
queryQuantitySamples,
|
|
168
|
-
queryQuantitySamplesWithAnchor,
|
|
169
|
-
queryStatisticsForQuantity,
|
|
170
|
-
queryStatisticsCollectionForQuantity,
|
|
171
|
-
queryWorkoutSamples,
|
|
172
|
-
queryWorkoutSamplesWithAnchor,
|
|
173
|
-
querySources,
|
|
174
|
-
requestAuthorization,
|
|
175
|
-
deleteObjects,
|
|
176
|
-
saveCategorySample,
|
|
177
|
-
saveCorrelationSample,
|
|
178
|
-
saveQuantitySample,
|
|
179
|
-
saveWorkoutSample,
|
|
180
|
-
subscribeToChanges,
|
|
181
|
-
startWatchApp,
|
|
182
|
-
isProtectedDataAvailable,
|
|
183
|
-
queryStateOfMindSamples,
|
|
184
|
-
saveStateOfMindSample,
|
|
185
|
-
// Hooks
|
|
186
|
-
useMostRecentCategorySample,
|
|
187
|
-
useMostRecentQuantitySample,
|
|
188
|
-
useMostRecentWorkout,
|
|
189
|
-
useSubscribeToChanges,
|
|
190
|
-
useHealthkitAuthorization,
|
|
191
|
-
useIsHealthDataAvailable,
|
|
192
|
-
useSources,
|
|
193
|
-
useStatisticsForQuantity,
|
|
194
|
-
getBiologicalSexAsync,
|
|
195
|
-
getBloodTypeAsync,
|
|
196
|
-
getDateOfBirthAsync,
|
|
197
|
-
getFitzpatrickSkinTypeAsync,
|
|
198
|
-
getWheelchairUseAsync,
|
|
199
|
-
};
|
|
200
|
-
export default {
|
|
201
|
-
...HealthkitModule,
|
|
202
|
-
default: HealthkitModule,
|
|
203
|
-
};
|
|
1
|
+
import HealthKit from './healthkit';
|
|
2
|
+
export * from './healthkit';
|
|
3
|
+
export default HealthKit;
|