react-native-nitro-geolocation 1.1.4 → 1.2.1

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 (186) hide show
  1. package/README.md +97 -9
  2. package/android/build.gradle +6 -0
  3. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidAccuracy.kt +105 -0
  4. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidHeadingManager.kt +313 -0
  5. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidLocationSettings.kt +313 -0
  6. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/GetCurrentPosition.kt +46 -45
  7. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/LocationMetadata.kt +26 -0
  8. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/LocationValues.kt +31 -0
  9. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/NitroGeolocation.kt +1027 -140
  10. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/NitroGeolocationCompat.kt +11 -11
  11. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/RequestAuthorization.kt +6 -6
  12. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/WatchPosition.kt +46 -45
  13. package/ios/CLLocation+GeolocationMetadata.swift +32 -0
  14. package/ios/LocationManager.swift +205 -51
  15. package/ios/NitroGeolocation.swift +949 -110
  16. package/ios/NitroGeolocationCompat.swift +7 -7
  17. package/nitrogen/generated/android/c++/JAccuracyAuthorization.hpp +61 -0
  18. package/nitrogen/generated/android/c++/JAndroidAccuracyPreset.hpp +64 -0
  19. package/nitrogen/generated/android/c++/JAndroidGranularity.hpp +61 -0
  20. package/nitrogen/generated/android/c++/{JRNConfigurationInternal.hpp → JCompatGeolocationConfigurationInternal.hpp} +10 -10
  21. package/nitrogen/generated/android/c++/{JGeolocationError.hpp → JCompatGeolocationError.hpp} +10 -10
  22. package/nitrogen/generated/android/c++/JCompatGeolocationOptions.hpp +105 -0
  23. package/nitrogen/generated/android/c++/JCompatGeolocationResponse.hpp +67 -0
  24. package/nitrogen/generated/android/c++/JFunc_void_AccuracyAuthorization.hpp +77 -0
  25. package/nitrogen/generated/android/c++/JFunc_void_CompatGeolocationError.hpp +78 -0
  26. package/nitrogen/generated/android/c++/JFunc_void_CompatGeolocationResponse.hpp +84 -0
  27. package/nitrogen/generated/android/c++/JFunc_void_GeolocationResponse.hpp +2 -0
  28. package/nitrogen/generated/android/c++/JFunc_void_Heading.hpp +78 -0
  29. package/nitrogen/generated/android/c++/JFunc_void_LocationProviderStatus.hpp +78 -0
  30. package/nitrogen/generated/android/c++/JFunc_void_PermissionStatus.hpp +77 -0
  31. package/nitrogen/generated/android/c++/JFunc_void_std__vector_GeocodedLocation_.hpp +97 -0
  32. package/nitrogen/generated/android/c++/JFunc_void_std__vector_ReverseGeocodedAddress_.hpp +98 -0
  33. package/nitrogen/generated/android/c++/JGeocodedLocation.hpp +65 -0
  34. package/nitrogen/generated/android/c++/JGeocodingCoordinates.hpp +61 -0
  35. package/nitrogen/generated/android/c++/{JModernGeolocationConfiguration.hpp → JGeolocationConfiguration.hpp} +10 -10
  36. package/nitrogen/generated/android/c++/JGeolocationResponse.hpp +13 -3
  37. package/nitrogen/generated/android/c++/JHeading.hpp +69 -0
  38. package/nitrogen/generated/android/c++/JHeadingOptions.hpp +57 -0
  39. package/nitrogen/generated/android/c++/JHybridNitroGeolocationCompatSpec.cpp +46 -30
  40. package/nitrogen/generated/android/c++/JHybridNitroGeolocationCompatSpec.hpp +4 -4
  41. package/nitrogen/generated/android/c++/JHybridNitroGeolocationSpec.cpp +169 -33
  42. package/nitrogen/generated/android/c++/JHybridNitroGeolocationSpec.hpp +14 -3
  43. package/nitrogen/generated/android/c++/JIOSAccuracyPreset.hpp +73 -0
  44. package/nitrogen/generated/android/c++/JIOSActivityType.hpp +67 -0
  45. package/nitrogen/generated/android/c++/JLocationAccuracyOptions.hpp +65 -0
  46. package/nitrogen/generated/android/c++/JLocationAvailability.hpp +62 -0
  47. package/nitrogen/generated/android/c++/JLocationProviderStatus.hpp +77 -0
  48. package/nitrogen/generated/android/c++/JLocationProviderUsed.hpp +67 -0
  49. package/nitrogen/generated/android/c++/JLocationRequestOptions.hpp +49 -3
  50. package/nitrogen/generated/android/c++/{JGeolocationOptions.hpp → JLocationSettingsOptions.hpp} +28 -22
  51. package/nitrogen/generated/android/c++/JReverseGeocodedAddress.hpp +82 -0
  52. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/AccuracyAuthorization.kt +24 -0
  53. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/AndroidAccuracyPreset.kt +25 -0
  54. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/AndroidGranularity.kt +24 -0
  55. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/{RNConfigurationInternal.kt → CompatGeolocationConfigurationInternal.kt} +5 -5
  56. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/{GeolocationError.kt → CompatGeolocationError.kt} +5 -5
  57. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/CompatGeolocationOptions.kt +68 -0
  58. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/CompatGeolocationResponse.kt +41 -0
  59. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_AccuracyAuthorization.kt +80 -0
  60. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/{Func_void_GeolocationError.kt → Func_void_CompatGeolocationError.kt} +9 -9
  61. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_CompatGeolocationResponse.kt +80 -0
  62. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_Heading.kt +80 -0
  63. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_LocationProviderStatus.kt +80 -0
  64. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_PermissionStatus.kt +80 -0
  65. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_std__vector_GeocodedLocation_.kt +80 -0
  66. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_std__vector_ReverseGeocodedAddress_.kt +80 -0
  67. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeocodedLocation.kt +44 -0
  68. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeocodingCoordinates.kt +41 -0
  69. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/{ModernGeolocationConfiguration.kt → GeolocationConfiguration.kt} +5 -5
  70. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeolocationResponse.kt +9 -3
  71. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Heading.kt +47 -0
  72. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/HeadingOptions.kt +38 -0
  73. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/HybridNitroGeolocationCompatSpec.kt +7 -7
  74. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/HybridNitroGeolocationSpec.kt +92 -3
  75. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/IOSAccuracyPreset.kt +28 -0
  76. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/IOSActivityType.kt +26 -0
  77. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationAccuracyOptions.kt +41 -0
  78. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationAvailability.kt +41 -0
  79. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationProviderStatus.kt +53 -0
  80. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationProviderUsed.kt +26 -0
  81. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationRequestOptions.kt +30 -3
  82. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/{GeolocationOptions.kt → LocationSettingsOptions.kt} +11 -11
  83. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/ReverseGeocodedAddress.kt +56 -0
  84. package/nitrogen/generated/android/nitrogeolocationOnLoad.cpp +18 -4
  85. package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Bridge.cpp +76 -12
  86. package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Bridge.hpp +519 -77
  87. package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Umbrella.hpp +61 -12
  88. package/nitrogen/generated/ios/c++/HybridNitroGeolocationCompatSpecSwift.hpp +28 -16
  89. package/nitrogen/generated/ios/c++/HybridNitroGeolocationSpecSwift.hpp +131 -13
  90. package/nitrogen/generated/ios/swift/AccuracyAuthorization.swift +44 -0
  91. package/nitrogen/generated/ios/swift/AndroidAccuracyPreset.swift +48 -0
  92. package/nitrogen/generated/ios/swift/AndroidGranularity.swift +44 -0
  93. package/nitrogen/generated/ios/swift/{RNConfigurationInternal.swift → CompatGeolocationConfigurationInternal.swift} +5 -5
  94. package/nitrogen/generated/ios/swift/{GeolocationError.swift → CompatGeolocationError.swift} +5 -5
  95. package/nitrogen/generated/ios/swift/CompatGeolocationOptions.swift +208 -0
  96. package/nitrogen/generated/ios/swift/CompatGeolocationResponse.swift +34 -0
  97. package/nitrogen/generated/ios/swift/Func_void_AccuracyAuthorization.swift +46 -0
  98. package/nitrogen/generated/ios/swift/Func_void_CompatGeolocationError.swift +46 -0
  99. package/nitrogen/generated/ios/swift/Func_void_CompatGeolocationResponse.swift +46 -0
  100. package/nitrogen/generated/ios/swift/{Func_void_GeolocationError.swift → Func_void_Heading.swift} +11 -11
  101. package/nitrogen/generated/ios/swift/Func_void_LocationAvailability.swift +46 -0
  102. package/nitrogen/generated/ios/swift/Func_void_LocationProviderStatus.swift +46 -0
  103. package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
  104. package/nitrogen/generated/ios/swift/Func_void_std__vector_GeocodedLocation_.swift +46 -0
  105. package/nitrogen/generated/ios/swift/Func_void_std__vector_ReverseGeocodedAddress_.swift +46 -0
  106. package/nitrogen/generated/ios/swift/GeocodedLocation.swift +52 -0
  107. package/nitrogen/generated/ios/swift/GeocodingCoordinates.swift +34 -0
  108. package/nitrogen/generated/ios/swift/{ModernGeolocationConfiguration.swift → GeolocationConfiguration.swift} +5 -5
  109. package/nitrogen/generated/ios/swift/GeolocationResponse.swift +31 -2
  110. package/nitrogen/generated/ios/swift/Heading.swift +70 -0
  111. package/nitrogen/generated/ios/swift/HeadingOptions.swift +42 -0
  112. package/nitrogen/generated/ios/swift/HybridNitroGeolocationCompatSpec.swift +4 -4
  113. package/nitrogen/generated/ios/swift/HybridNitroGeolocationCompatSpec_cxx.swift +28 -28
  114. package/nitrogen/generated/ios/swift/HybridNitroGeolocationSpec.swift +14 -3
  115. package/nitrogen/generated/ios/swift/HybridNitroGeolocationSpec_cxx.swift +318 -15
  116. package/nitrogen/generated/ios/swift/IOSAccuracyPreset.swift +60 -0
  117. package/nitrogen/generated/ios/swift/IOSActivityType.swift +52 -0
  118. package/nitrogen/generated/ios/swift/LocationAccuracyOptions.swift +46 -0
  119. package/nitrogen/generated/ios/swift/LocationAvailability.swift +47 -0
  120. package/nitrogen/generated/ios/swift/LocationProviderStatus.swift +106 -0
  121. package/nitrogen/generated/ios/swift/LocationProviderUsed.swift +52 -0
  122. package/nitrogen/generated/ios/swift/LocationRequestOptions.swift +142 -1
  123. package/nitrogen/generated/ios/swift/{GeolocationOptions.swift → LocationSettingsOptions.swift} +39 -46
  124. package/nitrogen/generated/ios/swift/ReverseGeocodedAddress.swift +150 -0
  125. package/nitrogen/generated/shared/c++/AccuracyAuthorization.hpp +80 -0
  126. package/nitrogen/generated/shared/c++/AndroidAccuracyPreset.hpp +84 -0
  127. package/nitrogen/generated/shared/c++/AndroidGranularity.hpp +80 -0
  128. package/nitrogen/generated/shared/c++/{RNConfigurationInternal.hpp → CompatGeolocationConfigurationInternal.hpp} +11 -11
  129. package/nitrogen/generated/shared/c++/{GeolocationError.hpp → CompatGeolocationError.hpp} +11 -11
  130. package/nitrogen/generated/shared/c++/CompatGeolocationOptions.hpp +128 -0
  131. package/nitrogen/generated/shared/c++/CompatGeolocationResponse.hpp +88 -0
  132. package/nitrogen/generated/shared/c++/GeocodedLocation.hpp +91 -0
  133. package/nitrogen/generated/shared/c++/GeocodingCoordinates.hpp +87 -0
  134. package/nitrogen/generated/shared/c++/{ModernGeolocationConfiguration.hpp → GeolocationConfiguration.hpp} +11 -11
  135. package/nitrogen/generated/shared/c++/GeolocationResponse.hpp +14 -2
  136. package/nitrogen/generated/shared/c++/Heading.hpp +95 -0
  137. package/nitrogen/generated/shared/c++/HeadingOptions.hpp +83 -0
  138. package/nitrogen/generated/shared/c++/HybridNitroGeolocationCompatSpec.hpp +16 -16
  139. package/nitrogen/generated/shared/c++/HybridNitroGeolocationSpec.cpp +11 -0
  140. package/nitrogen/generated/shared/c++/HybridNitroGeolocationSpec.hpp +51 -12
  141. package/nitrogen/generated/shared/c++/IOSAccuracyPreset.hpp +96 -0
  142. package/nitrogen/generated/shared/c++/IOSActivityType.hpp +88 -0
  143. package/nitrogen/generated/shared/c++/LocationAccuracyOptions.hpp +92 -0
  144. package/nitrogen/generated/shared/c++/LocationAvailability.hpp +88 -0
  145. package/nitrogen/generated/shared/c++/LocationProviderStatus.hpp +103 -0
  146. package/nitrogen/generated/shared/c++/LocationProviderUsed.hpp +88 -0
  147. package/nitrogen/generated/shared/c++/LocationRequestOptions.hpp +47 -3
  148. package/nitrogen/generated/shared/c++/{GeolocationOptions.hpp → LocationSettingsOptions.hpp} +26 -24
  149. package/nitrogen/generated/shared/c++/ReverseGeocodedAddress.hpp +108 -0
  150. package/package.json +1 -1
  151. package/src/NitroGeolocation.nitro.ts +292 -18
  152. package/src/NitroGeolocationCompat.nitro.ts +12 -12
  153. package/src/api/geocode.ts +18 -0
  154. package/src/api/getAccuracyAuthorization.ts +12 -0
  155. package/src/api/getCurrentPosition.ts +5 -3
  156. package/src/api/getHeading.ts +13 -0
  157. package/src/api/getLastKnownPosition.ts +28 -0
  158. package/src/api/getLocationAvailability.ts +11 -0
  159. package/src/api/getProviderStatus.ts +16 -0
  160. package/src/api/hasServicesEnabled.ts +13 -0
  161. package/src/api/index.ts +11 -0
  162. package/src/api/requestLocationSettings.ts +29 -0
  163. package/src/api/requestPermission.ts +3 -1
  164. package/src/api/requestTemporaryFullAccuracy.ts +21 -0
  165. package/src/api/reverseGeocode.ts +23 -0
  166. package/src/api/setConfiguration.ts +8 -4
  167. package/src/api/watchHeading.ts +19 -0
  168. package/src/api/watchPosition.ts +2 -2
  169. package/src/compat/getCurrentPosition.ts +7 -7
  170. package/src/compat/index.tsx +5 -5
  171. package/src/compat/requestAuthorization.ts +2 -2
  172. package/src/compat/setRNConfiguration.ts +7 -5
  173. package/src/compat/watchPosition.ts +7 -7
  174. package/src/devtools/getCurrentPosition.ts +5 -3
  175. package/src/devtools/index.ts +1 -1
  176. package/src/devtools/watchPosition.ts +6 -7
  177. package/src/hooks/useWatchPosition.ts +2 -2
  178. package/src/index.tsx +35 -6
  179. package/src/publicTypes.ts +108 -0
  180. package/src/types.ts +113 -37
  181. package/src/utils/errors.test.ts +65 -0
  182. package/src/utils/errors.ts +45 -18
  183. package/src/utils/index.ts +2 -2
  184. package/src/utils/provider.test.ts +172 -1
  185. package/src/utils/provider.ts +50 -5
  186. package/nitrogen/generated/android/c++/JFunc_void_GeolocationError.hpp +0 -78
