From 3c0c347d4875e5cefb6b07876c1ae9d825546cc0 Mon Sep 17 00:00:00 2001 From: Christophe Beyls Date: Mon, 29 Apr 2024 12:11:18 +0200 Subject: [PATCH] use Uri Builder instead of custom String formatting to build Map Uri --- .../domain/interactor/OpenMapUseCase.android.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/shared/domain/src/androidMain/kotlin/fr/androidmakers/domain/interactor/OpenMapUseCase.android.kt b/shared/domain/src/androidMain/kotlin/fr/androidmakers/domain/interactor/OpenMapUseCase.android.kt index 03253623..f57df72a 100644 --- a/shared/domain/src/androidMain/kotlin/fr/androidmakers/domain/interactor/OpenMapUseCase.android.kt +++ b/shared/domain/src/androidMain/kotlin/fr/androidmakers/domain/interactor/OpenMapUseCase.android.kt @@ -9,10 +9,11 @@ actual class OpenMapUseCase( private val urlOpener: UrlOpener ) { actual operator fun invoke(platformContext: PlatformContext, coordinates: String, name: String) { - val venueCoordinatesUri = Uri.parse( - "geo:" + coordinates + - "?q=" + Uri.encode(name) - ) + val venueCoordinatesUri = Uri.Builder() + .scheme("geo") + .encodedAuthority(coordinates) + .appendQueryParameter("q", name) + .build() try { val intent = Intent(Intent.ACTION_VIEW, venueCoordinatesUri) platformContext.context.startActivity(intent)