Skip to content

Commit

Permalink
use Uri Builder instead of custom String formatting to build Map Uri
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeyls committed Apr 29, 2024
1 parent d637124 commit 3c0c347
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3c0c347

Please sign in to comment.