@@ -0,0 +1,92 @@
1
+ ///
2
+ /// LocationAccuracyOptions.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
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+ // Forward declaration of `AndroidAccuracyPreset` to properly resolve imports.
32
+ namespace margelo::nitro::nitrogeolocation { enum class AndroidAccuracyPreset; }
33
+ // Forward declaration of `IOSAccuracyPreset` to properly resolve imports.
34
+ namespace margelo::nitro::nitrogeolocation { enum class IOSAccuracyPreset; }
35
+
36
+ #include "AndroidAccuracyPreset.hpp"
37
+ #include <optional>
38
+ #include "IOSAccuracyPreset.hpp"
39
+
40
+ namespace margelo::nitro::nitrogeolocation {
41
+
42
+ /**
43
+ * A struct which can be represented as a JavaScript object (LocationAccuracyOptions).
44
+ */
45
+ struct LocationAccuracyOptions final {
46
+ public:
47
+ std::optional<AndroidAccuracyPreset> android SWIFT_PRIVATE;
48
+ std::optional<IOSAccuracyPreset> ios SWIFT_PRIVATE;
49
+
50
+ public:
51
+ LocationAccuracyOptions() = default;
52
+ explicit LocationAccuracyOptions(std::optional<AndroidAccuracyPreset> android, std::optional<IOSAccuracyPreset> ios): android(android), ios(ios) {}
53
+
54
+ public:
55
+ friend bool operator==(const LocationAccuracyOptions& lhs, const LocationAccuracyOptions& rhs) = default;
56
+ };
57
+
58
+ } // namespace margelo::nitro::nitrogeolocation
59
+
60
+ namespace margelo::nitro {
61
+
62
+ // C++ LocationAccuracyOptions <> JS LocationAccuracyOptions (object)
63
+ template <>
64
+ struct JSIConverter<margelo::nitro::nitrogeolocation::LocationAccuracyOptions> final {
65
+ static inline margelo::nitro::nitrogeolocation::LocationAccuracyOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
66
+ jsi::Object obj = arg.asObject(runtime);
67
+ return margelo::nitro::nitrogeolocation::LocationAccuracyOptions(
68
+ JSIConverter<std::optional<margelo::nitro::nitrogeolocation::AndroidAccuracyPreset>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "android"))),
69
+ JSIConverter<std::optional<margelo::nitro::nitrogeolocation::IOSAccuracyPreset>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "ios")))
70
+ );
71
+ }
72
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::LocationAccuracyOptions& arg) {
73
+ jsi::Object obj(runtime);
74
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "android"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::AndroidAccuracyPreset>>::toJSI(runtime, arg.android));
75
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "ios"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::IOSAccuracyPreset>>::toJSI(runtime, arg.ios));
76
+ return obj;
77
+ }
78
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
79
+ if (!value.isObject()) {
80
+ return false;
81
+ }
82
+ jsi::Object obj = value.getObject(runtime);
83
+ if (!nitro::isPlainObject(runtime, obj)) {
84
+ return false;
85
+ }
86
+ if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::AndroidAccuracyPreset>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "android")))) return false;
87
+ if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::IOSAccuracyPreset>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "ios")))) return false;
88
+ return true;
89
+ }
90
+ };
91
+
92
+ } // namespace margelo::nitro
@@ -0,0 +1,88 @@
1
+ ///
2
+ /// LocationAvailability.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
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+
32
+
33
+ #include <string>
34
+ #include <optional>
35
+
36
+ namespace margelo::nitro::nitrogeolocation {
37
+
38
+ /**
39
+ * A struct which can be represented as a JavaScript object (LocationAvailability).
40
+ */
41
+ struct LocationAvailability final {
42
+ public:
43
+ bool available SWIFT_PRIVATE;
44
+ std::optional<std::string> reason SWIFT_PRIVATE;
45
+
46
+ public:
47
+ LocationAvailability() = default;
48
+ explicit LocationAvailability(bool available, std::optional<std::string> reason): available(available), reason(reason) {}
49
+
50
+ public:
51
+ friend bool operator==(const LocationAvailability& lhs, const LocationAvailability& rhs) = default;
52
+ };
53
+
54
+ } // namespace margelo::nitro::nitrogeolocation
55
+
56
+ namespace margelo::nitro {
57
+
58
+ // C++ LocationAvailability <> JS LocationAvailability (object)
59
+ template <>
60
+ struct JSIConverter<margelo::nitro::nitrogeolocation::LocationAvailability> final {
61
+ static inline margelo::nitro::nitrogeolocation::LocationAvailability fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
62
+ jsi::Object obj = arg.asObject(runtime);
63
+ return margelo::nitro::nitrogeolocation::LocationAvailability(
64
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "available"))),
65
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "reason")))
66
+ );
67
+ }
68
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::LocationAvailability& arg) {
69
+ jsi::Object obj(runtime);
70
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "available"), JSIConverter<bool>::toJSI(runtime, arg.available));
71
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "reason"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.reason));
72
+ return obj;
73
+ }
74
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
75
+ if (!value.isObject()) {
76
+ return false;
77
+ }
78
+ jsi::Object obj = value.getObject(runtime);
79
+ if (!nitro::isPlainObject(runtime, obj)) {
80
+ return false;
81
+ }
82
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "available")))) return false;
83
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "reason")))) return false;
84
+ return true;
85
+ }
86
+ };
87
+
88
+ } // namespace margelo::nitro
@@ -0,0 +1,103 @@
1
+ ///
2
+ /// LocationProviderStatus.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
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+
32
+
33
+ #include <optional>
34
+
35
+ namespace margelo::nitro::nitrogeolocation {
36
+
37
+ /**
38
+ * A struct which can be represented as a JavaScript object (LocationProviderStatus).
39
+ */
40
+ struct LocationProviderStatus final {
41
+ public:
42
+ bool locationServicesEnabled SWIFT_PRIVATE;
43
+ bool backgroundModeEnabled SWIFT_PRIVATE;
44
+ std::optional<bool> gpsAvailable SWIFT_PRIVATE;
45
+ std::optional<bool> networkAvailable SWIFT_PRIVATE;
46
+ std::optional<bool> passiveAvailable SWIFT_PRIVATE;
47
+ std::optional<bool> googleLocationAccuracyEnabled SWIFT_PRIVATE;
48
+
49
+ public:
50
+ LocationProviderStatus() = default;
51
+ explicit LocationProviderStatus(bool locationServicesEnabled, bool backgroundModeEnabled, std::optional<bool> gpsAvailable, std::optional<bool> networkAvailable, std::optional<bool> passiveAvailable, std::optional<bool> googleLocationAccuracyEnabled): locationServicesEnabled(locationServicesEnabled), backgroundModeEnabled(backgroundModeEnabled), gpsAvailable(gpsAvailable), networkAvailable(networkAvailable), passiveAvailable(passiveAvailable), googleLocationAccuracyEnabled(googleLocationAccuracyEnabled) {}
52
+
53
+ public:
54
+ friend bool operator==(const LocationProviderStatus& lhs, const LocationProviderStatus& rhs) = default;
55
+ };
56
+
57
+ } // namespace margelo::nitro::nitrogeolocation
58
+
59
+ namespace margelo::nitro {
60
+
61
+ // C++ LocationProviderStatus <> JS LocationProviderStatus (object)
62
+ template <>
63
+ struct JSIConverter<margelo::nitro::nitrogeolocation::LocationProviderStatus> final {
64
+ static inline margelo::nitro::nitrogeolocation::LocationProviderStatus fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
65
+ jsi::Object obj = arg.asObject(runtime);
66
+ return margelo::nitro::nitrogeolocation::LocationProviderStatus(
67
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "locationServicesEnabled"))),
68
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "backgroundModeEnabled"))),
69
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "gpsAvailable"))),
70
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "networkAvailable"))),
71
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "passiveAvailable"))),
72
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "googleLocationAccuracyEnabled")))
73
+ );
74
+ }
75
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::LocationProviderStatus& arg) {
76
+ jsi::Object obj(runtime);
77
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "locationServicesEnabled"), JSIConverter<bool>::toJSI(runtime, arg.locationServicesEnabled));
78
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "backgroundModeEnabled"), JSIConverter<bool>::toJSI(runtime, arg.backgroundModeEnabled));
79
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "gpsAvailable"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.gpsAvailable));
80
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "networkAvailable"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.networkAvailable));
81
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "passiveAvailable"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.passiveAvailable));
82
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "googleLocationAccuracyEnabled"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.googleLocationAccuracyEnabled));
83
+ return obj;
84
+ }
85
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
86
+ if (!value.isObject()) {
87
+ return false;
88
+ }
89
+ jsi::Object obj = value.getObject(runtime);
90
+ if (!nitro::isPlainObject(runtime, obj)) {
91
+ return false;
92
+ }
93
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "locationServicesEnabled")))) return false;
94
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "backgroundModeEnabled")))) return false;
95
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "gpsAvailable")))) return false;
96
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "networkAvailable")))) return false;
97
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "passiveAvailable")))) return false;
98
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "googleLocationAccuracyEnabled")))) return false;
99
+ return true;
100
+ }
101
+ };
102
+
103
+ } // namespace margelo::nitro
@@ -0,0 +1,88 @@
1
+ ///
2
+ /// LocationProviderUsed.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/NitroHash.hpp>)
11
+ #include <NitroModules/NitroHash.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
16
+ #include <NitroModules/JSIConverter.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
21
+ #include <NitroModules/NitroDefines.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+
26
+ namespace margelo::nitro::nitrogeolocation {
27
+
28
+ /**
29
+ * An enum which can be represented as a JavaScript union (LocationProviderUsed).
30
+ */
31
+ enum class LocationProviderUsed {
32
+ PASSIVE SWIFT_NAME(passive) = 0,
33
+ UNKNOWN SWIFT_NAME(unknown) = 1,
34
+ FUSED SWIFT_NAME(fused) = 2,
35
+ GPS SWIFT_NAME(gps) = 3,
36
+ NETWORK SWIFT_NAME(network) = 4,
37
+ } CLOSED_ENUM;
38
+
39
+ } // namespace margelo::nitro::nitrogeolocation
40
+
41
+ namespace margelo::nitro {
42
+
43
+ // C++ LocationProviderUsed <> JS LocationProviderUsed (union)
44
+ template <>
45
+ struct JSIConverter<margelo::nitro::nitrogeolocation::LocationProviderUsed> final {
46
+ static inline margelo::nitro::nitrogeolocation::LocationProviderUsed fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
47
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
48
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
49
+ case hashString("passive"): return margelo::nitro::nitrogeolocation::LocationProviderUsed::PASSIVE;
50
+ case hashString("unknown"): return margelo::nitro::nitrogeolocation::LocationProviderUsed::UNKNOWN;
51
+ case hashString("fused"): return margelo::nitro::nitrogeolocation::LocationProviderUsed::FUSED;
52
+ case hashString("gps"): return margelo::nitro::nitrogeolocation::LocationProviderUsed::GPS;
53
+ case hashString("network"): return margelo::nitro::nitrogeolocation::LocationProviderUsed::NETWORK;
54
+ default: [[unlikely]]
55
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum LocationProviderUsed - invalid value!");
56
+ }
57
+ }
58
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitrogeolocation::LocationProviderUsed arg) {
59
+ switch (arg) {
60
+ case margelo::nitro::nitrogeolocation::LocationProviderUsed::PASSIVE: return JSIConverter<std::string>::toJSI(runtime, "passive");
61
+ case margelo::nitro::nitrogeolocation::LocationProviderUsed::UNKNOWN: return JSIConverter<std::string>::toJSI(runtime, "unknown");
62
+ case margelo::nitro::nitrogeolocation::LocationProviderUsed::FUSED: return JSIConverter<std::string>::toJSI(runtime, "fused");
63
+ case margelo::nitro::nitrogeolocation::LocationProviderUsed::GPS: return JSIConverter<std::string>::toJSI(runtime, "gps");
64
+ case margelo::nitro::nitrogeolocation::LocationProviderUsed::NETWORK: return JSIConverter<std::string>::toJSI(runtime, "network");
65
+ default: [[unlikely]]
66
+ throw std::invalid_argument("Cannot convert LocationProviderUsed to JS - invalid value: "
67
+ + std::to_string(static_cast<int>(arg)) + "!");
68
+ }
69
+ }
70
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
71
+ if (!value.isString()) {
72
+ return false;
73
+ }
74
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
75
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
76
+ case hashString("passive"):
77
+ case hashString("unknown"):
78
+ case hashString("fused"):
79
+ case hashString("gps"):
80
+ case hashString("network"):
81
+ return true;
82
+ default:
83
+ return false;
84
+ }
85
+ }
86
+ };
87
+
88
+ } // namespace margelo::nitro
@@ -28,9 +28,17 @@
28
28
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
29
  #endif
