Commit 07155031 authored by Roger Yang's avatar Roger Yang
Browse files

Closes #8169: Immediately show redirect dialog fragment

parent c0d20a88
......@@ -78,7 +78,7 @@ class AppLinksFeature(
dialog.onCancelRedirect = doNotOpenApp
if (!isAlreadyADialogCreated()) {
dialog.show(fragmentManager, FRAGMENT_TAG)
dialog.showNow(fragmentManager, FRAGMENT_TAG)
}
return
......
......@@ -23,8 +23,10 @@ import org.mockito.ArgumentMatchers.anyBoolean
import org.mockito.ArgumentMatchers.anyString
import org.mockito.ArgumentMatchers.eq
import org.mockito.Mockito.`when`
import org.mockito.Mockito.doReturn
import org.mockito.Mockito.never
import org.mockito.Mockito.spy
import org.mockito.Mockito.times
import org.mockito.Mockito.verify
import org.mockito.Mockito.verifyNoMoreInteractions
......@@ -73,13 +75,13 @@ class AppLinksFeatureTest {
`when`(mockGetRedirect.invoke(intentUrl)).thenReturn(appRedirect)
`when`(mockGetRedirect.invoke(webUrlWithAppLink)).thenReturn(appRedirectFromWebUrl)
feature = AppLinksFeature(
feature = spy(AppLinksFeature(
context = mockContext,
sessionManager = mockSessionManager,
fragmentManager = mockFragmentManager,
useCases = mockUseCases,
dialog = mockDialog
)
))
}
private fun createSession(isPrivate: Boolean, url: String = "https://mozilla.com"): Session {
......@@ -152,7 +154,7 @@ class AppLinksFeatureTest {
feature.start()
userTapsOnSession(intentUrl, true)
verify(mockDialog).show(eq(mockFragmentManager), anyString())
verify(mockDialog).showNow(eq(mockFragmentManager), anyString())
verify(mockOpenRedirect, never()).invoke(any(), anyBoolean(), any())
}
......@@ -164,4 +166,17 @@ class AppLinksFeatureTest {
val dialog = feature.getOrCreateDialog()
assertEquals(dialog, feature.getOrCreateDialog())
}
@Test
fun `redirect dialog is only added once`() {
feature.start()
userTapsOnSession(intentUrl, true)
verify(mockDialog).showNow(eq(mockFragmentManager), anyString())
doReturn(mockDialog).`when`(feature).getOrCreateDialog()
doReturn(mockDialog).`when`(mockFragmentManager).findFragmentByTag(RedirectDialogFragment.FRAGMENT_TAG)
userTapsOnSession(intentUrl, true)
verify(mockDialog, times(1)).showNow(mockFragmentManager, RedirectDialogFragment.FRAGMENT_TAG)
}
}
......@@ -18,6 +18,9 @@ permalink: /changelog/
* **browser-tabstray**
* Added the convenience function `TabsAdapter.doOnTabsUpdated` for performing actions only once when the tabs are updated.
* **feature-app-links**
* Fixed [issue #8169](https://github.com/mozilla-mobile/android-components/issues/8169) App links dialog will now call `showNow` to immediately show the dialog.
# 55.0.0
* [Commits](https://github.com/mozilla-mobile/android-components/compare/v54.0.0...v55.0.0)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment