react-native-nitro-geolocation 1.1.4 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/README.md +97 -9
  2. package/android/build.gradle +6 -0
  3. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidAccuracy.kt +105 -0
  4. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidHeadingManager.kt +313 -0
  5. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidLocationSettings.kt +313 -0
  6. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/GetCurrentPosition.kt +46 -45
  7. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/LocationMetadata.kt +26 -0
  8. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/LocationValues.kt +31 -0
  9. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/NitroGeolocation.kt +1027 -140
  10. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/NitroGeolocationCompat.kt +11 -11
  11. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/RequestAuthorization.kt +6 -6
  12. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/WatchPosition.kt +46 -45
  13. package/ios/CLLocation+GeolocationMetadata.swift +32 -0
  14. package/ios/LocationManager.swift +205 -51
  15. package/ios/NitroGeolocation.swift +949 -110
  16. package/ios/NitroGeolocationCompat.swift +7 -7
  17. package/nitrogen/generated/android/c++/JAccuracyAuthorization.hpp +61 -0
  18. package/nitrogen/generated/android/c++/JAndroidAccuracyPreset.hpp +64 -0
  19. package/nitrogen/generated/android/c++/JAndroidGranularity.hpp +61 -0
  20. package/nitrogen/generated/android/c++/{JRNConfigurationInternal.hpp → JCompatGeolocationConfigurationInternal.hpp} +10 -10
  21. package/nitrogen/generated/android/c++/{JGeolocationError.hpp → JCompatGeolocationError.hpp} +10 -10
  22. package/nitrogen/generated/android/c++/JCompatGeolocationOptions.hpp +105 -0
  23. package/nitrogen/generated/android/c++/JCompatGeolocationResponse.hpp +67 -0
  24. package/nitrogen/generated/android/c++/JFunc_void_AccuracyAuthorization.hpp +77 -0
  25. package/nitrogen/generated/android/c++/JFunc_void_CompatGeolocationError.hpp +78 -0
  26. package/nitrogen/generated/android/c++/JFunc_void_CompatGeolocationResponse.hpp +84 -0
  27. package/nitrogen/generated/android/c++/JFunc_void_GeolocationResponse.hpp +2 -0
  28. package/nitrogen/generated/android/c++/JFunc_void_Heading.hpp +78 -0
  29. package/nitrogen/generated/android/c++/JFunc_void_LocationProviderStatus.hpp +78 -0
  30. package/nitrogen/generated/android/c++/JFunc_void_PermissionStatus.hpp +77 -0
  31. package/nitrogen/generated/android/c++/JFunc_void_std__vector_GeocodedLocation_.hpp +97 -0
  32. package/nitrogen/generated/android/c++/JFunc_void_std__vector_ReverseGeocodedAddress_.hpp +98 -0
  33. package/nitrogen/generated/android/c++/JGeocodedLocation.hpp +65 -0
  34. package/nitrogen/generated/android/c++/JGeocodingCoordinates.hpp +61 -0
  35. package/nitrogen/generated/android/c++/{JModernGeolocationConfiguration.hpp → JGeolocationConfiguration.hpp} +10 -10
  36. package/nitrogen/generated/android/c++/JGeolocationResponse.hpp +13 -3
  37. package/nitrogen/generated/android/c++/JHeading.hpp +69 -0
  38. package/nitrogen/generated/android/c++/JHeadingOptions.hpp +57 -0
  39. package/nitrogen/generated/android/c++/JHybridNitroGeolocationCompatSpec.cpp +46 -30
  40. package/nitrogen/generated/android/c++/JHybridNitroGeolocationCompatSpec.hpp +4 -4
  41. package/nitrogen/generated/android/c++/JHybridNitroGeolocationSpec.cpp +169 -33
  42. package/nitrogen/generated/android/c++/JHybridNitroGeolocationSpec.hpp +14 -3
  43. package/nitrogen/generated/android/c++/JIOSAccuracyPreset.hpp +73 -0
  44. package/nitrogen/generated/android/c++/JIOSActivityType.hpp +67 -0
  45. package/nitrogen/generated/android/c++/JLocationAccuracyOptions.hpp +65 -0
  46. package/nitrogen/generated/android/c++/JLocationAvailability.hpp +62 -0
  47. package/nitrogen/generated/android/c++/JLocationProviderStatus.hpp +77 -0
  48. package/nitrogen/generated/android/c++/JLocationProviderUsed.hpp +67 -0
  49. package/nitrogen/generated/android/c++/JLocationRequestOptions.hpp +49 -3
  50. package/nitrogen/generated/android/c++/{JGeolocationOptions.hpp → JLocationSettingsOptions.hpp} +28 -22
  51. package/nitrogen/generated/android/c++/JReverseGeocodedAddress.hpp +82 -0
  52. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/AccuracyAuthorization.kt +24 -0
  53. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/AndroidAccuracyPreset.kt +25 -0
  54. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/AndroidGranularity.kt +24 -0
  55. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/{RNConfigurationInternal.kt → CompatGeolocationConfigurationInternal.kt} +5 -5
  56. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/{GeolocationError.kt → CompatGeolocationError.kt} +5 -5
  57. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/CompatGeolocationOptions.kt +68 -0
  58. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/CompatGeolocationResponse.kt +41 -0
  59. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_AccuracyAuthorization.kt +80 -0
  60. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/{Func_void_GeolocationError.kt → Func_void_CompatGeolocationError.kt} +9 -9
  61. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_CompatGeolocationResponse.kt +80 -0
  62. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_Heading.kt +80 -0
  63. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_LocationProviderStatus.kt +80 -0
  64. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_PermissionStatus.kt +80 -0
  65. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_std__vector_GeocodedLocation_.kt +80 -0
  66. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_std__vector_ReverseGeocodedAddress_.kt +80 -0
  67. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeocodedLocation.kt +44 -0
  68. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeocodingCoordinates.kt +41 -0
  69. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/{ModernGeolocationConfiguration.kt → GeolocationConfiguration.kt} +5 -5
  70. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeolocationResponse.kt +9 -3
  71. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Heading.kt +47 -0
  72. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/HeadingOptions.kt +38 -0
  73. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/HybridNitroGeolocationCompatSpec.kt +7 -7
  74. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/HybridNitroGeolocationSpec.kt +92 -3
  75. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/IOSAccuracyPreset.kt +28 -0
  76. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/IOSActivityType.kt +26 -0
  77. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationAccuracyOptions.kt +41 -0
  78. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationAvailability.kt +41 -0
  79. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationProviderStatus.kt +53 -0
  80. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationProviderUsed.kt +26 -0
  81. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationRequestOptions.kt +30 -3
  82. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/{GeolocationOptions.kt → LocationSettingsOptions.kt} +11 -11
  83. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/ReverseGeocodedAddress.kt +56 -0
  84. package/nitrogen/generated/android/nitrogeolocationOnLoad.cpp +18 -4
  85. package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Bridge.cpp +76 -12
  86. package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Bridge.hpp +519 -77
  87. package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Umbrella.hpp +61 -12
  88. package/nitrogen/generated/ios/c++/HybridNitroGeolocationCompatSpecSwift.hpp +28 -16
  89. package/nitrogen/generated/ios/c++/HybridNitroGeolocationSpecSwift.hpp +131 -13
  90. package/nitrogen/generated/ios/swift/AccuracyAuthorization.swift +44 -0
  91. package/nitrogen/generated/ios/swift/AndroidAccuracyPreset.swift +48 -0
  92. package/nitrogen/generated/ios/swift/AndroidGranularity.swift +44 -0
  93. package/nitrogen/generated/ios/swift/{RNConfigurationInternal.swift → CompatGeolocationConfigurationInternal.swift} +5 -5
  94. package/nitrogen/generated/ios/swift/{GeolocationError.swift → CompatGeolocationError.swift} +5 -5
  95. package/nitrogen/generated/ios/swift/CompatGeolocationOptions.swift +208 -0
  96. package/nitrogen/generated/ios/swift/CompatGeolocationResponse.swift +34 -0
  97. package/nitrogen/generated/ios/swift/Func_void_AccuracyAuthorization.swift +46 -0
  98. package/nitrogen/generated/ios/swift/Func_void_CompatGeolocationError.swift +46 -0
  99. package/nitrogen/generated/ios/swift/Func_void_CompatGeolocationResponse.swift +46 -0
  100. package/nitrogen/generated/ios/swift/{Func_void_GeolocationError.swift → Func_void_Heading.swift} +11 -11
  101. package/nitrogen/generated/ios/swift/Func_void_LocationAvailability.swift +46 -0
  102. package/nitrogen/generated/ios/swift/Func_void_LocationProviderStatus.swift +46 -0
  103. package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
  104. package/nitrogen/generated/ios/swift/Func_void_std__vector_GeocodedLocation_.swift +46 -0
  105. package/nitrogen/generated/ios/swift/Func_void_std__vector_ReverseGeocodedAddress_.swift +46 -0
  106. package/nitrogen/generated/ios/swift/GeocodedLocation.swift +52 -0
  107. package/nitrogen/generated/ios/swift/GeocodingCoordinates.swift +34 -0
  108. package/nitrogen/generated/ios/swift/{ModernGeolocationConfiguration.swift → GeolocationConfiguration.swift} +5 -5
  109. package/nitrogen/generated/ios/swift/GeolocationResponse.swift +31 -2
  110. package/nitrogen/generated/ios/swift/Heading.swift +70 -0
  111. package/nitrogen/generated/ios/swift/HeadingOptions.swift +42 -0
  112. package/nitrogen/generated/ios/swift/HybridNitroGeolocationCompatSpec.swift +4 -4
  113. package/nitrogen/generated/ios/swift/HybridNitroGeolocationCompatSpec_cxx.swift +28 -28
  114. package/nitrogen/generated/ios/swift/HybridNitroGeolocationSpec.swift +14 -3
  115. package/nitrogen/generated/ios/swift/HybridNitroGeolocationSpec_cxx.swift +318 -15
  116. package/nitrogen/generated/ios/swift/IOSAccuracyPreset.swift +60 -0
  117. package/nitrogen/generated/ios/swift/IOSActivityType.swift +52 -0
  118. package/nitrogen/generated/ios/swift/LocationAccuracyOptions.swift +46 -0
  119. package/nitrogen/generated/ios/swift/LocationAvailability.swift +47 -0
  120. package/nitrogen/generated/ios/swift/LocationProviderStatus.swift +106 -0
  121. package/nitrogen/generated/ios/swift/LocationProviderUsed.swift +52 -0
  122. package/nitrogen/generated/ios/swift/LocationRequestOptions.swift +142 -1
  123. package/nitrogen/generated/ios/swift/{GeolocationOptions.swift → LocationSettingsOptions.swift} +39 -46
  124. package/nitrogen/generated/ios/swift/ReverseGeocodedAddress.swift +150 -0
  125. package/nitrogen/generated/shared/c++/AccuracyAuthorization.hpp +80 -0
  126. package/nitrogen/generated/shared/c++/AndroidAccuracyPreset.hpp +84 -0
  127. package/nitrogen/generated/shared/c++/AndroidGranularity.hpp +80 -0
  128. package/nitrogen/generated/shared/c++/{RNConfigurationInternal.hpp → CompatGeolocationConfigurationInternal.hpp} +11 -11
  129. package/nitrogen/generated/shared/c++/{GeolocationError.hpp → CompatGeolocationError.hpp} +11 -11
  130. package/nitrogen/generated/shared/c++/CompatGeolocationOptions.hpp +128 -0
  131. package/nitrogen/generated/shared/c++/CompatGeolocationResponse.hpp +88 -0
  132. package/nitrogen/generated/shared/c++/GeocodedLocation.hpp +91 -0
  133. package/nitrogen/generated/shared/c++/GeocodingCoordinates.hpp +87 -0
  134. package/nitrogen/generated/shared/c++/{ModernGeolocationConfiguration.hpp → GeolocationConfiguration.hpp} +11 -11
  135. package/nitrogen/generated/shared/c++/GeolocationResponse.hpp +14 -2
  136. package/nitrogen/generated/shared/c++/Heading.hpp +95 -0
  137. package/nitrogen/generated/shared/c++/HeadingOptions.hpp +83 -0
  138. package/nitrogen/generated/shared/c++/HybridNitroGeolocationCompatSpec.hpp +16 -16
  139. package/nitrogen/generated/shared/c++/HybridNitroGeolocationSpec.cpp +11 -0
  140. package/nitrogen/generated/shared/c++/HybridNitroGeolocationSpec.hpp +51 -12
  141. package/nitrogen/generated/shared/c++/IOSAccuracyPreset.hpp +96 -0
  142. package/nitrogen/generated/shared/c++/IOSActivityType.hpp +88 -0
  143. package/nitrogen/generated/shared/c++/LocationAccuracyOptions.hpp +92 -0
  144. package/nitrogen/generated/shared/c++/LocationAvailability.hpp +88 -0
  145. package/nitrogen/generated/shared/c++/LocationProviderStatus.hpp +103 -0
  146. package/nitrogen/generated/shared/c++/LocationProviderUsed.hpp +88 -0
  147. package/nitrogen/generated/shared/c++/LocationRequestOptions.hpp +47 -3
  148. package/nitrogen/generated/shared/c++/{GeolocationOptions.hpp → LocationSettingsOptions.hpp} +26 -24
  149. package/nitrogen/generated/shared/c++/ReverseGeocodedAddress.hpp +108 -0
  150. package/package.json +1 -1
  151. package/src/NitroGeolocation.nitro.ts +292 -18
  152. package/src/NitroGeolocationCompat.nitro.ts +12 -12
  153. package/src/api/geocode.ts +18 -0
  154. package/src/api/getAccuracyAuthorization.ts +12 -0
  155. package/src/api/getCurrentPosition.ts +5 -3
  156. package/src/api/getHeading.ts +13 -0
  157. package/src/api/getLastKnownPosition.ts +28 -0
  158. package/src/api/getLocationAvailability.ts +11 -0
  159. package/src/api/getProviderStatus.ts +16 -0
  160. package/src/api/hasServicesEnabled.ts +13 -0
  161. package/src/api/index.ts +11 -0
  162. package/src/api/requestLocationSettings.ts +29 -0
  163. package/src/api/requestPermission.ts +3 -1
  164. package/src/api/requestTemporaryFullAccuracy.ts +21 -0
  165. package/src/api/reverseGeocode.ts +23 -0
  166. package/src/api/setConfiguration.ts +8 -4
  167. package/src/api/watchHeading.ts +19 -0
  168. package/src/api/watchPosition.ts +2 -2
  169. package/src/compat/getCurrentPosition.ts +7 -7
  170. package/src/compat/index.tsx +5 -5
  171. package/src/compat/requestAuthorization.ts +2 -2
  172. package/src/compat/setRNConfiguration.ts +7 -5
  173. package/src/compat/watchPosition.ts +7 -7
  174. package/src/devtools/getCurrentPosition.ts +5 -3
  175. package/src/devtools/index.ts +1 -1
  176. package/src/devtools/watchPosition.ts +6 -7
  177. package/src/hooks/useWatchPosition.ts +2 -2
  178. package/src/index.tsx +35 -6
  179. package/src/publicTypes.ts +108 -0
  180. package/src/types.ts +113 -37
  181. package/src/utils/errors.test.ts +65 -0
  182. package/src/utils/errors.ts +45 -18
  183. package/src/utils/index.ts +2 -2
  184. package/src/utils/provider.test.ts +172 -1
  185. package/src/utils/provider.ts +50 -5
  186. package/nitrogen/generated/android/c++/JFunc_void_GeolocationError.hpp +0 -78