30
30
 
31
-
31
+ // Forward declaration of `LocationAccuracyOptions` to properly resolve imports.
32
+ namespace margelo::nitro::nitrogeolocation { struct LocationAccuracyOptions; }
33
+ // Forward declaration of `AndroidGranularity` to properly resolve imports.
34
+ namespace margelo::nitro::nitrogeolocation { enum class AndroidGranularity; }
35
+ // Forward declaration of `IOSActivityType` to properly resolve imports.
36
+ namespace margelo::nitro::nitrogeolocation { enum class IOSActivityType; }
32
37
 
33
38
  #include <optional>
39
+ #include "LocationAccuracyOptions.hpp"
40
+ #include "AndroidGranularity.hpp"
41
+ #include "IOSActivityType.hpp"
34
42
 
35
43
  namespace margelo::nitro::nitrogeolocation {
36
44
 
@@ -42,14 +50,23 @@ namespace margelo::nitro::nitrogeolocation {
42
50
  std::optional<double> timeout SWIFT_PRIVATE;
43
51
  std::optional<double> maximumAge SWIFT_PRIVATE;
44
52
  std::optional<bool> enableHighAccuracy SWIFT_PRIVATE;
53
+ std::optional<LocationAccuracyOptions> accuracy SWIFT_PRIVATE;
45
54
  std::optional<double> interval SWIFT_PRIVATE;
46
55
  std::optional<double> fastestInterval SWIFT_PRIVATE;
47
56
  std::optional<double> distanceFilter SWIFT_PRIVATE;
57
+ std::optional<AndroidGranularity> granularity SWIFT_PRIVATE;
58
+ std::optional<bool> waitForAccurateLocation SWIFT_PRIVATE;
59
+ std::optional<double> maxUpdateAge SWIFT_PRIVATE;
60
+ std::optional<double> maxUpdateDelay SWIFT_PRIVATE;
61
+ std::optional<double> maxUpdates SWIFT_PRIVATE;
48
62
  std::optional<bool> useSignificantChanges SWIFT_PRIVATE;
63
+ std::optional<IOSActivityType> activityType SWIFT_PRIVATE;
64
+ std::optional<bool> pausesLocationUpdatesAutomatically SWIFT_PRIVATE;
65
+ std::optional<bool> showsBackgroundLocationIndicator SWIFT_PRIVATE;
49
66
 
50
67
  public:
51
68
  LocationRequestOptions() = default;
52
- explicit LocationRequestOptions(std::optional<double> timeout, std::optional<double> maximumAge, std::optional<bool> enableHighAccuracy, std::optional<double> interval, std::optional<double> fastestInterval, std::optional<double> distanceFilter, std::optional<bool> useSignificantChanges): timeout(timeout), maximumAge(maximumAge), enableHighAccuracy(enableHighAccuracy), interval(interval), fastestInterval(fastestInterval), distanceFilter(distanceFilter), useSignificantChanges(useSignificantChanges) {}
69
+ explicit LocationRequestOptions(std::optional<double> timeout, std::optional<double> maximumAge, std::optional<bool> enableHighAccuracy, std::optional<LocationAccuracyOptions> accuracy, std::optional<double> interval, std::optional<double> fastestInterval, std::optional<double> distanceFilter, std::optional<AndroidGranularity> granularity, std::optional<bool> waitForAccurateLocation, std::optional<double> maxUpdateAge, std::optional<double> maxUpdateDelay, std::optional<double> maxUpdates, std::optional<bool> useSignificantChanges, std::optional<IOSActivityType> activityType, std::optional<bool> pausesLocationUpdatesAutomatically, std::optional<bool> showsBackgroundLocationIndicator): timeout(timeout), maximumAge(maximumAge), enableHighAccuracy(enableHighAccuracy), accuracy(accuracy), interval(interval), fastestInterval(fastestInterval), distanceFilter(distanceFilter), granularity(granularity), waitForAccurateLocation(waitForAccurateLocation), maxUpdateAge(maxUpdateAge), maxUpdateDelay(maxUpdateDelay), maxUpdates(maxUpdates), useSignificantChanges(useSignificantChanges), activityType(activityType), pausesLocationUpdatesAutomatically(pausesLocationUpdatesAutomatically), showsBackgroundLocationIndicator(showsBackgroundLocationIndicator) {}
53
70
 
54
71
  public:
55
72
  friend bool operator==(const LocationRequestOptions& lhs, const LocationRequestOptions& rhs) = default;
@@ -68,10 +85,19 @@ namespace margelo::nitro {
68
85
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timeout"))),
69
86
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumAge"))),
70
87
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableHighAccuracy"))),
88
+ JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationAccuracyOptions>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accuracy"))),
71
89
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "interval"))),
72
90
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fastestInterval"))),
73
91
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "distanceFilter"))),
74
- JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "useSignificantChanges")))
92
+ JSIConverter<std::optional<margelo::nitro::nitrogeolocation::AndroidGranularity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "granularity"))),
93
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "waitForAccurateLocation"))),
94
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxUpdateAge"))),
95
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxUpdateDelay"))),
96
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxUpdates"))),
97
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "useSignificantChanges"))),
98
+ JSIConverter<std::optional<margelo::nitro::nitrogeolocation::IOSActivityType>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "activityType"))),
99
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pausesLocationUpdatesAutomatically"))),
100
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "showsBackgroundLocationIndicator")))
75
101
  );
76
102
  }
77
103
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::LocationRequestOptions& arg) {
@@ -79,10 +105,19 @@ namespace margelo::nitro {
79
105
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "timeout"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.timeout));
80
106
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "maximumAge"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.maximumAge));
81
107
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "enableHighAccuracy"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.enableHighAccuracy));
108
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "accuracy"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationAccuracyOptions>>::toJSI(runtime, arg.accuracy));
82
109
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "interval"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.interval));
83
110
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "fastestInterval"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.fastestInterval));
84
111
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "distanceFilter"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.distanceFilter));
112
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "granularity"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::AndroidGranularity>>::toJSI(runtime, arg.granularity));
113
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "waitForAccurateLocation"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.waitForAccurateLocation));
114
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "maxUpdateAge"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.maxUpdateAge));
115
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "maxUpdateDelay"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.maxUpdateDelay));
116
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "maxUpdates"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.maxUpdates));
85
117
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "useSignificantChanges"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.useSignificantChanges));
118
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "activityType"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::IOSActivityType>>::toJSI(runtime, arg.activityType));
119
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "pausesLocationUpdatesAutomatically"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.pausesLocationUpdatesAutomatically));
120
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "showsBackgroundLocationIndicator"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.showsBackgroundLocationIndicator));
86
121
  return obj;
