Merge pull request #4364 from vector-im/yostyle/open_url_on_browser_task

Open URL on external browser task
This commit is contained in:
Benoit Marty 2022-06-30 22:36:26 +02:00 committed by GitHub
commit e2a55fb6f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,6 +76,8 @@ fun openUrlInExternalBrowser(context: Context, url: String?) {
fun openUrlInExternalBrowser(context: Context, uri: Uri?) { fun openUrlInExternalBrowser(context: Context, uri: Uri?) {
uri?.let { uri?.let {
val browserIntent = Intent(Intent.ACTION_VIEW, it).apply { val browserIntent = Intent(Intent.ACTION_VIEW, it).apply {
// Open activity on browser task and not on element task
flags = Intent.FLAG_ACTIVITY_NEW_TASK
putExtra(Browser.EXTRA_APPLICATION_ID, context.packageName) putExtra(Browser.EXTRA_APPLICATION_ID, context.packageName)
putExtra(Browser.EXTRA_CREATE_NEW_TAB, true) putExtra(Browser.EXTRA_CREATE_NEW_TAB, true)
} }