Skip to content

Commit

Permalink
Fix crash when clicking links in about without browser available (#3284)
Browse files Browse the repository at this point in the history
* Fix crash when clicking links in about without browser available
  • Loading branch information
Bnyro authored Mar 10, 2023
1 parent 44024c7 commit e085054
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ package com.github.libretube.helpers
import android.content.Context
import android.content.Intent
import android.net.Uri
import com.github.libretube.R
import com.github.libretube.extensions.toastFromMainThread

object IntentHelper {
fun openLinkFromHref(context: Context, link: String) {
val uri = Uri.parse(link)
val launchIntent = Intent(Intent.ACTION_VIEW).setData(uri)
context.startActivity(launchIntent)
try {
context.startActivity(launchIntent)
} catch (e: Exception) {
context.toastFromMainThread(R.string.unknown_error)
}
}
}

0 comments on commit e085054

Please sign in to comment.