87
122
  }
88
123
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -96,10 +131,19 @@ namespace margelo::nitro {
96
131
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timeout")))) return false;
97
132
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumAge")))) return false;
98
133
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableHighAccuracy")))) return false;
134
+ if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationAccuracyOptions>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accuracy")))) return false;
99
135
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "interval")))) return false;
100
136
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fastestInterval")))) return false;
101
137
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "distanceFilter")))) return false;
138
+ if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::AndroidGranularity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "granularity")))) return false;
139
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "waitForAccurateLocation")))) return false;
140
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxUpdateAge")))) return false;
141
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxUpdateDelay")))) return false;
142
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxUpdates")))) return false;
102
143
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "useSignificantChanges")))) return false;
144
+ if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::IOSActivityType>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "activityType")))) return false;
145
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pausesLocationUpdatesAutomatically")))) return false;
146
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "showsBackgroundLocationIndicator")))) return false;
103
147
  return true;
104
148
  }
105
149
  };
@@ -1,5 +1,5 @@
1
1
  ///
2
- /// GeolocationOptions.hpp
2
+ /// LocationSettingsOptions.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
5
  /// Copyright © Marc Rousavy @ Margelo
@@ -28,61 +28,63 @@
28
28
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
29
  #endif
30
30
 
31
-
31
+ // Forward declaration of `LocationAccuracyOptions` to properly resolve imports.
32
+ namespace margelo::nitro::nitrogeolocation { struct LocationAccuracyOptions; }
32
33
 
