react-native-nitro-geolocation 0.0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/LICENSE +4 -1
  2. package/README.md +318 -0
  3. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/GetCurrentPosition.kt +341 -0
  4. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/NitroGeolocation.kt +76 -5
  5. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/RequestAuthorization.kt +164 -0
  6. package/android/src/main/java/com/margelo/nitro/nitrogeolocation/WatchPosition.kt +228 -0
  7. package/ios/LocationManager.swift +529 -0
  8. package/ios/NitroGeolocation.swift +96 -2
  9. package/nitrogen/generated/.gitattributes +1 -0
  10. package/nitrogen/generated/android/c++/JAuthorizationLevelInternal.hpp +62 -0
  11. package/nitrogen/generated/android/c++/JFunc_void.hpp +74 -0
  12. package/nitrogen/generated/android/c++/JFunc_void_GeolocationError.hpp +77 -0
  13. package/nitrogen/generated/android/c++/JFunc_void_GeolocationResponse.hpp +79 -0
  14. package/nitrogen/generated/android/c++/JGeolocationCoordinates.hpp +77 -0
  15. package/nitrogen/generated/android/c++/JGeolocationError.hpp +69 -0
  16. package/nitrogen/generated/android/c++/JGeolocationOptions.hpp +77 -0
  17. package/nitrogen/generated/android/c++/JGeolocationResponse.hpp +59 -0
  18. package/nitrogen/generated/android/c++/JHybridNitroGeolocationSpec.cpp +98 -0
  19. package/nitrogen/generated/android/c++/JHybridNitroGeolocationSpec.hpp +69 -0
  20. package/nitrogen/generated/android/c++/JLocationProviderInternal.hpp +62 -0
  21. package/nitrogen/generated/android/c++/JRNConfigurationInternal.hpp +69 -0
  22. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/AuthorizationLevelInternal.kt +22 -0
  23. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void.kt +81 -0
  24. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_GeolocationError.kt +81 -0
  25. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_GeolocationResponse.kt +81 -0
  26. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeolocationCoordinates.kt +47 -0
  27. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeolocationError.kt +41 -0
  28. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeolocationOptions.kt +47 -0
  29. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeolocationResponse.kt +32 -0
  30. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/HybridNitroGeolocationSpec.kt +87 -0
  31. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationProviderInternal.kt +22 -0
  32. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/RNConfigurationInternal.kt +38 -0
  33. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/nitrogeolocationOnLoad.kt +35 -0
  34. package/nitrogen/generated/android/nitrogeolocation+autolinking.cmake +81 -0
  35. package/nitrogen/generated/android/nitrogeolocation+autolinking.gradle +27 -0
  36. package/nitrogen/generated/android/nitrogeolocationOnLoad.cpp +50 -0
  37. package/nitrogen/generated/android/nitrogeolocationOnLoad.hpp +25 -0
  38. package/nitrogen/generated/ios/NitroGeolocation+autolinking.rb +60 -0
  39. package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Bridge.cpp +56 -0
  40. package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Bridge.hpp +252 -0
  41. package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Umbrella.hpp +67 -0
  42. package/nitrogen/generated/ios/NitroGeolocationAutolinking.mm +33 -0
  43. package/nitrogen/generated/ios/NitroGeolocationAutolinking.swift +25 -0
  44. package/nitrogen/generated/ios/c++/HybridNitroGeolocationSpecSwift.cpp +11 -0
  45. package/nitrogen/generated/ios/c++/HybridNitroGeolocationSpecSwift.hpp +125 -0
  46. package/nitrogen/generated/ios/swift/AuthorizationLevelInternal.swift +44 -0
  47. package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
  48. package/nitrogen/generated/ios/swift/Func_void_GeolocationError.swift +47 -0
  49. package/nitrogen/generated/ios/swift/Func_void_GeolocationResponse.swift +47 -0
  50. package/nitrogen/generated/ios/swift/GeolocationCoordinates.swift +149 -0
  51. package/nitrogen/generated/ios/swift/GeolocationError.swift +79 -0
  52. package/nitrogen/generated/ios/swift/GeolocationOptions.swift +185 -0
  53. package/nitrogen/generated/ios/swift/GeolocationResponse.swift +46 -0
  54. package/nitrogen/generated/ios/swift/HybridNitroGeolocationSpec.swift +54 -0
  55. package/nitrogen/generated/ios/swift/HybridNitroGeolocationSpec_cxx.swift +236 -0
  56. package/nitrogen/generated/ios/swift/LocationProviderInternal.swift +44 -0
  57. package/nitrogen/generated/ios/swift/RNConfigurationInternal.swift +104 -0
  58. package/nitrogen/generated/shared/c++/AuthorizationLevelInternal.hpp +80 -0
  59. package/nitrogen/generated/shared/c++/GeolocationCoordinates.hpp +91 -0
  60. package/nitrogen/generated/shared/c++/GeolocationError.hpp +83 -0
  61. package/nitrogen/generated/shared/c++/GeolocationOptions.hpp +91 -0
  62. package/nitrogen/generated/shared/c++/GeolocationResponse.hpp +72 -0
  63. package/nitrogen/generated/shared/c++/HybridNitroGeolocationSpec.cpp +26 -0
  64. package/nitrogen/generated/shared/c++/HybridNitroGeolocationSpec.hpp +79 -0
  65. package/nitrogen/generated/shared/c++/LocationProviderInternal.hpp +80 -0
  66. package/nitrogen/generated/shared/c++/RNConfigurationInternal.hpp +84 -0
  67. package/package.json +34 -10
  68. package/src/NitroGeolocation.nitro.ts +38 -3
  69. package/src/NitroGeolocationModule.ts +5 -0
  70. package/src/clearWatch.ts +13 -0
  71. package/src/getCurrentPosition.ts +14 -0
  72. package/src/index.tsx +32 -7
  73. package/src/requestAuthorization.ts +9 -0
  74. package/src/setRNConfiguration.ts +22 -0
  75. package/src/stopObserving.ts +12 -0
  76. package/src/types.ts +43 -0
  77. package/src/watchPosition.ts +26 -0
  78. package/nitro.json +0 -17
  79. package/turbo.json +0 -42
