-
Notifications
You must be signed in to change notification settings - Fork 319
Update audio guidance for AA compatibility #6336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
79a27f0 to
537a692
Compare
|
EDIT: Solution here is to temporarily depend on the project rather than the version Running into an issue from this approach #6316 It works fine while debugging but the incompatibility is still caught |
537a692 to
7688b8d
Compare
|
Converting to a draft because we need to release a new version of andriodauto before we can proceed here It looks like we also need to make an incompatible change in order to handle the nav-sdk changes. In other words, after this merges we will need a nav-sdk release so that AA can become compatible. Migrating to public apis should make it so this is the last time we need to do this. Will open this one back up for review after this #6343. That way we can start working on |
151631f to
99dbd2e
Compare
Codecov Report
@@ Coverage Diff @@
## main #6336 +/- ##
============================================
+ Coverage 68.88% 68.91% +0.03%
- Complexity 4504 4517 +13
============================================
Files 681 682 +1
Lines 27002 27010 +8
Branches 3162 3168 +6
============================================
+ Hits 18601 18615 +14
+ Misses 7182 7176 -6
Partials 1219 1219
|
d9955b7 to
c0f348a
Compare
tomaszrybakiewicz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great initiative. Left a couple of comments.
While we are on the topic of the MapboxAudioGuidance interface, what do you think about simplifying it to just?
interface MapboxAudioGuidance : MapboxNavigationObserver {
val state: StateFlow<State>
fun setMuted(muted: Boolean)
/**
* Accessed through [state].
*/
interface State {
/**
* When the trip session has started, and there is an active route.
*/
val isPlayable: Boolean
/**
* Unrelated to the navigation state, provides state of
* the controls [mute] [unmute] [toggle]
*/
val isMuted: Boolean
/**
* Once a voice instruction becomes available this will not be null.
* When the state [isPlayable] and this is null, it means there are no voice instructions
* on the route at this time.
*/
val voiceInstructions: VoiceInstructions?
/**
* After a [voiceInstructions] has been announced, this value will be emitted.
* This will always be null when [isMuted] is true.
*/
val speechAnnouncement: SpeechAnnouncement?
}
}
libnavui-voice/src/main/java/com/mapbox/navigation/ui/voice/api/MapboxAudioGuidance.kt
Show resolved
Hide resolved
| ) : MapboxNavigationObserver { | ||
|
|
||
| var dataStoreOwner: NavigationDataStoreOwner? = null | ||
| constructor() : this(MapboxAudioGuidanceServices(), Dispatchers.Main) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make all constructors internal and offer a factory to instantiate the default MapboxAudioGuidance implementation. Doing so will allow us to replace MapboxAudioGuidanceImpl when needed without breaking compatibility.
object MapboxAudioGuidanceProvider {
fun create(): MapboxAudioGuidance =
MapboxAudioGuidanceImpl(MapboxAudioGuidanceServices(), Dispatchers.Main)
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's an idea but i like the empty constructor for public api. this will still allow us to delegate the internals when/if we want. But the MapboxAudioGuidanceImpl is deleted after merging the interface. All for better backwards compatibility in the public api.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tomaszrybakiewicz how about this, added a couple companion functions to make it clear what the intended usage is. Moved the constructor to private
MapboxAudioGuidance {
..
companion object {
fun create(): MapboxAudioGuidance ...
fun getInstance(): MapboxAudioGuidance = MapboxNavigationApp
.getObservers(MapboxAudioGuidance::class)
.firstOrNull() ?: create()
.also { MapboxNavigationApp.registerObserver(it) }
Removing the interface in favor of a class to be able to handle backwards compatibility. Customization will be handled by adding new functions rather than proposing inheritance. Which is more consistent with the rest of the sdk. As for the change from Lines 117 to 130 in 8df22ed
|
9f7e36c to
ddbd4e7
Compare
|
When running this branch and starting cc @kmadsen |
|
Out of curiosity, we are introducing |
Thanks for catching! I didn't fix Using |
I'm not seeing a need for the |
b755ba6 to
8265dd0
Compare
@abhishek1508 Not entirely sure why Refs to previous work: |

Description
Fixes NAVAND-628
AA and the nav-sdk work on different release channels. In order to support long term backwards compatibility, AA will only use public apis from the nav-sdk.
MapboxAudioGuidanceis an internal api, so this moves it out into the public. Looking to make this part of the 2.9 release train, and the alpha release starts today.Some related issues and pull requests that this change is addressing
Code samples
Here are some samples of the interactions.
Lower level interactions are available, but you need to know what you're doing.