For #7715: Display search suggestions when pressing allow

fennec/beta
Sawyer Blatz 4 years ago committed by Emily Kager
parent fddf77280c
commit b8d5dc4551

@ -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