@@ -1,5 +1,5 @@
1
1
  ///
2
- /// ModernGeolocationConfiguration.hpp
2
+ /// GeolocationConfiguration.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
5
  /// Copyright © Marc Rousavy @ Margelo
@@ -40,9 +40,9 @@ namespace margelo::nitro::nitrogeolocation { enum class LocationProvider; }
40
40
  namespace margelo::nitro::nitrogeolocation {
41
41
 
42
42
  /**
43
- * A struct which can be represented as a JavaScript object (ModernGeolocationConfiguration).
43
+ * A struct which can be represented as a JavaScript object (GeolocationConfiguration).
44
44
  */
45
- struct ModernGeolocationConfiguration final {
45
+ struct GeolocationConfiguration final {
46
46
  public:
47
47
  std::optional<bool> autoRequestPermission SWIFT_PRIVATE;
48
48
  std::optional<AuthorizationLevel> authorizationLevel SWIFT_PRIVATE;
@@ -50,30 +50,30 @@ namespace margelo::nitro::nitrogeolocation {
50
50
  std::optional<LocationProvider> locationProvider SWIFT_PRIVATE;
51
51
 
52
52
  public:
53
- ModernGeolocationConfiguration() = default;
54
- explicit ModernGeolocationConfiguration(std::optional<bool> autoRequestPermission, std::optional<AuthorizationLevel> authorizationLevel, std::optional<bool> enableBackgroundLocationUpdates, std::optional<LocationProvider> locationProvider): autoRequestPermission(autoRequestPermission), authorizationLevel(authorizationLevel), enableBackgroundLocationUpdates(enableBackgroundLocationUpdates), locationProvider(locationProvider) {}
53
+ GeolocationConfiguration() = default;
54
+ explicit GeolocationConfiguration(std::optional<bool> autoRequestPermission, std::optional<AuthorizationLevel> authorizationLevel, std::optional<bool> enableBackgroundLocationUpdates, std::optional<LocationProvider> locationProvider): autoRequestPermission(autoRequestPermission), authorizationLevel(authorizationLevel), enableBackgroundLocationUpdates(enableBackgroundLocationUpdates), locationProvider(locationProvider) {}
55
55
 
56
56
  public:
57
- friend bool operator==(const ModernGeolocationConfiguration& lhs, const ModernGeolocationConfiguration& rhs) = default;
57
+ friend bool operator==(const GeolocationConfiguration& lhs, const GeolocationConfiguration& rhs) = default;
58
58
  };
59
59
 
60
60
  } // namespace margelo::nitro::nitrogeolocation
61
61
 
62
62
  namespace margelo::nitro {
63
63
 
64
- // C++ ModernGeolocationConfiguration <> JS ModernGeolocationConfiguration (object)
64
+ // C++ GeolocationConfiguration <> JS GeolocationConfiguration (object)
65
65
  template <>
66
- struct JSIConverter<margelo::nitro::nitrogeolocation::ModernGeolocationConfiguration> final {
67
- static inline margelo::nitro::nitrogeolocation::ModernGeolocationConfiguration fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
66
+ struct JSIConverter<margelo::nitro::nitrogeolocation::GeolocationConfiguration> final {
67
+ static inline margelo::nitro::nitrogeolocation::GeolocationConfiguration fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
68
68
  jsi::Object obj = arg.asObject(runtime);
69
- return margelo::nitro::nitrogeolocation::ModernGeolocationConfiguration(
69
+ return margelo::nitro::nitrogeolocation::GeolocationConfiguration(
70
70
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "autoRequestPermission"))),
71
71
  JSIConverter<std::optional<margelo::nitro::nitrogeolocation::AuthorizationLevel>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "authorizationLevel"))),
72
72
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableBackgroundLocationUpdates"))),
73
73
  JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationProvider>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "locationProvider")))
