@jacques_gordon/expo-mapbox-navigation 1.0.7 → 1.0.8
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/.gradle/9.2.0/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/ios/ExpoMapboxNavigation.podspec +1 -1
- package/package.json +2 -2
- package/plugin/index.js +109 -109
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#Sun Jun 28
|
|
1
|
+
#Sun Jun 28 09:52:58 CEST 2026
|
|
2
2
|
gradle.version=8.9
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Pod::Spec.new do |s|
|
|
2
2
|
s.name = 'ExpoMapboxNavigation'
|
|
3
|
-
s.version = '1.0.
|
|
3
|
+
s.version = '1.0.0'
|
|
4
4
|
s.summary = 'Expo module for Mapbox turn-by-turn navigation — iOS & Android'
|
|
5
5
|
s.homepage = 'https://github.com/YOUR_GITHUB/expo-mapbox-navigation'
|
|
6
6
|
s.license = { :type => 'MIT' }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jacques_gordon/expo-mapbox-navigation",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Expo module for Mapbox turn-by-turn navigation — iOS & Android, compatible with Expo SDK 53 Dev Client",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"repository": {
|
|
36
36
|
"type": "git",
|
|
37
|
-
"url": "https://github.com/jacquesngomeheffa/expo-mapbox-navigation.git"
|
|
37
|
+
"url": "git+https://github.com/jacquesngomeheffa/expo-mapbox-navigation.git"
|
|
38
38
|
},
|
|
39
39
|
"bugs": {
|
|
40
40
|
"url": "https://github.com/jacquesngomeheffa/expo-mapbox-navigation/issues"
|
package/plugin/index.js
CHANGED
|
@@ -3,53 +3,16 @@ const {
|
|
|
3
3
|
withAppBuildGradle,
|
|
4
4
|
withProjectBuildGradle,
|
|
5
5
|
withAndroidManifest,
|
|
6
|
+
withDangerousMod,
|
|
6
7
|
createRunOncePlugin,
|
|
7
|
-
} = require(
|
|
8
|
+
} = require('@expo/config-plugins');
|
|
8
9
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
accessToken,
|
|
12
|
-
mapboxMapsVersion = "11.11.0",
|
|
13
|
-
androidColorOverrides = {},
|
|
14
|
-
} = options || {};
|
|
15
|
-
|
|
16
|
-
if (!accessToken) {
|
|
17
|
-
throw new Error(
|
|
18
|
-
"[expo-mapbox-navigation] accessToken est requis dans la configuration du plugin."
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// ── iOS ──
|
|
23
|
-
config = withInfoPlist(config, (cfg) => {
|
|
24
|
-
cfg.modResults["MBXAccessToken"] = accessToken;
|
|
25
|
-
|
|
26
|
-
cfg.modResults["NSLocationWhenInUseUsageDescription"] =
|
|
27
|
-
cfg.modResults["NSLocationWhenInUseUsageDescription"] ??
|
|
28
|
-
"Cette application utilise votre position pour la navigation GPS.";
|
|
29
|
-
|
|
30
|
-
cfg.modResults["NSLocationAlwaysAndWhenInUseUsageDescription"] =
|
|
31
|
-
cfg.modResults["NSLocationAlwaysAndWhenInUseUsageDescription"] ??
|
|
32
|
-
"Cette application utilise votre position en arrière-plan pour la navigation GPS.";
|
|
33
|
-
|
|
34
|
-
cfg.modResults["NSMotionUsageDescription"] =
|
|
35
|
-
cfg.modResults["NSMotionUsageDescription"] ??
|
|
36
|
-
"Cette application utilise le capteur de mouvement pour améliorer la navigation.";
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const path = require('path');
|
|
37
12
|
|
|
38
|
-
|
|
39
|
-
if (!uiBackgroundModes.includes("audio")) uiBackgroundModes.push("audio");
|
|
40
|
-
if (!uiBackgroundModes.includes("location"))
|
|
41
|
-
uiBackgroundModes.push("location");
|
|
42
|
-
cfg.modResults["UIBackgroundModes"] = uiBackgroundModes;
|
|
13
|
+
// ─── Mapbox Maven block ────────────────────────────────────────────────
|
|
43
14
|
|
|
44
|
-
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
// ── Android project build.gradle ──
|
|
48
|
-
config = withProjectBuildGradle(config, (cfg) => {
|
|
49
|
-
if (!cfg.modResults.contents.includes("api.mapbox.com/downloads")) {
|
|
50
|
-
cfg.modResults.contents = cfg.modResults.contents.replace(
|
|
51
|
-
/allprojects\s*\{([\s\S]*?)repositories\s*\{/,
|
|
52
|
-
`allprojects {$1repositories {
|
|
15
|
+
const MAPBOX_MAVEN_BLOCK = `
|
|
53
16
|
maven {
|
|
54
17
|
url 'https://api.mapbox.com/downloads/v2/releases/maven'
|
|
55
18
|
authentication { basic(BasicAuthentication) }
|
|
@@ -57,98 +20,135 @@ const withExpoMapboxNavigation = (config, options) => {
|
|
|
57
20
|
username = "mapbox"
|
|
58
21
|
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: System.getenv("MAPBOX_DOWNLOADS_TOKEN") ?: ""
|
|
59
22
|
}
|
|
60
|
-
}`
|
|
61
|
-
);
|
|
62
23
|
}
|
|
63
|
-
|
|
64
|
-
});
|
|
24
|
+
`;
|
|
65
25
|
|
|
66
|
-
|
|
67
|
-
config = withAppBuildGradle(config, (cfg) => {
|
|
68
|
-
if (!cfg.modResults.contents.includes("mapbox_access_token")) {
|
|
69
|
-
cfg.modResults.contents = cfg.modResults.contents.replace(
|
|
70
|
-
/defaultConfig\s*\{/,
|
|
71
|
-
`defaultConfig {
|
|
72
|
-
resValue "string", "mapbox_access_token", "${accessToken}"`
|
|
73
|
-
);
|
|
74
|
-
}
|
|
26
|
+
// ─── Inject into settings.gradle (SDK 53 FIX) ───────────────────────────
|
|
75
27
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
RNMapboxMapsVersion = "${mapboxMapsVersion}"`
|
|
28
|
+
const withMapboxMavenInSettings = (config) => {
|
|
29
|
+
return withDangerousMod(config, [
|
|
30
|
+
'android',
|
|
31
|
+
async (cfg) => {
|
|
32
|
+
const settingsPath = path.join(
|
|
33
|
+
cfg.modRequest.platformProjectRoot,
|
|
34
|
+
'settings.gradle'
|
|
84
35
|
);
|
|
85
36
|
|
|
86
|
-
if (!
|
|
87
|
-
cfg.modResults.contents = cfg.modResults.contents.replace(
|
|
88
|
-
/^(buildscript\s*\{)/m,
|
|
89
|
-
`ext {
|
|
90
|
-
RNMapboxMapsVersion = "${mapboxMapsVersion}"
|
|
91
|
-
}
|
|
37
|
+
if (!fs.existsSync(settingsPath)) return cfg;
|
|
92
38
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
39
|
+
let contents = fs.readFileSync(settingsPath, 'utf8');
|
|
40
|
+
|
|
41
|
+
if (contents.includes('api.mapbox.com/downloads')) return cfg;
|
|
97
42
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (!cfg.modResults.contents.includes("androidColorOverrides_injected")) {
|
|
104
|
-
cfg.modResults.contents = cfg.modResults.contents.replace(
|
|
105
|
-
/defaultConfig\s*\{/,
|
|
106
|
-
`defaultConfig {
|
|
107
|
-
${colorResources}
|
|
108
|
-
// androidColorOverrides_injected`
|
|
43
|
+
if (contents.includes('dependencyResolutionManagement')) {
|
|
44
|
+
contents = contents.replace(
|
|
45
|
+
/dependencyResolutionManagement\s*\{([\s\S]*?)repositories\s*\{/,
|
|
46
|
+
`dependencyResolutionManagement {$1repositories {${MAPBOX_MAVEN_BLOCK}`
|
|
109
47
|
);
|
|
48
|
+
} else if (contents.includes('allprojects')) {
|
|
49
|
+
contents = contents.replace(
|
|
50
|
+
/allprojects\s*\{([\s\S]*?)repositories\s*\{/,
|
|
51
|
+
`allprojects {$1repositories {${MAPBOX_MAVEN_BLOCK}`
|
|
52
|
+
);
|
|
53
|
+
} else {
|
|
54
|
+
contents += `
|
|
55
|
+
allprojects {
|
|
56
|
+
repositories {${MAPBOX_MAVEN_BLOCK}
|
|
57
|
+
}
|
|
58
|
+
}`;
|
|
110
59
|
}
|
|
111
|
-
|
|
60
|
+
|
|
61
|
+
fs.writeFileSync(settingsPath, contents);
|
|
62
|
+
return cfg;
|
|
63
|
+
},
|
|
64
|
+
]);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// ─── Plugin ─────────────────────────────────────────────────────────────
|
|
68
|
+
|
|
69
|
+
const withExpoMapboxNavigation = (config, options) => {
|
|
70
|
+
const {
|
|
71
|
+
accessToken,
|
|
72
|
+
mapboxMapsVersion = '11.11.0',
|
|
73
|
+
androidColorOverrides = {},
|
|
74
|
+
} = options;
|
|
75
|
+
|
|
76
|
+
if (!accessToken) {
|
|
77
|
+
throw new Error('[expo-mapbox-navigation] accessToken is required');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// ── iOS ───────────────────────────────────────────────────────────────
|
|
81
|
+
config = withInfoPlist(config, (cfg) => {
|
|
82
|
+
cfg.modResults.MBXAccessToken = accessToken;
|
|
83
|
+
|
|
84
|
+
cfg.modResults.NSLocationWhenInUseUsageDescription =
|
|
85
|
+
cfg.modResults.NSLocationWhenInUseUsageDescription ??
|
|
86
|
+
'Navigation GPS requires location access.';
|
|
87
|
+
|
|
88
|
+
cfg.modResults.NSLocationAlwaysAndWhenInUseUsageDescription =
|
|
89
|
+
cfg.modResults.NSLocationAlwaysAndWhenInUseUsageDescription ??
|
|
90
|
+
'Background navigation requires location access.';
|
|
91
|
+
|
|
92
|
+
cfg.modResults.NSMotionUsageDescription =
|
|
93
|
+
cfg.modResults.NSMotionUsageDescription ??
|
|
94
|
+
'Motion is used to improve navigation experience.';
|
|
95
|
+
|
|
96
|
+
const modes = cfg.modResults.UIBackgroundModes || [];
|
|
97
|
+
if (!modes.includes('audio')) modes.push('audio');
|
|
98
|
+
if (!modes.includes('location')) modes.push('location');
|
|
99
|
+
cfg.modResults.UIBackgroundModes = modes;
|
|
112
100
|
|
|
113
101
|
return cfg;
|
|
114
102
|
});
|
|
115
103
|
|
|
116
|
-
// ── Android
|
|
104
|
+
// ── Android settings.gradle FIX (IMPORTANT SDK 53) ────────────────────
|
|
105
|
+
config = withMapboxMavenInSettings(config);
|
|
106
|
+
|
|
107
|
+
// ── Android Manifest ──────────────────────────────────────────────────
|
|
117
108
|
config = withAndroidManifest(config, (cfg) => {
|
|
118
109
|
const manifest = cfg.modResults.manifest;
|
|
119
|
-
const permissions = manifest[
|
|
110
|
+
const permissions = manifest['uses-permission'] || [];
|
|
120
111
|
|
|
121
|
-
const
|
|
122
|
-
if (!permissions.
|
|
123
|
-
permissions.push({ $: {
|
|
112
|
+
const add = (name) => {
|
|
113
|
+
if (!permissions.find((p) => p.$?.['android:name'] === name)) {
|
|
114
|
+
permissions.push({ $: { 'android:name': name } });
|
|
124
115
|
}
|
|
125
116
|
};
|
|
126
117
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
manifest["uses-permission"] = permissions;
|
|
118
|
+
add('android.permission.ACCESS_FINE_LOCATION');
|
|
119
|
+
add('android.permission.ACCESS_COARSE_LOCATION');
|
|
120
|
+
add('android.permission.FOREGROUND_SERVICE');
|
|
121
|
+
add('android.permission.FOREGROUND_SERVICE_LOCATION');
|
|
133
122
|
|
|
134
|
-
|
|
135
|
-
if (application) {
|
|
136
|
-
const metaData = application["meta-data"] ?? [];
|
|
123
|
+
manifest['uses-permission'] = permissions;
|
|
137
124
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
125
|
+
const app = manifest.application?.[0];
|
|
126
|
+
if (app) {
|
|
127
|
+
const meta = app['meta-data'] || [];
|
|
141
128
|
|
|
142
|
-
if (!
|
|
143
|
-
|
|
129
|
+
if (!meta.find((m) => m.$?.['android:name'] === 'com.mapbox.token')) {
|
|
130
|
+
meta.push({
|
|
144
131
|
$: {
|
|
145
|
-
|
|
146
|
-
|
|
132
|
+
'android:name': 'com.mapbox.token',
|
|
133
|
+
'android:value': accessToken,
|
|
147
134
|
},
|
|
148
135
|
});
|
|
149
136
|
}
|
|
150
137
|
|
|
151
|
-
|
|
138
|
+
app['meta-data'] = meta;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return cfg;
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// ── App build.gradle ──────────────────────────────────────────────────
|
|
145
|
+
config = withAppBuildGradle(config, (cfg) => {
|
|
146
|
+
if (!cfg.modResults.contents.includes('mapbox_access_token')) {
|
|
147
|
+
cfg.modResults.contents = cfg.modResults.contents.replace(
|
|
148
|
+
/defaultConfig\s*\{/,
|
|
149
|
+
`defaultConfig {
|
|
150
|
+
resValue "string", "mapbox_access_token", "${accessToken}"`
|
|
151
|
+
);
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
return cfg;
|
|
@@ -160,7 +160,7 @@ ${colorResources}
|
|
|
160
160
|
const plugin = createRunOncePlugin(
|
|
161
161
|
withExpoMapboxNavigation,
|
|
162
162
|
"expo-mapbox-navigation",
|
|
163
|
-
"1.0.
|
|
163
|
+
"1.0.8"
|
|
164
164
|
);
|
|
165
165
|
|
|
166
166
|
module.exports = plugin;
|