@kingstinct/react-native-healthkit 13.3.1 → 14.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.
Files changed (191) hide show
  1. package/ReactNativeHealthkit.podspec +1 -0
  2. package/app.plugin.ts +40 -2
  3. package/ios/BackgroundDeliveryManager.swift +196 -0
  4. package/ios/CategoryTypeModule.swift +1 -1
  5. package/ios/CoreModule.swift +24 -0
  6. package/ios/CorrelationTypeModule.swift +2 -35
  7. package/ios/ElectrocardiogramModule.swift +2 -34
  8. package/ios/HeartbeatSeriesModule.swift +2 -34
  9. package/ios/MedicationModule.swift +3 -35
  10. package/ios/PredicateHelpers.swift +2 -2
  11. package/ios/QuantityTypeModule.swift +11 -11
  12. package/ios/Serializers.swift +58 -90
  13. package/ios/StateOfMindModule.swift +2 -34
  14. package/ios/WorkoutProxy.swift +4 -149
  15. package/ios/generated/HealthkitGenerated.swift +52 -0
  16. package/lib/commonjs/generated/healthkit.generated.js +745 -0
  17. package/lib/commonjs/healthkit.ios.js +51 -17
  18. package/lib/commonjs/healthkit.js +120 -34
  19. package/lib/commonjs/specs/QuantityTypeModule.nitro.js +1 -0
  20. package/lib/commonjs/type-tests/generated-typing.js +2 -0
  21. package/lib/commonjs/types/CategoryType.js +19 -99
  22. package/lib/commonjs/types/Medication.js +2 -0
  23. package/lib/commonjs/types/MetadataEnums.js +17 -0
  24. package/lib/commonjs/types/QuantityType.js +4 -15
  25. package/lib/commonjs/types/WeatherCondition.js +2 -32
  26. package/lib/commonjs/types/Workouts.js +3 -98
  27. package/lib/commonjs/types/index.js +2 -0
  28. package/lib/module/generated/healthkit.generated.js +742 -0
  29. package/lib/module/healthkit.ios.js +49 -15
  30. package/lib/module/healthkit.js +94 -20
  31. package/lib/module/specs/QuantityTypeModule.nitro.js +1 -0
  32. package/lib/module/type-tests/generated-typing.js +1 -0
  33. package/lib/module/types/CategoryType.js +2 -98
  34. package/lib/module/types/Medication.js +1 -0
  35. package/lib/module/types/MetadataEnums.js +1 -0
  36. package/lib/module/types/QuantityType.js +2 -14
  37. package/lib/module/types/WeatherCondition.js +1 -32
  38. package/lib/module/types/Workouts.js +2 -98
  39. package/lib/module/types/index.js +2 -0
  40. package/lib/typescript/generated/healthkit.generated.d.ts +1006 -0
  41. package/lib/typescript/healthkit.d.ts +39 -36
  42. package/lib/typescript/healthkit.ios.d.ts +64 -53
  43. package/lib/typescript/hooks/useMostRecentQuantitySample.d.ts +3 -2
  44. package/lib/typescript/hooks/useMostRecentWorkout.d.ts +2 -2
  45. package/lib/typescript/hooks/useQuantitySampleById.d.ts +5 -4
  46. package/lib/typescript/hooks/useStatisticsForQuantity.d.ts +2 -2
  47. package/lib/typescript/hooks/useSubscribeToQuantitySamples.d.ts +1 -1
  48. package/lib/typescript/modules.d.ts +2 -2
  49. package/lib/typescript/specs/CategoryTypeModule.nitro.d.ts +3 -3
  50. package/lib/typescript/specs/CoreModule.nitro.d.ts +15 -0
  51. package/lib/typescript/specs/QuantityTypeModule.nitro.d.ts +20 -9
  52. package/lib/typescript/type-tests/generated-typing.d.ts +1 -0
  53. package/lib/typescript/types/CategoryType.d.ts +10 -104
  54. package/lib/typescript/types/CategoryTypeIdentifier.d.ts +1 -61
  55. package/lib/typescript/types/CorrelationType.d.ts +8 -2
  56. package/lib/typescript/types/ElectrocardiogramSample.d.ts +8 -1
  57. package/lib/typescript/types/HeartbeatSeries.d.ts +8 -1
  58. package/lib/typescript/types/InterfaceVerification.d.ts +14 -1
  59. package/lib/typescript/types/Medication.d.ts +10 -0
  60. package/lib/typescript/types/MetadataEnums.d.ts +1 -0
  61. package/lib/typescript/types/QuantitySample.d.ts +9 -1
  62. package/lib/typescript/types/QuantityType.d.ts +14 -18
  63. package/lib/typescript/types/QuantityTypeIdentifier.d.ts +1 -671
  64. package/lib/typescript/types/QueryOptions.d.ts +8 -4
  65. package/lib/typescript/types/Shared.d.ts +12 -41
  66. package/lib/typescript/types/StateOfMind.d.ts +8 -1
  67. package/lib/typescript/types/Subscriptions.d.ts +11 -11
  68. package/lib/typescript/types/WeatherCondition.d.ts +1 -30
  69. package/lib/typescript/types/Workouts.d.ts +20 -104
  70. package/lib/typescript/types/index.d.ts +2 -0
  71. package/lib/typescript/utils/getMostRecentQuantitySample.d.ts +2 -1
  72. package/lib/typescript/utils/getMostRecentWorkout.d.ts +2 -1
  73. package/lib/typescript/utils/getPreferredUnit.d.ts +2 -1
  74. package/lib/typescript/utils/getQuantitySampleById.d.ts +2 -1
  75. package/lib/typescript/utils/subscribeToQuantitySamples.d.ts +1 -1
  76. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.hpp +55 -109
  77. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Umbrella.hpp +12 -18
  78. package/nitrogen/generated/ios/c++/HybridCategoryTypeModuleSpecSwift.hpp +5 -14
  79. package/nitrogen/generated/ios/c++/HybridCoreModuleSpecSwift.hpp +18 -2
  80. package/nitrogen/generated/ios/c++/HybridCorrelationTypeModuleSpecSwift.hpp +1 -13
  81. package/nitrogen/generated/ios/c++/HybridElectrocardiogramModuleSpecSwift.hpp +1 -13
  82. package/nitrogen/generated/ios/c++/HybridHeartbeatSeriesModuleSpecSwift.hpp +2 -14
  83. package/nitrogen/generated/ios/c++/HybridMedicationModuleSpecSwift.hpp +1 -13
  84. package/nitrogen/generated/ios/c++/HybridQuantityTypeModuleSpecSwift.hpp +19 -28
  85. package/nitrogen/generated/ios/c++/HybridStateOfMindModuleSpecSwift.hpp +2 -14
  86. package/nitrogen/generated/ios/c++/HybridWorkoutProxySpecSwift.hpp +3 -116
  87. package/nitrogen/generated/ios/swift/CategorySample.swift +4 -329
  88. package/nitrogen/generated/ios/swift/CategoryTypeIdentifier.swift +112 -108
  89. package/nitrogen/generated/ios/swift/CategoryTypeIdentifierWriteable.swift +292 -0
  90. package/nitrogen/generated/ios/swift/CorrelationSample.swift +4 -347
  91. package/nitrogen/generated/ios/swift/ElectrocardiogramSample.swift +4 -329
  92. package/nitrogen/generated/ios/swift/FilterForWorkouts.swift +30 -30
  93. package/nitrogen/generated/ios/swift/FilterForWorkoutsBase.swift +30 -30
  94. package/nitrogen/generated/ios/swift/GeneralForm.swift +4 -4
  95. package/nitrogen/generated/ios/swift/HeartbeatSeriesSample.swift +4 -329
  96. package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec.swift +1 -1
  97. package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec_cxx.swift +1 -1
  98. package/nitrogen/generated/ios/swift/HybridCoreModuleSpec.swift +2 -0
  99. package/nitrogen/generated/ios/swift/HybridCoreModuleSpec_cxx.swift +38 -0
  100. package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec.swift +6 -6
  101. package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec_cxx.swift +6 -6
  102. package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec.swift +1 -27
  103. package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec_cxx.swift +2 -340
  104. package/nitrogen/generated/ios/swift/MedicationDoseEvent.swift +4 -329
  105. package/nitrogen/generated/ios/swift/ObjectTypeIdentifier.swift +492 -492
  106. package/nitrogen/generated/ios/swift/QuantitySample.swift +4 -329
  107. package/nitrogen/generated/ios/swift/QuantityTypeIdentifier.swift +380 -384
  108. package/nitrogen/generated/ios/swift/QuantityTypeIdentifierWriteable.swift +372 -376
  109. package/nitrogen/generated/ios/swift/{QueryOptionsWithAnchorAndUnit.swift → QueryOptionsWithAnchorAndStringUnit.swift} +5 -5
  110. package/nitrogen/generated/ios/swift/{QueryOptionsWithSortOrderAndUnit.swift → QueryOptionsWithSortOrderAndStringUnit.swift} +5 -5
  111. package/nitrogen/generated/ios/swift/QueryStatisticsResponseFromSingleSource.swift +37 -37
  112. package/nitrogen/generated/ios/swift/SampleTypeIdentifier.swift +492 -492
  113. package/nitrogen/generated/ios/swift/SampleTypeIdentifierWriteable.swift +482 -486
  114. package/nitrogen/generated/ios/swift/StateOfMindSample.swift +4 -329
  115. package/nitrogen/generated/ios/swift/{StatisticsQueryOptions.swift → StatisticsQueryOptionsWithStringUnit.swift} +5 -5
  116. package/nitrogen/generated/ios/swift/WorkoutEvent.swift +20 -2
  117. package/nitrogen/generated/ios/swift/WorkoutSample.swift +4 -402
  118. package/nitrogen/generated/shared/c++/CategorySample.hpp +8 -100
  119. package/nitrogen/generated/shared/c++/CategoryTypeIdentifier.hpp +153 -149
  120. package/nitrogen/generated/shared/c++/CategoryTypeIdentifierWriteable.hpp +328 -0
  121. package/nitrogen/generated/shared/c++/CorrelationSample.hpp +9 -105
  122. package/nitrogen/generated/shared/c++/ElectrocardiogramSample.hpp +7 -99
  123. package/nitrogen/generated/shared/c++/FilterForWorkouts.hpp +13 -13
  124. package/nitrogen/generated/shared/c++/FilterForWorkoutsBase.hpp +13 -13
  125. package/nitrogen/generated/shared/c++/GeneralForm.hpp +7 -7
  126. package/nitrogen/generated/shared/c++/HeartbeatSeriesSample.hpp +8 -100
  127. package/nitrogen/generated/shared/c++/HybridCategoryTypeModuleSpec.hpp +5 -2
  128. package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.cpp +2 -0
  129. package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.hpp +4 -2
  130. package/nitrogen/generated/shared/c++/HybridQuantityTypeModuleSpec.hpp +15 -15
  131. package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.cpp +1 -27
  132. package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.hpp +2 -37
  133. package/nitrogen/generated/shared/c++/MedicationDoseEvent.hpp +7 -99
  134. package/nitrogen/generated/shared/c++/ObjectTypeIdentifier.hpp +565 -565
  135. package/nitrogen/generated/shared/c++/QuantitySample.hpp +8 -100
  136. package/nitrogen/generated/shared/c++/QuantityTypeIdentifier.hpp +407 -411
  137. package/nitrogen/generated/shared/c++/QuantityTypeIdentifierWriteable.hpp +398 -402
  138. package/nitrogen/generated/shared/c++/{QueryOptionsWithAnchorAndUnit.hpp → QueryOptionsWithAnchorAndStringUnit.hpp} +11 -11
  139. package/nitrogen/generated/shared/c++/{QueryOptionsWithSortOrderAndUnit.hpp → QueryOptionsWithSortOrderAndStringUnit.hpp} +11 -11
  140. package/nitrogen/generated/shared/c++/QueryStatisticsResponseFromSingleSource.hpp +12 -12
  141. package/nitrogen/generated/shared/c++/SampleTypeIdentifier.hpp +559 -559
  142. package/nitrogen/generated/shared/c++/SampleTypeIdentifierWriteable.hpp +541 -545
  143. package/nitrogen/generated/shared/c++/StateOfMindSample.hpp +8 -100
  144. package/nitrogen/generated/shared/c++/{StatisticsQueryOptions.hpp → StatisticsQueryOptionsWithStringUnit.hpp} +11 -11
  145. package/nitrogen/generated/shared/c++/WorkoutEvent.hpp +8 -2
  146. package/nitrogen/generated/shared/c++/WorkoutSample.hpp +7 -120
  147. package/package.json +5 -2
  148. package/src/generated/healthkit-schema.json +3680 -0
  149. package/src/generated/healthkit.generated.ts +1307 -0
  150. package/src/healthkit.ios.ts +225 -19
  151. package/src/healthkit.ts +181 -55
  152. package/src/hooks/useMostRecentQuantitySample.ts +6 -5
  153. package/src/hooks/useMostRecentWorkout.ts +2 -2
  154. package/src/hooks/useQuantitySampleById.ts +6 -5
  155. package/src/hooks/useStatisticsForQuantity.ts +2 -1
  156. package/src/hooks/useSubscribeToQuantitySamples.ts +1 -1
  157. package/src/modules.ts +7 -2
  158. package/src/specs/CategoryTypeModule.nitro.ts +8 -5
  159. package/src/specs/CoreModule.nitro.ts +20 -0
  160. package/src/specs/QuantityTypeModule.nitro.ts +81 -7
  161. package/src/test-setup.ts +2 -0
  162. package/src/type-tests/generated-typing.ts +133 -0
  163. package/src/types/CategoryType.ts +52 -148
  164. package/src/types/CategoryTypeIdentifier.ts +5 -134
  165. package/src/types/CorrelationType.ts +13 -3
  166. package/src/types/ElectrocardiogramSample.ts +13 -1
  167. package/src/types/HeartbeatSeries.ts +13 -1
  168. package/src/types/InterfaceVerification.ts +38 -1
  169. package/src/types/Medication.ts +19 -0
  170. package/src/types/MetadataEnums.ts +15 -0
  171. package/src/types/QuantitySample.ts +14 -2
  172. package/src/types/QuantityType.ts +22 -122
  173. package/src/types/QuantityTypeIdentifier.ts +5 -772
  174. package/src/types/QueryOptions.ts +11 -4
  175. package/src/types/Shared.ts +22 -49
  176. package/src/types/StateOfMind.ts +13 -1
  177. package/src/types/Subscriptions.ts +19 -13
  178. package/src/types/WeatherCondition.ts +1 -31
  179. package/src/types/Workouts.ts +46 -108
  180. package/src/types/index.ts +2 -0
  181. package/src/utils/getMostRecentQuantitySample.ts +4 -3
  182. package/src/utils/getMostRecentWorkout.ts +5 -2
  183. package/src/utils/getPreferredUnit.ts +5 -4
  184. package/src/utils/getQuantitySampleById.ts +4 -3
  185. package/src/utils/subscribeToQuantitySamples.ts +5 -3
  186. package/nitrogen/generated/ios/swift/HeartRateMotionContext.swift +0 -44
  187. package/nitrogen/generated/ios/swift/InsulinDeliveryReason.swift +0 -40
  188. package/nitrogen/generated/ios/swift/WeatherCondition.swift +0 -144
  189. package/nitrogen/generated/shared/c++/HeartRateMotionContext.hpp +0 -67
  190. package/nitrogen/generated/shared/c++/InsulinDeliveryReason.hpp +0 -62
  191. package/nitrogen/generated/shared/c++/WeatherCondition.hpp +0 -88
@@ -1,144 +0,0 @@
1
- ///
2
- /// WeatherCondition.swift
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © Marc Rousavy @ Margelo
6
- ///
7
-
8
- /**
9
- * Represents the JS enum `WeatherCondition`, backed by a C++ enum.
10
- */
11
- public typealias WeatherCondition = margelo.nitro.healthkit.WeatherCondition
12
-
13
- public extension WeatherCondition {
14
- /**
15
- * Get a WeatherCondition for the given String value, or
16
- * return `nil` if the given value was invalid/unknown.
17
- */
18
- init?(fromString string: String) {
19
- switch string {
20
- case "none":
21
- self = .none
22
- case "clear":
23
- self = .clear
24
- case "fair":
25
- self = .fair
26
- case "partlyCloudy":
27
- self = .partlycloudy
28
- case "mostlyCloudy":
29
- self = .mostlycloudy
30
- case "cloudy":
31
- self = .cloudy
32
- case "foggy":
33
- self = .foggy
34
- case "haze":
35
- self = .haze
36
- case "windy":
37
- self = .windy
38
- case "blustery":
39
- self = .blustery
40
- case "smoky":
41
- self = .smoky
42
- case "dust":
43
- self = .dust
44
- case "snow":
45
- self = .snow
46
- case "hail":
47
- self = .hail
48
- case "sleet":
49
- self = .sleet
50
- case "freezingDrizzle":
51
- self = .freezingdrizzle
52
- case "freezingRain":
53
- self = .freezingrain
54
- case "mixedRainAndHail":
55
- self = .mixedrainandhail
56
- case "mixedRainAndSnow":
57
- self = .mixedrainandsnow
58
- case "mixedRainAndSleet":
59
- self = .mixedrainandsleet
60
- case "mixedSnowAndSleet":
61
- self = .mixedsnowandsleet
62
- case "drizzle":
63
- self = .drizzle
64
- case "scatteredShowers":
65
- self = .scatteredshowers
66
- case "showers":
67
- self = .showers
68
- case "thunderstorms":
69
- self = .thunderstorms
70
- case "tropicalStorm":
71
- self = .tropicalstorm
72
- case "hurricane":
73
- self = .hurricane
74
- case "tornado":
75
- self = .tornado
76
- default:
77
- return nil
78
- }
79
- }
80
-
81
- /**
82
- * Get the String value this WeatherCondition represents.
83
- */
84
- var stringValue: String {
85
- switch self {
86
- case .none:
87
- return "none"
88
- case .clear:
89
- return "clear"
90
- case .fair:
91
- return "fair"
92
- case .partlycloudy:
93
- return "partlyCloudy"
94
- case .mostlycloudy:
95
- return "mostlyCloudy"
96
- case .cloudy:
97
- return "cloudy"
98
- case .foggy:
99
- return "foggy"
100
- case .haze:
101
- return "haze"
102
- case .windy:
103
- return "windy"
104
- case .blustery:
105
- return "blustery"
106
- case .smoky:
107
- return "smoky"
108
- case .dust:
109
- return "dust"
110
- case .snow:
111
- return "snow"
112
- case .hail:
113
- return "hail"
114
- case .sleet:
115
- return "sleet"
116
- case .freezingdrizzle:
117
- return "freezingDrizzle"
118
- case .freezingrain:
119
- return "freezingRain"
120
- case .mixedrainandhail:
121
- return "mixedRainAndHail"
122
- case .mixedrainandsnow:
123
- return "mixedRainAndSnow"
124
- case .mixedrainandsleet:
125
- return "mixedRainAndSleet"
126
- case .mixedsnowandsleet:
127
- return "mixedSnowAndSleet"
128
- case .drizzle:
129
- return "drizzle"
130
- case .scatteredshowers:
131
- return "scatteredShowers"
132
- case .showers:
133
- return "showers"
134
- case .thunderstorms:
135
- return "thunderstorms"
136
- case .tropicalstorm:
137
- return "tropicalStorm"
138
- case .hurricane:
139
- return "hurricane"
140
- case .tornado:
141
- return "tornado"
142
- }
143
- }
144
- }
@@ -1,67 +0,0 @@
1
- ///
2
- /// HeartRateMotionContext.hpp
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 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
- namespace margelo::nitro::healthkit {
22
-
23
- /**
24
- * An enum which can be represented as a JavaScript enum (HeartRateMotionContext).
25
- */
26
- enum class HeartRateMotionContext {
27
- ACTIVE SWIFT_NAME(active) = 2,
28
- NOTSET SWIFT_NAME(notset) = 0,
29
- SEDENTARY SWIFT_NAME(sedentary) = 1,
30
- } CLOSED_ENUM;
31
-
32
- } // namespace margelo::nitro::healthkit
33
-
34
- namespace margelo::nitro {
35
-
36
- // C++ HeartRateMotionContext <> JS HeartRateMotionContext (enum)
37
- template <>
38
- struct JSIConverter<margelo::nitro::healthkit::HeartRateMotionContext> final {
39
- static inline margelo::nitro::healthkit::HeartRateMotionContext fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
40
- int enumValue = JSIConverter<int>::fromJSI(runtime, arg);
41
- return static_cast<margelo::nitro::healthkit::HeartRateMotionContext>(enumValue);
42
- }
43
- static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::healthkit::HeartRateMotionContext arg) {
44
- int enumValue = static_cast<int>(arg);
45
- return JSIConverter<int>::toJSI(runtime, enumValue);
46
- }
47
- static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) {
48
- if (!value.isNumber()) {
49
- return false;
50
- }
51
- double number = value.getNumber();
52
- int integer = static_cast<int>(number);
53
- if (number != integer) {
54
- // The integer is not the same value as the double - we truncated floating points.
55
- // Enums are all integers, so the input floating point number is obviously invalid.
56
- return false;
57
- }
58
- switch (integer) {
59
- case 2 /* ACTIVE */: return true;
60
- case 0 /* NOTSET */: return true;
61
- case 1 /* SEDENTARY */: return true;
62
- default: return false;
63
- }
64
- }
65
- };
66
-
67
- } // namespace margelo::nitro
@@ -1,62 +0,0 @@
1
- ///
2
- /// InsulinDeliveryReason.hpp
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 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
- namespace margelo::nitro::healthkit {
22
-
23
- /**
24
- * An enum which can be represented as a JavaScript enum (InsulinDeliveryReason).
25
- */
26
- enum class InsulinDeliveryReason {
27
- BASAL SWIFT_NAME(basal) = 1,
28
- BOLUS SWIFT_NAME(bolus) = 2,
29
- } CLOSED_ENUM;
30
-
31
- } // namespace margelo::nitro::healthkit
32
-
33
- namespace margelo::nitro {
34
-
35
- // C++ InsulinDeliveryReason <> JS InsulinDeliveryReason (enum)
36
- template <>
37
- struct JSIConverter<margelo::nitro::healthkit::InsulinDeliveryReason> final {
38
- static inline margelo::nitro::healthkit::InsulinDeliveryReason fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
39
- int enumValue = JSIConverter<int>::fromJSI(runtime, arg);
40
- return static_cast<margelo::nitro::healthkit::InsulinDeliveryReason>(enumValue);
41
- }
42
- static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::healthkit::InsulinDeliveryReason arg) {
43
- int enumValue = static_cast<int>(arg);
44
- return JSIConverter<int>::toJSI(runtime, enumValue);
45
- }
46
- static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) {
47
- if (!value.isNumber()) {
48
- return false;
49
- }
50
- double number = value.getNumber();
51
- int integer = static_cast<int>(number);
52
- if (number != integer) {
53
- // The integer is not the same value as the double - we truncated floating points.
54
- // Enums are all integers, so the input floating point number is obviously invalid.
55
- return false;
56
- }
57
- // Check if we are within the bounds of the enum.
58
- return integer >= 1 && integer <= 2;
59
- }
60
- };
61
-
62
- } // namespace margelo::nitro
@@ -1,88 +0,0 @@
1
- ///
2
- /// WeatherCondition.hpp
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 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
- namespace margelo::nitro::healthkit {
22
-
23
- /**
24
- * An enum which can be represented as a JavaScript enum (WeatherCondition).
25
- */
26
- enum class WeatherCondition {
27
- NONE SWIFT_NAME(none) = 0,
28
- CLEAR SWIFT_NAME(clear) = 1,
29
- FAIR SWIFT_NAME(fair) = 2,
30
- PARTLYCLOUDY SWIFT_NAME(partlycloudy) = 3,
31
- MOSTLYCLOUDY SWIFT_NAME(mostlycloudy) = 4,
32
- CLOUDY SWIFT_NAME(cloudy) = 5,
33
- FOGGY SWIFT_NAME(foggy) = 6,
34
- HAZE SWIFT_NAME(haze) = 7,
35
- WINDY SWIFT_NAME(windy) = 8,
36
- BLUSTERY SWIFT_NAME(blustery) = 9,
37
- SMOKY SWIFT_NAME(smoky) = 10,
38
- DUST SWIFT_NAME(dust) = 11,
39
- SNOW SWIFT_NAME(snow) = 12,
40
- HAIL SWIFT_NAME(hail) = 13,
41
- SLEET SWIFT_NAME(sleet) = 14,
42
- FREEZINGDRIZZLE SWIFT_NAME(freezingdrizzle) = 15,
43
- FREEZINGRAIN SWIFT_NAME(freezingrain) = 16,
44
- MIXEDRAINANDHAIL SWIFT_NAME(mixedrainandhail) = 17,
45
- MIXEDRAINANDSNOW SWIFT_NAME(mixedrainandsnow) = 18,
46
- MIXEDRAINANDSLEET SWIFT_NAME(mixedrainandsleet) = 19,
47
- MIXEDSNOWANDSLEET SWIFT_NAME(mixedsnowandsleet) = 20,
48
- DRIZZLE SWIFT_NAME(drizzle) = 21,
49
- SCATTEREDSHOWERS SWIFT_NAME(scatteredshowers) = 22,
50
- SHOWERS SWIFT_NAME(showers) = 23,
51
- THUNDERSTORMS SWIFT_NAME(thunderstorms) = 24,
52
- TROPICALSTORM SWIFT_NAME(tropicalstorm) = 25,
53
- HURRICANE SWIFT_NAME(hurricane) = 26,
54
- TORNADO SWIFT_NAME(tornado) = 27,
55
- } CLOSED_ENUM;
56
-
57
- } // namespace margelo::nitro::healthkit
58
-
59
- namespace margelo::nitro {
60
-
61
- // C++ WeatherCondition <> JS WeatherCondition (enum)
62
- template <>
63
- struct JSIConverter<margelo::nitro::healthkit::WeatherCondition> final {
64
- static inline margelo::nitro::healthkit::WeatherCondition fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
65
- int enumValue = JSIConverter<int>::fromJSI(runtime, arg);
66
- return static_cast<margelo::nitro::healthkit::WeatherCondition>(enumValue);
67
- }
68
- static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::healthkit::WeatherCondition arg) {
69
- int enumValue = static_cast<int>(arg);
70
- return JSIConverter<int>::toJSI(runtime, enumValue);
71
- }
72
- static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) {
73
- if (!value.isNumber()) {
74
- return false;
75
- }
76
- double number = value.getNumber();
77
- int integer = static_cast<int>(number);
78
- if (number != integer) {
79
- // The integer is not the same value as the double - we truncated floating points.
80
- // Enums are all integers, so the input floating point number is obviously invalid.
81
- return false;
82
- }
83
- // Check if we are within the bounds of the enum.
84
- return integer >= 0 && integer <= 27;
85
- }
86
- };
87
-
88
- } // namespace margelo::nitro