33
34
  #include <optional>
35
+ #include "LocationAccuracyOptions.hpp"
34
36
 
35
37
  namespace margelo::nitro::nitrogeolocation {
36
38
 
37
39
  /**
38
- * A struct which can be represented as a JavaScript object (GeolocationOptions).
40
+ * A struct which can be represented as a JavaScript object (LocationSettingsOptions).
39
41
  */
40
- struct GeolocationOptions final {
42
+ struct LocationSettingsOptions final {
41
43
  public:
42
- std::optional<double> timeout SWIFT_PRIVATE;
43
- std::optional<double> maximumAge SWIFT_PRIVATE;
44
44
  std::optional<bool> enableHighAccuracy SWIFT_PRIVATE;
45
+ std::optional<LocationAccuracyOptions> accuracy SWIFT_PRIVATE;
45
46
  std::optional<double> interval SWIFT_PRIVATE;
46
47
  std::optional<double> fastestInterval SWIFT_PRIVATE;
47
48
  std::optional<double> distanceFilter SWIFT_PRIVATE;
48
- std::optional<bool> useSignificantChanges SWIFT_PRIVATE;
49
+ std::optional<bool> alwaysShow SWIFT_PRIVATE;
50
+ std::optional<bool> needBle SWIFT_PRIVATE;
49
51
 
50
52
  public:
51
- GeolocationOptions() = default;
52
- explicit GeolocationOptions(std::optional<double> timeout, std::optional<double> maximumAge, std::optional<bool> enableHighAccuracy, std::optional<double> interval, std::optional<double> fastestInterval, std::optional<double> distanceFilter, std::optional<bool> useSignificantChanges): timeout(timeout), maximumAge(maximumAge), enableHighAccuracy(enableHighAccuracy), interval(interval), fastestInterval(fastestInterval), distanceFilter(distanceFilter), useSignificantChanges(useSignificantChanges) {}
53
+ LocationSettingsOptions() = default;
54
+ explicit LocationSettingsOptions(std::optional<bool> enableHighAccuracy, std::optional<LocationAccuracyOptions> accuracy, std::optional<double> interval, std::optional<double> fastestInterval, std::optional<double> distanceFilter, std::optional<bool> alwaysShow, std::optional<bool> needBle): enableHighAccuracy(enableHighAccuracy), accuracy(accuracy), interval(interval), fastestInterval(fastestInterval), distanceFilter(distanceFilter), alwaysShow(alwaysShow), needBle(needBle) {}
53
55
 
54
56
  public:
55
- friend bool operator==(const GeolocationOptions& lhs, const GeolocationOptions& rhs) = default;
57
+ friend bool operator==(const LocationSettingsOptions& lhs, const LocationSettingsOptions& rhs) = default;
56
58
  };
57
59
 
58
60
  } // namespace margelo::nitro::nitrogeolocation
59
61
 
60
62
  namespace margelo::nitro {
61
63
 
62
- // C++ GeolocationOptions <> JS GeolocationOptions (object)
64
+ // C++ LocationSettingsOptions <> JS LocationSettingsOptions (object)
63
65
  template <>
64
- struct JSIConverter<margelo::nitro::nitrogeolocation::GeolocationOptions> final {
65
- static inline margelo::nitro::nitrogeolocation::GeolocationOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
66
+ struct JSIConverter<margelo::nitro::nitrogeolocation::LocationSettingsOptions> final {
67
+ static inline margelo::nitro::nitrogeolocation::LocationSettingsOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
66
68
  jsi::Object obj = arg.asObject(runtime);
67
- return margelo::nitro::nitrogeolocation::GeolocationOptions(
68
- JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timeout"))),
69
- JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumAge"))),
69
+ return margelo::nitro::nitrogeolocation::LocationSettingsOptions(
70
70
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableHighAccuracy"))),
71
+ JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationAccuracyOptions>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accuracy"))),
71
72
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "interval"))),
72
73
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fastestInterval"))),
73
74
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "distanceFilter"))),
74
- JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "useSignificantChanges")))
75
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "alwaysShow"))),
76
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "needBle")))
75
77
  );