74
74
  );
75
75
  }
76
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::ModernGeolocationConfiguration& arg) {
76
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::GeolocationConfiguration& arg) {
77
77
  jsi::Object obj(runtime);
78
78
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "autoRequestPermission"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.autoRequestPermission));
79
79
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "authorizationLevel"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::AuthorizationLevel>>::toJSI(runtime, arg.authorizationLevel));
@@ -30,8 +30,12 @@
30
30
 
31
31
  // Forward declaration of `GeolocationCoordinates` to properly resolve imports.
32
32
  namespace margelo::nitro::nitrogeolocation { struct GeolocationCoordinates; }
33
+ // Forward declaration of `LocationProviderUsed` to properly resolve imports.
34
+ namespace margelo::nitro::nitrogeolocation { enum class LocationProviderUsed; }
33
35
 
34
36
  #include "GeolocationCoordinates.hpp"
37
+ #include <optional>
38
+ #include "LocationProviderUsed.hpp"
35
39
 
36
40
  namespace margelo::nitro::nitrogeolocation {
37
41
 
@@ -42,10 +46,12 @@ namespace margelo::nitro::nitrogeolocation {
42
46
  public:
43
47
  GeolocationCoordinates coords SWIFT_PRIVATE;
44
48
  double timestamp SWIFT_PRIVATE;
49
+ std::optional<bool> mocked SWIFT_PRIVATE;
50
+ std::optional<LocationProviderUsed> provider SWIFT_PRIVATE;
45
51
 
46
52
  public:
47
53
  GeolocationResponse() = default;
48
- explicit GeolocationResponse(GeolocationCoordinates coords, double timestamp): coords(coords), timestamp(timestamp) {}
54
+ explicit GeolocationResponse(GeolocationCoordinates coords, double timestamp, std::optional<bool> mocked, std::optional<LocationProviderUsed> provider): coords(coords), timestamp(timestamp), mocked(mocked), provider(provider) {}
49
55
 
50
56
  public:
51
57
  friend bool operator==(const GeolocationResponse& lhs, const GeolocationResponse& rhs) = default;
@@ -62,13 +68,17 @@ namespace margelo::nitro {
62
68
  jsi::Object obj = arg.asObject(runtime);
63
69
  return margelo::nitro::nitrogeolocation::GeolocationResponse(
64
70
  JSIConverter<margelo::nitro::nitrogeolocation::GeolocationCoordinates>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "coords"))),
65
- JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp")))
71
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp"))),
72
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mocked"))),
73
+ JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationProviderUsed>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "provider")))
66
74
  );
