Loading components/feature/app-links/src/main/java/mozilla/components/feature/app/links/AppLinksFeature.kt +2 −2 Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ class AppLinksFeature( return } val redirect = useCases.interceptedAppLinkRedirect.invoke(url) val redirect = useCases.interceptedAppLinkRedirect(url) if (redirect.isRedirect()) { handleRedirect(redirect, session) Loading @@ -98,7 +98,7 @@ class AppLinksFeature( } val doOpenApp = { useCases.openAppLink.invoke(redirect) useCases.openAppLink(redirect) } if (!session.private || fragmentManager == null) { Loading components/feature/app-links/src/main/java/mozilla/components/feature/app/links/AppLinksUseCases.kt +2 −2 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ class AppLinksUseCases( private val ignoreDefaultBrowser: Boolean = false, private val includeInstallAppFallback: Boolean = false ) { fun invoke(url: String): AppLinkRedirect { operator fun invoke(url: String): AppLinkRedirect { val intents = createBrowsableIntents(url) val appIntent = if (includeHttpAppLinks) { intents.firstOrNull { getNonBrowserActivities(it).isNotEmpty() } Loading Loading @@ -153,7 +153,7 @@ class AppLinksUseCases( class OpenAppLinkRedirect internal constructor( private val context: Context ) { fun invoke(redirect: AppLinkRedirect) { operator fun invoke(redirect: AppLinkRedirect) { val intent = redirect.appIntent ?: return context.startActivity(intent) } Loading components/feature/app-links/src/test/java/mozilla/components/feature/app/links/AppLinksUseCasesTest.kt +9 −9 Original line number Diff line number Diff line Loading @@ -59,7 +59,7 @@ class AppLinksUseCasesTest { val context = createContext() val subject = AppLinksUseCases(context, emptySet()) val redirect = subject.interceptedAppLinkRedirect.invoke(appUrl) val redirect = subject.interceptedAppLinkRedirect(appUrl) assertFalse(redirect.isRedirect()) } Loading @@ -69,11 +69,11 @@ class AppLinksUseCasesTest { val subject = AppLinksUseCases(context, emptySet()) // We will not redirect to it when we click on it. val redirect = subject.interceptedAppLinkRedirect.invoke(appUrl) val redirect = subject.interceptedAppLinkRedirect(appUrl) assertFalse(redirect.isRedirect()) // But we do from a context menu. val menuRedirect = subject.appLinkRedirect.invoke(appUrl) val menuRedirect = subject.appLinkRedirect(appUrl) assertTrue(menuRedirect.isRedirect()) } Loading @@ -82,7 +82,7 @@ class AppLinksUseCasesTest { val context = createContext(appUrl to browserPackage) val subject = AppLinksUseCases(context, setOf(browserPackage)) val redirect = subject.interceptedAppLinkRedirect.invoke(appUrl) val redirect = subject.interceptedAppLinkRedirect(appUrl) assertFalse(redirect.isRedirect()) } Loading @@ -91,7 +91,7 @@ class AppLinksUseCasesTest { val context = createContext(appUrl to appPackage, appUrl to browserPackage) val subject = AppLinksUseCases(context, setOf(browserPackage)) val redirect = subject.appLinkRedirect.invoke(appUrl) val redirect = subject.appLinkRedirect(appUrl) assertTrue(redirect.isRedirect()) } Loading @@ -110,7 +110,7 @@ class AppLinksUseCasesTest { val context = createContext(uri to appPackage, appUrl to browserPackage) val subject = AppLinksUseCases(context, setOf(browserPackage)) val redirect = subject.interceptedAppLinkRedirect.invoke(uri) val redirect = subject.interceptedAppLinkRedirect(uri) assertTrue(redirect.hasExternalApp()) assertNotNull(redirect.appIntent) Loading @@ -124,7 +124,7 @@ class AppLinksUseCasesTest { val uri = "intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;end" val redirect = subject.interceptedAppLinkRedirect.invoke(uri) val redirect = subject.interceptedAppLinkRedirect(uri) assertFalse(redirect.hasExternalApp()) assertFalse(redirect.hasFallback()) assertNull(redirect.webUrl) Loading @@ -137,7 +137,7 @@ class AppLinksUseCasesTest { val uri = "intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;S.browser_fallback_url=http%3A%2F%2Fzxing.org;end" val redirect = subject.interceptedAppLinkRedirect.invoke(uri) val redirect = subject.interceptedAppLinkRedirect(uri) assertFalse(redirect.hasExternalApp()) assertTrue(redirect.hasFallback()) Loading @@ -151,7 +151,7 @@ class AppLinksUseCasesTest { val redirect = AppLinkRedirect(appIntent, appUrl, false) val subject = AppLinksUseCases(context, setOf(browserPackage)) subject.openAppLink.invoke(redirect) subject.openAppLink(redirect) verify(context).startActivity(any()) } Loading components/feature/awesomebar/src/main/java/mozilla/components/feature/awesomebar/provider/SessionSuggestionProvider.kt +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ class SessionSuggestionProvider( title = session.title, description = session.url, icon = icons.loadLambda(session.url), onSuggestionClicked = { selectTabUseCase.invoke(session) } onSuggestionClicked = { selectTabUseCase(session) } ) ) } Loading components/feature/contextmenu/src/main/java/mozilla/components/feature/contextmenu/ContextMenuCandidate.kt +7 −7 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ data class ContextMenuCandidate( label = context.getString(R.string.mozac_feature_contextmenu_open_link_in_new_tab), showFor = { session, hitResult -> hitResult.isLink() && !session.private }, action = { parent, hitResult -> val session = tabsUseCases.addTab.invoke( val session = tabsUseCases.addTab( hitResult.getLink(), selectTab = false, startLoading = true, parent = parent) snackbarDelegate.show( Loading @@ -75,7 +75,7 @@ data class ContextMenuCandidate( duration = Snackbar.LENGTH_LONG, action = R.string.mozac_feature_contextmenu_snackbar_action_switch ) { tabsUseCases.selectTab.invoke(session) tabsUseCases.selectTab(session) } } ) Loading @@ -93,7 +93,7 @@ data class ContextMenuCandidate( label = context.getString(R.string.mozac_feature_contextmenu_open_link_in_private_tab), showFor = { _, hitResult -> hitResult.isLink() }, action = { parent, hitResult -> val session = tabsUseCases.addPrivateTab.invoke( val session = tabsUseCases.addPrivateTab( hitResult.getLink(), selectTab = false, startLoading = true, parent = parent) snackbarDelegate.show( Loading @@ -102,7 +102,7 @@ data class ContextMenuCandidate( Snackbar.LENGTH_LONG, R.string.mozac_feature_contextmenu_snackbar_action_switch ) { tabsUseCases.selectTab.invoke(session) tabsUseCases.selectTab(session) } } ) Loading @@ -121,10 +121,10 @@ data class ContextMenuCandidate( showFor = { _, hitResult -> hitResult.isImage() }, action = { parent, hitResult -> val session = if (parent.private) { tabsUseCases.addPrivateTab.invoke( tabsUseCases.addPrivateTab( hitResult.src, selectTab = false, startLoading = true, parent = parent) } else { tabsUseCases.addTab.invoke( tabsUseCases.addTab( hitResult.src, selectTab = false, startLoading = true, parent = parent) } Loading @@ -134,7 +134,7 @@ data class ContextMenuCandidate( duration = Snackbar.LENGTH_LONG, action = R.string.mozac_feature_contextmenu_snackbar_action_switch ) { tabsUseCases.selectTab.invoke(session) tabsUseCases.selectTab(session) } } ) Loading Loading
components/feature/app-links/src/main/java/mozilla/components/feature/app/links/AppLinksFeature.kt +2 −2 Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ class AppLinksFeature( return } val redirect = useCases.interceptedAppLinkRedirect.invoke(url) val redirect = useCases.interceptedAppLinkRedirect(url) if (redirect.isRedirect()) { handleRedirect(redirect, session) Loading @@ -98,7 +98,7 @@ class AppLinksFeature( } val doOpenApp = { useCases.openAppLink.invoke(redirect) useCases.openAppLink(redirect) } if (!session.private || fragmentManager == null) { Loading
components/feature/app-links/src/main/java/mozilla/components/feature/app/links/AppLinksUseCases.kt +2 −2 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ class AppLinksUseCases( private val ignoreDefaultBrowser: Boolean = false, private val includeInstallAppFallback: Boolean = false ) { fun invoke(url: String): AppLinkRedirect { operator fun invoke(url: String): AppLinkRedirect { val intents = createBrowsableIntents(url) val appIntent = if (includeHttpAppLinks) { intents.firstOrNull { getNonBrowserActivities(it).isNotEmpty() } Loading Loading @@ -153,7 +153,7 @@ class AppLinksUseCases( class OpenAppLinkRedirect internal constructor( private val context: Context ) { fun invoke(redirect: AppLinkRedirect) { operator fun invoke(redirect: AppLinkRedirect) { val intent = redirect.appIntent ?: return context.startActivity(intent) } Loading
components/feature/app-links/src/test/java/mozilla/components/feature/app/links/AppLinksUseCasesTest.kt +9 −9 Original line number Diff line number Diff line Loading @@ -59,7 +59,7 @@ class AppLinksUseCasesTest { val context = createContext() val subject = AppLinksUseCases(context, emptySet()) val redirect = subject.interceptedAppLinkRedirect.invoke(appUrl) val redirect = subject.interceptedAppLinkRedirect(appUrl) assertFalse(redirect.isRedirect()) } Loading @@ -69,11 +69,11 @@ class AppLinksUseCasesTest { val subject = AppLinksUseCases(context, emptySet()) // We will not redirect to it when we click on it. val redirect = subject.interceptedAppLinkRedirect.invoke(appUrl) val redirect = subject.interceptedAppLinkRedirect(appUrl) assertFalse(redirect.isRedirect()) // But we do from a context menu. val menuRedirect = subject.appLinkRedirect.invoke(appUrl) val menuRedirect = subject.appLinkRedirect(appUrl) assertTrue(menuRedirect.isRedirect()) } Loading @@ -82,7 +82,7 @@ class AppLinksUseCasesTest { val context = createContext(appUrl to browserPackage) val subject = AppLinksUseCases(context, setOf(browserPackage)) val redirect = subject.interceptedAppLinkRedirect.invoke(appUrl) val redirect = subject.interceptedAppLinkRedirect(appUrl) assertFalse(redirect.isRedirect()) } Loading @@ -91,7 +91,7 @@ class AppLinksUseCasesTest { val context = createContext(appUrl to appPackage, appUrl to browserPackage) val subject = AppLinksUseCases(context, setOf(browserPackage)) val redirect = subject.appLinkRedirect.invoke(appUrl) val redirect = subject.appLinkRedirect(appUrl) assertTrue(redirect.isRedirect()) } Loading @@ -110,7 +110,7 @@ class AppLinksUseCasesTest { val context = createContext(uri to appPackage, appUrl to browserPackage) val subject = AppLinksUseCases(context, setOf(browserPackage)) val redirect = subject.interceptedAppLinkRedirect.invoke(uri) val redirect = subject.interceptedAppLinkRedirect(uri) assertTrue(redirect.hasExternalApp()) assertNotNull(redirect.appIntent) Loading @@ -124,7 +124,7 @@ class AppLinksUseCasesTest { val uri = "intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;end" val redirect = subject.interceptedAppLinkRedirect.invoke(uri) val redirect = subject.interceptedAppLinkRedirect(uri) assertFalse(redirect.hasExternalApp()) assertFalse(redirect.hasFallback()) assertNull(redirect.webUrl) Loading @@ -137,7 +137,7 @@ class AppLinksUseCasesTest { val uri = "intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;S.browser_fallback_url=http%3A%2F%2Fzxing.org;end" val redirect = subject.interceptedAppLinkRedirect.invoke(uri) val redirect = subject.interceptedAppLinkRedirect(uri) assertFalse(redirect.hasExternalApp()) assertTrue(redirect.hasFallback()) Loading @@ -151,7 +151,7 @@ class AppLinksUseCasesTest { val redirect = AppLinkRedirect(appIntent, appUrl, false) val subject = AppLinksUseCases(context, setOf(browserPackage)) subject.openAppLink.invoke(redirect) subject.openAppLink(redirect) verify(context).startActivity(any()) } Loading
components/feature/awesomebar/src/main/java/mozilla/components/feature/awesomebar/provider/SessionSuggestionProvider.kt +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ class SessionSuggestionProvider( title = session.title, description = session.url, icon = icons.loadLambda(session.url), onSuggestionClicked = { selectTabUseCase.invoke(session) } onSuggestionClicked = { selectTabUseCase(session) } ) ) } Loading
components/feature/contextmenu/src/main/java/mozilla/components/feature/contextmenu/ContextMenuCandidate.kt +7 −7 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ data class ContextMenuCandidate( label = context.getString(R.string.mozac_feature_contextmenu_open_link_in_new_tab), showFor = { session, hitResult -> hitResult.isLink() && !session.private }, action = { parent, hitResult -> val session = tabsUseCases.addTab.invoke( val session = tabsUseCases.addTab( hitResult.getLink(), selectTab = false, startLoading = true, parent = parent) snackbarDelegate.show( Loading @@ -75,7 +75,7 @@ data class ContextMenuCandidate( duration = Snackbar.LENGTH_LONG, action = R.string.mozac_feature_contextmenu_snackbar_action_switch ) { tabsUseCases.selectTab.invoke(session) tabsUseCases.selectTab(session) } } ) Loading @@ -93,7 +93,7 @@ data class ContextMenuCandidate( label = context.getString(R.string.mozac_feature_contextmenu_open_link_in_private_tab), showFor = { _, hitResult -> hitResult.isLink() }, action = { parent, hitResult -> val session = tabsUseCases.addPrivateTab.invoke( val session = tabsUseCases.addPrivateTab( hitResult.getLink(), selectTab = false, startLoading = true, parent = parent) snackbarDelegate.show( Loading @@ -102,7 +102,7 @@ data class ContextMenuCandidate( Snackbar.LENGTH_LONG, R.string.mozac_feature_contextmenu_snackbar_action_switch ) { tabsUseCases.selectTab.invoke(session) tabsUseCases.selectTab(session) } } ) Loading @@ -121,10 +121,10 @@ data class ContextMenuCandidate( showFor = { _, hitResult -> hitResult.isImage() }, action = { parent, hitResult -> val session = if (parent.private) { tabsUseCases.addPrivateTab.invoke( tabsUseCases.addPrivateTab( hitResult.src, selectTab = false, startLoading = true, parent = parent) } else { tabsUseCases.addTab.invoke( tabsUseCases.addTab( hitResult.src, selectTab = false, startLoading = true, parent = parent) } Loading @@ -134,7 +134,7 @@ data class ContextMenuCandidate( duration = Snackbar.LENGTH_LONG, action = R.string.mozac_feature_contextmenu_snackbar_action_switch ) { tabsUseCases.selectTab.invoke(session) tabsUseCases.selectTab(session) } } ) Loading