Bug 1856438 - Reorganize Search settings to match the Cross Platform Suggest designs

fenix/120.0
Tif Tran 8 months ago committed by mergify[bot]
parent 416d5c39c7
commit 268657a16c

@ -96,7 +96,7 @@ class SettingsSubMenuSearchRobot {
}
fun verifyAddressBarSectionHeader() {
onView(withText("Address bar")).check(matches(isDisplayed()))
onView(withText("Address bar - Firefox Suggest")).check(matches(isDisplayed()))
}
fun verifyDefaultSearchEngineList() {

@ -31,6 +31,7 @@ enum class BrowserDirection(@IdRes val fragmentId: Int) {
FromSavedLoginsFragment(R.id.savedLoginsFragment),
FromAddNewDeviceFragment(R.id.addNewDeviceFragment),
FromAddSearchEngineFragment(R.id.addSearchEngineFragment),
FromSearchEngineFragment(R.id.searchEngineFragment),
FromSaveSearchEngineFragment(R.id.saveSearchEngineFragment),
FromAddonDetailsFragment(R.id.addonDetailsFragment),
FromStudiesFragment(R.id.studiesFragment),

@ -150,6 +150,7 @@ import org.mozilla.fenix.settings.logins.fragment.SavedLoginsAuthFragmentDirecti
import org.mozilla.fenix.settings.quicksettings.protections.cookiebanners.dialog.CookieBannerReEngagementDialogUtils
import org.mozilla.fenix.settings.search.AddSearchEngineFragmentDirections
import org.mozilla.fenix.settings.search.SaveSearchEngineFragmentDirections
import org.mozilla.fenix.settings.search.SearchEngineFragmentDirections
import org.mozilla.fenix.settings.studies.StudiesFragmentDirections
import org.mozilla.fenix.settings.wallpaper.WallpaperSettingsFragmentDirections
import org.mozilla.fenix.share.AddNewDeviceFragmentDirections
@ -1043,6 +1044,8 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
AddNewDeviceFragmentDirections.actionGlobalBrowser(customTabSessionId)
BrowserDirection.FromAddSearchEngineFragment ->
AddSearchEngineFragmentDirections.actionGlobalBrowser(customTabSessionId)
BrowserDirection.FromSearchEngineFragment ->
SearchEngineFragmentDirections.actionGlobalBrowser(customTabSessionId)
BrowserDirection.FromSaveSearchEngineFragment ->
SaveSearchEngineFragmentDirections.actionGlobalBrowser(customTabSessionId)
BrowserDirection.FromAddonDetailsFragment ->

@ -58,6 +58,7 @@ object SupportUtils {
COOKIE_BANNER("cookie-banner-reduction-firefox-android"),
UNSIGNED_ADDONS("unsigned-addons"),
REVIEW_QUALITY_CHECK("review_checker_mobile"),
FX_SUGGEST("search-suggestions-firefox"),
}
enum class MozillaPage(internal val path: String) {

@ -13,6 +13,8 @@ import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreference
import mozilla.components.browser.state.state.selectedOrDefaultSearchEngine
import mozilla.components.support.ktx.android.view.hideKeyboard
import org.mozilla.fenix.BrowserDirection
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.getPreferenceKey
@ -20,6 +22,7 @@ import org.mozilla.fenix.ext.navigateWithBreadcrumb
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.ext.showToolbar
import org.mozilla.fenix.settings.SharedPreferenceUpdater
import org.mozilla.fenix.settings.SupportUtils
import org.mozilla.fenix.settings.requirePreference
import org.mozilla.gecko.search.SearchWidgetProvider
@ -37,6 +40,9 @@ class SearchEngineFragment : PreferenceFragmentCompat() {
requirePreference<SwitchPreference>(R.string.pref_key_show_nonsponsored_suggestions).apply {
isVisible = context.settings().enableFxSuggest
}
requirePreference<Preference>(R.string.pref_key_learn_about_fx_suggest).apply {
isVisible = context.settings().enableFxSuggest
}
view?.hideKeyboard()
}
@ -171,6 +177,15 @@ class SearchEngineFragment : PreferenceFragmentCompat() {
)
}
}
getPreferenceKey(R.string.pref_key_learn_about_fx_suggest) -> {
(activity as HomeActivity).openToBrowserAndLoad(
searchTermOrURL = SupportUtils.getGenericSumoURLForTopic(
SupportUtils.SumoTopic.FX_SUGGEST,
),
newTab = true,
from = BrowserDirection.FromSearchEngineFragment,
)
}
}
return super.onPreferenceTreeClick(preference)

@ -116,7 +116,8 @@
<string name="pref_key_enable_autocomplete_urls" translatable="false">pref_key_enable_domain_autocomplete</string>
<string name="pref_key_show_sponsored_suggestions" translatable="false">pref_key_show_sponsored_suggestions</string>
<string name="pref_key_show_nonsponsored_suggestions" translatable="false">pref_key_show_nonsponsored_suggestions</string>
<string name="pref_key_learn_about_fx_suggest" translatable="false">pref_key_learn_about_fx_suggest</string>
<!-- Site Permissions Settings -->
<string name="pref_key_site_permissions_description" translatable="false">pref_key_site_permissions_description</string>
<string name="pref_key_show_site_exceptions" translatable="false">pref_key_show_site_exceptions</string>

@ -395,8 +395,16 @@
<string name="preferences_search">Search</string>
<!-- Preference for settings related to Search engines -->
<string name="preferences_search_engines">Search engines</string>
<!-- Preference for settings related to Search engines suggestions-->
<string name="preferences_search_engines_suggestions">Suggestions from search engines</string>
<!-- Preference for settings related to Search address bar -->
<string name="preferences_search_address_bar">Address bar</string>
<string name="preferences_search_address_bar" moz:removedIn="120" tools:ignore="UnusedResources">Address bar</string>
<!-- Preference Category for settings related to Search address bar -->
<string name="preferences_settings_address_bar">Address bar preferences</string>
<!-- Preference Category for settings to Firefox Suggest -->
<string name="preference_search_address_bar_fx_suggest">Address bar - Firefox Suggest</string>
<!-- Preference link to Learn more about Firefox Suggest -->
<string name="preference_search_learn_about_fx_suggest">Learn more about Firefox Suggest</string>
<!-- Preference link to rating Fenix on the Play Store -->
<string name="preferences_rate">Rate on Google Play</string>
<!-- Preference linking to about page for Fenix

@ -21,21 +21,30 @@
</PreferenceCategory>
<PreferenceCategory
android:title="@string/preferences_search_address_bar"
android:title="@string/preferences_search_engines_suggestions"
android:selectable="false"
app:iconSpaceReserved="false"
android:layout="@layout/preference_category_no_icon_style">
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="true"
android:key="@string/pref_key_enable_autocomplete_urls"
android:title="@string/preferences_enable_autocomplete_urls" />
<SwitchPreference
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="true"
android:key="@string/pref_key_show_clipboard_suggestions"
android:title="@string/preferences_show_clipboard_suggestions" />
<SwitchPreference
android:key="@string/pref_key_show_search_suggestions"
android:title="@string/preferences_show_search_suggestions" />
<CheckBoxPreference
android:defaultValue="false"
android:dependency="@string/pref_key_show_search_suggestions"
android:key="@string/pref_key_show_search_suggestions_in_private"
android:layout="@layout/checkbox_left_preference"
android:title="@string/preferences_show_search_suggestions_in_private"
app:iconSpaceReserved="false" />
</PreferenceCategory>
<PreferenceCategory
android:title="@string/preference_search_address_bar_fx_suggest"
android:selectable="false"
app:iconSpaceReserved="false"
android:layout="@layout/preference_category_no_icon_style">
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="true"
android:key="@string/pref_key_search_browsing_history"
@ -50,23 +59,6 @@
android:defaultValue="true"
android:key="@string/pref_key_search_synced_tabs"
android:title='@string/preferences_search_synced_tabs' />
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="true"
android:key="@string/pref_key_show_voice_search"
android:title="@string/preferences_show_voice_search" />
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="true"
android:key="@string/pref_key_show_search_suggestions"
android:title="@string/preferences_show_search_suggestions" />
<CheckBoxPreference
android:defaultValue="false"
android:dependency="@string/pref_key_show_search_suggestions"
android:key="@string/pref_key_show_search_suggestions_in_private"
android:layout="@layout/checkbox_left_preference"
android:title="@string/preferences_show_search_suggestions_in_private"
app:iconSpaceReserved="false" />
<SwitchPreference
app:iconSpaceReserved="false"
android:key="@string/pref_key_show_nonsponsored_suggestions"
@ -77,5 +69,31 @@
android:key="@string/pref_key_show_sponsored_suggestions"
android:title="@string/preferences_show_sponsored_suggestions"
android:summary="@string/preferences_show_sponsored_suggestions_summary" />
<Preference
app:iconSpaceReserved="false"
android:key="@string/pref_key_learn_about_fx_suggest"
android:title="@string/preference_search_learn_about_fx_suggest" />
</PreferenceCategory>
<PreferenceCategory
android:title="@string/preferences_settings_address_bar"
android:selectable="false"
app:iconSpaceReserved="false"
android:layout="@layout/preference_category_no_icon_style">
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="true"
android:key="@string/pref_key_show_clipboard_suggestions"
android:title="@string/preferences_show_clipboard_suggestions" />
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="true"
android:key="@string/pref_key_enable_autocomplete_urls"
android:title="@string/preferences_enable_autocomplete_urls" />
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="true"
android:key="@string/pref_key_show_voice_search"
android:title="@string/preferences_show_voice_search" />
</PreferenceCategory>
</PreferenceScreen>

@ -98,6 +98,11 @@ class SearchEngineFragmentTest {
} returns mockk(relaxed = true) {
every { context } returns testContext
}
every {
fragment.findPreference<Preference>(testContext.getString(R.string.pref_key_learn_about_fx_suggest))
} returns mockk(relaxed = true) {
every { context } returns testContext
}
// This preference is the sole purpose of this test
every {
fragment.findPreference<SwitchPreference>(voiceSearchPreferenceKey)

Loading…
Cancel
Save