Do what the doc says: if no CustomChrome tab is available, try to open the Url in any installed browser.

This commit is contained in:
Benoit Marty 2024-10-08 09:10:12 +02:00
parent b7d444254c
commit 67140fe165

View file

@ -13,6 +13,7 @@ import android.net.Uri
import androidx.browser.customtabs.CustomTabColorSchemeParams import androidx.browser.customtabs.CustomTabColorSchemeParams
import androidx.browser.customtabs.CustomTabsIntent import androidx.browser.customtabs.CustomTabsIntent
import androidx.browser.customtabs.CustomTabsSession import androidx.browser.customtabs.CustomTabsSession
import io.element.android.libraries.androidutils.system.openUrlInExternalApp
/** /**
* Open url in custom tab or, if not available, in the default browser. * Open url in custom tab or, if not available, in the default browser.
@ -53,6 +54,6 @@ fun Activity.openUrlInChromeCustomTab(
} }
.launchUrl(this, Uri.parse(url)) .launchUrl(this, Uri.parse(url))
} catch (activityNotFoundException: ActivityNotFoundException) { } catch (activityNotFoundException: ActivityNotFoundException) {
// TODO context.toast(R.string.error_no_external_application_found) openUrlInExternalApp(url)
} }
} }