mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 00:10:32 +05:30
Fix crash when clicking links in about without browser available (#3284)
* Fix crash when clicking links in about without browser available
This commit is contained in:
parent
44024c7ef4
commit
e08505491f
@ -3,11 +3,17 @@ package com.github.libretube.helpers
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import com.github.libretube.R
|
||||||
|
import com.github.libretube.extensions.toastFromMainThread
|
||||||
|
|
||||||
object IntentHelper {
|
object IntentHelper {
|
||||||
fun openLinkFromHref(context: Context, link: String) {
|
fun openLinkFromHref(context: Context, link: String) {
|
||||||
val uri = Uri.parse(link)
|
val uri = Uri.parse(link)
|
||||||
val launchIntent = Intent(Intent.ACTION_VIEW).setData(uri)
|
val launchIntent = Intent(Intent.ACTION_VIEW).setData(uri)
|
||||||
context.startActivity(launchIntent)
|
try {
|
||||||
|
context.startActivity(launchIntent)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
context.toastFromMainThread(R.string.unknown_error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user