react-native-nitro-geolocation 1.1.4 → 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 +74 -8
- 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,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_CompatGeolocationError.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include "CompatGeolocationError.hpp"
|
|
14
|
+
#include <functional>
|
|
15
|
+
#include <NitroModules/JNICallable.hpp>
|
|
16
|
+
#include "JCompatGeolocationError.hpp"
|
|
17
|
+
#include <string>
|
|
18
|
+
|
|
19
|
+
namespace margelo::nitro::nitrogeolocation {
|
|
20
|
+
|
|
21
|
+
using namespace facebook;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Represents the Java/Kotlin callback `(error: CompatGeolocationError) -> Unit`.
|
|
25
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
26
|
+
*/
|
|
27
|
+
struct JFunc_void_CompatGeolocationError: public jni::JavaClass<JFunc_void_CompatGeolocationError> {
|
|
28
|
+
public:
|
|
29
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrogeolocation/Func_void_CompatGeolocationError;";
|
|
30
|
+
|
|
31
|
+
public:
|
|
32
|
+
/**
|
|
33
|
+
* Invokes the function this `JFunc_void_CompatGeolocationError` instance holds through JNI.
|
|
34
|
+
*/
|
|
35
|
+
void invoke(const CompatGeolocationError& error) const {
|
|
36
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JCompatGeolocationError> /* error */)>("invoke");
|
|
37
|
+
method(self(), JCompatGeolocationError::fromCpp(error));
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* An implementation of Func_void_CompatGeolocationError that is backed by a C++ implementation (using `std::function<...>`)
|
|
43
|
+
*/
|
|
44
|
+
class JFunc_void_CompatGeolocationError_cxx final: public jni::HybridClass<JFunc_void_CompatGeolocationError_cxx, JFunc_void_CompatGeolocationError> {
|
|
45
|
+
public:
|
|
46
|
+
static jni::local_ref<JFunc_void_CompatGeolocationError::javaobject> fromCpp(const std::function<void(const CompatGeolocationError& /* error */)>& func) {
|
|
47
|
+
return JFunc_void_CompatGeolocationError_cxx::newObjectCxxArgs(func);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
/**
|
|
52
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_CompatGeolocationError_cxx` instance holds.
|
|
53
|
+
*/
|
|
54
|
+
void invoke_cxx(jni::alias_ref<JCompatGeolocationError> error) {
|
|
55
|
+
_func(error->toCpp());
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public:
|
|
59
|
+
[[nodiscard]]
|
|
60
|
+
inline const std::function<void(const CompatGeolocationError& /* error */)>& getFunction() const {
|
|
61
|
+
return _func;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public:
|
|
65
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrogeolocation/Func_void_CompatGeolocationError_cxx;";
|
|
66
|
+
static void registerNatives() {
|
|
67
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_CompatGeolocationError_cxx::invoke_cxx)});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
explicit JFunc_void_CompatGeolocationError_cxx(const std::function<void(const CompatGeolocationError& /* error */)>& func): _func(func) { }
|
|
72
|
+
|
|
73
|
+
private:
|
|
74
|
+
friend HybridBase;
|
|
75
|
+
std::function<void(const CompatGeolocationError& /* error */)> _func;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
} // namespace margelo::nitro::nitrogeolocation
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include "CompatGeolocationResponse.hpp"
|
|
14
|
+
#include <functional>
|
|
15
|
+
#include <NitroModules/JNICallable.hpp>
|
|
16
|
+
#include "JCompatGeolocationResponse.hpp"
|
|
17
|
+
#include "GeolocationCoordinates.hpp"
|
|
18
|
+
#include "JGeolocationCoordinates.hpp"
|
|
19
|
+
#include <NitroModules/Null.hpp>
|
|
20
|
+
#include <variant>
|
|
21
|
+
#include <optional>
|
|
22
|
+
#include "JNullableDouble.hpp"
|
|
23
|
+
#include <NitroModules/JNull.hpp>
|
|
24
|
+
|
|
25
|
+
namespace margelo::nitro::nitrogeolocation {
|
|
26
|
+
|
|
27
|
+
using namespace facebook;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Represents the Java/Kotlin callback `(position: CompatGeolocationResponse) -> Unit`.
|
|
31
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
32
|
+
*/
|
|
33
|
+
struct JFunc_void_CompatGeolocationResponse: public jni::JavaClass<JFunc_void_CompatGeolocationResponse> {
|
|
34
|
+
public:
|
|
35
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrogeolocation/Func_void_CompatGeolocationResponse;";
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Invokes the function this `JFunc_void_CompatGeolocationResponse` instance holds through JNI.
|
|
40
|
+
*/
|
|
41
|
+
void invoke(const CompatGeolocationResponse& position) const {
|
|
42
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JCompatGeolocationResponse> /* position */)>("invoke");
|
|
43
|
+
method(self(), JCompatGeolocationResponse::fromCpp(position));
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* An implementation of Func_void_CompatGeolocationResponse that is backed by a C++ implementation (using `std::function<...>`)
|
|
49
|
+
*/
|
|
50
|
+
class JFunc_void_CompatGeolocationResponse_cxx final: public jni::HybridClass<JFunc_void_CompatGeolocationResponse_cxx, JFunc_void_CompatGeolocationResponse> {
|
|
51
|
+
public:
|
|
52
|
+
static jni::local_ref<JFunc_void_CompatGeolocationResponse::javaobject> fromCpp(const std::function<void(const CompatGeolocationResponse& /* position */)>& func) {
|
|
53
|
+
return JFunc_void_CompatGeolocationResponse_cxx::newObjectCxxArgs(func);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
/**
|
|
58
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_CompatGeolocationResponse_cxx` instance holds.
|
|
59
|
+
*/
|
|
60
|
+
void invoke_cxx(jni::alias_ref<JCompatGeolocationResponse> position) {
|
|
61
|
+
_func(position->toCpp());
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public:
|
|
65
|
+
[[nodiscard]]
|
|
66
|
+
inline const std::function<void(const CompatGeolocationResponse& /* position */)>& getFunction() const {
|
|
67
|
+
return _func;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public:
|
|
71
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrogeolocation/Func_void_CompatGeolocationResponse_cxx;";
|
|
72
|
+
static void registerNatives() {
|
|
73
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_CompatGeolocationResponse_cxx::invoke_cxx)});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
private:
|
|
77
|
+
explicit JFunc_void_CompatGeolocationResponse_cxx(const std::function<void(const CompatGeolocationResponse& /* position */)>& func): _func(func) { }
|
|
78
|
+
|
|
79
|
+
private:
|
|
80
|
+
friend HybridBase;
|
|
81
|
+
std::function<void(const CompatGeolocationResponse& /* position */)> _func;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
} // namespace margelo::nitro::nitrogeolocation
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_Heading.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include "Heading.hpp"
|
|
14
|
+
#include <functional>
|
|
15
|
+
#include <NitroModules/JNICallable.hpp>
|
|
16
|
+
#include "JHeading.hpp"
|
|
17
|
+
#include <optional>
|
|
18
|
+
|
|
19
|
+
namespace margelo::nitro::nitrogeolocation {
|
|
20
|
+
|
|
21
|
+
using namespace facebook;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Represents the Java/Kotlin callback `(heading: Heading) -> Unit`.
|
|
25
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
26
|
+
*/
|
|
27
|
+
struct JFunc_void_Heading: public jni::JavaClass<JFunc_void_Heading> {
|
|
28
|
+
public:
|
|
29
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrogeolocation/Func_void_Heading;";
|
|
30
|
+
|
|
31
|
+
public:
|
|
32
|
+
/**
|
|
33
|
+
* Invokes the function this `JFunc_void_Heading` instance holds through JNI.
|
|
34
|
+
*/
|
|
35
|
+
void invoke(const Heading& heading) const {
|
|
36
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JHeading> /* heading */)>("invoke");
|
|
37
|
+
method(self(), JHeading::fromCpp(heading));
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* An implementation of Func_void_Heading that is backed by a C++ implementation (using `std::function<...>`)
|
|
43
|
+
*/
|
|
44
|
+
class JFunc_void_Heading_cxx final: public jni::HybridClass<JFunc_void_Heading_cxx, JFunc_void_Heading> {
|
|
45
|
+
public:
|
|
46
|
+
static jni::local_ref<JFunc_void_Heading::javaobject> fromCpp(const std::function<void(const Heading& /* heading */)>& func) {
|
|
47
|
+
return JFunc_void_Heading_cxx::newObjectCxxArgs(func);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
/**
|
|
52
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_Heading_cxx` instance holds.
|
|
53
|
+
*/
|
|
54
|
+
void invoke_cxx(jni::alias_ref<JHeading> heading) {
|
|
55
|
+
_func(heading->toCpp());
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public:
|
|
59
|
+
[[nodiscard]]
|
|
60
|
+
inline const std::function<void(const Heading& /* heading */)>& getFunction() const {
|
|
61
|
+
return _func;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public:
|
|
65
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrogeolocation/Func_void_Heading_cxx;";
|
|
66
|
+
static void registerNatives() {
|
|
67
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_Heading_cxx::invoke_cxx)});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
explicit JFunc_void_Heading_cxx(const std::function<void(const Heading& /* heading */)>& func): _func(func) { }
|
|
72
|
+
|
|
73
|
+
private:
|
|
74
|
+
friend HybridBase;
|
|
75
|
+
std::function<void(const Heading& /* heading */)> _func;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
} // namespace margelo::nitro::nitrogeolocation
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_LocationProviderStatus.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include "LocationProviderStatus.hpp"
|
|
14
|
+
#include <functional>
|
|
15
|
+
#include <NitroModules/JNICallable.hpp>
|
|
16
|
+
#include "JLocationProviderStatus.hpp"
|
|
17
|
+
#include <optional>
|
|
18
|
+
|
|
19
|
+
namespace margelo::nitro::nitrogeolocation {
|
|
20
|
+
|
|
21
|
+
using namespace facebook;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Represents the Java/Kotlin callback `(status: LocationProviderStatus) -> Unit`.
|
|
25
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
26
|
+
*/
|
|
27
|
+
struct JFunc_void_LocationProviderStatus: public jni::JavaClass<JFunc_void_LocationProviderStatus> {
|
|
28
|
+
public:
|
|
29
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrogeolocation/Func_void_LocationProviderStatus;";
|
|
30
|
+
|
|
31
|
+
public:
|
|
32
|
+
/**
|
|
33
|
+
* Invokes the function this `JFunc_void_LocationProviderStatus` instance holds through JNI.
|
|
34
|
+
*/
|
|
35
|
+
void invoke(const LocationProviderStatus& status) const {
|
|
36
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JLocationProviderStatus> /* status */)>("invoke");
|
|
37
|
+
method(self(), JLocationProviderStatus::fromCpp(status));
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* An implementation of Func_void_LocationProviderStatus that is backed by a C++ implementation (using `std::function<...>`)
|
|
43
|
+
*/
|
|
44
|
+
class JFunc_void_LocationProviderStatus_cxx final: public jni::HybridClass<JFunc_void_LocationProviderStatus_cxx, JFunc_void_LocationProviderStatus> {
|
|
45
|
+
public:
|
|
46
|
+
static jni::local_ref<JFunc_void_LocationProviderStatus::javaobject> fromCpp(const std::function<void(const LocationProviderStatus& /* status */)>& func) {
|
|
47
|
+
return JFunc_void_LocationProviderStatus_cxx::newObjectCxxArgs(func);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
/**
|
|
52
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_LocationProviderStatus_cxx` instance holds.
|
|
53
|
+
*/
|
|
54
|
+
void invoke_cxx(jni::alias_ref<JLocationProviderStatus> status) {
|
|
55
|
+
_func(status->toCpp());
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public:
|
|
59
|
+
[[nodiscard]]
|
|
60
|
+
inline const std::function<void(const LocationProviderStatus& /* status */)>& getFunction() const {
|
|
61
|
+
return _func;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public:
|
|
65
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrogeolocation/Func_void_LocationProviderStatus_cxx;";
|
|
66
|
+
static void registerNatives() {
|
|
67
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_LocationProviderStatus_cxx::invoke_cxx)});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
explicit JFunc_void_LocationProviderStatus_cxx(const std::function<void(const LocationProviderStatus& /* status */)>& func): _func(func) { }
|
|
72
|
+
|
|
73
|
+
private:
|
|
74
|
+
friend HybridBase;
|
|
75
|
+
std::function<void(const LocationProviderStatus& /* status */)> _func;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
} // namespace margelo::nitro::nitrogeolocation
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_PermissionStatus.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include "PermissionStatus.hpp"
|
|
14
|
+
#include <functional>
|
|
15
|
+
#include <NitroModules/JNICallable.hpp>
|
|
16
|
+
#include "JPermissionStatus.hpp"
|
|
17
|
+
|
|
18
|
+
namespace margelo::nitro::nitrogeolocation {
|
|
19
|
+
|
|
20
|
+
using namespace facebook;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Represents the Java/Kotlin callback `(status: PermissionStatus) -> Unit`.
|
|
24
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
25
|
+
*/
|
|
26
|
+
struct JFunc_void_PermissionStatus: public jni::JavaClass<JFunc_void_PermissionStatus> {
|
|
27
|
+
public:
|
|
28
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrogeolocation/Func_void_PermissionStatus;";
|
|
29
|
+
|
|
30
|
+
public:
|
|
31
|
+
/**
|
|
32
|
+
* Invokes the function this `JFunc_void_PermissionStatus` instance holds through JNI.
|
|
33
|
+
*/
|
|
34
|
+
void invoke(PermissionStatus status) const {
|
|
35
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JPermissionStatus> /* status */)>("invoke");
|
|
36
|
+
method(self(), JPermissionStatus::fromCpp(status));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* An implementation of Func_void_PermissionStatus that is backed by a C++ implementation (using `std::function<...>`)
|
|
42
|
+
*/
|
|
43
|
+
class JFunc_void_PermissionStatus_cxx final: public jni::HybridClass<JFunc_void_PermissionStatus_cxx, JFunc_void_PermissionStatus> {
|
|
44
|
+
public:
|
|
45
|
+
static jni::local_ref<JFunc_void_PermissionStatus::javaobject> fromCpp(const std::function<void(PermissionStatus /* status */)>& func) {
|
|
46
|
+
return JFunc_void_PermissionStatus_cxx::newObjectCxxArgs(func);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
/**
|
|
51
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_PermissionStatus_cxx` instance holds.
|
|
52
|
+
*/
|
|
53
|
+
void invoke_cxx(jni::alias_ref<JPermissionStatus> status) {
|
|
54
|
+
_func(status->toCpp());
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public:
|
|
58
|
+
[[nodiscard]]
|
|
59
|
+
inline const std::function<void(PermissionStatus /* status */)>& getFunction() const {
|
|
60
|
+
return _func;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public:
|
|
64
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrogeolocation/Func_void_PermissionStatus_cxx;";
|
|
65
|
+
static void registerNatives() {
|
|
66
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_PermissionStatus_cxx::invoke_cxx)});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private:
|
|
70
|
+
explicit JFunc_void_PermissionStatus_cxx(const std::function<void(PermissionStatus /* status */)>& func): _func(func) { }
|
|
71
|
+
|
|
72
|
+
private:
|
|
73
|
+
friend HybridBase;
|
|
74
|
+
std::function<void(PermissionStatus /* status */)> _func;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
} // namespace margelo::nitro::nitrogeolocation
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_std__vector_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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include "GeocodedLocation.hpp"
|
|
14
|
+
#include <vector>
|
|
15
|
+
#include <functional>
|
|
16
|
+
#include <NitroModules/JNICallable.hpp>
|
|
17
|
+
#include "JGeocodedLocation.hpp"
|
|
18
|
+
#include <optional>
|
|
19
|
+
|
|
20
|
+
namespace margelo::nitro::nitrogeolocation {
|
|
21
|
+
|
|
22
|
+
using namespace facebook;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Represents the Java/Kotlin callback `(locations: Array<GeocodedLocation>) -> Unit`.
|
|
26
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
27
|
+
*/
|
|
28
|
+
struct JFunc_void_std__vector_GeocodedLocation_: public jni::JavaClass<JFunc_void_std__vector_GeocodedLocation_> {
|
|
29
|
+
public:
|
|
30
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrogeolocation/Func_void_std__vector_GeocodedLocation_;";
|
|
31
|
+
|
|
32
|
+
public:
|
|
33
|
+
/**
|
|
34
|
+
* Invokes the function this `JFunc_void_std__vector_GeocodedLocation_` instance holds through JNI.
|
|
35
|
+
*/
|
|
36
|
+
void invoke(const std::vector<GeocodedLocation>& locations) const {
|
|
37
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<JGeocodedLocation>> /* locations */)>("invoke");
|
|
38
|
+
method(self(), [&]() {
|
|
39
|
+
size_t __size = locations.size();
|
|
40
|
+
jni::local_ref<jni::JArrayClass<JGeocodedLocation>> __array = jni::JArrayClass<JGeocodedLocation>::newArray(__size);
|
|
41
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
42
|
+
const auto& __element = locations[__i];
|
|
43
|
+
auto __elementJni = JGeocodedLocation::fromCpp(__element);
|
|
44
|
+
__array->setElement(__i, *__elementJni);
|
|
45
|
+
}
|
|
46
|
+
return __array;
|
|
47
|
+
}());
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* An implementation of Func_void_std__vector_GeocodedLocation_ that is backed by a C++ implementation (using `std::function<...>`)
|
|
53
|
+
*/
|
|
54
|
+
class JFunc_void_std__vector_GeocodedLocation__cxx final: public jni::HybridClass<JFunc_void_std__vector_GeocodedLocation__cxx, JFunc_void_std__vector_GeocodedLocation_> {
|
|
55
|
+
public:
|
|
56
|
+
static jni::local_ref<JFunc_void_std__vector_GeocodedLocation_::javaobject> fromCpp(const std::function<void(const std::vector<GeocodedLocation>& /* locations */)>& func) {
|
|
57
|
+
return JFunc_void_std__vector_GeocodedLocation__cxx::newObjectCxxArgs(func);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public:
|
|
61
|
+
/**
|
|
62
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_std__vector_GeocodedLocation__cxx` instance holds.
|
|
63
|
+
*/
|
|
64
|
+
void invoke_cxx(jni::alias_ref<jni::JArrayClass<JGeocodedLocation>> locations) {
|
|
65
|
+
_func([&]() {
|
|
66
|
+
size_t __size = locations->size();
|
|
67
|
+
std::vector<GeocodedLocation> __vector;
|
|
68
|
+
__vector.reserve(__size);
|
|
69
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
70
|
+
auto __element = locations->getElement(__i);
|
|
71
|
+
__vector.push_back(__element->toCpp());
|
|
72
|
+
}
|
|
73
|
+
return __vector;
|
|
74
|
+
}());
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public:
|
|
78
|
+
[[nodiscard]]
|
|
79
|
+
inline const std::function<void(const std::vector<GeocodedLocation>& /* locations */)>& getFunction() const {
|
|
80
|
+
return _func;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public:
|
|
84
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrogeolocation/Func_void_std__vector_GeocodedLocation__cxx;";
|
|
85
|
+
static void registerNatives() {
|
|
86
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__vector_GeocodedLocation__cxx::invoke_cxx)});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private:
|
|
90
|
+
explicit JFunc_void_std__vector_GeocodedLocation__cxx(const std::function<void(const std::vector<GeocodedLocation>& /* locations */)>& func): _func(func) { }
|
|
91
|
+
|
|
92
|
+
private:
|
|
93
|
+
friend HybridBase;
|
|
94
|
+
std::function<void(const std::vector<GeocodedLocation>& /* locations */)> _func;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
} // namespace margelo::nitro::nitrogeolocation
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_std__vector_ReverseGeocodedAddress_.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include "ReverseGeocodedAddress.hpp"
|
|
14
|
+
#include <vector>
|
|
15
|
+
#include <functional>
|
|
16
|
+
#include <NitroModules/JNICallable.hpp>
|
|
17
|
+
#include "JReverseGeocodedAddress.hpp"
|
|
18
|
+
#include <string>
|
|
19
|
+
#include <optional>
|
|
20
|
+
|
|
21
|
+
namespace margelo::nitro::nitrogeolocation {
|
|
22
|
+
|
|
23
|
+
using namespace facebook;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Represents the Java/Kotlin callback `(addresses: Array<ReverseGeocodedAddress>) -> Unit`.
|
|
27
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
28
|
+
*/
|
|
29
|
+
struct JFunc_void_std__vector_ReverseGeocodedAddress_: public jni::JavaClass<JFunc_void_std__vector_ReverseGeocodedAddress_> {
|
|
30
|
+
public:
|
|
31
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrogeolocation/Func_void_std__vector_ReverseGeocodedAddress_;";
|
|
32
|
+
|
|
33
|
+
public:
|
|
34
|
+
/**
|
|
35
|
+
* Invokes the function this `JFunc_void_std__vector_ReverseGeocodedAddress_` instance holds through JNI.
|
|
36
|
+
*/
|
|
37
|
+
void invoke(const std::vector<ReverseGeocodedAddress>& addresses) const {
|
|
38
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<JReverseGeocodedAddress>> /* addresses */)>("invoke");
|
|
39
|
+
method(self(), [&]() {
|
|
40
|
+
size_t __size = addresses.size();
|
|
41
|
+
jni::local_ref<jni::JArrayClass<JReverseGeocodedAddress>> __array = jni::JArrayClass<JReverseGeocodedAddress>::newArray(__size);
|
|
42
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
43
|
+
const auto& __element = addresses[__i];
|
|
44
|
+
auto __elementJni = JReverseGeocodedAddress::fromCpp(__element);
|
|
45
|
+
__array->setElement(__i, *__elementJni);
|
|
46
|
+
}
|
|
47
|
+
return __array;
|
|
48
|
+
}());
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* An implementation of Func_void_std__vector_ReverseGeocodedAddress_ that is backed by a C++ implementation (using `std::function<...>`)
|
|
54
|
+
*/
|
|
55
|
+
class JFunc_void_std__vector_ReverseGeocodedAddress__cxx final: public jni::HybridClass<JFunc_void_std__vector_ReverseGeocodedAddress__cxx, JFunc_void_std__vector_ReverseGeocodedAddress_> {
|
|
56
|
+
public:
|
|
57
|
+
static jni::local_ref<JFunc_void_std__vector_ReverseGeocodedAddress_::javaobject> fromCpp(const std::function<void(const std::vector<ReverseGeocodedAddress>& /* addresses */)>& func) {
|
|
58
|
+
return JFunc_void_std__vector_ReverseGeocodedAddress__cxx::newObjectCxxArgs(func);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public:
|
|
62
|
+
/**
|
|
63
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_std__vector_ReverseGeocodedAddress__cxx` instance holds.
|
|
64
|
+
*/
|
|
65
|
+
void invoke_cxx(jni::alias_ref<jni::JArrayClass<JReverseGeocodedAddress>> addresses) {
|
|
66
|
+
_func([&]() {
|
|
67
|
+
size_t __size = addresses->size();
|
|
68
|
+
std::vector<ReverseGeocodedAddress> __vector;
|
|
69
|
+
__vector.reserve(__size);
|
|
70
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
71
|
+
auto __element = addresses->getElement(__i);
|
|
72
|
+
__vector.push_back(__element->toCpp());
|
|
73
|
+
}
|
|
74
|
+
return __vector;
|
|
75
|
+
}());
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public:
|
|
79
|
+
[[nodiscard]]
|
|
80
|
+
inline const std::function<void(const std::vector<ReverseGeocodedAddress>& /* addresses */)>& getFunction() const {
|
|
81
|
+
return _func;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public:
|
|
85
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrogeolocation/Func_void_std__vector_ReverseGeocodedAddress__cxx;";
|
|
86
|
+
static void registerNatives() {
|
|
87
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__vector_ReverseGeocodedAddress__cxx::invoke_cxx)});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
private:
|
|
91
|
+
explicit JFunc_void_std__vector_ReverseGeocodedAddress__cxx(const std::function<void(const std::vector<ReverseGeocodedAddress>& /* addresses */)>& func): _func(func) { }
|
|
92
|
+
|
|
93
|
+
private:
|
|
94
|
+
friend HybridBase;
|
|
95
|
+
std::function<void(const std::vector<ReverseGeocodedAddress>& /* addresses */)> _func;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
} // namespace margelo::nitro::nitrogeolocation
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JGeocodedLocation.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "GeocodedLocation.hpp"
|
|
12
|
+
|
|
13
|
+
#include <optional>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::nitrogeolocation {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "GeocodedLocation" and the the Kotlin data class "GeocodedLocation".
|
|
21
|
+
*/
|
|
22
|
+
struct JGeocodedLocation final: public jni::JavaClass<JGeocodedLocation> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrogeolocation/GeocodedLocation;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct GeocodedLocation by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
GeocodedLocation toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldLatitude = clazz->getField<double>("latitude");
|
|
35
|
+
double latitude = this->getFieldValue(fieldLatitude);
|
|
36
|
+
static const auto fieldLongitude = clazz->getField<double>("longitude");
|
|
37
|
+
double longitude = this->getFieldValue(fieldLongitude);
|
|
38
|
+
static const auto fieldAccuracy = clazz->getField<jni::JDouble>("accuracy");
|
|
39
|
+
jni::local_ref<jni::JDouble> accuracy = this->getFieldValue(fieldAccuracy);
|
|
40
|
+
return GeocodedLocation(
|
|
41
|
+
latitude,
|
|
42
|
+
longitude,
|
|
43
|
+
accuracy != nullptr ? std::make_optional(accuracy->value()) : std::nullopt
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
/**
|
|
49
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
50
|
+
*/
|
|
51
|
+
[[maybe_unused]]
|
|
52
|
+
static jni::local_ref<JGeocodedLocation::javaobject> fromCpp(const GeocodedLocation& value) {
|
|
53
|
+
using JSignature = JGeocodedLocation(double, double, jni::alias_ref<jni::JDouble>);
|
|
54
|
+
static const auto clazz = javaClassStatic();
|
|
55
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
56
|
+
return create(
|
|
57
|
+
clazz,
|
|
58
|
+
value.latitude,
|
|
59
|
+
value.longitude,
|
|
60
|
+
value.accuracy.has_value() ? jni::JDouble::valueOf(value.accuracy.value()) : nullptr
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
} // namespace margelo::nitro::nitrogeolocation
|