Skip to content

Commit

Permalink
AAOS: more navigateToCharger fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
johan12345 committed Aug 16, 2024
1 parent 17efe71 commit be4115a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/src/main/java/net/vonforst/evmap/auto/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,13 @@ fun openUrl(carContext: CarContext, url: String) {
}

fun navigateToCharger(ctx: CarContext, charger: ChargeLocation) {
val success = navigateCarApp(ctx, charger)
var success = navigateCarApp(ctx, charger)
if (!success && BuildConfig.FLAVOR_automotive == "automotive") {
// on AAOS, some OEMs' navigation apps might not support
navigateRegularApp(ctx, charger)
success = navigateRegularApp(ctx, charger)
}
if (!success) {
CarToast.makeText(ctx, R.string.no_maps_app_found, CarToast.LENGTH_SHORT).show()
}
}

Expand Down Expand Up @@ -309,6 +312,7 @@ private fun navigateRegularApp(ctx: CarContext, charger: ChargeLocation): Boolea
Uri.encode(charger.name)
})"
)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
if (intent.resolveActivity(ctx.packageManager) != null) {
ctx.startActivity(intent)
return true
Expand Down

0 comments on commit be4115a

Please sign in to comment.