@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,28 +1,28 @@
|
|
|
1
|
-
require "json"
|
|
2
|
-
|
|
3
|
-
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
-
|
|
5
|
-
Pod::Spec.new do |s|
|
|
6
|
-
s.name = "NitroLocationGeocoder"
|
|
7
|
-
s.version = package["version"]
|
|
8
|
-
s.summary = package["description"]
|
|
9
|
-
s.homepage = package["homepage"] || "https://github.com"
|
|
10
|
-
s.license = package["license"] || "Apache-2.0"
|
|
11
|
-
s.authors = package["author"] || "Inoxia Labs"
|
|
12
|
-
|
|
13
|
-
s.platforms = { :ios => min_ios_version_supported, :visionos => 1.0 }
|
|
14
|
-
s.source = { :path => "." }
|
|
15
|
-
|
|
16
|
-
s.source_files = [
|
|
17
|
-
"ios/**/*.{swift}",
|
|
18
|
-
"ios/**/*.{m,mm}",
|
|
19
|
-
"cpp/**/*.{hpp,cpp}",
|
|
20
|
-
]
|
|
21
|
-
|
|
22
|
-
load "nitrogen/generated/ios/NitroLocationGeocoder+autolinking.rb"
|
|
23
|
-
add_nitrogen_files(s)
|
|
24
|
-
|
|
25
|
-
s.dependency "React-jsi"
|
|
26
|
-
s.dependency "React-callinvoker"
|
|
27
|
-
install_modules_dependencies(s)
|
|
28
|
-
end
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "NitroLocationGeocoder"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"] || "https://github.com"
|
|
10
|
+
s.license = package["license"] || "Apache-2.0"
|
|
11
|
+
s.authors = package["author"] || "Inoxia Labs"
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => min_ios_version_supported, :visionos => 1.0 }
|
|
14
|
+
s.source = { :path => "." }
|
|
15
|
+
|
|
16
|
+
s.source_files = [
|
|
17
|
+
"ios/**/*.{swift}",
|
|
18
|
+
"ios/**/*.{m,mm}",
|
|
19
|
+
"cpp/**/*.{hpp,cpp}",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
load "nitrogen/generated/ios/NitroLocationGeocoder+autolinking.rb"
|
|
23
|
+
add_nitrogen_files(s)
|
|
24
|
+
|
|
25
|
+
s.dependency "React-jsi"
|
|
26
|
+
s.dependency "React-callinvoker"
|
|
27
|
+
install_modules_dependencies(s)
|
|
28
|
+
end
|
package/README.md
CHANGED
|
@@ -1,80 +1,120 @@
|
|
|
1
|
-
# @inoxialabs/react-native-nitro-location-geocoder
|
|
2
|
-
|
|
3
|
-
`@inoxialabs/react-native-nitro-location-geocoder` is a minimal React Native Nitro module for reverse geocoding latitude and longitude coordinates into normalized
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
- Locale-aware lookups
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
1
|
+
# @inoxialabs/react-native-nitro-location-geocoder
|
|
2
|
+
|
|
3
|
+
`@inoxialabs/react-native-nitro-location-geocoder` is a minimal React Native Nitro module for reverse geocoding latitude and longitude coordinates into a normalized location result.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Reverse geocoding on iOS and Android.
|
|
8
|
+
- Locale-aware lookups using language tags such as `en`, `es`, or `es-PE`.
|
|
9
|
+
- Small, typed API with a normalized result shape.
|
|
10
|
+
- No backend dependency and no device location permission requirement.
|
|
11
|
+
- Stable generic errors for unavailable geocoders, empty results, invalid coordinates, timeouts, and native geocoder failures.
|
|
12
|
+
|
|
13
|
+
## Supported platforms
|
|
14
|
+
|
|
15
|
+
- iOS
|
|
16
|
+
- Android
|
|
17
|
+
|
|
18
|
+
This package does not expose a web implementation.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
Install the package and its Nitro peer dependency:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install @inoxialabs/react-native-nitro-location-geocoder react-native-nitro-modules
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Peer dependencies:
|
|
29
|
+
|
|
30
|
+
- `react`
|
|
31
|
+
- `react-native`
|
|
32
|
+
- `react-native-nitro-modules` `^0.35.0`
|
|
33
|
+
|
|
34
|
+
On iOS, install pods after adding the package:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
cd ios && pod install
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { reverseGeocode } from '@inoxialabs/react-native-nitro-location-geocoder';
|
|
44
|
+
|
|
45
|
+
const result = await reverseGeocode(-12.0464, -77.0428, 'es-PE');
|
|
46
|
+
|
|
47
|
+
console.log(result.countryCode);
|
|
48
|
+
console.log(result.country);
|
|
49
|
+
console.log(result.locality);
|
|
50
|
+
console.log(result.administrativeArea);
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
To use the system default locale, pass an empty string:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
const result = await reverseGeocode(4.711, -74.0721, '');
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## API
|
|
60
|
+
|
|
61
|
+
### `reverseGeocode(latitude, longitude, locale)`
|
|
62
|
+
|
|
63
|
+
Returns `Promise<LocationGeocoderResult>`.
|
|
64
|
+
|
|
65
|
+
Parameters:
|
|
66
|
+
|
|
67
|
+
- `latitude`: required `number`
|
|
68
|
+
- `longitude`: required `number`
|
|
69
|
+
- `locale`: required `string`
|
|
70
|
+
|
|
71
|
+
`locale` accepts a language tag such as `en`, `es`, or `es-PE`. Passing `''` uses the platform default locale, but the argument itself is still required.
|
|
72
|
+
Latitude must be finite and between `-90` and `90`. Longitude must be finite and between `-180` and `180`.
|
|
73
|
+
|
|
74
|
+
### `LocationGeocoderResult`
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
type LocationGeocoderResult = {
|
|
78
|
+
countryCode: string;
|
|
79
|
+
country: string;
|
|
80
|
+
locality: string;
|
|
81
|
+
administrativeArea: string;
|
|
82
|
+
subAdministrativeArea: string;
|
|
83
|
+
subLocality: string;
|
|
84
|
+
};
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
All fields are always present. When the platform geocoder cannot provide a field, the module returns an empty string for that property.
|
|
88
|
+
|
|
89
|
+
## Platform behavior
|
|
90
|
+
|
|
60
91
|
- iOS uses `CLGeocoder`.
|
|
61
92
|
- Android uses `android.location.Geocoder`.
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
93
|
+
- Calls are independent. Starting one reverse-geocode request does not cancel another request.
|
|
94
|
+
- Requests time out after 10 seconds with `GEOCODER_TIMEOUT`.
|
|
95
|
+
- The module rejects with `INVALID_COORDINATES` when latitude or longitude is outside the valid coordinate range.
|
|
96
|
+
- The module rejects with `NO_RESULTS` when no address is found.
|
|
97
|
+
- Android rejects with `UNAVAILABLE` when the platform geocoder is not available.
|
|
98
|
+
- iOS wraps native geocoder failures as `GEOCODER_FAILED: <platform message>`.
|
|
99
|
+
- Android wraps native geocoder failures as `GEOCODER_FAILED` or `GEOCODER_FAILED: <platform message>`.
|
|
100
|
+
|
|
101
|
+
## Notes
|
|
102
|
+
|
|
103
|
+
- The module reverse geocodes coordinates that you already have. It does not request GPS updates or device location permissions.
|
|
104
|
+
- The package exports `reverseGeocode`, `Geocoder`, and the default `Geocoder` object.
|
|
105
|
+
|
|
106
|
+
## Development
|
|
107
|
+
|
|
108
|
+
Regenerate Nitro bindings after changing `src/specs/LocationGeocoder.nitro.ts` or `nitro.json`:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
npm install
|
|
112
|
+
npm run specs
|
|
113
|
+
npm test
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Validate the published package contents:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npm pack --dry-run
|
|
120
|
+
```
|
package/android/CMakeLists.txt
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
project(NitroLocationGeocoder)
|
|
2
|
-
cmake_minimum_required(VERSION 3.9.0)
|
|
3
|
-
|
|
4
|
-
set(PACKAGE_NAME NitroLocationGeocoder)
|
|
5
|
-
set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
6
|
-
set(CMAKE_CXX_STANDARD 20)
|
|
7
|
-
|
|
8
|
-
add_library(${PACKAGE_NAME} SHARED
|
|
9
|
-
src/main/cpp/cpp-adapter.cpp
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/NitroLocationGeocoder+autolinking.cmake)
|
|
13
|
-
|
|
14
|
-
include_directories(
|
|
15
|
-
"src/main/cpp"
|
|
16
|
-
"../cpp"
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
find_library(LOG_LIB log)
|
|
20
|
-
|
|
21
|
-
target_link_libraries(
|
|
22
|
-
${PACKAGE_NAME}
|
|
23
|
-
${LOG_LIB}
|
|
24
|
-
android
|
|
25
|
-
)
|
|
1
|
+
project(NitroLocationGeocoder)
|
|
2
|
+
cmake_minimum_required(VERSION 3.9.0)
|
|
3
|
+
|
|
4
|
+
set(PACKAGE_NAME NitroLocationGeocoder)
|
|
5
|
+
set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
6
|
+
set(CMAKE_CXX_STANDARD 20)
|
|
7
|
+
|
|
8
|
+
add_library(${PACKAGE_NAME} SHARED
|
|
9
|
+
src/main/cpp/cpp-adapter.cpp
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/NitroLocationGeocoder+autolinking.cmake)
|
|
13
|
+
|
|
14
|
+
include_directories(
|
|
15
|
+
"src/main/cpp"
|
|
16
|
+
"../cpp"
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
find_library(LOG_LIB log)
|
|
20
|
+
|
|
21
|
+
target_link_libraries(
|
|
22
|
+
${PACKAGE_NAME}
|
|
23
|
+
${LOG_LIB}
|
|
24
|
+
android
|
|
25
|
+
)
|
package/android/build.gradle
CHANGED
|
@@ -1,129 +1,129 @@
|
|
|
1
|
-
buildscript {
|
|
2
|
-
repositories {
|
|
3
|
-
google()
|
|
4
|
-
mavenCentral()
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
dependencies {
|
|
8
|
-
classpath "com.android.tools.build:gradle:8.13.1"
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
def reactNativeArchitectures() {
|
|
13
|
-
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
14
|
-
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
def isNewArchitectureEnabled() {
|
|
18
|
-
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
apply plugin: "com.android.library"
|
|
22
|
-
apply plugin: "org.jetbrains.kotlin.android"
|
|
23
|
-
apply from: "../nitrogen/generated/android/NitroLocationGeocoder+autolinking.gradle"
|
|
24
|
-
apply from: "./fix-prefab.gradle"
|
|
25
|
-
|
|
26
|
-
if (isNewArchitectureEnabled()) {
|
|
27
|
-
apply plugin: "com.facebook.react"
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
def getExtOrDefault(name) {
|
|
31
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["NitroLocationGeocoder_" + name]
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
def getExtOrIntegerDefault(name) {
|
|
35
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["NitroLocationGeocoder_" + name]).toInteger()
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
android {
|
|
39
|
-
namespace "com.margelo.nitro.locationgeocoder"
|
|
40
|
-
|
|
41
|
-
ndkVersion getExtOrDefault("ndkVersion")
|
|
42
|
-
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
43
|
-
|
|
44
|
-
defaultConfig {
|
|
45
|
-
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
46
|
-
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
47
|
-
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
48
|
-
|
|
49
|
-
externalNativeBuild {
|
|
50
|
-
cmake {
|
|
51
|
-
cppFlags "-frtti -fexceptions -Wall -Wextra -fstack-protector-all"
|
|
52
|
-
arguments "-DANDROID_STL=c++_shared", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
|
|
53
|
-
abiFilters (*reactNativeArchitectures())
|
|
54
|
-
|
|
55
|
-
buildTypes {
|
|
56
|
-
debug {
|
|
57
|
-
cppFlags "-O1 -g"
|
|
58
|
-
}
|
|
59
|
-
release {
|
|
60
|
-
cppFlags "-O2"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
externalNativeBuild {
|
|
68
|
-
cmake {
|
|
69
|
-
path "CMakeLists.txt"
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
packagingOptions {
|
|
74
|
-
excludes = [
|
|
75
|
-
"META-INF",
|
|
76
|
-
"META-INF/**",
|
|
77
|
-
"**/libc++_shared.so",
|
|
78
|
-
"**/libfbjni.so",
|
|
79
|
-
"**/libjsi.so",
|
|
80
|
-
"**/libfolly_json.so",
|
|
81
|
-
"**/libfolly_runtime.so",
|
|
82
|
-
"**/libglog.so",
|
|
83
|
-
"**/libhermes.so",
|
|
84
|
-
"**/libhermes-executor-debug.so",
|
|
85
|
-
"**/libhermes_executor.so",
|
|
86
|
-
"**/libreactnative.so",
|
|
87
|
-
"**/libreactnativejni.so",
|
|
88
|
-
"**/libturbomodulejsijni.so",
|
|
89
|
-
"**/libreact_nativemodule_core.so",
|
|
90
|
-
"**/libjscexecutor.so"
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
buildFeatures {
|
|
95
|
-
buildConfig true
|
|
96
|
-
prefab true
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
buildTypes {
|
|
100
|
-
release {
|
|
101
|
-
minifyEnabled false
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
compileOptions {
|
|
106
|
-
sourceCompatibility JavaVersion.VERSION_1_8
|
|
107
|
-
targetCompatibility JavaVersion.VERSION_1_8
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
sourceSets {
|
|
111
|
-
main {
|
|
112
|
-
if (isNewArchitectureEnabled()) {
|
|
113
|
-
java.srcDirs += [
|
|
114
|
-
"${project.buildDir}/generated/source/codegen/java"
|
|
115
|
-
]
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
repositories {
|
|
122
|
-
mavenCentral()
|
|
123
|
-
google()
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
dependencies {
|
|
127
|
-
implementation "com.facebook.react:react-native:+"
|
|
128
|
-
implementation project(":react-native-nitro-modules")
|
|
129
|
-
}
|
|
1
|
+
buildscript {
|
|
2
|
+
repositories {
|
|
3
|
+
google()
|
|
4
|
+
mavenCentral()
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
dependencies {
|
|
8
|
+
classpath "com.android.tools.build:gradle:8.13.1"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
def reactNativeArchitectures() {
|
|
13
|
+
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
14
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
def isNewArchitectureEnabled() {
|
|
18
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
apply plugin: "com.android.library"
|
|
22
|
+
apply plugin: "org.jetbrains.kotlin.android"
|
|
23
|
+
apply from: "../nitrogen/generated/android/NitroLocationGeocoder+autolinking.gradle"
|
|
24
|
+
apply from: "./fix-prefab.gradle"
|
|
25
|
+
|
|
26
|
+
if (isNewArchitectureEnabled()) {
|
|
27
|
+
apply plugin: "com.facebook.react"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
def getExtOrDefault(name) {
|
|
31
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["NitroLocationGeocoder_" + name]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
def getExtOrIntegerDefault(name) {
|
|
35
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["NitroLocationGeocoder_" + name]).toInteger()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
android {
|
|
39
|
+
namespace "com.margelo.nitro.locationgeocoder"
|
|
40
|
+
|
|
41
|
+
ndkVersion getExtOrDefault("ndkVersion")
|
|
42
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
43
|
+
|
|
44
|
+
defaultConfig {
|
|
45
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
46
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
47
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
48
|
+
|
|
49
|
+
externalNativeBuild {
|
|
50
|
+
cmake {
|
|
51
|
+
cppFlags "-frtti -fexceptions -Wall -Wextra -fstack-protector-all"
|
|
52
|
+
arguments "-DANDROID_STL=c++_shared", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
|
|
53
|
+
abiFilters (*reactNativeArchitectures())
|
|
54
|
+
|
|
55
|
+
buildTypes {
|
|
56
|
+
debug {
|
|
57
|
+
cppFlags "-O1 -g"
|
|
58
|
+
}
|
|
59
|
+
release {
|
|
60
|
+
cppFlags "-O2"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
externalNativeBuild {
|
|
68
|
+
cmake {
|
|
69
|
+
path "CMakeLists.txt"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
packagingOptions {
|
|
74
|
+
excludes = [
|
|
75
|
+
"META-INF",
|
|
76
|
+
"META-INF/**",
|
|
77
|
+
"**/libc++_shared.so",
|
|
78
|
+
"**/libfbjni.so",
|
|
79
|
+
"**/libjsi.so",
|
|
80
|
+
"**/libfolly_json.so",
|
|
81
|
+
"**/libfolly_runtime.so",
|
|
82
|
+
"**/libglog.so",
|
|
83
|
+
"**/libhermes.so",
|
|
84
|
+
"**/libhermes-executor-debug.so",
|
|
85
|
+
"**/libhermes_executor.so",
|
|
86
|
+
"**/libreactnative.so",
|
|
87
|
+
"**/libreactnativejni.so",
|
|
88
|
+
"**/libturbomodulejsijni.so",
|
|
89
|
+
"**/libreact_nativemodule_core.so",
|
|
90
|
+
"**/libjscexecutor.so"
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
buildFeatures {
|
|
95
|
+
buildConfig true
|
|
96
|
+
prefab true
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
buildTypes {
|
|
100
|
+
release {
|
|
101
|
+
minifyEnabled false
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
compileOptions {
|
|
106
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
107
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
sourceSets {
|
|
111
|
+
main {
|
|
112
|
+
if (isNewArchitectureEnabled()) {
|
|
113
|
+
java.srcDirs += [
|
|
114
|
+
"${project.buildDir}/generated/source/codegen/java"
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
repositories {
|
|
122
|
+
mavenCentral()
|
|
123
|
+
google()
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
dependencies {
|
|
127
|
+
implementation "com.facebook.react:react-native:+"
|
|
128
|
+
implementation project(":react-native-nitro-modules")
|
|
129
|
+
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
tasks.configureEach { task ->
|
|
2
|
-
def prefabConfigurePattern = ~/^prefab(.+)ConfigurePackage$/
|
|
3
|
-
def matcher = task.name =~ prefabConfigurePattern
|
|
4
|
-
if (matcher.matches()) {
|
|
5
|
-
def variantName = matcher[0][1]
|
|
6
|
-
task.outputs.upToDateWhen { false }
|
|
7
|
-
task.dependsOn("externalNativeBuild${variantName}")
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
afterEvaluate {
|
|
12
|
-
def abis = reactNativeArchitectures()
|
|
13
|
-
rootProject.allprojects.each { proj ->
|
|
14
|
-
if (proj === rootProject) return
|
|
15
|
-
|
|
16
|
-
def dependsOnThisLib = proj.configurations.findAll { it.canBeResolved }.any { config ->
|
|
17
|
-
config.dependencies.any { dep ->
|
|
18
|
-
dep.group == project.group && dep.name == project.name
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
if (!dependsOnThisLib && proj != project) return
|
|
22
|
-
|
|
23
|
-
if (!proj.plugins.hasPlugin("com.android.application") && !proj.plugins.hasPlugin("com.android.library")) {
|
|
24
|
-
return
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
def variants = proj.android.hasProperty("applicationVariants") ? proj.android.applicationVariants : proj.android.libraryVariants
|
|
28
|
-
variants.all { variant ->
|
|
29
|
-
def variantName = variant.name
|
|
30
|
-
abis.each { abi ->
|
|
31
|
-
def searchDir = new File(proj.projectDir, ".cxx/${variantName}")
|
|
32
|
-
if (!searchDir.exists()) return
|
|
33
|
-
def matches = []
|
|
34
|
-
searchDir.eachDir { randomDir ->
|
|
35
|
-
def prefabFile = new File(randomDir, "${abi}/prefab_config.json")
|
|
36
|
-
if (prefabFile.exists()) matches << prefabFile
|
|
37
|
-
}
|
|
38
|
-
matches.each { prefabConfig ->
|
|
39
|
-
prefabConfig.setLastModified(System.currentTimeMillis())
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
1
|
+
tasks.configureEach { task ->
|
|
2
|
+
def prefabConfigurePattern = ~/^prefab(.+)ConfigurePackage$/
|
|
3
|
+
def matcher = task.name =~ prefabConfigurePattern
|
|
4
|
+
if (matcher.matches()) {
|
|
5
|
+
def variantName = matcher[0][1]
|
|
6
|
+
task.outputs.upToDateWhen { false }
|
|
7
|
+
task.dependsOn("externalNativeBuild${variantName}")
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
afterEvaluate {
|
|
12
|
+
def abis = reactNativeArchitectures()
|
|
13
|
+
rootProject.allprojects.each { proj ->
|
|
14
|
+
if (proj === rootProject) return
|
|
15
|
+
|
|
16
|
+
def dependsOnThisLib = proj.configurations.findAll { it.canBeResolved }.any { config ->
|
|
17
|
+
config.dependencies.any { dep ->
|
|
18
|
+
dep.group == project.group && dep.name == project.name
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (!dependsOnThisLib && proj != project) return
|
|
22
|
+
|
|
23
|
+
if (!proj.plugins.hasPlugin("com.android.application") && !proj.plugins.hasPlugin("com.android.library")) {
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
def variants = proj.android.hasProperty("applicationVariants") ? proj.android.applicationVariants : proj.android.libraryVariants
|
|
28
|
+
variants.all { variant ->
|
|
29
|
+
def variantName = variant.name
|
|
30
|
+
abis.each { abi ->
|
|
31
|
+
def searchDir = new File(proj.projectDir, ".cxx/${variantName}")
|
|
32
|
+
if (!searchDir.exists()) return
|
|
33
|
+
def matches = []
|
|
34
|
+
searchDir.eachDir { randomDir ->
|
|
35
|
+
def prefabFile = new File(randomDir, "${abi}/prefab_config.json")
|
|
36
|
+
if (prefabFile.exists()) matches << prefabFile
|
|
37
|
+
}
|
|
38
|
+
matches.each { prefabConfig ->
|
|
39
|
+
prefabConfig.setLastModified(System.currentTimeMillis())
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
NitroLocationGeocoder_kotlinVersion=2.1.20
|
|
2
|
-
NitroLocationGeocoder_minSdkVersion=24
|
|
3
|
-
NitroLocationGeocoder_targetSdkVersion=36
|
|
4
|
-
NitroLocationGeocoder_compileSdkVersion=36
|
|
5
|
-
NitroLocationGeocoder_ndkVersion=27.1.12297006
|
|
1
|
+
NitroLocationGeocoder_kotlinVersion=2.1.20
|
|
2
|
+
NitroLocationGeocoder_minSdkVersion=24
|
|
3
|
+
NitroLocationGeocoder_targetSdkVersion=36
|
|
4
|
+
NitroLocationGeocoder_compileSdkVersion=36
|
|
5
|
+
NitroLocationGeocoder_ndkVersion=27.1.12297006
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
-
package="com.margelo.nitro.locationgeocoder" />
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
+
package="com.margelo.nitro.locationgeocoder" />
|