@jacques_gordon/expo-mapbox-navigation 2.0.2 → 2.0.4
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/android/build.gradle +7 -5
- package/app.plugin.js +12 -32
- package/package.json +1 -1
- package/plugin/src/index.js +12 -32
package/android/build.gradle
CHANGED
|
@@ -7,7 +7,9 @@ apply plugin: 'maven-publish'
|
|
|
7
7
|
// Must be aligned with the Mapbox Maps SDK version used in @rnmapbox/maps.
|
|
8
8
|
// Minimum required: 3.x compatible with mapbox-maps-android 11.11.0
|
|
9
9
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
10
|
-
|
|
10
|
+
// Navigation SDK v3 uses com.mapbox.navigationcore (NOT com.mapbox.navigation)
|
|
11
|
+
// v3.8.1 is the stable release that ships with Maps SDK 11.11.0
|
|
12
|
+
def MAPBOX_NAVIGATION_VERSION = "3.8.1"
|
|
11
13
|
|
|
12
14
|
// Forces minimum Mapbox Maps Android version to 11.11.0 to ensure
|
|
13
15
|
// CameraAnimationsUtils.calculateCameraAnimationHint(...) is available (fixes #43)
|
|
@@ -94,11 +96,11 @@ dependencies {
|
|
|
94
96
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${safeExtGet('kotlinVersion', '1.9.0')}"
|
|
95
97
|
|
|
96
98
|
// ─────────────────────────────────────────────────────────────────────────
|
|
97
|
-
// Mapbox Navigation SDK for Android
|
|
98
|
-
//
|
|
99
|
-
//
|
|
99
|
+
// Mapbox Navigation SDK v3 for Android
|
|
100
|
+
// Group changed from com.mapbox.navigation to com.mapbox.navigationcore in v3
|
|
101
|
+
// v3.8.1 ships with mapbox-maps-android 11.11.0 (fixes issue #43)
|
|
100
102
|
// ─────────────────────────────────────────────────────────────────────────
|
|
101
|
-
implementation "com.mapbox.
|
|
103
|
+
implementation "com.mapbox.navigationcore:android:${MAPBOX_NAVIGATION_VERSION}"
|
|
102
104
|
|
|
103
105
|
// Explicitly pin Mapbox Maps SDK to ≥ 11.11.0 to guarantee method compatibility
|
|
104
106
|
// Prevents gradle from resolving an older transitive version (issue #43 root cause)
|
package/app.plugin.js
CHANGED
|
@@ -2,28 +2,11 @@ const { withAppBuildGradle, withProjectBuildGradle, withAndroidManifest, withInf
|
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const path = require('path');
|
|
4
4
|
|
|
5
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
6
|
-
// Config Plugin for @jacques_gordon/expo-mapbox-navigation
|
|
7
|
-
//
|
|
8
|
-
// This plugin:
|
|
9
|
-
// 1. Adds Mapbox Maven repository to android/build.gradle
|
|
10
|
-
// 2. Forces NDK 27 for 16 KB page size compatibility
|
|
11
|
-
// 3. Enables jniLibs.useLegacyPackaging = false (required for 16 KB pages)
|
|
12
|
-
// 4. Adds Mapbox access token to android resources & iOS Info.plist
|
|
13
|
-
// 5. Adds background location & audio modes for iOS
|
|
14
|
-
// 6. Supports androidColorOverrides for UI theming
|
|
15
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
16
|
-
|
|
17
5
|
const NDK_VERSION = '27.0.12077973';
|
|
18
6
|
const MAPBOX_MAPS_MIN_VERSION = '11.11.0';
|
|
7
|
+
// Navigation SDK v3 uses com.mapbox.navigationcore group
|
|
8
|
+
const MAPBOX_NAV_VERSION = '3.8.1';
|
|
19
9
|
|
|
20
|
-
/**
|
|
21
|
-
* @param {import('@expo/config-plugins').ConfigPlugin<{
|
|
22
|
-
* accessToken: string,
|
|
23
|
-
* mapboxMapsVersion?: string,
|
|
24
|
-
* androidColorOverrides?: Record<string, string>
|
|
25
|
-
* }>}
|
|
26
|
-
*/
|
|
27
10
|
const withMapboxNavigation = (config, options = {}) => {
|
|
28
11
|
const {
|
|
29
12
|
accessToken,
|
|
@@ -67,7 +50,6 @@ const withMapboxNavigation = (config, options = {}) => {
|
|
|
67
50
|
}
|
|
68
51
|
}`;
|
|
69
52
|
|
|
70
|
-
// Insert into allprojects.repositories if it exists
|
|
71
53
|
if (contents.includes('allprojects') && contents.includes('repositories')) {
|
|
72
54
|
contents = contents.replace(
|
|
73
55
|
/allprojects\s*\{[\s\S]*?repositories\s*\{/,
|
|
@@ -76,6 +58,7 @@ const withMapboxNavigation = (config, options = {}) => {
|
|
|
76
58
|
}
|
|
77
59
|
}
|
|
78
60
|
|
|
61
|
+
|
|
79
62
|
mod.modResults.contents = contents;
|
|
80
63
|
return mod;
|
|
81
64
|
});
|
|
@@ -91,7 +74,6 @@ const withMapboxNavigation = (config, options = {}) => {
|
|
|
91
74
|
`android {\n ndkVersion "${NDK_VERSION}" // Required for 16 KB page size (expo-mapbox-navigation)`
|
|
92
75
|
);
|
|
93
76
|
} else if (!contents.includes(NDK_VERSION)) {
|
|
94
|
-
// Replace any existing ndkVersion
|
|
95
77
|
contents = contents.replace(
|
|
96
78
|
/ndkVersion\s+["'][^"']*["']/,
|
|
97
79
|
`ndkVersion "${NDK_VERSION}" // Forced by expo-mapbox-navigation for 16KB page size`
|
|
@@ -106,16 +88,17 @@ const withMapboxNavigation = (config, options = {}) => {
|
|
|
106
88
|
);
|
|
107
89
|
}
|
|
108
90
|
|
|
109
|
-
// Pin Mapbox Maps
|
|
91
|
+
// Pin Mapbox Maps + Navigation versions via resolutionStrategy
|
|
110
92
|
const resolutionBlock = `
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
}
|
|
93
|
+
configurations.all {
|
|
94
|
+
resolutionStrategy {
|
|
95
|
+
// Force Mapbox Maps SDK >= ${mapboxMapsVersion} — required for NavigationCamera compatibility (issue #43)
|
|
96
|
+
force "com.mapbox.maps:android:${mapboxMapsVersion}"
|
|
97
|
+
force "com.mapbox.maps:android-ndk27:${mapboxMapsVersion}"
|
|
98
|
+
}
|
|
99
|
+
}`;
|
|
117
100
|
|
|
118
|
-
if (!contents.includes('com.mapbox.maps:android')) {
|
|
101
|
+
if (!contents.includes('com.mapbox.maps:android:')) {
|
|
119
102
|
contents = contents + '\n' + resolutionBlock;
|
|
120
103
|
}
|
|
121
104
|
|
|
@@ -184,10 +167,8 @@ ${colorEntries}
|
|
|
184
167
|
|
|
185
168
|
// ── iOS: Info.plist ──────────────────────────────────────────────────────
|
|
186
169
|
config = withInfoPlist(config, (mod) => {
|
|
187
|
-
// Mapbox public token
|
|
188
170
|
mod.modResults.MBXAccessToken = accessToken;
|
|
189
171
|
|
|
190
|
-
// Location permissions (required for navigation)
|
|
191
172
|
if (!mod.modResults.NSLocationWhenInUseUsageDescription) {
|
|
192
173
|
mod.modResults.NSLocationWhenInUseUsageDescription =
|
|
193
174
|
'Your location is used for turn-by-turn navigation.';
|
|
@@ -197,7 +178,6 @@ ${colorEntries}
|
|
|
197
178
|
'Your location is used for turn-by-turn navigation even when the app is in the background.';
|
|
198
179
|
}
|
|
199
180
|
|
|
200
|
-
// Background modes required for navigation audio + location tracking
|
|
201
181
|
if (!mod.modResults.UIBackgroundModes) {
|
|
202
182
|
mod.modResults.UIBackgroundModes = [];
|
|
203
183
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jacques_gordon/expo-mapbox-navigation",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Expo module for Mapbox Navigation SDK with 16KB page size support, NDK27, and Mapbox Maps v11.11.0+",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
package/plugin/src/index.js
CHANGED
|
@@ -2,28 +2,11 @@ const { withAppBuildGradle, withProjectBuildGradle, withAndroidManifest, withInf
|
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const path = require('path');
|
|
4
4
|
|
|
5
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
6
|
-
// Config Plugin for @jacques_gordon/expo-mapbox-navigation
|
|
7
|
-
//
|
|
8
|
-
// This plugin:
|
|
9
|
-
// 1. Adds Mapbox Maven repository to android/build.gradle
|
|
10
|
-
// 2. Forces NDK 27 for 16 KB page size compatibility
|
|
11
|
-
// 3. Enables jniLibs.useLegacyPackaging = false (required for 16 KB pages)
|
|
12
|
-
// 4. Adds Mapbox access token to android resources & iOS Info.plist
|
|
13
|
-
// 5. Adds background location & audio modes for iOS
|
|
14
|
-
// 6. Supports androidColorOverrides for UI theming
|
|
15
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
16
|
-
|
|
17
5
|
const NDK_VERSION = '27.0.12077973';
|
|
18
6
|
const MAPBOX_MAPS_MIN_VERSION = '11.11.0';
|
|
7
|
+
// Navigation SDK v3 uses com.mapbox.navigationcore group
|
|
8
|
+
const MAPBOX_NAV_VERSION = '3.8.1';
|
|
19
9
|
|
|
20
|
-
/**
|
|
21
|
-
* @param {import('@expo/config-plugins').ConfigPlugin<{
|
|
22
|
-
* accessToken: string,
|
|
23
|
-
* mapboxMapsVersion?: string,
|
|
24
|
-
* androidColorOverrides?: Record<string, string>
|
|
25
|
-
* }>}
|
|
26
|
-
*/
|
|
27
10
|
const withMapboxNavigation = (config, options = {}) => {
|
|
28
11
|
const {
|
|
29
12
|
accessToken,
|
|
@@ -67,7 +50,6 @@ const withMapboxNavigation = (config, options = {}) => {
|
|
|
67
50
|
}
|
|
68
51
|
}`;
|
|
69
52
|
|
|
70
|
-
// Insert into allprojects.repositories if it exists
|
|
71
53
|
if (contents.includes('allprojects') && contents.includes('repositories')) {
|
|
72
54
|
contents = contents.replace(
|
|
73
55
|
/allprojects\s*\{[\s\S]*?repositories\s*\{/,
|
|
@@ -76,6 +58,7 @@ const withMapboxNavigation = (config, options = {}) => {
|
|
|
76
58
|
}
|
|
77
59
|
}
|
|
78
60
|
|
|
61
|
+
|
|
79
62
|
mod.modResults.contents = contents;
|
|
80
63
|
return mod;
|
|
81
64
|
});
|
|
@@ -91,7 +74,6 @@ const withMapboxNavigation = (config, options = {}) => {
|
|
|
91
74
|
`android {\n ndkVersion "${NDK_VERSION}" // Required for 16 KB page size (expo-mapbox-navigation)`
|
|
92
75
|
);
|
|
93
76
|
} else if (!contents.includes(NDK_VERSION)) {
|
|
94
|
-
// Replace any existing ndkVersion
|
|
95
77
|
contents = contents.replace(
|
|
96
78
|
/ndkVersion\s+["'][^"']*["']/,
|
|
97
79
|
`ndkVersion "${NDK_VERSION}" // Forced by expo-mapbox-navigation for 16KB page size`
|
|
@@ -106,16 +88,17 @@ const withMapboxNavigation = (config, options = {}) => {
|
|
|
106
88
|
);
|
|
107
89
|
}
|
|
108
90
|
|
|
109
|
-
// Pin Mapbox Maps
|
|
91
|
+
// Pin Mapbox Maps + Navigation versions via resolutionStrategy
|
|
110
92
|
const resolutionBlock = `
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
}
|
|
93
|
+
configurations.all {
|
|
94
|
+
resolutionStrategy {
|
|
95
|
+
// Force Mapbox Maps SDK >= ${mapboxMapsVersion} — required for NavigationCamera compatibility (issue #43)
|
|
96
|
+
force "com.mapbox.maps:android:${mapboxMapsVersion}"
|
|
97
|
+
force "com.mapbox.maps:android-ndk27:${mapboxMapsVersion}"
|
|
98
|
+
}
|
|
99
|
+
}`;
|
|
117
100
|
|
|
118
|
-
if (!contents.includes('com.mapbox.maps:android')) {
|
|
101
|
+
if (!contents.includes('com.mapbox.maps:android:')) {
|
|
119
102
|
contents = contents + '\n' + resolutionBlock;
|
|
120
103
|
}
|
|
121
104
|
|
|
@@ -184,10 +167,8 @@ ${colorEntries}
|
|
|
184
167
|
|
|
185
168
|
// ── iOS: Info.plist ──────────────────────────────────────────────────────
|
|
186
169
|
config = withInfoPlist(config, (mod) => {
|
|
187
|
-
// Mapbox public token
|
|
188
170
|
mod.modResults.MBXAccessToken = accessToken;
|
|
189
171
|
|
|
190
|
-
// Location permissions (required for navigation)
|
|
191
172
|
if (!mod.modResults.NSLocationWhenInUseUsageDescription) {
|
|
192
173
|
mod.modResults.NSLocationWhenInUseUsageDescription =
|
|
193
174
|
'Your location is used for turn-by-turn navigation.';
|
|
@@ -197,7 +178,6 @@ ${colorEntries}
|
|
|
197
178
|
'Your location is used for turn-by-turn navigation even when the app is in the background.';
|
|
198
179
|
}
|
|
199
180
|
|
|
200
|
-
// Background modes required for navigation audio + location tracking
|
|
201
181
|
if (!mod.modResults.UIBackgroundModes) {
|
|
202
182
|
mod.modResults.UIBackgroundModes = [];
|
|
203
183
|
}
|