refactor: handle `ActivityNotFoundException` when opening URIs

pull/950/head
andrekir 2024-04-01 19:45:56 -03:00
rodzic 6e3e173096
commit 9024d36985
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -1,5 +1,6 @@
package com.geeksville.mesh.ui
import android.content.ActivityNotFoundException
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.text.ClickableText
import androidx.compose.material.MaterialTheme
@ -55,7 +56,11 @@ fun LinkedCoordinates(
debug("Clicked on link")
annotatedString.getStringAnnotations(tag = "gps", start = offset, end = offset)
.firstOrNull()?.let {
uriHandler.openUri(it.item)
try {
uriHandler.openUri(it.item)
} catch (ex: ActivityNotFoundException) {
debug("No application found: $ex")
}
}
}
)