@jacques_gordon/expo-mapbox-navigation 2.1.4 → 2.1.5
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.
|
@@ -447,43 +447,32 @@ class ExpoMapboxNavigationView(context: Context, appContext: AppContext) :
|
|
|
447
447
|
voiceInstructionsPlayer = MapboxVoiceInstructionsPlayer(context, voiceLang)
|
|
448
448
|
}
|
|
449
449
|
|
|
450
|
-
// ── Voice callbacks
|
|
451
|
-
//
|
|
452
|
-
// speechCallback
|
|
453
|
-
|
|
454
|
-
|
|
450
|
+
// ── Voice callbacks — EXACT pattern from official TurnByTurnExperienceActivity ──
|
|
451
|
+
// MapboxNavigationConsumer is in com.mapbox.navigation.ui.base.util (NOT base.route)
|
|
452
|
+
// voiceInstructionsPlayerCallback must be defined BEFORE speechCallback (used inside it)
|
|
453
|
+
private val voiceInstructionsPlayerCallback =
|
|
454
|
+
com.mapbox.navigation.ui.base.util.MapboxNavigationConsumer<SpeechAnnouncement> { value ->
|
|
455
|
+
speechApi.clean(value)
|
|
456
|
+
}
|
|
457
|
+
|
|
455
458
|
private val speechCallback =
|
|
456
|
-
com.mapbox.navigation.base.
|
|
459
|
+
com.mapbox.navigation.ui.base.util.MapboxNavigationConsumer<
|
|
457
460
|
com.mapbox.bindgen.Expected<SpeechError, SpeechValue>
|
|
458
461
|
> { expected ->
|
|
459
462
|
expected.fold(
|
|
460
463
|
{ error ->
|
|
461
|
-
// On-device TTS fallback when MP3 is not available
|
|
462
464
|
if (!isMuted) {
|
|
463
|
-
voiceInstructionsPlayer.play(
|
|
464
|
-
error.fallback,
|
|
465
|
-
voiceInstructionsPlayerCallback
|
|
466
|
-
)
|
|
465
|
+
voiceInstructionsPlayer.play(error.fallback, voiceInstructionsPlayerCallback)
|
|
467
466
|
}
|
|
468
467
|
},
|
|
469
468
|
{ value ->
|
|
470
|
-
// Play the synthesized MP3 from Mapbox Voice API
|
|
471
469
|
if (!isMuted) {
|
|
472
|
-
voiceInstructionsPlayer.play(
|
|
473
|
-
value.announcement,
|
|
474
|
-
voiceInstructionsPlayerCallback
|
|
475
|
-
)
|
|
470
|
+
voiceInstructionsPlayer.play(value.announcement, voiceInstructionsPlayerCallback)
|
|
476
471
|
}
|
|
477
472
|
}
|
|
478
473
|
)
|
|
479
474
|
}
|
|
480
475
|
|
|
481
|
-
private val voiceInstructionsPlayerCallback =
|
|
482
|
-
{ announcement: SpeechAnnouncement ->
|
|
483
|
-
// Cleanup the file after playing
|
|
484
|
-
speechApi.clean(announcement)
|
|
485
|
-
}
|
|
486
|
-
|
|
487
476
|
private val voiceInstructionsObserver = VoiceInstructionsObserver { voiceInstructions ->
|
|
488
477
|
speechApi.generate(voiceInstructions, speechCallback)
|
|
489
478
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jacques_gordon/expo-mapbox-navigation",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
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",
|