Skip to content
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

[Android Auto] Remove MapboxNavigation from RoutePreviewCarContext #6226

Merged
merged 3 commits into from
Aug 25, 2022

Conversation

kmadsen
Copy link
Contributor

@kmadsen kmadsen commented Aug 25, 2022

Description

Addressing #6141

  • Migrate CarSpeedLimitRenderer to MapboxNavigationApp
  • CarRoutePreviewScreen can use MapboxNavigationApp.current() since it has single shot actions
  • GeoDeeplinkNavigateAction can use MapboxNavigationApp.current() since it has single shot actions

Skipping changelog because there is are no public api changes here.

The remaining migrations are a bit more ambiguous, this classes were some low hanging fruit.

@kmadsen kmadsen added the Android Auto Bugs, improvements and feature requests on Android Auto. label Aug 25, 2022
@kmadsen kmadsen requested a review from a team as a code owner August 25, 2022 00:57
@kmadsen kmadsen added the skip changelog Should not be added into version changelog. label Aug 25, 2022
@codecov
Copy link

codecov bot commented Aug 25, 2022

Codecov Report

Merging #6226 (edb9dfc) into main (0c1d2c7) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##               main    #6226   +/-   ##
=========================================
  Coverage     68.75%   68.75%           
  Complexity     4311     4311           
=========================================
  Files           649      649           
  Lines         26022    26022           
  Branches       3055     3055           
=========================================
  Hits          17891    17891           
  Misses         6971     6971           
  Partials       1160     1160           

carRoutesProvider.navigationRoutes.value
)
MapboxCarApp.updateCarAppState(ActiveGuidanceState)
MapboxNavigationApp.current()?.let { mapboxNavigation ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it is important to have mapboxNavigation here, should we use !! instead? Or at least log a warning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah.. thinking about this a bit and going with !!. Going to list a couple examples where a developer could create the crash. In particular, this crash could only happen because of 3. It is a small window of a crash, but we could potentially cure the 3 case with a reset function 🤔.

  1. If you current()!! before the setup
MapboxNavigationApp.current()!!.setNavigationRoutes(emptyList())
MapboxNavigationApp.setup(..)
  1. If you current()!! before the attach lifecycle onCreate is called
MapboxNavigationApp.attach(..)
MapboxNavigationApp.current()!!.setNavigationRoutes(emptyList())
  1. When you're in the middle of resetting options
val navigationOption = MapboxNavigationApp.current()!!.navigationOptions
MapboxNavigationApp.disable()
MapboxNavigationApp.current()!!.setNavigationRoutes(..)
MapboxNavigationApp.setup(navigationOption)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will merge here, but I think we should consider adding a ReadOnlyDelegate that makes it so current()!! is not a common practice

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the ReadOnlyDelegate #6233 😄

@kmadsen kmadsen merged commit 9073234 into main Aug 25, 2022
@kmadsen kmadsen deleted the km-remove-mapbox-navigation branch August 25, 2022 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Auto Bugs, improvements and feature requests on Android Auto. skip changelog Should not be added into version changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants