@inoxialabs/react-native-nitro-location-geocoder 0.1.0 → 1.0.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/NitroLocationGeocoder.podspec +28 -28
- package/README.md +118 -78
- package/android/CMakeLists.txt +25 -25
- package/android/build.gradle +129 -129
- package/android/fix-prefab.gradle +44 -44
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +2 -2
- package/android/src/main/cpp/cpp-adapter.cpp +6 -6
- package/android/src/main/java/com/margelo/nitro/locationgeocoder/HybridLocationGeocoder.kt +85 -57
- package/android/src/main/java/com/margelo/nitro/locationgeocoder/NitroLocationGeocoderPackage.kt +18 -18
- package/ios/Bridge.h +1 -1
- package/ios/HybridLocationGeocoder.swift +62 -19
- package/nitro.json +24 -24
- package/nitrogen/generated/.gitattributes +1 -1
- package/nitrogen/generated/android/NitroLocationGeocoder+autolinking.cmake +81 -81
- package/nitrogen/generated/android/NitroLocationGeocoder+autolinking.gradle +27 -27
- package/nitrogen/generated/android/NitroLocationGeocoderOnLoad.cpp +54 -54
- package/nitrogen/generated/android/NitroLocationGeocoderOnLoad.hpp +34 -34
- package/nitrogen/generated/android/c++/JHybridLocationGeocoderSpec.cpp +69 -69
- package/nitrogen/generated/android/c++/JHybridLocationGeocoderSpec.hpp +63 -63
- package/nitrogen/generated/android/c++/JLocationGeocoderResult.hpp +77 -77
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/locationgeocoder/HybridLocationGeocoderSpec.kt +55 -55
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/locationgeocoder/LocationGeocoderResult.kt +53 -53
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/locationgeocoder/NitroLocationGeocoderOnLoad.kt +35 -35
- package/nitrogen/generated/ios/NitroLocationGeocoder+autolinking.rb +60 -60
- package/nitrogen/generated/ios/NitroLocationGeocoder-Swift-Cxx-Bridge.cpp +49 -49
- package/nitrogen/generated/ios/NitroLocationGeocoder-Swift-Cxx-Bridge.hpp +114 -114
- package/nitrogen/generated/ios/NitroLocationGeocoder-Swift-Cxx-Umbrella.hpp +48 -48
- package/nitrogen/generated/ios/NitroLocationGeocoderAutolinking.mm +33 -33
- package/nitrogen/generated/ios/NitroLocationGeocoderAutolinking.swift +26 -26
- package/nitrogen/generated/ios/c++/HybridLocationGeocoderSpecSwift.cpp +11 -11
- package/nitrogen/generated/ios/c++/HybridLocationGeocoderSpecSwift.hpp +85 -85
- package/nitrogen/generated/ios/swift/Func_void_LocationGeocoderResult.swift +46 -46
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -46
- package/nitrogen/generated/ios/swift/HybridLocationGeocoderSpec.swift +55 -55
- package/nitrogen/generated/ios/swift/HybridLocationGeocoderSpec_cxx.swift +145 -145
- package/nitrogen/generated/ios/swift/LocationGeocoderResult.swift +54 -54
- package/nitrogen/generated/shared/c++/HybridLocationGeocoderSpec.cpp +21 -21
- package/nitrogen/generated/shared/c++/HybridLocationGeocoderSpec.hpp +65 -65
- package/nitrogen/generated/shared/c++/LocationGeocoderResult.hpp +103 -103
- package/package.json +65 -65
- package/react-native.config.js +8 -8
- package/src/index.ts +39 -7
- package/src/specs/LocationGeocoder.nitro.ts +14 -14
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#include <jni.h>
|
|
2
|
-
#include "NitroLocationGeocoderOnLoad.hpp"
|
|
3
|
-
|
|
4
|
-
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
5
|
-
return margelo::nitro::locationgeocoder::initialize(vm);
|
|
6
|
-
}
|
|
1
|
+
#include <jni.h>
|
|
2
|
+
#include "NitroLocationGeocoderOnLoad.hpp"
|
|
3
|
+
|
|
4
|
+
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
5
|
+
return margelo::nitro::locationgeocoder::initialize(vm);
|
|
6
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
package com.margelo.nitro.locationgeocoder
|
|
2
|
-
|
|
1
|
+
package com.margelo.nitro.locationgeocoder
|
|
2
|
+
|
|
3
3
|
import android.location.Address
|
|
4
4
|
import android.location.Geocoder
|
|
5
5
|
import android.os.Build
|
|
@@ -7,26 +7,41 @@ import androidx.annotation.RequiresApi
|
|
|
7
7
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
8
8
|
import com.margelo.nitro.NitroModules
|
|
9
9
|
import com.margelo.nitro.core.Promise
|
|
10
|
+
import java.io.IOException
|
|
10
11
|
import java.util.Locale
|
|
11
12
|
import java.util.concurrent.CountDownLatch
|
|
12
13
|
import java.util.concurrent.TimeUnit
|
|
13
14
|
import java.util.concurrent.atomic.AtomicReference
|
|
14
15
|
|
|
15
|
-
@DoNotStrip
|
|
16
|
-
class HybridLocationGeocoder : HybridLocationGeocoderSpec() {
|
|
17
|
-
|
|
18
|
-
private val context
|
|
19
|
-
get() = NitroModules.applicationContext
|
|
20
|
-
?: throw RuntimeException("Application context not available")
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
class HybridLocationGeocoder : HybridLocationGeocoderSpec() {
|
|
18
|
+
|
|
19
|
+
private val context
|
|
20
|
+
get() = NitroModules.applicationContext
|
|
21
|
+
?: throw RuntimeException("Application context not available")
|
|
22
|
+
|
|
23
|
+
private fun getLocale(locale: String): Locale {
|
|
24
|
+
val normalized = locale.trim()
|
|
25
|
+
if (normalized.isEmpty()) return Locale.getDefault()
|
|
26
|
+
return Locale.forLanguageTag(normalized)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
private fun createGeocoder(locale: String): Geocoder {
|
|
30
|
+
return Geocoder(context, getLocale(locale))
|
|
31
|
+
}
|
|
21
32
|
|
|
22
|
-
private fun
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
private fun isValidCoordinate(latitude: Double, longitude: Double): Boolean {
|
|
34
|
+
return latitude.isFinite() &&
|
|
35
|
+
longitude.isFinite() &&
|
|
36
|
+
latitude >= -90.0 &&
|
|
37
|
+
latitude <= 90.0 &&
|
|
38
|
+
longitude >= -180.0 &&
|
|
39
|
+
longitude <= 180.0
|
|
26
40
|
}
|
|
27
41
|
|
|
28
|
-
private fun
|
|
29
|
-
|
|
42
|
+
private fun geocoderFailed(message: String?): Exception {
|
|
43
|
+
val normalized = message?.trim()?.takeIf { it.isNotEmpty() }
|
|
44
|
+
return Exception(if (normalized == null) "GEOCODER_FAILED" else "GEOCODER_FAILED: $normalized")
|
|
30
45
|
}
|
|
31
46
|
|
|
32
47
|
override fun reverseGeocode(
|
|
@@ -35,61 +50,74 @@ class HybridLocationGeocoder : HybridLocationGeocoderSpec() {
|
|
|
35
50
|
locale: String
|
|
36
51
|
): Promise<LocationGeocoderResult> {
|
|
37
52
|
return Promise.async {
|
|
53
|
+
if (!isValidCoordinate(latitude, longitude)) {
|
|
54
|
+
throw Exception("INVALID_COORDINATES")
|
|
55
|
+
}
|
|
56
|
+
|
|
38
57
|
if (!Geocoder.isPresent()) {
|
|
39
58
|
throw Exception("UNAVAILABLE")
|
|
40
59
|
}
|
|
41
60
|
|
|
42
|
-
val address =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
61
|
+
val address = try {
|
|
62
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
63
|
+
reverseGeocodeApi33(latitude, longitude, locale)
|
|
64
|
+
} else {
|
|
65
|
+
reverseGeocodeLegacy(latitude, longitude, locale)
|
|
66
|
+
}
|
|
67
|
+
} catch (error: IllegalArgumentException) {
|
|
68
|
+
throw Exception("INVALID_COORDINATES")
|
|
69
|
+
} catch (error: IOException) {
|
|
70
|
+
throw geocoderFailed(error.message)
|
|
71
|
+
} catch (error: InterruptedException) {
|
|
72
|
+
Thread.currentThread().interrupt()
|
|
73
|
+
throw geocoderFailed(error.message)
|
|
46
74
|
} ?: throw Exception("NO_RESULTS")
|
|
47
75
|
|
|
48
76
|
mapAddress(address)
|
|
49
77
|
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
|
|
53
|
-
private fun reverseGeocodeApi33(latitude: Double, longitude: Double, locale: String): Address? {
|
|
54
|
-
val geocoder = createGeocoder(locale)
|
|
55
|
-
val resultRef = AtomicReference<Address?>()
|
|
56
|
-
val errorRef = AtomicReference<Exception?>()
|
|
57
|
-
val latch = CountDownLatch(1)
|
|
58
|
-
|
|
59
|
-
geocoder.getFromLocation(latitude, longitude, 1, object : Geocoder.GeocodeListener {
|
|
60
|
-
override fun onGeocode(addresses: MutableList<Address>) {
|
|
61
|
-
resultRef.set(addresses.firstOrNull())
|
|
62
|
-
latch.countDown()
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
|
|
81
|
+
private fun reverseGeocodeApi33(latitude: Double, longitude: Double, locale: String): Address? {
|
|
82
|
+
val geocoder = createGeocoder(locale)
|
|
83
|
+
val resultRef = AtomicReference<Address?>()
|
|
84
|
+
val errorRef = AtomicReference<Exception?>()
|
|
85
|
+
val latch = CountDownLatch(1)
|
|
86
|
+
|
|
87
|
+
geocoder.getFromLocation(latitude, longitude, 1, object : Geocoder.GeocodeListener {
|
|
88
|
+
override fun onGeocode(addresses: MutableList<Address>) {
|
|
89
|
+
resultRef.set(addresses.firstOrNull())
|
|
90
|
+
latch.countDown()
|
|
63
91
|
}
|
|
64
92
|
|
|
65
93
|
override fun onError(errorMessage: String?) {
|
|
66
|
-
errorRef.set(
|
|
94
|
+
errorRef.set(geocoderFailed(errorMessage))
|
|
67
95
|
latch.countDown()
|
|
68
96
|
}
|
|
69
97
|
})
|
|
70
98
|
|
|
71
|
-
val completed = latch.await(
|
|
72
|
-
if (!completed) {
|
|
73
|
-
throw Exception("GEOCODER_TIMEOUT")
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
errorRef.get()?.let { throw it }
|
|
77
|
-
return resultRef.get()
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
@Suppress("DEPRECATION")
|
|
81
|
-
private fun reverseGeocodeLegacy(latitude: Double, longitude: Double, locale: String): Address? {
|
|
82
|
-
return createGeocoder(locale).getFromLocation(latitude, longitude, 1)?.firstOrNull()
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
private fun mapAddress(address: Address): LocationGeocoderResult {
|
|
86
|
-
return LocationGeocoderResult(
|
|
87
|
-
countryCode = address.countryCode ?: "",
|
|
88
|
-
country = address.countryName ?: "",
|
|
89
|
-
locality = address.locality ?: "",
|
|
90
|
-
administrativeArea = address.adminArea ?: "",
|
|
91
|
-
subAdministrativeArea = address.subAdminArea ?: "",
|
|
92
|
-
subLocality = address.subLocality ?: ""
|
|
93
|
-
)
|
|
94
|
-
}
|
|
95
|
-
}
|
|
99
|
+
val completed = latch.await(10, TimeUnit.SECONDS)
|
|
100
|
+
if (!completed) {
|
|
101
|
+
throw Exception("GEOCODER_TIMEOUT")
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
errorRef.get()?.let { throw it }
|
|
105
|
+
return resultRef.get()
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@Suppress("DEPRECATION")
|
|
109
|
+
private fun reverseGeocodeLegacy(latitude: Double, longitude: Double, locale: String): Address? {
|
|
110
|
+
return createGeocoder(locale).getFromLocation(latitude, longitude, 1)?.firstOrNull()
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private fun mapAddress(address: Address): LocationGeocoderResult {
|
|
114
|
+
return LocationGeocoderResult(
|
|
115
|
+
countryCode = address.countryCode ?: "",
|
|
116
|
+
country = address.countryName ?: "",
|
|
117
|
+
locality = address.locality ?: "",
|
|
118
|
+
administrativeArea = address.adminArea ?: "",
|
|
119
|
+
subAdministrativeArea = address.subAdminArea ?: "",
|
|
120
|
+
subLocality = address.subLocality ?: ""
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
}
|
package/android/src/main/java/com/margelo/nitro/locationgeocoder/NitroLocationGeocoderPackage.kt
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
package com.margelo.nitro.locationgeocoder
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.BaseReactPackage
|
|
4
|
-
import com.facebook.react.bridge.NativeModule
|
|
5
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
-
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
7
|
-
|
|
8
|
-
class NitroLocationGeocoderPackage : BaseReactPackage() {
|
|
9
|
-
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? = null
|
|
10
|
-
|
|
11
|
-
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider = ReactModuleInfoProvider { HashMap() }
|
|
12
|
-
|
|
13
|
-
companion object {
|
|
14
|
-
init {
|
|
15
|
-
NitroLocationGeocoderOnLoad.initializeNative()
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
1
|
+
package com.margelo.nitro.locationgeocoder
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.BaseReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
7
|
+
|
|
8
|
+
class NitroLocationGeocoderPackage : BaseReactPackage() {
|
|
9
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? = null
|
|
10
|
+
|
|
11
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider = ReactModuleInfoProvider { HashMap() }
|
|
12
|
+
|
|
13
|
+
companion object {
|
|
14
|
+
init {
|
|
15
|
+
NitroLocationGeocoderOnLoad.initializeNative()
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
package/ios/Bridge.h
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
#pragma once
|
|
1
|
+
#pragma once
|
|
@@ -1,49 +1,92 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
import CoreLocation
|
|
3
|
-
import NitroModules
|
|
4
|
-
|
|
1
|
+
import Foundation
|
|
2
|
+
import CoreLocation
|
|
3
|
+
import NitroModules
|
|
4
|
+
|
|
5
5
|
class HybridLocationGeocoder: HybridLocationGeocoderSpec {
|
|
6
6
|
|
|
7
|
-
private let
|
|
7
|
+
private let timeoutSeconds: TimeInterval = 10
|
|
8
8
|
|
|
9
9
|
private func preferredLocale(_ locale: String) -> Locale? {
|
|
10
10
|
let normalized = locale.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
11
|
-
if normalized.isEmpty {
|
|
12
|
-
return nil
|
|
13
|
-
}
|
|
11
|
+
if normalized.isEmpty {
|
|
12
|
+
return nil
|
|
13
|
+
}
|
|
14
14
|
return Locale(identifier: normalized)
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
private func isValidCoordinate(latitude: Double, longitude: Double) -> Bool {
|
|
18
|
+
latitude.isFinite &&
|
|
19
|
+
longitude.isFinite &&
|
|
20
|
+
latitude >= -90 &&
|
|
21
|
+
latitude <= 90 &&
|
|
22
|
+
longitude >= -180 &&
|
|
23
|
+
longitude <= 180
|
|
24
|
+
}
|
|
25
|
+
|
|
17
26
|
func reverseGeocode(latitude: Double, longitude: Double, locale: String) throws -> Promise<LocationGeocoderResult> {
|
|
18
27
|
let promise = Promise<LocationGeocoderResult>()
|
|
19
28
|
|
|
20
|
-
|
|
29
|
+
guard isValidCoordinate(latitude: latitude, longitude: longitude) else {
|
|
30
|
+
promise.reject(withError: RuntimeError.error(withMessage: "INVALID_COORDINATES"))
|
|
31
|
+
return promise
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let geocoder = CLGeocoder()
|
|
35
|
+
var didComplete = false
|
|
36
|
+
var timeoutWorkItem: DispatchWorkItem?
|
|
37
|
+
|
|
38
|
+
func reject(_ message: String) {
|
|
39
|
+
if didComplete {
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
didComplete = true
|
|
43
|
+
timeoutWorkItem?.cancel()
|
|
44
|
+
promise.reject(withError: RuntimeError.error(withMessage: message))
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
func resolve(_ result: LocationGeocoderResult) {
|
|
48
|
+
if didComplete {
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
didComplete = true
|
|
52
|
+
timeoutWorkItem?.cancel()
|
|
53
|
+
promise.resolve(withResult: result)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
timeoutWorkItem = DispatchWorkItem {
|
|
57
|
+
reject("GEOCODER_TIMEOUT")
|
|
21
58
|
geocoder.cancelGeocode()
|
|
22
59
|
}
|
|
60
|
+
if let timeoutWorkItem = timeoutWorkItem {
|
|
61
|
+
DispatchQueue.main.asyncAfter(
|
|
62
|
+
deadline: .now() + .milliseconds(Int(timeoutSeconds * 1000)),
|
|
63
|
+
execute: timeoutWorkItem
|
|
64
|
+
)
|
|
65
|
+
}
|
|
23
66
|
|
|
24
67
|
let location = CLLocation(latitude: latitude, longitude: longitude)
|
|
25
68
|
geocoder.reverseGeocodeLocation(location, preferredLocale: preferredLocale(locale)) { placemarks, error in
|
|
26
69
|
if let error = error {
|
|
27
|
-
|
|
70
|
+
reject("GEOCODER_FAILED: \(error.localizedDescription)")
|
|
28
71
|
return
|
|
29
72
|
}
|
|
30
73
|
|
|
31
74
|
guard let placemark = placemarks?.first else {
|
|
32
|
-
|
|
75
|
+
reject("NO_RESULTS")
|
|
33
76
|
return
|
|
34
77
|
}
|
|
35
78
|
|
|
36
|
-
let result = LocationGeocoderResult(
|
|
37
|
-
countryCode: placemark.isoCountryCode ?? "",
|
|
38
|
-
country: placemark.country ?? "",
|
|
39
|
-
locality: placemark.locality ?? "",
|
|
40
|
-
administrativeArea: placemark.administrativeArea ?? "",
|
|
79
|
+
let result = LocationGeocoderResult(
|
|
80
|
+
countryCode: placemark.isoCountryCode ?? "",
|
|
81
|
+
country: placemark.country ?? "",
|
|
82
|
+
locality: placemark.locality ?? "",
|
|
83
|
+
administrativeArea: placemark.administrativeArea ?? "",
|
|
41
84
|
subAdministrativeArea: placemark.subAdministrativeArea ?? "",
|
|
42
85
|
subLocality: placemark.subLocality ?? ""
|
|
43
86
|
)
|
|
44
|
-
|
|
87
|
+
resolve(result)
|
|
45
88
|
}
|
|
46
89
|
|
|
47
90
|
return promise
|
|
48
|
-
}
|
|
49
|
-
}
|
|
91
|
+
}
|
|
92
|
+
}
|
package/nitro.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://nitro.margelo.com/nitro.schema.json",
|
|
3
|
-
"cxxNamespace": [
|
|
4
|
-
"locationgeocoder"
|
|
5
|
-
],
|
|
6
|
-
"ios": {
|
|
7
|
-
"iosModuleName": "NitroLocationGeocoder"
|
|
8
|
-
},
|
|
9
|
-
"android": {
|
|
10
|
-
"androidNamespace": [
|
|
11
|
-
"locationgeocoder"
|
|
12
|
-
],
|
|
13
|
-
"androidCxxLibName": "NitroLocationGeocoder"
|
|
14
|
-
},
|
|
15
|
-
"autolinking": {
|
|
16
|
-
"LocationGeocoder": {
|
|
17
|
-
"swift": "HybridLocationGeocoder",
|
|
18
|
-
"kotlin": "HybridLocationGeocoder"
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
"ignorePaths": [
|
|
22
|
-
"**/node_modules"
|
|
23
|
-
]
|
|
24
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://nitro.margelo.com/nitro.schema.json",
|
|
3
|
+
"cxxNamespace": [
|
|
4
|
+
"locationgeocoder"
|
|
5
|
+
],
|
|
6
|
+
"ios": {
|
|
7
|
+
"iosModuleName": "NitroLocationGeocoder"
|
|
8
|
+
},
|
|
9
|
+
"android": {
|
|
10
|
+
"androidNamespace": [
|
|
11
|
+
"locationgeocoder"
|
|
12
|
+
],
|
|
13
|
+
"androidCxxLibName": "NitroLocationGeocoder"
|
|
14
|
+
},
|
|
15
|
+
"autolinking": {
|
|
16
|
+
"LocationGeocoder": {
|
|
17
|
+
"swift": "HybridLocationGeocoder",
|
|
18
|
+
"kotlin": "HybridLocationGeocoder"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"ignorePaths": [
|
|
22
|
+
"**/node_modules"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
** linguist-generated=true
|
|
1
|
+
** linguist-generated=true
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
#
|
|
2
|
-
# NitroLocationGeocoder+autolinking.cmake
|
|
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
|
-
# This is a CMake file that adds all files generated by Nitrogen
|
|
9
|
-
# to the current CMake project.
|
|
10
|
-
#
|
|
11
|
-
# To use it, add this to your CMakeLists.txt:
|
|
12
|
-
# ```cmake
|
|
13
|
-
# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/NitroLocationGeocoder+autolinking.cmake)
|
|
14
|
-
# ```
|
|
15
|
-
|
|
16
|
-
# Define a flag to check if we are building properly
|
|
17
|
-
add_definitions(-DBUILDING_NITROLOCATIONGEOCODER_WITH_GENERATED_CMAKE_PROJECT)
|
|
18
|
-
|
|
19
|
-
# Enable Raw Props parsing in react-native (for Nitro Views)
|
|
20
|
-
add_definitions(-DRN_SERIALIZABLE_STATE)
|
|
21
|
-
|
|
22
|
-
# Add all headers that were generated by Nitrogen
|
|
23
|
-
include_directories(
|
|
24
|
-
"../nitrogen/generated/shared/c++"
|
|
25
|
-
"../nitrogen/generated/android/c++"
|
|
26
|
-
"../nitrogen/generated/android/"
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
# Add all .cpp sources that were generated by Nitrogen
|
|
30
|
-
target_sources(
|
|
31
|
-
# CMake project name (Android C++ library name)
|
|
32
|
-
NitroLocationGeocoder PRIVATE
|
|
33
|
-
# Autolinking Setup
|
|
34
|
-
../nitrogen/generated/android/NitroLocationGeocoderOnLoad.cpp
|
|
35
|
-
# Shared Nitrogen C++ sources
|
|
36
|
-
../nitrogen/generated/shared/c++/HybridLocationGeocoderSpec.cpp
|
|
37
|
-
# Android-specific Nitrogen C++ sources
|
|
38
|
-
../nitrogen/generated/android/c++/JHybridLocationGeocoderSpec.cpp
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
42
|
-
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
|
|
43
|
-
target_compile_definitions(
|
|
44
|
-
NitroLocationGeocoder PRIVATE
|
|
45
|
-
-DFOLLY_NO_CONFIG=1
|
|
46
|
-
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
|
47
|
-
-DFOLLY_USE_LIBCPP=1
|
|
48
|
-
-DFOLLY_CFG_NO_COROUTINES=1
|
|
49
|
-
-DFOLLY_MOBILE=1
|
|
50
|
-
-DFOLLY_HAVE_RECVMMSG=1
|
|
51
|
-
-DFOLLY_HAVE_PTHREAD=1
|
|
52
|
-
# Once we target android-23 above, we can comment
|
|
53
|
-
# the following line. NDK uses GNU style stderror_r() after API 23.
|
|
54
|
-
-DFOLLY_HAVE_XSI_STRERROR_R=1
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
# Add all libraries required by the generated specs
|
|
58
|
-
find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
|
|
59
|
-
find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
|
|
60
|
-
find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
|
|
61
|
-
|
|
62
|
-
# Link all libraries together
|
|
63
|
-
target_link_libraries(
|
|
64
|
-
NitroLocationGeocoder
|
|
65
|
-
fbjni::fbjni # <-- Facebook C++ JNI helpers
|
|
66
|
-
ReactAndroid::jsi # <-- RN: JSI
|
|
67
|
-
react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
# Link react-native (different prefab between RN 0.75 and RN 0.76)
|
|
71
|
-
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
|
|
72
|
-
target_link_libraries(
|
|
73
|
-
NitroLocationGeocoder
|
|
74
|
-
ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
|
|
75
|
-
)
|
|
76
|
-
else()
|
|
77
|
-
target_link_libraries(
|
|
78
|
-
NitroLocationGeocoder
|
|
79
|
-
ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
|
|
80
|
-
)
|
|
81
|
-
endif()
|
|
1
|
+
#
|
|
2
|
+
# NitroLocationGeocoder+autolinking.cmake
|
|
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
|
+
# This is a CMake file that adds all files generated by Nitrogen
|
|
9
|
+
# to the current CMake project.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your CMakeLists.txt:
|
|
12
|
+
# ```cmake
|
|
13
|
+
# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/NitroLocationGeocoder+autolinking.cmake)
|
|
14
|
+
# ```
|
|
15
|
+
|
|
16
|
+
# Define a flag to check if we are building properly
|
|
17
|
+
add_definitions(-DBUILDING_NITROLOCATIONGEOCODER_WITH_GENERATED_CMAKE_PROJECT)
|
|
18
|
+
|
|
19
|
+
# Enable Raw Props parsing in react-native (for Nitro Views)
|
|
20
|
+
add_definitions(-DRN_SERIALIZABLE_STATE)
|
|
21
|
+
|
|
22
|
+
# Add all headers that were generated by Nitrogen
|
|
23
|
+
include_directories(
|
|
24
|
+
"../nitrogen/generated/shared/c++"
|
|
25
|
+
"../nitrogen/generated/android/c++"
|
|
26
|
+
"../nitrogen/generated/android/"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# Add all .cpp sources that were generated by Nitrogen
|
|
30
|
+
target_sources(
|
|
31
|
+
# CMake project name (Android C++ library name)
|
|
32
|
+
NitroLocationGeocoder PRIVATE
|
|
33
|
+
# Autolinking Setup
|
|
34
|
+
../nitrogen/generated/android/NitroLocationGeocoderOnLoad.cpp
|
|
35
|
+
# Shared Nitrogen C++ sources
|
|
36
|
+
../nitrogen/generated/shared/c++/HybridLocationGeocoderSpec.cpp
|
|
37
|
+
# Android-specific Nitrogen C++ sources
|
|
38
|
+
../nitrogen/generated/android/c++/JHybridLocationGeocoderSpec.cpp
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
42
|
+
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
|
|
43
|
+
target_compile_definitions(
|
|
44
|
+
NitroLocationGeocoder PRIVATE
|
|
45
|
+
-DFOLLY_NO_CONFIG=1
|
|
46
|
+
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
|
47
|
+
-DFOLLY_USE_LIBCPP=1
|
|
48
|
+
-DFOLLY_CFG_NO_COROUTINES=1
|
|
49
|
+
-DFOLLY_MOBILE=1
|
|
50
|
+
-DFOLLY_HAVE_RECVMMSG=1
|
|
51
|
+
-DFOLLY_HAVE_PTHREAD=1
|
|
52
|
+
# Once we target android-23 above, we can comment
|
|
53
|
+
# the following line. NDK uses GNU style stderror_r() after API 23.
|
|
54
|
+
-DFOLLY_HAVE_XSI_STRERROR_R=1
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
# Add all libraries required by the generated specs
|
|
58
|
+
find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
|
|
59
|
+
find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
|
|
60
|
+
find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
|
|
61
|
+
|
|
62
|
+
# Link all libraries together
|
|
63
|
+
target_link_libraries(
|
|
64
|
+
NitroLocationGeocoder
|
|
65
|
+
fbjni::fbjni # <-- Facebook C++ JNI helpers
|
|
66
|
+
ReactAndroid::jsi # <-- RN: JSI
|
|
67
|
+
react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
# Link react-native (different prefab between RN 0.75 and RN 0.76)
|
|
71
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
|
|
72
|
+
target_link_libraries(
|
|
73
|
+
NitroLocationGeocoder
|
|
74
|
+
ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
|
|
75
|
+
)
|
|
76
|
+
else()
|
|
77
|
+
target_link_libraries(
|
|
78
|
+
NitroLocationGeocoder
|
|
79
|
+
ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
|
|
80
|
+
)
|
|
81
|
+
endif()
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// NitroLocationGeocoder+autolinking.gradle
|
|
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
|
-
/// This is a Gradle file that adds all files generated by Nitrogen
|
|
9
|
-
/// to the current Gradle project.
|
|
10
|
-
///
|
|
11
|
-
/// To use it, add this to your build.gradle:
|
|
12
|
-
/// ```gradle
|
|
13
|
-
/// apply from: '../nitrogen/generated/android/NitroLocationGeocoder+autolinking.gradle'
|
|
14
|
-
/// ```
|
|
15
|
-
|
|
16
|
-
logger.warn("[NitroModules] 🔥 NitroLocationGeocoder is boosted by nitro!")
|
|
17
|
-
|
|
18
|
-
android {
|
|
19
|
-
sourceSets {
|
|
20
|
-
main {
|
|
21
|
-
java.srcDirs += [
|
|
22
|
-
// Nitrogen files
|
|
23
|
-
"${project.projectDir}/../nitrogen/generated/android/kotlin"
|
|
24
|
-
]
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
///
|
|
2
|
+
/// NitroLocationGeocoder+autolinking.gradle
|
|
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
|
+
/// This is a Gradle file that adds all files generated by Nitrogen
|
|
9
|
+
/// to the current Gradle project.
|
|
10
|
+
///
|
|
11
|
+
/// To use it, add this to your build.gradle:
|
|
12
|
+
/// ```gradle
|
|
13
|
+
/// apply from: '../nitrogen/generated/android/NitroLocationGeocoder+autolinking.gradle'
|
|
14
|
+
/// ```
|
|
15
|
+
|
|
16
|
+
logger.warn("[NitroModules] 🔥 NitroLocationGeocoder is boosted by nitro!")
|
|
17
|
+
|
|
18
|
+
android {
|
|
19
|
+
sourceSets {
|
|
20
|
+
main {
|
|
21
|
+
java.srcDirs += [
|
|
22
|
+
// Nitrogen files
|
|
23
|
+
"${project.projectDir}/../nitrogen/generated/android/kotlin"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|