Fix tracking urls not going to browser when using certain browsers

This commit is contained in:
Jays2Kings 2023-02-11 16:22:32 -05:00
parent 3908326fb1
commit 599df50320

View file

@ -380,7 +380,7 @@ fun Context.isServiceRunning(serviceClass: Class<*>): Boolean {
}
fun Context.openInBrowser(url: String, @ColorInt toolbarColor: Int? = null, forceBrowser: Boolean = false) {
this.openInBrowser(url.toUri(), toolbarColor)
this.openInBrowser(url.toUri(), toolbarColor, forceBrowser)
}
fun Context.openInBrowser(uri: Uri, @ColorInt toolbarColor: Int? = null, forceBrowser: Boolean = false) {
@ -394,9 +394,11 @@ fun Context.openInBrowser(uri: Uri, @ColorInt toolbarColor: Int? = null, forceBr
.build()
if (forceBrowser) {
val packages = getCustomTabsPackages().maxByOrNull { it.preferredOrder }
val processName = packages?.activityInfo?.processName ?: return
val processName = packages?.activityInfo?.processName
if (processName == null) {
intent.intent.`package` = processName
}
}
intent.launchUrl(this, uri)
} catch (e: Exception) {
toast(e.message)