Skip to content

Commit 0b03a78

Browse files
korshaknnabhishek1508
authored andcommitted
expose voiceInstructionsPlayer in drop-in
1 parent c8ca9a4 commit 0b03a78

File tree

7 files changed

+21
-1
lines changed

7 files changed

+21
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Mapbox welcomes participation and contributions from everyone.
1717
- Fixed an issue with `NavigationView` that caused unexpected camera movements when switching between navigation states. [#6487](https://github.com/mapbox/mapbox-navigation-android/pull/6487)
1818
- Supported changing `MapboxVoiceInstructionsPlayer` language in runtime via `updateLanguage` method. [#6491](https://github.com/mapbox/mapbox-navigation-android/pull/6491)
1919
- Deprecated `MapboxVoiceInstructionsPlayer` constructors that accept access token and introduced the ones without it. [#6491](https://github.com/mapbox/mapbox-navigation-android/pull/6491)
20+
- Updated `NavigationViewApi` and `MapboxAudioGuidance`. Introduced `currentVoiceInstructionsPlayer` which allows playing customers voice instructions. [#6475](https://github.com/mapbox/mapbox-navigation-android/pull/6475)
2021

2122
## Mapbox Navigation SDK 2.9.0-beta.2 - 14 October, 2022
2223
### Changelog

libnavui-dropin/api/current.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ package com.mapbox.navigation.dropin {
3737

3838
@UiThread @com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public abstract class NavigationViewApi {
3939
ctor public NavigationViewApi();
40+
method public abstract com.mapbox.navigation.ui.voice.api.MapboxVoiceInstructionsPlayer? getCurrentVoiceInstructionsPlayer();
4041
method public abstract boolean isReplayEnabled();
4142
method public abstract void routeReplayEnabled(boolean enabled);
4243
method public abstract com.mapbox.bindgen.Expected<com.mapbox.navigation.dropin.NavigationViewApiError,kotlin.Unit> startActiveGuidance();
@@ -47,6 +48,7 @@ package com.mapbox.navigation.dropin {
4748
method public abstract void startFreeDrive();
4849
method public abstract com.mapbox.bindgen.Expected<com.mapbox.navigation.dropin.NavigationViewApiError,kotlin.Unit> startRoutePreview();
4950
method public abstract com.mapbox.bindgen.Expected<com.mapbox.navigation.dropin.NavigationViewApiError,kotlin.Unit> startRoutePreview(java.util.List<com.mapbox.navigation.base.route.NavigationRoute> routes);
51+
property public abstract com.mapbox.navigation.ui.voice.api.MapboxVoiceInstructionsPlayer? currentVoiceInstructionsPlayer;
5052
}
5153

5254
public final class NavigationViewApiError extends java.lang.Throwable {

libnavui-dropin/src/main/java/com/mapbox/navigation/dropin/NavigationViewApi.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import com.mapbox.bindgen.Expected
88
import com.mapbox.geojson.Point
99
import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI
1010
import com.mapbox.navigation.base.route.NavigationRoute
11+
import com.mapbox.navigation.ui.voice.api.MapboxVoiceInstructionsPlayer
1112

1213
/**
1314
* Api that gives you the ability to change the state for navigation apps.
@@ -112,4 +113,9 @@ abstract class NavigationViewApi {
112113
* Enable/Disable replay trip session based on simulated locations.
113114
*/
114115
abstract fun routeReplayEnabled(enabled: Boolean)
116+
117+
/**
118+
* Current instance of a voice instructions player.
119+
*/
120+
abstract val currentVoiceInstructionsPlayer: MapboxVoiceInstructionsPlayer?
115121
}

libnavui-dropin/src/main/java/com/mapbox/navigation/dropin/navigationview/MapboxNavigationViewApi.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import com.mapbox.navigation.ui.app.internal.showRoutePreview
1919
import com.mapbox.navigation.ui.app.internal.startActiveNavigation
2020
import com.mapbox.navigation.ui.app.internal.startArrival
2121
import com.mapbox.navigation.ui.app.internal.tripsession.TripSessionStarterAction
22+
import com.mapbox.navigation.ui.voice.api.MapboxAudioGuidance
2223

2324
@ExperimentalPreviewMapboxNavigationAPI
2425
internal class MapboxNavigationViewApi(
@@ -100,6 +101,9 @@ internal class MapboxNavigationViewApi(
100101
}
101102
}
102103

104+
override val currentVoiceInstructionsPlayer
105+
get() = MapboxAudioGuidance.getRegisteredInstance().currentVoiceInstructionsPlayer
106+
103107
@Throws(NavigationViewApiError::class)
104108
private fun checkDestination() {
105109
if (store.state.value.destination == null) {

libnavui-voice/api/current.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ package com.mapbox.navigation.ui.voice.api {
2323

2424
public final class MapboxAudioGuidance implements com.mapbox.navigation.core.lifecycle.MapboxNavigationObserver {
2525
method public static com.mapbox.navigation.ui.voice.api.MapboxAudioGuidance create();
26+
method public com.mapbox.navigation.ui.voice.api.MapboxVoiceInstructionsPlayer? getCurrentVoiceInstructionsPlayer();
2627
method public static com.mapbox.navigation.ui.voice.api.MapboxAudioGuidance getRegisteredInstance();
2728
method public void mute();
2829
method public void onAttached(com.mapbox.navigation.core.MapboxNavigation mapboxNavigation);
2930
method public void onDetached(com.mapbox.navigation.core.MapboxNavigation mapboxNavigation);
3031
method public kotlinx.coroutines.flow.StateFlow<com.mapbox.navigation.ui.voice.api.MapboxAudioGuidanceState> stateFlow();
3132
method public void toggle();
3233
method public void unmute();
34+
property public final com.mapbox.navigation.ui.voice.api.MapboxVoiceInstructionsPlayer? currentVoiceInstructionsPlayer;
3335
field public static final com.mapbox.navigation.ui.voice.api.MapboxAudioGuidance.Companion Companion;
3436
}
3537

libnavui-voice/src/main/java/com/mapbox/navigation/ui/voice/api/MapboxAudioGuidance.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ internal constructor(
4949

5050
private var job: Job? = null
5151

52+
/**
53+
* Current instance of a [VoiceInstructionsPlayer].
54+
*/
55+
val currentVoiceInstructionsPlayer get() = audioGuidanceServices.voiceInstructionsPlayer
56+
5257
/**
5358
* @see [MapboxNavigationApp]
5459
*/

libnavui-voice/src/main/java/com/mapbox/navigation/ui/voice/internal/impl/MapboxAudioGuidanceServices.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import com.mapbox.navigation.ui.voice.internal.MapboxVoiceInstructions
1111

1212
class MapboxAudioGuidanceServices {
1313

14-
private var voiceInstructionsPlayer: MapboxVoiceInstructionsPlayer? = null
14+
var voiceInstructionsPlayer: MapboxVoiceInstructionsPlayer? = null
1515

1616
fun mapboxAudioGuidanceVoice(
1717
mapboxNavigation: MapboxNavigation,

0 commit comments

Comments
 (0)