67
75
  }
68
76
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::GeolocationResponse& arg) {
69
77
  jsi::Object obj(runtime);
70
78
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "coords"), JSIConverter<margelo::nitro::nitrogeolocation::GeolocationCoordinates>::toJSI(runtime, arg.coords));
71
79
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "timestamp"), JSIConverter<double>::toJSI(runtime, arg.timestamp));
80
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "mocked"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.mocked));
81
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "provider"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationProviderUsed>>::toJSI(runtime, arg.provider));
72
82
  return obj;
73
83
  }
74
84
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -81,6 +91,8 @@ namespace margelo::nitro {
81
91
  }
82
92
  if (!JSIConverter<margelo::nitro::nitrogeolocation::GeolocationCoordinates>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "coords")))) return false;
83
93
  if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp")))) return false;
94
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mocked")))) return false;
95
+ if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationProviderUsed>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "provider")))) return false;
84
96
  return true;
85
97
  }
86
98
  };
@@ -0,0 +1,95 @@
1
+ ///
2
+ /// Heading.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 (Heading).
39
+ */
40
+ struct Heading final {
41
+ public:
42
+ double magneticHeading SWIFT_PRIVATE;
43
+ std::optional<double> trueHeading SWIFT_PRIVATE;
44
+ std::optional<double> accuracy SWIFT_PRIVATE;
45
+ double timestamp SWIFT_PRIVATE;
46
+
47
+ public:
48
+ Heading() = default;
49
+ explicit Heading(double magneticHeading, std::optional<double> trueHeading, std::optional<double> accuracy, double timestamp): magneticHeading(magneticHeading), trueHeading(trueHeading), accuracy(accuracy), timestamp(timestamp) {}
50
+
51
+ public:
52
+ friend bool operator==(const Heading& lhs, const Heading& rhs) = default;
53
+ };
54
+
55
+ } // namespace margelo::nitro::nitrogeolocation
56
+
57
+ namespace margelo::nitro {
58
+
59
+ // C++ Heading <> JS Heading (object)
60
+ template <>
61
+ struct JSIConverter<margelo::nitro::nitrogeolocation::Heading> final {
62
+ static inline margelo::nitro::nitrogeolocation::Heading fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
63
+ jsi::Object obj = arg.asObject(runtime);
64
+ return margelo::nitro::nitrogeolocation::Heading(
65
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "magneticHeading"))),
66
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "trueHeading"))),
67
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accuracy"))),
68
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp")))
69
+ );
70
+ }
71
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::Heading& arg) {
72
+ jsi::Object obj(runtime);
73
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "magneticHeading"), JSIConverter<double>::toJSI(runtime, arg.magneticHeading));
74
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "trueHeading"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.trueHeading));
75
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "accuracy"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.accuracy));
76
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "timestamp"), JSIConverter<double>::toJSI(runtime, arg.timestamp));
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<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "magneticHeading")))) return false;
88
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "trueHeading")))) return false;
89
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accuracy")))) return false;
90
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp")))) return false;
91
+ return true;
92
+ }
93
+ };
94
+
95
+ } // namespace margelo::nitro
@@ -0,0 +1,83 @@
1
+ ///
2
+ /// HeadingOptions.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 (HeadingOptions).
39
+ */
40
+ struct HeadingOptions final {
41
+ public:
42
+ std::optional<double> headingFilter SWIFT_PRIVATE;
43
+
44
+ public:
45
+ HeadingOptions() = default;
46
+ explicit HeadingOptions(std::optional<double> headingFilter): headingFilter(headingFilter) {}
47
+
48
+ public:
49
+ friend bool operator==(const HeadingOptions& lhs, const HeadingOptions& rhs) = default;
50
+ };
51
+
52
+ } // namespace margelo::nitro::nitrogeolocation
53
+
54
+ namespace margelo::nitro {
55
+
56
+ // C++ HeadingOptions <> JS HeadingOptions (object)
57
+ template <>
58
+ struct JSIConverter<margelo::nitro::nitrogeolocation::HeadingOptions> final {
59
+ static inline margelo::nitro::nitrogeolocation::HeadingOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
60
+ jsi::Object obj = arg.asObject(runtime);
61
+ return margelo::nitro::nitrogeolocation::HeadingOptions(
62
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "headingFilter")))
63
+ );
64
+ }
65
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::HeadingOptions& arg) {
66
+ jsi::Object obj(runtime);
67
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "headingFilter"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.headingFilter));
68
+ return obj;
69
+ }
70
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
71
+ if (!value.isObject()) {
72
+ return false;
73
+ }
74
+ jsi::Object obj = value.getObject(runtime);
75
+ if (!nitro::isPlainObject(runtime, obj)) {
76
+ return false;
77
+ }
78
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "headingFilter")))) return false;
79
+ return true;
80
+ }
81
+ };
82
+
83
+ } // namespace margelo::nitro
@@ -13,21 +13,21 @@
13
13
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
14
  #endif
15
15
 
16
- // Forward declaration of `RNConfigurationInternal` to properly resolve imports.
17
- namespace margelo::nitro::nitrogeolocation { struct RNConfigurationInternal; }
18
- // Forward declaration of `GeolocationError` to properly resolve imports.
19
- namespace margelo::nitro::nitrogeolocation { struct GeolocationError; }
20
- // Forward declaration of `GeolocationResponse` to properly resolve imports.
21
- namespace margelo::nitro::nitrogeolocation { struct GeolocationResponse; }
22
- // Forward declaration of `GeolocationOptions` to properly resolve imports.
23
- namespace margelo::nitro::nitrogeolocation { struct GeolocationOptions; }
16
+ // Forward declaration of `CompatGeolocationConfigurationInternal` to properly resolve imports.
17
+ namespace margelo::nitro::nitrogeolocation { struct CompatGeolocationConfigurationInternal; }
18
+ // Forward declaration of `CompatGeolocationError` to properly resolve imports.
19
+ namespace margelo::nitro::nitrogeolocation { struct CompatGeolocationError; }
20
+ // Forward declaration of `CompatGeolocationResponse` to properly resolve imports.
21
+ namespace margelo::nitro::nitrogeolocation { struct CompatGeolocationResponse; }
22
+ // Forward declaration of `CompatGeolocationOptions` to properly resolve imports.
23
+ namespace margelo::nitro::nitrogeolocation { struct CompatGeolocationOptions; }
24
24
 
25
- #include "RNConfigurationInternal.hpp"
25
+ #include "CompatGeolocationConfigurationInternal.hpp"
26
26
  #include <functional>
27
27
  #include <optional>
28
- #include "GeolocationError.hpp"
29
- #include "GeolocationResponse.hpp"
30
- #include "GeolocationOptions.hpp"
28
+ #include "CompatGeolocationError.hpp"
29
+ #include "CompatGeolocationResponse.hpp"
30
+ #include "CompatGeolocationOptions.hpp"
31
31
 
