@iternio/react-native-auto-play 0.1.11 → 0.1.13

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.
@@ -5,6 +5,7 @@ import android.graphics.Color
5
5
  import androidx.car.app.AppManager
6
6
  import androidx.car.app.CarContext
7
7
  import androidx.car.app.model.Action
8
+ import androidx.car.app.model.ActionStrip
8
9
  import androidx.car.app.model.Alert
9
10
  import androidx.car.app.model.AlertCallback
10
11
  import androidx.car.app.model.CarColor
@@ -75,6 +76,12 @@ class MapTemplate(
75
76
  }
76
77
  config.headerActions?.let { headerActions ->
77
78
  setActionStrip(Parser.parseMapHeaderActions(context, headerActions))
79
+ } ?: run {
80
+ setActionStrip(
81
+ ActionStrip.Builder()
82
+ .addAction(Action.APP_ICON)
83
+ .build()
84
+ )
78
85
  }
79
86
  val travelEstimates =
80
87
  if (config.visibleTravelEstimate == VisibleTravelEstimate.FIRST) destinationTravelEstimates.firstOrNull() else destinationTravelEstimates.lastOrNull()
@@ -239,11 +246,19 @@ class MapTemplate(
239
246
  fun updateTripDestinations() {
240
247
  val tripDestinations = getTripDestinations()
241
248
  UiThreadUtil.runOnUiThread {
242
- navigationManager.updateTrip(Trip.Builder().apply {
249
+ val trip = Trip.Builder().apply {
243
250
  tripDestinations.forEach {
244
251
  addDestination(it.key, it.value)
245
252
  }
246
- }.build())
253
+ }.build()
254
+ try {
255
+ navigationManager.updateTrip(trip)
256
+ } catch(e: IllegalStateException) {
257
+ // Sometimes we get a "java.lang.IllegalStateException: Navigation is not started" here, although the navigation
258
+ // is started already (we check for isNavigating at the top). So i guess this is a race condition, that we start navigation
259
+ // and the AA app is not ready yet. Unfortunately we can not ask the AA app for it's state, so we just catch the error.
260
+ }
261
+
247
262
  }
248
263
  }
249
264
 
@@ -401,4 +416,4 @@ class MapTemplate(
401
416
  }
402
417
  }
403
418
  }
404
- }
419
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iternio/react-native-auto-play",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Android Auto and Apple CarPlay for react-native",
5
5
  "main": "lib/index",
6
6
  "module": "lib/index",