[fenix] For https://github.com/mozilla-mobile/fenix/issues/7715: Display search suggestions when pressing allow

pull/600/head
Sawyer Blatz 5 years ago committed by Emily Kager
parent 32802e7fc8
commit 7fd64075b3

@ -209,6 +209,8 @@ class SearchFragment : Fragment(), UserInteractionHandler {
inflated.visibility = View.GONE
context?.settings()?.shouldShowSearchSuggestionsInPrivate = true
context?.settings()?.showSearchSuggestionsInPrivateOnboardingFinished = true
searchStore.dispatch(SearchFragmentAction.SetShowSearchSuggestions(true))
searchStore.dispatch(SearchFragmentAction.AllowSearchSuggestionsInPrivateModePrompt(false))
requireComponents.analytics.metrics.track(Event.PrivateBrowsingShowSearchSuggestions)
}

@ -64,6 +64,7 @@ data class SearchFragmentState(
* Actions to dispatch through the `SearchStore` to modify `SearchState` through the reducer.
*/
sealed class SearchFragmentAction : Action {
data class SetShowSearchSuggestions(val show: Boolean) : SearchFragmentAction()
data class SearchShortcutEngineSelected(val engine: SearchEngine) : SearchFragmentAction()
data class SelectNewDefaultSearchEngine(val engine: SearchEngine) : SearchFragmentAction()
data class ShowSearchShortcutEnginePicker(val show: Boolean) : SearchFragmentAction()
@ -91,5 +92,7 @@ private fun searchStateReducer(state: SearchFragmentState, action: SearchFragmen
)
is SearchFragmentAction.AllowSearchSuggestionsInPrivateModePrompt ->
state.copy(showSearchSuggestionsHint = action.show)
is SearchFragmentAction.SetShowSearchSuggestions ->
state.copy(showSearchSuggestions = action.show)
}
}

Loading…
Cancel
Save