@@ -0,0 +1,69 @@
1
+ ///
2
+ /// HybridNitroGeolocationSpec.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <NitroModules/JHybridObject.hpp>
11
+ #include <fbjni/fbjni.h>
12
+ #include "HybridNitroGeolocationSpec.hpp"
13
+
14
+
15
+
16
+
17
+ namespace margelo::nitro::nitrogeolocation {
18
+
19
+ using namespace facebook;
20
+
21
+ class JHybridNitroGeolocationSpec: public jni::HybridClass<JHybridNitroGeolocationSpec, JHybridObject>,
22
+ public virtual HybridNitroGeolocationSpec {
23
+ public:
24
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrogeolocation/HybridNitroGeolocationSpec;";
25
+ static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
26
+ static void registerNatives();
27
+
28
+ protected:
29
+ // C++ constructor (called from Java via `initHybrid()`)
30
+ explicit JHybridNitroGeolocationSpec(jni::alias_ref<jhybridobject> jThis) :
31
+ HybridObject(HybridNitroGeolocationSpec::TAG),
32
+ HybridBase(jThis),
33
+ _javaPart(jni::make_global(jThis)) {}
34
+
35
+ public:
36
+ ~JHybridNitroGeolocationSpec() override {
37
+ // Hermes GC can destroy JS objects on a non-JNI Thread.
38
+ jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
39
+ }
40
+
41
+ public:
42
+ size_t getExternalMemorySize() noexcept override;
43
+ void dispose() noexcept override;
44
+
45
+ public:
46
+ inline const jni::global_ref<JHybridNitroGeolocationSpec::javaobject>& getJavaPart() const noexcept {
47
+ return _javaPart;
48
+ }
49
+
50
+ public:
51
+ // Properties
52
+
53
+
54
+ public:
55
+ // Methods
56
+ void setRNConfiguration(const RNConfigurationInternal& config) override;
57
+ void requestAuthorization(const std::optional<std::function<void()>>& success, const std::optional<std::function<void(const GeolocationError& /* error */)>>& error) override;
58
+ void getCurrentPosition(const std::function<void(const GeolocationResponse& /* position */)>& success, const std::optional<std::function<void(const GeolocationError& /* error */)>>& error, const std::optional<GeolocationOptions>& options) override;
59
+ double watchPosition(const std::function<void(const GeolocationResponse& /* position */)>& success, const std::optional<std::function<void(const GeolocationError& /* error */)>>& error, const std::optional<GeolocationOptions>& options) override;
60
+ void clearWatch(double watchId) override;
61
+ void stopObserving() override;
62
+
63
+ private:
64
+ friend HybridBase;
65
+ using HybridBase::HybridBase;
66
+ jni::global_ref<JHybridNitroGeolocationSpec::javaobject> _javaPart;
67
+ };
68
+
69
+ } // namespace margelo::nitro::nitrogeolocation
@@ -0,0 +1,62 @@
1
+ ///
2
+ /// JLocationProviderInternal.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <fbjni/fbjni.h>
11
+ #include "LocationProviderInternal.hpp"
12
+
13
+ namespace margelo::nitro::nitrogeolocation {
14
+
15
+ using namespace facebook;
16
+
17
+ /**
18
+ * The C++ JNI bridge between the C++ enum "LocationProviderInternal" and the the Kotlin enum "LocationProviderInternal".
19
+ */
20
+ struct JLocationProviderInternal final: public jni::JavaClass<JLocationProviderInternal> {
21
+ public:
22
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrogeolocation/LocationProviderInternal;";
23
+
24
+ public:
25
+ /**
26
+ * Convert this Java/Kotlin-based enum to the C++ enum LocationProviderInternal.
27
+ */
28
+ [[maybe_unused]]
29
+ [[nodiscard]]
30
+ LocationProviderInternal toCpp() const {
31
+ static const auto clazz = javaClassStatic();
32
+ static const auto fieldOrdinal = clazz->getField<int>("value");
33
+ int ordinal = this->getFieldValue(fieldOrdinal);
34
+ return static_cast<LocationProviderInternal>(ordinal);
35
+ }
36
+
37
+ public:
38
+ /**
39
+ * Create a Java/Kotlin-based enum with the given C++ enum's value.
40
+ */
41
+ [[maybe_unused]]
42
+ static jni::alias_ref<JLocationProviderInternal> fromCpp(LocationProviderInternal value) {
43
+ static const auto clazz = javaClassStatic();
44
+ static const auto fieldAUTO = clazz->getStaticField<JLocationProviderInternal>("AUTO");
45
+ static const auto fieldPLAYSERVICES = clazz->getStaticField<JLocationProviderInternal>("PLAYSERVICES");
46
+ static const auto fieldANDROID_PLATFORM = clazz->getStaticField<JLocationProviderInternal>("ANDROID_PLATFORM");
47
+
48
+ switch (value) {
49
+ case LocationProviderInternal::AUTO:
50
+ return clazz->getStaticFieldValue(fieldAUTO);
51
+ case LocationProviderInternal::PLAYSERVICES:
52
+ return clazz->getStaticFieldValue(fieldPLAYSERVICES);
53
+ case LocationProviderInternal::ANDROID_PLATFORM:
54
+ return clazz->getStaticFieldValue(fieldANDROID_PLATFORM);
55
+ default:
56
+ std::string stringValue = std::to_string(static_cast<int>(value));
57
+ throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
58
+ }
59
+ }
60
+ };
61
+
62
+ } // namespace margelo::nitro::nitrogeolocation
@@ -0,0 +1,69 @@
1
+ ///
2
+ /// JRNConfigurationInternal.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <fbjni/fbjni.h>
11
+ #include "RNConfigurationInternal.hpp"
12
+
13
+ #include "AuthorizationLevelInternal.hpp"
14
+ #include "JAuthorizationLevelInternal.hpp"
15
+ #include "JLocationProviderInternal.hpp"
16
+ #include "LocationProviderInternal.hpp"
17
+ #include <optional>
18
+
19
+ namespace margelo::nitro::nitrogeolocation {
20
+
21
+ using namespace facebook;
22
+
23
+ /**
24
+ * The C++ JNI bridge between the C++ struct "RNConfigurationInternal" and the the Kotlin data class "RNConfigurationInternal".
25
+ */
26
+ struct JRNConfigurationInternal final: public jni::JavaClass<JRNConfigurationInternal> {
27
+ public:
28
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrogeolocation/RNConfigurationInternal;";
29
+
30
+ public:
31
+ /**
32
+ * Convert this Java/Kotlin-based struct to the C++ struct RNConfigurationInternal by copying all values to C++.
33
+ */
34
+ [[maybe_unused]]
35
+ [[nodiscard]]
36
+ RNConfigurationInternal toCpp() const {
37
+ static const auto clazz = javaClassStatic();
38
+ static const auto fieldSkipPermissionRequests = clazz->getField<jboolean>("skipPermissionRequests");
39
+ jboolean skipPermissionRequests = this->getFieldValue(fieldSkipPermissionRequests);
40
+ static const auto fieldAuthorizationLevel = clazz->getField<JAuthorizationLevelInternal>("authorizationLevel");
41
+ jni::local_ref<JAuthorizationLevelInternal> authorizationLevel = this->getFieldValue(fieldAuthorizationLevel);
42
+ static const auto fieldEnableBackgroundLocationUpdates = clazz->getField<jni::JBoolean>("enableBackgroundLocationUpdates");
43
+ jni::local_ref<jni::JBoolean> enableBackgroundLocationUpdates = this->getFieldValue(fieldEnableBackgroundLocationUpdates);
44
+ static const auto fieldLocationProvider = clazz->getField<JLocationProviderInternal>("locationProvider");
45
+ jni::local_ref<JLocationProviderInternal> locationProvider = this->getFieldValue(fieldLocationProvider);
46
+ return RNConfigurationInternal(
47
+ static_cast<bool>(skipPermissionRequests),
48
+ authorizationLevel != nullptr ? std::make_optional(authorizationLevel->toCpp()) : std::nullopt,
49
+ enableBackgroundLocationUpdates != nullptr ? std::make_optional(static_cast<bool>(enableBackgroundLocationUpdates->value())) : std::nullopt,
50
+ locationProvider != nullptr ? std::make_optional(locationProvider->toCpp()) : std::nullopt
51
+ );
52
+ }
53
+
54
+ public:
55
+ /**
56
+ * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
57
+ */
58
+ [[maybe_unused]]
59
+ static jni::local_ref<JRNConfigurationInternal::javaobject> fromCpp(const RNConfigurationInternal& value) {
60
+ return newInstance(
61
+ value.skipPermissionRequests,
62
+ value.authorizationLevel.has_value() ? JAuthorizationLevelInternal::fromCpp(value.authorizationLevel.value()) : nullptr,
63
+ value.enableBackgroundLocationUpdates.has_value() ? jni::JBoolean::valueOf(value.enableBackgroundLocationUpdates.value()) : nullptr,
64
+ value.locationProvider.has_value() ? JLocationProviderInternal::fromCpp(value.locationProvider.value()) : nullptr
65
+ );
66
+ }
67
+ };
68
+
69
+ } // namespace margelo::nitro::nitrogeolocation
@@ -0,0 +1,22 @@
1
+ ///
2
+ /// AuthorizationLevelInternal.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.nitrogeolocation
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+ /**
14
+ * Represents the JavaScript enum/union "AuthorizationLevelInternal".
15
+ */
16
+ @DoNotStrip
17
+ @Keep
18
+ enum class AuthorizationLevelInternal(@DoNotStrip @Keep val value: Int) {
19
+ ALWAYS(0),
20
+ WHENINUSE(1),
21
+ AUTO(2);
22
+ }
@@ -0,0 +1,81 @@
1
+ ///
2
+ /// Func_void.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.nitrogeolocation
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.*
14
+ import dalvik.annotation.optimization.FastNative
15
+
16
+
17
+ /**
18
+ * Represents the JavaScript callback `() => void`.
19
+ * This can be either implemented in C++ (in which case it might be a callback coming from JS),
20
+ * or in Kotlin/Java (in which case it is a native callback).
21
+ */
22
+ @DoNotStrip
23
+ @Keep
24
+ @Suppress("ClassName", "RedundantUnitReturnType")
25
+ fun interface Func_void: () -> Unit {
26
+ /**
27
+ * Call the given JS callback.
28
+ * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
29
+ */
30
+ @DoNotStrip
31
+ @Keep
32
+ override fun invoke(): Unit
33
+ }
34
+
35
+ /**
36
+ * Represents the JavaScript callback `() => void`.
37
+ * This is implemented in C++, via a `std::function<...>`.
38
+ * The callback might be coming from JS.
39
+ */
40
+ @DoNotStrip
41
+ @Keep
42
+ @Suppress(
43
+ "KotlinJniMissingFunction", "unused",
44
+ "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
45
+ "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
46
+ )
47
+ class Func_void_cxx: Func_void {
48
+ @DoNotStrip
49
+ @Keep
50
+ private val mHybridData: HybridData
51
+
52
+ @DoNotStrip
53
+ @Keep
54
+ private constructor(hybridData: HybridData) {
55
+ mHybridData = hybridData
56
+ }
57
+
58
+ @DoNotStrip
59
+ @Keep
60
+ override fun invoke(): Unit
61
+ = invoke_cxx()
62
+
63
+ @FastNative
64
+ private external fun invoke_cxx(): Unit
65
+ }
66
+
67
+ /**
68
+ * Represents the JavaScript callback `() => void`.
69
+ * This is implemented in Java/Kotlin, via a `() -> Unit`.
70
+ * The callback is always coming from native.
71
+ */
72
+ @DoNotStrip
73
+ @Keep
74
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
75
+ class Func_void_java(private val function: () -> Unit): Func_void {
76
+ @DoNotStrip
77
+ @Keep
78
+ override fun invoke(): Unit {
79
+ return this.function()
80
+ }
81
+ }
@@ -0,0 +1,81 @@
1
+ ///
2
+ /// Func_void_GeolocationError.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.nitrogeolocation
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.*
14
+ import dalvik.annotation.optimization.FastNative
15
+
16
+
17
+ /**
18
+ * Represents the JavaScript callback `(error: struct) => void`.
19
+ * This can be either implemented in C++ (in which case it might be a callback coming from JS),
20
+ * or in Kotlin/Java (in which case it is a native callback).
21
+ */
22
+ @DoNotStrip
23
+ @Keep
24
+ @Suppress("ClassName", "RedundantUnitReturnType")
25
+ fun interface Func_void_GeolocationError: (GeolocationError) -> Unit {
26
+ /**
27
+ * Call the given JS callback.
28
+ * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
29
+ */
30
+ @DoNotStrip
31
+ @Keep
32
+ override fun invoke(error: GeolocationError): Unit
33
+ }
34
+
35
+ /**
36
+ * Represents the JavaScript callback `(error: struct) => void`.
37
+ * This is implemented in C++, via a `std::function<...>`.
38
+ * The callback might be coming from JS.
39
+ */
40
+ @DoNotStrip
41
+ @Keep
42
+ @Suppress(
43
+ "KotlinJniMissingFunction", "unused",
44
+ "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
45
+ "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
46
+ )
47
+ class Func_void_GeolocationError_cxx: Func_void_GeolocationError {
48
+ @DoNotStrip
49
+ @Keep
50
+ private val mHybridData: HybridData
51
+
52
+ @DoNotStrip
53
+ @Keep
54
+ private constructor(hybridData: HybridData) {
55
+ mHybridData = hybridData
56
+ }
57
+
58
+ @DoNotStrip
59
+ @Keep
60
+ override fun invoke(error: GeolocationError): Unit
61
+ = invoke_cxx(error)
62
+
63
+ @FastNative
64
+ private external fun invoke_cxx(error: GeolocationError): Unit
65
+ }
66
+
67
+ /**
68
+ * Represents the JavaScript callback `(error: struct) => void`.
69
+ * This is implemented in Java/Kotlin, via a `(GeolocationError) -> Unit`.
70
+ * The callback is always coming from native.
71
+ */
72
+ @DoNotStrip
73
+ @Keep
74
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
75
+ class Func_void_GeolocationError_java(private val function: (GeolocationError) -> Unit): Func_void_GeolocationError {
76
+ @DoNotStrip
77
+ @Keep
78
+ override fun invoke(error: GeolocationError): Unit {
79
+ return this.function(error)
80
+ }
81
+ }
@@ -0,0 +1,81 @@
1
+ ///
2
+ /// Func_void_GeolocationResponse.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.nitrogeolocation
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.*
14
+ import dalvik.annotation.optimization.FastNative
15
+
16
+
17
+ /**
18
+ * Represents the JavaScript callback `(position: struct) => void`.
19
+ * This can be either implemented in C++ (in which case it might be a callback coming from JS),
20
+ * or in Kotlin/Java (in which case it is a native callback).
21
+ */
22
+ @DoNotStrip
23
+ @Keep
24
+ @Suppress("ClassName", "RedundantUnitReturnType")
25
+ fun interface Func_void_GeolocationResponse: (GeolocationResponse) -> Unit {
26
+ /**
27
+ * Call the given JS callback.
28
+ * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
29
+ */
30
+ @DoNotStrip
31
+ @Keep
32
+ override fun invoke(position: GeolocationResponse): Unit
33
+ }
34
+
35
+ /**
36
+ * Represents the JavaScript callback `(position: struct) => void`.
37
+ * This is implemented in C++, via a `std::function<...>`.
38
+ * The callback might be coming from JS.
39
+ */
40
+ @DoNotStrip
41
+ @Keep
42
+ @Suppress(
43
+ "KotlinJniMissingFunction", "unused",
44
+ "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
45
+ "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
46
+ )
47
+ class Func_void_GeolocationResponse_cxx: Func_void_GeolocationResponse {
48
+ @DoNotStrip
49
+ @Keep
50
+ private val mHybridData: HybridData
51
+
52
+ @DoNotStrip
53
+ @Keep
54
+ private constructor(hybridData: HybridData) {
55
+ mHybridData = hybridData
56
+ }
57
+
58
+ @DoNotStrip
59
+ @Keep
60
+ override fun invoke(position: GeolocationResponse): Unit
61
+ = invoke_cxx(position)
62
+
63
+ @FastNative
64
+ private external fun invoke_cxx(position: GeolocationResponse): Unit
65
+ }
66
+
67
+ /**
68
+ * Represents the JavaScript callback `(position: struct) => void`.
69
+ * This is implemented in Java/Kotlin, via a `(GeolocationResponse) -> Unit`.
70
+ * The callback is always coming from native.
71
+ */
72
+ @DoNotStrip
73
+ @Keep
74
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
75
+ class Func_void_GeolocationResponse_java(private val function: (GeolocationResponse) -> Unit): Func_void_GeolocationResponse {
76
+ @DoNotStrip
77
+ @Keep
78
+ override fun invoke(position: GeolocationResponse): Unit {
79
+ return this.function(position)
80
+ }
81
+ }
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// GeolocationCoordinates.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.nitrogeolocation
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import com.margelo.nitro.core.*
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "GeolocationCoordinates".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class GeolocationCoordinates
21
+ @DoNotStrip
22
+ @Keep
23
+ constructor(
24
+ @DoNotStrip
25
+ @Keep
26
+ val latitude: Double,
27
+ @DoNotStrip
28
+ @Keep
29
+ val longitude: Double,
30
+ @DoNotStrip
31
+ @Keep
32
+ val altitude: Double?,
33
+ @DoNotStrip
34
+ @Keep
35
+ val accuracy: Double,
36
+ @DoNotStrip
37
+ @Keep
38
+ val altitudeAccuracy: Double?,
39
+ @DoNotStrip
40
+ @Keep
41
+ val heading: Double?,
42
+ @DoNotStrip
43
+ @Keep
44
+ val speed: Double?
45
+ ) {
46
+ /* main constructor */
47
+ }
@@ -0,0 +1,41 @@
1
+ ///
2
+ /// GeolocationError.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.nitrogeolocation
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import com.margelo.nitro.core.*
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "GeolocationError".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class GeolocationError
21
+ @DoNotStrip
22
+ @Keep
23
+ constructor(
24
+ @DoNotStrip
25
+ @Keep
26
+ val code: Double,
27
+ @DoNotStrip
28
+ @Keep
29
+ val message: String,
30
+ @DoNotStrip
31
+ @Keep
32
+ val PERMISSION_DENIED: Double,
33
+ @DoNotStrip
34
+ @Keep
35
+ val POSITION_UNAVAILABLE: Double,
36
+ @DoNotStrip
37
+ @Keep
38
+ val TIMEOUT: Double
39
+ ) {
40
+ /* main constructor */
41
+ }
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// GeolocationOptions.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.nitrogeolocation
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import com.margelo.nitro.core.*
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "GeolocationOptions".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class GeolocationOptions
21
+ @DoNotStrip
22
+ @Keep
23
+ constructor(
24
+ @DoNotStrip
25
+ @Keep
26
+ val timeout: Double?,
27
+ @DoNotStrip
28
+ @Keep
29
+ val maximumAge: Double?,
30
+ @DoNotStrip
31
+ @Keep
32
+ val enableHighAccuracy: Boolean?,
33
+ @DoNotStrip
34
+ @Keep
35
+ val interval: Double?,
36
+ @DoNotStrip
37
+ @Keep
38
+ val fastestInterval: Double?,
39
+ @DoNotStrip
40
+ @Keep
41
+ val distanceFilter: Double?,
42
+ @DoNotStrip
43
+ @Keep
44
+ val useSignificantChanges: Boolean?
45
+ ) {
46
+ /* main constructor */
47
+ }
@@ -0,0 +1,32 @@
1
+ ///
2
+ /// GeolocationResponse.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.nitrogeolocation
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import com.margelo.nitro.core.*
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "GeolocationResponse".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class GeolocationResponse
21
+ @DoNotStrip
22
+ @Keep
23
+ constructor(
24
+ @DoNotStrip
25
+ @Keep
26
+ val coords: GeolocationCoordinates,
27
+ @DoNotStrip
28
+ @Keep
29
+ val timestamp: Double
30
+ ) {
31
+ /* main constructor */
32
+ }