react-native-nitro-geolocation 1.2.6 → 1.3.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 (223) hide show
  1. package/README.md +61 -272
  2. package/android/build.gradle +1 -0
  3. package/android/src/main/AndroidManifest.xml +39 -0
  4. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidFusedLocationProvider.kt +310 -0
  5. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidFusedRequestFactory.kt +31 -0
  6. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidGeolocationConversions.kt +71 -0
  7. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidGeolocationErrors.kt +85 -0
  8. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidGeolocationOptions.kt +92 -0
  9. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidLocationSettings.kt +3 -0
  10. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidProviderRoute.kt +74 -0
  11. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/NitroBackgroundLocation.kt +132 -0
  12. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/NitroGeolocation.kt +219 -476
  13. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/AndroidBackgroundHttpSync.kt +134 -0
  14. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/AndroidBackgroundPermissions.kt +196 -0
  15. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/AndroidBackgroundSerialization.kt +266 -0
  16. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroActivityRecognitionReceiver.kt +13 -0
  17. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroBackgroundEventHub.kt +65 -0
  18. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroBackgroundHeadlessTaskService.kt +58 -0
  19. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroBackgroundLocationController.kt +711 -0
  20. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroBackgroundLocationService.kt +48 -0
  21. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroBackgroundNotificationFactory.kt +37 -0
  22. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroBackgroundStore.kt +655 -0
  23. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroBootReceiver.kt +26 -0
  24. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroGeofenceReceiver.kt +14 -0
  25. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroLocationUpdateReceiver.kt +37 -0
  26. package/android/src/test/java/com/margelo/nitro/nitrogeolocation/AndroidFusedLocationProviderTest.kt +64 -0
  27. package/android/src/test/java/com/margelo/nitro/nitrogeolocation/AndroidProviderRouteTest.kt +116 -0
  28. package/ios/IOSBackgroundHttpSync.swift +126 -0
  29. package/ios/IOSBackgroundLocationDelegate.swift +36 -0
  30. package/ios/IOSBackgroundMotion.swift +55 -0
  31. package/ios/IOSBackgroundSerialization.swift +539 -0
  32. package/ios/IOSGeolocationConversions.swift +131 -0
  33. package/ios/IOSGeolocationDelegate.swift +31 -0
  34. package/ios/IOSGeolocationErrors.swift +39 -0
  35. package/ios/IOSGeolocationOptions.swift +135 -0
  36. package/ios/NitroBackgroundLocation.swift +849 -0
  37. package/ios/NitroGeolocation.swift +14 -347
  38. package/nitrogen/generated/android/c++/JActivityRecognitionOptions.hpp +69 -0
  39. package/nitrogen/generated/android/c++/JAndroidBackgroundLocationOptions.hpp +74 -0
  40. package/nitrogen/generated/android/c++/JAndroidBackgroundLocationStatus.hpp +67 -0
  41. package/nitrogen/generated/android/c++/JAndroidBackgroundProvider.hpp +61 -0
  42. package/nitrogen/generated/android/c++/JAndroidForegroundServiceOptions.hpp +90 -0
  43. package/nitrogen/generated/android/c++/JBackgroundEventEnvelope.hpp +129 -0
  44. package/nitrogen/generated/android/c++/JBackgroundEventType.hpp +70 -0
  45. package/nitrogen/generated/android/c++/JBackgroundHttpMethod.hpp +61 -0
  46. package/nitrogen/generated/android/c++/JBackgroundHttpSyncOptions.hpp +131 -0
  47. package/nitrogen/generated/android/c++/JBackgroundHttpSyncResult.hpp +111 -0
  48. package/nitrogen/generated/android/c++/JBackgroundLocation.hpp +110 -0
  49. package/nitrogen/generated/android/c++/JBackgroundLocationOptions.hpp +162 -0
  50. package/nitrogen/generated/android/c++/JBackgroundLocationSource.hpp +73 -0
  51. package/nitrogen/generated/android/c++/JBackgroundLocationState.hpp +70 -0
  52. package/nitrogen/generated/android/c++/JBackgroundLocationStatus.hpp +126 -0
  53. package/nitrogen/generated/android/c++/JBackgroundPermissionResult.hpp +79 -0
  54. package/nitrogen/generated/android/c++/JBackgroundPermissionStatus.hpp +64 -0
  55. package/nitrogen/generated/android/c++/JBackgroundTrackingMode.hpp +61 -0
  56. package/nitrogen/generated/android/c++/JBatterySnapshot.hpp +61 -0
  57. package/nitrogen/generated/android/c++/JDetectedActivity.hpp +66 -0
  58. package/nitrogen/generated/android/c++/JDetectedActivityType.hpp +76 -0
  59. package/nitrogen/generated/android/c++/JFunc_void_BackgroundEventEnvelope.hpp +114 -0
  60. package/nitrogen/generated/android/c++/JFunc_void_BackgroundLocation.hpp +95 -0
  61. package/nitrogen/generated/android/c++/JGeofenceEvent.hpp +94 -0
  62. package/nitrogen/generated/android/c++/JGeofenceRegion.hpp +112 -0
  63. package/nitrogen/generated/android/c++/JGeofenceTransition.hpp +61 -0
  64. package/nitrogen/generated/android/c++/JGeofencingOptions.hpp +82 -0
  65. package/nitrogen/generated/android/c++/JGetStoredBackgroundEventsOptions.hpp +90 -0
  66. package/nitrogen/generated/android/c++/JGetStoredBackgroundLocationsOptions.hpp +69 -0
  67. package/nitrogen/generated/android/c++/JHybridNitroBackgroundLocationSpec.cpp +662 -0
  68. package/nitrogen/generated/android/c++/JHybridNitroBackgroundLocationSpec.hpp +89 -0
  69. package/nitrogen/generated/android/c++/JIOSBackgroundActivityType.hpp +67 -0
  70. package/nitrogen/generated/android/c++/JIOSBackgroundLocationOptions.hpp +79 -0
  71. package/nitrogen/generated/android/c++/JIOSBackgroundLocationStatus.hpp +61 -0
  72. package/nitrogen/generated/android/c++/JLocationProviderStatus.hpp +5 -1
  73. package/nitrogen/generated/android/c++/JStoredBackgroundEventEnvelope.hpp +115 -0
  74. package/nitrogen/generated/android/c++/JStoredBackgroundLocation.hpp +122 -0
  75. package/nitrogen/generated/android/c++/JVariant_NullType_Boolean_String_Double.cpp +34 -0
  76. package/nitrogen/generated/android/c++/JVariant_NullType_Boolean_String_Double.hpp +100 -0
  77. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/ActivityRecognitionOptions.kt +66 -0
  78. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/AndroidBackgroundLocationOptions.kt +66 -0
  79. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/AndroidBackgroundLocationStatus.kt +61 -0
  80. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/AndroidBackgroundProvider.kt +24 -0
  81. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/AndroidForegroundServiceOptions.kt +91 -0
  82. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundEventEnvelope.kt +96 -0
  83. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundEventType.kt +27 -0
  84. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundHttpMethod.kt +24 -0
  85. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundHttpSyncOptions.kt +101 -0
  86. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundHttpSyncResult.kt +71 -0
  87. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundLocation.kt +96 -0
  88. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundLocationOptions.kt +136 -0
  89. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundLocationSource.kt +28 -0
  90. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundLocationState.kt +27 -0
  91. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundLocationStatus.kt +116 -0
  92. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundPermissionResult.kt +71 -0
  93. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundPermissionStatus.kt +25 -0
  94. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundTrackingMode.kt +24 -0
  95. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BatterySnapshot.kt +56 -0
  96. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/DetectedActivity.kt +61 -0
  97. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/DetectedActivityType.kt +29 -0
  98. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_BackgroundEventEnvelope.kt +80 -0
  99. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_BackgroundLocation.kt +80 -0
  100. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeofenceEvent.kt +66 -0
  101. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeofenceRegion.kt +96 -0
  102. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeofenceTransition.kt +24 -0
  103. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeofencingOptions.kt +56 -0
  104. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GetStoredBackgroundEventsOptions.kt +66 -0
  105. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GetStoredBackgroundLocationsOptions.kt +66 -0
  106. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/HybridNitroBackgroundLocationSpec.kt +174 -0
  107. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/IOSBackgroundActivityType.kt +26 -0
  108. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/IOSBackgroundLocationOptions.kt +76 -0
  109. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/IOSBackgroundLocationStatus.kt +56 -0
  110. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationProviderStatus.kt +7 -2
  111. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/StoredBackgroundEventEnvelope.kt +76 -0
  112. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/StoredBackgroundLocation.kt +111 -0
  113. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Variant_NullType_Boolean_String_Double.kt +88 -0
  114. package/nitrogen/generated/android/nitrogeolocation+autolinking.cmake +3 -0
  115. package/nitrogen/generated/android/nitrogeolocationOnLoad.cpp +20 -0
  116. package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Bridge.cpp +104 -15
  117. package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Bridge.hpp +1107 -50
  118. package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Umbrella.hpp +102 -0
  119. package/nitrogen/generated/ios/NitroGeolocationAutolinking.mm +8 -0
  120. package/nitrogen/generated/ios/NitroGeolocationAutolinking.swift +15 -3
  121. package/nitrogen/generated/ios/c++/HybridNitroBackgroundLocationSpecSwift.cpp +11 -0
  122. package/nitrogen/generated/ios/c++/HybridNitroBackgroundLocationSpecSwift.hpp +416 -0
  123. package/nitrogen/generated/ios/swift/ActivityRecognitionOptions.swift +96 -0
  124. package/nitrogen/generated/ios/swift/AndroidBackgroundLocationOptions.swift +76 -0
  125. package/nitrogen/generated/ios/swift/AndroidBackgroundLocationStatus.swift +58 -0
  126. package/nitrogen/generated/ios/swift/AndroidBackgroundProvider.swift +44 -0
  127. package/nitrogen/generated/ios/swift/AndroidForegroundServiceOptions.swift +160 -0
  128. package/nitrogen/generated/ios/swift/BackgroundEventEnvelope.swift +110 -0
  129. package/nitrogen/generated/ios/swift/BackgroundEventType.swift +56 -0
  130. package/nitrogen/generated/ios/swift/BackgroundHttpMethod.swift +44 -0
  131. package/nitrogen/generated/ios/swift/BackgroundHttpSyncOptions.swift +259 -0
  132. package/nitrogen/generated/ios/swift/BackgroundHttpSyncResult.swift +87 -0
  133. package/nitrogen/generated/ios/swift/BackgroundLocation.swift +118 -0
  134. package/nitrogen/generated/ios/swift/BackgroundLocationOptions.swift +292 -0
  135. package/nitrogen/generated/ios/swift/BackgroundLocationSource.swift +60 -0
  136. package/nitrogen/generated/ios/swift/BackgroundLocationState.swift +56 -0
  137. package/nitrogen/generated/ios/swift/BackgroundLocationStatus.swift +124 -0
  138. package/nitrogen/generated/ios/swift/BackgroundPermissionResult.swift +81 -0
  139. package/nitrogen/generated/ios/swift/BackgroundPermissionStatus.swift +48 -0
  140. package/nitrogen/generated/ios/swift/BackgroundTrackingMode.swift +44 -0
  141. package/nitrogen/generated/ios/swift/BatterySnapshot.swift +60 -0
  142. package/nitrogen/generated/ios/swift/DetectedActivity.swift +39 -0
  143. package/nitrogen/generated/ios/swift/DetectedActivityType.swift +64 -0
  144. package/nitrogen/generated/ios/swift/Func_void_BackgroundEventEnvelope.swift +46 -0
  145. package/nitrogen/generated/ios/swift/Func_void_BackgroundHttpSyncResult.swift +46 -0
  146. package/nitrogen/generated/ios/swift/Func_void_BackgroundLocation.swift +46 -0
  147. package/nitrogen/generated/ios/swift/Func_void_BackgroundLocationStatus.swift +46 -0
  148. package/nitrogen/generated/ios/swift/Func_void_BackgroundPermissionResult.swift +46 -0
  149. package/nitrogen/generated/ios/swift/Func_void_std__optional_BackgroundLocationOptions_.swift +46 -0
  150. package/nitrogen/generated/ios/swift/Func_void_std__vector_GeofenceRegion_.swift +46 -0
  151. package/nitrogen/generated/ios/swift/Func_void_std__vector_StoredBackgroundEventEnvelope_.swift +46 -0
  152. package/nitrogen/generated/ios/swift/Func_void_std__vector_StoredBackgroundLocation_.swift +46 -0
  153. package/nitrogen/generated/ios/swift/GeofenceEvent.swift +50 -0
  154. package/nitrogen/generated/ios/swift/GeofenceRegion.swift +195 -0
  155. package/nitrogen/generated/ios/swift/GeofenceTransition.swift +44 -0
  156. package/nitrogen/generated/ios/swift/GeofencingOptions.swift +66 -0
  157. package/nitrogen/generated/ios/swift/GetStoredBackgroundEventsOptions.swift +102 -0
  158. package/nitrogen/generated/ios/swift/GetStoredBackgroundLocationsOptions.swift +96 -0
  159. package/nitrogen/generated/ios/swift/HybridNitroBackgroundLocationSpec.swift +81 -0
  160. package/nitrogen/generated/ios/swift/HybridNitroBackgroundLocationSpec_cxx.swift +654 -0
  161. package/nitrogen/generated/ios/swift/IOSBackgroundActivityType.swift +52 -0
  162. package/nitrogen/generated/ios/swift/IOSBackgroundLocationOptions.swift +125 -0
  163. package/nitrogen/generated/ios/swift/IOSBackgroundLocationStatus.swift +34 -0
  164. package/nitrogen/generated/ios/swift/LocationProviderStatus.swift +19 -1
  165. package/nitrogen/generated/ios/swift/StoredBackgroundEventEnvelope.swift +54 -0
  166. package/nitrogen/generated/ios/swift/StoredBackgroundLocation.swift +120 -0
  167. package/nitrogen/generated/ios/swift/Variant_NullType_Bool_String_Double.swift +34 -0
  168. package/nitrogen/generated/shared/c++/ActivityRecognitionOptions.hpp +95 -0
  169. package/nitrogen/generated/shared/c++/AndroidBackgroundLocationOptions.hpp +100 -0
  170. package/nitrogen/generated/shared/c++/AndroidBackgroundLocationStatus.hpp +93 -0
  171. package/nitrogen/generated/shared/c++/AndroidBackgroundProvider.hpp +80 -0
  172. package/nitrogen/generated/shared/c++/AndroidForegroundServiceOptions.hpp +116 -0
  173. package/nitrogen/generated/shared/c++/BackgroundEventEnvelope.hpp +140 -0
  174. package/nitrogen/generated/shared/c++/BackgroundEventType.hpp +92 -0
  175. package/nitrogen/generated/shared/c++/BackgroundHttpMethod.hpp +80 -0
  176. package/nitrogen/generated/shared/c++/BackgroundHttpSyncOptions.hpp +129 -0
  177. package/nitrogen/generated/shared/c++/BackgroundHttpSyncResult.hpp +101 -0
  178. package/nitrogen/generated/shared/c++/BackgroundLocation.hpp +134 -0
  179. package/nitrogen/generated/shared/c++/BackgroundLocationOptions.hpp +174 -0
  180. package/nitrogen/generated/shared/c++/BackgroundLocationSource.hpp +96 -0
  181. package/nitrogen/generated/shared/c++/BackgroundLocationState.hpp +92 -0
  182. package/nitrogen/generated/shared/c++/BackgroundLocationStatus.hpp +158 -0
  183. package/nitrogen/generated/shared/c++/BackgroundPermissionResult.hpp +107 -0
  184. package/nitrogen/generated/shared/c++/BackgroundPermissionStatus.hpp +84 -0
  185. package/nitrogen/generated/shared/c++/BackgroundTrackingMode.hpp +80 -0
  186. package/nitrogen/generated/shared/c++/BatterySnapshot.hpp +87 -0
  187. package/nitrogen/generated/shared/c++/DetectedActivity.hpp +92 -0
  188. package/nitrogen/generated/shared/c++/DetectedActivityType.hpp +100 -0
  189. package/nitrogen/generated/shared/c++/GeofenceEvent.hpp +103 -0
  190. package/nitrogen/generated/shared/c++/GeofenceRegion.hpp +123 -0
  191. package/nitrogen/generated/shared/c++/GeofenceTransition.hpp +80 -0
  192. package/nitrogen/generated/shared/c++/GeofencingOptions.hpp +90 -0
  193. package/nitrogen/generated/shared/c++/GetStoredBackgroundEventsOptions.hpp +98 -0
  194. package/nitrogen/generated/shared/c++/GetStoredBackgroundLocationsOptions.hpp +95 -0
  195. package/nitrogen/generated/shared/c++/HybridNitroBackgroundLocationSpec.cpp +47 -0
  196. package/nitrogen/generated/shared/c++/HybridNitroBackgroundLocationSpec.hpp +133 -0
  197. package/nitrogen/generated/shared/c++/IOSBackgroundActivityType.hpp +88 -0
  198. package/nitrogen/generated/shared/c++/IOSBackgroundLocationOptions.hpp +105 -0
  199. package/nitrogen/generated/shared/c++/IOSBackgroundLocationStatus.hpp +87 -0
  200. package/nitrogen/generated/shared/c++/LocationProviderStatus.hpp +5 -1
  201. package/nitrogen/generated/shared/c++/StoredBackgroundEventEnvelope.hpp +108 -0
  202. package/nitrogen/generated/shared/c++/StoredBackgroundLocation.hpp +146 -0
  203. package/package.json +17 -6
  204. package/src/NitroGeolocation.nitro.ts +4 -4
  205. package/src/api/getCurrentPosition.ts +1 -1
  206. package/src/api/requestLocationSettings.ts +3 -2
  207. package/src/background/NitroBackgroundLocation.nitro.ts +83 -0
  208. package/src/background/index.ts +200 -0
  209. package/src/background/index.web.ts +120 -0
  210. package/src/background/task.ts +13 -0
  211. package/src/background/types.ts +328 -0
  212. package/src/compat/index.web.ts +141 -0
  213. package/src/index.tsx +3 -0
  214. package/src/index.web.tsx +41 -0
  215. package/src/publicTypes.ts +6 -5
  216. package/src/types.ts +3 -0
  217. package/src/web/browser.ts +171 -0
  218. package/src/web/index.ts +167 -0
  219. package/src/web/useWatchPosition.ts +76 -0
  220. package/src/web/watch.ts +81 -0
  221. package/src/devtools/index.test.ts +0 -54
  222. package/src/utils/errors.test.ts +0 -65
  223. package/src/utils/provider.test.ts +0 -303
