react-native-nitro-geolocation 1.2.3 → 1.2.5
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.
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/NitroGeolocation.kt +10 -10
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/NitroGeolocationCompat.kt +4 -4
- package/ios/NitroGeolocation.swift +17 -11
- package/ios/NitroGeolocationCompat.swift +6 -4
- package/nitrogen/generated/android/c++/JAccuracyAuthorization.hpp +1 -1
- package/nitrogen/generated/android/c++/JAndroidAccuracyPreset.hpp +1 -1
- package/nitrogen/generated/android/c++/JAndroidGranularity.hpp +1 -1
- package/nitrogen/generated/android/c++/JAuthorizationLevel.hpp +1 -1
- package/nitrogen/generated/android/c++/JAuthorizationLevelInternal.hpp +1 -1
- package/nitrogen/generated/android/c++/JCompatGeolocationConfigurationInternal.hpp +1 -1
- package/nitrogen/generated/android/c++/JCompatGeolocationError.hpp +1 -1
- package/nitrogen/generated/android/c++/JCompatGeolocationOptions.hpp +1 -1
- package/nitrogen/generated/android/c++/JCompatGeolocationResponse.hpp +1 -1
- package/nitrogen/generated/android/c++/JFunc_void.hpp +2 -2
- package/nitrogen/generated/android/c++/JFunc_void_AccuracyAuthorization.hpp +2 -2
- package/nitrogen/generated/android/c++/JFunc_void_CompatGeolocationError.hpp +2 -2
- package/nitrogen/generated/android/c++/JFunc_void_CompatGeolocationResponse.hpp +2 -2
- package/nitrogen/generated/android/c++/JFunc_void_GeolocationResponse.hpp +2 -2
- package/nitrogen/generated/android/c++/JFunc_void_Heading.hpp +2 -2
- package/nitrogen/generated/android/c++/JFunc_void_LocationError.hpp +2 -2
- package/nitrogen/generated/android/c++/JFunc_void_LocationProviderStatus.hpp +2 -2
- package/nitrogen/generated/android/c++/JFunc_void_PermissionStatus.hpp +2 -2
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_GeocodedLocation_.hpp +16 -16
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_ReverseGeocodedAddress_.hpp +16 -16
- package/nitrogen/generated/android/c++/JGeocodedLocation.hpp +1 -1
- package/nitrogen/generated/android/c++/JGeocodingCoordinates.hpp +1 -1
- package/nitrogen/generated/android/c++/JGeolocationConfiguration.hpp +1 -1
- package/nitrogen/generated/android/c++/JGeolocationCoordinates.hpp +1 -1
- package/nitrogen/generated/android/c++/JGeolocationResponse.hpp +1 -1
- package/nitrogen/generated/android/c++/JHeading.hpp +1 -1
- package/nitrogen/generated/android/c++/JHeadingOptions.hpp +1 -1
- package/nitrogen/generated/android/c++/JHybridNitroGeolocationCompatSpec.cpp +6 -6
- package/nitrogen/generated/android/c++/JHybridNitroGeolocationCompatSpec.hpp +4 -4
- package/nitrogen/generated/android/c++/JHybridNitroGeolocationSpec.cpp +15 -15
- package/nitrogen/generated/android/c++/JHybridNitroGeolocationSpec.hpp +7 -7
- package/nitrogen/generated/android/c++/JIOSAccuracyPreset.hpp +1 -1
- package/nitrogen/generated/android/c++/JIOSActivityType.hpp +1 -1
- package/nitrogen/generated/android/c++/JLocationAccuracyOptions.hpp +1 -1
- package/nitrogen/generated/android/c++/JLocationAvailability.hpp +1 -1
- package/nitrogen/generated/android/c++/JLocationError.hpp +1 -1
- package/nitrogen/generated/android/c++/JLocationProvider.hpp +1 -1
- package/nitrogen/generated/android/c++/JLocationProviderInternal.hpp +1 -1
- package/nitrogen/generated/android/c++/JLocationProviderStatus.hpp +1 -1
- package/nitrogen/generated/android/c++/JLocationProviderUsed.hpp +1 -1
- package/nitrogen/generated/android/c++/JLocationRequestOptions.hpp +1 -1
- package/nitrogen/generated/android/c++/JLocationSettingsOptions.hpp +1 -1
- package/nitrogen/generated/android/c++/JNullableDouble.hpp +3 -3
- package/nitrogen/generated/android/c++/JPermissionStatus.hpp +1 -1
- package/nitrogen/generated/android/c++/JReverseGeocodedAddress.hpp +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/CompatGeolocationConfigurationInternal.kt +19 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/CompatGeolocationError.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/CompatGeolocationOptions.kt +33 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/CompatGeolocationResponse.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeocodedLocation.kt +17 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeocodingCoordinates.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeolocationConfiguration.kt +19 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeolocationCoordinates.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeolocationResponse.kt +19 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Heading.kt +19 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/HeadingOptions.kt +13 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/HybridNitroGeolocationCompatSpec.kt +6 -6
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/HybridNitroGeolocationSpec.kt +15 -15
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationAccuracyOptions.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationAvailability.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationError.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationProviderStatus.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationRequestOptions.kt +43 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationSettingsOptions.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/NullableDouble.kt +16 -7
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/ReverseGeocodedAddress.kt +25 -0
- package/nitrogen/generated/android/nitrogeolocationOnLoad.cpp +4 -4
- package/nitrogen/generated/ios/NitroGeolocation+autolinking.rb +2 -0
- package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Bridge.hpp +0 -72
- package/nitrogen/generated/ios/c++/HybridNitroGeolocationCompatSpecSwift.hpp +4 -4
- package/nitrogen/generated/ios/c++/HybridNitroGeolocationSpecSwift.hpp +10 -10
- package/nitrogen/generated/ios/swift/HybridNitroGeolocationCompatSpec.swift +2 -2
- package/nitrogen/generated/ios/swift/HybridNitroGeolocationCompatSpec_cxx.swift +6 -6
- package/nitrogen/generated/ios/swift/HybridNitroGeolocationSpec.swift +5 -5
- package/nitrogen/generated/ios/swift/HybridNitroGeolocationSpec_cxx.swift +15 -15
- package/nitrogen/generated/ios/swift/NullableDouble.swift +12 -0
- package/nitrogen/generated/shared/c++/HybridNitroGeolocationCompatSpec.hpp +2 -2
- package/nitrogen/generated/shared/c++/HybridNitroGeolocationSpec.hpp +5 -5
- package/package.json +2 -1
- package/src/NitroGeolocation.nitro.ts +10 -10
- package/src/NitroGeolocationCompat.nitro.ts +4 -4
- package/src/api/getCurrentPosition.ts +5 -1
- package/src/api/getLastKnownPosition.ts +5 -1
- package/src/api/requestLocationSettings.ts +2 -2
- package/src/api/watchHeading.ts +5 -1
- package/src/api/watchPosition.ts +5 -1
- package/src/compat/getCurrentPosition.ts +2 -2
- package/src/compat/watchPosition.ts +2 -2
- package/src/publicTypes.ts +7 -16
|
@@ -184,8 +184,8 @@ namespace margelo::nitro::nitrogeolocation {
|
|
|
184
184
|
auto __value = std::move(__result.value());
|
|
185
185
|
return __value;
|
|
186
186
|
}
|
|
187
|
-
inline void requestLocationSettings(const std::function<void(const LocationProviderStatus& /* status */)>& success, const std::optional<std::function<void(const LocationError& /* error */)>>& error
|
|
188
|
-
auto __result = _swiftPart.requestLocationSettings(success,
|
|
187
|
+
inline void requestLocationSettings(const std::function<void(const LocationProviderStatus& /* status */)>& success, const LocationSettingsOptions& options, const std::optional<std::function<void(const LocationError& /* error */)>>& error) override {
|
|
188
|
+
auto __result = _swiftPart.requestLocationSettings(success, std::forward<decltype(options)>(options), error);
|
|
189
189
|
if (__result.hasError()) [[unlikely]] {
|
|
190
190
|
std::rethrow_exception(__result.error());
|
|
191
191
|
}
|
|
@@ -204,14 +204,14 @@ namespace margelo::nitro::nitrogeolocation {
|
|
|
204
204
|
std::rethrow_exception(__result.error());
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
inline void getCurrentPosition(const std::function<void(const GeolocationResponse& /* position */)>& success, const std::optional<std::function<void(const LocationError& /* error */)>>& error
|
|
208
|
-
auto __result = _swiftPart.getCurrentPosition(success,
|
|
207
|
+
inline void getCurrentPosition(const std::function<void(const GeolocationResponse& /* position */)>& success, const LocationRequestOptions& options, const std::optional<std::function<void(const LocationError& /* error */)>>& error) override {
|
|
208
|
+
auto __result = _swiftPart.getCurrentPosition(success, std::forward<decltype(options)>(options), error);
|
|
209
209
|
if (__result.hasError()) [[unlikely]] {
|
|
210
210
|
std::rethrow_exception(__result.error());
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
-
inline void getLastKnownPosition(const std::function<void(const GeolocationResponse& /* position */)>& success, const std::optional<std::function<void(const LocationError& /* error */)>>& error
|
|
214
|
-
auto __result = _swiftPart.getLastKnownPosition(success,
|
|
213
|
+
inline void getLastKnownPosition(const std::function<void(const GeolocationResponse& /* position */)>& success, const LocationRequestOptions& options, const std::optional<std::function<void(const LocationError& /* error */)>>& error) override {
|
|
214
|
+
auto __result = _swiftPart.getLastKnownPosition(success, std::forward<decltype(options)>(options), error);
|
|
215
215
|
if (__result.hasError()) [[unlikely]] {
|
|
216
216
|
std::rethrow_exception(__result.error());
|
|
217
217
|
}
|
|
@@ -234,16 +234,16 @@ namespace margelo::nitro::nitrogeolocation {
|
|
|
234
234
|
std::rethrow_exception(__result.error());
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
-
inline std::string watchHeading(const std::function<void(const Heading& /* heading */)>& success, const std::optional<std::function<void(const LocationError& /* error */)>>& error
|
|
238
|
-
auto __result = _swiftPart.watchHeading(success,
|
|
237
|
+
inline std::string watchHeading(const std::function<void(const Heading& /* heading */)>& success, const HeadingOptions& options, const std::optional<std::function<void(const LocationError& /* error */)>>& error) override {
|
|
238
|
+
auto __result = _swiftPart.watchHeading(success, std::forward<decltype(options)>(options), error);
|
|
239
239
|
if (__result.hasError()) [[unlikely]] {
|
|
240
240
|
std::rethrow_exception(__result.error());
|
|
241
241
|
}
|
|
242
242
|
auto __value = std::move(__result.value());
|
|
243
243
|
return __value;
|
|
244
244
|
}
|
|
245
|
-
inline std::string watchPosition(const std::function<void(const GeolocationResponse& /* position */)>& success, const std::optional<std::function<void(const LocationError& /* error */)>>& error
|
|
246
|
-
auto __result = _swiftPart.watchPosition(success,
|
|
245
|
+
inline std::string watchPosition(const std::function<void(const GeolocationResponse& /* position */)>& success, const LocationRequestOptions& options, const std::optional<std::function<void(const LocationError& /* error */)>>& error) override {
|
|
246
|
+
auto __result = _swiftPart.watchPosition(success, std::forward<decltype(options)>(options), error);
|
|
247
247
|
if (__result.hasError()) [[unlikely]] {
|
|
248
248
|
std::rethrow_exception(__result.error());
|
|
249
249
|
}
|
|
@@ -15,8 +15,8 @@ public protocol HybridNitroGeolocationCompatSpec_protocol: HybridObject {
|
|
|
15
15
|
// Methods
|
|
16
16
|
func setRNConfiguration(config: CompatGeolocationConfigurationInternal) throws -> Void
|
|
17
17
|
func requestAuthorization(success: (() -> Void)?, error: ((_ error: CompatGeolocationError) -> Void)?) throws -> Void
|
|
18
|
-
func getCurrentPosition(success: @escaping (_ position: CompatGeolocationResponse) -> Void, error: ((_ error: CompatGeolocationError) -> Void)
|
|
19
|
-
func watchPosition(success: @escaping (_ position: CompatGeolocationResponse) -> Void, error: ((_ error: CompatGeolocationError) -> Void)
|
|
18
|
+
func getCurrentPosition(success: @escaping (_ position: CompatGeolocationResponse) -> Void, options: CompatGeolocationOptions, error: ((_ error: CompatGeolocationError) -> Void)?) throws -> Void
|
|
19
|
+
func watchPosition(success: @escaping (_ position: CompatGeolocationResponse) -> Void, options: CompatGeolocationOptions, error: ((_ error: CompatGeolocationError) -> Void)?) throws -> Double
|
|
20
20
|
func clearWatch(watchId: Double) throws -> Void
|
|
21
21
|
func stopObserving() throws -> Void
|
|
22
22
|
}
|
|
@@ -171,14 +171,14 @@ open class HybridNitroGeolocationCompatSpec_cxx {
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
@inline(__always)
|
|
174
|
-
public final func getCurrentPosition(success: bridge.Func_void_CompatGeolocationResponse,
|
|
174
|
+
public final func getCurrentPosition(success: bridge.Func_void_CompatGeolocationResponse, options: CompatGeolocationOptions, error: bridge.std__optional_std__function_void_const_CompatGeolocationError_____error______) -> bridge.Result_void_ {
|
|
175
175
|
do {
|
|
176
176
|
try self.__implementation.getCurrentPosition(success: { () -> (CompatGeolocationResponse) -> Void in
|
|
177
177
|
let __wrappedFunction = bridge.wrap_Func_void_CompatGeolocationResponse(success)
|
|
178
178
|
return { (__position: CompatGeolocationResponse) -> Void in
|
|
179
179
|
__wrappedFunction.call(__position)
|
|
180
180
|
}
|
|
181
|
-
}(), error: { () -> ((_ error: CompatGeolocationError) -> Void)? in
|
|
181
|
+
}(), options: options, error: { () -> ((_ error: CompatGeolocationError) -> Void)? in
|
|
182
182
|
if bridge.has_value_std__optional_std__function_void_const_CompatGeolocationError_____error______(error) {
|
|
183
183
|
let __unwrapped = bridge.get_std__optional_std__function_void_const_CompatGeolocationError_____error______(error)
|
|
184
184
|
return { () -> (CompatGeolocationError) -> Void in
|
|
@@ -190,7 +190,7 @@ open class HybridNitroGeolocationCompatSpec_cxx {
|
|
|
190
190
|
} else {
|
|
191
191
|
return nil
|
|
192
192
|
}
|
|
193
|
-
}()
|
|
193
|
+
}())
|
|
194
194
|
return bridge.create_Result_void_()
|
|
195
195
|
} catch (let __error) {
|
|
196
196
|
let __exceptionPtr = __error.toCpp()
|
|
@@ -199,14 +199,14 @@ open class HybridNitroGeolocationCompatSpec_cxx {
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
@inline(__always)
|
|
202
|
-
public final func watchPosition(success: bridge.Func_void_CompatGeolocationResponse,
|
|
202
|
+
public final func watchPosition(success: bridge.Func_void_CompatGeolocationResponse, options: CompatGeolocationOptions, error: bridge.std__optional_std__function_void_const_CompatGeolocationError_____error______) -> bridge.Result_double_ {
|
|
203
203
|
do {
|
|
204
204
|
let __result = try self.__implementation.watchPosition(success: { () -> (CompatGeolocationResponse) -> Void in
|
|
205
205
|
let __wrappedFunction = bridge.wrap_Func_void_CompatGeolocationResponse(success)
|
|
206
206
|
return { (__position: CompatGeolocationResponse) -> Void in
|
|
207
207
|
__wrappedFunction.call(__position)
|
|
208
208
|
}
|
|
209
|
-
}(), error: { () -> ((_ error: CompatGeolocationError) -> Void)? in
|
|
209
|
+
}(), options: options, error: { () -> ((_ error: CompatGeolocationError) -> Void)? in
|
|
210
210
|
if bridge.has_value_std__optional_std__function_void_const_CompatGeolocationError_____error______(error) {
|
|
211
211
|
let __unwrapped = bridge.get_std__optional_std__function_void_const_CompatGeolocationError_____error______(error)
|
|
212
212
|
return { () -> (CompatGeolocationError) -> Void in
|
|
@@ -218,7 +218,7 @@ open class HybridNitroGeolocationCompatSpec_cxx {
|
|
|
218
218
|
} else {
|
|
219
219
|
return nil
|
|
220
220
|
}
|
|
221
|
-
}()
|
|
221
|
+
}())
|
|
222
222
|
let __resultCpp = __result
|
|
223
223
|
return bridge.create_Result_double_(__resultCpp)
|
|
224
224
|
} catch (let __error) {
|
|
@@ -19,16 +19,16 @@ public protocol HybridNitroGeolocationSpec_protocol: HybridObject {
|
|
|
19
19
|
func hasServicesEnabled() throws -> Promise<Bool>
|
|
20
20
|
func getProviderStatus() throws -> Promise<LocationProviderStatus>
|
|
21
21
|
func getLocationAvailability() throws -> Promise<LocationAvailability>
|
|
22
|
-
func requestLocationSettings(success: @escaping (_ status: LocationProviderStatus) -> Void, error: ((_ error: LocationError) -> Void)
|
|
22
|
+
func requestLocationSettings(success: @escaping (_ status: LocationProviderStatus) -> Void, options: LocationSettingsOptions, error: ((_ error: LocationError) -> Void)?) throws -> Void
|
|
23
23
|
func getAccuracyAuthorization() throws -> Promise<AccuracyAuthorization>
|
|
24
24
|
func requestTemporaryFullAccuracy(purposeKey: String, success: @escaping (_ authorization: AccuracyAuthorization) -> Void, error: ((_ error: LocationError) -> Void)?) throws -> Void
|
|
25
|
-
func getCurrentPosition(success: @escaping (_ position: GeolocationResponse) -> Void, error: ((_ error: LocationError) -> Void)
|
|
26
|
-
func getLastKnownPosition(success: @escaping (_ position: GeolocationResponse) -> Void, error: ((_ error: LocationError) -> Void)
|
|
25
|
+
func getCurrentPosition(success: @escaping (_ position: GeolocationResponse) -> Void, options: LocationRequestOptions, error: ((_ error: LocationError) -> Void)?) throws -> Void
|
|
26
|
+
func getLastKnownPosition(success: @escaping (_ position: GeolocationResponse) -> Void, options: LocationRequestOptions, error: ((_ error: LocationError) -> Void)?) throws -> Void
|
|
27
27
|
func geocode(address: String, success: @escaping (_ locations: [GeocodedLocation]) -> Void, error: ((_ error: LocationError) -> Void)?) throws -> Void
|
|
28
28
|
func reverseGeocode(coords: GeocodingCoordinates, success: @escaping (_ addresses: [ReverseGeocodedAddress]) -> Void, error: ((_ error: LocationError) -> Void)?) throws -> Void
|
|
29
29
|
func getHeading(success: @escaping (_ heading: Heading) -> Void, error: ((_ error: LocationError) -> Void)?) throws -> Void
|
|
30
|
-
func watchHeading(success: @escaping (_ heading: Heading) -> Void, error: ((_ error: LocationError) -> Void)
|
|
31
|
-
func watchPosition(success: @escaping (_ position: GeolocationResponse) -> Void, error: ((_ error: LocationError) -> Void)
|
|
30
|
+
func watchHeading(success: @escaping (_ heading: Heading) -> Void, options: HeadingOptions, error: ((_ error: LocationError) -> Void)?) throws -> String
|
|
31
|
+
func watchPosition(success: @escaping (_ position: GeolocationResponse) -> Void, options: LocationRequestOptions, error: ((_ error: LocationError) -> Void)?) throws -> String
|
|
32
32
|
func unwatch(token: String) throws -> Void
|
|
33
33
|
func stopObserving() throws -> Void
|
|
34
34
|
}
|
|
@@ -240,14 +240,14 @@ open class HybridNitroGeolocationSpec_cxx {
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
@inline(__always)
|
|
243
|
-
public final func requestLocationSettings(success: bridge.Func_void_LocationProviderStatus,
|
|
243
|
+
public final func requestLocationSettings(success: bridge.Func_void_LocationProviderStatus, options: LocationSettingsOptions, error: bridge.std__optional_std__function_void_const_LocationError_____error______) -> bridge.Result_void_ {
|
|
244
244
|
do {
|
|
245
245
|
try self.__implementation.requestLocationSettings(success: { () -> (LocationProviderStatus) -> Void in
|
|
246
246
|
let __wrappedFunction = bridge.wrap_Func_void_LocationProviderStatus(success)
|
|
247
247
|
return { (__status: LocationProviderStatus) -> Void in
|
|
248
248
|
__wrappedFunction.call(__status)
|
|
249
249
|
}
|
|
250
|
-
}(), error: { () -> ((_ error: LocationError) -> Void)? in
|
|
250
|
+
}(), options: options, error: { () -> ((_ error: LocationError) -> Void)? in
|
|
251
251
|
if bridge.has_value_std__optional_std__function_void_const_LocationError_____error______(error) {
|
|
252
252
|
let __unwrapped = bridge.get_std__optional_std__function_void_const_LocationError_____error______(error)
|
|
253
253
|
return { () -> (LocationError) -> Void in
|
|
@@ -259,7 +259,7 @@ open class HybridNitroGeolocationSpec_cxx {
|
|
|
259
259
|
} else {
|
|
260
260
|
return nil
|
|
261
261
|
}
|
|
262
|
-
}()
|
|
262
|
+
}())
|
|
263
263
|
return bridge.create_Result_void_()
|
|
264
264
|
} catch (let __error) {
|
|
265
265
|
let __exceptionPtr = __error.toCpp()
|
|
@@ -315,14 +315,14 @@ open class HybridNitroGeolocationSpec_cxx {
|
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
@inline(__always)
|
|
318
|
-
public final func getCurrentPosition(success: bridge.Func_void_GeolocationResponse,
|
|
318
|
+
public final func getCurrentPosition(success: bridge.Func_void_GeolocationResponse, options: LocationRequestOptions, error: bridge.std__optional_std__function_void_const_LocationError_____error______) -> bridge.Result_void_ {
|
|
319
319
|
do {
|
|
320
320
|
try self.__implementation.getCurrentPosition(success: { () -> (GeolocationResponse) -> Void in
|
|
321
321
|
let __wrappedFunction = bridge.wrap_Func_void_GeolocationResponse(success)
|
|
322
322
|
return { (__position: GeolocationResponse) -> Void in
|
|
323
323
|
__wrappedFunction.call(__position)
|
|
324
324
|
}
|
|
325
|
-
}(), error: { () -> ((_ error: LocationError) -> Void)? in
|
|
325
|
+
}(), options: options, error: { () -> ((_ error: LocationError) -> Void)? in
|
|
326
326
|
if bridge.has_value_std__optional_std__function_void_const_LocationError_____error______(error) {
|
|
327
327
|
let __unwrapped = bridge.get_std__optional_std__function_void_const_LocationError_____error______(error)
|
|
328
328
|
return { () -> (LocationError) -> Void in
|
|
@@ -334,7 +334,7 @@ open class HybridNitroGeolocationSpec_cxx {
|
|
|
334
334
|
} else {
|
|
335
335
|
return nil
|
|
336
336
|
}
|
|
337
|
-
}()
|
|
337
|
+
}())
|
|
338
338
|
return bridge.create_Result_void_()
|
|
339
339
|
} catch (let __error) {
|
|
340
340
|
let __exceptionPtr = __error.toCpp()
|
|
@@ -343,14 +343,14 @@ open class HybridNitroGeolocationSpec_cxx {
|
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
@inline(__always)
|
|
346
|
-
public final func getLastKnownPosition(success: bridge.Func_void_GeolocationResponse,
|
|
346
|
+
public final func getLastKnownPosition(success: bridge.Func_void_GeolocationResponse, options: LocationRequestOptions, error: bridge.std__optional_std__function_void_const_LocationError_____error______) -> bridge.Result_void_ {
|
|
347
347
|
do {
|
|
348
348
|
try self.__implementation.getLastKnownPosition(success: { () -> (GeolocationResponse) -> Void in
|
|
349
349
|
let __wrappedFunction = bridge.wrap_Func_void_GeolocationResponse(success)
|
|
350
350
|
return { (__position: GeolocationResponse) -> Void in
|
|
351
351
|
__wrappedFunction.call(__position)
|
|
352
352
|
}
|
|
353
|
-
}(), error: { () -> ((_ error: LocationError) -> Void)? in
|
|
353
|
+
}(), options: options, error: { () -> ((_ error: LocationError) -> Void)? in
|
|
354
354
|
if bridge.has_value_std__optional_std__function_void_const_LocationError_____error______(error) {
|
|
355
355
|
let __unwrapped = bridge.get_std__optional_std__function_void_const_LocationError_____error______(error)
|
|
356
356
|
return { () -> (LocationError) -> Void in
|
|
@@ -362,7 +362,7 @@ open class HybridNitroGeolocationSpec_cxx {
|
|
|
362
362
|
} else {
|
|
363
363
|
return nil
|
|
364
364
|
}
|
|
365
|
-
}()
|
|
365
|
+
}())
|
|
366
366
|
return bridge.create_Result_void_()
|
|
367
367
|
} catch (let __error) {
|
|
368
368
|
let __exceptionPtr = __error.toCpp()
|
|
@@ -467,14 +467,14 @@ open class HybridNitroGeolocationSpec_cxx {
|
|
|
467
467
|
}
|
|
468
468
|
|
|
469
469
|
@inline(__always)
|
|
470
|
-
public final func watchHeading(success: bridge.Func_void_Heading,
|
|
470
|
+
public final func watchHeading(success: bridge.Func_void_Heading, options: HeadingOptions, error: bridge.std__optional_std__function_void_const_LocationError_____error______) -> bridge.Result_std__string_ {
|
|
471
471
|
do {
|
|
472
472
|
let __result = try self.__implementation.watchHeading(success: { () -> (Heading) -> Void in
|
|
473
473
|
let __wrappedFunction = bridge.wrap_Func_void_Heading(success)
|
|
474
474
|
return { (__heading: Heading) -> Void in
|
|
475
475
|
__wrappedFunction.call(__heading)
|
|
476
476
|
}
|
|
477
|
-
}(), error: { () -> ((_ error: LocationError) -> Void)? in
|
|
477
|
+
}(), options: options, error: { () -> ((_ error: LocationError) -> Void)? in
|
|
478
478
|
if bridge.has_value_std__optional_std__function_void_const_LocationError_____error______(error) {
|
|
479
479
|
let __unwrapped = bridge.get_std__optional_std__function_void_const_LocationError_____error______(error)
|
|
480
480
|
return { () -> (LocationError) -> Void in
|
|
@@ -486,7 +486,7 @@ open class HybridNitroGeolocationSpec_cxx {
|
|
|
486
486
|
} else {
|
|
487
487
|
return nil
|
|
488
488
|
}
|
|
489
|
-
}()
|
|
489
|
+
}())
|
|
490
490
|
let __resultCpp = std.string(__result)
|
|
491
491
|
return bridge.create_Result_std__string_(__resultCpp)
|
|
492
492
|
} catch (let __error) {
|
|
@@ -496,14 +496,14 @@ open class HybridNitroGeolocationSpec_cxx {
|
|
|
496
496
|
}
|
|
497
497
|
|
|
498
498
|
@inline(__always)
|
|
499
|
-
public final func watchPosition(success: bridge.Func_void_GeolocationResponse,
|
|
499
|
+
public final func watchPosition(success: bridge.Func_void_GeolocationResponse, options: LocationRequestOptions, error: bridge.std__optional_std__function_void_const_LocationError_____error______) -> bridge.Result_std__string_ {
|
|
500
500
|
do {
|
|
501
501
|
let __result = try self.__implementation.watchPosition(success: { () -> (GeolocationResponse) -> Void in
|
|
502
502
|
let __wrappedFunction = bridge.wrap_Func_void_GeolocationResponse(success)
|
|
503
503
|
return { (__position: GeolocationResponse) -> Void in
|
|
504
504
|
__wrappedFunction.call(__position)
|
|
505
505
|
}
|
|
506
|
-
}(), error: { () -> ((_ error: LocationError) -> Void)? in
|
|
506
|
+
}(), options: options, error: { () -> ((_ error: LocationError) -> Void)? in
|
|
507
507
|
if bridge.has_value_std__optional_std__function_void_const_LocationError_____error______(error) {
|
|
508
508
|
let __unwrapped = bridge.get_std__optional_std__function_void_const_LocationError_____error______(error)
|
|
509
509
|
return { () -> (LocationError) -> Void in
|
|
@@ -515,7 +515,7 @@ open class HybridNitroGeolocationSpec_cxx {
|
|
|
515
515
|
} else {
|
|
516
516
|
return nil
|
|
517
517
|
}
|
|
518
|
-
}()
|
|
518
|
+
}())
|
|
519
519
|
let __resultCpp = std.string(__result)
|
|
520
520
|
return bridge.create_Result_std__string_(__resultCpp)
|
|
521
521
|
} catch (let __error) {
|
|
@@ -16,3 +16,15 @@ public enum NullableDouble {
|
|
|
16
16
|
case first(NullType)
|
|
17
17
|
case second(Double)
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
public extension NullableDouble {
|
|
21
|
+
func asType<T>(_ type: T.Type = T.self) -> T? {
|
|
22
|
+
switch self {
|
|
23
|
+
case .first(let value): return value as? T
|
|
24
|
+
case .second(let value): return value as? T
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
func isType<T>(_ type: T.Type = T.self) -> Bool {
|
|
28
|
+
return self.asType(type) != nil
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -62,8 +62,8 @@ namespace margelo::nitro::nitrogeolocation {
|
|
|
62
62
|
// Methods
|
|
63
63
|
virtual void setRNConfiguration(const CompatGeolocationConfigurationInternal& config) = 0;
|
|
64
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
|
|
66
|
-
virtual double watchPosition(const std::function<void(const CompatGeolocationResponse& /* position */)>& success, const std::optional<std::function<void(const CompatGeolocationError& /* error */)>>& error
|
|
65
|
+
virtual void getCurrentPosition(const std::function<void(const CompatGeolocationResponse& /* position */)>& success, const CompatGeolocationOptions& options, const std::optional<std::function<void(const CompatGeolocationError& /* error */)>>& error) = 0;
|
|
66
|
+
virtual double watchPosition(const std::function<void(const CompatGeolocationResponse& /* position */)>& success, const CompatGeolocationOptions& options, const std::optional<std::function<void(const CompatGeolocationError& /* error */)>>& error) = 0;
|
|
67
67
|
virtual void clearWatch(double watchId) = 0;
|
|
68
68
|
virtual void stopObserving() = 0;
|
|
69
69
|
|
|
@@ -99,16 +99,16 @@ namespace margelo::nitro::nitrogeolocation {
|
|
|
99
99
|
virtual std::shared_ptr<Promise<bool>> hasServicesEnabled() = 0;
|
|
100
100
|
virtual std::shared_ptr<Promise<LocationProviderStatus>> getProviderStatus() = 0;
|
|
101
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
|
|
102
|
+
virtual void requestLocationSettings(const std::function<void(const LocationProviderStatus& /* status */)>& success, const LocationSettingsOptions& options, const std::optional<std::function<void(const LocationError& /* error */)>>& error) = 0;
|
|
103
103
|
virtual std::shared_ptr<Promise<AccuracyAuthorization>> getAccuracyAuthorization() = 0;
|
|
104
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
|
|
106
|
-
virtual void getLastKnownPosition(const std::function<void(const GeolocationResponse& /* position */)>& success, const std::optional<std::function<void(const LocationError& /* error */)>>& error
|
|
105
|
+
virtual void getCurrentPosition(const std::function<void(const GeolocationResponse& /* position */)>& success, const LocationRequestOptions& options, const std::optional<std::function<void(const LocationError& /* error */)>>& error) = 0;
|
|
106
|
+
virtual void getLastKnownPosition(const std::function<void(const GeolocationResponse& /* position */)>& success, const LocationRequestOptions& options, const std::optional<std::function<void(const LocationError& /* error */)>>& error) = 0;
|
|
107
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
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
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
|
|
111
|
-
virtual std::string watchPosition(const std::function<void(const GeolocationResponse& /* position */)>& success, const std::optional<std::function<void(const LocationError& /* error */)>>& error
|
|
110
|
+
virtual std::string watchHeading(const std::function<void(const Heading& /* heading */)>& success, const HeadingOptions& options, const std::optional<std::function<void(const LocationError& /* error */)>>& error) = 0;
|
|
111
|
+
virtual std::string watchPosition(const std::function<void(const GeolocationResponse& /* position */)>& success, const LocationRequestOptions& options, const std::optional<std::function<void(const LocationError& /* error */)>>& error) = 0;
|
|
112
112
|
virtual void unwatch(const std::string& token) = 0;
|
|
113
113
|
virtual void stopObserving() = 0;
|
|
114
114
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nitro-geolocation",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Nitro-powered native geolocation for modern React Native apps",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"source": "src/index",
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
"react-native": ">=0.75.0",
|
|
85
85
|
"react-native-nitro-modules": "*"
|
|
86
86
|
},
|
|
87
|
+
"sideEffects": false,
|
|
87
88
|
"create-react-native-library": {
|
|
88
89
|
"languages": "kotlin-swift",
|
|
89
90
|
"type": "nitro-module",
|
|
@@ -315,8 +315,8 @@ export interface NitroGeolocation
|
|
|
315
315
|
*/
|
|
316
316
|
requestLocationSettings(
|
|
317
317
|
success: (status: LocationProviderStatus) => void,
|
|
318
|
-
|
|
319
|
-
|
|
318
|
+
options: LocationSettingsOptions,
|
|
319
|
+
error?: (error: LocationError) => void
|
|
320
320
|
): void;
|
|
321
321
|
|
|
322
322
|
/**
|
|
@@ -359,8 +359,8 @@ export interface NitroGeolocation
|
|
|
359
359
|
*/
|
|
360
360
|
getCurrentPosition(
|
|
361
361
|
success: (position: GeolocationResponse) => void,
|
|
362
|
-
|
|
363
|
-
|
|
362
|
+
options: LocationRequestOptions,
|
|
363
|
+
error?: (error: LocationError) => void
|
|
364
364
|
): void;
|
|
365
365
|
|
|
366
366
|
/**
|
|
@@ -370,8 +370,8 @@ export interface NitroGeolocation
|
|
|
370
370
|
*/
|
|
371
371
|
getLastKnownPosition(
|
|
372
372
|
success: (position: GeolocationResponse) => void,
|
|
373
|
-
|
|
374
|
-
|
|
373
|
+
options: LocationRequestOptions,
|
|
374
|
+
error?: (error: LocationError) => void
|
|
375
375
|
): void;
|
|
376
376
|
|
|
377
377
|
/**
|
|
@@ -413,8 +413,8 @@ export interface NitroGeolocation
|
|
|
413
413
|
*/
|
|
414
414
|
watchHeading(
|
|
415
415
|
success: (heading: Heading) => void,
|
|
416
|
-
|
|
417
|
-
|
|
416
|
+
options: HeadingOptions,
|
|
417
|
+
error?: (error: LocationError) => void
|
|
418
418
|
): string;
|
|
419
419
|
|
|
420
420
|
/**
|
|
@@ -434,8 +434,8 @@ export interface NitroGeolocation
|
|
|
434
434
|
*/
|
|
435
435
|
watchPosition(
|
|
436
436
|
success: (position: GeolocationResponse) => void,
|
|
437
|
-
|
|
438
|
-
|
|
437
|
+
options: LocationRequestOptions,
|
|
438
|
+
error?: (error: LocationError) => void
|
|
439
439
|
): string;
|
|
440
440
|
|
|
441
441
|
/**
|
|
@@ -28,13 +28,13 @@ export interface NitroGeolocationCompat
|
|
|
28
28
|
): void;
|
|
29
29
|
getCurrentPosition(
|
|
30
30
|
success: (position: CompatGeolocationResponse) => void,
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
options: CompatGeolocationOptions,
|
|
32
|
+
error?: (error: CompatGeolocationError) => void
|
|
33
33
|
): void;
|
|
34
34
|
watchPosition(
|
|
35
35
|
success: (position: CompatGeolocationResponse) => void,
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
options: CompatGeolocationOptions,
|
|
37
|
+
error?: (error: CompatGeolocationError) => void
|
|
38
38
|
): number;
|
|
39
39
|
clearWatch(watchId: number): void;
|
|
40
40
|
stopObserving(): void;
|
|
@@ -40,6 +40,10 @@ export function getCurrentPosition(
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
return new Promise((resolve, reject) => {
|
|
43
|
-
NitroGeolocationHybridObject.getCurrentPosition(
|
|
43
|
+
NitroGeolocationHybridObject.getCurrentPosition(
|
|
44
|
+
resolve,
|
|
45
|
+
options ?? {},
|
|
46
|
+
reject
|
|
47
|
+
);
|
|
44
48
|
});
|
|
45
49
|
}
|
|
@@ -23,6 +23,10 @@ export function getLastKnownPosition(
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
return new Promise((resolve, reject) => {
|
|
26
|
-
NitroGeolocationHybridObject.getLastKnownPosition(
|
|
26
|
+
NitroGeolocationHybridObject.getLastKnownPosition(
|
|
27
|
+
resolve,
|
|
28
|
+
options ?? {},
|
|
29
|
+
reject
|
|
30
|
+
);
|
|
27
31
|
});
|
|
28
32
|
}
|
package/src/api/watchHeading.ts
CHANGED
|
@@ -15,5 +15,9 @@ export function watchHeading(
|
|
|
15
15
|
error?: (error: LocationError) => void,
|
|
16
16
|
options?: HeadingOptions
|
|
17
17
|
): string {
|
|
18
|
-
return NitroGeolocationHybridObject.watchHeading(
|
|
18
|
+
return NitroGeolocationHybridObject.watchHeading(
|
|
19
|
+
success,
|
|
20
|
+
options ?? {},
|
|
21
|
+
error
|
|
22
|
+
);
|
|
19
23
|
}
|
package/src/api/watchPosition.ts
CHANGED
|
@@ -39,5 +39,9 @@ export function watchPosition(
|
|
|
39
39
|
if (isDevtoolsEnabled()) {
|
|
40
40
|
return devtoolsWatchPosition(success, error);
|
|
41
41
|
}
|
|
42
|
-
return NitroGeolocationHybridObject.watchPosition(
|
|
42
|
+
return NitroGeolocationHybridObject.watchPosition(
|
|
43
|
+
success,
|
|
44
|
+
options ?? {},
|
|
45
|
+
error
|
|
46
|
+
);
|
|
43
47
|
}
|
package/src/publicTypes.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { NitroGeolocation } from "./NitroGeolocation.nitro";
|
|
2
|
-
import type {
|
|
3
|
-
CompatGeolocationConfigurationInternal,
|
|
4
|
-
NitroGeolocationCompat
|
|
5
|
-
} from "./NitroGeolocationCompat.nitro";
|
|
2
|
+
import type { CompatGeolocationConfigurationInternal } from "./NitroGeolocationCompat.nitro";
|
|
6
3
|
import type {
|
|
7
4
|
AccuracyAuthorization as SchemaAccuracyAuthorization,
|
|
8
5
|
AndroidAccuracyPreset as SchemaAndroidAccuracyPreset,
|
|
9
6
|
AndroidGranularity as SchemaAndroidGranularity,
|
|
7
|
+
CompatGeolocationError as SchemaCompatGeolocationError,
|
|
8
|
+
CompatGeolocationOptions as SchemaCompatGeolocationOptions,
|
|
9
|
+
CompatGeolocationResponse as SchemaCompatGeolocationResponse,
|
|
10
10
|
GeocodedLocation as SchemaGeocodedLocation,
|
|
11
11
|
GeocodingCoordinates as SchemaGeocodingCoordinates,
|
|
12
12
|
GeolocationResponse as SchemaGeolocationResponse,
|
|
@@ -21,13 +21,6 @@ import type {
|
|
|
21
21
|
ReverseGeocodedAddress as SchemaReverseGeocodedAddress
|
|
22
22
|
} from "./types";
|
|
23
23
|
|
|
24
|
-
type CallbackValue<TCallback> = TCallback extends (value: infer Value) => void
|
|
25
|
-
? Value
|
|
26
|
-
: never;
|
|
27
|
-
|
|
28
|
-
type CompatGetCurrentPosition = NitroGeolocationCompat["getCurrentPosition"];
|
|
29
|
-
type CompatSuccessCallback = Parameters<CompatGetCurrentPosition>[0];
|
|
30
|
-
type CompatErrorCallback = NonNullable<Parameters<CompatGetCurrentPosition>[1]>;
|
|
31
24
|
type NativeGeolocationConfiguration = Parameters<
|
|
32
25
|
NitroGeolocation["setConfiguration"]
|
|
33
26
|
>[0];
|
|
@@ -50,14 +43,12 @@ export type LocationAccuracyOptions = SchemaLocationAccuracyOptions;
|
|
|
50
43
|
export type Heading = SchemaHeading;
|
|
51
44
|
export type HeadingOptions = SchemaHeadingOptions;
|
|
52
45
|
|
|
53
|
-
export type CompatGeolocationResponse =
|
|
46
|
+
export type CompatGeolocationResponse = SchemaCompatGeolocationResponse;
|
|
54
47
|
|
|
55
48
|
export type GeolocationCoordinates = GeolocationResponse["coords"];
|
|
56
49
|
export type LocationProviderUsed = SchemaLocationProviderUsed;
|
|
57
|
-
export type CompatGeolocationError =
|
|
58
|
-
export type CompatGeolocationOptions =
|
|
59
|
-
Parameters<CompatGetCurrentPosition>[2]
|
|
60
|
-
>;
|
|
50
|
+
export type CompatGeolocationError = SchemaCompatGeolocationError;
|
|
51
|
+
export type CompatGeolocationOptions = SchemaCompatGeolocationOptions;
|
|
61
52
|
|
|
62
53
|
export type AuthorizationLevel = NonNullable<
|
|
63
54
|
NativeGeolocationConfiguration["authorizationLevel"]
|