mapbox-navigation-android icon indicating copy to clipboard operation
mapbox-navigation-android copied to clipboard

[Android Auto] Simplify search implementation

Open kmadsen opened this issue 3 years ago • 3 comments

Description

Resolves https://github.com/mapbox/mapbox-navigation-android/issues/6154

Defining an api for search that works simple and by default. This adds the CarPlaceSearchOptions as something that can be overridden so that we can declare a stable api for supporting a place search screen.

I'm also moving CarSearchLocationProvider from the qa-test-app into the :libnavui-androidauto internal packages. That way it can be deleted from the examples

Code sample

When building the MainCarContext from the MainCarScreen, you can specify an access token for search like this. If none is specified, the MapboxNavigation access token will be used.

val mainCarContext = MainCarContext(
    carContext = carContext,
    mapboxCarMap = mapboxCarMap,
    carPlaceSearchOptions = CarPlaceSearchOptions.Builder()
        .accessToken(mySearchAccessToken)
        .build()
)

kmadsen avatar Aug 13 '22 00:08 kmadsen

Codecov Report

Merging #6165 (a3c5418) into main (d8d04fe) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##               main    #6165   +/-   ##
=========================================
  Coverage     68.89%   68.89%           
  Complexity     4255     4255           
=========================================
  Files           639      639           
  Lines         25643    25643           
  Branches       3003     3003           
=========================================
  Hits          17668    17668           
  Misses         6828     6828           
  Partials       1147     1147           

codecov[bot] avatar Aug 13 '22 01:08 codecov[bot]

Also noting that unit-tests-androidauto are ❌

> Task :libnavui-androidauto:compileDebugUnitTestKotlin FAILED
e: /root/code/libnavui-androidauto/src/test/java/com/******/androidauto/car/search/SearchScreenTest.kt: (23, 17): Unresolved reference: carPlaceSearchApi
e: /root/code/libnavui-androidauto/src/test/java/com/******/androidauto/car/search/SearchScreenTest.kt: (63, 30): Unresolved reference: carPlaceSearchApi

FAILURE: Build failed with an exception.

Guardiola31337 avatar Aug 15 '22 08:08 Guardiola31337

Added some more tests for the internal implementation CarPlaceSearchImplTest

kmadsen avatar Aug 15 '22 21:08 kmadsen