mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-17 15:26:23 +00:00
Bug 1822750 - Add option to open default browser help page in custom tab
This commit is contained in:
parent
bacea723cb
commit
d7f511e138
@ -69,10 +69,12 @@ fun Activity.breadcrumb(
|
|||||||
*
|
*
|
||||||
* @param from fallback direction in case, couldn't open the setting.
|
* @param from fallback direction in case, couldn't open the setting.
|
||||||
* @param flags fallback flags for when opening the Sumo article page.
|
* @param flags fallback flags for when opening the Sumo article page.
|
||||||
|
* @param useCustomTab fallback to open the Sumo article in a custom tab.
|
||||||
*/
|
*/
|
||||||
fun Activity.openSetDefaultBrowserOption(
|
fun Activity.openSetDefaultBrowserOption(
|
||||||
from: BrowserDirection = BrowserDirection.FromSettings,
|
from: BrowserDirection = BrowserDirection.FromSettings,
|
||||||
flags: EngineSession.LoadUrlFlags = EngineSession.LoadUrlFlags.none(),
|
flags: EngineSession.LoadUrlFlags = EngineSession.LoadUrlFlags.none(),
|
||||||
|
useCustomTab: Boolean = false,
|
||||||
) {
|
) {
|
||||||
when {
|
when {
|
||||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q -> {
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q -> {
|
||||||
@ -94,15 +96,22 @@ fun Activity.openSetDefaultBrowserOption(
|
|||||||
navigateToDefaultBrowserAppsSettings()
|
navigateToDefaultBrowserAppsSettings()
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
(this as HomeActivity).openToBrowserAndLoad(
|
val sumoDefaultBrowserUrl = SupportUtils.getSumoURLForTopic(
|
||||||
searchTermOrURL = SupportUtils.getSumoURLForTopic(
|
context = this,
|
||||||
this,
|
topic = SupportUtils.SumoTopic.SET_AS_DEFAULT_BROWSER,
|
||||||
SupportUtils.SumoTopic.SET_AS_DEFAULT_BROWSER,
|
|
||||||
),
|
|
||||||
newTab = true,
|
|
||||||
from = from,
|
|
||||||
flags = flags,
|
|
||||||
)
|
)
|
||||||
|
if (useCustomTab) {
|
||||||
|
startActivity(
|
||||||
|
SupportUtils.createCustomTabIntent(context = this, url = sumoDefaultBrowserUrl),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
(this as HomeActivity).openToBrowserAndLoad(
|
||||||
|
searchTermOrURL = sumoDefaultBrowserUrl,
|
||||||
|
newTab = true,
|
||||||
|
from = from,
|
||||||
|
flags = flags,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user