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.
- package/README.md +97 -9
- 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 +1027 -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 +292 -18
- 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 +108 -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,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AndroidGranularity.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 (AndroidGranularity).
|
|
30
|
+
*/
|
|
31
|
+
enum class AndroidGranularity {
|
|
32
|
+
PERMISSION SWIFT_NAME(permission) = 0,
|
|
33
|
+
COARSE SWIFT_NAME(coarse) = 1,
|
|
34
|
+
FINE SWIFT_NAME(fine) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::nitrogeolocation
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ AndroidGranularity <> JS AndroidGranularity (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::nitrogeolocation::AndroidGranularity> final {
|
|
44
|
+
static inline margelo::nitro::nitrogeolocation::AndroidGranularity fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
46
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
47
|
+
case hashString("permission"): return margelo::nitro::nitrogeolocation::AndroidGranularity::PERMISSION;
|
|
48
|
+
case hashString("coarse"): return margelo::nitro::nitrogeolocation::AndroidGranularity::COARSE;
|
|
49
|
+
case hashString("fine"): return margelo::nitro::nitrogeolocation::AndroidGranularity::FINE;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum AndroidGranularity - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitrogeolocation::AndroidGranularity arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::nitrogeolocation::AndroidGranularity::PERMISSION: return JSIConverter<std::string>::toJSI(runtime, "permission");
|
|
57
|
+
case margelo::nitro::nitrogeolocation::AndroidGranularity::COARSE: return JSIConverter<std::string>::toJSI(runtime, "coarse");
|
|
58
|
+
case margelo::nitro::nitrogeolocation::AndroidGranularity::FINE: return JSIConverter<std::string>::toJSI(runtime, "fine");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert AndroidGranularity to JS - invalid value: "
|
|
61
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isString()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
69
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
70
|
+
case hashString("permission"):
|
|
71
|
+
case hashString("coarse"):
|
|
72
|
+
case hashString("fine"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// CompatGeolocationConfigurationInternal.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 LocationProviderInternal
|
|
|
40
40
|
namespace margelo::nitro::nitrogeolocation {
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* A struct which can be represented as a JavaScript object (
|
|
43
|
+
* A struct which can be represented as a JavaScript object (CompatGeolocationConfigurationInternal).
|
|
44
44
|
*/
|
|
45
|
-
struct
|
|
45
|
+
struct CompatGeolocationConfigurationInternal final {
|
|
46
46
|
public:
|
|
47
47
|
bool skipPermissionRequests SWIFT_PRIVATE;
|
|
48
48
|
std::optional<AuthorizationLevelInternal> authorizationLevel SWIFT_PRIVATE;
|
|
@@ -50,30 +50,30 @@ namespace margelo::nitro::nitrogeolocation {
|
|
|
50
50
|
std::optional<LocationProviderInternal> locationProvider SWIFT_PRIVATE;
|
|
51
51
|
|
|
52
52
|
public:
|
|
53
|
-
|
|
54
|
-
explicit
|
|
53
|
+
CompatGeolocationConfigurationInternal() = default;
|
|
54
|
+
explicit CompatGeolocationConfigurationInternal(bool skipPermissionRequests, std::optional<AuthorizationLevelInternal> authorizationLevel, std::optional<bool> enableBackgroundLocationUpdates, std::optional<LocationProviderInternal> locationProvider): skipPermissionRequests(skipPermissionRequests), authorizationLevel(authorizationLevel), enableBackgroundLocationUpdates(enableBackgroundLocationUpdates), locationProvider(locationProvider) {}
|
|
55
55
|
|
|
56
56
|
public:
|
|
57
|
-
friend bool operator==(const
|
|
57
|
+
friend bool operator==(const CompatGeolocationConfigurationInternal& lhs, const CompatGeolocationConfigurationInternal& rhs) = default;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
} // namespace margelo::nitro::nitrogeolocation
|
|
61
61
|
|
|
62
62
|
namespace margelo::nitro {
|
|
63
63
|
|
|
64
|
-
// C++
|
|
64
|
+
// C++ CompatGeolocationConfigurationInternal <> JS CompatGeolocationConfigurationInternal (object)
|
|
65
65
|
template <>
|
|
66
|
-
struct JSIConverter<margelo::nitro::nitrogeolocation::
|
|
67
|
-
static inline margelo::nitro::nitrogeolocation::
|
|
66
|
+
struct JSIConverter<margelo::nitro::nitrogeolocation::CompatGeolocationConfigurationInternal> final {
|
|
67
|
+
static inline margelo::nitro::nitrogeolocation::CompatGeolocationConfigurationInternal fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
68
68
|
jsi::Object obj = arg.asObject(runtime);
|
|
69
|
-
return margelo::nitro::nitrogeolocation::
|
|
69
|
+
return margelo::nitro::nitrogeolocation::CompatGeolocationConfigurationInternal(
|
|
70
70
|
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "skipPermissionRequests"))),
|
|
71
71
|
JSIConverter<std::optional<margelo::nitro::nitrogeolocation::AuthorizationLevelInternal>>::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::LocationProviderInternal>>::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::
|
|
76
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::CompatGeolocationConfigurationInternal& arg) {
|
|
77
77
|
jsi::Object obj(runtime);
|
|
78
78
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "skipPermissionRequests"), JSIConverter<bool>::toJSI(runtime, arg.skipPermissionRequests));
|
|
79
79
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "authorizationLevel"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::AuthorizationLevelInternal>>::toJSI(runtime, arg.authorizationLevel));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// CompatGeolocationError.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
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
namespace margelo::nitro::nitrogeolocation {
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* A struct which can be represented as a JavaScript object (
|
|
38
|
+
* A struct which can be represented as a JavaScript object (CompatGeolocationError).
|
|
39
39
|
*/
|
|
40
|
-
struct
|
|
40
|
+
struct CompatGeolocationError final {
|
|
41
41
|
public:
|
|
42
42
|
double code SWIFT_PRIVATE;
|
|
43
43
|
std::string message SWIFT_PRIVATE;
|
|
@@ -46,23 +46,23 @@ namespace margelo::nitro::nitrogeolocation {
|
|
|
46
46
|
double TIMEOUT SWIFT_PRIVATE;
|
|
47
47
|
|
|
48
48
|
public:
|
|
49
|
-
|
|
50
|
-
explicit
|
|
49
|
+
CompatGeolocationError() = default;
|
|
50
|
+
explicit CompatGeolocationError(double code, std::string message, double PERMISSION_DENIED, double POSITION_UNAVAILABLE, double TIMEOUT): code(code), message(message), PERMISSION_DENIED(PERMISSION_DENIED), POSITION_UNAVAILABLE(POSITION_UNAVAILABLE), TIMEOUT(TIMEOUT) {}
|
|
51
51
|
|
|
52
52
|
public:
|
|
53
|
-
friend bool operator==(const
|
|
53
|
+
friend bool operator==(const CompatGeolocationError& lhs, const CompatGeolocationError& rhs) = default;
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
} // namespace margelo::nitro::nitrogeolocation
|
|
57
57
|
|
|
58
58
|
namespace margelo::nitro {
|
|
59
59
|
|
|
60
|
-
// C++
|
|
60
|
+
// C++ CompatGeolocationError <> JS CompatGeolocationError (object)
|
|
61
61
|
template <>
|
|
62
|
-
struct JSIConverter<margelo::nitro::nitrogeolocation::
|
|
63
|
-
static inline margelo::nitro::nitrogeolocation::
|
|
62
|
+
struct JSIConverter<margelo::nitro::nitrogeolocation::CompatGeolocationError> final {
|
|
63
|
+
static inline margelo::nitro::nitrogeolocation::CompatGeolocationError fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
64
64
|
jsi::Object obj = arg.asObject(runtime);
|
|
65
|
-
return margelo::nitro::nitrogeolocation::
|
|
65
|
+
return margelo::nitro::nitrogeolocation::CompatGeolocationError(
|
|
66
66
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "code"))),
|
|
67
67
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "message"))),
|
|
68
68
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "PERMISSION_DENIED"))),
|
|
@@ -70,7 +70,7 @@ namespace margelo::nitro {
|
|
|
70
70
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "TIMEOUT")))
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::
|
|
73
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::CompatGeolocationError& arg) {
|
|
74
74
|
jsi::Object obj(runtime);
|
|
75
75
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "code"), JSIConverter<double>::toJSI(runtime, arg.code));
|
|
76
76
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "message"), JSIConverter<std::string>::toJSI(runtime, arg.message));
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CompatGeolocationOptions.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `LocationAccuracyOptions` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::nitrogeolocation { struct LocationAccuracyOptions; }
|
|
33
|
+
// Forward declaration of `IOSActivityType` to properly resolve imports.
|
|
34
|
+
namespace margelo::nitro::nitrogeolocation { enum class IOSActivityType; }
|
|
35
|
+
|
|
36
|
+
#include <optional>
|
|
37
|
+
#include "LocationAccuracyOptions.hpp"
|
|
38
|
+
#include "IOSActivityType.hpp"
|
|
39
|
+
|
|
40
|
+
namespace margelo::nitro::nitrogeolocation {
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A struct which can be represented as a JavaScript object (CompatGeolocationOptions).
|
|
44
|
+
*/
|
|
45
|
+
struct CompatGeolocationOptions final {
|
|
46
|
+
public:
|
|
47
|
+
std::optional<double> timeout SWIFT_PRIVATE;
|
|
48
|
+
std::optional<double> maximumAge SWIFT_PRIVATE;
|
|
49
|
+
std::optional<bool> enableHighAccuracy SWIFT_PRIVATE;
|
|
50
|
+
std::optional<LocationAccuracyOptions> accuracy SWIFT_PRIVATE;
|
|
51
|
+
std::optional<double> interval SWIFT_PRIVATE;
|
|
52
|
+
std::optional<double> fastestInterval SWIFT_PRIVATE;
|
|
53
|
+
std::optional<double> distanceFilter SWIFT_PRIVATE;
|
|
54
|
+
std::optional<bool> useSignificantChanges SWIFT_PRIVATE;
|
|
55
|
+
std::optional<IOSActivityType> activityType SWIFT_PRIVATE;
|
|
56
|
+
std::optional<bool> pausesLocationUpdatesAutomatically SWIFT_PRIVATE;
|
|
57
|
+
std::optional<bool> showsBackgroundLocationIndicator SWIFT_PRIVATE;
|
|
58
|
+
|
|
59
|
+
public:
|
|
60
|
+
CompatGeolocationOptions() = default;
|
|
61
|
+
explicit CompatGeolocationOptions(std::optional<double> timeout, std::optional<double> maximumAge, std::optional<bool> enableHighAccuracy, std::optional<LocationAccuracyOptions> accuracy, std::optional<double> interval, std::optional<double> fastestInterval, std::optional<double> distanceFilter, std::optional<bool> useSignificantChanges, std::optional<IOSActivityType> activityType, std::optional<bool> pausesLocationUpdatesAutomatically, std::optional<bool> showsBackgroundLocationIndicator): timeout(timeout), maximumAge(maximumAge), enableHighAccuracy(enableHighAccuracy), accuracy(accuracy), interval(interval), fastestInterval(fastestInterval), distanceFilter(distanceFilter), useSignificantChanges(useSignificantChanges), activityType(activityType), pausesLocationUpdatesAutomatically(pausesLocationUpdatesAutomatically), showsBackgroundLocationIndicator(showsBackgroundLocationIndicator) {}
|
|
62
|
+
|
|
63
|
+
public:
|
|
64
|
+
friend bool operator==(const CompatGeolocationOptions& lhs, const CompatGeolocationOptions& rhs) = default;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
} // namespace margelo::nitro::nitrogeolocation
|
|
68
|
+
|
|
69
|
+
namespace margelo::nitro {
|
|
70
|
+
|
|
71
|
+
// C++ CompatGeolocationOptions <> JS CompatGeolocationOptions (object)
|
|
72
|
+
template <>
|
|
73
|
+
struct JSIConverter<margelo::nitro::nitrogeolocation::CompatGeolocationOptions> final {
|
|
74
|
+
static inline margelo::nitro::nitrogeolocation::CompatGeolocationOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
75
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
76
|
+
return margelo::nitro::nitrogeolocation::CompatGeolocationOptions(
|
|
77
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timeout"))),
|
|
78
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumAge"))),
|
|
79
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableHighAccuracy"))),
|
|
80
|
+
JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationAccuracyOptions>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accuracy"))),
|
|
81
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "interval"))),
|
|
82
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fastestInterval"))),
|
|
83
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "distanceFilter"))),
|
|
84
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "useSignificantChanges"))),
|
|
85
|
+
JSIConverter<std::optional<margelo::nitro::nitrogeolocation::IOSActivityType>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "activityType"))),
|
|
86
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pausesLocationUpdatesAutomatically"))),
|
|
87
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "showsBackgroundLocationIndicator")))
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::CompatGeolocationOptions& arg) {
|
|
91
|
+
jsi::Object obj(runtime);
|
|
92
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "timeout"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.timeout));
|
|
93
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "maximumAge"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.maximumAge));
|
|
94
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "enableHighAccuracy"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.enableHighAccuracy));
|
|
95
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "accuracy"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationAccuracyOptions>>::toJSI(runtime, arg.accuracy));
|
|
96
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "interval"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.interval));
|
|
97
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "fastestInterval"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.fastestInterval));
|
|
98
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "distanceFilter"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.distanceFilter));
|
|
99
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "useSignificantChanges"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.useSignificantChanges));
|
|
100
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "activityType"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::IOSActivityType>>::toJSI(runtime, arg.activityType));
|
|
101
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "pausesLocationUpdatesAutomatically"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.pausesLocationUpdatesAutomatically));
|
|
102
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "showsBackgroundLocationIndicator"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.showsBackgroundLocationIndicator));
|
|
103
|
+
return obj;
|
|
104
|
+
}
|
|
105
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
106
|
+
if (!value.isObject()) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
jsi::Object obj = value.getObject(runtime);
|
|
110
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timeout")))) return false;
|
|
114
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumAge")))) return false;
|
|
115
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableHighAccuracy")))) return false;
|
|
116
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationAccuracyOptions>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accuracy")))) return false;
|
|
117
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "interval")))) return false;
|
|
118
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fastestInterval")))) return false;
|
|
119
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "distanceFilter")))) return false;
|
|
120
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "useSignificantChanges")))) return false;
|
|
121
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::IOSActivityType>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "activityType")))) return false;
|
|
122
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pausesLocationUpdatesAutomatically")))) return false;
|
|
123
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "showsBackgroundLocationIndicator")))) return false;
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CompatGeolocationResponse.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `GeolocationCoordinates` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::nitrogeolocation { struct GeolocationCoordinates; }
|
|
33
|
+
|
|
34
|
+
#include "GeolocationCoordinates.hpp"
|
|
35
|
+
|
|
36
|
+
namespace margelo::nitro::nitrogeolocation {
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A struct which can be represented as a JavaScript object (CompatGeolocationResponse).
|
|
40
|
+
*/
|
|
41
|
+
struct CompatGeolocationResponse final {
|
|
42
|
+
public:
|
|
43
|
+
GeolocationCoordinates coords SWIFT_PRIVATE;
|
|
44
|
+
double timestamp SWIFT_PRIVATE;
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
CompatGeolocationResponse() = default;
|
|
48
|
+
explicit CompatGeolocationResponse(GeolocationCoordinates coords, double timestamp): coords(coords), timestamp(timestamp) {}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
friend bool operator==(const CompatGeolocationResponse& lhs, const CompatGeolocationResponse& rhs) = default;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // namespace margelo::nitro::nitrogeolocation
|
|
55
|
+
|
|
56
|
+
namespace margelo::nitro {
|
|
57
|
+
|
|
58
|
+
// C++ CompatGeolocationResponse <> JS CompatGeolocationResponse (object)
|
|
59
|
+
template <>
|
|
60
|
+
struct JSIConverter<margelo::nitro::nitrogeolocation::CompatGeolocationResponse> final {
|
|
61
|
+
static inline margelo::nitro::nitrogeolocation::CompatGeolocationResponse fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
62
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
63
|
+
return margelo::nitro::nitrogeolocation::CompatGeolocationResponse(
|
|
64
|
+
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")))
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::CompatGeolocationResponse& arg) {
|
|
69
|
+
jsi::Object obj(runtime);
|
|
70
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "coords"), JSIConverter<margelo::nitro::nitrogeolocation::GeolocationCoordinates>::toJSI(runtime, arg.coords));
|
|
71
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "timestamp"), JSIConverter<double>::toJSI(runtime, arg.timestamp));
|
|
72
|
+
return obj;
|
|
73
|
+
}
|
|
74
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
75
|
+
if (!value.isObject()) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
jsi::Object obj = value.getObject(runtime);
|
|
79
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
if (!JSIConverter<margelo::nitro::nitrogeolocation::GeolocationCoordinates>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "coords")))) return false;
|
|
83
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp")))) return false;
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// GeocodedLocation.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 (GeocodedLocation).
|
|
39
|
+
*/
|
|
40
|
+
struct GeocodedLocation final {
|
|
41
|
+
public:
|
|
42
|
+
double latitude SWIFT_PRIVATE;
|
|
43
|
+
double longitude SWIFT_PRIVATE;
|
|
44
|
+
std::optional<double> accuracy SWIFT_PRIVATE;
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
GeocodedLocation() = default;
|
|
48
|
+
explicit GeocodedLocation(double latitude, double longitude, std::optional<double> accuracy): latitude(latitude), longitude(longitude), accuracy(accuracy) {}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
friend bool operator==(const GeocodedLocation& lhs, const GeocodedLocation& rhs) = default;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // namespace margelo::nitro::nitrogeolocation
|
|
55
|
+
|
|
56
|
+
namespace margelo::nitro {
|
|
57
|
+
|
|
58
|
+
// C++ GeocodedLocation <> JS GeocodedLocation (object)
|
|
59
|
+
template <>
|
|
60
|
+
struct JSIConverter<margelo::nitro::nitrogeolocation::GeocodedLocation> final {
|
|
61
|
+
static inline margelo::nitro::nitrogeolocation::GeocodedLocation fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
62
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
63
|
+
return margelo::nitro::nitrogeolocation::GeocodedLocation(
|
|
64
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latitude"))),
|
|
65
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "longitude"))),
|
|
66
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accuracy")))
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::GeocodedLocation& arg) {
|
|
70
|
+
jsi::Object obj(runtime);
|
|
71
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "latitude"), JSIConverter<double>::toJSI(runtime, arg.latitude));
|
|
72
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "longitude"), JSIConverter<double>::toJSI(runtime, arg.longitude));
|
|
73
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "accuracy"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.accuracy));
|
|
74
|
+
return obj;
|
|
75
|
+
}
|
|
76
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
77
|
+
if (!value.isObject()) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
jsi::Object obj = value.getObject(runtime);
|
|
81
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latitude")))) return false;
|
|
85
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "longitude")))) return false;
|
|
86
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accuracy")))) return false;
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// GeocodingCoordinates.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::nitrogeolocation {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (GeocodingCoordinates).
|
|
39
|
+
*/
|
|
40
|
+
struct GeocodingCoordinates final {
|
|
41
|
+
public:
|
|
42
|
+
double latitude SWIFT_PRIVATE;
|
|
43
|
+
double longitude SWIFT_PRIVATE;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
GeocodingCoordinates() = default;
|
|
47
|
+
explicit GeocodingCoordinates(double latitude, double longitude): latitude(latitude), longitude(longitude) {}
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
friend bool operator==(const GeocodingCoordinates& lhs, const GeocodingCoordinates& rhs) = default;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
} // namespace margelo::nitro::nitrogeolocation
|
|
54
|
+
|
|
55
|
+
namespace margelo::nitro {
|
|
56
|
+
|
|
57
|
+
// C++ GeocodingCoordinates <> JS GeocodingCoordinates (object)
|
|
58
|
+
template <>
|
|
59
|
+
struct JSIConverter<margelo::nitro::nitrogeolocation::GeocodingCoordinates> final {
|
|
60
|
+
static inline margelo::nitro::nitrogeolocation::GeocodingCoordinates fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
61
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
62
|
+
return margelo::nitro::nitrogeolocation::GeocodingCoordinates(
|
|
63
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latitude"))),
|
|
64
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "longitude")))
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::GeocodingCoordinates& arg) {
|
|
68
|
+
jsi::Object obj(runtime);
|
|
69
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "latitude"), JSIConverter<double>::toJSI(runtime, arg.latitude));
|
|
70
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "longitude"), JSIConverter<double>::toJSI(runtime, arg.longitude));
|
|
71
|
+
return obj;
|
|
72
|
+
}
|
|
73
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
74
|
+
if (!value.isObject()) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
jsi::Object obj = value.getObject(runtime);
|
|
78
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latitude")))) return false;
|
|
82
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "longitude")))) return false;
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
} // namespace margelo::nitro
|