76
78
  }
77
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::GeolocationOptions& arg) {
79
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::LocationSettingsOptions& arg) {
78
80
  jsi::Object obj(runtime);
79
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "timeout"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.timeout));
80
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "maximumAge"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.maximumAge));
81
81
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "enableHighAccuracy"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.enableHighAccuracy));
82
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "accuracy"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationAccuracyOptions>>::toJSI(runtime, arg.accuracy));
82
83
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "interval"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.interval));
83
84
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "fastestInterval"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.fastestInterval));
84
85
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "distanceFilter"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.distanceFilter));
85
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "useSignificantChanges"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.useSignificantChanges));
86
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "alwaysShow"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.alwaysShow));
87
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "needBle"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.needBle));
86
88
  return obj;
87
89
  }
88
90
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -93,13 +95,13 @@ namespace margelo::nitro {
93
95
  if (!nitro::isPlainObject(runtime, obj)) {
94
96
  return false;
95
97
  }
96
- if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timeout")))) return false;
97
- if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumAge")))) return false;
98
98
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableHighAccuracy")))) return false;
99
+ if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationAccuracyOptions>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accuracy")))) return false;
99
100
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "interval")))) return false;
100
101
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fastestInterval")))) return false;
101
102
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "distanceFilter")))) return false;
102
- if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "useSignificantChanges")))) return false;
103
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "alwaysShow")))) return false;
104
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "needBle")))) return false;
103
105
  return true;
104
106
  }
105
107
  };