@kingstinct/react-native-healthkit 10.1.0 → 11.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/ios/CoreModule.swift +5 -15
- package/ios/CorrelationTypeModule.swift +7 -2
- package/ios/QuantityTypeModule.swift +62 -110
- package/ios/Serializers.swift +39 -66
- package/ios/WorkoutProxy.swift +38 -20
- package/ios/WorkoutsModule.swift +7 -18
- package/lib/commonjs/hooks/useMostRecentWorkout.js +2 -9
- package/lib/commonjs/hooks/useWorkoutById.js +1 -4
- package/lib/commonjs/utils/getMostRecentWorkout.js +1 -3
- package/lib/commonjs/utils/getWorkoutById.js +1 -3
- package/lib/module/hooks/useMostRecentWorkout.js +3 -10
- package/lib/module/hooks/useWorkoutById.js +1 -4
- package/lib/module/utils/getMostRecentWorkout.js +1 -3
- package/lib/module/utils/getWorkoutById.js +1 -3
- package/lib/typescript/healthkit.d.ts +1 -1
- package/lib/typescript/healthkit.ios.d.ts +1 -1
- package/lib/typescript/hooks/useMostRecentWorkout.d.ts +1 -4
- package/lib/typescript/specs/WorkoutProxy.nitro.d.ts +11 -0
- package/lib/typescript/types/Workouts.d.ts +0 -8
- package/lib/typescript/utils/getMostRecentWorkout.d.ts +1 -2
- package/lib/typescript/utils/getWorkoutById.d.ts +1 -2
- package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.cpp +103 -87
- package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.hpp +748 -493
- package/nitrogen/generated/ios/ReactNativeHealthkitAutolinking.mm +8 -8
- package/nitrogen/generated/ios/ReactNativeHealthkitAutolinking.swift +16 -16
- package/nitrogen/generated/ios/c++/HybridCategoryTypeModuleSpecSwift.hpp +6 -4
- package/nitrogen/generated/ios/c++/HybridCharacteristicTypeModuleSpecSwift.hpp +4 -2
- package/nitrogen/generated/ios/c++/HybridCoreModuleSpecSwift.hpp +7 -5
- package/nitrogen/generated/ios/c++/HybridCorrelationTypeModuleSpecSwift.hpp +6 -4
- package/nitrogen/generated/ios/c++/HybridHeartbeatSeriesModuleSpecSwift.hpp +7 -5
- package/nitrogen/generated/ios/c++/HybridQuantityTypeModuleSpecSwift.hpp +5 -3
- package/nitrogen/generated/ios/c++/HybridSourceProxySpecSwift.hpp +3 -1
- package/nitrogen/generated/ios/c++/HybridStateOfMindModuleSpecSwift.hpp +7 -5
- package/nitrogen/generated/ios/c++/HybridWorkoutProxySpecSwift.hpp +50 -22
- package/nitrogen/generated/ios/c++/HybridWorkoutsModuleSpecSwift.hpp +9 -7
- package/nitrogen/generated/ios/swift/CategorySample.swift +4 -2
- package/nitrogen/generated/ios/swift/CategorySampleForSaving.swift +2 -1
- package/nitrogen/generated/ios/swift/CorrelationObject.swift +2 -0
- package/nitrogen/generated/ios/swift/DeletedSample.swift +2 -1
- package/nitrogen/generated/ios/swift/Device.swift +16 -8
- package/nitrogen/generated/ios/swift/FilterForSamples.swift +2 -0
- package/nitrogen/generated/ios/swift/Func_void_AuthorizationRequestStatus.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_BiologicalSex.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_BloodType.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_CategorySamplesWithAnchorResponse.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_FitzpatrickSkinType.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_HeartbeatSeriesSamplesWithAnchorResponse.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_OnChangeCallbackArgs.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_QuantitySamplesWithAnchorResponse.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_QueryStatisticsResponse.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_QueryWorkoutSamplesWithAnchorResponse.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_WheelchairUse.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_QueryStatisticsResponse_.swift +54 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_WorkoutPlan_.swift +3 -1
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__chrono__system_clock__time_point_.swift +3 -1
- package/nitrogen/generated/ios/swift/{Func_void_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec_.swift → Func_void_std__shared_ptr_HybridWorkoutProxySpec_.swift} +9 -8
- package/nitrogen/generated/ios/swift/Func_void_std__unordered_map_std__string__QueryStatisticsResponse_.swift +55 -0
- package/nitrogen/generated/ios/swift/Func_void_std__unordered_map_std__string__bool_.swift +2 -1
- package/nitrogen/generated/ios/swift/Func_void_std__vector_CategorySample_.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_CorrelationSample_.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_HeartbeatSeriesSample_.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_IdentifierWithUnit_.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_QuantitySample_.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_QueryStatisticsResponse_.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_StateOfMindSample_.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_WorkoutRoute_.swift +1 -0
- package/nitrogen/generated/ios/swift/{Func_void_std__vector_std__shared_ptr_margelo__nitro__healthkit__HybridSourceProxySpec__.swift → Func_void_std__vector_std__shared_ptr_HybridSourceProxySpec__.swift} +9 -8
- package/nitrogen/generated/ios/swift/{Func_void_std__vector_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec__.swift → Func_void_std__vector_std__shared_ptr_HybridWorkoutProxySpec__.swift} +9 -8
- package/nitrogen/generated/ios/swift/HeartbeatSeriesSample.swift +6 -3
- package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec.swift +2 -1
- package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec_cxx.swift +17 -7
- package/nitrogen/generated/ios/swift/HybridCharacteristicTypeModuleSpec.swift +2 -1
- package/nitrogen/generated/ios/swift/HybridCharacteristicTypeModuleSpec_cxx.swift +15 -6
- package/nitrogen/generated/ios/swift/HybridCoreModuleSpec.swift +2 -1
- package/nitrogen/generated/ios/swift/HybridCoreModuleSpec_cxx.swift +24 -15
- package/nitrogen/generated/ios/swift/HybridCorrelationTypeModuleSpec.swift +2 -1
- package/nitrogen/generated/ios/swift/HybridCorrelationTypeModuleSpec_cxx.swift +15 -6
- package/nitrogen/generated/ios/swift/HybridHeartbeatSeriesModuleSpec.swift +2 -1
- package/nitrogen/generated/ios/swift/HybridHeartbeatSeriesModuleSpec_cxx.swift +17 -7
- package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec.swift +2 -1
- package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec_cxx.swift +21 -9
- package/nitrogen/generated/ios/swift/HybridSourceProxySpec.swift +2 -1
- package/nitrogen/generated/ios/swift/HybridSourceProxySpec_cxx.swift +17 -7
- package/nitrogen/generated/ios/swift/HybridStateOfMindModuleSpec.swift +2 -1
- package/nitrogen/generated/ios/swift/HybridStateOfMindModuleSpec_cxx.swift +19 -8
- package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec.swift +8 -5
- package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec_cxx.swift +108 -41
- package/nitrogen/generated/ios/swift/HybridWorkoutsModuleSpec.swift +2 -1
- package/nitrogen/generated/ios/swift/HybridWorkoutsModuleSpec_cxx.swift +31 -22
- package/nitrogen/generated/ios/swift/OnChangeCallbackArgs.swift +2 -1
- package/nitrogen/generated/ios/swift/PredicateForSamples.swift +2 -0
- package/nitrogen/generated/ios/swift/PredicateForWorkouts.swift +2 -0
- package/nitrogen/generated/ios/swift/PredicateFromWorkout.swift +3 -3
- package/nitrogen/generated/ios/swift/PredicateWithMetadataKey.swift +2 -1
- package/nitrogen/generated/ios/swift/PredicateWithStartAndEnd.swift +4 -2
- package/nitrogen/generated/ios/swift/QuantitySample.swift +4 -2
- package/nitrogen/generated/ios/swift/QuantitySampleForSaving.swift +2 -1
- package/nitrogen/generated/ios/swift/QueryOptionsWithAnchor.swift +4 -2
- package/nitrogen/generated/ios/swift/QueryOptionsWithAnchorAndUnit.swift +6 -3
- package/nitrogen/generated/ios/swift/QueryOptionsWithSortOrder.swift +2 -1
- package/nitrogen/generated/ios/swift/QueryOptionsWithSortOrderAndUnit.swift +4 -2
- package/nitrogen/generated/ios/swift/QueryStatisticsResponse.swift +18 -9
- package/nitrogen/generated/ios/swift/QueryWorkoutSamplesWithAnchorResponse.swift +7 -7
- package/nitrogen/generated/ios/swift/SampleForSaving.swift +2 -0
- package/nitrogen/generated/ios/swift/SourceRevision.swift +13 -9
- package/nitrogen/generated/ios/swift/StateOfMindSample.swift +6 -3
- package/nitrogen/generated/ios/swift/StatisticsQueryOptions.swift +4 -2
- package/nitrogen/generated/ios/swift/Variant_PredicateWithUUID_PredicateWithUUIDs_PredicateWithMetadataKey_PredicateWithStartAndEnd_PredicateFromWorkout_FilterForSamplesAnd_FilterForSamplesOr.swift +2 -0
- package/nitrogen/generated/ios/swift/Variant_PredicateWithUUID_PredicateWithUUIDs_PredicateWithMetadataKey_PredicateWithStartAndEnd_PredicateFromWorkout_WorkoutActivityTypePredicate_WorkoutDurationPredicate_PredicateForWorkoutsOr_PredicateForWorkoutsAnd.swift +2 -0
- package/nitrogen/generated/ios/swift/Variant_String_Double_Bool_Date.swift +2 -0
- package/nitrogen/generated/ios/swift/WorkoutQueryOptions.swift +4 -61
- package/nitrogen/generated/ios/swift/WorkoutQueryOptionsWithAnchor.swift +6 -62
- package/nitrogen/generated/ios/swift/WorkoutRoute.swift +2 -1
- package/nitrogen/generated/ios/swift/WorkoutSample.swift +12 -123
- package/nitrogen/generated/shared/c++/AuthorizationRequestStatus.hpp +9 -11
- package/nitrogen/generated/shared/c++/AuthorizationStatus.hpp +9 -11
- package/nitrogen/generated/shared/c++/BiologicalSex.hpp +9 -11
- package/nitrogen/generated/shared/c++/BloodType.hpp +9 -11
- package/nitrogen/generated/shared/c++/CategorySample.hpp +14 -16
- package/nitrogen/generated/shared/c++/CategorySampleForSaving.hpp +11 -13
- package/nitrogen/generated/shared/c++/CategorySamplesWithAnchorResponse.hpp +11 -13
- package/nitrogen/generated/shared/c++/CategoryTypeIdentifier.hpp +131 -133
- package/nitrogen/generated/shared/c++/ComparisonPredicateOperator.hpp +26 -13
- package/nitrogen/generated/shared/c++/CorrelationSample.hpp +12 -14
- package/nitrogen/generated/shared/c++/CorrelationTypeIdentifier.hpp +7 -9
- package/nitrogen/generated/shared/c++/DeletedSample.hpp +5 -7
- package/nitrogen/generated/shared/c++/Device.hpp +5 -7
- package/nitrogen/generated/shared/c++/FilterForSamplesAnd.hpp +9 -11
- package/nitrogen/generated/shared/c++/FilterForSamplesOr.hpp +9 -11
- package/nitrogen/generated/shared/c++/FitzpatrickSkinType.hpp +9 -11
- package/nitrogen/generated/shared/c++/Heartbeat.hpp +4 -6
- package/nitrogen/generated/shared/c++/HeartbeatSeriesSample.hpp +15 -17
- package/nitrogen/generated/shared/c++/HeartbeatSeriesSamplesWithAnchorResponse.hpp +11 -13
- package/nitrogen/generated/shared/c++/HybridCategoryTypeModuleSpec.hpp +2 -2
- package/nitrogen/generated/shared/c++/HybridCharacteristicTypeModuleSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.hpp +4 -4
- package/nitrogen/generated/shared/c++/HybridCorrelationTypeModuleSpec.hpp +2 -2
- package/nitrogen/generated/shared/c++/HybridHeartbeatSeriesModuleSpec.hpp +3 -3
- package/nitrogen/generated/shared/c++/HybridQuantityTypeModuleSpec.hpp +3 -3
- package/nitrogen/generated/shared/c++/HybridStateOfMindModuleSpec.hpp +3 -3
- package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.cpp +6 -4
- package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.hpp +18 -9
- package/nitrogen/generated/shared/c++/HybridWorkoutsModuleSpec.hpp +4 -4
- package/nitrogen/generated/shared/c++/IdentifierWithUnit.hpp +4 -6
- package/nitrogen/generated/shared/c++/IntervalComponents.hpp +4 -6
- package/nitrogen/generated/shared/c++/LocationForSaving.hpp +4 -6
- package/nitrogen/generated/shared/c++/ObjectTypeIdentifier.hpp +397 -399
- package/nitrogen/generated/shared/c++/OnChangeCallbackArgs.hpp +8 -10
- package/nitrogen/generated/shared/c++/PredicateForWorkoutsAnd.hpp +9 -11
- package/nitrogen/generated/shared/c++/PredicateForWorkoutsOr.hpp +9 -11
- package/nitrogen/generated/shared/c++/PredicateFromWorkout.hpp +6 -8
- package/nitrogen/generated/shared/c++/PredicateWithMetadataKey.hpp +9 -11
- package/nitrogen/generated/shared/c++/PredicateWithMetadataOperator.hpp +11 -13
- package/nitrogen/generated/shared/c++/PredicateWithStartAndEnd.hpp +5 -7
- package/nitrogen/generated/shared/c++/PredicateWithUUID.hpp +4 -6
- package/nitrogen/generated/shared/c++/PredicateWithUUIDs.hpp +5 -7
- package/nitrogen/generated/shared/c++/Quantity.hpp +4 -6
- package/nitrogen/generated/shared/c++/QuantityDateInterval.hpp +4 -6
- package/nitrogen/generated/shared/c++/QuantitySample.hpp +14 -16
- package/nitrogen/generated/shared/c++/QuantitySampleForSaving.hpp +11 -13
- package/nitrogen/generated/shared/c++/QuantitySamplesWithAnchorResponse.hpp +11 -13
- package/nitrogen/generated/shared/c++/QuantityTypeIdentifier.hpp +241 -243
- package/nitrogen/generated/shared/c++/QueryOptionsWithAnchor.hpp +9 -11
- package/nitrogen/generated/shared/c++/QueryOptionsWithAnchorAndUnit.hpp +9 -11
- package/nitrogen/generated/shared/c++/QueryOptionsWithSortOrder.hpp +8 -10
- package/nitrogen/generated/shared/c++/QueryOptionsWithSortOrderAndUnit.hpp +9 -11
- package/nitrogen/generated/shared/c++/QueryStatisticsResponse.hpp +26 -28
- package/nitrogen/generated/shared/c++/QueryWorkoutSamplesWithAnchorResponse.hpp +10 -12
- package/nitrogen/generated/shared/c++/SampleTypeIdentifier.hpp +383 -385
- package/nitrogen/generated/shared/c++/SampleTypeIdentifierWriteable.hpp +373 -375
- package/nitrogen/generated/shared/c++/Source.hpp +4 -6
- package/nitrogen/generated/shared/c++/SourceRevision.hpp +7 -9
- package/nitrogen/generated/shared/c++/StateOfMindAssociation.hpp +10 -12
- package/nitrogen/generated/shared/c++/StateOfMindKind.hpp +14 -13
- package/nitrogen/generated/shared/c++/StateOfMindLabel.hpp +10 -12
- package/nitrogen/generated/shared/c++/StateOfMindSample.hpp +24 -26
- package/nitrogen/generated/shared/c++/StateOfMindValenceClassification.hpp +10 -12
- package/nitrogen/generated/shared/c++/StatisticsOptions.hpp +17 -19
- package/nitrogen/generated/shared/c++/StatisticsQueryOptions.hpp +9 -11
- package/nitrogen/generated/shared/c++/UpdateFrequency.hpp +10 -12
- package/nitrogen/generated/shared/c++/WheelchairUse.hpp +9 -11
- package/nitrogen/generated/shared/c++/WorkoutActivity.hpp +4 -6
- package/nitrogen/generated/shared/c++/WorkoutActivityType.hpp +96 -13
- package/nitrogen/generated/shared/c++/WorkoutActivityTypePredicate.hpp +7 -9
- package/nitrogen/generated/shared/c++/WorkoutConfiguration.hpp +11 -13
- package/nitrogen/generated/shared/c++/WorkoutDurationPredicate.hpp +7 -9
- package/nitrogen/generated/shared/c++/WorkoutEvent.hpp +7 -9
- package/nitrogen/generated/shared/c++/WorkoutEventType.hpp +10 -12
- package/nitrogen/generated/shared/c++/WorkoutPlan.hpp +7 -9
- package/nitrogen/generated/shared/c++/WorkoutQueryOptions.hpp +10 -21
- package/nitrogen/generated/shared/c++/WorkoutQueryOptionsWithAnchor.hpp +11 -21
- package/nitrogen/generated/shared/c++/WorkoutRoute.hpp +9 -11
- package/nitrogen/generated/shared/c++/WorkoutRouteLocation.hpp +4 -6
- package/nitrogen/generated/shared/c++/WorkoutSample.hpp +25 -43
- package/nitrogen/generated/shared/c++/WorkoutSessionLocationType.hpp +10 -12
- package/nitrogen/generated/shared/c++/WorkoutTotals.hpp +4 -6
- package/package.json +11 -11
- package/src/hooks/useMostRecentWorkout.ts +3 -17
- package/src/hooks/useWorkoutById.ts +1 -4
- package/src/specs/WorkoutProxy.nitro.ts +18 -1
- package/src/types/Workouts.ts +0 -8
- package/src/utils/getMostRecentWorkout.ts +1 -6
- package/src/utils/getWorkoutById.ts +1 -6
|
@@ -29,13 +29,13 @@ namespace margelo::nitro::healthkit { struct PredicateWithStartAndEnd; }
|
|
|
29
29
|
// Forward declaration of `PredicateFromWorkout` to properly resolve imports.
|
|
30
30
|
namespace margelo::nitro::healthkit { struct PredicateFromWorkout; }
|
|
31
31
|
|
|
32
|
-
#include <vector>
|
|
33
|
-
#include <variant>
|
|
34
32
|
#include "PredicateWithUUID.hpp"
|
|
35
33
|
#include "PredicateWithUUIDs.hpp"
|
|
36
34
|
#include "PredicateWithMetadataKey.hpp"
|
|
37
35
|
#include "PredicateWithStartAndEnd.hpp"
|
|
38
36
|
#include "PredicateFromWorkout.hpp"
|
|
37
|
+
#include <variant>
|
|
38
|
+
#include <vector>
|
|
39
39
|
|
|
40
40
|
namespace margelo::nitro::healthkit {
|
|
41
41
|
|
|
@@ -55,20 +55,18 @@ namespace margelo::nitro::healthkit {
|
|
|
55
55
|
|
|
56
56
|
namespace margelo::nitro {
|
|
57
57
|
|
|
58
|
-
using namespace margelo::nitro::healthkit;
|
|
59
|
-
|
|
60
58
|
// C++ FilterForSamplesAnd <> JS FilterForSamplesAnd (object)
|
|
61
59
|
template <>
|
|
62
|
-
struct JSIConverter<FilterForSamplesAnd> final {
|
|
63
|
-
static inline FilterForSamplesAnd fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
60
|
+
struct JSIConverter<margelo::nitro::healthkit::FilterForSamplesAnd> final {
|
|
61
|
+
static inline margelo::nitro::healthkit::FilterForSamplesAnd fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
64
62
|
jsi::Object obj = arg.asObject(runtime);
|
|
65
|
-
return FilterForSamplesAnd(
|
|
66
|
-
JSIConverter<std::vector<std::variant<PredicateWithUUID, PredicateWithUUIDs, PredicateWithMetadataKey, PredicateWithStartAndEnd, PredicateFromWorkout>>>::fromJSI(runtime, obj.getProperty(runtime, "AND"))
|
|
63
|
+
return margelo::nitro::healthkit::FilterForSamplesAnd(
|
|
64
|
+
JSIConverter<std::vector<std::variant<margelo::nitro::healthkit::PredicateWithUUID, margelo::nitro::healthkit::PredicateWithUUIDs, margelo::nitro::healthkit::PredicateWithMetadataKey, margelo::nitro::healthkit::PredicateWithStartAndEnd, margelo::nitro::healthkit::PredicateFromWorkout>>>::fromJSI(runtime, obj.getProperty(runtime, "AND"))
|
|
67
65
|
);
|
|
68
66
|
}
|
|
69
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const FilterForSamplesAnd& arg) {
|
|
67
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::FilterForSamplesAnd& arg) {
|
|
70
68
|
jsi::Object obj(runtime);
|
|
71
|
-
obj.setProperty(runtime, "AND", JSIConverter<std::vector<std::variant<PredicateWithUUID, PredicateWithUUIDs, PredicateWithMetadataKey, PredicateWithStartAndEnd, PredicateFromWorkout>>>::toJSI(runtime, arg.AND));
|
|
69
|
+
obj.setProperty(runtime, "AND", JSIConverter<std::vector<std::variant<margelo::nitro::healthkit::PredicateWithUUID, margelo::nitro::healthkit::PredicateWithUUIDs, margelo::nitro::healthkit::PredicateWithMetadataKey, margelo::nitro::healthkit::PredicateWithStartAndEnd, margelo::nitro::healthkit::PredicateFromWorkout>>>::toJSI(runtime, arg.AND));
|
|
72
70
|
return obj;
|
|
73
71
|
}
|
|
74
72
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -76,7 +74,7 @@ namespace margelo::nitro {
|
|
|
76
74
|
return false;
|
|
77
75
|
}
|
|
78
76
|
jsi::Object obj = value.getObject(runtime);
|
|
79
|
-
if (!JSIConverter<std::vector<std::variant<PredicateWithUUID, PredicateWithUUIDs, PredicateWithMetadataKey, PredicateWithStartAndEnd, PredicateFromWorkout>>>::canConvert(runtime, obj.getProperty(runtime, "AND"))) return false;
|
|
77
|
+
if (!JSIConverter<std::vector<std::variant<margelo::nitro::healthkit::PredicateWithUUID, margelo::nitro::healthkit::PredicateWithUUIDs, margelo::nitro::healthkit::PredicateWithMetadataKey, margelo::nitro::healthkit::PredicateWithStartAndEnd, margelo::nitro::healthkit::PredicateFromWorkout>>>::canConvert(runtime, obj.getProperty(runtime, "AND"))) return false;
|
|
80
78
|
return true;
|
|
81
79
|
}
|
|
82
80
|
};
|
|
@@ -29,13 +29,13 @@ namespace margelo::nitro::healthkit { struct PredicateWithStartAndEnd; }
|
|
|
29
29
|
// Forward declaration of `PredicateFromWorkout` to properly resolve imports.
|
|
30
30
|
namespace margelo::nitro::healthkit { struct PredicateFromWorkout; }
|
|
31
31
|
|
|
32
|
-
#include <vector>
|
|
33
|
-
#include <variant>
|
|
34
32
|
#include "PredicateWithUUID.hpp"
|
|
35
33
|
#include "PredicateWithUUIDs.hpp"
|
|
36
34
|
#include "PredicateWithMetadataKey.hpp"
|
|
37
35
|
#include "PredicateWithStartAndEnd.hpp"
|
|
38
36
|
#include "PredicateFromWorkout.hpp"
|
|
37
|
+
#include <variant>
|
|
38
|
+
#include <vector>
|
|
39
39
|
|
|
40
40
|
namespace margelo::nitro::healthkit {
|
|
41
41
|
|
|
@@ -55,20 +55,18 @@ namespace margelo::nitro::healthkit {
|
|
|
55
55
|
|
|
56
56
|
namespace margelo::nitro {
|
|
57
57
|
|
|
58
|
-
using namespace margelo::nitro::healthkit;
|
|
59
|
-
|
|
60
58
|
// C++ FilterForSamplesOr <> JS FilterForSamplesOr (object)
|
|
61
59
|
template <>
|
|
62
|
-
struct JSIConverter<FilterForSamplesOr> final {
|
|
63
|
-
static inline FilterForSamplesOr fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
60
|
+
struct JSIConverter<margelo::nitro::healthkit::FilterForSamplesOr> final {
|
|
61
|
+
static inline margelo::nitro::healthkit::FilterForSamplesOr fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
64
62
|
jsi::Object obj = arg.asObject(runtime);
|
|
65
|
-
return FilterForSamplesOr(
|
|
66
|
-
JSIConverter<std::vector<std::variant<PredicateWithUUID, PredicateWithUUIDs, PredicateWithMetadataKey, PredicateWithStartAndEnd, PredicateFromWorkout>>>::fromJSI(runtime, obj.getProperty(runtime, "OR"))
|
|
63
|
+
return margelo::nitro::healthkit::FilterForSamplesOr(
|
|
64
|
+
JSIConverter<std::vector<std::variant<margelo::nitro::healthkit::PredicateWithUUID, margelo::nitro::healthkit::PredicateWithUUIDs, margelo::nitro::healthkit::PredicateWithMetadataKey, margelo::nitro::healthkit::PredicateWithStartAndEnd, margelo::nitro::healthkit::PredicateFromWorkout>>>::fromJSI(runtime, obj.getProperty(runtime, "OR"))
|
|
67
65
|
);
|
|
68
66
|
}
|
|
69
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const FilterForSamplesOr& arg) {
|
|
67
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::FilterForSamplesOr& arg) {
|
|
70
68
|
jsi::Object obj(runtime);
|
|
71
|
-
obj.setProperty(runtime, "OR", JSIConverter<std::vector<std::variant<PredicateWithUUID, PredicateWithUUIDs, PredicateWithMetadataKey, PredicateWithStartAndEnd, PredicateFromWorkout>>>::toJSI(runtime, arg.OR));
|
|
69
|
+
obj.setProperty(runtime, "OR", JSIConverter<std::vector<std::variant<margelo::nitro::healthkit::PredicateWithUUID, margelo::nitro::healthkit::PredicateWithUUIDs, margelo::nitro::healthkit::PredicateWithMetadataKey, margelo::nitro::healthkit::PredicateWithStartAndEnd, margelo::nitro::healthkit::PredicateFromWorkout>>>::toJSI(runtime, arg.OR));
|
|
72
70
|
return obj;
|
|
73
71
|
}
|
|
74
72
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -76,7 +74,7 @@ namespace margelo::nitro {
|
|
|
76
74
|
return false;
|
|
77
75
|
}
|
|
78
76
|
jsi::Object obj = value.getObject(runtime);
|
|
79
|
-
if (!JSIConverter<std::vector<std::variant<PredicateWithUUID, PredicateWithUUIDs, PredicateWithMetadataKey, PredicateWithStartAndEnd, PredicateFromWorkout>>>::canConvert(runtime, obj.getProperty(runtime, "OR"))) return false;
|
|
77
|
+
if (!JSIConverter<std::vector<std::variant<margelo::nitro::healthkit::PredicateWithUUID, margelo::nitro::healthkit::PredicateWithUUIDs, margelo::nitro::healthkit::PredicateWithMetadataKey, margelo::nitro::healthkit::PredicateWithStartAndEnd, margelo::nitro::healthkit::PredicateFromWorkout>>>::canConvert(runtime, obj.getProperty(runtime, "OR"))) return false;
|
|
80
78
|
return true;
|
|
81
79
|
}
|
|
82
80
|
};
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
|
-
#include <cmath>
|
|
11
10
|
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
12
11
|
#include <NitroModules/JSIConverter.hpp>
|
|
13
12
|
#else
|
|
@@ -38,16 +37,14 @@ namespace margelo::nitro::healthkit {
|
|
|
38
37
|
|
|
39
38
|
namespace margelo::nitro {
|
|
40
39
|
|
|
41
|
-
using namespace margelo::nitro::healthkit;
|
|
42
|
-
|
|
43
40
|
// C++ FitzpatrickSkinType <> JS FitzpatrickSkinType (enum)
|
|
44
41
|
template <>
|
|
45
|
-
struct JSIConverter<FitzpatrickSkinType> final {
|
|
46
|
-
static inline FitzpatrickSkinType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
42
|
+
struct JSIConverter<margelo::nitro::healthkit::FitzpatrickSkinType> final {
|
|
43
|
+
static inline margelo::nitro::healthkit::FitzpatrickSkinType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
47
44
|
int enumValue = JSIConverter<int>::fromJSI(runtime, arg);
|
|
48
|
-
return static_cast<FitzpatrickSkinType>(enumValue);
|
|
45
|
+
return static_cast<margelo::nitro::healthkit::FitzpatrickSkinType>(enumValue);
|
|
49
46
|
}
|
|
50
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, FitzpatrickSkinType arg) {
|
|
47
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::healthkit::FitzpatrickSkinType arg) {
|
|
51
48
|
int enumValue = static_cast<int>(arg);
|
|
52
49
|
return JSIConverter<int>::toJSI(runtime, enumValue);
|
|
53
50
|
}
|
|
@@ -55,10 +52,11 @@ namespace margelo::nitro {
|
|
|
55
52
|
if (!value.isNumber()) {
|
|
56
53
|
return false;
|
|
57
54
|
}
|
|
58
|
-
double
|
|
59
|
-
|
|
60
|
-
if (
|
|
61
|
-
//
|
|
55
|
+
double number = value.getNumber();
|
|
56
|
+
int integer = static_cast<int>(number);
|
|
57
|
+
if (number != integer) {
|
|
58
|
+
// The integer is not the same value as the double - we truncated floating points.
|
|
59
|
+
// Enums are all integers, so the input floating point number is obviously invalid.
|
|
62
60
|
return false;
|
|
63
61
|
}
|
|
64
62
|
// Check if we are within the bounds of the enum.
|
|
@@ -41,19 +41,17 @@ namespace margelo::nitro::healthkit {
|
|
|
41
41
|
|
|
42
42
|
namespace margelo::nitro {
|
|
43
43
|
|
|
44
|
-
using namespace margelo::nitro::healthkit;
|
|
45
|
-
|
|
46
44
|
// C++ Heartbeat <> JS Heartbeat (object)
|
|
47
45
|
template <>
|
|
48
|
-
struct JSIConverter<Heartbeat> final {
|
|
49
|
-
static inline Heartbeat fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
46
|
+
struct JSIConverter<margelo::nitro::healthkit::Heartbeat> final {
|
|
47
|
+
static inline margelo::nitro::healthkit::Heartbeat fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
50
48
|
jsi::Object obj = arg.asObject(runtime);
|
|
51
|
-
return Heartbeat(
|
|
49
|
+
return margelo::nitro::healthkit::Heartbeat(
|
|
52
50
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "timeSinceSeriesStart")),
|
|
53
51
|
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "precededByGap"))
|
|
54
52
|
);
|
|
55
53
|
}
|
|
56
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const Heartbeat& arg) {
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::Heartbeat& arg) {
|
|
57
55
|
jsi::Object obj(runtime);
|
|
58
56
|
obj.setProperty(runtime, "timeSinceSeriesStart", JSIConverter<double>::toJSI(runtime, arg.timeSinceSeriesStart));
|
|
59
57
|
obj.setProperty(runtime, "precededByGap", JSIConverter<bool>::toJSI(runtime, arg.precededByGap));
|
|
@@ -28,11 +28,11 @@ namespace NitroModules { class AnyMap; }
|
|
|
28
28
|
namespace margelo::nitro::healthkit { struct SourceRevision; }
|
|
29
29
|
|
|
30
30
|
#include <string>
|
|
31
|
-
#include <optional>
|
|
32
31
|
#include "Device.hpp"
|
|
32
|
+
#include <optional>
|
|
33
33
|
#include <chrono>
|
|
34
|
-
#include <vector>
|
|
35
34
|
#include "Heartbeat.hpp"
|
|
35
|
+
#include <vector>
|
|
36
36
|
#include <NitroModules/AnyMap.hpp>
|
|
37
37
|
#include "SourceRevision.hpp"
|
|
38
38
|
|
|
@@ -60,32 +60,30 @@ namespace margelo::nitro::healthkit {
|
|
|
60
60
|
|
|
61
61
|
namespace margelo::nitro {
|
|
62
62
|
|
|
63
|
-
using namespace margelo::nitro::healthkit;
|
|
64
|
-
|
|
65
63
|
// C++ HeartbeatSeriesSample <> JS HeartbeatSeriesSample (object)
|
|
66
64
|
template <>
|
|
67
|
-
struct JSIConverter<HeartbeatSeriesSample> final {
|
|
68
|
-
static inline HeartbeatSeriesSample fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
65
|
+
struct JSIConverter<margelo::nitro::healthkit::HeartbeatSeriesSample> final {
|
|
66
|
+
static inline margelo::nitro::healthkit::HeartbeatSeriesSample fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
69
67
|
jsi::Object obj = arg.asObject(runtime);
|
|
70
|
-
return HeartbeatSeriesSample(
|
|
68
|
+
return margelo::nitro::healthkit::HeartbeatSeriesSample(
|
|
71
69
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "uuid")),
|
|
72
|
-
JSIConverter<std::optional<Device>>::fromJSI(runtime, obj.getProperty(runtime, "device")),
|
|
70
|
+
JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::fromJSI(runtime, obj.getProperty(runtime, "device")),
|
|
73
71
|
JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, "startDate")),
|
|
74
72
|
JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, "endDate")),
|
|
75
|
-
JSIConverter<std::vector<Heartbeat>>::fromJSI(runtime, obj.getProperty(runtime, "heartbeats")),
|
|
73
|
+
JSIConverter<std::vector<margelo::nitro::healthkit::Heartbeat>>::fromJSI(runtime, obj.getProperty(runtime, "heartbeats")),
|
|
76
74
|
JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::fromJSI(runtime, obj.getProperty(runtime, "metadata")),
|
|
77
|
-
JSIConverter<std::optional<SourceRevision>>::fromJSI(runtime, obj.getProperty(runtime, "sourceRevision"))
|
|
75
|
+
JSIConverter<std::optional<margelo::nitro::healthkit::SourceRevision>>::fromJSI(runtime, obj.getProperty(runtime, "sourceRevision"))
|
|
78
76
|
);
|
|
79
77
|
}
|
|
80
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const HeartbeatSeriesSample& arg) {
|
|
78
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::HeartbeatSeriesSample& arg) {
|
|
81
79
|
jsi::Object obj(runtime);
|
|
82
80
|
obj.setProperty(runtime, "uuid", JSIConverter<std::string>::toJSI(runtime, arg.uuid));
|
|
83
|
-
obj.setProperty(runtime, "device", JSIConverter<std::optional<Device>>::toJSI(runtime, arg.device));
|
|
81
|
+
obj.setProperty(runtime, "device", JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::toJSI(runtime, arg.device));
|
|
84
82
|
obj.setProperty(runtime, "startDate", JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.startDate));
|
|
85
83
|
obj.setProperty(runtime, "endDate", JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.endDate));
|
|
86
|
-
obj.setProperty(runtime, "heartbeats", JSIConverter<std::vector<Heartbeat>>::toJSI(runtime, arg.heartbeats));
|
|
84
|
+
obj.setProperty(runtime, "heartbeats", JSIConverter<std::vector<margelo::nitro::healthkit::Heartbeat>>::toJSI(runtime, arg.heartbeats));
|
|
87
85
|
obj.setProperty(runtime, "metadata", JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::toJSI(runtime, arg.metadata));
|
|
88
|
-
obj.setProperty(runtime, "sourceRevision", JSIConverter<std::optional<SourceRevision>>::toJSI(runtime, arg.sourceRevision));
|
|
86
|
+
obj.setProperty(runtime, "sourceRevision", JSIConverter<std::optional<margelo::nitro::healthkit::SourceRevision>>::toJSI(runtime, arg.sourceRevision));
|
|
89
87
|
return obj;
|
|
90
88
|
}
|
|
91
89
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -94,12 +92,12 @@ namespace margelo::nitro {
|
|
|
94
92
|
}
|
|
95
93
|
jsi::Object obj = value.getObject(runtime);
|
|
96
94
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "uuid"))) return false;
|
|
97
|
-
if (!JSIConverter<std::optional<Device>>::canConvert(runtime, obj.getProperty(runtime, "device"))) return false;
|
|
95
|
+
if (!JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::canConvert(runtime, obj.getProperty(runtime, "device"))) return false;
|
|
98
96
|
if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, "startDate"))) return false;
|
|
99
97
|
if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, "endDate"))) return false;
|
|
100
|
-
if (!JSIConverter<std::vector<Heartbeat>>::canConvert(runtime, obj.getProperty(runtime, "heartbeats"))) return false;
|
|
98
|
+
if (!JSIConverter<std::vector<margelo::nitro::healthkit::Heartbeat>>::canConvert(runtime, obj.getProperty(runtime, "heartbeats"))) return false;
|
|
101
99
|
if (!JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::canConvert(runtime, obj.getProperty(runtime, "metadata"))) return false;
|
|
102
|
-
if (!JSIConverter<std::optional<SourceRevision>>::canConvert(runtime, obj.getProperty(runtime, "sourceRevision"))) return false;
|
|
100
|
+
if (!JSIConverter<std::optional<margelo::nitro::healthkit::SourceRevision>>::canConvert(runtime, obj.getProperty(runtime, "sourceRevision"))) return false;
|
|
103
101
|
return true;
|
|
104
102
|
}
|
|
105
103
|
};
|
|
@@ -23,8 +23,8 @@ namespace margelo::nitro::healthkit { struct HeartbeatSeriesSample; }
|
|
|
23
23
|
// Forward declaration of `DeletedSample` to properly resolve imports.
|
|
24
24
|
namespace margelo::nitro::healthkit { struct DeletedSample; }
|
|
25
25
|
|
|
26
|
-
#include <vector>
|
|
27
26
|
#include "HeartbeatSeriesSample.hpp"
|
|
27
|
+
#include <vector>
|
|
28
28
|
#include "DeletedSample.hpp"
|
|
29
29
|
#include <string>
|
|
30
30
|
|
|
@@ -48,23 +48,21 @@ namespace margelo::nitro::healthkit {
|
|
|
48
48
|
|
|
49
49
|
namespace margelo::nitro {
|
|
50
50
|
|
|
51
|
-
using namespace margelo::nitro::healthkit;
|
|
52
|
-
|
|
53
51
|
// C++ HeartbeatSeriesSamplesWithAnchorResponse <> JS HeartbeatSeriesSamplesWithAnchorResponse (object)
|
|
54
52
|
template <>
|
|
55
|
-
struct JSIConverter<HeartbeatSeriesSamplesWithAnchorResponse> final {
|
|
56
|
-
static inline HeartbeatSeriesSamplesWithAnchorResponse fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
53
|
+
struct JSIConverter<margelo::nitro::healthkit::HeartbeatSeriesSamplesWithAnchorResponse> final {
|
|
54
|
+
static inline margelo::nitro::healthkit::HeartbeatSeriesSamplesWithAnchorResponse fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
57
55
|
jsi::Object obj = arg.asObject(runtime);
|
|
58
|
-
return HeartbeatSeriesSamplesWithAnchorResponse(
|
|
59
|
-
JSIConverter<std::vector<HeartbeatSeriesSample>>::fromJSI(runtime, obj.getProperty(runtime, "samples")),
|
|
60
|
-
JSIConverter<std::vector<DeletedSample>>::fromJSI(runtime, obj.getProperty(runtime, "deletedSamples")),
|
|
56
|
+
return margelo::nitro::healthkit::HeartbeatSeriesSamplesWithAnchorResponse(
|
|
57
|
+
JSIConverter<std::vector<margelo::nitro::healthkit::HeartbeatSeriesSample>>::fromJSI(runtime, obj.getProperty(runtime, "samples")),
|
|
58
|
+
JSIConverter<std::vector<margelo::nitro::healthkit::DeletedSample>>::fromJSI(runtime, obj.getProperty(runtime, "deletedSamples")),
|
|
61
59
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "newAnchor"))
|
|
62
60
|
);
|
|
63
61
|
}
|
|
64
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const HeartbeatSeriesSamplesWithAnchorResponse& arg) {
|
|
62
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::HeartbeatSeriesSamplesWithAnchorResponse& arg) {
|
|
65
63
|
jsi::Object obj(runtime);
|
|
66
|
-
obj.setProperty(runtime, "samples", JSIConverter<std::vector<HeartbeatSeriesSample>>::toJSI(runtime, arg.samples));
|
|
67
|
-
obj.setProperty(runtime, "deletedSamples", JSIConverter<std::vector<DeletedSample>>::toJSI(runtime, arg.deletedSamples));
|
|
64
|
+
obj.setProperty(runtime, "samples", JSIConverter<std::vector<margelo::nitro::healthkit::HeartbeatSeriesSample>>::toJSI(runtime, arg.samples));
|
|
65
|
+
obj.setProperty(runtime, "deletedSamples", JSIConverter<std::vector<margelo::nitro::healthkit::DeletedSample>>::toJSI(runtime, arg.deletedSamples));
|
|
68
66
|
obj.setProperty(runtime, "newAnchor", JSIConverter<std::string>::toJSI(runtime, arg.newAnchor));
|
|
69
67
|
return obj;
|
|
70
68
|
}
|
|
@@ -73,8 +71,8 @@ namespace margelo::nitro {
|
|
|
73
71
|
return false;
|
|
74
72
|
}
|
|
75
73
|
jsi::Object obj = value.getObject(runtime);
|
|
76
|
-
if (!JSIConverter<std::vector<HeartbeatSeriesSample>>::canConvert(runtime, obj.getProperty(runtime, "samples"))) return false;
|
|
77
|
-
if (!JSIConverter<std::vector<DeletedSample>>::canConvert(runtime, obj.getProperty(runtime, "deletedSamples"))) return false;
|
|
74
|
+
if (!JSIConverter<std::vector<margelo::nitro::healthkit::HeartbeatSeriesSample>>::canConvert(runtime, obj.getProperty(runtime, "samples"))) return false;
|
|
75
|
+
if (!JSIConverter<std::vector<margelo::nitro::healthkit::DeletedSample>>::canConvert(runtime, obj.getProperty(runtime, "deletedSamples"))) return false;
|
|
78
76
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "newAnchor"))) return false;
|
|
79
77
|
return true;
|
|
80
78
|
}
|
|
@@ -30,10 +30,10 @@ namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchor; }
|
|
|
30
30
|
#include "CategoryTypeIdentifier.hpp"
|
|
31
31
|
#include <chrono>
|
|
32
32
|
#include <NitroModules/AnyMap.hpp>
|
|
33
|
-
#include <vector>
|
|
34
33
|
#include "CategorySample.hpp"
|
|
35
|
-
#include <
|
|
34
|
+
#include <vector>
|
|
36
35
|
#include "QueryOptionsWithSortOrder.hpp"
|
|
36
|
+
#include <optional>
|
|
37
37
|
#include "CategorySamplesWithAnchorResponse.hpp"
|
|
38
38
|
#include "QueryOptionsWithAnchor.hpp"
|
|
39
39
|
|
|
@@ -23,8 +23,8 @@ namespace margelo::nitro::healthkit { enum class FitzpatrickSkinType; }
|
|
|
23
23
|
namespace margelo::nitro::healthkit { enum class WheelchairUse; }
|
|
24
24
|
|
|
25
25
|
#include "BloodType.hpp"
|
|
26
|
-
#include <optional>
|
|
27
26
|
#include <chrono>
|
|
27
|
+
#include <optional>
|
|
28
28
|
#include "BiologicalSex.hpp"
|
|
29
29
|
#include "FitzpatrickSkinType.hpp"
|
|
30
30
|
#include "WheelchairUse.hpp"
|
|
@@ -51,20 +51,19 @@ namespace margelo::nitro::healthkit { struct FilterForSamplesOr; }
|
|
|
51
51
|
#include <NitroModules/Promise.hpp>
|
|
52
52
|
#include "ObjectTypeIdentifier.hpp"
|
|
53
53
|
#include "UpdateFrequency.hpp"
|
|
54
|
-
#include <vector>
|
|
55
54
|
#include "IdentifierWithUnit.hpp"
|
|
55
|
+
#include <vector>
|
|
56
56
|
#include "QuantityTypeIdentifier.hpp"
|
|
57
57
|
#include <optional>
|
|
58
58
|
#include <memory>
|
|
59
59
|
#include "HybridSourceProxySpec.hpp"
|
|
60
60
|
#include "SampleTypeIdentifier.hpp"
|
|
61
61
|
#include <string>
|
|
62
|
-
#include <functional>
|
|
63
62
|
#include "OnChangeCallbackArgs.hpp"
|
|
63
|
+
#include <functional>
|
|
64
64
|
#include "AuthorizationStatus.hpp"
|
|
65
65
|
#include "AuthorizationRequestStatus.hpp"
|
|
66
66
|
#include "SampleTypeIdentifierWriteable.hpp"
|
|
67
|
-
#include <variant>
|
|
68
67
|
#include "PredicateWithUUID.hpp"
|
|
69
68
|
#include "PredicateWithUUIDs.hpp"
|
|
70
69
|
#include "PredicateWithMetadataKey.hpp"
|
|
@@ -72,6 +71,7 @@ namespace margelo::nitro::healthkit { struct FilterForSamplesOr; }
|
|
|
72
71
|
#include "PredicateFromWorkout.hpp"
|
|
73
72
|
#include "FilterForSamplesAnd.hpp"
|
|
74
73
|
#include "FilterForSamplesOr.hpp"
|
|
74
|
+
#include <variant>
|
|
75
75
|
#include <unordered_map>
|
|
76
76
|
|
|
77
77
|
namespace margelo::nitro::healthkit {
|
|
@@ -113,7 +113,7 @@ namespace margelo::nitro::healthkit {
|
|
|
113
113
|
virtual bool isProtectedDataAvailable() = 0;
|
|
114
114
|
virtual std::shared_ptr<Promise<bool>> isProtectedDataAvailableAsync() = 0;
|
|
115
115
|
virtual std::shared_ptr<Promise<std::vector<IdentifierWithUnit>>> getPreferredUnits(const std::vector<QuantityTypeIdentifier>& identifiers, std::optional<bool> forceUpdate) = 0;
|
|
116
|
-
virtual std::shared_ptr<Promise<std::vector<std::shared_ptr<
|
|
116
|
+
virtual std::shared_ptr<Promise<std::vector<std::shared_ptr<HybridSourceProxySpec>>>> querySources(SampleTypeIdentifier identifier) = 0;
|
|
117
117
|
virtual std::string subscribeToObserverQuery(SampleTypeIdentifier typeIdentifier, const std::function<void(const OnChangeCallbackArgs& /* args */)>& callback) = 0;
|
|
118
118
|
virtual bool unsubscribeQuery(const std::string& queryId) = 0;
|
|
119
119
|
virtual std::shared_ptr<Promise<bool>> unsubscribeQueryAsync(const std::string& queryId) = 0;
|
|
@@ -26,10 +26,10 @@ namespace margelo::nitro::healthkit { struct CorrelationSample; }
|
|
|
26
26
|
|
|
27
27
|
#include <NitroModules/Promise.hpp>
|
|
28
28
|
#include "CorrelationTypeIdentifier.hpp"
|
|
29
|
-
#include <vector>
|
|
30
|
-
#include <variant>
|
|
31
29
|
#include "CategorySampleForSaving.hpp"
|
|
32
30
|
#include "QuantitySampleForSaving.hpp"
|
|
31
|
+
#include <variant>
|
|
32
|
+
#include <vector>
|
|
33
33
|
#include <chrono>
|
|
34
34
|
#include <NitroModules/AnyMap.hpp>
|
|
35
35
|
#include "CorrelationSample.hpp"
|
|
@@ -22,11 +22,11 @@ namespace margelo::nitro::healthkit { struct HeartbeatSeriesSamplesWithAnchorRes
|
|
|
22
22
|
// Forward declaration of `QueryOptionsWithAnchor` to properly resolve imports.
|
|
23
23
|
namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchor; }
|
|
24
24
|
|
|
25
|
-
#include <NitroModules/Promise.hpp>
|
|
26
|
-
#include <vector>
|
|
27
25
|
#include "HeartbeatSeriesSample.hpp"
|
|
28
|
-
#include <
|
|
26
|
+
#include <vector>
|
|
27
|
+
#include <NitroModules/Promise.hpp>
|
|
29
28
|
#include "QueryOptionsWithSortOrder.hpp"
|
|
29
|
+
#include <optional>
|
|
30
30
|
#include "HeartbeatSeriesSamplesWithAnchorResponse.hpp"
|
|
31
31
|
#include "QueryOptionsWithAnchor.hpp"
|
|
32
32
|
|
|
@@ -53,7 +53,6 @@ namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchorAndUnit; }
|
|
|
53
53
|
#include <NitroModules/Promise.hpp>
|
|
54
54
|
#include <chrono>
|
|
55
55
|
#include <NitroModules/AnyMap.hpp>
|
|
56
|
-
#include <variant>
|
|
57
56
|
#include "PredicateWithUUID.hpp"
|
|
58
57
|
#include "PredicateWithUUIDs.hpp"
|
|
59
58
|
#include "PredicateWithMetadataKey.hpp"
|
|
@@ -61,10 +60,11 @@ namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchorAndUnit; }
|
|
|
61
60
|
#include "PredicateFromWorkout.hpp"
|
|
62
61
|
#include "FilterForSamplesAnd.hpp"
|
|
63
62
|
#include "FilterForSamplesOr.hpp"
|
|
64
|
-
#include <
|
|
63
|
+
#include <variant>
|
|
65
64
|
#include "QuantitySample.hpp"
|
|
66
|
-
#include <
|
|
65
|
+
#include <vector>
|
|
67
66
|
#include "QueryOptionsWithSortOrderAndUnit.hpp"
|
|
67
|
+
#include <optional>
|
|
68
68
|
#include "QueryStatisticsResponse.hpp"
|
|
69
69
|
#include "StatisticsOptions.hpp"
|
|
70
70
|
#include "StatisticsQueryOptions.hpp"
|
|
@@ -26,11 +26,11 @@ namespace margelo::nitro::healthkit { enum class StateOfMindAssociation; }
|
|
|
26
26
|
// Forward declaration of `AnyMap` to properly resolve imports.
|
|
27
27
|
namespace NitroModules { class AnyMap; }
|
|
28
28
|
|
|
29
|
-
#include <NitroModules/Promise.hpp>
|
|
30
|
-
#include <vector>
|
|
31
29
|
#include "StateOfMindSample.hpp"
|
|
32
|
-
#include <
|
|
30
|
+
#include <vector>
|
|
31
|
+
#include <NitroModules/Promise.hpp>
|
|
33
32
|
#include "QueryOptionsWithSortOrder.hpp"
|
|
33
|
+
#include <optional>
|
|
34
34
|
#include <chrono>
|
|
35
35
|
#include "StateOfMindKind.hpp"
|
|
36
36
|
#include "StateOfMindLabel.hpp"
|
|
@@ -14,14 +14,14 @@ namespace margelo::nitro::healthkit {
|
|
|
14
14
|
HybridObject::loadHybridMethods();
|
|
15
15
|
// load custom methods/properties
|
|
16
16
|
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
-
prototype.registerHybridGetter("uuid", &HybridWorkoutProxySpec::getUuid);
|
|
18
|
-
prototype.registerHybridGetter("device", &HybridWorkoutProxySpec::getDevice);
|
|
19
|
-
prototype.registerHybridGetter("workoutActivityType", &HybridWorkoutProxySpec::getWorkoutActivityType);
|
|
20
|
-
prototype.registerHybridGetter("duration", &HybridWorkoutProxySpec::getDuration);
|
|
21
17
|
prototype.registerHybridGetter("totalDistance", &HybridWorkoutProxySpec::getTotalDistance);
|
|
22
18
|
prototype.registerHybridGetter("totalEnergyBurned", &HybridWorkoutProxySpec::getTotalEnergyBurned);
|
|
23
19
|
prototype.registerHybridGetter("totalSwimmingStrokeCount", &HybridWorkoutProxySpec::getTotalSwimmingStrokeCount);
|
|
24
20
|
prototype.registerHybridGetter("totalFlightsClimbed", &HybridWorkoutProxySpec::getTotalFlightsClimbed);
|
|
21
|
+
prototype.registerHybridGetter("uuid", &HybridWorkoutProxySpec::getUuid);
|
|
22
|
+
prototype.registerHybridGetter("device", &HybridWorkoutProxySpec::getDevice);
|
|
23
|
+
prototype.registerHybridGetter("workoutActivityType", &HybridWorkoutProxySpec::getWorkoutActivityType);
|
|
24
|
+
prototype.registerHybridGetter("duration", &HybridWorkoutProxySpec::getDuration);
|
|
25
25
|
prototype.registerHybridGetter("startDate", &HybridWorkoutProxySpec::getStartDate);
|
|
26
26
|
prototype.registerHybridGetter("endDate", &HybridWorkoutProxySpec::getEndDate);
|
|
27
27
|
prototype.registerHybridGetter("metadata", &HybridWorkoutProxySpec::getMetadata);
|
|
@@ -32,6 +32,8 @@ namespace margelo::nitro::healthkit {
|
|
|
32
32
|
prototype.registerHybridMethod("saveWorkoutRoute", &HybridWorkoutProxySpec::saveWorkoutRoute);
|
|
33
33
|
prototype.registerHybridMethod("getWorkoutPlan", &HybridWorkoutProxySpec::getWorkoutPlan);
|
|
34
34
|
prototype.registerHybridMethod("getWorkoutRoutes", &HybridWorkoutProxySpec::getWorkoutRoutes);
|
|
35
|
+
prototype.registerHybridMethod("getStatistic", &HybridWorkoutProxySpec::getStatistic);
|
|
36
|
+
prototype.registerHybridMethod("getAllStatistics", &HybridWorkoutProxySpec::getAllStatistics);
|
|
35
37
|
});
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
14
|
#endif
|
|
15
15
|
|
|
16
|
+
// Forward declaration of `Quantity` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::healthkit { struct Quantity; }
|
|
16
18
|
// Forward declaration of `Device` to properly resolve imports.
|
|
17
19
|
namespace margelo::nitro::healthkit { struct Device; }
|
|
18
20
|
// Forward declaration of `WorkoutActivityType` to properly resolve imports.
|
|
19
21
|
namespace margelo::nitro::healthkit { enum class WorkoutActivityType; }
|
|
20
|
-
// Forward declaration of `Quantity` to properly resolve imports.
|
|
21
|
-
namespace margelo::nitro::healthkit { struct Quantity; }
|
|
22
22
|
// Forward declaration of `AnyMap` to properly resolve imports.
|
|
23
23
|
namespace NitroModules { class AnyMap; }
|
|
24
24
|
// Forward declaration of `SourceRevision` to properly resolve imports.
|
|
@@ -35,23 +35,30 @@ namespace margelo::nitro::healthkit { struct LocationForSaving; }
|
|
|
35
35
|
namespace margelo::nitro::healthkit { struct WorkoutPlan; }
|
|
36
36
|
// Forward declaration of `WorkoutRoute` to properly resolve imports.
|
|
37
37
|
namespace margelo::nitro::healthkit { struct WorkoutRoute; }
|
|
38
|
+
// Forward declaration of `QueryStatisticsResponse` to properly resolve imports.
|
|
39
|
+
namespace margelo::nitro::healthkit { struct QueryStatisticsResponse; }
|
|
40
|
+
// Forward declaration of `QuantityTypeIdentifier` to properly resolve imports.
|
|
41
|
+
namespace margelo::nitro::healthkit { enum class QuantityTypeIdentifier; }
|
|
38
42
|
|
|
39
|
-
#include
|
|
43
|
+
#include "Quantity.hpp"
|
|
40
44
|
#include <optional>
|
|
45
|
+
#include <string>
|
|
41
46
|
#include "Device.hpp"
|
|
42
47
|
#include "WorkoutActivityType.hpp"
|
|
43
|
-
#include "Quantity.hpp"
|
|
44
48
|
#include <chrono>
|
|
45
49
|
#include <NitroModules/AnyMap.hpp>
|
|
46
50
|
#include "SourceRevision.hpp"
|
|
47
|
-
#include <vector>
|
|
48
51
|
#include "WorkoutEvent.hpp"
|
|
52
|
+
#include <vector>
|
|
49
53
|
#include "WorkoutActivity.hpp"
|
|
50
54
|
#include "WorkoutSample.hpp"
|
|
51
55
|
#include <NitroModules/Promise.hpp>
|
|
52
56
|
#include "LocationForSaving.hpp"
|
|
53
57
|
#include "WorkoutPlan.hpp"
|
|
54
58
|
#include "WorkoutRoute.hpp"
|
|
59
|
+
#include "QueryStatisticsResponse.hpp"
|
|
60
|
+
#include "QuantityTypeIdentifier.hpp"
|
|
61
|
+
#include <unordered_map>
|
|
55
62
|
|
|
56
63
|
namespace margelo::nitro::healthkit {
|
|
57
64
|
|
|
@@ -80,14 +87,14 @@ namespace margelo::nitro::healthkit {
|
|
|
80
87
|
|
|
81
88
|
public:
|
|
82
89
|
// Properties
|
|
83
|
-
virtual std::string getUuid() = 0;
|
|
84
|
-
virtual std::optional<Device> getDevice() = 0;
|
|
85
|
-
virtual WorkoutActivityType getWorkoutActivityType() = 0;
|
|
86
|
-
virtual Quantity getDuration() = 0;
|
|
87
90
|
virtual std::optional<Quantity> getTotalDistance() = 0;
|
|
88
91
|
virtual std::optional<Quantity> getTotalEnergyBurned() = 0;
|
|
89
92
|
virtual std::optional<Quantity> getTotalSwimmingStrokeCount() = 0;
|
|
90
93
|
virtual std::optional<Quantity> getTotalFlightsClimbed() = 0;
|
|
94
|
+
virtual std::string getUuid() = 0;
|
|
95
|
+
virtual std::optional<Device> getDevice() = 0;
|
|
96
|
+
virtual WorkoutActivityType getWorkoutActivityType() = 0;
|
|
97
|
+
virtual Quantity getDuration() = 0;
|
|
91
98
|
virtual std::chrono::system_clock::time_point getStartDate() = 0;
|
|
92
99
|
virtual std::chrono::system_clock::time_point getEndDate() = 0;
|
|
93
100
|
virtual std::optional<std::shared_ptr<AnyMap>> getMetadata() = 0;
|
|
@@ -101,6 +108,8 @@ namespace margelo::nitro::healthkit {
|
|
|
101
108
|
virtual std::shared_ptr<Promise<bool>> saveWorkoutRoute(const std::vector<LocationForSaving>& locations) = 0;
|
|
102
109
|
virtual std::shared_ptr<Promise<std::optional<WorkoutPlan>>> getWorkoutPlan() = 0;
|
|
103
110
|
virtual std::shared_ptr<Promise<std::vector<WorkoutRoute>>> getWorkoutRoutes() = 0;
|
|
111
|
+
virtual std::shared_ptr<Promise<std::optional<QueryStatisticsResponse>>> getStatistic(QuantityTypeIdentifier quantityType, const std::optional<std::string>& unitOverride) = 0;
|
|
112
|
+
virtual std::shared_ptr<Promise<std::unordered_map<std::string, QueryStatisticsResponse>>> getAllStatistics() = 0;
|
|
104
113
|
|
|
105
114
|
protected:
|
|
106
115
|
// Hybrid Setup
|
|
@@ -32,12 +32,12 @@ namespace margelo::nitro::healthkit { struct WorkoutQueryOptions; }
|
|
|
32
32
|
// Forward declaration of `WorkoutConfiguration` to properly resolve imports.
|
|
33
33
|
namespace margelo::nitro::healthkit { struct WorkoutConfiguration; }
|
|
34
34
|
|
|
35
|
-
#include <NitroModules/Promise.hpp>
|
|
36
35
|
#include <memory>
|
|
37
36
|
#include "HybridWorkoutProxySpec.hpp"
|
|
37
|
+
#include <NitroModules/Promise.hpp>
|
|
38
38
|
#include "WorkoutActivityType.hpp"
|
|
39
|
-
#include <vector>
|
|
40
39
|
#include "QuantitySampleForSaving.hpp"
|
|
40
|
+
#include <vector>
|
|
41
41
|
#include <chrono>
|
|
42
42
|
#include "WorkoutTotals.hpp"
|
|
43
43
|
#include <NitroModules/AnyMap.hpp>
|
|
@@ -77,9 +77,9 @@ namespace margelo::nitro::healthkit {
|
|
|
77
77
|
|
|
78
78
|
public:
|
|
79
79
|
// Methods
|
|
80
|
-
virtual std::shared_ptr<Promise<std::shared_ptr<
|
|
80
|
+
virtual std::shared_ptr<Promise<std::shared_ptr<HybridWorkoutProxySpec>>> saveWorkoutSample(WorkoutActivityType workoutActivityType, const std::vector<QuantitySampleForSaving>& quantities, std::chrono::system_clock::time_point startDate, std::chrono::system_clock::time_point endDate, const WorkoutTotals& totals, const std::shared_ptr<AnyMap>& metadata) = 0;
|
|
81
81
|
virtual std::shared_ptr<Promise<QueryWorkoutSamplesWithAnchorResponse>> queryWorkoutSamplesWithAnchor(const WorkoutQueryOptionsWithAnchor& options) = 0;
|
|
82
|
-
virtual std::shared_ptr<Promise<std::vector<std::shared_ptr<
|
|
82
|
+
virtual std::shared_ptr<Promise<std::vector<std::shared_ptr<HybridWorkoutProxySpec>>>> queryWorkoutSamples(const WorkoutQueryOptions& options) = 0;
|
|
83
83
|
virtual std::shared_ptr<Promise<bool>> startWatchAppWithWorkoutConfiguration(const WorkoutConfiguration& workoutConfiguration) = 0;
|
|
84
84
|
|
|
85
85
|
protected:
|
|
@@ -41,19 +41,17 @@ namespace margelo::nitro::healthkit {
|
|
|
41
41
|
|
|
42
42
|
namespace margelo::nitro {
|
|
43
43
|
|
|
44
|
-
using namespace margelo::nitro::healthkit;
|
|
45
|
-
|
|
46
44
|
// C++ IdentifierWithUnit <> JS IdentifierWithUnit (object)
|
|
47
45
|
template <>
|
|
48
|
-
struct JSIConverter<IdentifierWithUnit> final {
|
|
49
|
-
static inline IdentifierWithUnit fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
46
|
+
struct JSIConverter<margelo::nitro::healthkit::IdentifierWithUnit> final {
|
|
47
|
+
static inline margelo::nitro::healthkit::IdentifierWithUnit fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
50
48
|
jsi::Object obj = arg.asObject(runtime);
|
|
51
|
-
return IdentifierWithUnit(
|
|
49
|
+
return margelo::nitro::healthkit::IdentifierWithUnit(
|
|
52
50
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "typeIdentifier")),
|
|
53
51
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "unit"))
|
|
54
52
|
);
|
|
55
53
|
}
|
|
56
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const IdentifierWithUnit& arg) {
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::IdentifierWithUnit& arg) {
|
|
57
55
|
jsi::Object obj(runtime);
|
|
58
56
|
obj.setProperty(runtime, "typeIdentifier", JSIConverter<std::string>::toJSI(runtime, arg.typeIdentifier));
|
|
59
57
|
obj.setProperty(runtime, "unit", JSIConverter<std::string>::toJSI(runtime, arg.unit));
|
|
@@ -44,14 +44,12 @@ namespace margelo::nitro::healthkit {
|
|
|
44
44
|
|
|
45
45
|
namespace margelo::nitro {
|
|
46
46
|
|
|
47
|
-
using namespace margelo::nitro::healthkit;
|
|
48
|
-
|
|
49
47
|
// C++ IntervalComponents <> JS IntervalComponents (object)
|
|
50
48
|
template <>
|
|
51
|
-
struct JSIConverter<IntervalComponents> final {
|
|
52
|
-
static inline IntervalComponents fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
49
|
+
struct JSIConverter<margelo::nitro::healthkit::IntervalComponents> final {
|
|
50
|
+
static inline margelo::nitro::healthkit::IntervalComponents fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
53
51
|
jsi::Object obj = arg.asObject(runtime);
|
|
54
|
-
return IntervalComponents(
|
|
52
|
+
return margelo::nitro::healthkit::IntervalComponents(
|
|
55
53
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "minute")),
|
|
56
54
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "hour")),
|
|
57
55
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "day")),
|
|
@@ -59,7 +57,7 @@ namespace margelo::nitro {
|
|
|
59
57
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "year"))
|
|
60
58
|
);
|
|
61
59
|
}
|
|
62
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const IntervalComponents& arg) {
|
|
60
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::IntervalComponents& arg) {
|
|
63
61
|
jsi::Object obj(runtime);
|
|
64
62
|
obj.setProperty(runtime, "minute", JSIConverter<std::optional<double>>::toJSI(runtime, arg.minute));
|
|
65
63
|
obj.setProperty(runtime, "hour", JSIConverter<std::optional<double>>::toJSI(runtime, arg.hour));
|