@@ -0,0 +1,105 @@
1
+ ///
2
+ /// IOSBackgroundLocationOptions.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 `IOSBackgroundActivityType` to properly resolve imports.
32
+ namespace margelo::nitro::nitrogeolocation { enum class IOSBackgroundActivityType; }
33
+
34
+ #include "IOSBackgroundActivityType.hpp"
35
+ #include <optional>
36
+
37
+ namespace margelo::nitro::nitrogeolocation {
38
+
39
+ /**
40
+ * A struct which can be represented as a JavaScript object (IOSBackgroundLocationOptions).
41
+ */
42
+ struct IOSBackgroundLocationOptions final {
43
+ public:
44
+ std::optional<IOSBackgroundActivityType> activityType SWIFT_PRIVATE;
45
+ std::optional<bool> pausesLocationUpdatesAutomatically SWIFT_PRIVATE;
46
+ std::optional<bool> showsBackgroundLocationIndicator SWIFT_PRIVATE;
47
+ std::optional<bool> useSignificantChanges SWIFT_PRIVATE;
48
+ std::optional<double> deferredUpdatesDistance SWIFT_PRIVATE;
49
+ std::optional<double> deferredUpdatesInterval SWIFT_PRIVATE;
50
+
51
+ public:
52
+ IOSBackgroundLocationOptions() = default;
53
+ explicit IOSBackgroundLocationOptions(std::optional<IOSBackgroundActivityType> activityType, std::optional<bool> pausesLocationUpdatesAutomatically, std::optional<bool> showsBackgroundLocationIndicator, std::optional<bool> useSignificantChanges, std::optional<double> deferredUpdatesDistance, std::optional<double> deferredUpdatesInterval): activityType(activityType), pausesLocationUpdatesAutomatically(pausesLocationUpdatesAutomatically), showsBackgroundLocationIndicator(showsBackgroundLocationIndicator), useSignificantChanges(useSignificantChanges), deferredUpdatesDistance(deferredUpdatesDistance), deferredUpdatesInterval(deferredUpdatesInterval) {}
54
+
55
+ public:
56
+ friend bool operator==(const IOSBackgroundLocationOptions& lhs, const IOSBackgroundLocationOptions& rhs) = default;
57
+ };
58
+
59
+ } // namespace margelo::nitro::nitrogeolocation
60
+
61
+ namespace margelo::nitro {
62
+
63
+ // C++ IOSBackgroundLocationOptions <> JS IOSBackgroundLocationOptions (object)
64
+ template <>
65
+ struct JSIConverter<margelo::nitro::nitrogeolocation::IOSBackgroundLocationOptions> final {
66
+ static inline margelo::nitro::nitrogeolocation::IOSBackgroundLocationOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
67
+ jsi::Object obj = arg.asObject(runtime);
68
+ return margelo::nitro::nitrogeolocation::IOSBackgroundLocationOptions(
69
+ JSIConverter<std::optional<margelo::nitro::nitrogeolocation::IOSBackgroundActivityType>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "activityType"))),
70
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pausesLocationUpdatesAutomatically"))),
71
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "showsBackgroundLocationIndicator"))),
72
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "useSignificantChanges"))),
73
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "deferredUpdatesDistance"))),
74
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "deferredUpdatesInterval")))
75
+ );
76
+ }
77
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::IOSBackgroundLocationOptions& arg) {
78
+ jsi::Object obj(runtime);
79
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "activityType"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::IOSBackgroundActivityType>>::toJSI(runtime, arg.activityType));
80
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "pausesLocationUpdatesAutomatically"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.pausesLocationUpdatesAutomatically));
81
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "showsBackgroundLocationIndicator"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.showsBackgroundLocationIndicator));
82
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "useSignificantChanges"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.useSignificantChanges));
83
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "deferredUpdatesDistance"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.deferredUpdatesDistance));
84
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "deferredUpdatesInterval"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.deferredUpdatesInterval));
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 (!nitro::isPlainObject(runtime, obj)) {
93
+ return false;
94
+ }
95
+ if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::IOSBackgroundActivityType>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "activityType")))) return false;
96
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pausesLocationUpdatesAutomatically")))) return false;
97
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "showsBackgroundLocationIndicator")))) return false;
98
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "useSignificantChanges")))) return false;
99
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "deferredUpdatesDistance")))) return false;
100
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "deferredUpdatesInterval")))) return false;
101
+ return true;
102
+ }
103
+ };
104
+
105
+ } // namespace margelo::nitro
@@ -0,0 +1,87 @@
1
+ ///
2
+ /// IOSBackgroundLocationStatus.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
+
34
+
35
+ namespace margelo::nitro::nitrogeolocation {
36
+
37
+ /**
38
+ * A struct which can be represented as a JavaScript object (IOSBackgroundLocationStatus).
39
+ */
40
+ struct IOSBackgroundLocationStatus final {
41
+ public:
42
+ bool allowsBackgroundLocationUpdates SWIFT_PRIVATE;
43
+ bool significantChangesEnabled SWIFT_PRIVATE;
44
+
45
+ public:
46
+ IOSBackgroundLocationStatus() = default;
47
+ explicit IOSBackgroundLocationStatus(bool allowsBackgroundLocationUpdates, bool significantChangesEnabled): allowsBackgroundLocationUpdates(allowsBackgroundLocationUpdates), significantChangesEnabled(significantChangesEnabled) {}
48
+
49
+ public:
50
+ friend bool operator==(const IOSBackgroundLocationStatus& lhs, const IOSBackgroundLocationStatus& rhs) = default;
51
+ };
52
+
53
+ } // namespace margelo::nitro::nitrogeolocation
54
+
55
+ namespace margelo::nitro {
56
+
57
+ // C++ IOSBackgroundLocationStatus <> JS IOSBackgroundLocationStatus (object)
58
+ template <>
59
+ struct JSIConverter<margelo::nitro::nitrogeolocation::IOSBackgroundLocationStatus> final {
60
+ static inline margelo::nitro::nitrogeolocation::IOSBackgroundLocationStatus fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
61
+ jsi::Object obj = arg.asObject(runtime);
62
+ return margelo::nitro::nitrogeolocation::IOSBackgroundLocationStatus(
63
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "allowsBackgroundLocationUpdates"))),
64
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "significantChangesEnabled")))
65
+ );
66
+ }
67
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::IOSBackgroundLocationStatus& arg) {
68
+ jsi::Object obj(runtime);
69
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "allowsBackgroundLocationUpdates"), JSIConverter<bool>::toJSI(runtime, arg.allowsBackgroundLocationUpdates));
70
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "significantChangesEnabled"), JSIConverter<bool>::toJSI(runtime, arg.significantChangesEnabled));
71
+ return obj;
72
+ }
73
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
74
+ if (!value.isObject()) {
75
+ return false;
76
+ }
77
+ jsi::Object obj = value.getObject(runtime);
78
+ if (!nitro::isPlainObject(runtime, obj)) {
79
+ return false;
80
+ }
81
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "allowsBackgroundLocationUpdates")))) return false;
82
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "significantChangesEnabled")))) return false;
83
+ return true;
84
+ }
85
+ };
86
+
87
+ } // namespace margelo::nitro
@@ -44,11 +44,12 @@ namespace margelo::nitro::nitrogeolocation {
44
44
  std::optional<bool> gpsAvailable SWIFT_PRIVATE;
45
45
  std::optional<bool> networkAvailable SWIFT_PRIVATE;
46
46
  std::optional<bool> passiveAvailable SWIFT_PRIVATE;
47
+ std::optional<bool> googlePlayServicesAvailable SWIFT_PRIVATE;
47
48
  std::optional<bool> googleLocationAccuracyEnabled SWIFT_PRIVATE;
48
49
 
49
50
  public:
50
51
  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
+ explicit LocationProviderStatus(bool locationServicesEnabled, bool backgroundModeEnabled, std::optional<bool> gpsAvailable, std::optional<bool> networkAvailable, std::optional<bool> passiveAvailable, std::optional<bool> googlePlayServicesAvailable, std::optional<bool> googleLocationAccuracyEnabled): locationServicesEnabled(locationServicesEnabled), backgroundModeEnabled(backgroundModeEnabled), gpsAvailable(gpsAvailable), networkAvailable(networkAvailable), passiveAvailable(passiveAvailable), googlePlayServicesAvailable(googlePlayServicesAvailable), googleLocationAccuracyEnabled(googleLocationAccuracyEnabled) {}
52
53
 
53
54
  public:
54
55
  friend bool operator==(const LocationProviderStatus& lhs, const LocationProviderStatus& rhs) = default;
@@ -69,6 +70,7 @@ namespace margelo::nitro {
69
70
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "gpsAvailable"))),
70
71
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "networkAvailable"))),
71
72
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "passiveAvailable"))),
73
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "googlePlayServicesAvailable"))),
72
74
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "googleLocationAccuracyEnabled")))
73
75
  );
