|
|
@ -29,6 +29,7 @@ import mozilla.components.support.ktx.kotlin.isUrl
|
|
|
|
import org.mozilla.fenix.BrowserDirection
|
|
|
|
import org.mozilla.fenix.BrowserDirection
|
|
|
|
import org.mozilla.fenix.HomeActivity
|
|
|
|
import org.mozilla.fenix.HomeActivity
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
|
|
|
|
import org.mozilla.fenix.browser.BrowserFragmentDirections
|
|
|
|
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
|
|
|
|
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
|
|
|
|
import org.mozilla.fenix.collections.SaveCollectionStep
|
|
|
|
import org.mozilla.fenix.collections.SaveCollectionStep
|
|
|
|
import org.mozilla.fenix.components.TabCollectionStorage
|
|
|
|
import org.mozilla.fenix.components.TabCollectionStorage
|
|
|
@ -40,11 +41,14 @@ import org.mozilla.fenix.ext.components
|
|
|
|
import org.mozilla.fenix.ext.metrics
|
|
|
|
import org.mozilla.fenix.ext.metrics
|
|
|
|
import org.mozilla.fenix.ext.nav
|
|
|
|
import org.mozilla.fenix.ext.nav
|
|
|
|
import org.mozilla.fenix.ext.openSetDefaultBrowserOption
|
|
|
|
import org.mozilla.fenix.ext.openSetDefaultBrowserOption
|
|
|
|
|
|
|
|
import org.mozilla.fenix.ext.settings
|
|
|
|
import org.mozilla.fenix.home.HomeFragment
|
|
|
|
import org.mozilla.fenix.home.HomeFragment
|
|
|
|
import org.mozilla.fenix.home.HomeFragmentAction
|
|
|
|
import org.mozilla.fenix.home.HomeFragmentAction
|
|
|
|
import org.mozilla.fenix.home.HomeFragmentDirections
|
|
|
|
import org.mozilla.fenix.home.HomeFragmentDirections
|
|
|
|
import org.mozilla.fenix.home.HomeFragmentStore
|
|
|
|
import org.mozilla.fenix.home.HomeFragmentStore
|
|
|
|
|
|
|
|
import org.mozilla.fenix.home.Mode
|
|
|
|
import org.mozilla.fenix.settings.SupportUtils
|
|
|
|
import org.mozilla.fenix.settings.SupportUtils
|
|
|
|
|
|
|
|
import org.mozilla.fenix.settings.SupportUtils.SumoTopic.PRIVATE_BROWSING_MYTHS
|
|
|
|
import org.mozilla.fenix.utils.Settings
|
|
|
|
import org.mozilla.fenix.utils.Settings
|
|
|
|
import mozilla.components.feature.tab.collections.Tab as ComponentTab
|
|
|
|
import mozilla.components.feature.tab.collections.Tab as ComponentTab
|
|
|
|
|
|
|
|
|
|
|
@ -178,6 +182,11 @@ interface SessionControlController {
|
|
|
|
* @see [ExperimentCardInteractor.onCloseExperimentCardClicked]
|
|
|
|
* @see [ExperimentCardInteractor.onCloseExperimentCardClicked]
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
fun handleCloseExperimentCard()
|
|
|
|
fun handleCloseExperimentCard()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @see [TabSessionInteractor.onPrivateModeButtonClicked]
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
fun handlePrivateModeButtonClicked(newMode: BrowsingMode, userHasBeenOnboarded: Boolean)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Suppress("TooManyFunctions", "LargeClass")
|
|
|
|
@Suppress("TooManyFunctions", "LargeClass")
|
|
|
@ -296,8 +305,7 @@ class DefaultSessionControlController(
|
|
|
|
override fun handlePrivateBrowsingLearnMoreClicked() {
|
|
|
|
override fun handlePrivateBrowsingLearnMoreClicked() {
|
|
|
|
dismissSearchDialogIfDisplayed()
|
|
|
|
dismissSearchDialogIfDisplayed()
|
|
|
|
activity.openToBrowserAndLoad(
|
|
|
|
activity.openToBrowserAndLoad(
|
|
|
|
searchTermOrURL = SupportUtils.getGenericSumoURLForTopic
|
|
|
|
searchTermOrURL = SupportUtils.getGenericSumoURLForTopic(PRIVATE_BROWSING_MYTHS),
|
|
|
|
(SupportUtils.SumoTopic.PRIVATE_BROWSING_MYTHS),
|
|
|
|
|
|
|
|
newTab = true,
|
|
|
|
newTab = true,
|
|
|
|
from = BrowserDirection.FromHome
|
|
|
|
from = BrowserDirection.FromHome
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -561,4 +569,27 @@ class DefaultSessionControlController(
|
|
|
|
metrics.track(Event.CloseExperimentCardClicked)
|
|
|
|
metrics.track(Event.CloseExperimentCardClicked)
|
|
|
|
fragmentStore.dispatch(HomeFragmentAction.RemoveSetDefaultBrowserCard)
|
|
|
|
fragmentStore.dispatch(HomeFragmentAction.RemoveSetDefaultBrowserCard)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun handlePrivateModeButtonClicked(
|
|
|
|
|
|
|
|
newMode: BrowsingMode,
|
|
|
|
|
|
|
|
userHasBeenOnboarded: Boolean
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
if (newMode == BrowsingMode.Private) {
|
|
|
|
|
|
|
|
activity.settings().incrementNumTimesPrivateModeOpened()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (userHasBeenOnboarded) {
|
|
|
|
|
|
|
|
fragmentStore.dispatch(
|
|
|
|
|
|
|
|
HomeFragmentAction.ModeChange(Mode.fromBrowsingMode(newMode))
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (navController.currentDestination?.id == R.id.searchDialogFragment) {
|
|
|
|
|
|
|
|
navController.navigate(
|
|
|
|
|
|
|
|
BrowserFragmentDirections.actionGlobalSearchDialog(
|
|
|
|
|
|
|
|
sessionId = null
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|