1
0
Fork 0

No issue: Fix search suggestions strings

master
ekager 2019-12-02 18:05:55 +00:00 committed by Emily Kager
parent 401cc37f99
commit 3df32edff0
4 changed files with 58 additions and 48 deletions

View File

@ -151,7 +151,7 @@ class ThreeDotMenuMainRobot {
} }
fun openWhatsNew(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition { fun openWhatsNew(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
mDevice.waitNotNull(Until.findObject(By.text("What's New")), waitingTime) mDevice.waitNotNull(Until.findObject(By.text("Whats New")), waitingTime)
whatsNewButton().click() whatsNewButton().click()
BrowserRobot().interact() BrowserRobot().interact()
@ -256,7 +256,9 @@ private fun ShareALinkTitle() =
private fun assertShareALinkTitle() = ShareALinkTitle() private fun assertShareALinkTitle() = ShareALinkTitle()
private fun whatsNewButton() = onView(allOf(withText("What's New"), private fun whatsNewButton() = onView(
allOf(
withText("Whats New"),
withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
private fun assertWhatsNewButton() = whatsNewButton() private fun assertWhatsNewButton() = whatsNewButton()
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) .check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))

View File

@ -37,14 +37,14 @@ import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.components.StoreProvider import org.mozilla.fenix.components.StoreProvider
import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.getSpannable import org.mozilla.fenix.ext.getSpannable
import org.mozilla.fenix.ext.hideToolbar import org.mozilla.fenix.ext.hideToolbar
import org.mozilla.fenix.ext.requireComponents import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.search.awesomebar.AwesomeBarView import org.mozilla.fenix.search.awesomebar.AwesomeBarView
import org.mozilla.fenix.search.toolbar.ToolbarView import org.mozilla.fenix.search.toolbar.ToolbarView
import org.mozilla.fenix.settings.SupportUtils import org.mozilla.fenix.settings.SupportUtils
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.settings
@Suppress("TooManyFunctions", "LargeClass") @Suppress("TooManyFunctions", "LargeClass")
class SearchFragment : Fragment(), UserInteractionHandler { class SearchFragment : Fragment(), UserInteractionHandler {
@ -86,12 +86,13 @@ class SearchFragment : Fragment(), UserInteractionHandler {
requireComponents.search.provider.getDefaultEngine(requireContext()) requireComponents.search.provider.getDefaultEngine(requireContext())
) )
val showSearchSuggestions = if ((activity as HomeActivity).browsingModeManager.mode.isPrivate) { val showSearchSuggestions =
requireContext().settings().shouldShowSearchSuggestions && if ((activity as HomeActivity).browsingModeManager.mode.isPrivate) {
requireContext().settings().shouldShowSearchSuggestionsInPrivate requireContext().settings().shouldShowSearchSuggestions &&
} else { requireContext().settings().shouldShowSearchSuggestionsInPrivate
requireContext().settings().shouldShowSearchSuggestions } else {
} requireContext().settings().shouldShowSearchSuggestions
}
searchStore = StoreProvider.get(this) { searchStore = StoreProvider.get(this) {
SearchFragmentStore( SearchFragmentStore(
@ -199,7 +200,8 @@ class SearchFragment : Fragment(), UserInteractionHandler {
(activity as HomeActivity) (activity as HomeActivity)
.openToBrowserAndLoad( .openToBrowserAndLoad(
searchTermOrURL = SupportUtils.getGenericSumoURLForTopic( searchTermOrURL = SupportUtils.getGenericSumoURLForTopic(
SupportUtils.SumoTopic.SEARCH_SUGGESTION), SupportUtils.SumoTopic.SEARCH_SUGGESTION
),
newTab = searchStore.state.session == null, newTab = searchStore.state.session == null,
from = BrowserDirection.FromSearch from = BrowserDirection.FromSearch
) )
@ -216,11 +218,12 @@ class SearchFragment : Fragment(), UserInteractionHandler {
context?.settings()?.shouldShowSearchSuggestionsInPrivate = false context?.settings()?.shouldShowSearchSuggestionsInPrivate = false
context?.settings()?.showSearchSuggestionsInPrivateOnboardingFinished = true context?.settings()?.showSearchSuggestionsInPrivateOnboardingFinished = true
} }
inflated.text.text =
getString(R.string.search_suggestions_onboarding_text, getString(R.string.app_name))
} }
view.search_suggestions_onboarding.setOnInflateListener((stubListener) view.search_suggestions_onboarding.setOnInflateListener((stubListener))
)
view.toolbar_wrapper.clipToOutline = false view.toolbar_wrapper.clipToOutline = false
@ -263,7 +266,10 @@ class SearchFragment : Fragment(), UserInteractionHandler {
toolbarView.view.requestFocus() toolbarView.view.requestFocus()
} }
updateClipboardSuggestion(searchStore.state, requireContext().components.clipboardHandler.url) updateClipboardSuggestion(
searchStore.state,
requireContext().components.clipboardHandler.url
)
permissionDidUpdate = false permissionDidUpdate = false
hideToolbar() hideToolbar()
@ -292,7 +298,7 @@ class SearchFragment : Fragment(), UserInteractionHandler {
private fun updateClipboardSuggestion(searchState: SearchFragmentState, clipboardUrl: String?) { private fun updateClipboardSuggestion(searchState: SearchFragmentState, clipboardUrl: String?) {
val visibility = val visibility =
if (searchState.showClipboardSuggestions && searchState.query.isEmpty() && !clipboardUrl.isNullOrEmpty()) if (searchState.showClipboardSuggestions && searchState.query.isEmpty() && !clipboardUrl.isNullOrEmpty())
View.VISIBLE else View.GONE View.VISIBLE else View.GONE
fill_link_from_clipboard.visibility = visibility fill_link_from_clipboard.visibility = visibility
divider_line.visibility = visibility divider_line.visibility = visibility

View File

@ -1,11 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="20dp" android:padding="20dp"
android:paddingBottom="10dp" android:paddingBottom="10dp">
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView <ImageView
android:id="@+id/info_button" android:id="@+id/info_button"
@ -17,39 +19,39 @@
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
android:textAppearance="?android:attr/textAppearanceListItem"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="32dp" android:layout_marginStart="32dp"
android:text="@string/search_suggestions_onboarding_title"
android:paddingBottom="12dp" android:paddingBottom="12dp"
app:layout_constraintStart_toStartOf="parent" android:textAppearance="?android:attr/textAppearanceListItem"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"/> app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/search_suggestions_onboarding_title" />
<TextView <TextView
android:id="@+id/text" android:id="@+id/text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/search_suggestions_onboarding_text" android:text="@string/search_suggestions_onboarding_text"
app:layout_constraintStart_toStartOf="@id/title" android:textAppearance="?android:attr/textAppearanceSmall"
app:layout_constraintBottom_toTopOf="@id/learn_more"
app:layout_constraintEnd_toEndOf="@id/title" app:layout_constraintEnd_toEndOf="@id/title"
app:layout_constraintTop_toBottomOf="@id/title" app:layout_constraintStart_toStartOf="@id/title"
app:layout_constraintBottom_toTopOf="@id/learn_more"/> app:layout_constraintTop_toBottomOf="@id/title" />
<TextView <TextView
android:id="@+id/learn_more" android:id="@+id/learn_more"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?attr/accentHighContrast"
android:textStyle="bold"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/exceptions_empty_message_learn_more_link" android:text="@string/exceptions_empty_message_learn_more_link"
app:layout_constraintStart_toStartOf="@id/title" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?attr/accentHighContrast"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@id/allow"
app:layout_constraintEnd_toEndOf="@id/title" app:layout_constraintEnd_toEndOf="@id/title"
app:layout_constraintTop_toBottomOf="@id/text" app:layout_constraintStart_toStartOf="@id/title"
app:layout_constraintBottom_toTopOf="@id/allow"/> app:layout_constraintTop_toBottomOf="@id/text" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/allow" android:id="@+id/allow"
@ -58,20 +60,20 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="12dp" android:padding="12dp"
android:text="@string/search_suggestions_onboarding_allow_button" android:text="@string/search_suggestions_onboarding_allow_button"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/title" app:layout_constraintEnd_toEndOf="@id/title"
app:layout_constraintTop_toBottomOf="@id/text" app:layout_constraintTop_toBottomOf="@id/text" />
app:layout_constraintBottom_toBottomOf="parent"/>
<TextView <TextView
android:id="@+id/dismiss" android:id="@+id/dismiss"
android:textColor="#ffffff"
android:textStyle="bold"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="20dp" android:padding="20dp"
android:text="@string/search_suggestions_onboarding_do_not_allow_button" android:text="@string/search_suggestions_onboarding_do_not_allow_button"
app:layout_constraintEnd_toStartOf="@id/allow" android:textColor="#ffffff"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/allow" app:layout_constraintBottom_toBottomOf="@id/allow"
app:layout_constraintTop_toTopOf="@id/allow"/> app:layout_constraintEnd_toStartOf="@id/allow"
app:layout_constraintTop_toTopOf="@id/allow" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -67,7 +67,7 @@
<!-- Browser menu button that sends a user to help articles --> <!-- Browser menu button that sends a user to help articles -->
<string name="browser_menu_help">Help</string> <string name="browser_menu_help">Help</string>
<!-- Browser menu button that sends a to a the what's new article --> <!-- Browser menu button that sends a to a the what's new article -->
<string name="browser_menu_whats_new">What\'s New</string> <string name="browser_menu_whats_new">What\s New</string>
<!-- Browser menu button that opens the settings menu --> <!-- Browser menu button that opens the settings menu -->
<string name="browser_menu_settings">Settings</string> <string name="browser_menu_settings">Settings</string>
<!-- Browser menu button that opens a user's library --> <!-- Browser menu button that opens a user's library -->
@ -120,11 +120,11 @@
<!-- Button in the search suggestions onboarding that allows search suggestions in private sessions --> <!-- Button in the search suggestions onboarding that allows search suggestions in private sessions -->
<string name="search_suggestions_onboarding_allow_button">Allow</string> <string name="search_suggestions_onboarding_allow_button">Allow</string>
<!-- Button in the search suggestions onboarding that does not allow search suggestions in private sessions --> <!-- Button in the search suggestions onboarding that does not allow search suggestions in private sessions -->
<string name="search_suggestions_onboarding_do_not_allow_button">Don\'t allow</string> <string name="search_suggestions_onboarding_do_not_allow_button">Don\t allow</string>
<!-- Search suggestion onboarding hint title text --> <!-- Search suggestion onboarding hint title text -->
<string name="search_suggestions_onboarding_title">Allow search suggestions in private sessions?</string> <string name="search_suggestions_onboarding_title">Allow search suggestions in private sessions?</string>
<!-- Search suggestion onboarding hint description text --> <!-- Search suggestion onboarding hint description text, first parameter is the name of the app defined in app_name (for example: Fenix)-->
<string name="search_suggestions_onboarding_text">Firefox Preview will share everything you type in the address bar with your default search engine.</string> <string name="search_suggestions_onboarding_text">%s will share everything you type in the address bar with your default search engine.</string>
<!-- Search suggestion onboarding hint Learn more link text --> <!-- Search suggestion onboarding hint Learn more link text -->
<string name="search_suggestions_onboarding_learn_more_link">Learn more</string> <string name="search_suggestions_onboarding_learn_more_link">Learn more</string>
@ -884,7 +884,7 @@
<!-- Preference description for enhanced tracking protection for the standard protection settings --> <!-- Preference description for enhanced tracking protection for the standard protection settings -->
<string name="preference_enhanced_tracking_protection_standard_description_2">Pages will load normally, but block fewer trackers.</string> <string name="preference_enhanced_tracking_protection_standard_description_2">Pages will load normally, but block fewer trackers.</string>
<!-- Accessibility text for the Standard protection information icon --> <!-- Accessibility text for the Standard protection information icon -->
<string name="preference_enhanced_tracking_protection_standard_info_button">What\'s blocked by standard tracking protection</string> <string name="preference_enhanced_tracking_protection_standard_info_button">What\s blocked by standard tracking protection</string>
<!-- Preference for enhanced tracking protection for the strict protection settings --> <!-- Preference for enhanced tracking protection for the strict protection settings -->
<string name="preference_enhanced_tracking_protection_strict">Strict</string> <string name="preference_enhanced_tracking_protection_strict">Strict</string>
<!-- Preference for enhanced tracking protection for the strict protection settings, default setting --> <!-- Preference for enhanced tracking protection for the strict protection settings, default setting -->
@ -896,7 +896,7 @@
<!-- Preference description for enhanced tracking protection for the strict protection settings --> <!-- Preference description for enhanced tracking protection for the strict protection settings -->
<string name="preference_enhanced_tracking_protection_strict_description">Stronger protection, but may cause some sites or content to break.</string> <string name="preference_enhanced_tracking_protection_strict_description">Stronger protection, but may cause some sites or content to break.</string>
<!-- Accessibility text for the Strict protection information icon --> <!-- Accessibility text for the Strict protection information icon -->
<string name="preference_enhanced_tracking_protection_strict_info_button">What\'s blocked by strict tracking protection</string> <string name="preference_enhanced_tracking_protection_strict_info_button">What\s blocked by strict tracking protection</string>
<!-- Header for categories that are being blocked by current Enhanced Tracking Protection settings --> <!-- Header for categories that are being blocked by current Enhanced Tracking Protection settings -->
<string name="enhanced_tracking_protection_blocked">Blocked</string> <string name="enhanced_tracking_protection_blocked">Blocked</string>
<!-- Header for categories that are being not being blocked by current Enhanced Tracking Protection settings --> <!-- Header for categories that are being not being blocked by current Enhanced Tracking Protection settings -->
@ -934,7 +934,7 @@
<!-- About page link text to open open source licenses screen --> <!-- About page link text to open open source licenses screen -->
<string name="about_open_source_licenses">Open source libraries we use</string> <string name="about_open_source_licenses">Open source libraries we use</string>
<!-- About page link text to open what's new link --> <!-- About page link text to open what's new link -->
<string name="about_whats_new">What\'s new in %s</string> <string name="about_whats_new">What\s new in %s</string>
<!-- Open source licenses page title <!-- Open source licenses page title
The first parameter is the app name --> The first parameter is the app name -->
<string name="open_source_licenses_title">%s | OSS Libraries</string> <string name="open_source_licenses_title">%s | OSS Libraries</string>
@ -1016,7 +1016,7 @@
<!-- Positive confirmation that Fenix should save the new or updated login --> <!-- Positive confirmation that Fenix should save the new or updated login -->
<string name="logins_doorhanger_save_confirmation">Save</string> <string name="logins_doorhanger_save_confirmation">Save</string>
<!-- Negative confirmation that Fenix should not save the new or updated login --> <!-- Negative confirmation that Fenix should not save the new or updated login -->
<string name="logins_doorhanger_save_dont_save">Don\'t save</string> <string name="logins_doorhanger_save_dont_save">Don\t save</string>
<!-- Shown in snackbar to tell user that the password has been copied --> <!-- Shown in snackbar to tell user that the password has been copied -->
<string name="logins_password_copied">Password copied to clipboard</string> <string name="logins_password_copied">Password copied to clipboard</string>
<!-- Shown in snackbar to tell user that the username has been copied --> <!-- Shown in snackbar to tell user that the username has been copied -->