react-native-nitro-geolocation 1.1.3 → 1.2.0
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/README.md +316 -0
- package/android/build.gradle +6 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidAccuracy.kt +105 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidHeadingManager.kt +313 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidLocationSettings.kt +313 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/GetCurrentPosition.kt +46 -45
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/LocationMetadata.kt +26 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/LocationValues.kt +31 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/NitroGeolocation.kt +1025 -140
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/NitroGeolocationCompat.kt +11 -11
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/RequestAuthorization.kt +6 -6
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/WatchPosition.kt +46 -45
- package/ios/CLLocation+GeolocationMetadata.swift +32 -0
- package/ios/LocationManager.swift +205 -51
- package/ios/NitroGeolocation.swift +949 -110
- package/ios/NitroGeolocationCompat.swift +7 -7
- package/nitrogen/generated/android/c++/JAccuracyAuthorization.hpp +61 -0
- package/nitrogen/generated/android/c++/JAndroidAccuracyPreset.hpp +64 -0
- package/nitrogen/generated/android/c++/JAndroidGranularity.hpp +61 -0
- package/nitrogen/generated/android/c++/{JRNConfigurationInternal.hpp → JCompatGeolocationConfigurationInternal.hpp} +10 -10
- package/nitrogen/generated/android/c++/{JGeolocationError.hpp → JCompatGeolocationError.hpp} +10 -10
- package/nitrogen/generated/android/c++/JCompatGeolocationOptions.hpp +105 -0
- package/nitrogen/generated/android/c++/JCompatGeolocationResponse.hpp +67 -0
- package/nitrogen/generated/android/c++/JFunc_void_AccuracyAuthorization.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_CompatGeolocationError.hpp +78 -0
- package/nitrogen/generated/android/c++/JFunc_void_CompatGeolocationResponse.hpp +84 -0
- package/nitrogen/generated/android/c++/JFunc_void_GeolocationResponse.hpp +2 -0
- package/nitrogen/generated/android/c++/JFunc_void_Heading.hpp +78 -0
- package/nitrogen/generated/android/c++/JFunc_void_LocationProviderStatus.hpp +78 -0
- package/nitrogen/generated/android/c++/JFunc_void_PermissionStatus.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_GeocodedLocation_.hpp +97 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_ReverseGeocodedAddress_.hpp +98 -0
- package/nitrogen/generated/android/c++/JGeocodedLocation.hpp +65 -0
- package/nitrogen/generated/android/c++/JGeocodingCoordinates.hpp +61 -0
- package/nitrogen/generated/android/c++/{JModernGeolocationConfiguration.hpp → JGeolocationConfiguration.hpp} +10 -10
- package/nitrogen/generated/android/c++/JGeolocationResponse.hpp +13 -3
- package/nitrogen/generated/android/c++/JHeading.hpp +69 -0
- package/nitrogen/generated/android/c++/JHeadingOptions.hpp +57 -0
- package/nitrogen/generated/android/c++/JHybridNitroGeolocationCompatSpec.cpp +46 -30
- package/nitrogen/generated/android/c++/JHybridNitroGeolocationCompatSpec.hpp +4 -4
- package/nitrogen/generated/android/c++/JHybridNitroGeolocationSpec.cpp +169 -33
- package/nitrogen/generated/android/c++/JHybridNitroGeolocationSpec.hpp +14 -3
- package/nitrogen/generated/android/c++/JIOSAccuracyPreset.hpp +73 -0
- package/nitrogen/generated/android/c++/JIOSActivityType.hpp +67 -0
- package/nitrogen/generated/android/c++/JLocationAccuracyOptions.hpp +65 -0
- package/nitrogen/generated/android/c++/JLocationAvailability.hpp +62 -0
- package/nitrogen/generated/android/c++/JLocationProviderStatus.hpp +77 -0
- package/nitrogen/generated/android/c++/JLocationProviderUsed.hpp +67 -0
- package/nitrogen/generated/android/c++/JLocationRequestOptions.hpp +49 -3
- package/nitrogen/generated/android/c++/{JGeolocationOptions.hpp → JLocationSettingsOptions.hpp} +28 -22
- package/nitrogen/generated/android/c++/JReverseGeocodedAddress.hpp +82 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/AccuracyAuthorization.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/AndroidAccuracyPreset.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/AndroidGranularity.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/{RNConfigurationInternal.kt → CompatGeolocationConfigurationInternal.kt} +5 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/{GeolocationError.kt → CompatGeolocationError.kt} +5 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/CompatGeolocationOptions.kt +68 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/CompatGeolocationResponse.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_AccuracyAuthorization.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/{Func_void_GeolocationError.kt → Func_void_CompatGeolocationError.kt} +9 -9
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_CompatGeolocationResponse.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_Heading.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_LocationProviderStatus.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_PermissionStatus.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_std__vector_GeocodedLocation_.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_std__vector_ReverseGeocodedAddress_.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeocodedLocation.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeocodingCoordinates.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/{ModernGeolocationConfiguration.kt → GeolocationConfiguration.kt} +5 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeolocationResponse.kt +9 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Heading.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/HeadingOptions.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/HybridNitroGeolocationCompatSpec.kt +7 -7
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/HybridNitroGeolocationSpec.kt +92 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/IOSAccuracyPreset.kt +28 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/IOSActivityType.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationAccuracyOptions.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationAvailability.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationProviderStatus.kt +53 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationProviderUsed.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationRequestOptions.kt +30 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/{GeolocationOptions.kt → LocationSettingsOptions.kt} +11 -11
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/ReverseGeocodedAddress.kt +56 -0
- package/nitrogen/generated/android/nitrogeolocationOnLoad.cpp +18 -4
- package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Bridge.cpp +76 -12
- package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Bridge.hpp +519 -77
- package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Umbrella.hpp +61 -12
- package/nitrogen/generated/ios/c++/HybridNitroGeolocationCompatSpecSwift.hpp +28 -16
- package/nitrogen/generated/ios/c++/HybridNitroGeolocationSpecSwift.hpp +131 -13
- package/nitrogen/generated/ios/swift/AccuracyAuthorization.swift +44 -0
- package/nitrogen/generated/ios/swift/AndroidAccuracyPreset.swift +48 -0
- package/nitrogen/generated/ios/swift/AndroidGranularity.swift +44 -0
- package/nitrogen/generated/ios/swift/{RNConfigurationInternal.swift → CompatGeolocationConfigurationInternal.swift} +5 -5
- package/nitrogen/generated/ios/swift/{GeolocationError.swift → CompatGeolocationError.swift} +5 -5
- package/nitrogen/generated/ios/swift/CompatGeolocationOptions.swift +208 -0
- package/nitrogen/generated/ios/swift/CompatGeolocationResponse.swift +34 -0
- package/nitrogen/generated/ios/swift/Func_void_AccuracyAuthorization.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_CompatGeolocationError.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_CompatGeolocationResponse.swift +46 -0
- package/nitrogen/generated/ios/swift/{Func_void_GeolocationError.swift → Func_void_Heading.swift} +11 -11
- package/nitrogen/generated/ios/swift/Func_void_LocationAvailability.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_LocationProviderStatus.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_GeocodedLocation_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_ReverseGeocodedAddress_.swift +46 -0
- package/nitrogen/generated/ios/swift/GeocodedLocation.swift +52 -0
- package/nitrogen/generated/ios/swift/GeocodingCoordinates.swift +34 -0
- package/nitrogen/generated/ios/swift/{ModernGeolocationConfiguration.swift → GeolocationConfiguration.swift} +5 -5
- package/nitrogen/generated/ios/swift/GeolocationResponse.swift +31 -2
- package/nitrogen/generated/ios/swift/Heading.swift +70 -0
- package/nitrogen/generated/ios/swift/HeadingOptions.swift +42 -0
- package/nitrogen/generated/ios/swift/HybridNitroGeolocationCompatSpec.swift +4 -4
- package/nitrogen/generated/ios/swift/HybridNitroGeolocationCompatSpec_cxx.swift +28 -28
- package/nitrogen/generated/ios/swift/HybridNitroGeolocationSpec.swift +14 -3
- package/nitrogen/generated/ios/swift/HybridNitroGeolocationSpec_cxx.swift +318 -15
- package/nitrogen/generated/ios/swift/IOSAccuracyPreset.swift +60 -0
- package/nitrogen/generated/ios/swift/IOSActivityType.swift +52 -0
- package/nitrogen/generated/ios/swift/LocationAccuracyOptions.swift +46 -0
- package/nitrogen/generated/ios/swift/LocationAvailability.swift +47 -0
- package/nitrogen/generated/ios/swift/LocationProviderStatus.swift +106 -0
- package/nitrogen/generated/ios/swift/LocationProviderUsed.swift +52 -0
- package/nitrogen/generated/ios/swift/LocationRequestOptions.swift +142 -1
- package/nitrogen/generated/ios/swift/{GeolocationOptions.swift → LocationSettingsOptions.swift} +39 -46
- package/nitrogen/generated/ios/swift/ReverseGeocodedAddress.swift +150 -0
- package/nitrogen/generated/shared/c++/AccuracyAuthorization.hpp +80 -0
- package/nitrogen/generated/shared/c++/AndroidAccuracyPreset.hpp +84 -0
- package/nitrogen/generated/shared/c++/AndroidGranularity.hpp +80 -0
- package/nitrogen/generated/shared/c++/{RNConfigurationInternal.hpp → CompatGeolocationConfigurationInternal.hpp} +11 -11
- package/nitrogen/generated/shared/c++/{GeolocationError.hpp → CompatGeolocationError.hpp} +11 -11
- package/nitrogen/generated/shared/c++/CompatGeolocationOptions.hpp +128 -0
- package/nitrogen/generated/shared/c++/CompatGeolocationResponse.hpp +88 -0
- package/nitrogen/generated/shared/c++/GeocodedLocation.hpp +91 -0
- package/nitrogen/generated/shared/c++/GeocodingCoordinates.hpp +87 -0
- package/nitrogen/generated/shared/c++/{ModernGeolocationConfiguration.hpp → GeolocationConfiguration.hpp} +11 -11
- package/nitrogen/generated/shared/c++/GeolocationResponse.hpp +14 -2
- package/nitrogen/generated/shared/c++/Heading.hpp +95 -0
- package/nitrogen/generated/shared/c++/HeadingOptions.hpp +83 -0
- package/nitrogen/generated/shared/c++/HybridNitroGeolocationCompatSpec.hpp +16 -16
- package/nitrogen/generated/shared/c++/HybridNitroGeolocationSpec.cpp +11 -0
- package/nitrogen/generated/shared/c++/HybridNitroGeolocationSpec.hpp +51 -12
- package/nitrogen/generated/shared/c++/IOSAccuracyPreset.hpp +96 -0
- package/nitrogen/generated/shared/c++/IOSActivityType.hpp +88 -0
- package/nitrogen/generated/shared/c++/LocationAccuracyOptions.hpp +92 -0
- package/nitrogen/generated/shared/c++/LocationAvailability.hpp +88 -0
- package/nitrogen/generated/shared/c++/LocationProviderStatus.hpp +103 -0
- package/nitrogen/generated/shared/c++/LocationProviderUsed.hpp +88 -0
- package/nitrogen/generated/shared/c++/LocationRequestOptions.hpp +47 -3
- package/nitrogen/generated/shared/c++/{GeolocationOptions.hpp → LocationSettingsOptions.hpp} +26 -24
- package/nitrogen/generated/shared/c++/ReverseGeocodedAddress.hpp +108 -0
- package/package.json +1 -1
- package/src/NitroGeolocation.nitro.ts +291 -17
- package/src/NitroGeolocationCompat.nitro.ts +12 -12
- package/src/api/geocode.ts +18 -0
- package/src/api/getAccuracyAuthorization.ts +12 -0
- package/src/api/getCurrentPosition.ts +5 -3
- package/src/api/getHeading.ts +13 -0
- package/src/api/getLastKnownPosition.ts +28 -0
- package/src/api/getLocationAvailability.ts +11 -0
- package/src/api/getProviderStatus.ts +16 -0
- package/src/api/hasServicesEnabled.ts +13 -0
- package/src/api/index.ts +11 -0
- package/src/api/requestLocationSettings.ts +29 -0
- package/src/api/requestPermission.ts +3 -1
- package/src/api/requestTemporaryFullAccuracy.ts +21 -0
- package/src/api/reverseGeocode.ts +23 -0
- package/src/api/setConfiguration.ts +8 -4
- package/src/api/watchHeading.ts +19 -0
- package/src/api/watchPosition.ts +2 -2
- package/src/compat/getCurrentPosition.ts +7 -7
- package/src/compat/index.tsx +5 -5
- package/src/compat/requestAuthorization.ts +2 -2
- package/src/compat/setRNConfiguration.ts +7 -5
- package/src/compat/watchPosition.ts +7 -7
- package/src/devtools/getCurrentPosition.ts +5 -3
- package/src/devtools/index.ts +1 -1
- package/src/devtools/watchPosition.ts +6 -7
- package/src/hooks/useWatchPosition.ts +2 -2
- package/src/index.tsx +35 -6
- package/src/publicTypes.ts +96 -0
- package/src/types.ts +113 -37
- package/src/utils/errors.test.ts +65 -0
- package/src/utils/errors.ts +45 -18
- package/src/utils/index.ts +2 -2
- package/src/utils/provider.test.ts +172 -1
- package/src/utils/provider.ts +50 -5
- package/nitrogen/generated/android/c++/JFunc_void_GeolocationError.hpp +0 -78
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// GeocodedLocation.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `GeocodedLocation`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias GeocodedLocation = margelo.nitro.nitrogeolocation.GeocodedLocation
|
|
14
|
+
|
|
15
|
+
public extension GeocodedLocation {
|
|
16
|
+
private typealias bridge = margelo.nitro.nitrogeolocation.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `GeocodedLocation`.
|
|
20
|
+
*/
|
|
21
|
+
init(latitude: Double, longitude: Double, accuracy: Double?) {
|
|
22
|
+
self.init(latitude, longitude, { () -> bridge.std__optional_double_ in
|
|
23
|
+
if let __unwrappedValue = accuracy {
|
|
24
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}())
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@inline(__always)
|
|
32
|
+
var latitude: Double {
|
|
33
|
+
return self.__latitude
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@inline(__always)
|
|
37
|
+
var longitude: Double {
|
|
38
|
+
return self.__longitude
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@inline(__always)
|
|
42
|
+
var accuracy: Double? {
|
|
43
|
+
return { () -> Double? in
|
|
44
|
+
if bridge.has_value_std__optional_double_(self.__accuracy) {
|
|
45
|
+
let __unwrapped = bridge.get_std__optional_double_(self.__accuracy)
|
|
46
|
+
return __unwrapped
|
|
47
|
+
} else {
|
|
48
|
+
return nil
|
|
49
|
+
}
|
|
50
|
+
}()
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// GeocodingCoordinates.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `GeocodingCoordinates`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias GeocodingCoordinates = margelo.nitro.nitrogeolocation.GeocodingCoordinates
|
|
14
|
+
|
|
15
|
+
public extension GeocodingCoordinates {
|
|
16
|
+
private typealias bridge = margelo.nitro.nitrogeolocation.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `GeocodingCoordinates`.
|
|
20
|
+
*/
|
|
21
|
+
init(latitude: Double, longitude: Double) {
|
|
22
|
+
self.init(latitude, longitude)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@inline(__always)
|
|
26
|
+
var latitude: Double {
|
|
27
|
+
return self.__latitude
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@inline(__always)
|
|
31
|
+
var longitude: Double {
|
|
32
|
+
return self.__longitude
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// GeolocationConfiguration.swift
|
|
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
|
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
import NitroModules
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Represents an instance of `
|
|
11
|
+
* Represents an instance of `GeolocationConfiguration`, backed by a C++ struct.
|
|
12
12
|
*/
|
|
13
|
-
public typealias
|
|
13
|
+
public typealias GeolocationConfiguration = margelo.nitro.nitrogeolocation.GeolocationConfiguration
|
|
14
14
|
|
|
15
|
-
public extension
|
|
15
|
+
public extension GeolocationConfiguration {
|
|
16
16
|
private typealias bridge = margelo.nitro.nitrogeolocation.bridge.swift
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* Create a new instance of `
|
|
19
|
+
* Create a new instance of `GeolocationConfiguration`.
|
|
20
20
|
*/
|
|
21
21
|
init(autoRequestPermission: Bool?, authorizationLevel: AuthorizationLevel?, enableBackgroundLocationUpdates: Bool?, locationProvider: LocationProvider?) {
|
|
22
22
|
self.init({ () -> bridge.std__optional_bool_ in
|
|
@@ -18,8 +18,20 @@ public extension GeolocationResponse {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `GeolocationResponse`.
|
|
20
20
|
*/
|
|
21
|
-
init(coords: GeolocationCoordinates, timestamp: Double) {
|
|
22
|
-
self.init(coords, timestamp)
|
|
21
|
+
init(coords: GeolocationCoordinates, timestamp: Double, mocked: Bool?, provider: LocationProviderUsed?) {
|
|
22
|
+
self.init(coords, timestamp, { () -> bridge.std__optional_bool_ in
|
|
23
|
+
if let __unwrappedValue = mocked {
|
|
24
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}(), { () -> bridge.std__optional_LocationProviderUsed_ in
|
|
29
|
+
if let __unwrappedValue = provider {
|
|
30
|
+
return bridge.create_std__optional_LocationProviderUsed_(__unwrappedValue)
|
|
31
|
+
} else {
|
|
32
|
+
return .init()
|
|
33
|
+
}
|
|
34
|
+
}())
|
|
23
35
|
}
|
|
24
36
|
|
|
25
37
|
@inline(__always)
|
|
@@ -31,4 +43,21 @@ public extension GeolocationResponse {
|
|
|
31
43
|
var timestamp: Double {
|
|
32
44
|
return self.__timestamp
|
|
33
45
|
}
|
|
46
|
+
|
|
47
|
+
@inline(__always)
|
|
48
|
+
var mocked: Bool? {
|
|
49
|
+
return { () -> Bool? in
|
|
50
|
+
if bridge.has_value_std__optional_bool_(self.__mocked) {
|
|
51
|
+
let __unwrapped = bridge.get_std__optional_bool_(self.__mocked)
|
|
52
|
+
return __unwrapped
|
|
53
|
+
} else {
|
|
54
|
+
return nil
|
|
55
|
+
}
|
|
56
|
+
}()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@inline(__always)
|
|
60
|
+
var provider: LocationProviderUsed? {
|
|
61
|
+
return self.__provider.value
|
|
62
|
+
}
|
|
34
63
|
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Heading.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `Heading`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias Heading = margelo.nitro.nitrogeolocation.Heading
|
|
14
|
+
|
|
15
|
+
public extension Heading {
|
|
16
|
+
private typealias bridge = margelo.nitro.nitrogeolocation.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `Heading`.
|
|
20
|
+
*/
|
|
21
|
+
init(magneticHeading: Double, trueHeading: Double?, accuracy: Double?, timestamp: Double) {
|
|
22
|
+
self.init(magneticHeading, { () -> bridge.std__optional_double_ in
|
|
23
|
+
if let __unwrappedValue = trueHeading {
|
|
24
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
29
|
+
if let __unwrappedValue = accuracy {
|
|
30
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
31
|
+
} else {
|
|
32
|
+
return .init()
|
|
33
|
+
}
|
|
34
|
+
}(), timestamp)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@inline(__always)
|
|
38
|
+
var magneticHeading: Double {
|
|
39
|
+
return self.__magneticHeading
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@inline(__always)
|
|
43
|
+
var trueHeading: Double? {
|
|
44
|
+
return { () -> Double? in
|
|
45
|
+
if bridge.has_value_std__optional_double_(self.__trueHeading) {
|
|
46
|
+
let __unwrapped = bridge.get_std__optional_double_(self.__trueHeading)
|
|
47
|
+
return __unwrapped
|
|
48
|
+
} else {
|
|
49
|
+
return nil
|
|
50
|
+
}
|
|
51
|
+
}()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@inline(__always)
|
|
55
|
+
var accuracy: Double? {
|
|
56
|
+
return { () -> Double? in
|
|
57
|
+
if bridge.has_value_std__optional_double_(self.__accuracy) {
|
|
58
|
+
let __unwrapped = bridge.get_std__optional_double_(self.__accuracy)
|
|
59
|
+
return __unwrapped
|
|
60
|
+
} else {
|
|
61
|
+
return nil
|
|
62
|
+
}
|
|
63
|
+
}()
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@inline(__always)
|
|
67
|
+
var timestamp: Double {
|
|
68
|
+
return self.__timestamp
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HeadingOptions.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `HeadingOptions`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias HeadingOptions = margelo.nitro.nitrogeolocation.HeadingOptions
|
|
14
|
+
|
|
15
|
+
public extension HeadingOptions {
|
|
16
|
+
private typealias bridge = margelo.nitro.nitrogeolocation.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `HeadingOptions`.
|
|
20
|
+
*/
|
|
21
|
+
init(headingFilter: Double?) {
|
|
22
|
+
self.init({ () -> bridge.std__optional_double_ in
|
|
23
|
+
if let __unwrappedValue = headingFilter {
|
|
24
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}())
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@inline(__always)
|
|
32
|
+
var headingFilter: Double? {
|
|
33
|
+
return { () -> Double? in
|
|
34
|
+
if bridge.has_value_std__optional_double_(self.__headingFilter) {
|
|
35
|
+
let __unwrapped = bridge.get_std__optional_double_(self.__headingFilter)
|
|
36
|
+
return __unwrapped
|
|
37
|
+
} else {
|
|
38
|
+
return nil
|
|
39
|
+
}
|
|
40
|
+
}()
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -13,10 +13,10 @@ public protocol HybridNitroGeolocationCompatSpec_protocol: HybridObject {
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
// Methods
|
|
16
|
-
func setRNConfiguration(config:
|
|
17
|
-
func requestAuthorization(success: (() -> Void)?, error: ((_ error:
|
|
18
|
-
func getCurrentPosition(success: @escaping (_ position:
|
|
19
|
-
func watchPosition(success: @escaping (_ position:
|
|
16
|
+
func setRNConfiguration(config: CompatGeolocationConfigurationInternal) throws -> Void
|
|
17
|
+
func requestAuthorization(success: (() -> Void)?, error: ((_ error: CompatGeolocationError) -> Void)?) throws -> Void
|
|
18
|
+
func getCurrentPosition(success: @escaping (_ position: CompatGeolocationResponse) -> Void, error: ((_ error: CompatGeolocationError) -> Void)?, options: CompatGeolocationOptions?) throws -> Void
|
|
19
|
+
func watchPosition(success: @escaping (_ position: CompatGeolocationResponse) -> Void, error: ((_ error: CompatGeolocationError) -> Void)?, options: CompatGeolocationOptions?) throws -> Double
|
|
20
20
|
func clearWatch(watchId: Double) throws -> Void
|
|
21
21
|
func stopObserving() throws -> Void
|
|
22
22
|
}
|
|
@@ -125,7 +125,7 @@ open class HybridNitroGeolocationCompatSpec_cxx {
|
|
|
125
125
|
|
|
126
126
|
// Methods
|
|
127
127
|
@inline(__always)
|
|
128
|
-
public final func setRNConfiguration(config:
|
|
128
|
+
public final func setRNConfiguration(config: CompatGeolocationConfigurationInternal) -> bridge.Result_void_ {
|
|
129
129
|
do {
|
|
130
130
|
try self.__implementation.setRNConfiguration(config: config)
|
|
131
131
|
return bridge.create_Result_void_()
|
|
@@ -136,7 +136,7 @@ open class HybridNitroGeolocationCompatSpec_cxx {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
@inline(__always)
|
|
139
|
-
public final func requestAuthorization(success: bridge.std__optional_std__function_void____, error: bridge.
|
|
139
|
+
public final func requestAuthorization(success: bridge.std__optional_std__function_void____, error: bridge.std__optional_std__function_void_const_CompatGeolocationError_____error______) -> bridge.Result_void_ {
|
|
140
140
|
do {
|
|
141
141
|
try self.__implementation.requestAuthorization(success: { () -> (() -> Void)? in
|
|
142
142
|
if bridge.has_value_std__optional_std__function_void____(success) {
|
|
@@ -150,12 +150,12 @@ open class HybridNitroGeolocationCompatSpec_cxx {
|
|
|
150
150
|
} else {
|
|
151
151
|
return nil
|
|
152
152
|
}
|
|
153
|
-
}(), error: { () -> ((_ error:
|
|
154
|
-
if bridge.
|
|
155
|
-
let __unwrapped = bridge.
|
|
156
|
-
return { () -> (
|
|
157
|
-
let __wrappedFunction = bridge.
|
|
158
|
-
return { (__error:
|
|
153
|
+
}(), error: { () -> ((_ error: CompatGeolocationError) -> Void)? in
|
|
154
|
+
if bridge.has_value_std__optional_std__function_void_const_CompatGeolocationError_____error______(error) {
|
|
155
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_const_CompatGeolocationError_____error______(error)
|
|
156
|
+
return { () -> (CompatGeolocationError) -> Void in
|
|
157
|
+
let __wrappedFunction = bridge.wrap_Func_void_CompatGeolocationError(__unwrapped)
|
|
158
|
+
return { (__error: CompatGeolocationError) -> Void in
|
|
159
159
|
__wrappedFunction.call(__error)
|
|
160
160
|
}
|
|
161
161
|
}()
|
|
@@ -171,19 +171,19 @@ open class HybridNitroGeolocationCompatSpec_cxx {
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
@inline(__always)
|
|
174
|
-
public final func getCurrentPosition(success: bridge.
|
|
174
|
+
public final func getCurrentPosition(success: bridge.Func_void_CompatGeolocationResponse, error: bridge.std__optional_std__function_void_const_CompatGeolocationError_____error______, options: bridge.std__optional_CompatGeolocationOptions_) -> bridge.Result_void_ {
|
|
175
175
|
do {
|
|
176
|
-
try self.__implementation.getCurrentPosition(success: { () -> (
|
|
177
|
-
let __wrappedFunction = bridge.
|
|
178
|
-
return { (__position:
|
|
176
|
+
try self.__implementation.getCurrentPosition(success: { () -> (CompatGeolocationResponse) -> Void in
|
|
177
|
+
let __wrappedFunction = bridge.wrap_Func_void_CompatGeolocationResponse(success)
|
|
178
|
+
return { (__position: CompatGeolocationResponse) -> Void in
|
|
179
179
|
__wrappedFunction.call(__position)
|
|
180
180
|
}
|
|
181
|
-
}(), error: { () -> ((_ error:
|
|
182
|
-
if bridge.
|
|
183
|
-
let __unwrapped = bridge.
|
|
184
|
-
return { () -> (
|
|
185
|
-
let __wrappedFunction = bridge.
|
|
186
|
-
return { (__error:
|
|
181
|
+
}(), error: { () -> ((_ error: CompatGeolocationError) -> Void)? in
|
|
182
|
+
if bridge.has_value_std__optional_std__function_void_const_CompatGeolocationError_____error______(error) {
|
|
183
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_const_CompatGeolocationError_____error______(error)
|
|
184
|
+
return { () -> (CompatGeolocationError) -> Void in
|
|
185
|
+
let __wrappedFunction = bridge.wrap_Func_void_CompatGeolocationError(__unwrapped)
|
|
186
|
+
return { (__error: CompatGeolocationError) -> Void in
|
|
187
187
|
__wrappedFunction.call(__error)
|
|
188
188
|
}
|
|
189
189
|
}()
|
|
@@ -199,19 +199,19 @@ open class HybridNitroGeolocationCompatSpec_cxx {
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
@inline(__always)
|
|
202
|
-
public final func watchPosition(success: bridge.
|
|
202
|
+
public final func watchPosition(success: bridge.Func_void_CompatGeolocationResponse, error: bridge.std__optional_std__function_void_const_CompatGeolocationError_____error______, options: bridge.std__optional_CompatGeolocationOptions_) -> bridge.Result_double_ {
|
|
203
203
|
do {
|
|
204
|
-
let __result = try self.__implementation.watchPosition(success: { () -> (
|
|
205
|
-
let __wrappedFunction = bridge.
|
|
206
|
-
return { (__position:
|
|
204
|
+
let __result = try self.__implementation.watchPosition(success: { () -> (CompatGeolocationResponse) -> Void in
|
|
205
|
+
let __wrappedFunction = bridge.wrap_Func_void_CompatGeolocationResponse(success)
|
|
206
|
+
return { (__position: CompatGeolocationResponse) -> Void in
|
|
207
207
|
__wrappedFunction.call(__position)
|
|
208
208
|
}
|
|
209
|
-
}(), error: { () -> ((_ error:
|
|
210
|
-
if bridge.
|
|
211
|
-
let __unwrapped = bridge.
|
|
212
|
-
return { () -> (
|
|
213
|
-
let __wrappedFunction = bridge.
|
|
214
|
-
return { (__error:
|
|
209
|
+
}(), error: { () -> ((_ error: CompatGeolocationError) -> Void)? in
|
|
210
|
+
if bridge.has_value_std__optional_std__function_void_const_CompatGeolocationError_____error______(error) {
|
|
211
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_const_CompatGeolocationError_____error______(error)
|
|
212
|
+
return { () -> (CompatGeolocationError) -> Void in
|
|
213
|
+
let __wrappedFunction = bridge.wrap_Func_void_CompatGeolocationError(__unwrapped)
|
|
214
|
+
return { (__error: CompatGeolocationError) -> Void in
|
|
215
215
|
__wrappedFunction.call(__error)
|
|
216
216
|
}
|
|
217
217
|
}()
|
|
@@ -13,10 +13,21 @@ public protocol HybridNitroGeolocationSpec_protocol: HybridObject {
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
// Methods
|
|
16
|
-
func setConfiguration(config:
|
|
16
|
+
func setConfiguration(config: GeolocationConfiguration) throws -> Void
|
|
17
17
|
func checkPermission() throws -> Promise<PermissionStatus>
|
|
18
|
-
func requestPermission() throws ->
|
|
19
|
-
func
|
|
18
|
+
func requestPermission(success: @escaping (_ status: PermissionStatus) -> Void, error: ((_ error: LocationError) -> Void)?) throws -> Void
|
|
19
|
+
func hasServicesEnabled() throws -> Promise<Bool>
|
|
20
|
+
func getProviderStatus() throws -> Promise<LocationProviderStatus>
|
|
21
|
+
func getLocationAvailability() throws -> Promise<LocationAvailability>
|
|
22
|
+
func requestLocationSettings(success: @escaping (_ status: LocationProviderStatus) -> Void, error: ((_ error: LocationError) -> Void)?, options: LocationSettingsOptions?) throws -> Void
|
|
23
|
+
func getAccuracyAuthorization() throws -> Promise<AccuracyAuthorization>
|
|
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)?, options: LocationRequestOptions?) throws -> Void
|
|
26
|
+
func getLastKnownPosition(success: @escaping (_ position: GeolocationResponse) -> Void, error: ((_ error: LocationError) -> Void)?, options: LocationRequestOptions?) throws -> Void
|
|
27
|
+
func geocode(address: String, success: @escaping (_ locations: [GeocodedLocation]) -> Void, error: ((_ error: LocationError) -> Void)?) throws -> Void
|
|
28
|
+
func reverseGeocode(coords: GeocodingCoordinates, success: @escaping (_ addresses: [ReverseGeocodedAddress]) -> Void, error: ((_ error: LocationError) -> Void)?) throws -> Void
|
|
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)?, options: HeadingOptions?) throws -> String
|
|
20
31
|
func watchPosition(success: @escaping (_ position: GeolocationResponse) -> Void, error: ((_ error: LocationError) -> Void)?, options: LocationRequestOptions?) throws -> String
|
|
21
32
|
func unwatch(token: String) throws -> Void
|
|
22
33
|
func stopObserving() throws -> Void
|