Skip to content

Commit

Permalink
[fenix] For mozilla-mobile/fenix#18453 - Show SUMO for default browse…
Browse files Browse the repository at this point in the history
…r deeplink on Android <N

Lower Android versions don't offer the possibility of opening system settings
at a specific preference. In this cases we already shown a sumo article
detailing the manual steps each user is expected to perform to change the
system set default browser.

UltraBlame original commit: 9b58a0a1d44dfd68f784f0a607cc320c8e857793
  • Loading branch information
marco-c committed Jun 6, 2024
1 parent bc02783 commit afb46c6
Show file tree
Hide file tree
Showing 3 changed files with 236 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,30 @@ fenix
ext
.
alreadyOnDestination
import
org
.
mozilla
.
fenix
.
home
.
intent
.
DeepLinkIntentProcessor
.
DeepLinkVerifier
import
org
.
mozilla
.
fenix
.
settings
.
SupportUtils
/
*
*
Expand Down Expand Up @@ -681,6 +705,44 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,36 @@ net
.
Uri
import
android
.
os
.
Build
.
VERSION_CODES
.
M
import
android
.
os
.
Build
.
VERSION_CODES
.
N
import
android
.
os
.
Build
.
VERSION_CODES
.
P
import
androidx
.
core
Expand Down Expand Up @@ -242,6 +272,24 @@ fenix
helpers
.
FenixRobolectricTestRunner
import
org
.
mozilla
.
fenix
.
settings
.
SupportUtils
import
org
.
robolectric
.
annotation
.
Config
RunWith
(
FenixRobolectricTestRunner
Expand Down Expand Up @@ -1447,11 +1495,84 @@ Called
}
}
Test
Config
(
minSdk
=
N
maxSdk
=
P
)
fun
process
make_default_browser
deep
link
for
above
API
23
(
)
{
assertTrue
(
processor
.
process
(
testIntent
(
"
make_default_browser
"
)
navController
out
)
)
verify
{
activity
.
startActivity
(
any
(
)
)
}
verify
{
navController
wasNot
Called
}
verify
{
out
wasNot
Called
}
}
Test
Config
(
maxSdk
=
M
)
fun
process
make_default_browser
deep
link
for
API
23
and
below
(
)
{
Expand All @@ -1473,6 +1594,44 @@ out
)
verify
{
activity
.
openToBrowserAndLoad
(
searchTermOrURL
=
SupportUtils
.
getSumoURLForTopic
(
activity
SupportUtils
.
SumoTopic
.
SET_AS_DEFAULT_BROWSER
)
newTab
=
true
from
=
BrowserDirection
.
FromGlobal
flags
=
EngineSession
.
LoadUrlFlags
.
external
(
)
)
}
verify
{
navController
wasNot
Called
Expand Down
24 changes: 15 additions & 9 deletions mobile/android/fenix/docs/mma.md
Original file line number Diff line number Diff line change
Expand Up @@ -4817,18 +4817,24 @@ apps
settings
screen
.
*
*
Only
works
on
If
Android
API
>
<
=
24
*
*
23
opens
tab
to
support
page
defined
in
SupportUtils
.
SumoTopic
.
SET_AS_DEFAULT_BROWSER
<
/
td
Expand Down

0 comments on commit afb46c6

Please sign in to comment.