@jacques_gordon/expo-mapbox-navigation 1.0.5 → 1.0.7
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/README.md +6 -0
- 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 +1 -1
- package/plugin/index.js +6 -3
- package/plugin/index.ts +0 -186
package/README.md
CHANGED
|
@@ -38,6 +38,12 @@ La version recommandée est `11.11.0`. **Important : définir explicitement `RNM
|
|
|
38
38
|
npm install @jacques_gordon/expo-mapbox-navigation
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
Et additionnellement le package (parfois optionnelle)
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install metro-cache-key
|
|
45
|
+
```
|
|
46
|
+
|
|
41
47
|
### 3. Configurer le plugin dans `app.json`
|
|
42
48
|
|
|
43
49
|
```json
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#
|
|
1
|
+
#Sun Jun 28 07:35:13 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.7'
|
|
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.7",
|
|
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",
|
package/plugin/index.js
CHANGED
|
@@ -157,8 +157,11 @@ ${colorResources}
|
|
|
157
157
|
return config;
|
|
158
158
|
};
|
|
159
159
|
|
|
160
|
-
|
|
160
|
+
const plugin = createRunOncePlugin(
|
|
161
161
|
withExpoMapboxNavigation,
|
|
162
162
|
"expo-mapbox-navigation",
|
|
163
|
-
"1.0.
|
|
164
|
-
);
|
|
163
|
+
"1.0.7"
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
module.exports = plugin;
|
|
167
|
+
module.exports.default = plugin;
|
package/plugin/index.ts
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConfigPlugin,
|
|
3
|
-
withInfoPlist,
|
|
4
|
-
withAppBuildGradle,
|
|
5
|
-
withProjectBuildGradle,
|
|
6
|
-
withAndroidManifest,
|
|
7
|
-
createRunOncePlugin,
|
|
8
|
-
} from '@expo/config-plugins';
|
|
9
|
-
|
|
10
|
-
export interface ExpoMapboxNavigationPluginOptions {
|
|
11
|
-
/** Token public Mapbox (commence par pk.) */
|
|
12
|
-
accessToken: string;
|
|
13
|
-
/**
|
|
14
|
-
* Version du SDK Mapbox Maps (doit correspondre à la version utilisée par @rnmapbox/maps).
|
|
15
|
-
* Exemple: "11.11.0"
|
|
16
|
-
*/
|
|
17
|
-
mapboxMapsVersion?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Overrides de couleurs Android pour personnaliser l'UI Mapbox.
|
|
20
|
-
* Exemple: { "mapbox_main_maneuver_background_color": "#FF0000" }
|
|
21
|
-
*/
|
|
22
|
-
androidColorOverrides?: Record<string, string>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const withExpoMapboxNavigation: ConfigPlugin<ExpoMapboxNavigationPluginOptions> = (
|
|
26
|
-
config,
|
|
27
|
-
options
|
|
28
|
-
) => {
|
|
29
|
-
const { accessToken, mapboxMapsVersion = '11.11.0', androidColorOverrides = {} } = options;
|
|
30
|
-
|
|
31
|
-
if (!accessToken) {
|
|
32
|
-
throw new Error(
|
|
33
|
-
'[expo-mapbox-navigation] accessToken est requis dans la configuration du plugin.'
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// ── iOS — Info.plist ──────────────────────────────────────────────────────
|
|
38
|
-
|
|
39
|
-
config = withInfoPlist(config, (cfg) => {
|
|
40
|
-
cfg.modResults['MBXAccessToken'] = accessToken;
|
|
41
|
-
|
|
42
|
-
cfg.modResults['NSLocationWhenInUseUsageDescription'] =
|
|
43
|
-
cfg.modResults['NSLocationWhenInUseUsageDescription'] ??
|
|
44
|
-
'Cette application utilise votre position pour la navigation GPS.';
|
|
45
|
-
|
|
46
|
-
cfg.modResults['NSLocationAlwaysAndWhenInUseUsageDescription'] =
|
|
47
|
-
cfg.modResults['NSLocationAlwaysAndWhenInUseUsageDescription'] ??
|
|
48
|
-
"Cette application utilise votre position en arrière-plan pour la navigation GPS.";
|
|
49
|
-
|
|
50
|
-
cfg.modResults['NSMotionUsageDescription'] =
|
|
51
|
-
cfg.modResults['NSMotionUsageDescription'] ??
|
|
52
|
-
"Cette application utilise le capteur de mouvement pour améliorer la navigation.";
|
|
53
|
-
|
|
54
|
-
// Background modes: audio (voix) + location
|
|
55
|
-
const uiBackgroundModes: string[] = cfg.modResults['UIBackgroundModes'] ?? [];
|
|
56
|
-
if (!uiBackgroundModes.includes('audio')) uiBackgroundModes.push('audio');
|
|
57
|
-
if (!uiBackgroundModes.includes('location')) uiBackgroundModes.push('location');
|
|
58
|
-
cfg.modResults['UIBackgroundModes'] = uiBackgroundModes;
|
|
59
|
-
|
|
60
|
-
return cfg;
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
// ── Android — project build.gradle (repo Maven Mapbox) ───────────────────
|
|
64
|
-
|
|
65
|
-
config = withProjectBuildGradle(config, (cfg) => {
|
|
66
|
-
if (!cfg.modResults.contents.includes('api.mapbox.com/downloads')) {
|
|
67
|
-
// Ajouter le repo Mapbox dans allprojects > repositories
|
|
68
|
-
cfg.modResults.contents = cfg.modResults.contents.replace(
|
|
69
|
-
/allprojects\s*\{([\s\S]*?)repositories\s*\{/,
|
|
70
|
-
`allprojects {$1repositories {
|
|
71
|
-
maven {
|
|
72
|
-
url 'https://api.mapbox.com/downloads/v2/releases/maven'
|
|
73
|
-
authentication { basic(BasicAuthentication) }
|
|
74
|
-
credentials {
|
|
75
|
-
username = "mapbox"
|
|
76
|
-
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: System.getenv("MAPBOX_DOWNLOADS_TOKEN") ?: ""
|
|
77
|
-
}
|
|
78
|
-
}`
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
return cfg;
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
// ── Android — app build.gradle (token + version maps) ────────────────────
|
|
85
|
-
|
|
86
|
-
config = withAppBuildGradle(config, (cfg) => {
|
|
87
|
-
// Injecter le token Mapbox public comme ressource string
|
|
88
|
-
if (!cfg.modResults.contents.includes('mapbox_access_token')) {
|
|
89
|
-
cfg.modResults.contents = cfg.modResults.contents.replace(
|
|
90
|
-
/defaultConfig\s*\{/,
|
|
91
|
-
`defaultConfig {
|
|
92
|
-
resValue "string", "mapbox_access_token", "${accessToken}"`
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Injecter RNMapboxMapsVersion (requis par @rnmapbox/maps)
|
|
97
|
-
if (
|
|
98
|
-
mapboxMapsVersion &&
|
|
99
|
-
!cfg.modResults.contents.includes('RNMapboxMapsVersion')
|
|
100
|
-
) {
|
|
101
|
-
cfg.modResults.contents = cfg.modResults.contents.replace(
|
|
102
|
-
/ext\s*\{/,
|
|
103
|
-
`ext {
|
|
104
|
-
RNMapboxMapsVersion = "${mapboxMapsVersion}"`
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
// Si pas de bloc ext, en créer un
|
|
108
|
-
if (!cfg.modResults.contents.includes('RNMapboxMapsVersion')) {
|
|
109
|
-
cfg.modResults.contents = cfg.modResults.contents.replace(
|
|
110
|
-
/^(buildscript\s*\{)/m,
|
|
111
|
-
`ext {
|
|
112
|
-
RNMapboxMapsVersion = "${mapboxMapsVersion}"
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
$1`
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// Générer les color overrides Android
|
|
121
|
-
if (Object.keys(androidColorOverrides).length > 0) {
|
|
122
|
-
const colorResources = Object.entries(androidColorOverrides)
|
|
123
|
-
.map(([name, value]) => ` resValue "color", "${name}", "${value}"`)
|
|
124
|
-
.join('\n');
|
|
125
|
-
|
|
126
|
-
if (!cfg.modResults.contents.includes('androidColorOverrides_injected')) {
|
|
127
|
-
cfg.modResults.contents = cfg.modResults.contents.replace(
|
|
128
|
-
/defaultConfig\s*\{/,
|
|
129
|
-
`defaultConfig {
|
|
130
|
-
${colorResources}
|
|
131
|
-
// androidColorOverrides_injected`
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return cfg;
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
// ── Android — Manifest (permissions) ─────────────────────────────────────
|
|
140
|
-
|
|
141
|
-
config = withAndroidManifest(config, (cfg) => {
|
|
142
|
-
const manifest = cfg.modResults.manifest;
|
|
143
|
-
const permissions: any[] = manifest['uses-permission'] ?? [];
|
|
144
|
-
|
|
145
|
-
const addPermission = (name: string) => {
|
|
146
|
-
if (!permissions.some((p: any) => p.$?.['android:name'] === name)) {
|
|
147
|
-
permissions.push({ $: { 'android:name': name } });
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
addPermission('android.permission.ACCESS_FINE_LOCATION');
|
|
152
|
-
addPermission('android.permission.ACCESS_COARSE_LOCATION');
|
|
153
|
-
addPermission('android.permission.FOREGROUND_SERVICE');
|
|
154
|
-
addPermission('android.permission.FOREGROUND_SERVICE_LOCATION');
|
|
155
|
-
|
|
156
|
-
manifest['uses-permission'] = permissions;
|
|
157
|
-
|
|
158
|
-
// Ajouter le token Mapbox dans les métadonnées de l'application
|
|
159
|
-
const application = manifest.application?.[0];
|
|
160
|
-
if (application) {
|
|
161
|
-
const metaData: any[] = application['meta-data'] ?? [];
|
|
162
|
-
const existingToken = metaData.find(
|
|
163
|
-
(m: any) => m.$?.['android:name'] === 'com.mapbox.token'
|
|
164
|
-
);
|
|
165
|
-
if (!existingToken) {
|
|
166
|
-
metaData.push({
|
|
167
|
-
$: {
|
|
168
|
-
'android:name': 'com.mapbox.token',
|
|
169
|
-
'android:value': accessToken,
|
|
170
|
-
},
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
application['meta-data'] = metaData;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return cfg;
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
return config;
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
export default createRunOncePlugin(
|
|
183
|
-
withExpoMapboxNavigation,
|
|
184
|
-
'expo-mapbox-navigation',
|
|
185
|
-
'1.0.4'
|
|
186
|
-
);
|