Commit a6a58c8f authored by Lucio Maciel's avatar Lucio Maciel

Don't crash if can't launch the browser intent

parent 5a9f819f
...@@ -5,12 +5,17 @@ import android.support.customtabs.CustomTabsIntent ...@@ -5,12 +5,17 @@ import android.support.customtabs.CustomTabsIntent
import android.support.v4.content.res.ResourcesCompat import android.support.v4.content.res.ResourcesCompat
import android.view.View import android.view.View
import chat.rocket.android.R import chat.rocket.android.R
import timber.log.Timber
fun View.openTabbedUrl(url: Uri) { fun View.openTabbedUrl(url: Uri) {
with(this) { with(this) {
val tabsbuilder = CustomTabsIntent.Builder() val tabsbuilder = CustomTabsIntent.Builder()
tabsbuilder.setToolbarColor(ResourcesCompat.getColor(context.resources, R.color.colorPrimary, context.theme)) tabsbuilder.setToolbarColor(ResourcesCompat.getColor(context.resources, R.color.colorPrimary, context.theme))
val customTabsIntent = tabsbuilder.build() val customTabsIntent = tabsbuilder.build()
customTabsIntent.launchUrl(context, url) try {
customTabsIntent.launchUrl(context, url)
} catch (ex: Exception) {
Timber.d(ex, "Unable to launch URL")
}
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment