@jacques_gordon/expo-mapbox-navigation 2.0.1 → 2.0.3
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 +25 -32
- package/expo-module.config.json +9 -0
- package/package.json +2 -1
- package/plugin/src/index.js +25 -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,20 @@ const withMapboxNavigation = (config, options = {}) => {
|
|
|
76
58
|
}
|
|
77
59
|
}
|
|
78
60
|
|
|
61
|
+
// Add Notifee Maven repo if not already present
|
|
62
|
+
// Fixes: "Could not find any matches for app.notifee:core:+"
|
|
63
|
+
if (!contents.includes('dl.cloudsmith.io/public/notifee')) {
|
|
64
|
+
const notifeeRepo = `
|
|
65
|
+
maven { url 'https://dl.cloudsmith.io/public/notifee/notifee/maven/' }`;
|
|
66
|
+
|
|
67
|
+
if (contents.includes('allprojects') && contents.includes('repositories')) {
|
|
68
|
+
contents = contents.replace(
|
|
69
|
+
/allprojects\s*\{[\s\S]*?repositories\s*\{/,
|
|
70
|
+
(match) => match + notifeeRepo
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
79
75
|
mod.modResults.contents = contents;
|
|
80
76
|
return mod;
|
|
81
77
|
});
|
|
@@ -91,7 +87,6 @@ const withMapboxNavigation = (config, options = {}) => {
|
|
|
91
87
|
`android {\n ndkVersion "${NDK_VERSION}" // Required for 16 KB page size (expo-mapbox-navigation)`
|
|
92
88
|
);
|
|
93
89
|
} else if (!contents.includes(NDK_VERSION)) {
|
|
94
|
-
// Replace any existing ndkVersion
|
|
95
90
|
contents = contents.replace(
|
|
96
91
|
/ndkVersion\s+["'][^"']*["']/,
|
|
97
92
|
`ndkVersion "${NDK_VERSION}" // Forced by expo-mapbox-navigation for 16KB page size`
|
|
@@ -106,16 +101,17 @@ const withMapboxNavigation = (config, options = {}) => {
|
|
|
106
101
|
);
|
|
107
102
|
}
|
|
108
103
|
|
|
109
|
-
// Pin Mapbox Maps
|
|
104
|
+
// Pin Mapbox Maps + Navigation versions via resolutionStrategy
|
|
110
105
|
const resolutionBlock = `
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
}
|
|
106
|
+
configurations.all {
|
|
107
|
+
resolutionStrategy {
|
|
108
|
+
// Force Mapbox Maps SDK >= ${mapboxMapsVersion} — required for NavigationCamera compatibility (issue #43)
|
|
109
|
+
force "com.mapbox.maps:android:${mapboxMapsVersion}"
|
|
110
|
+
force "com.mapbox.maps:android-ndk27:${mapboxMapsVersion}"
|
|
111
|
+
}
|
|
112
|
+
}`;
|
|
117
113
|
|
|
118
|
-
if (!contents.includes('com.mapbox.maps:android')) {
|
|
114
|
+
if (!contents.includes('com.mapbox.maps:android:')) {
|
|
119
115
|
contents = contents + '\n' + resolutionBlock;
|
|
120
116
|
}
|
|
121
117
|
|
|
@@ -184,10 +180,8 @@ ${colorEntries}
|
|
|
184
180
|
|
|
185
181
|
// ── iOS: Info.plist ──────────────────────────────────────────────────────
|
|
186
182
|
config = withInfoPlist(config, (mod) => {
|
|
187
|
-
// Mapbox public token
|
|
188
183
|
mod.modResults.MBXAccessToken = accessToken;
|
|
189
184
|
|
|
190
|
-
// Location permissions (required for navigation)
|
|
191
185
|
if (!mod.modResults.NSLocationWhenInUseUsageDescription) {
|
|
192
186
|
mod.modResults.NSLocationWhenInUseUsageDescription =
|
|
193
187
|
'Your location is used for turn-by-turn navigation.';
|
|
@@ -197,7 +191,6 @@ ${colorEntries}
|
|
|
197
191
|
'Your location is used for turn-by-turn navigation even when the app is in the background.';
|
|
198
192
|
}
|
|
199
193
|
|
|
200
|
-
// Background modes required for navigation audio + location tracking
|
|
201
194
|
if (!mod.modResults.UIBackgroundModes) {
|
|
202
195
|
mod.modResults.UIBackgroundModes = [];
|
|
203
196
|
}
|
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.3",
|
|
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",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"plugin",
|
|
56
56
|
"*.podspec",
|
|
57
57
|
"app.plugin.js",
|
|
58
|
+
"expo-module.config.json",
|
|
58
59
|
"README.md",
|
|
59
60
|
"LICENSE"
|
|
60
61
|
],
|
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,20 @@ const withMapboxNavigation = (config, options = {}) => {
|
|
|
76
58
|
}
|
|
77
59
|
}
|
|
78
60
|
|
|
61
|
+
// Add Notifee Maven repo if not already present
|
|
62
|
+
// Fixes: "Could not find any matches for app.notifee:core:+"
|
|
63
|
+
if (!contents.includes('dl.cloudsmith.io/public/notifee')) {
|
|
64
|
+
const notifeeRepo = `
|
|
65
|
+
maven { url 'https://dl.cloudsmith.io/public/notifee/notifee/maven/' }`;
|
|
66
|
+
|
|
67
|
+
if (contents.includes('allprojects') && contents.includes('repositories')) {
|
|
68
|
+
contents = contents.replace(
|
|
69
|
+
/allprojects\s*\{[\s\S]*?repositories\s*\{/,
|
|
70
|
+
(match) => match + notifeeRepo
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
79
75
|
mod.modResults.contents = contents;
|
|
80
76
|
return mod;
|
|
81
77
|
});
|
|
@@ -91,7 +87,6 @@ const withMapboxNavigation = (config, options = {}) => {
|
|
|
91
87
|
`android {\n ndkVersion "${NDK_VERSION}" // Required for 16 KB page size (expo-mapbox-navigation)`
|
|
92
88
|
);
|
|
93
89
|
} else if (!contents.includes(NDK_VERSION)) {
|
|
94
|
-
// Replace any existing ndkVersion
|
|
95
90
|
contents = contents.replace(
|
|
96
91
|
/ndkVersion\s+["'][^"']*["']/,
|
|
97
92
|
`ndkVersion "${NDK_VERSION}" // Forced by expo-mapbox-navigation for 16KB page size`
|
|
@@ -106,16 +101,17 @@ const withMapboxNavigation = (config, options = {}) => {
|
|
|
106
101
|
);
|
|
107
102
|
}
|
|
108
103
|
|
|
109
|
-
// Pin Mapbox Maps
|
|
104
|
+
// Pin Mapbox Maps + Navigation versions via resolutionStrategy
|
|
110
105
|
const resolutionBlock = `
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
}
|
|
106
|
+
configurations.all {
|
|
107
|
+
resolutionStrategy {
|
|
108
|
+
// Force Mapbox Maps SDK >= ${mapboxMapsVersion} — required for NavigationCamera compatibility (issue #43)
|
|
109
|
+
force "com.mapbox.maps:android:${mapboxMapsVersion}"
|
|
110
|
+
force "com.mapbox.maps:android-ndk27:${mapboxMapsVersion}"
|
|
111
|
+
}
|
|
112
|
+
}`;
|
|
117
113
|
|
|
118
|
-
if (!contents.includes('com.mapbox.maps:android')) {
|
|
114
|
+
if (!contents.includes('com.mapbox.maps:android:')) {
|
|
119
115
|
contents = contents + '\n' + resolutionBlock;
|
|
120
116
|
}
|
|
121
117
|
|
|
@@ -184,10 +180,8 @@ ${colorEntries}
|
|
|
184
180
|
|
|
185
181
|
// ── iOS: Info.plist ──────────────────────────────────────────────────────
|
|
186
182
|
config = withInfoPlist(config, (mod) => {
|
|
187
|
-
// Mapbox public token
|
|
188
183
|
mod.modResults.MBXAccessToken = accessToken;
|
|
189
184
|
|
|
190
|
-
// Location permissions (required for navigation)
|
|
191
185
|
if (!mod.modResults.NSLocationWhenInUseUsageDescription) {
|
|
192
186
|
mod.modResults.NSLocationWhenInUseUsageDescription =
|
|
193
187
|
'Your location is used for turn-by-turn navigation.';
|
|
@@ -197,7 +191,6 @@ ${colorEntries}
|
|
|
197
191
|
'Your location is used for turn-by-turn navigation even when the app is in the background.';
|
|
198
192
|
}
|
|
199
193
|
|
|
200
|
-
// Background modes required for navigation audio + location tracking
|
|
201
194
|
if (!mod.modResults.UIBackgroundModes) {
|
|
202
195
|
mod.modResults.UIBackgroundModes = [];
|
|
203
196
|
}
|