74
76
  }
@@ -79,6 +81,7 @@ namespace margelo::nitro {
79
81
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "gpsAvailable"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.gpsAvailable));
80
82
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "networkAvailable"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.networkAvailable));
81
83
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "passiveAvailable"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.passiveAvailable));
84
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "googlePlayServicesAvailable"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.googlePlayServicesAvailable));
82
85
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "googleLocationAccuracyEnabled"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.googleLocationAccuracyEnabled));
83
86
  return obj;
84
87
  }
@@ -95,6 +98,7 @@ namespace margelo::nitro {
95
98
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "gpsAvailable")))) return false;
96
99
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "networkAvailable")))) return false;
97
100
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "passiveAvailable")))) return false;
101
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "googlePlayServicesAvailable")))) return false;
98
102
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "googleLocationAccuracyEnabled")))) return false;
99
103
  return true;
100
104
  }
@@ -0,0 +1,108 @@
1
+ ///
2
+ /// StoredBackgroundEventEnvelope.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 `BackgroundEventEnvelope` to properly resolve imports.
32
+ namespace margelo::nitro::nitrogeolocation { struct BackgroundEventEnvelope; }
33
+ // Forward declaration of `BackgroundEventType` to properly resolve imports.
34
+ namespace margelo::nitro::nitrogeolocation { enum class BackgroundEventType; }
35
+
36
+ #include "BackgroundEventEnvelope.hpp"
37
+ #include <string>
38
+ #include "BackgroundEventType.hpp"
39
+
40
+ namespace margelo::nitro::nitrogeolocation {
41
+
42
+ /**
43
+ * A struct which can be represented as a JavaScript object (StoredBackgroundEventEnvelope).
44
+ */
45
+ struct StoredBackgroundEventEnvelope final {
46
+ public:
47
+ BackgroundEventEnvelope event SWIFT_PRIVATE;
48
+ double createdAt SWIFT_PRIVATE;
49
+ std::string id SWIFT_PRIVATE;
50
+ BackgroundEventType type SWIFT_PRIVATE;
51
+ double timestamp SWIFT_PRIVATE;
52
+ bool deliveredToJS SWIFT_PRIVATE;
53
+
54
+ public:
55
+ StoredBackgroundEventEnvelope() = default;
56
+ explicit StoredBackgroundEventEnvelope(BackgroundEventEnvelope event, double createdAt, std::string id, BackgroundEventType type, double timestamp, bool deliveredToJS): event(event), createdAt(createdAt), id(id), type(type), timestamp(timestamp), deliveredToJS(deliveredToJS) {}
57
+
58
+ public:
59
+ friend bool operator==(const StoredBackgroundEventEnvelope& lhs, const StoredBackgroundEventEnvelope& rhs) = default;
60
+ };
61
+
62
+ } // namespace margelo::nitro::nitrogeolocation
63
+
64
+ namespace margelo::nitro {
65
+
66
+ // C++ StoredBackgroundEventEnvelope <> JS StoredBackgroundEventEnvelope (object)
67
+ template <>
68
+ struct JSIConverter<margelo::nitro::nitrogeolocation::StoredBackgroundEventEnvelope> final {
69
+ static inline margelo::nitro::nitrogeolocation::StoredBackgroundEventEnvelope fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
70
+ jsi::Object obj = arg.asObject(runtime);
71
+ return margelo::nitro::nitrogeolocation::StoredBackgroundEventEnvelope(
72
+ JSIConverter<margelo::nitro::nitrogeolocation::BackgroundEventEnvelope>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "event"))),
73
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "createdAt"))),
74
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id"))),
75
+ JSIConverter<margelo::nitro::nitrogeolocation::BackgroundEventType>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))),
76
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp"))),
77
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "deliveredToJS")))
78
+ );
79
+ }
80
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::StoredBackgroundEventEnvelope& arg) {
81
+ jsi::Object obj(runtime);
82
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "event"), JSIConverter<margelo::nitro::nitrogeolocation::BackgroundEventEnvelope>::toJSI(runtime, arg.event));
83
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "createdAt"), JSIConverter<double>::toJSI(runtime, arg.createdAt));
84
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "id"), JSIConverter<std::string>::toJSI(runtime, arg.id));
85
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter<margelo::nitro::nitrogeolocation::BackgroundEventType>::toJSI(runtime, arg.type));
86
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "timestamp"), JSIConverter<double>::toJSI(runtime, arg.timestamp));
87
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "deliveredToJS"), JSIConverter<bool>::toJSI(runtime, arg.deliveredToJS));
88
+ return obj;
89
+ }
90
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
91
+ if (!value.isObject()) {
92
+ return false;
93
+ }
94
+ jsi::Object obj = value.getObject(runtime);
95
+ if (!nitro::isPlainObject(runtime, obj)) {
96
+ return false;
97
+ }
98
+ if (!JSIConverter<margelo::nitro::nitrogeolocation::BackgroundEventEnvelope>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "event")))) return false;
99
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "createdAt")))) return false;
100
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id")))) return false;
101
+ if (!JSIConverter<margelo::nitro::nitrogeolocation::BackgroundEventType>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false;
102
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp")))) return false;
103
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "deliveredToJS")))) return false;
104
+ return true;
105
+ }
106
+ };
107
+
108
+ } // namespace margelo::nitro
@@ -0,0 +1,146 @@
1
+ ///
2
+ /// StoredBackgroundLocation.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 `BackgroundLocationSource` to properly resolve imports.
32
+ namespace margelo::nitro::nitrogeolocation { enum class BackgroundLocationSource; }
33
+ // Forward declaration of `LocationProviderUsed` to properly resolve imports.
34
+ namespace margelo::nitro::nitrogeolocation { enum class LocationProviderUsed; }
35
+ // Forward declaration of `DetectedActivity` to properly resolve imports.
36
+ namespace margelo::nitro::nitrogeolocation { struct DetectedActivity; }
37
+ // Forward declaration of `BatterySnapshot` to properly resolve imports.
38
+ namespace margelo::nitro::nitrogeolocation { struct BatterySnapshot; }
39
+ // Forward declaration of `GeolocationCoordinates` to properly resolve imports.
40
+ namespace margelo::nitro::nitrogeolocation { struct GeolocationCoordinates; }
41
+
42
+ #include <string>
43
+ #include "BackgroundLocationSource.hpp"
44
+ #include "LocationProviderUsed.hpp"
45
+ #include <optional>
46
+ #include "DetectedActivity.hpp"
47
+ #include "BatterySnapshot.hpp"
48
+ #include "GeolocationCoordinates.hpp"
49
+
50
+ namespace margelo::nitro::nitrogeolocation {
51
+
52
+ /**
53
+ * A struct which can be represented as a JavaScript object (StoredBackgroundLocation).
54
+ */
55
+ struct StoredBackgroundLocation final {
56
+ public:
57
+ std::string id SWIFT_PRIVATE;
58
+ bool deliveredToJS SWIFT_PRIVATE;
59
+ bool synced SWIFT_PRIVATE;
60
+ double createdAt SWIFT_PRIVATE;
61
+ BackgroundLocationSource source SWIFT_PRIVATE;
62
+ bool isFromBackground SWIFT_PRIVATE;
63
+ std::optional<LocationProviderUsed> provider SWIFT_PRIVATE;
64
+ std::optional<bool> mocked SWIFT_PRIVATE;
65
+ double recordedAt SWIFT_PRIVATE;
66
+ std::optional<DetectedActivity> activity SWIFT_PRIVATE;
67
+ std::optional<BatterySnapshot> battery SWIFT_PRIVATE;
68
+ GeolocationCoordinates coords SWIFT_PRIVATE;
69
+ double timestamp SWIFT_PRIVATE;
70
+
71
+ public:
72
+ StoredBackgroundLocation() = default;
73
+ explicit StoredBackgroundLocation(std::string id, bool deliveredToJS, bool synced, double createdAt, BackgroundLocationSource source, bool isFromBackground, std::optional<LocationProviderUsed> provider, std::optional<bool> mocked, double recordedAt, std::optional<DetectedActivity> activity, std::optional<BatterySnapshot> battery, GeolocationCoordinates coords, double timestamp): id(id), deliveredToJS(deliveredToJS), synced(synced), createdAt(createdAt), source(source), isFromBackground(isFromBackground), provider(provider), mocked(mocked), recordedAt(recordedAt), activity(activity), battery(battery), coords(coords), timestamp(timestamp) {}
74
+
75
+ public:
76
+ friend bool operator==(const StoredBackgroundLocation& lhs, const StoredBackgroundLocation& rhs) = default;
77
+ };
78
+
79
+ } // namespace margelo::nitro::nitrogeolocation
80
+
81
+ namespace margelo::nitro {
82
+
83
+ // C++ StoredBackgroundLocation <> JS StoredBackgroundLocation (object)
84
+ template <>
85
+ struct JSIConverter<margelo::nitro::nitrogeolocation::StoredBackgroundLocation> final {
86
+ static inline margelo::nitro::nitrogeolocation::StoredBackgroundLocation fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
87
+ jsi::Object obj = arg.asObject(runtime);
88
+ return margelo::nitro::nitrogeolocation::StoredBackgroundLocation(
89
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id"))),
90
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "deliveredToJS"))),
91
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "synced"))),
92
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "createdAt"))),
93
+ JSIConverter<margelo::nitro::nitrogeolocation::BackgroundLocationSource>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "source"))),
94
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isFromBackground"))),
95
+ JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationProviderUsed>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "provider"))),
96
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mocked"))),
97
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "recordedAt"))),
98
+ JSIConverter<std::optional<margelo::nitro::nitrogeolocation::DetectedActivity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "activity"))),
99
+ JSIConverter<std::optional<margelo::nitro::nitrogeolocation::BatterySnapshot>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "battery"))),
100
+ JSIConverter<margelo::nitro::nitrogeolocation::GeolocationCoordinates>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "coords"))),
101
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp")))
102
+ );
103
+ }
104
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::StoredBackgroundLocation& arg) {
105
+ jsi::Object obj(runtime);
106
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "id"), JSIConverter<std::string>::toJSI(runtime, arg.id));
107
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "deliveredToJS"), JSIConverter<bool>::toJSI(runtime, arg.deliveredToJS));
108
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "synced"), JSIConverter<bool>::toJSI(runtime, arg.synced));
109
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "createdAt"), JSIConverter<double>::toJSI(runtime, arg.createdAt));
110
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "source"), JSIConverter<margelo::nitro::nitrogeolocation::BackgroundLocationSource>::toJSI(runtime, arg.source));
111
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "isFromBackground"), JSIConverter<bool>::toJSI(runtime, arg.isFromBackground));
112
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "provider"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationProviderUsed>>::toJSI(runtime, arg.provider));
113
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "mocked"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.mocked));
114
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "recordedAt"), JSIConverter<double>::toJSI(runtime, arg.recordedAt));
115
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "activity"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::DetectedActivity>>::toJSI(runtime, arg.activity));
116
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "battery"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::BatterySnapshot>>::toJSI(runtime, arg.battery));
117
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "coords"), JSIConverter<margelo::nitro::nitrogeolocation::GeolocationCoordinates>::toJSI(runtime, arg.coords));
118
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "timestamp"), JSIConverter<double>::toJSI(runtime, arg.timestamp));
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 (!nitro::isPlainObject(runtime, obj)) {
127
+ return false;
128
+ }
129
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id")))) return false;
130
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "deliveredToJS")))) return false;
131
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "synced")))) return false;
132
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "createdAt")))) return false;
133
+ if (!JSIConverter<margelo::nitro::nitrogeolocation::BackgroundLocationSource>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "source")))) return false;
134
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isFromBackground")))) return false;
135
+ if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationProviderUsed>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "provider")))) return false;
136
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mocked")))) return false;
137
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "recordedAt")))) return false;
138
+ if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::DetectedActivity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "activity")))) return false;
139
+ if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::BatterySnapshot>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "battery")))) return false;
140
+ if (!JSIConverter<margelo::nitro::nitrogeolocation::GeolocationCoordinates>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "coords")))) return false;
141
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp")))) return false;
142
+ return true;
143
+ }
144
+ };
145
+
146
+ } // namespace margelo::nitro
package/package.json CHANGED
@@ -1,17 +1,29 @@
1
1
  {
2
2
  "name": "react-native-nitro-geolocation",
3
- "version": "1.2.6",
3
+ "version": "1.3.1",
4
4
  "description": "Nitro-powered native geolocation for modern React Native apps",
5
5
  "main": "src/index",
6
6
  "source": "src/index",
7
+ "browser": "src/index.web.tsx",
8
+ "react-native": "src/index.tsx",
7
9
  "exports": {
8
10
  ".": {
9
11
  "types": "./src/index.tsx",
12
+ "browser": "./src/index.web.tsx",
13
+ "react-native": "./src/index.tsx",
10
14
  "default": "./src/index.tsx"
11
15
  },
12
16
  "./compat": {
13
17
  "types": "./src/compat/index.tsx",
18
+ "browser": "./src/compat/index.web.ts",
19
+ "react-native": "./src/compat/index.tsx",
14
20
  "default": "./src/compat/index.tsx"
21
+ },
22
+ "./background": {
23
+ "types": "./src/background/index.ts",
24
+ "browser": "./src/background/index.web.ts",
25
+ "react-native": "./src/background/index.ts",
26
+ "default": "./src/background/index.ts"
15
27
  }
16
28
  },
17
29
  "codegenConfig": {
@@ -49,12 +61,8 @@
49
61
  },
50
62
  "files": [
51
63
  "src",
52
- "react-native.config.js",
53
- "lib",
54
64
  "nitrogen",
55
- "cpp",
56
65
  "android/build.gradle",
57
- "android/fix-prefab.gradle",
58
66
  "android/gradle.properties",
59
67
  "android/CMakeLists.txt",
60
68
  "android/src/**/*",
@@ -63,7 +71,10 @@
63
71
  "ios/**/*.mm",
64
72
  "ios/**/*.cpp",
65
73
  "ios/**/*.swift",
66
- "app.plugin.js",
74
+ "!src/**/*.test.ts",
75
+ "!src/**/*.test.tsx",
76
+ "!src/**/*.spec.ts",
77
+ "!src/**/*.spec.tsx",
67
78
  "*.podspec",
68
79
  "README.md"
69
80
  ],
@@ -65,9 +65,9 @@ export interface GeolocationConfiguration {
65
65
 
66
66
  /**
67
67
  * Android: Location provider
68
- * - 'playServices': Use Google Play Services (fused location)
68
+ * - 'playServices': Prefer Google Play Services (fused location), then platform fallback
69
69
  * - 'android_platform': Use Android platform LocationManager
70
- * - 'auto': Use Android platform LocationManager by default
70
+ * - 'auto': Prefer Google Play Services (fused location), then platform fallback
71
71
  */
72
72
  locationProvider?: LocationProvider;
73
73
  }
@@ -296,7 +296,7 @@ export interface NitroGeolocation
296
296
  * Get whether the current platform is likely to deliver location updates.
297
297
  *
298
298
  * Android: uses Fused Location availability when the configured provider is
299
- * Play Services, otherwise falls back to platform provider/service checks.
299
+ * auto or Play Services, then falls back to platform provider/service checks.
300
300
  *
301
301
  * iOS: maps Core Location service and authorization state.
302
302
  */
@@ -347,7 +347,7 @@ export interface NitroGeolocation
347
347
  *
348
348
  * Strategy:
349
349
  * 1. Check cached location (if maximumAge allows)
350
- * 2. Request fresh location from GPS/Network
350
+ * 2. Request fresh location from the configured native provider
351
351
  * 3. Timeout after specified duration
352
352
  *
353
353
  * Internal native contract. The public JS API wraps this in a Promise so
@@ -9,7 +9,7 @@ import type { GeolocationResponse } from "../publicTypes";
9
9
  *
10
10
  * Strategy:
11
11
  * 1. Check cached location (if maximumAge allows)
12
- * 2. Request fresh location from GPS/Network
12
+ * 2. Request fresh location from the configured native provider
13
13
  * 3. Timeout after specified duration
14
14
  *
15
15
  * @param options - Location request options
@@ -13,8 +13,9 @@ import type { LocationProviderStatus } from "../publicTypes";
13
13
  * the current Core Location status:
14
14
  * - `locationServicesEnabled`: `CLLocationManager.locationServicesEnabled()`
15
15
  * - `backgroundModeEnabled`: whether `UIBackgroundModes` contains `location`
16
- * - `gpsAvailable`, `networkAvailable`, `passiveAvailable`, and
17
- * `googleLocationAccuracyEnabled`: `undefined`
16
+ * - `gpsAvailable`, `networkAvailable`, `passiveAvailable`,
17
+ * `googlePlayServicesAvailable`, and `googleLocationAccuracyEnabled`:
18
+ * `undefined`
18
19
  */
19
20
  export function requestLocationSettings(
20
21
  options?: LocationSettingsOptions