Skip to content

Commit

Permalink
For mozilla-mobile#18453 Add deep link navigation to support page for…
Browse files Browse the repository at this point in the history
… setting as default browser action when Android SDK below API 24.
  • Loading branch information
kershan committed Mar 22, 2021
1 parent 5c0c411 commit f6564f0
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
import org.mozilla.fenix.components.SearchWidgetCreator
import org.mozilla.fenix.ext.alreadyOnDestination
import org.mozilla.fenix.home.intent.DeepLinkIntentProcessor.DeepLinkVerifier
import org.mozilla.fenix.settings.SupportUtils

/**
* Deep links in the form of `fenix://host` open different parts of the app.
Expand All @@ -33,7 +35,8 @@ class DeepLinkIntentProcessor(
private val logger = Logger("DeepLinkIntentProcessor")

override fun process(intent: Intent, navController: NavController, out: Intent): Boolean {
val scheme = intent.scheme?.equals(BuildConfig.DEEP_LINK_SCHEME, ignoreCase = true) ?: return false
val scheme =
intent.scheme?.equals(BuildConfig.DEEP_LINK_SCHEME, ignoreCase = true) ?: return false
return if (scheme) {
intent.data?.let { handleDeepLink(it, navController) }
true
Expand Down Expand Up @@ -89,6 +92,16 @@ class DeepLinkIntentProcessor(
if (SDK_INT >= Build.VERSION_CODES.N) {
val settingsIntent = Intent(Settings.ACTION_MANAGE_DEFAULT_APPS_SETTINGS)
activity.startActivity(settingsIntent)
} else {
activity.openToBrowserAndLoad(
searchTermOrURL = SupportUtils.getSumoURLForTopic(
activity,
SupportUtils.SumoTopic.SET_AS_DEFAULT_BROWSER
),
newTab = true,
from = BrowserDirection.FromGlobal,
flags = EngineSession.LoadUrlFlags.external()
)
}
}
"open" -> {
Expand Down

0 comments on commit f6564f0

Please sign in to comment.