mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-15 18:12:54 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/8157: Redirect about:addons search (https://github.com/mozilla-mobile/fenix/pull/13990)
This commit is contained in:
parent
517ef24c99
commit
ce22838e4c
@ -44,7 +44,7 @@ enum class GlobalDirections(val navDirections: NavDirections, val destinationId:
|
||||
R.id.deleteBrowsingDataFragment
|
||||
),
|
||||
SettingsAddonManager(
|
||||
NavGraphDirections.actionGlobalSettingsAddonsManagementFragment(),
|
||||
NavGraphDirections.actionGlobalAddonsManagementFragment(),
|
||||
R.id.addonsManagementFragment
|
||||
),
|
||||
SettingsLogins(
|
||||
|
@ -61,6 +61,10 @@ class DefaultSearchController(
|
||||
// and open the crash list activity instead.
|
||||
activity.startActivity(Intent(activity, CrashListActivity::class.java))
|
||||
}
|
||||
"about:addons" -> {
|
||||
val directions = SearchFragmentDirections.actionGlobalAddonsManagementFragment()
|
||||
navController.navigateSafe(R.id.searchFragment, directions)
|
||||
}
|
||||
"moz://a" -> openSearchOrUrl(SupportUtils.getMozillaPageUrl(MANIFESTO))
|
||||
else -> if (url.isNotBlank()) {
|
||||
openSearchOrUrl(url)
|
||||
|
@ -44,6 +44,10 @@ class SearchDialogController(
|
||||
// and open the crash list activity instead.
|
||||
activity.startActivity(Intent(activity, CrashListActivity::class.java))
|
||||
}
|
||||
"about:addons" -> {
|
||||
val directions = SearchDialogFragmentDirections.actionGlobalAddonsManagementFragment()
|
||||
navController.navigateSafe(R.id.searchDialogFragment, directions)
|
||||
}
|
||||
"moz://a" -> openSearchOrUrl(SupportUtils.getMozillaPageUrl(SupportUtils.MozillaPage.MANIFESTO))
|
||||
else -> if (url.isNotBlank()) {
|
||||
openSearchOrUrl(url)
|
||||
|
@ -40,9 +40,6 @@
|
||||
<action
|
||||
android:id="@+id/action_global_turn_on_sync"
|
||||
app:destination="@id/turnOnSyncFragment" />
|
||||
<action
|
||||
android:id="@+id/action_global_settings_addonsManagementFragment"
|
||||
app:destination="@id/addons_management_graph" />
|
||||
<action
|
||||
android:id="@+id/action_global_searchEngineFragment"
|
||||
app:destination="@id/search_engine_graph" />
|
||||
|
@ -157,7 +157,7 @@ class DeepLinkIntentProcessorTest {
|
||||
fun `process settings_addon_manager deep link`() {
|
||||
assertTrue(processor.process(testIntent("settings_addon_manager"), navController, out))
|
||||
|
||||
verify { navController.navigate(NavGraphDirections.actionGlobalSettingsAddonsManagementFragment()) }
|
||||
verify { navController.navigate(NavGraphDirections.actionGlobalAddonsManagementFragment()) }
|
||||
verify { out wasNot Called }
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,6 @@ import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.metrics.Event
|
||||
import org.mozilla.fenix.components.metrics.MetricController
|
||||
import org.mozilla.fenix.components.metrics.MetricsUtils
|
||||
import org.mozilla.fenix.ext.navigateSafe
|
||||
import org.mozilla.fenix.settings.SupportUtils
|
||||
import org.mozilla.fenix.utils.Settings
|
||||
|
||||
@ -55,6 +54,9 @@ class DefaultSearchControllerTest {
|
||||
every { store.state.tabId } returns "test-tab-id"
|
||||
every { store.state.searchEngineSource.searchEngine } returns searchEngine
|
||||
every { sessionManager.select(any()) } just Runs
|
||||
every { navController.currentDestination } returns mockk {
|
||||
every { id } returns R.id.searchFragment
|
||||
}
|
||||
every { MetricsUtils.createSearchEvent(searchEngine, activity, any()) } returns null
|
||||
|
||||
controller = DefaultSearchController(
|
||||
@ -119,6 +121,16 @@ class DefaultSearchControllerTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun handleAddonsUrlCommitted() {
|
||||
val url = "about:addons"
|
||||
val directions = SearchFragmentDirections.actionGlobalAddonsManagementFragment()
|
||||
|
||||
controller.handleUrlCommitted(url)
|
||||
|
||||
verify { navController.navigate(directions) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun handleMozillaUrlCommitted() {
|
||||
val url = "moz://a"
|
||||
@ -265,7 +277,7 @@ class DefaultSearchControllerTest {
|
||||
|
||||
controller.handleClickSearchEngineSettings()
|
||||
|
||||
verify { navController.navigateSafe(R.id.searchEngineFragment, directions) }
|
||||
verify { navController.navigate(directions) }
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -29,7 +29,6 @@ import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.metrics.Event
|
||||
import org.mozilla.fenix.components.metrics.MetricController
|
||||
import org.mozilla.fenix.components.metrics.MetricsUtils
|
||||
import org.mozilla.fenix.ext.navigateSafe
|
||||
import org.mozilla.fenix.search.SearchFragmentAction
|
||||
import org.mozilla.fenix.settings.SupportUtils
|
||||
import org.mozilla.fenix.utils.Settings
|
||||
@ -56,6 +55,9 @@ class SearchDialogControllerTest {
|
||||
every { store.state.tabId } returns "test-tab-id"
|
||||
every { store.state.searchEngineSource.searchEngine } returns searchEngine
|
||||
every { sessionManager.select(any()) } just Runs
|
||||
every { navController.currentDestination } returns mockk {
|
||||
every { id } returns R.id.searchDialogFragment
|
||||
}
|
||||
every { MetricsUtils.createSearchEvent(searchEngine, activity, any()) } returns null
|
||||
|
||||
controller = SearchDialogController(
|
||||
@ -120,6 +122,16 @@ class SearchDialogControllerTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun handleAddonsUrlCommitted() {
|
||||
val url = "about:addons"
|
||||
val directions = SearchDialogFragmentDirections.actionGlobalAddonsManagementFragment()
|
||||
|
||||
controller.handleUrlCommitted(url)
|
||||
|
||||
verify { navController.navigate(directions) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun handleMozillaUrlCommitted() {
|
||||
val url = "moz://a"
|
||||
@ -266,7 +278,7 @@ class SearchDialogControllerTest {
|
||||
|
||||
controller.handleClickSearchEngineSettings()
|
||||
|
||||
verify { navController.navigateSafe(R.id.searchEngineFragment, directions) }
|
||||
verify { navController.navigate(directions) }
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user