mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 06:43:32 +00:00
Bug 1930300 - Use fallback URL if it's Google PlayStore URL and the app is not installed already a=dmeehan
Original Revision: https://phabricator.services.mozilla.com/D228987 Differential Revision: https://phabricator.services.mozilla.com/D229034
This commit is contained in:
parent
d896d894ad
commit
5d7a36d15c
@ -123,7 +123,7 @@ class AppLinksUseCases(
|
||||
// Only set fallback URL if url is not a Google PlayStore URL
|
||||
// The reason here is we already handled that case with the market place URL
|
||||
val fallbackUrl = redirectData.fallbackIntent?.data?.takeIf {
|
||||
it.isHttpOrHttps && !isPlayStoreURL(it.toString())
|
||||
it.isHttpOrHttps && (!isPlayStoreURL(it.toString()) || redirectData.resolveInfo == null)
|
||||
}?.toString()
|
||||
|
||||
val appIntent = when {
|
||||
|
@ -54,7 +54,7 @@ class AppLinksUseCasesTest {
|
||||
private val appIntentWithPackageAndFallback =
|
||||
"intent://com.example.app#Intent;package=com.example.com;S.browser_fallback_url=https://example.com;end"
|
||||
private val appIntentWithPackageAndPlayStoreFallback =
|
||||
"intent://com.example.app#Intent;package=com.example.com;S.browser_fallback_url=https?://play.google.com/store/abc;end"
|
||||
"intent://com.example.app#Intent;package=com.example.com;S.browser_fallback_url=https://play.google.com/store/abc;end"
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
@ -686,4 +686,15 @@ class AppLinksUseCasesTest {
|
||||
assertTrue(redirect.marketplaceIntent != null)
|
||||
assertNull(redirect.fallbackUrl)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `WHEN opening a app scheme uri WITHOUT package installed WHERE the URL is Google PlayStore THEN use fallback URL`() {
|
||||
val context = createContext()
|
||||
|
||||
val subject = AppLinksUseCases(context, { false })
|
||||
val redirect = subject.interceptedAppLinkRedirect(appIntentWithPackageAndPlayStoreFallback)
|
||||
assertFalse(redirect.hasExternalApp())
|
||||
assertTrue(redirect.hasFallback())
|
||||
assertEquals("https://play.google.com/store/abc", redirect.fallbackUrl)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user