32
32
  namespace margelo::nitro::nitrogeolocation {
33
33
 
@@ -60,10 +60,10 @@ namespace margelo::nitro::nitrogeolocation {
60
60
 
61
61
  public:
62
62
  // Methods
63
- virtual void setRNConfiguration(const RNConfigurationInternal& config) = 0;
64
- virtual void requestAuthorization(const std::optional<std::function<void()>>& success, const std::optional<std::function<void(const GeolocationError& /* error */)>>& error) = 0;
65
- virtual void getCurrentPosition(const std::function<void(const GeolocationResponse& /* position */)>& success, const std::optional<std::function<void(const GeolocationError& /* error */)>>& error, const std::optional<GeolocationOptions>& options) = 0;
66
- virtual double watchPosition(const std::function<void(const GeolocationResponse& /* position */)>& success, const std::optional<std::function<void(const GeolocationError& /* error */)>>& error, const std::optional<GeolocationOptions>& options) = 0;
63
+ virtual void setRNConfiguration(const CompatGeolocationConfigurationInternal& config) = 0;
64
+ virtual void requestAuthorization(const std::optional<std::function<void()>>& success, const std::optional<std::function<void(const CompatGeolocationError& /* error */)>>& error) = 0;
65
+ virtual void getCurrentPosition(const std::function<void(const CompatGeolocationResponse& /* position */)>& success, const std::optional<std::function<void(const CompatGeolocationError& /* error */)>>& error, const std::optional<CompatGeolocationOptions>& options) = 0;
66
+ virtual double watchPosition(const std::function<void(const CompatGeolocationResponse& /* position */)>& success, const std::optional<std::function<void(const CompatGeolocationError& /* error */)>>& error, const std::optional<CompatGeolocationOptions>& options) = 0;
67
67
  virtual void clearWatch(double watchId) = 0;
68
68
  virtual void stopObserving() = 0;
69
69
 
@@ -17,7 +17,18 @@ namespace margelo::nitro::nitrogeolocation {
17
17
  prototype.registerHybridMethod("setConfiguration", &HybridNitroGeolocationSpec::setConfiguration);
18
18
  prototype.registerHybridMethod("checkPermission", &HybridNitroGeolocationSpec::checkPermission);
19
19
  prototype.registerHybridMethod("requestPermission", &HybridNitroGeolocationSpec::requestPermission);
20
+ prototype.registerHybridMethod("hasServicesEnabled", &HybridNitroGeolocationSpec::hasServicesEnabled);
21
+ prototype.registerHybridMethod("getProviderStatus", &HybridNitroGeolocationSpec::getProviderStatus);
22
+ prototype.registerHybridMethod("getLocationAvailability", &HybridNitroGeolocationSpec::getLocationAvailability);
23
+ prototype.registerHybridMethod("requestLocationSettings", &HybridNitroGeolocationSpec::requestLocationSettings);
24
+ prototype.registerHybridMethod("getAccuracyAuthorization", &HybridNitroGeolocationSpec::getAccuracyAuthorization);
25
+ prototype.registerHybridMethod("requestTemporaryFullAccuracy", &HybridNitroGeolocationSpec::requestTemporaryFullAccuracy);
20
26
  prototype.registerHybridMethod("getCurrentPosition", &HybridNitroGeolocationSpec::getCurrentPosition);
27
+ prototype.registerHybridMethod("getLastKnownPosition", &HybridNitroGeolocationSpec::getLastKnownPosition);
28
+ prototype.registerHybridMethod("geocode", &HybridNitroGeolocationSpec::geocode);
29
+ prototype.registerHybridMethod("reverseGeocode", &HybridNitroGeolocationSpec::reverseGeocode);
30
+ prototype.registerHybridMethod("getHeading", &HybridNitroGeolocationSpec::getHeading);
31
+ prototype.registerHybridMethod("watchHeading", &HybridNitroGeolocationSpec::watchHeading);
21
32
  prototype.registerHybridMethod("watchPosition", &HybridNitroGeolocationSpec::watchPosition);
22
33
  prototype.registerHybridMethod("unwatch", &HybridNitroGeolocationSpec::unwatch);
23
34
  prototype.registerHybridMethod("stopObserving", &HybridNitroGeolocationSpec::stopObserving);
@@ -13,26 +13,54 @@
13
13
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
14
  #endif
15
15
 
16
- // Forward declaration of `ModernGeolocationConfiguration` to properly resolve imports.
17
- namespace margelo::nitro::nitrogeolocation { struct ModernGeolocationConfiguration; }
16
+ // Forward declaration of `GeolocationConfiguration` to properly resolve imports.
17
+ namespace margelo::nitro::nitrogeolocation { struct GeolocationConfiguration; }
18
18
  // Forward declaration of `PermissionStatus` to properly resolve imports.
19
19
  namespace margelo::nitro::nitrogeolocation { enum class PermissionStatus; }
20
+ // Forward declaration of `LocationError` to properly resolve imports.
21
+ namespace margelo::nitro::nitrogeolocation { struct LocationError; }
22
+ // Forward declaration of `LocationProviderStatus` to properly resolve imports.
23
+ namespace margelo::nitro::nitrogeolocation { struct LocationProviderStatus; }
24
+ // Forward declaration of `LocationAvailability` to properly resolve imports.
25
+ namespace margelo::nitro::nitrogeolocation { struct LocationAvailability; }
26
+ // Forward declaration of `LocationSettingsOptions` to properly resolve imports.
27
+ namespace margelo::nitro::nitrogeolocation { struct LocationSettingsOptions; }
28
+ // Forward declaration of `AccuracyAuthorization` to properly resolve imports.
29
+ namespace margelo::nitro::nitrogeolocation { enum class AccuracyAuthorization; }
20
30
  // Forward declaration of `GeolocationResponse` to properly resolve imports.
21
31
  namespace margelo::nitro::nitrogeolocation { struct GeolocationResponse; }
22
32
  // Forward declaration of `LocationRequestOptions` to properly resolve imports.
23
33
  namespace margelo::nitro::nitrogeolocation { struct LocationRequestOptions; }
24
- // Forward declaration of `LocationError` to properly resolve imports.
25
- namespace margelo::nitro::nitrogeolocation { struct LocationError; }
34
+ // Forward declaration of `GeocodedLocation` to properly resolve imports.
35
+ namespace margelo::nitro::nitrogeolocation { struct GeocodedLocation; }
36
+ // Forward declaration of `GeocodingCoordinates` to properly resolve imports.
37
+ namespace margelo::nitro::nitrogeolocation { struct GeocodingCoordinates; }
38
+ // Forward declaration of `ReverseGeocodedAddress` to properly resolve imports.
39
+ namespace margelo::nitro::nitrogeolocation { struct ReverseGeocodedAddress; }
40
+ // Forward declaration of `Heading` to properly resolve imports.
41
+ namespace margelo::nitro::nitrogeolocation { struct Heading; }
42
+ // Forward declaration of `HeadingOptions` to properly resolve imports.
43
+ namespace margelo::nitro::nitrogeolocation { struct HeadingOptions; }
26
44
 
27
- #include "ModernGeolocationConfiguration.hpp"
45
+ #include "GeolocationConfiguration.hpp"
28
46
  #include "PermissionStatus.hpp"
29
47
  #include <NitroModules/Promise.hpp>
30
- #include "GeolocationResponse.hpp"
31
- #include "LocationRequestOptions.hpp"
32
- #include <optional>
33
- #include <string>
34
48
  #include <functional>
35
49
  #include "LocationError.hpp"
50
+ #include <optional>
51
+ #include "LocationProviderStatus.hpp"
52
+ #include "LocationAvailability.hpp"
53
+ #include "LocationSettingsOptions.hpp"
54
+ #include "AccuracyAuthorization.hpp"
55
+ #include <string>
56
+ #include "GeolocationResponse.hpp"
57
+ #include "LocationRequestOptions.hpp"
58
+ #include "GeocodedLocation.hpp"
59
+ #include <vector>
60
+ #include "GeocodingCoordinates.hpp"
61
+ #include "ReverseGeocodedAddress.hpp"
62
+ #include "Heading.hpp"
63
+ #include "HeadingOptions.hpp"
36
64
 
37
65
  namespace margelo::nitro::nitrogeolocation {
38
66
 
@@ -65,10 +93,21 @@ namespace margelo::nitro::nitrogeolocation {
65
93
 
66
94
  public:
67
95
  // Methods
68
- virtual void setConfiguration(const ModernGeolocationConfiguration& config) = 0;
96
+ virtual void setConfiguration(const GeolocationConfiguration& config) = 0;
69
97
  virtual std::shared_ptr<Promise<PermissionStatus>> checkPermission() = 0;
70
- virtual std::shared_ptr<Promise<PermissionStatus>> requestPermission() = 0;
71
- virtual std::shared_ptr<Promise<GeolocationResponse>> getCurrentPosition(const std::optional<LocationRequestOptions>& options) = 0;
98
+ virtual void requestPermission(const std::function<void(PermissionStatus /* status */)>& success, const std::optional<std::function<void(const LocationError& /* error */)>>& error) = 0;
99
+ virtual std::shared_ptr<Promise<bool>> hasServicesEnabled() = 0;
100
+ virtual std::shared_ptr<Promise<LocationProviderStatus>> getProviderStatus() = 0;
101
+ virtual std::shared_ptr<Promise<LocationAvailability>> getLocationAvailability() = 0;
102
+ virtual void requestLocationSettings(const std::function<void(const LocationProviderStatus& /* status */)>& success, const std::optional<std::function<void(const LocationError& /* error */)>>& error, const std::optional<LocationSettingsOptions>& options) = 0;
103
+ virtual std::shared_ptr<Promise<AccuracyAuthorization>> getAccuracyAuthorization() = 0;
104
+ virtual void requestTemporaryFullAccuracy(const std::string& purposeKey, const std::function<void(AccuracyAuthorization /* authorization */)>& success, const std::optional<std::function<void(const LocationError& /* error */)>>& error) = 0;
105
+ virtual void getCurrentPosition(const std::function<void(const GeolocationResponse& /* position */)>& success, const std::optional<std::function<void(const LocationError& /* error */)>>& error, const std::optional<LocationRequestOptions>& options) = 0;
106
+ virtual void getLastKnownPosition(const std::function<void(const GeolocationResponse& /* position */)>& success, const std::optional<std::function<void(const LocationError& /* error */)>>& error, const std::optional<LocationRequestOptions>& options) = 0;
107
+ virtual void geocode(const std::string& address, const std::function<void(const std::vector<GeocodedLocation>& /* locations */)>& success, const std::optional<std::function<void(const LocationError& /* error */)>>& error) = 0;
108
+ virtual void reverseGeocode(const GeocodingCoordinates& coords, const std::function<void(const std::vector<ReverseGeocodedAddress>& /* addresses */)>& success, const std::optional<std::function<void(const LocationError& /* error */)>>& error) = 0;
109
+ virtual void getHeading(const std::function<void(const Heading& /* heading */)>& success, const std::optional<std::function<void(const LocationError& /* error */)>>& error) = 0;
110
+ virtual std::string watchHeading(const std::function<void(const Heading& /* heading */)>& success, const std::optional<std::function<void(const LocationError& /* error */)>>& error, const std::optional<HeadingOptions>& options) = 0;
72
111
  virtual std::string watchPosition(const std::function<void(const GeolocationResponse& /* position */)>& success, const std::optional<std::function<void(const LocationError& /* error */)>>& error, const std::optional<LocationRequestOptions>& options) = 0;
73
112
  virtual void unwatch(const std::string& token) = 0;
74
113
  virtual void stopObserving() = 0;
@@ -0,0 +1,96 @@
1
+ ///
2
+ /// IOSAccuracyPreset.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 (IOSAccuracyPreset).
30
+ */
31
+ enum class IOSAccuracyPreset {
32
+ BESTFORNAVIGATION SWIFT_NAME(bestfornavigation) = 0,
33
+ BEST SWIFT_NAME(best) = 1,
34
+ NEARESTTENMETERS SWIFT_NAME(nearesttenmeters) = 2,
35
+ HUNDREDMETERS SWIFT_NAME(hundredmeters) = 3,
36
+ KILOMETER SWIFT_NAME(kilometer) = 4,
37
+ THREEKILOMETERS SWIFT_NAME(threekilometers) = 5,
38
+ REDUCED SWIFT_NAME(reduced) = 6,
39
+ } CLOSED_ENUM;
40
+
41
+ } // namespace margelo::nitro::nitrogeolocation
42
+
43
+ namespace margelo::nitro {
44
+
45
+ // C++ IOSAccuracyPreset <> JS IOSAccuracyPreset (union)
46
+ template <>
47
+ struct JSIConverter<margelo::nitro::nitrogeolocation::IOSAccuracyPreset> final {
48
+ static inline margelo::nitro::nitrogeolocation::IOSAccuracyPreset fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
49
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
50
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
51
+ case hashString("bestForNavigation"): return margelo::nitro::nitrogeolocation::IOSAccuracyPreset::BESTFORNAVIGATION;
52
+ case hashString("best"): return margelo::nitro::nitrogeolocation::IOSAccuracyPreset::BEST;
53
+ case hashString("nearestTenMeters"): return margelo::nitro::nitrogeolocation::IOSAccuracyPreset::NEARESTTENMETERS;
54
+ case hashString("hundredMeters"): return margelo::nitro::nitrogeolocation::IOSAccuracyPreset::HUNDREDMETERS;
55
+ case hashString("kilometer"): return margelo::nitro::nitrogeolocation::IOSAccuracyPreset::KILOMETER;
56
+ case hashString("threeKilometers"): return margelo::nitro::nitrogeolocation::IOSAccuracyPreset::THREEKILOMETERS;
57
+ case hashString("reduced"): return margelo::nitro::nitrogeolocation::IOSAccuracyPreset::REDUCED;
58
+ default: [[unlikely]]
59
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum IOSAccuracyPreset - invalid value!");
60
+ }
61
+ }
62
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitrogeolocation::IOSAccuracyPreset arg) {
63
+ switch (arg) {
64
+ case margelo::nitro::nitrogeolocation::IOSAccuracyPreset::BESTFORNAVIGATION: return JSIConverter<std::string>::toJSI(runtime, "bestForNavigation");
65
+ case margelo::nitro::nitrogeolocation::IOSAccuracyPreset::BEST: return JSIConverter<std::string>::toJSI(runtime, "best");
66
+ case margelo::nitro::nitrogeolocation::IOSAccuracyPreset::NEARESTTENMETERS: return JSIConverter<std::string>::toJSI(runtime, "nearestTenMeters");
67
+ case margelo::nitro::nitrogeolocation::IOSAccuracyPreset::HUNDREDMETERS: return JSIConverter<std::string>::toJSI(runtime, "hundredMeters");
68
+ case margelo::nitro::nitrogeolocation::IOSAccuracyPreset::KILOMETER: return JSIConverter<std::string>::toJSI(runtime, "kilometer");
69
+ case margelo::nitro::nitrogeolocation::IOSAccuracyPreset::THREEKILOMETERS: return JSIConverter<std::string>::toJSI(runtime, "threeKilometers");
70
+ case margelo::nitro::nitrogeolocation::IOSAccuracyPreset::REDUCED: return JSIConverter<std::string>::toJSI(runtime, "reduced");
71
+ default: [[unlikely]]
72
+ throw std::invalid_argument("Cannot convert IOSAccuracyPreset to JS - invalid value: "
73
+ + std::to_string(static_cast<int>(arg)) + "!");
74
+ }
75
+ }
76
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
77
+ if (!value.isString()) {
78
+ return false;
79
+ }
80
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
81
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
82
+ case hashString("bestForNavigation"):
83
+ case hashString("best"):
84
+ case hashString("nearestTenMeters"):
85
+ case hashString("hundredMeters"):
86
+ case hashString("kilometer"):
87
+ case hashString("threeKilometers"):
88
+ case hashString("reduced"):
89
+ return true;
90
+ default:
91
+ return false;
92
+ }
93
+ }
94
+ };
95
+
96
+ } // namespace margelo::nitro
@@ -0,0 +1,88 @@
1
+ ///
2
+ /// IOSActivityType.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 (IOSActivityType).
30
+ */
31
+ enum class IOSActivityType {
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++ IOSActivityType <> JS IOSActivityType (union)
44
+ template <>
45
+ struct JSIConverter<margelo::nitro::nitrogeolocation::IOSActivityType> final {
46
+ static inline margelo::nitro::nitrogeolocation::IOSActivityType 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::IOSActivityType::OTHER;
50
+ case hashString("automotiveNavigation"): return margelo::nitro::nitrogeolocation::IOSActivityType::AUTOMOTIVENAVIGATION;
51
+ case hashString("fitness"): return margelo::nitro::nitrogeolocation::IOSActivityType::FITNESS;
52
+ case hashString("otherNavigation"): return margelo::nitro::nitrogeolocation::IOSActivityType::OTHERNAVIGATION;
53
+ case hashString("airborne"): return margelo::nitro::nitrogeolocation::IOSActivityType::AIRBORNE;
54
+ default: [[unlikely]]
55
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum IOSActivityType - invalid value!");
56
+ }
57
+ }
58
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitrogeolocation::IOSActivityType arg) {
59
+ switch (arg) {
60
+ case margelo::nitro::nitrogeolocation::IOSActivityType::OTHER: return JSIConverter<std::string>::toJSI(runtime, "other");
61
+ case margelo::nitro::nitrogeolocation::IOSActivityType::AUTOMOTIVENAVIGATION: return JSIConverter<std::string>::toJSI(runtime, "automotiveNavigation");
62
+ case margelo::nitro::nitrogeolocation::IOSActivityType::FITNESS: return JSIConverter<std::string>::toJSI(runtime, "fitness");
63
+ case margelo::nitro::nitrogeolocation::IOSActivityType::OTHERNAVIGATION: return JSIConverter<std::string>::toJSI(runtime, "otherNavigation");
64
+ case margelo::nitro::nitrogeolocation::IOSActivityType::AIRBORNE: return JSIConverter<std::string>::toJSI(runtime, "airborne");
65
+ default: [[unlikely]]
66
+ throw std::invalid_argument("Cannot convert IOSActivityType 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