mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
fix #656, prepend website with https if needed
This commit is contained in:
@ -80,8 +80,14 @@ fun Context.sendAddressIntent(address: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Context.openWebsiteIntent(url: String) {
|
fun Context.openWebsiteIntent(url: String) {
|
||||||
|
val website = if (url.startsWith("http")) {
|
||||||
|
url
|
||||||
|
} else {
|
||||||
|
"https://$url"
|
||||||
|
}
|
||||||
|
|
||||||
Intent(Intent.ACTION_VIEW).apply {
|
Intent(Intent.ACTION_VIEW).apply {
|
||||||
data = Uri.parse(url)
|
data = Uri.parse(website)
|
||||||
if (resolveActivity(packageManager) != null) {
|
if (resolveActivity(packageManager) != null) {
|
||||||
startActivity(this)
|
startActivity(this)
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user