Websearch quick actions: allow custom url schemes

This commit is contained in:
MM20 2023-02-20 16:48:15 +01:00
parent 33e7b00b7e
commit 295f1e54ca
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389

View File

@ -15,10 +15,12 @@ data class OpenUrlAction(
override fun start(context: Context) {
val url =
if (url.startsWith("https://") || url.startsWith("http://")) url else "https://$url"
var uri = Uri.parse(url)
if (uri.scheme == null) {
uri = Uri.parse("https://$url")
}
val intent = Intent(Intent.ACTION_VIEW).apply {
data = Uri.parse(url)
data = uri
flags = Intent.FLAG_ACTIVITY_NEW_TASK
}
context.tryStartActivity(intent)