@kingstinct/react-native-healthkit 9.0.0 → 9.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +192 -0
- package/app.plugin.js +0 -1
- package/ios/Helpers.swift +33 -37
- package/ios/WorkoutProxy.swift +7 -0
- package/lib/commonjs/hooks/useCategorySampleById.js +36 -0
- package/lib/commonjs/hooks/useHealthkitAuthorization.js +34 -0
- package/lib/commonjs/hooks/useIsHealthDataAvailable.js +23 -0
- package/lib/commonjs/hooks/useMostRecentCategorySample.js +21 -0
- package/lib/commonjs/hooks/useMostRecentQuantitySample.js +22 -0
- package/lib/commonjs/hooks/useMostRecentWorkout.js +31 -0
- package/lib/commonjs/hooks/useQuantitySampleById.js +34 -0
- package/lib/commonjs/hooks/useSources.js +17 -0
- package/lib/commonjs/hooks/useStatisticsForQuantity.js +26 -0
- package/lib/commonjs/hooks/useSubscribeToChanges.js +20 -0
- package/lib/commonjs/hooks/useWorkoutById.js +46 -0
- package/lib/commonjs/index.ios.js +144 -0
- package/lib/commonjs/index.js +210 -0
- package/lib/commonjs/modules.js +12 -0
- package/lib/commonjs/specs/CategoryTypeModule.nitro.js +5 -0
- package/lib/commonjs/specs/CharacteristicTypeModule.nitro.js +2 -0
- package/lib/commonjs/specs/CoreModule.nitro.js +2 -0
- package/lib/commonjs/specs/CorrelationTypeModule.nitro.js +2 -0
- package/lib/commonjs/specs/HeartbeatSeriesModule.nitro.js +2 -0
- package/lib/commonjs/specs/QuantityTypeModule.nitro.js +2 -0
- package/lib/commonjs/specs/SourceProxy.nitro.js +2 -0
- package/lib/commonjs/specs/StateOfMindModule.nitro.js +2 -0
- package/lib/commonjs/specs/WorkoutProxy.nitro.js +2 -0
- package/lib/commonjs/specs/WorkoutSessionModule.nitro.js +19 -0
- package/lib/commonjs/specs/WorkoutsModule.nitro.js +2 -0
- package/lib/commonjs/types/Auth.js +21 -0
- package/lib/commonjs/types/Background.js +13 -0
- package/lib/commonjs/types/CategoryType.js +101 -0
- package/lib/commonjs/types/CategoryTypeIdentifier.js +2 -0
- package/lib/commonjs/types/Characteristics.js +48 -0
- package/lib/commonjs/types/Constants.js +23 -0
- package/lib/commonjs/types/CorrelationType.js +2 -0
- package/lib/commonjs/types/Device.js +2 -0
- package/lib/commonjs/types/HeartbeatSeries.js +2 -0
- package/lib/commonjs/types/InterfaceVerification.js +24 -0
- package/lib/commonjs/types/InterfaceVerificationExample.js +33 -0
- package/lib/commonjs/types/QuantitySample.js +2 -0
- package/lib/commonjs/types/QuantityType.js +17 -0
- package/lib/commonjs/types/QuantityTypeIdentifier.js +2 -0
- package/lib/commonjs/types/QueryOptions.js +2 -0
- package/lib/commonjs/types/Shared.js +13 -0
- package/lib/commonjs/types/Source.js +2 -0
- package/lib/commonjs/types/StateOfMind.js +90 -0
- package/lib/commonjs/types/Subscriptons.js +2 -0
- package/lib/commonjs/types/Units.js +2 -0
- package/lib/commonjs/types/WeatherCondition.js +35 -0
- package/lib/commonjs/types/WorkoutKit.js +12 -0
- package/lib/commonjs/types/Workouts.js +150 -0
- package/lib/commonjs/utils/getCategorySampleById.js +12 -0
- package/lib/commonjs/utils/getMostRecentCategorySample.js +12 -0
- package/lib/commonjs/utils/getMostRecentQuantitySample.js +11 -0
- package/lib/commonjs/utils/getMostRecentWorkout.js +13 -0
- package/lib/commonjs/utils/getPreferredUnit.js +12 -0
- package/lib/commonjs/utils/getQuantitySampleById.js +14 -0
- package/lib/commonjs/utils/getWorkoutById.js +15 -0
- package/lib/commonjs/utils/subscribeToChanges.js +11 -0
- package/lib/module/hooks/useCategorySampleById.js +30 -0
- package/lib/module/hooks/useHealthkitAuthorization.js +30 -0
- package/lib/module/hooks/useIsHealthDataAvailable.js +19 -0
- package/lib/module/hooks/useMostRecentCategorySample.js +15 -0
- package/lib/module/hooks/useMostRecentQuantitySample.js +16 -0
- package/lib/module/hooks/useMostRecentWorkout.js +25 -0
- package/lib/module/hooks/useQuantitySampleById.js +28 -0
- package/lib/module/hooks/useSources.js +14 -0
- package/lib/module/hooks/useStatisticsForQuantity.js +20 -0
- package/lib/module/hooks/useSubscribeToChanges.js +17 -0
- package/lib/module/hooks/useWorkoutById.js +40 -0
- package/lib/module/index.ios.js +126 -0
- package/lib/module/index.js +202 -0
- package/lib/module/modules.js +9 -0
- package/lib/module/specs/CategoryTypeModule.nitro.js +4 -0
- package/lib/module/specs/CharacteristicTypeModule.nitro.js +1 -0
- package/lib/module/specs/CoreModule.nitro.js +1 -0
- package/lib/module/specs/CorrelationTypeModule.nitro.js +1 -0
- package/lib/module/specs/HeartbeatSeriesModule.nitro.js +1 -0
- package/lib/module/specs/QuantityTypeModule.nitro.js +1 -0
- package/lib/module/specs/SourceProxy.nitro.js +1 -0
- package/lib/module/specs/StateOfMindModule.nitro.js +1 -0
- package/lib/module/specs/WorkoutProxy.nitro.js +1 -0
- package/lib/module/specs/WorkoutSessionModule.nitro.js +16 -0
- package/lib/module/specs/WorkoutsModule.nitro.js +1 -0
- package/lib/module/types/Auth.js +18 -0
- package/lib/module/types/Background.js +10 -0
- package/lib/module/types/CategoryType.js +98 -0
- package/lib/module/types/CategoryTypeIdentifier.js +1 -0
- package/lib/module/types/Characteristics.js +45 -0
- package/lib/module/types/Constants.js +20 -0
- package/lib/module/types/CorrelationType.js +1 -0
- package/lib/module/types/Device.js +1 -0
- package/lib/module/types/HeartbeatSeries.js +1 -0
- package/lib/module/types/InterfaceVerification.js +23 -0
- package/lib/module/types/InterfaceVerificationExample.js +32 -0
- package/lib/module/types/QuantitySample.js +1 -0
- package/lib/module/types/QuantityType.js +14 -0
- package/lib/module/types/QuantityTypeIdentifier.js +1 -0
- package/lib/module/types/QueryOptions.js +1 -0
- package/lib/module/types/Shared.js +10 -0
- package/lib/module/types/Source.js +1 -0
- package/lib/module/types/StateOfMind.js +87 -0
- package/lib/module/types/Subscriptons.js +1 -0
- package/lib/module/types/Units.js +1 -0
- package/lib/module/types/WeatherCondition.js +32 -0
- package/lib/module/types/WorkoutKit.js +9 -0
- package/lib/module/types/Workouts.js +147 -0
- package/lib/module/utils/getCategorySampleById.js +9 -0
- package/lib/module/utils/getMostRecentCategorySample.js +9 -0
- package/lib/module/utils/getMostRecentQuantitySample.js +9 -0
- package/lib/module/utils/getMostRecentWorkout.js +11 -0
- package/lib/module/utils/getPreferredUnit.js +10 -0
- package/lib/module/utils/getQuantitySampleById.js +12 -0
- package/lib/module/utils/getWorkoutById.js +13 -0
- package/lib/module/utils/subscribeToChanges.js +7 -0
- package/lib/typescript/hooks/useCategorySampleById.d.ts +11 -0
- package/lib/typescript/hooks/useHealthkitAuthorization.d.ts +9 -0
- package/lib/typescript/hooks/useIsHealthDataAvailable.d.ts +7 -0
- package/lib/typescript/hooks/useMostRecentCategorySample.d.ts +7 -0
- package/lib/typescript/hooks/useMostRecentQuantitySample.d.ts +7 -0
- package/lib/typescript/hooks/useMostRecentWorkout.d.ts +9 -0
- package/lib/typescript/hooks/useQuantitySampleById.d.ts +14 -0
- package/lib/typescript/hooks/useSources.d.ts +4 -0
- package/lib/typescript/hooks/useStatisticsForQuantity.d.ts +4 -0
- package/lib/typescript/hooks/useSubscribeToChanges.d.ts +4 -0
- package/lib/typescript/hooks/useWorkoutById.d.ts +13 -0
- package/lib/typescript/index.d.ts +74 -0
- package/lib/typescript/index.ios.d.ts +142 -0
- package/lib/typescript/modules.d.ts +16 -0
- package/lib/typescript/specs/CategoryTypeModule.nitro.d.ts +16 -0
- package/lib/typescript/specs/CharacteristicTypeModule.nitro.d.ts +16 -0
- package/lib/typescript/specs/CoreModule.nitro.d.ts +60 -0
- package/lib/typescript/specs/CorrelationTypeModule.nitro.d.ts +8 -0
- package/lib/typescript/specs/HeartbeatSeriesModule.nitro.d.ts +9 -0
- package/lib/typescript/specs/QuantityTypeModule.nitro.d.ts +16 -0
- package/lib/typescript/specs/SourceProxy.nitro.d.ts +14 -0
- package/lib/typescript/specs/StateOfMindModule.nitro.d.ts +9 -0
- package/lib/typescript/specs/WorkoutProxy.nitro.d.ts +10 -0
- package/lib/typescript/specs/WorkoutSessionModule.nitro.d.ts +47 -0
- package/lib/typescript/specs/WorkoutsModule.nitro.d.ts +13 -0
- package/lib/typescript/types/Auth.d.ts +16 -0
- package/lib/typescript/types/Background.d.ts +9 -0
- package/lib/typescript/types/CategoryType.d.ts +144 -0
- package/lib/typescript/types/CategoryTypeIdentifier.d.ts +31 -0
- package/lib/typescript/types/Characteristics.d.ts +41 -0
- package/lib/typescript/types/Constants.d.ts +20 -0
- package/lib/typescript/types/CorrelationType.d.ts +21 -0
- package/lib/typescript/types/Device.d.ts +13 -0
- package/lib/typescript/types/HeartbeatSeries.d.ts +25 -0
- package/lib/typescript/types/InterfaceVerification.d.ts +73 -0
- package/lib/typescript/types/InterfaceVerificationExample.d.ts +58 -0
- package/lib/typescript/types/QuantitySample.d.ts +27 -0
- package/lib/typescript/types/QuantityType.d.ts +63 -0
- package/lib/typescript/types/QuantityTypeIdentifier.d.ts +659 -0
- package/lib/typescript/types/QueryOptions.d.ts +47 -0
- package/lib/typescript/types/Shared.d.ts +39 -0
- package/lib/typescript/types/Source.d.ts +10 -0
- package/lib/typescript/types/StateOfMind.d.ts +103 -0
- package/lib/typescript/types/Subscriptons.d.ts +8 -0
- package/lib/typescript/types/Units.d.ts +97 -0
- package/lib/typescript/types/WeatherCondition.d.ts +30 -0
- package/lib/typescript/types/WorkoutKit.d.ts +16 -0
- package/lib/typescript/types/Workouts.d.ts +254 -0
- package/lib/typescript/utils/getCategorySampleById.d.ts +3 -0
- package/lib/typescript/utils/getMostRecentCategorySample.d.ts +3 -0
- package/lib/typescript/utils/getMostRecentQuantitySample.d.ts +3 -0
- package/lib/typescript/utils/getMostRecentWorkout.d.ts +3 -0
- package/lib/typescript/utils/getPreferredUnit.d.ts +3 -0
- package/lib/typescript/utils/getQuantitySampleById.d.ts +3 -0
- package/lib/typescript/utils/getWorkoutById.d.ts +3 -0
- package/lib/typescript/utils/subscribeToChanges.d.ts +5 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/ios/ReactNativeHealthkit+autolinking.rb +60 -0
- package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.cpp +450 -0
- package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.hpp +2570 -0
- package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Umbrella.hpp +326 -0
- package/nitrogen/generated/ios/ReactNativeHealthkitAutolinking.mm +89 -0
- package/nitrogen/generated/ios/ReactNativeHealthkitAutolinking.swift +130 -0
- package/nitrogen/generated/ios/c++/HybridCategoryTypeModuleSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCategoryTypeModuleSpecSwift.hpp +146 -0
- package/nitrogen/generated/ios/c++/HybridCharacteristicTypeModuleSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCharacteristicTypeModuleSpecSwift.hpp +155 -0
- package/nitrogen/generated/ios/c++/HybridCoreModuleSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCoreModuleSpecSwift.hpp +300 -0
- package/nitrogen/generated/ios/c++/HybridCorrelationTypeModuleSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCorrelationTypeModuleSpecSwift.hpp +120 -0
- package/nitrogen/generated/ios/c++/HybridHeartbeatSeriesModuleSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridHeartbeatSeriesModuleSpecSwift.hpp +138 -0
- package/nitrogen/generated/ios/c++/HybridQuantityTypeModuleSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridQuantityTypeModuleSpecSwift.hpp +196 -0
- package/nitrogen/generated/ios/c++/HybridSourceProxySpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridSourceProxySpecSwift.hpp +77 -0
- package/nitrogen/generated/ios/c++/HybridStateOfMindModuleSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridStateOfMindModuleSpecSwift.hpp +138 -0
- package/nitrogen/generated/ios/c++/HybridWorkoutProxySpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridWorkoutProxySpecSwift.hpp +196 -0
- package/nitrogen/generated/ios/c++/HybridWorkoutSessionModuleSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridWorkoutSessionModuleSpecSwift.hpp +107 -0
- package/nitrogen/generated/ios/c++/HybridWorkoutsModuleSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridWorkoutsModuleSpecSwift.hpp +172 -0
- package/nitrogen/generated/ios/swift/AuthorizationRequestStatus.swift +44 -0
- package/nitrogen/generated/ios/swift/AuthorizationStatus.swift +44 -0
- package/nitrogen/generated/ios/swift/BiologicalSex.swift +48 -0
- package/nitrogen/generated/ios/swift/BloodType.swift +68 -0
- package/nitrogen/generated/ios/swift/CategorySample.swift +148 -0
- package/nitrogen/generated/ios/swift/CategorySampleForSaving.swift +108 -0
- package/nitrogen/generated/ios/swift/CategorySamplesWithAnchorResponse.swift +81 -0
- package/nitrogen/generated/ios/swift/CategoryTypeIdentifier.swift +288 -0
- package/nitrogen/generated/ios/swift/ComparisonPredicateOperator.swift +88 -0
- package/nitrogen/generated/ios/swift/CorrelationObject.swift +16 -0
- package/nitrogen/generated/ios/swift/CorrelationSample.swift +117 -0
- package/nitrogen/generated/ios/swift/CorrelationTypeIdentifier.swift +40 -0
- package/nitrogen/generated/ios/swift/DeletedSample.swift +64 -0
- package/nitrogen/generated/ios/swift/Device.swift +256 -0
- package/nitrogen/generated/ios/swift/FilterForSamples.swift +21 -0
- package/nitrogen/generated/ios/swift/FilterForSamplesAnd.swift +94 -0
- package/nitrogen/generated/ios/swift/FilterForSamplesOr.swift +94 -0
- package/nitrogen/generated/ios/swift/FitzpatrickSkinType.swift +60 -0
- package/nitrogen/generated/ios/swift/Func_void_AuthorizationRequestStatus.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_BiologicalSex.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_BloodType.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_CategorySamplesWithAnchorResponse.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_FitzpatrickSkinType.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_HeartbeatSeriesSamplesWithAnchorResponse.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_OnChangeCallbackArgs.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_QuantitySamplesWithAnchorResponse.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_QueryStatisticsResponse.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_QueryWorkoutSamplesWithAnchorResponse.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_WheelchairUse.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_WorkoutEventType.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_WorkoutSessionState_WorkoutSessionState_std__chrono__system_clock__time_point.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__chrono__system_clock__time_point.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_WorkoutPlan_.swift +52 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__unordered_map_std__string__bool_.swift +54 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_CategorySample_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_CorrelationSample_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_HeartbeatSeriesSample_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_IdentifierWithUnit_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_QuantitySample_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_QueryStatisticsResponse_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_RemoteSessionSharableData_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_StateOfMindSample_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_WorkoutRoute_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_std__shared_ptr_margelo__nitro__healthkit__HybridSourceProxySpec__.swift +50 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec__.swift +50 -0
- package/nitrogen/generated/ios/swift/Heartbeat.swift +46 -0
- package/nitrogen/generated/ios/swift/HeartbeatSeriesSample.swift +167 -0
- package/nitrogen/generated/ios/swift/HeartbeatSeriesSamplesWithAnchorResponse.swift +81 -0
- package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec.swift +50 -0
- package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec_cxx.swift +171 -0
- package/nitrogen/generated/ios/swift/HybridCharacteristicTypeModuleSpec.swift +57 -0
- package/nitrogen/generated/ios/swift/HybridCharacteristicTypeModuleSpec_cxx.swift +257 -0
- package/nitrogen/generated/ios/swift/HybridCoreModuleSpec.swift +69 -0
- package/nitrogen/generated/ios/swift/HybridCoreModuleSpec_cxx.swift +523 -0
- package/nitrogen/generated/ios/swift/HybridCorrelationTypeModuleSpec.swift +49 -0
- package/nitrogen/generated/ios/swift/HybridCorrelationTypeModuleSpec_cxx.swift +158 -0
- package/nitrogen/generated/ios/swift/HybridHeartbeatSeriesModuleSpec.swift +49 -0
- package/nitrogen/generated/ios/swift/HybridHeartbeatSeriesModuleSpec_cxx.swift +152 -0
- package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec.swift +54 -0
- package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec_cxx.swift +285 -0
- package/nitrogen/generated/ios/swift/HybridSourceProxySpec.swift +48 -0
- package/nitrogen/generated/ios/swift/HybridSourceProxySpec_cxx.swift +125 -0
- package/nitrogen/generated/ios/swift/HybridStateOfMindModuleSpec.swift +49 -0
- package/nitrogen/generated/ios/swift/HybridStateOfMindModuleSpec_cxx.swift +158 -0
- package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec.swift +64 -0
- package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec_cxx.swift +351 -0
- package/nitrogen/generated/ios/swift/HybridWorkoutSessionModuleSpec.swift +49 -0
- package/nitrogen/generated/ios/swift/HybridWorkoutSessionModuleSpec_cxx.swift +133 -0
- package/nitrogen/generated/ios/swift/HybridWorkoutsModuleSpec.swift +51 -0
- package/nitrogen/generated/ios/swift/HybridWorkoutsModuleSpec_cxx.swift +187 -0
- package/nitrogen/generated/ios/swift/IdentifierWithUnit.swift +46 -0
- package/nitrogen/generated/ios/swift/IntervalComponents.swift +139 -0
- package/nitrogen/generated/ios/swift/LocationForSaving.swift +112 -0
- package/nitrogen/generated/ios/swift/ObjectTypeIdentifier.swift +820 -0
- package/nitrogen/generated/ios/swift/OnChangeCallbackArgs.swift +64 -0
- package/nitrogen/generated/ios/swift/PredicateForSamples.swift +19 -0
- package/nitrogen/generated/ios/swift/PredicateForWorkouts.swift +21 -0
- package/nitrogen/generated/ios/swift/PredicateForWorkoutsAnd.swift +108 -0
- package/nitrogen/generated/ios/swift/PredicateForWorkoutsOr.swift +108 -0
- package/nitrogen/generated/ios/swift/PredicateFromWorkout.swift +45 -0
- package/nitrogen/generated/ios/swift/PredicateWithMetadataKey.swift +35 -0
- package/nitrogen/generated/ios/swift/PredicateWithStartAndEnd.swift +128 -0
- package/nitrogen/generated/ios/swift/PredicateWithUUID.swift +35 -0
- package/nitrogen/generated/ios/swift/PredicateWithUUIDs.swift +47 -0
- package/nitrogen/generated/ios/swift/Quantity.swift +46 -0
- package/nitrogen/generated/ios/swift/QuantityDateInterval.swift +46 -0
- package/nitrogen/generated/ios/swift/QuantitySample.swift +159 -0
- package/nitrogen/generated/ios/swift/QuantitySampleForSaving.swift +119 -0
- package/nitrogen/generated/ios/swift/QuantitySamplesWithAnchorResponse.swift +81 -0
- package/nitrogen/generated/ios/swift/QuantityTypeIdentifier.swift +508 -0
- package/nitrogen/generated/ios/swift/QueryOptionsWithAnchor.swift +166 -0
- package/nitrogen/generated/ios/swift/QueryOptionsWithAnchorAndUnit.swift +195 -0
- package/nitrogen/generated/ios/swift/QueryOptionsWithSortOrder.swift +160 -0
- package/nitrogen/generated/ios/swift/QueryOptionsWithSortOrderAndUnit.swift +189 -0
- package/nitrogen/generated/ios/swift/QueryStatisticsResponse.swift +227 -0
- package/nitrogen/generated/ios/swift/QueryWorkoutSamplesWithAnchorResponse.swift +91 -0
- package/nitrogen/generated/ios/swift/RemoteSessionSharableData.swift +46 -0
- package/nitrogen/generated/ios/swift/SampleForSaving.swift +16 -0
- package/nitrogen/generated/ios/swift/SampleTypeIdentifier.swift +792 -0
- package/nitrogen/generated/ios/swift/SampleTypeIdentifierWriteable.swift +772 -0
- package/nitrogen/generated/ios/swift/Source.swift +46 -0
- package/nitrogen/generated/ios/swift/SourceRevision.swift +150 -0
- package/nitrogen/generated/ios/swift/StateOfMindAssociation.swift +104 -0
- package/nitrogen/generated/ios/swift/StateOfMindKind.swift +40 -0
- package/nitrogen/generated/ios/swift/StateOfMindLabel.swift +184 -0
- package/nitrogen/generated/ios/swift/StateOfMindSample.swift +223 -0
- package/nitrogen/generated/ios/swift/StateOfMindValenceClassification.swift +60 -0
- package/nitrogen/generated/ios/swift/StatisticsOptions.swift +60 -0
- package/nitrogen/generated/ios/swift/StatisticsQueryOptions.swift +129 -0
- package/nitrogen/generated/ios/swift/UpdateFrequency.swift +48 -0
- package/nitrogen/generated/ios/swift/Variant_PredicateWithUUID_PredicateWithUUIDs_PredicateWithMetadataKey_PredicateWithStartAndEnd_PredicateFromWorkout.swift +19 -0
- package/nitrogen/generated/ios/swift/Variant_PredicateWithUUID_PredicateWithUUIDs_PredicateWithMetadataKey_PredicateWithStartAndEnd_PredicateFromWorkout_FilterForSamplesAnd_FilterForSamplesOr.swift +21 -0
- package/nitrogen/generated/ios/swift/Variant_PredicateWithUUID_PredicateWithUUIDs_PredicateWithMetadataKey_PredicateWithStartAndEnd_PredicateFromWorkout_WorkoutActivityTypePredicate_WorkoutDurationPredicate_PredicateForWorkoutsOr_PredicateForWorkoutsAnd.swift +23 -0
- package/nitrogen/generated/ios/swift/WheelchairUse.swift +44 -0
- package/nitrogen/generated/ios/swift/WorkoutActivity.swift +68 -0
- package/nitrogen/generated/ios/swift/WorkoutActivityType.swift +368 -0
- package/nitrogen/generated/ios/swift/WorkoutActivityTypePredicate.swift +35 -0
- package/nitrogen/generated/ios/swift/WorkoutConfiguration.swift +58 -0
- package/nitrogen/generated/ios/swift/WorkoutDurationPredicate.swift +46 -0
- package/nitrogen/generated/ios/swift/WorkoutEvent.swift +57 -0
- package/nitrogen/generated/ios/swift/WorkoutEventType.swift +64 -0
- package/nitrogen/generated/ios/swift/WorkoutPlan.swift +46 -0
- package/nitrogen/generated/ios/swift/WorkoutQueryOptions.swift +232 -0
- package/nitrogen/generated/ios/swift/WorkoutQueryOptionsWithAnchor.swift +238 -0
- package/nitrogen/generated/ios/swift/WorkoutRoute.swift +99 -0
- package/nitrogen/generated/ios/swift/WorkoutRouteLocation.swift +146 -0
- package/nitrogen/generated/ios/swift/WorkoutSample.swift +364 -0
- package/nitrogen/generated/ios/swift/WorkoutSessionLocationType.swift +44 -0
- package/nitrogen/generated/ios/swift/WorkoutSessionMirroringStartHandlerOptions.swift +118 -0
- package/nitrogen/generated/ios/swift/WorkoutSessionState.swift +56 -0
- package/nitrogen/generated/ios/swift/WorkoutTotals.swift +70 -0
- package/nitrogen/generated/shared/c++/AuthorizationRequestStatus.hpp +65 -0
- package/nitrogen/generated/shared/c++/AuthorizationStatus.hpp +65 -0
- package/nitrogen/generated/shared/c++/BiologicalSex.hpp +66 -0
- package/nitrogen/generated/shared/c++/BloodType.hpp +71 -0
- package/nitrogen/generated/shared/c++/CategorySample.hpp +110 -0
- package/nitrogen/generated/shared/c++/CategorySampleForSaving.hpp +98 -0
- package/nitrogen/generated/shared/c++/CategorySamplesWithAnchorResponse.hpp +83 -0
- package/nitrogen/generated/shared/c++/CategoryTypeIdentifier.hpp +326 -0
- package/nitrogen/generated/shared/c++/ComparisonPredicateOperator.hpp +76 -0
- package/nitrogen/generated/shared/c++/CorrelationSample.hpp +98 -0
- package/nitrogen/generated/shared/c++/CorrelationTypeIdentifier.hpp +78 -0
- package/nitrogen/generated/shared/c++/DeletedSample.hpp +76 -0
- package/nitrogen/generated/shared/c++/Device.hpp +98 -0
- package/nitrogen/generated/shared/c++/FilterForSamplesAnd.hpp +84 -0
- package/nitrogen/generated/shared/c++/FilterForSamplesOr.hpp +84 -0
- package/nitrogen/generated/shared/c++/FitzpatrickSkinType.hpp +69 -0
- package/nitrogen/generated/shared/c++/Heartbeat.hpp +73 -0
- package/nitrogen/generated/shared/c++/HeartbeatSeriesSample.hpp +107 -0
- package/nitrogen/generated/shared/c++/HeartbeatSeriesSamplesWithAnchorResponse.hpp +83 -0
- package/nitrogen/generated/shared/c++/HybridCategoryTypeModuleSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridCategoryTypeModuleSpec.hpp +84 -0
- package/nitrogen/generated/shared/c++/HybridCharacteristicTypeModuleSpec.cpp +30 -0
- package/nitrogen/generated/shared/c++/HybridCharacteristicTypeModuleSpec.hpp +83 -0
- package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.cpp +42 -0
- package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.hpp +140 -0
- package/nitrogen/generated/shared/c++/HybridCorrelationTypeModuleSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridCorrelationTypeModuleSpec.hpp +80 -0
- package/nitrogen/generated/shared/c++/HybridHeartbeatSeriesModuleSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridHeartbeatSeriesModuleSpec.hpp +76 -0
- package/nitrogen/generated/shared/c++/HybridQuantityTypeModuleSpec.cpp +27 -0
- package/nitrogen/generated/shared/c++/HybridQuantityTypeModuleSpec.hpp +123 -0
- package/nitrogen/generated/shared/c++/HybridSourceProxySpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridSourceProxySpec.hpp +65 -0
- package/nitrogen/generated/shared/c++/HybridStateOfMindModuleSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridStateOfMindModuleSpec.hpp +83 -0
- package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.cpp +38 -0
- package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.hpp +114 -0
- package/nitrogen/generated/shared/c++/HybridWorkoutSessionModuleSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridWorkoutSessionModuleSpec.hpp +68 -0
- package/nitrogen/generated/shared/c++/HybridWorkoutsModuleSpec.cpp +24 -0
- package/nitrogen/generated/shared/c++/HybridWorkoutsModuleSpec.hpp +95 -0
- package/nitrogen/generated/shared/c++/IdentifierWithUnit.hpp +73 -0
- package/nitrogen/generated/shared/c++/IntervalComponents.hpp +85 -0
- package/nitrogen/generated/shared/c++/LocationForSaving.hpp +97 -0
- package/nitrogen/generated/shared/c++/ObjectTypeIdentifier.hpp +858 -0
- package/nitrogen/generated/shared/c++/OnChangeCallbackArgs.hpp +76 -0
- package/nitrogen/generated/shared/c++/PredicateForWorkoutsAnd.hpp +90 -0
- package/nitrogen/generated/shared/c++/PredicateForWorkoutsOr.hpp +90 -0
- package/nitrogen/generated/shared/c++/PredicateFromWorkout.hpp +71 -0
- package/nitrogen/generated/shared/c++/PredicateWithMetadataKey.hpp +69 -0
- package/nitrogen/generated/shared/c++/PredicateWithStartAndEnd.hpp +82 -0
- package/nitrogen/generated/shared/c++/PredicateWithUUID.hpp +69 -0
- package/nitrogen/generated/shared/c++/PredicateWithUUIDs.hpp +70 -0
- package/nitrogen/generated/shared/c++/Quantity.hpp +73 -0
- package/nitrogen/generated/shared/c++/QuantityDateInterval.hpp +73 -0
- package/nitrogen/generated/shared/c++/QuantitySample.hpp +114 -0
- package/nitrogen/generated/shared/c++/QuantitySampleForSaving.hpp +103 -0
- package/nitrogen/generated/shared/c++/QuantitySamplesWithAnchorResponse.hpp +83 -0
- package/nitrogen/generated/shared/c++/QuantityTypeIdentifier.hpp +546 -0
- package/nitrogen/generated/shared/c++/QueryOptionsWithAnchor.hpp +99 -0
- package/nitrogen/generated/shared/c++/QueryOptionsWithAnchorAndUnit.hpp +103 -0
- package/nitrogen/generated/shared/c++/QueryOptionsWithSortOrder.hpp +98 -0
- package/nitrogen/generated/shared/c++/QueryOptionsWithSortOrderAndUnit.hpp +103 -0
- package/nitrogen/generated/shared/c++/QueryStatisticsResponse.hpp +98 -0
- package/nitrogen/generated/shared/c++/QueryWorkoutSamplesWithAnchorResponse.hpp +84 -0
- package/nitrogen/generated/shared/c++/RemoteSessionSharableData.hpp +75 -0
- package/nitrogen/generated/shared/c++/SampleTypeIdentifier.hpp +830 -0
- package/nitrogen/generated/shared/c++/SampleTypeIdentifierWriteable.hpp +810 -0
- package/nitrogen/generated/shared/c++/Source.hpp +73 -0
- package/nitrogen/generated/shared/c++/SourceRevision.hpp +85 -0
- package/nitrogen/generated/shared/c++/StateOfMindAssociation.hpp +80 -0
- package/nitrogen/generated/shared/c++/StateOfMindKind.hpp +64 -0
- package/nitrogen/generated/shared/c++/StateOfMindLabel.hpp +100 -0
- package/nitrogen/generated/shared/c++/StateOfMindSample.hpp +132 -0
- package/nitrogen/generated/shared/c++/StateOfMindValenceClassification.hpp +69 -0
- package/nitrogen/generated/shared/c++/StatisticsOptions.hpp +98 -0
- package/nitrogen/generated/shared/c++/StatisticsQueryOptions.hpp +89 -0
- package/nitrogen/generated/shared/c++/UpdateFrequency.hpp +66 -0
- package/nitrogen/generated/shared/c++/WheelchairUse.hpp +65 -0
- package/nitrogen/generated/shared/c++/WorkoutActivity.hpp +82 -0
- package/nitrogen/generated/shared/c++/WorkoutActivityType.hpp +146 -0
- package/nitrogen/generated/shared/c++/WorkoutActivityTypePredicate.hpp +70 -0
- package/nitrogen/generated/shared/c++/WorkoutConfiguration.hpp +78 -0
- package/nitrogen/generated/shared/c++/WorkoutDurationPredicate.hpp +74 -0
- package/nitrogen/generated/shared/c++/WorkoutEvent.hpp +79 -0
- package/nitrogen/generated/shared/c++/WorkoutEventType.hpp +70 -0
- package/nitrogen/generated/shared/c++/WorkoutPlan.hpp +75 -0
- package/nitrogen/generated/shared/c++/WorkoutQueryOptions.hpp +113 -0
- package/nitrogen/generated/shared/c++/WorkoutQueryOptionsWithAnchor.hpp +113 -0
- package/nitrogen/generated/shared/c++/WorkoutRoute.hpp +81 -0
- package/nitrogen/generated/shared/c++/WorkoutRouteLocation.hpp +106 -0
- package/nitrogen/generated/shared/c++/WorkoutSample.hpp +144 -0
- package/nitrogen/generated/shared/c++/WorkoutSessionLocationType.hpp +65 -0
- package/nitrogen/generated/shared/c++/WorkoutSessionMirroringStartHandlerOptions.hpp +92 -0
- package/nitrogen/generated/shared/c++/WorkoutSessionState.hpp +68 -0
- package/nitrogen/generated/shared/c++/WorkoutTotals.hpp +73 -0
- package/package.json +35 -12
- package/src/hooks/useCategorySampleById.ts +41 -0
- package/src/hooks/useQuantitySampleById.ts +44 -0
- package/src/hooks/useWorkoutById.ts +55 -0
- package/src/index.ios.ts +1 -9
- package/src/index.ts +4 -16
- package/src/utils/getCategorySampleById.ts +16 -0
- package/src/utils/getQuantitySampleById.ts +20 -0
- package/src/utils/getWorkoutById.ts +20 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// WorkoutRoute.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
// Forward declaration of `WorkoutRouteLocation` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::healthkit { struct WorkoutRouteLocation; }
|
|
23
|
+
|
|
24
|
+
#include <vector>
|
|
25
|
+
#include "WorkoutRouteLocation.hpp"
|
|
26
|
+
#include <optional>
|
|
27
|
+
#include <string>
|
|
28
|
+
|
|
29
|
+
namespace margelo::nitro::healthkit {
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A struct which can be represented as a JavaScript object (WorkoutRoute).
|
|
33
|
+
*/
|
|
34
|
+
struct WorkoutRoute {
|
|
35
|
+
public:
|
|
36
|
+
std::vector<WorkoutRouteLocation> locations SWIFT_PRIVATE;
|
|
37
|
+
std::optional<std::string> HKMetadataKeySyncIdentifier SWIFT_PRIVATE;
|
|
38
|
+
std::optional<double> HKMetadataKeySyncVersion SWIFT_PRIVATE;
|
|
39
|
+
|
|
40
|
+
public:
|
|
41
|
+
WorkoutRoute() = default;
|
|
42
|
+
explicit WorkoutRoute(std::vector<WorkoutRouteLocation> locations, std::optional<std::string> HKMetadataKeySyncIdentifier, std::optional<double> HKMetadataKeySyncVersion): locations(locations), HKMetadataKeySyncIdentifier(HKMetadataKeySyncIdentifier), HKMetadataKeySyncVersion(HKMetadataKeySyncVersion) {}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
} // namespace margelo::nitro::healthkit
|
|
46
|
+
|
|
47
|
+
namespace margelo::nitro {
|
|
48
|
+
|
|
49
|
+
using namespace margelo::nitro::healthkit;
|
|
50
|
+
|
|
51
|
+
// C++ WorkoutRoute <> JS WorkoutRoute (object)
|
|
52
|
+
template <>
|
|
53
|
+
struct JSIConverter<WorkoutRoute> final {
|
|
54
|
+
static inline WorkoutRoute fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
55
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
56
|
+
return WorkoutRoute(
|
|
57
|
+
JSIConverter<std::vector<WorkoutRouteLocation>>::fromJSI(runtime, obj.getProperty(runtime, "locations")),
|
|
58
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "HKMetadataKeySyncIdentifier")),
|
|
59
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "HKMetadataKeySyncVersion"))
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const WorkoutRoute& arg) {
|
|
63
|
+
jsi::Object obj(runtime);
|
|
64
|
+
obj.setProperty(runtime, "locations", JSIConverter<std::vector<WorkoutRouteLocation>>::toJSI(runtime, arg.locations));
|
|
65
|
+
obj.setProperty(runtime, "HKMetadataKeySyncIdentifier", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.HKMetadataKeySyncIdentifier));
|
|
66
|
+
obj.setProperty(runtime, "HKMetadataKeySyncVersion", JSIConverter<std::optional<double>>::toJSI(runtime, arg.HKMetadataKeySyncVersion));
|
|
67
|
+
return obj;
|
|
68
|
+
}
|
|
69
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
70
|
+
if (!value.isObject()) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
jsi::Object obj = value.getObject(runtime);
|
|
74
|
+
if (!JSIConverter<std::vector<WorkoutRouteLocation>>::canConvert(runtime, obj.getProperty(runtime, "locations"))) return false;
|
|
75
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "HKMetadataKeySyncIdentifier"))) return false;
|
|
76
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "HKMetadataKeySyncVersion"))) return false;
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// WorkoutRouteLocation.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
#include <chrono>
|
|
24
|
+
#include <optional>
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::healthkit {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A struct which can be represented as a JavaScript object (WorkoutRouteLocation).
|
|
30
|
+
*/
|
|
31
|
+
struct WorkoutRouteLocation {
|
|
32
|
+
public:
|
|
33
|
+
double altitude SWIFT_PRIVATE;
|
|
34
|
+
double course SWIFT_PRIVATE;
|
|
35
|
+
std::chrono::system_clock::time_point date SWIFT_PRIVATE;
|
|
36
|
+
std::optional<double> distance SWIFT_PRIVATE;
|
|
37
|
+
double horizontalAccuracy SWIFT_PRIVATE;
|
|
38
|
+
double latitude SWIFT_PRIVATE;
|
|
39
|
+
double longitude SWIFT_PRIVATE;
|
|
40
|
+
double speed SWIFT_PRIVATE;
|
|
41
|
+
double speedAccuracy SWIFT_PRIVATE;
|
|
42
|
+
double verticalAccuracy SWIFT_PRIVATE;
|
|
43
|
+
|
|
44
|
+
public:
|
|
45
|
+
WorkoutRouteLocation() = default;
|
|
46
|
+
explicit WorkoutRouteLocation(double altitude, double course, std::chrono::system_clock::time_point date, std::optional<double> distance, double horizontalAccuracy, double latitude, double longitude, double speed, double speedAccuracy, double verticalAccuracy): altitude(altitude), course(course), date(date), distance(distance), horizontalAccuracy(horizontalAccuracy), latitude(latitude), longitude(longitude), speed(speed), speedAccuracy(speedAccuracy), verticalAccuracy(verticalAccuracy) {}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
} // namespace margelo::nitro::healthkit
|
|
50
|
+
|
|
51
|
+
namespace margelo::nitro {
|
|
52
|
+
|
|
53
|
+
using namespace margelo::nitro::healthkit;
|
|
54
|
+
|
|
55
|
+
// C++ WorkoutRouteLocation <> JS WorkoutRouteLocation (object)
|
|
56
|
+
template <>
|
|
57
|
+
struct JSIConverter<WorkoutRouteLocation> final {
|
|
58
|
+
static inline WorkoutRouteLocation fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
59
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
60
|
+
return WorkoutRouteLocation(
|
|
61
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "altitude")),
|
|
62
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "course")),
|
|
63
|
+
JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, "date")),
|
|
64
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "distance")),
|
|
65
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "horizontalAccuracy")),
|
|
66
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "latitude")),
|
|
67
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "longitude")),
|
|
68
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "speed")),
|
|
69
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "speedAccuracy")),
|
|
70
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "verticalAccuracy"))
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const WorkoutRouteLocation& arg) {
|
|
74
|
+
jsi::Object obj(runtime);
|
|
75
|
+
obj.setProperty(runtime, "altitude", JSIConverter<double>::toJSI(runtime, arg.altitude));
|
|
76
|
+
obj.setProperty(runtime, "course", JSIConverter<double>::toJSI(runtime, arg.course));
|
|
77
|
+
obj.setProperty(runtime, "date", JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.date));
|
|
78
|
+
obj.setProperty(runtime, "distance", JSIConverter<std::optional<double>>::toJSI(runtime, arg.distance));
|
|
79
|
+
obj.setProperty(runtime, "horizontalAccuracy", JSIConverter<double>::toJSI(runtime, arg.horizontalAccuracy));
|
|
80
|
+
obj.setProperty(runtime, "latitude", JSIConverter<double>::toJSI(runtime, arg.latitude));
|
|
81
|
+
obj.setProperty(runtime, "longitude", JSIConverter<double>::toJSI(runtime, arg.longitude));
|
|
82
|
+
obj.setProperty(runtime, "speed", JSIConverter<double>::toJSI(runtime, arg.speed));
|
|
83
|
+
obj.setProperty(runtime, "speedAccuracy", JSIConverter<double>::toJSI(runtime, arg.speedAccuracy));
|
|
84
|
+
obj.setProperty(runtime, "verticalAccuracy", JSIConverter<double>::toJSI(runtime, arg.verticalAccuracy));
|
|
85
|
+
return obj;
|
|
86
|
+
}
|
|
87
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
88
|
+
if (!value.isObject()) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
jsi::Object obj = value.getObject(runtime);
|
|
92
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "altitude"))) return false;
|
|
93
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "course"))) return false;
|
|
94
|
+
if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, "date"))) return false;
|
|
95
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "distance"))) return false;
|
|
96
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "horizontalAccuracy"))) return false;
|
|
97
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "latitude"))) return false;
|
|
98
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "longitude"))) return false;
|
|
99
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "speed"))) return false;
|
|
100
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "speedAccuracy"))) return false;
|
|
101
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "verticalAccuracy"))) return false;
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// WorkoutSample.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
// Forward declaration of `Device` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::healthkit { struct Device; }
|
|
23
|
+
// Forward declaration of `WorkoutActivityType` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::healthkit { enum class WorkoutActivityType; }
|
|
25
|
+
// Forward declaration of `Quantity` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::healthkit { struct Quantity; }
|
|
27
|
+
// Forward declaration of `AnyMap` to properly resolve imports.
|
|
28
|
+
namespace NitroModules { class AnyMap; }
|
|
29
|
+
// Forward declaration of `SourceRevision` to properly resolve imports.
|
|
30
|
+
namespace margelo::nitro::healthkit { struct SourceRevision; }
|
|
31
|
+
// Forward declaration of `WorkoutEvent` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::healthkit { struct WorkoutEvent; }
|
|
33
|
+
// Forward declaration of `WorkoutActivity` to properly resolve imports.
|
|
34
|
+
namespace margelo::nitro::healthkit { struct WorkoutActivity; }
|
|
35
|
+
|
|
36
|
+
#include <string>
|
|
37
|
+
#include <optional>
|
|
38
|
+
#include "Device.hpp"
|
|
39
|
+
#include "WorkoutActivityType.hpp"
|
|
40
|
+
#include "Quantity.hpp"
|
|
41
|
+
#include <chrono>
|
|
42
|
+
#include <NitroModules/AnyMap.hpp>
|
|
43
|
+
#include "SourceRevision.hpp"
|
|
44
|
+
#include <vector>
|
|
45
|
+
#include "WorkoutEvent.hpp"
|
|
46
|
+
#include "WorkoutActivity.hpp"
|
|
47
|
+
|
|
48
|
+
namespace margelo::nitro::healthkit {
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A struct which can be represented as a JavaScript object (WorkoutSample).
|
|
52
|
+
*/
|
|
53
|
+
struct WorkoutSample {
|
|
54
|
+
public:
|
|
55
|
+
std::string uuid SWIFT_PRIVATE;
|
|
56
|
+
std::optional<Device> device SWIFT_PRIVATE;
|
|
57
|
+
WorkoutActivityType workoutActivityType SWIFT_PRIVATE;
|
|
58
|
+
Quantity duration SWIFT_PRIVATE;
|
|
59
|
+
std::optional<Quantity> totalDistance SWIFT_PRIVATE;
|
|
60
|
+
std::optional<Quantity> totalEnergyBurned SWIFT_PRIVATE;
|
|
61
|
+
std::optional<Quantity> totalSwimmingStrokeCount SWIFT_PRIVATE;
|
|
62
|
+
std::optional<Quantity> totalFlightsClimbed SWIFT_PRIVATE;
|
|
63
|
+
std::chrono::system_clock::time_point startDate SWIFT_PRIVATE;
|
|
64
|
+
std::chrono::system_clock::time_point endDate SWIFT_PRIVATE;
|
|
65
|
+
std::optional<std::shared_ptr<AnyMap>> metadata SWIFT_PRIVATE;
|
|
66
|
+
std::optional<SourceRevision> sourceRevision SWIFT_PRIVATE;
|
|
67
|
+
std::optional<std::vector<WorkoutEvent>> events SWIFT_PRIVATE;
|
|
68
|
+
std::optional<std::vector<WorkoutActivity>> activities SWIFT_PRIVATE;
|
|
69
|
+
|
|
70
|
+
public:
|
|
71
|
+
WorkoutSample() = default;
|
|
72
|
+
explicit WorkoutSample(std::string uuid, std::optional<Device> device, WorkoutActivityType workoutActivityType, Quantity duration, std::optional<Quantity> totalDistance, std::optional<Quantity> totalEnergyBurned, std::optional<Quantity> totalSwimmingStrokeCount, std::optional<Quantity> totalFlightsClimbed, std::chrono::system_clock::time_point startDate, std::chrono::system_clock::time_point endDate, std::optional<std::shared_ptr<AnyMap>> metadata, std::optional<SourceRevision> sourceRevision, std::optional<std::vector<WorkoutEvent>> events, std::optional<std::vector<WorkoutActivity>> activities): uuid(uuid), device(device), workoutActivityType(workoutActivityType), duration(duration), totalDistance(totalDistance), totalEnergyBurned(totalEnergyBurned), totalSwimmingStrokeCount(totalSwimmingStrokeCount), totalFlightsClimbed(totalFlightsClimbed), startDate(startDate), endDate(endDate), metadata(metadata), sourceRevision(sourceRevision), events(events), activities(activities) {}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro::healthkit
|
|
76
|
+
|
|
77
|
+
namespace margelo::nitro {
|
|
78
|
+
|
|
79
|
+
using namespace margelo::nitro::healthkit;
|
|
80
|
+
|
|
81
|
+
// C++ WorkoutSample <> JS WorkoutSample (object)
|
|
82
|
+
template <>
|
|
83
|
+
struct JSIConverter<WorkoutSample> final {
|
|
84
|
+
static inline WorkoutSample fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
85
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
86
|
+
return WorkoutSample(
|
|
87
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "uuid")),
|
|
88
|
+
JSIConverter<std::optional<Device>>::fromJSI(runtime, obj.getProperty(runtime, "device")),
|
|
89
|
+
JSIConverter<WorkoutActivityType>::fromJSI(runtime, obj.getProperty(runtime, "workoutActivityType")),
|
|
90
|
+
JSIConverter<Quantity>::fromJSI(runtime, obj.getProperty(runtime, "duration")),
|
|
91
|
+
JSIConverter<std::optional<Quantity>>::fromJSI(runtime, obj.getProperty(runtime, "totalDistance")),
|
|
92
|
+
JSIConverter<std::optional<Quantity>>::fromJSI(runtime, obj.getProperty(runtime, "totalEnergyBurned")),
|
|
93
|
+
JSIConverter<std::optional<Quantity>>::fromJSI(runtime, obj.getProperty(runtime, "totalSwimmingStrokeCount")),
|
|
94
|
+
JSIConverter<std::optional<Quantity>>::fromJSI(runtime, obj.getProperty(runtime, "totalFlightsClimbed")),
|
|
95
|
+
JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, "startDate")),
|
|
96
|
+
JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, "endDate")),
|
|
97
|
+
JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::fromJSI(runtime, obj.getProperty(runtime, "metadata")),
|
|
98
|
+
JSIConverter<std::optional<SourceRevision>>::fromJSI(runtime, obj.getProperty(runtime, "sourceRevision")),
|
|
99
|
+
JSIConverter<std::optional<std::vector<WorkoutEvent>>>::fromJSI(runtime, obj.getProperty(runtime, "events")),
|
|
100
|
+
JSIConverter<std::optional<std::vector<WorkoutActivity>>>::fromJSI(runtime, obj.getProperty(runtime, "activities"))
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const WorkoutSample& arg) {
|
|
104
|
+
jsi::Object obj(runtime);
|
|
105
|
+
obj.setProperty(runtime, "uuid", JSIConverter<std::string>::toJSI(runtime, arg.uuid));
|
|
106
|
+
obj.setProperty(runtime, "device", JSIConverter<std::optional<Device>>::toJSI(runtime, arg.device));
|
|
107
|
+
obj.setProperty(runtime, "workoutActivityType", JSIConverter<WorkoutActivityType>::toJSI(runtime, arg.workoutActivityType));
|
|
108
|
+
obj.setProperty(runtime, "duration", JSIConverter<Quantity>::toJSI(runtime, arg.duration));
|
|
109
|
+
obj.setProperty(runtime, "totalDistance", JSIConverter<std::optional<Quantity>>::toJSI(runtime, arg.totalDistance));
|
|
110
|
+
obj.setProperty(runtime, "totalEnergyBurned", JSIConverter<std::optional<Quantity>>::toJSI(runtime, arg.totalEnergyBurned));
|
|
111
|
+
obj.setProperty(runtime, "totalSwimmingStrokeCount", JSIConverter<std::optional<Quantity>>::toJSI(runtime, arg.totalSwimmingStrokeCount));
|
|
112
|
+
obj.setProperty(runtime, "totalFlightsClimbed", JSIConverter<std::optional<Quantity>>::toJSI(runtime, arg.totalFlightsClimbed));
|
|
113
|
+
obj.setProperty(runtime, "startDate", JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.startDate));
|
|
114
|
+
obj.setProperty(runtime, "endDate", JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.endDate));
|
|
115
|
+
obj.setProperty(runtime, "metadata", JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::toJSI(runtime, arg.metadata));
|
|
116
|
+
obj.setProperty(runtime, "sourceRevision", JSIConverter<std::optional<SourceRevision>>::toJSI(runtime, arg.sourceRevision));
|
|
117
|
+
obj.setProperty(runtime, "events", JSIConverter<std::optional<std::vector<WorkoutEvent>>>::toJSI(runtime, arg.events));
|
|
118
|
+
obj.setProperty(runtime, "activities", JSIConverter<std::optional<std::vector<WorkoutActivity>>>::toJSI(runtime, arg.activities));
|
|
119
|
+
return obj;
|
|
120
|
+
}
|
|
121
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
122
|
+
if (!value.isObject()) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
jsi::Object obj = value.getObject(runtime);
|
|
126
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "uuid"))) return false;
|
|
127
|
+
if (!JSIConverter<std::optional<Device>>::canConvert(runtime, obj.getProperty(runtime, "device"))) return false;
|
|
128
|
+
if (!JSIConverter<WorkoutActivityType>::canConvert(runtime, obj.getProperty(runtime, "workoutActivityType"))) return false;
|
|
129
|
+
if (!JSIConverter<Quantity>::canConvert(runtime, obj.getProperty(runtime, "duration"))) return false;
|
|
130
|
+
if (!JSIConverter<std::optional<Quantity>>::canConvert(runtime, obj.getProperty(runtime, "totalDistance"))) return false;
|
|
131
|
+
if (!JSIConverter<std::optional<Quantity>>::canConvert(runtime, obj.getProperty(runtime, "totalEnergyBurned"))) return false;
|
|
132
|
+
if (!JSIConverter<std::optional<Quantity>>::canConvert(runtime, obj.getProperty(runtime, "totalSwimmingStrokeCount"))) return false;
|
|
133
|
+
if (!JSIConverter<std::optional<Quantity>>::canConvert(runtime, obj.getProperty(runtime, "totalFlightsClimbed"))) return false;
|
|
134
|
+
if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, "startDate"))) return false;
|
|
135
|
+
if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, "endDate"))) return false;
|
|
136
|
+
if (!JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::canConvert(runtime, obj.getProperty(runtime, "metadata"))) return false;
|
|
137
|
+
if (!JSIConverter<std::optional<SourceRevision>>::canConvert(runtime, obj.getProperty(runtime, "sourceRevision"))) return false;
|
|
138
|
+
if (!JSIConverter<std::optional<std::vector<WorkoutEvent>>>::canConvert(runtime, obj.getProperty(runtime, "events"))) return false;
|
|
139
|
+
if (!JSIConverter<std::optional<std::vector<WorkoutActivity>>>::canConvert(runtime, obj.getProperty(runtime, "activities"))) return false;
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// WorkoutSessionLocationType.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <cmath>
|
|
11
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
12
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
13
|
+
#else
|
|
14
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
15
|
+
#endif
|
|
16
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
17
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
18
|
+
#else
|
|
19
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
20
|
+
#endif
|
|
21
|
+
|
|
22
|
+
namespace margelo::nitro::healthkit {
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* An enum which can be represented as a JavaScript enum (WorkoutSessionLocationType).
|
|
26
|
+
*/
|
|
27
|
+
enum class WorkoutSessionLocationType {
|
|
28
|
+
UNKNOWN SWIFT_NAME(unknown) = 1,
|
|
29
|
+
INDOOR SWIFT_NAME(indoor) = 2,
|
|
30
|
+
OUTDOOR SWIFT_NAME(outdoor) = 3,
|
|
31
|
+
} CLOSED_ENUM;
|
|
32
|
+
|
|
33
|
+
} // namespace margelo::nitro::healthkit
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro {
|
|
36
|
+
|
|
37
|
+
using namespace margelo::nitro::healthkit;
|
|
38
|
+
|
|
39
|
+
// C++ WorkoutSessionLocationType <> JS WorkoutSessionLocationType (enum)
|
|
40
|
+
template <>
|
|
41
|
+
struct JSIConverter<WorkoutSessionLocationType> final {
|
|
42
|
+
static inline WorkoutSessionLocationType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
43
|
+
int enumValue = JSIConverter<int>::fromJSI(runtime, arg);
|
|
44
|
+
return static_cast<WorkoutSessionLocationType>(enumValue);
|
|
45
|
+
}
|
|
46
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, WorkoutSessionLocationType arg) {
|
|
47
|
+
int enumValue = static_cast<int>(arg);
|
|
48
|
+
return JSIConverter<int>::toJSI(runtime, enumValue);
|
|
49
|
+
}
|
|
50
|
+
static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) {
|
|
51
|
+
if (!value.isNumber()) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
double integer;
|
|
55
|
+
double fraction = modf(value.getNumber(), &integer);
|
|
56
|
+
if (fraction != 0.0) {
|
|
57
|
+
// It is some kind of floating point number - our enums are ints.
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
// Check if we are within the bounds of the enum.
|
|
61
|
+
return integer >= 0 && integer <= 2;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// WorkoutSessionMirroringStartHandlerOptions.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
// Forward declaration of `WorkoutSessionState` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::healthkit { enum class WorkoutSessionState; }
|
|
23
|
+
// Forward declaration of `RemoteSessionSharableData` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::healthkit { struct RemoteSessionSharableData; }
|
|
25
|
+
// Forward declaration of `WorkoutEventType` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::healthkit { enum class WorkoutEventType; }
|
|
27
|
+
|
|
28
|
+
#include <functional>
|
|
29
|
+
#include <string>
|
|
30
|
+
#include "WorkoutSessionState.hpp"
|
|
31
|
+
#include <chrono>
|
|
32
|
+
#include <vector>
|
|
33
|
+
#include "RemoteSessionSharableData.hpp"
|
|
34
|
+
#include "WorkoutEventType.hpp"
|
|
35
|
+
|
|
36
|
+
namespace margelo::nitro::healthkit {
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A struct which can be represented as a JavaScript object (WorkoutSessionMirroringStartHandlerOptions).
|
|
40
|
+
*/
|
|
41
|
+
struct WorkoutSessionMirroringStartHandlerOptions {
|
|
42
|
+
public:
|
|
43
|
+
std::function<void(const std::string& /* errorMessage */)> onError SWIFT_PRIVATE;
|
|
44
|
+
std::function<void(WorkoutSessionState /* toState */, WorkoutSessionState /* fromState */, std::chrono::system_clock::time_point /* date */)> onStateChange SWIFT_PRIVATE;
|
|
45
|
+
std::function<void(const std::vector<RemoteSessionSharableData>& /* data */)> onDataReceived SWIFT_PRIVATE;
|
|
46
|
+
std::function<void(WorkoutEventType /* type */)> onEventReceived SWIFT_PRIVATE;
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
WorkoutSessionMirroringStartHandlerOptions() = default;
|
|
50
|
+
explicit WorkoutSessionMirroringStartHandlerOptions(std::function<void(const std::string& /* errorMessage */)> onError, std::function<void(WorkoutSessionState /* toState */, WorkoutSessionState /* fromState */, std::chrono::system_clock::time_point /* date */)> onStateChange, std::function<void(const std::vector<RemoteSessionSharableData>& /* data */)> onDataReceived, std::function<void(WorkoutEventType /* type */)> onEventReceived): onError(onError), onStateChange(onStateChange), onDataReceived(onDataReceived), onEventReceived(onEventReceived) {}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
} // namespace margelo::nitro::healthkit
|
|
54
|
+
|
|
55
|
+
namespace margelo::nitro {
|
|
56
|
+
|
|
57
|
+
using namespace margelo::nitro::healthkit;
|
|
58
|
+
|
|
59
|
+
// C++ WorkoutSessionMirroringStartHandlerOptions <> JS WorkoutSessionMirroringStartHandlerOptions (object)
|
|
60
|
+
template <>
|
|
61
|
+
struct JSIConverter<WorkoutSessionMirroringStartHandlerOptions> final {
|
|
62
|
+
static inline WorkoutSessionMirroringStartHandlerOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
63
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
64
|
+
return WorkoutSessionMirroringStartHandlerOptions(
|
|
65
|
+
JSIConverter<std::function<void(const std::string& /* errorMessage */)>>::fromJSI(runtime, obj.getProperty(runtime, "onError")),
|
|
66
|
+
JSIConverter<std::function<void(WorkoutSessionState /* toState */, WorkoutSessionState /* fromState */, std::chrono::system_clock::time_point /* date */)>>::fromJSI(runtime, obj.getProperty(runtime, "onStateChange")),
|
|
67
|
+
JSIConverter<std::function<void(const std::vector<RemoteSessionSharableData>& /* data */)>>::fromJSI(runtime, obj.getProperty(runtime, "onDataReceived")),
|
|
68
|
+
JSIConverter<std::function<void(WorkoutEventType /* type */)>>::fromJSI(runtime, obj.getProperty(runtime, "onEventReceived"))
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const WorkoutSessionMirroringStartHandlerOptions& arg) {
|
|
72
|
+
jsi::Object obj(runtime);
|
|
73
|
+
obj.setProperty(runtime, "onError", JSIConverter<std::function<void(const std::string& /* errorMessage */)>>::toJSI(runtime, arg.onError));
|
|
74
|
+
obj.setProperty(runtime, "onStateChange", JSIConverter<std::function<void(WorkoutSessionState /* toState */, WorkoutSessionState /* fromState */, std::chrono::system_clock::time_point /* date */)>>::toJSI(runtime, arg.onStateChange));
|
|
75
|
+
obj.setProperty(runtime, "onDataReceived", JSIConverter<std::function<void(const std::vector<RemoteSessionSharableData>& /* data */)>>::toJSI(runtime, arg.onDataReceived));
|
|
76
|
+
obj.setProperty(runtime, "onEventReceived", JSIConverter<std::function<void(WorkoutEventType /* type */)>>::toJSI(runtime, arg.onEventReceived));
|
|
77
|
+
return obj;
|
|
78
|
+
}
|
|
79
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
80
|
+
if (!value.isObject()) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
jsi::Object obj = value.getObject(runtime);
|
|
84
|
+
if (!JSIConverter<std::function<void(const std::string& /* errorMessage */)>>::canConvert(runtime, obj.getProperty(runtime, "onError"))) return false;
|
|
85
|
+
if (!JSIConverter<std::function<void(WorkoutSessionState /* toState */, WorkoutSessionState /* fromState */, std::chrono::system_clock::time_point /* date */)>>::canConvert(runtime, obj.getProperty(runtime, "onStateChange"))) return false;
|
|
86
|
+
if (!JSIConverter<std::function<void(const std::vector<RemoteSessionSharableData>& /* data */)>>::canConvert(runtime, obj.getProperty(runtime, "onDataReceived"))) return false;
|
|
87
|
+
if (!JSIConverter<std::function<void(WorkoutEventType /* type */)>>::canConvert(runtime, obj.getProperty(runtime, "onEventReceived"))) return false;
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// WorkoutSessionState.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <cmath>
|
|
11
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
12
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
13
|
+
#else
|
|
14
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
15
|
+
#endif
|
|
16
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
17
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
18
|
+
#else
|
|
19
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
20
|
+
#endif
|
|
21
|
+
|
|
22
|
+
namespace margelo::nitro::healthkit {
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* An enum which can be represented as a JavaScript enum (WorkoutSessionState).
|
|
26
|
+
*/
|
|
27
|
+
enum class WorkoutSessionState {
|
|
28
|
+
NOTSTARTED SWIFT_NAME(notstarted) = 1,
|
|
29
|
+
RUNNING SWIFT_NAME(running) = 2,
|
|
30
|
+
ENDED SWIFT_NAME(ended) = 3,
|
|
31
|
+
PAUSED SWIFT_NAME(paused) = 4,
|
|
32
|
+
PREPARED SWIFT_NAME(prepared) = 5,
|
|
33
|
+
STOPPED SWIFT_NAME(stopped) = 6,
|
|
34
|
+
} CLOSED_ENUM;
|
|
35
|
+
|
|
36
|
+
} // namespace margelo::nitro::healthkit
|
|
37
|
+
|
|
38
|
+
namespace margelo::nitro {
|
|
39
|
+
|
|
40
|
+
using namespace margelo::nitro::healthkit;
|
|
41
|
+
|
|
42
|
+
// C++ WorkoutSessionState <> JS WorkoutSessionState (enum)
|
|
43
|
+
template <>
|
|
44
|
+
struct JSIConverter<WorkoutSessionState> final {
|
|
45
|
+
static inline WorkoutSessionState fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
46
|
+
int enumValue = JSIConverter<int>::fromJSI(runtime, arg);
|
|
47
|
+
return static_cast<WorkoutSessionState>(enumValue);
|
|
48
|
+
}
|
|
49
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, WorkoutSessionState arg) {
|
|
50
|
+
int enumValue = static_cast<int>(arg);
|
|
51
|
+
return JSIConverter<int>::toJSI(runtime, enumValue);
|
|
52
|
+
}
|
|
53
|
+
static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) {
|
|
54
|
+
if (!value.isNumber()) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
double integer;
|
|
58
|
+
double fraction = modf(value.getNumber(), &integer);
|
|
59
|
+
if (fraction != 0.0) {
|
|
60
|
+
// It is some kind of floating point number - our enums are ints.
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
// Check if we are within the bounds of the enum.
|
|
64
|
+
return integer >= 0 && integer <= 5;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// WorkoutTotals.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
#include <optional>
|
|
24
|
+
|
|
25
|
+
namespace margelo::nitro::healthkit {
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A struct which can be represented as a JavaScript object (WorkoutTotals).
|
|
29
|
+
*/
|
|
30
|
+
struct WorkoutTotals {
|
|
31
|
+
public:
|
|
32
|
+
std::optional<double> distance SWIFT_PRIVATE;
|
|
33
|
+
std::optional<double> energyBurned SWIFT_PRIVATE;
|
|
34
|
+
|
|
35
|
+
public:
|
|
36
|
+
WorkoutTotals() = default;
|
|
37
|
+
explicit WorkoutTotals(std::optional<double> distance, std::optional<double> energyBurned): distance(distance), energyBurned(energyBurned) {}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
} // namespace margelo::nitro::healthkit
|
|
41
|
+
|
|
42
|
+
namespace margelo::nitro {
|
|
43
|
+
|
|
44
|
+
using namespace margelo::nitro::healthkit;
|
|
45
|
+
|
|
46
|
+
// C++ WorkoutTotals <> JS WorkoutTotals (object)
|
|
47
|
+
template <>
|
|
48
|
+
struct JSIConverter<WorkoutTotals> final {
|
|
49
|
+
static inline WorkoutTotals fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
50
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
51
|
+
return WorkoutTotals(
|
|
52
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "distance")),
|
|
53
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "energyBurned"))
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const WorkoutTotals& arg) {
|
|
57
|
+
jsi::Object obj(runtime);
|
|
58
|
+
obj.setProperty(runtime, "distance", JSIConverter<std::optional<double>>::toJSI(runtime, arg.distance));
|
|
59
|
+
obj.setProperty(runtime, "energyBurned", JSIConverter<std::optional<double>>::toJSI(runtime, arg.energyBurned));
|
|
60
|
+
return obj;
|
|
61
|
+
}
|
|
62
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
63
|
+
if (!value.isObject()) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
jsi::Object obj = value.getObject(runtime);
|
|
67
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "distance"))) return false;
|
|
68
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "energyBurned"))) return false;
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
} // namespace margelo::nitro
|