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,90 @@
1
+ ///
2
+ /// GeofencingOptions.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 `GeofenceTransition` to properly resolve imports.
32
+ namespace margelo::nitro::nitrogeolocation { enum class GeofenceTransition; }
33
+
34
+ #include "GeofenceTransition.hpp"
35
+ #include <vector>
36
+ #include <optional>
37
+
38
+ namespace margelo::nitro::nitrogeolocation {
39
+
40
+ /**
41
+ * A struct which can be represented as a JavaScript object (GeofencingOptions).
42
+ */
43
+ struct GeofencingOptions final {
44
+ public:
45
+ std::optional<std::vector<GeofenceTransition>> initialTrigger SWIFT_PRIVATE;
46
+ std::optional<double> notificationResponsiveness SWIFT_PRIVATE;
47
+
48
+ public:
49
+ GeofencingOptions() = default;
50
+ explicit GeofencingOptions(std::optional<std::vector<GeofenceTransition>> initialTrigger, std::optional<double> notificationResponsiveness): initialTrigger(initialTrigger), notificationResponsiveness(notificationResponsiveness) {}
51
+
52
+ public:
53
+ friend bool operator==(const GeofencingOptions& lhs, const GeofencingOptions& rhs) = default;
54
+ };
55
+
56
+ } // namespace margelo::nitro::nitrogeolocation
57
+
58
+ namespace margelo::nitro {
59
+
60
+ // C++ GeofencingOptions <> JS GeofencingOptions (object)
61
+ template <>
62
+ struct JSIConverter<margelo::nitro::nitrogeolocation::GeofencingOptions> final {
63
+ static inline margelo::nitro::nitrogeolocation::GeofencingOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
64
+ jsi::Object obj = arg.asObject(runtime);
65
+ return margelo::nitro::nitrogeolocation::GeofencingOptions(
66
+ JSIConverter<std::optional<std::vector<margelo::nitro::nitrogeolocation::GeofenceTransition>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "initialTrigger"))),
67
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationResponsiveness")))
68
+ );
69
+ }
70
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::GeofencingOptions& arg) {
71
+ jsi::Object obj(runtime);
72
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "initialTrigger"), JSIConverter<std::optional<std::vector<margelo::nitro::nitrogeolocation::GeofenceTransition>>>::toJSI(runtime, arg.initialTrigger));
73
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "notificationResponsiveness"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.notificationResponsiveness));
74
+ return obj;
75
+ }
76
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
77
+ if (!value.isObject()) {
78
+ return false;
79
+ }
80
+ jsi::Object obj = value.getObject(runtime);
81
+ if (!nitro::isPlainObject(runtime, obj)) {
82
+ return false;
83
+ }
84
+ if (!JSIConverter<std::optional<std::vector<margelo::nitro::nitrogeolocation::GeofenceTransition>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "initialTrigger")))) return false;
85
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationResponsiveness")))) return false;
86
+ return true;
87
+ }
88
+ };
89
+
90
+ } // namespace margelo::nitro
@@ -0,0 +1,98 @@
1
+ ///
2
+ /// GetStoredBackgroundEventsOptions.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 `BackgroundEventType` to properly resolve imports.
32
+ namespace margelo::nitro::nitrogeolocation { enum class BackgroundEventType; }
33
+
34
+ #include "BackgroundEventType.hpp"
35
+ #include <vector>
36
+ #include <optional>
37
+
38
+ namespace margelo::nitro::nitrogeolocation {
39
+
40
+ /**
41
+ * A struct which can be represented as a JavaScript object (GetStoredBackgroundEventsOptions).
42
+ */
43
+ struct GetStoredBackgroundEventsOptions final {
44
+ public:
45
+ std::optional<std::vector<BackgroundEventType>> types SWIFT_PRIVATE;
46
+ std::optional<double> limit SWIFT_PRIVATE;
47
+ std::optional<double> since SWIFT_PRIVATE;
48
+ std::optional<bool> includeDelivered SWIFT_PRIVATE;
49
+
50
+ public:
51
+ GetStoredBackgroundEventsOptions() = default;
52
+ explicit GetStoredBackgroundEventsOptions(std::optional<std::vector<BackgroundEventType>> types, std::optional<double> limit, std::optional<double> since, std::optional<bool> includeDelivered): types(types), limit(limit), since(since), includeDelivered(includeDelivered) {}
53
+
54
+ public:
55
+ friend bool operator==(const GetStoredBackgroundEventsOptions& lhs, const GetStoredBackgroundEventsOptions& rhs) = default;
56
+ };
57
+
58
+ } // namespace margelo::nitro::nitrogeolocation
59
+
60
+ namespace margelo::nitro {
61
+
62
+ // C++ GetStoredBackgroundEventsOptions <> JS GetStoredBackgroundEventsOptions (object)
63
+ template <>
64
+ struct JSIConverter<margelo::nitro::nitrogeolocation::GetStoredBackgroundEventsOptions> final {
65
+ static inline margelo::nitro::nitrogeolocation::GetStoredBackgroundEventsOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
66
+ jsi::Object obj = arg.asObject(runtime);
67
+ return margelo::nitro::nitrogeolocation::GetStoredBackgroundEventsOptions(
68
+ JSIConverter<std::optional<std::vector<margelo::nitro::nitrogeolocation::BackgroundEventType>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "types"))),
69
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "limit"))),
70
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "since"))),
71
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "includeDelivered")))
72
+ );
73
+ }
74
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::GetStoredBackgroundEventsOptions& arg) {
75
+ jsi::Object obj(runtime);
76
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "types"), JSIConverter<std::optional<std::vector<margelo::nitro::nitrogeolocation::BackgroundEventType>>>::toJSI(runtime, arg.types));
77
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "limit"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.limit));
78
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "since"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.since));
79
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "includeDelivered"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.includeDelivered));
80
+ return obj;
81
+ }
82
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
83
+ if (!value.isObject()) {
84
+ return false;
85
+ }
86
+ jsi::Object obj = value.getObject(runtime);
87
+ if (!nitro::isPlainObject(runtime, obj)) {
88
+ return false;
89
+ }
90
+ if (!JSIConverter<std::optional<std::vector<margelo::nitro::nitrogeolocation::BackgroundEventType>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "types")))) return false;
91
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "limit")))) return false;
92
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "since")))) return false;
93
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "includeDelivered")))) return false;
94
+ return true;
95
+ }
96
+ };
97
+
98
+ } // namespace margelo::nitro
@@ -0,0 +1,95 @@
1
+ ///
2
+ /// GetStoredBackgroundLocationsOptions.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 (GetStoredBackgroundLocationsOptions).
39
+ */
40
+ struct GetStoredBackgroundLocationsOptions final {
41
+ public:
42
+ std::optional<double> limit SWIFT_PRIVATE;
43
+ std::optional<double> since SWIFT_PRIVATE;
44
+ std::optional<bool> includeDelivered SWIFT_PRIVATE;
45
+ std::optional<bool> includeSynced SWIFT_PRIVATE;
46
+
47
+ public:
48
+ GetStoredBackgroundLocationsOptions() = default;
49
+ explicit GetStoredBackgroundLocationsOptions(std::optional<double> limit, std::optional<double> since, std::optional<bool> includeDelivered, std::optional<bool> includeSynced): limit(limit), since(since), includeDelivered(includeDelivered), includeSynced(includeSynced) {}
50
+
51
+ public:
52
+ friend bool operator==(const GetStoredBackgroundLocationsOptions& lhs, const GetStoredBackgroundLocationsOptions& rhs) = default;
53
+ };
54
+
55
+ } // namespace margelo::nitro::nitrogeolocation
56
+
57
+ namespace margelo::nitro {
58
+
59
+ // C++ GetStoredBackgroundLocationsOptions <> JS GetStoredBackgroundLocationsOptions (object)
60
+ template <>
61
+ struct JSIConverter<margelo::nitro::nitrogeolocation::GetStoredBackgroundLocationsOptions> final {
62
+ static inline margelo::nitro::nitrogeolocation::GetStoredBackgroundLocationsOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
63
+ jsi::Object obj = arg.asObject(runtime);
64
+ return margelo::nitro::nitrogeolocation::GetStoredBackgroundLocationsOptions(
65
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "limit"))),
66
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "since"))),
67
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "includeDelivered"))),
68
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "includeSynced")))
69
+ );
70
+ }
71
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::GetStoredBackgroundLocationsOptions& arg) {
72
+ jsi::Object obj(runtime);
73
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "limit"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.limit));
74
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "since"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.since));
75
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "includeDelivered"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.includeDelivered));
76
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "includeSynced"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.includeSynced));
77
+ return obj;
78
+ }
79
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
80
+ if (!value.isObject()) {
81
+ return false;
82
+ }
83
+ jsi::Object obj = value.getObject(runtime);
84
+ if (!nitro::isPlainObject(runtime, obj)) {
85
+ return false;
86
+ }
87
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "limit")))) return false;
88
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "since")))) return false;
89
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "includeDelivered")))) return false;
90
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "includeSynced")))) return false;
91
+ return true;
92
+ }
93
+ };
94
+
95
+ } // namespace margelo::nitro
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// HybridNitroBackgroundLocationSpec.cpp
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
+ #include "HybridNitroBackgroundLocationSpec.hpp"
9
+
10
+ namespace margelo::nitro::nitrogeolocation {
11
+
12
+ void HybridNitroBackgroundLocationSpec::loadHybridMethods() {
13
+ // load base methods/properties
14
+ HybridObject::loadHybridMethods();
15
+ // load custom methods/properties
16
+ registerHybrids(this, [](Prototype& prototype) {
17
+ prototype.registerHybridMethod("checkBackgroundPermission", &HybridNitroBackgroundLocationSpec::checkBackgroundPermission);
18
+ prototype.registerHybridMethod("requestBackgroundPermission", &HybridNitroBackgroundLocationSpec::requestBackgroundPermission);
19
+ prototype.registerHybridMethod("openAppLocationSettings", &HybridNitroBackgroundLocationSpec::openAppLocationSettings);
20
+ prototype.registerHybridMethod("configureBackgroundLocation", &HybridNitroBackgroundLocationSpec::configureBackgroundLocation);
21
+ prototype.registerHybridMethod("getBackgroundConfiguration", &HybridNitroBackgroundLocationSpec::getBackgroundConfiguration);
22
+ prototype.registerHybridMethod("startBackgroundLocation", &HybridNitroBackgroundLocationSpec::startBackgroundLocation);
23
+ prototype.registerHybridMethod("stopBackgroundLocation", &HybridNitroBackgroundLocationSpec::stopBackgroundLocation);
24
+ prototype.registerHybridMethod("resetBackgroundLocation", &HybridNitroBackgroundLocationSpec::resetBackgroundLocation);
25
+ prototype.registerHybridMethod("getBackgroundLocationStatus", &HybridNitroBackgroundLocationSpec::getBackgroundLocationStatus);
26
+ prototype.registerHybridMethod("addBackgroundEventListener", &HybridNitroBackgroundLocationSpec::addBackgroundEventListener);
27
+ prototype.registerHybridMethod("removeBackgroundEventListener", &HybridNitroBackgroundLocationSpec::removeBackgroundEventListener);
28
+ prototype.registerHybridMethod("addBackgroundLocationListener", &HybridNitroBackgroundLocationSpec::addBackgroundLocationListener);
29
+ prototype.registerHybridMethod("removeBackgroundLocationListener", &HybridNitroBackgroundLocationSpec::removeBackgroundLocationListener);
30
+ prototype.registerHybridMethod("addBackgroundErrorListener", &HybridNitroBackgroundLocationSpec::addBackgroundErrorListener);
31
+ prototype.registerHybridMethod("removeBackgroundErrorListener", &HybridNitroBackgroundLocationSpec::removeBackgroundErrorListener);
32
+ prototype.registerHybridMethod("getStoredBackgroundLocations", &HybridNitroBackgroundLocationSpec::getStoredBackgroundLocations);
33
+ prototype.registerHybridMethod("clearStoredBackgroundLocations", &HybridNitroBackgroundLocationSpec::clearStoredBackgroundLocations);
34
+ prototype.registerHybridMethod("markStoredBackgroundLocationsDelivered", &HybridNitroBackgroundLocationSpec::markStoredBackgroundLocationsDelivered);
35
+ prototype.registerHybridMethod("getStoredBackgroundEvents", &HybridNitroBackgroundLocationSpec::getStoredBackgroundEvents);
36
+ prototype.registerHybridMethod("clearStoredBackgroundEvents", &HybridNitroBackgroundLocationSpec::clearStoredBackgroundEvents);
37
+ prototype.registerHybridMethod("markStoredBackgroundEventsDelivered", &HybridNitroBackgroundLocationSpec::markStoredBackgroundEventsDelivered);
38
+ prototype.registerHybridMethod("addGeofences", &HybridNitroBackgroundLocationSpec::addGeofences);
39
+ prototype.registerHybridMethod("removeGeofences", &HybridNitroBackgroundLocationSpec::removeGeofences);
40
+ prototype.registerHybridMethod("getRegisteredGeofences", &HybridNitroBackgroundLocationSpec::getRegisteredGeofences);
41
+ prototype.registerHybridMethod("startActivityRecognition", &HybridNitroBackgroundLocationSpec::startActivityRecognition);
42
+ prototype.registerHybridMethod("stopActivityRecognition", &HybridNitroBackgroundLocationSpec::stopActivityRecognition);
43
+ prototype.registerHybridMethod("syncStoredLocations", &HybridNitroBackgroundLocationSpec::syncStoredLocations);
44
+ });
45
+ }
46
+
47
+ } // namespace margelo::nitro::nitrogeolocation
@@ -0,0 +1,133 @@
1
+ ///
2
+ /// HybridNitroBackgroundLocationSpec.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/HybridObject.hpp>)
11
+ #include <NitroModules/HybridObject.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+
16
+ // Forward declaration of `BackgroundPermissionResult` to properly resolve imports.
17
+ namespace margelo::nitro::nitrogeolocation { struct BackgroundPermissionResult; }
18
+ // Forward declaration of `BackgroundLocationOptions` to properly resolve imports.
19
+ namespace margelo::nitro::nitrogeolocation { struct BackgroundLocationOptions; }
20
+ // Forward declaration of `BackgroundLocationStatus` to properly resolve imports.
21
+ namespace margelo::nitro::nitrogeolocation { struct BackgroundLocationStatus; }
22
+ // Forward declaration of `BackgroundEventEnvelope` to properly resolve imports.
23
+ namespace margelo::nitro::nitrogeolocation { struct BackgroundEventEnvelope; }
24
+ // Forward declaration of `BackgroundLocation` to properly resolve imports.
25
+ namespace margelo::nitro::nitrogeolocation { struct BackgroundLocation; }
26
+ // Forward declaration of `LocationError` to properly resolve imports.
27
+ namespace margelo::nitro::nitrogeolocation { struct LocationError; }
28
+ // Forward declaration of `StoredBackgroundLocation` to properly resolve imports.
29
+ namespace margelo::nitro::nitrogeolocation { struct StoredBackgroundLocation; }
30
+ // Forward declaration of `GetStoredBackgroundLocationsOptions` to properly resolve imports.
31
+ namespace margelo::nitro::nitrogeolocation { struct GetStoredBackgroundLocationsOptions; }
32
+ // Forward declaration of `StoredBackgroundEventEnvelope` to properly resolve imports.
33
+ namespace margelo::nitro::nitrogeolocation { struct StoredBackgroundEventEnvelope; }
34
+ // Forward declaration of `GetStoredBackgroundEventsOptions` to properly resolve imports.
35
+ namespace margelo::nitro::nitrogeolocation { struct GetStoredBackgroundEventsOptions; }
36
+ // Forward declaration of `GeofenceRegion` to properly resolve imports.
37
+ namespace margelo::nitro::nitrogeolocation { struct GeofenceRegion; }
38
+ // Forward declaration of `GeofencingOptions` to properly resolve imports.
39
+ namespace margelo::nitro::nitrogeolocation { struct GeofencingOptions; }
40
+ // Forward declaration of `ActivityRecognitionOptions` to properly resolve imports.
41
+ namespace margelo::nitro::nitrogeolocation { struct ActivityRecognitionOptions; }
42
+ // Forward declaration of `BackgroundHttpSyncResult` to properly resolve imports.
43
+ namespace margelo::nitro::nitrogeolocation { struct BackgroundHttpSyncResult; }
44
+
45
+ #include "BackgroundPermissionResult.hpp"
46
+ #include <NitroModules/Promise.hpp>
47
+ #include "BackgroundLocationOptions.hpp"
48
+ #include <optional>
49
+ #include "BackgroundLocationStatus.hpp"
50
+ #include <string>
51
+ #include "BackgroundEventEnvelope.hpp"
52
+ #include <functional>
53
+ #include "BackgroundLocation.hpp"
54
+ #include "LocationError.hpp"
55
+ #include "StoredBackgroundLocation.hpp"
56
+ #include <vector>
57
+ #include "GetStoredBackgroundLocationsOptions.hpp"
58
+ #include "StoredBackgroundEventEnvelope.hpp"
59
+ #include "GetStoredBackgroundEventsOptions.hpp"
60
+ #include "GeofenceRegion.hpp"
61
+ #include "GeofencingOptions.hpp"
62
+ #include "ActivityRecognitionOptions.hpp"
63
+ #include "BackgroundHttpSyncResult.hpp"
64
+
65
+ namespace margelo::nitro::nitrogeolocation {
66
+
67
+ using namespace margelo::nitro;
68
+
69
+ /**
70
+ * An abstract base class for `NitroBackgroundLocation`
71
+ * Inherit this class to create instances of `HybridNitroBackgroundLocationSpec` in C++.
72
+ * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
73
+ * @example
74
+ * ```cpp
75
+ * class HybridNitroBackgroundLocation: public HybridNitroBackgroundLocationSpec {
76
+ * public:
77
+ * HybridNitroBackgroundLocation(...): HybridObject(TAG) { ... }
78
+ * // ...
79
+ * };
80
+ * ```
81
+ */
82
+ class HybridNitroBackgroundLocationSpec: public virtual HybridObject {
83
+ public:
84
+ // Constructor
85
+ explicit HybridNitroBackgroundLocationSpec(): HybridObject(TAG) { }
86
+
87
+ // Destructor
88
+ ~HybridNitroBackgroundLocationSpec() override = default;
89
+
90
+ public:
91
+ // Properties
92
+
93
+
94
+ public:
95
+ // Methods
96
+ virtual std::shared_ptr<Promise<BackgroundPermissionResult>> checkBackgroundPermission() = 0;
97
+ virtual std::shared_ptr<Promise<BackgroundPermissionResult>> requestBackgroundPermission() = 0;
98
+ virtual std::shared_ptr<Promise<void>> openAppLocationSettings() = 0;
99
+ virtual std::shared_ptr<Promise<void>> configureBackgroundLocation(const BackgroundLocationOptions& options) = 0;
100
+ virtual std::shared_ptr<Promise<std::optional<BackgroundLocationOptions>>> getBackgroundConfiguration() = 0;
101
+ virtual std::shared_ptr<Promise<void>> startBackgroundLocation(const std::optional<BackgroundLocationOptions>& options) = 0;
102
+ virtual std::shared_ptr<Promise<void>> stopBackgroundLocation() = 0;
103
+ virtual std::shared_ptr<Promise<void>> resetBackgroundLocation() = 0;
104
+ virtual std::shared_ptr<Promise<BackgroundLocationStatus>> getBackgroundLocationStatus() = 0;
105
+ virtual std::string addBackgroundEventListener(const std::function<void(const BackgroundEventEnvelope& /* event */)>& listener) = 0;
106
+ virtual void removeBackgroundEventListener(const std::string& token) = 0;
107
+ virtual std::string addBackgroundLocationListener(const std::function<void(const BackgroundLocation& /* location */)>& listener) = 0;
108
+ virtual void removeBackgroundLocationListener(const std::string& token) = 0;
109
+ virtual std::string addBackgroundErrorListener(const std::function<void(const LocationError& /* error */)>& listener) = 0;
110
+ virtual void removeBackgroundErrorListener(const std::string& token) = 0;
111
+ virtual std::shared_ptr<Promise<std::vector<StoredBackgroundLocation>>> getStoredBackgroundLocations(const std::optional<GetStoredBackgroundLocationsOptions>& options) = 0;
112
+ virtual std::shared_ptr<Promise<void>> clearStoredBackgroundLocations(const std::optional<std::vector<std::string>>& ids) = 0;
113
+ virtual std::shared_ptr<Promise<void>> markStoredBackgroundLocationsDelivered(const std::vector<std::string>& ids) = 0;
114
+ virtual std::shared_ptr<Promise<std::vector<StoredBackgroundEventEnvelope>>> getStoredBackgroundEvents(const std::optional<GetStoredBackgroundEventsOptions>& options) = 0;
115
+ virtual std::shared_ptr<Promise<void>> clearStoredBackgroundEvents(const std::optional<std::vector<std::string>>& ids) = 0;
116
+ virtual std::shared_ptr<Promise<void>> markStoredBackgroundEventsDelivered(const std::vector<std::string>& ids) = 0;
117
+ virtual std::shared_ptr<Promise<void>> addGeofences(const std::vector<GeofenceRegion>& regions, const std::optional<GeofencingOptions>& options) = 0;
118
+ virtual std::shared_ptr<Promise<void>> removeGeofences(const std::optional<std::vector<std::string>>& identifiers) = 0;
119
+ virtual std::shared_ptr<Promise<std::vector<GeofenceRegion>>> getRegisteredGeofences() = 0;
120
+ virtual std::shared_ptr<Promise<void>> startActivityRecognition(const std::optional<ActivityRecognitionOptions>& options) = 0;
121
+ virtual std::shared_ptr<Promise<void>> stopActivityRecognition() = 0;
122
+ virtual std::shared_ptr<Promise<BackgroundHttpSyncResult>> syncStoredLocations() = 0;
123
+
124
+ protected:
125
+ // Hybrid Setup
126
+ void loadHybridMethods() override;
127
+
128
+ protected:
129
+ // Tag for logging
130
+ static constexpr auto TAG = "NitroBackgroundLocation";
131
+ };
132
+
133
+ } // namespace margelo::nitro::nitrogeolocation
@@ -0,0 +1,88 @@
1
+ ///
2
+ /// IOSBackgroundActivityType.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 (IOSBackgroundActivityType).
30
+ */
31
+ enum class IOSBackgroundActivityType {
32
+ OTHER SWIFT_NAME(other) = 0,
33
+ AUTOMOTIVENAVIGATION SWIFT_NAME(automotivenavigation) = 1,
34
+ FITNESS SWIFT_NAME(fitness) = 2,
35
+ OTHERNAVIGATION SWIFT_NAME(othernavigation) = 3,
36
+ AIRBORNE SWIFT_NAME(airborne) = 4,
37
+ } CLOSED_ENUM;
38
+
39
+ } // namespace margelo::nitro::nitrogeolocation
40
+
41
+ namespace margelo::nitro {
42
+
43
+ // C++ IOSBackgroundActivityType <> JS IOSBackgroundActivityType (union)
44
+ template <>
45
+ struct JSIConverter<margelo::nitro::nitrogeolocation::IOSBackgroundActivityType> final {
46
+ static inline margelo::nitro::nitrogeolocation::IOSBackgroundActivityType 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("other"): return margelo::nitro::nitrogeolocation::IOSBackgroundActivityType::OTHER;
50
+ case hashString("automotiveNavigation"): return margelo::nitro::nitrogeolocation::IOSBackgroundActivityType::AUTOMOTIVENAVIGATION;
51
+ case hashString("fitness"): return margelo::nitro::nitrogeolocation::IOSBackgroundActivityType::FITNESS;
52
+ case hashString("otherNavigation"): return margelo::nitro::nitrogeolocation::IOSBackgroundActivityType::OTHERNAVIGATION;
53
+ case hashString("airborne"): return margelo::nitro::nitrogeolocation::IOSBackgroundActivityType::AIRBORNE;
54
+ default: [[unlikely]]
55
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum IOSBackgroundActivityType - invalid value!");
56
+ }
57
+ }
58
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitrogeolocation::IOSBackgroundActivityType arg) {
59
+ switch (arg) {
60
+ case margelo::nitro::nitrogeolocation::IOSBackgroundActivityType::OTHER: return JSIConverter<std::string>::toJSI(runtime, "other");
61
+ case margelo::nitro::nitrogeolocation::IOSBackgroundActivityType::AUTOMOTIVENAVIGATION: return JSIConverter<std::string>::toJSI(runtime, "automotiveNavigation");
62
+ case margelo::nitro::nitrogeolocation::IOSBackgroundActivityType::FITNESS: return JSIConverter<std::string>::toJSI(runtime, "fitness");
63
+ case margelo::nitro::nitrogeolocation::IOSBackgroundActivityType::OTHERNAVIGATION: return JSIConverter<std::string>::toJSI(runtime, "otherNavigation");
64
+ case margelo::nitro::nitrogeolocation::IOSBackgroundActivityType::AIRBORNE: return JSIConverter<std::string>::toJSI(runtime, "airborne");
65
+ default: [[unlikely]]
66
+ throw std::invalid_argument("Cannot convert IOSBackgroundActivityType 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("other"):
77
+ case hashString("automotiveNavigation"):
78
+ case hashString("fitness"):
79
+ case hashString("otherNavigation"):
80
+ case hashString("airborne"):
81
+ return true;
82
+ default:
83
+ return false;
84
+ }
85
+ }
86
+ };
87
+
88
+ } // namespace margelo::nitro