For #15372 Optimize the order and messages of onboarding cards

upstream-sync
Arturo Mejia 3 years ago
parent 246c192de3
commit 869c99afaa

@ -35,6 +35,7 @@ import org.mozilla.fenix.ui.robots.enhancedTrackingProtection
import org.mozilla.fenix.ui.robots.homeScreen
import org.mozilla.fenix.ui.robots.navigationToolbar
import org.mozilla.fenix.ui.robots.tabDrawer
import org.mozilla.fenix.ui.util.STRING_ONBOARDING_TRACKING_PROTECTION_HEADER
/**
* Test Suite that contains tests defined as part of the Smoke and Sanity check defined in Test rail.
@ -125,13 +126,9 @@ class SmokeTest {
verifyStartSyncHeader()
verifyAccountsSignInButton()
// Intro to other sections
verifyGetToKnowHeader()
// Automatic privacy
scrollToElementByText("Automatic privacy")
// Always-on privacy
scrollToElementByText(STRING_ONBOARDING_TRACKING_PROTECTION_HEADER)
verifyAutomaticPrivacyHeader()
verifyTrackingProtectionToggle()
verifyAutomaticPrivacyText()
// Choose your theme
@ -142,11 +139,7 @@ class SmokeTest {
verifyLightThemeDescription()
verifyLightThemeToggle()
// Browse privately
verifyBrowsePrivatelyHeader()
verifyBrowsePrivatelyText()
// Take a position
// Pick your toolbar placement
verifyTakePositionHeader()
verifyTakePositionElements()
@ -161,6 +154,7 @@ class SmokeTest {
}
@Test
@Ignore("https://github.com/mozilla-mobile/fenix/issues/18603")
// Verifies the functionality of the onboarding Start Browsing button
fun startBrowsingButtonTest() {
homeScreen {

@ -54,6 +54,9 @@ import org.mozilla.fenix.helpers.click
import org.mozilla.fenix.helpers.ext.waitNotNull
import org.mozilla.fenix.helpers.matchers.hasItem
import org.mozilla.fenix.helpers.withBitmapDrawable
import org.mozilla.fenix.ui.util.STRING_ONBOARDING_ACCOUNT_SIGN_IN_HEADER
import org.mozilla.fenix.ui.util.STRING_ONBOARDING_TOOLBAR_PLACEMENT_HEADER
import org.mozilla.fenix.ui.util.STRING_ONBOARDING_TRACKING_PROTECTION_HEADER
/**
* Implementation of Robot Pattern for the home screen menu.
@ -85,7 +88,6 @@ class HomeScreenRobot {
fun verifyStartSyncHeader() = assertStartSyncHeader()
fun verifyAccountsSignInButton() = assertAccountsSignInButton()
fun verifyGetToKnowHeader() = assertGetToKnowHeader()
fun verifyChooseThemeHeader() = assertChooseThemeHeader()
fun verifyChooseThemeText() = assertChooseThemeText()
fun verifyLightThemeToggle() = assertLightThemeToggle()
@ -95,18 +97,13 @@ class HomeScreenRobot {
fun verifyAutomaticThemeToggle() = assertAutomaticThemeToggle()
fun verifyAutomaticThemeDescription() = assertAutomaticThemeDescription()
fun verifyAutomaticPrivacyHeader() = assertAutomaticPrivacyHeader()
fun verifyTrackingProtectionToggle() = assertTrackingProtectionToggle()
fun verifyAutomaticPrivacyText() = assertAutomaticPrivacyText()
fun verifyAutomaticPrivacyText() = assertAlwaysPrivacyText()
// Browse privately
fun verifyBrowsePrivatelyHeader() = assertBrowsePrivatelyHeader()
fun verifyBrowsePrivatelyText() = assertBrowsePrivatelyText()
// Take a position
fun verifyTakePositionHeader() = assertTakePositionheader()
// Pick your toolbar placement
fun verifyTakePositionHeader() = assertTakePlacementHeader()
fun verifyTakePositionElements() {
assertTakePositionBottomRadioButton()
assertTakePositionTopRadioButton()
assertTakePlacementBottomRadioButton()
assertTakePacementTopRadioButton()
}
// Your privacy
@ -549,18 +546,15 @@ private fun assertWelcomeHeader() =
onView(allOf(withText("Welcome to ${appContext.appName}!")))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
private fun assertStartSyncHeader() =
onView(allOf(withText("Start syncing bookmarks, passwords, and more with your Firefox account.")))
private fun assertStartSyncHeader() {
scrollToElementByText(STRING_ONBOARDING_ACCOUNT_SIGN_IN_HEADER)
onView(allOf(withText(R.string.onboarding_account_sign_in_header_1)))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}
private fun assertAccountsSignInButton() =
onView(ViewMatchers.withResourceName("fxa_sign_in_button"))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
private fun assertGetToKnowHeader() =
onView(allOf(withText("Get to know ${appContext.appName}")))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
private fun assertChooseThemeHeader() {
scrollToElementByText("Choose your theme")
onView(withText("Choose your theme"))
@ -568,7 +562,7 @@ private fun assertChooseThemeHeader() {
}
private fun assertChooseThemeText() {
scrollToElementByText("Choose your theme")
onView(allOf(withText("Save some battery and your eyesight by enabling dark mode.")))
onView(allOf(withText("Save some battery and your eyesight with dark mode.")))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}
@ -608,40 +602,23 @@ private fun assertAutomaticThemeDescription() {
}
private fun assertAutomaticPrivacyHeader() {
scrollToElementByText("Automatic privacy")
onView(allOf(withText("Automatic privacy")))
scrollToElementByText(STRING_ONBOARDING_TRACKING_PROTECTION_HEADER)
onView(allOf(withText(STRING_ONBOARDING_TRACKING_PROTECTION_HEADER)))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}
private fun assertTrackingProtectionToggle() {
scrollToElementByText("Automatic privacy")
onView(withId(R.id.tracking_protection_toggle))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}
private fun assertAutomaticPrivacyText() {
scrollToElementByText("Automatic privacy")
private fun assertAlwaysPrivacyText() {
scrollToElementByText(STRING_ONBOARDING_TRACKING_PROTECTION_HEADER)
onView(
allOf(
withText(
"Privacy and security settings block trackers, malware, and companies that follow you."
R.string.onboarding_tracking_protection_description_3
)
)
)
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}
private fun assertBrowsePrivatelyHeader() {
scrollToElementByText("Browse privately")
onView(allOf(withText("Browse privately")))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}
private fun assertBrowsePrivatelyText() {
scrollToElementByText("Browse privately")
onView(allOf(withText(containsString("Update your private browsing settings."))))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}
private fun assertYourPrivacyHeader() {
scrollToElementByText("Your privacy")
onView(allOf(withText("Your privacy")))
@ -672,21 +649,21 @@ private fun assertStartBrowsingButton() {
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}
// Take a position
private fun assertTakePositionheader() {
scrollToElementByText("Take a position")
onView(allOf(withText("Take a position")))
// Pick your toolbar placement
private fun assertTakePlacementHeader() {
scrollToElementByText(STRING_ONBOARDING_TOOLBAR_PLACEMENT_HEADER)
onView(allOf(withText(STRING_ONBOARDING_TOOLBAR_PLACEMENT_HEADER)))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}
private fun assertTakePositionTopRadioButton() {
scrollToElementByText("Take a position")
private fun assertTakePacementTopRadioButton() {
scrollToElementByText(STRING_ONBOARDING_TOOLBAR_PLACEMENT_HEADER)
onView(ViewMatchers.withResourceName("toolbar_top_radio_button"))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}
private fun assertTakePositionBottomRadioButton() {
scrollToElementByText("Take a position")
private fun assertTakePlacementBottomRadioButton() {
scrollToElementByText(STRING_ONBOARDING_TOOLBAR_PLACEMENT_HEADER)
onView(ViewMatchers.withResourceName("toolbar_bottom_radio_button"))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}

@ -143,16 +143,13 @@ private fun assertEnhancedTrackingProtectionOptions() {
onView(withText("Standard (default)"))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
val stdText = "Blocks fewer trackers. Pages will load normally."
onView(withText(stdText))
onView(withText(org.mozilla.fenix.R.string.preference_enhanced_tracking_protection_standard_description_4))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
onView(withText("Strict"))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
val strictText =
"Blocks more trackers, ads, and popups. Pages load faster, but some functionality might not work."
onView(withText(strictText))
onView(withText(org.mozilla.fenix.R.string.preference_enhanced_tracking_protection_strict_description_3))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
onView(withText("Custom"))
@ -168,16 +165,13 @@ private fun assertEnhancedTrackingProtectionOptionsGrayedOut() {
onView(withText("Standard (default)"))
.check(matches(not(isEnabled(true))))
val stdText = "Blocks fewer trackers. Pages will load normally."
onView(withText(stdText))
onView(withText(org.mozilla.fenix.R.string.preference_enhanced_tracking_protection_standard_description_4))
.check(matches(not(isEnabled(true))))
onView(withText("Strict"))
.check(matches(not(isEnabled(true))))
val strictText =
"Blocks more trackers, ads, and popups. Pages load faster, but some functionality might not work."
onView(withText(strictText))
onView(withText(org.mozilla.fenix.R.string.preference_enhanced_tracking_protection_strict_description_3))
.check(matches(not(isEnabled(true))))
onView(withText("Custom"))

@ -0,0 +1,9 @@
/* 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/. */
package org.mozilla.fenix.ui.util
const val STRING_ONBOARDING_ACCOUNT_SIGN_IN_HEADER = "Sync Firefox between devices"
const val STRING_ONBOARDING_TRACKING_PROTECTION_HEADER = "Always-on privacy"
const val STRING_ONBOARDING_TOOLBAR_PLACEMENT_HEADER = "Pick your toolbar placement"

@ -12,7 +12,6 @@ import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.extensions.LayoutContainer
import mozilla.components.feature.tab.collections.TabCollection
import mozilla.components.feature.top.sites.TopSite
import org.mozilla.fenix.R
import org.mozilla.fenix.components.tips.Tip
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.home.HomeFragmentState
@ -71,6 +70,13 @@ private fun privateModeAdapterItems() = listOf(AdapterItem.PrivateBrowsingDescri
private fun onboardingAdapterItems(onboardingState: OnboardingState): List<AdapterItem> {
val items: MutableList<AdapterItem> = mutableListOf(AdapterItem.OnboardingHeader)
items.addAll(
listOf(
AdapterItem.OnboardingThemePicker,
AdapterItem.OnboardingToolbarPositionPicker,
AdapterItem.OnboardingTrackingProtection
)
)
// Customize FxA items based on where we are with the account state:
items.addAll(
when (onboardingState) {
@ -90,14 +96,6 @@ private fun onboardingAdapterItems(onboardingState: OnboardingState): List<Adapt
items.addAll(
listOf(
AdapterItem.OnboardingSectionHeader {
val appName = it.getString(R.string.app_name)
it.getString(R.string.onboarding_feature_section_header, appName)
},
AdapterItem.OnboardingTrackingProtection,
AdapterItem.OnboardingThemePicker,
AdapterItem.OnboardingPrivateBrowsing,
AdapterItem.OnboardingToolbarPositionPicker,
AdapterItem.OnboardingPrivacyNotice,
AdapterItem.OnboardingFinish
)

@ -10,35 +10,25 @@ import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.onboarding_manual_signin.view.*
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.addUnderline
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.home.HomeFragmentDirections
import org.mozilla.fenix.onboarding.OnboardingController
import org.mozilla.fenix.onboarding.OnboardingInteractor
class OnboardingManualSignInViewHolder(view: View) : RecyclerView.ViewHolder(view) {
private val headerText = view.header_text
init {
val interactor = OnboardingInteractor(OnboardingController(itemView.context))
view.fxa_sign_in_button.setOnClickListener {
it.context.components.analytics.metrics.track(Event.OnboardingManualSignIn)
val directions = HomeFragmentDirections.actionGlobalTurnOnSync()
Navigation.findNavController(view).navigate(directions)
}
view.learn_more.addUnderline()
view.learn_more.setOnClickListener {
interactor.onLearnMoreClicked()
}
}
fun bind() {
val context = itemView.context
headerText.text = context.getString(R.string.onboarding_account_sign_in_header)
headerText.text = context.getString(R.string.onboarding_account_sign_in_header_1)
}
companion object {

@ -5,7 +5,6 @@
package org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding
import android.view.View
import androidx.appcompat.widget.SwitchCompat
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.onboarding_tracking_protection.view.*
import org.mozilla.fenix.R
@ -20,29 +19,20 @@ class OnboardingTrackingProtectionViewHolder(view: View) : RecyclerView.ViewHold
private var standardTrackingProtection: OnboardingRadioButton
private var strictTrackingProtection: OnboardingRadioButton
private var trackingProtectionToggle: SwitchCompat
init {
view.header_text.setOnboardingIcon(R.drawable.ic_onboarding_tracking_protection)
trackingProtectionToggle = view.tracking_protection_toggle
standardTrackingProtection = view.tracking_protection_standard_option
strictTrackingProtection = view.tracking_protection_strict_default
view.description_text.text = view.context.getString(
R.string.onboarding_tracking_protection_description_2
R.string.onboarding_tracking_protection_description_3
)
trackingProtectionToggle.apply {
isChecked = view.context.settings().shouldUseTrackingProtection
setOnCheckedChangeListener { _, isChecked ->
updateTrackingProtectionSetting(isChecked)
updateRadioGroupState(isChecked)
}
}
setupRadioGroup(trackingProtectionToggle.isChecked)
updateRadioGroupState(trackingProtectionToggle.isChecked)
val isTrackingProtectionEnabled = view.context.settings().shouldUseTrackingProtection
setupRadioGroup(isTrackingProtectionEnabled)
updateRadioGroupState(isTrackingProtectionEnabled)
}
private fun setupRadioGroup(isChecked: Boolean) {
@ -74,15 +64,6 @@ class OnboardingTrackingProtectionViewHolder(view: View) : RecyclerView.ViewHold
strictTrackingProtection.isEnabled = isChecked
}
private fun updateTrackingProtectionSetting(enabled: Boolean) {
itemView.context.settings().shouldUseTrackingProtection = enabled
with(itemView.context.components) {
val policy = core.trackingProtectionPolicyFactory.createTrackingProtectionPolicy()
useCases.settingsUseCases.updateTrackingProtection.invoke(policy)
useCases.sessionUseCases.reload.invoke()
}
}
private fun updateTrackingProtectionPolicy() {
itemView.context?.components?.let {
val policy = it.core.trackingProtectionPolicyFactory

@ -1,22 +0,0 @@
/* 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/. */
package org.mozilla.fenix.onboarding
import android.content.Context
import org.mozilla.fenix.BrowserDirection
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.settings.SupportUtils
class OnboardingController(
private val context: Context
) {
fun handleLearnMoreClicked() {
(context as HomeActivity).openToBrowserAndLoad(
searchTermOrURL = SupportUtils.getFirefoxAccountSumoUrl(),
newTab = true,
from = BrowserDirection.FromHome
)
}
}

@ -1,14 +0,0 @@
/* 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/. */
package org.mozilla.fenix.onboarding
class OnboardingInteractor(private val onboardingController: OnboardingController) {
/**
* Called when the user clicks the learn more link
* @param url the url the suggestion was providing
*/
fun onLearnMoreClicked() = onboardingController.handleLearnMoreClicked()
}

@ -8,9 +8,9 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:fillColor="?accent"
android:pathData="M17.6655,14.2092C16.1843,12.4998 14.1333,14.8 11.9997,14.8C9.8675,14.8 7.8151,12.4998 6.3339,14.2092C5.9139,14.6936 5.8803,15.3992 6.2401,15.9284C7.4959,17.7764 9.5959,19 11.9997,19C14.4035,19 16.5035,17.7764 17.7593,15.9284C18.1205,15.3992 18.0855,14.6936 17.6655,14.2092M16.25,9.25C16.25,6.9026 14.3474,5 12,5C9.6526,5 7.75,6.9026 7.75,9.25C7.75,11.5974 9.6526,13.5 12,13.5C14.3474,13.5 16.25,11.5974 16.25,9.25Z" />
<path
android:fillColor="@android:color/white"
android:fillColor="?accent"
android:pathData="M12,22C6.4772,22 2,17.5228 2,12C2,6.4772 6.4772,2 12,2C17.5228,2 22,6.4772 22,12C21.9939,17.5203 17.5203,21.9939 12,22L12,22ZM12,4C7.5817,4 4,7.5817 4,12C4,16.4183 7.5817,20 12,20C16.4183,20 20,16.4183 20,12C19.995,7.5838 16.4162,4.005 12,4Z" />
</vector>

@ -7,7 +7,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/onboarding_card"
style="@style/OnboardingCardDark"
style="@style/OnboardingCardLightWithPadding"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
@ -26,37 +26,31 @@
android:id="@+id/header_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/Header16TextStyle"
android:textAppearance="@style/HeaderTextStyle"
android:lineSpacingExtra="8sp"
android:textColor="@color/neutral_text"
app:drawableTint="@color/white_color"
android:layout_marginTop="10dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/avatar_icon"
android:layout_marginStart="52dp"
tools:text="@string/onboarding_account_sign_in_header"
/>
tools:text="@string/onboarding_account_sign_in_header_1" />
<org.mozilla.fenix.utils.LinkTextView
android:id="@+id/learn_more"
<TextView
android:id="@+id/description_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/onboarding_manual_sign_in_learn_more"
android:textAppearance="@style/Header16TextStyle"
android:textColor="@color/neutral_text"
app:layout_constraintStart_toStartOf="@id/header_text"
app:layout_constraintTop_toBottomOf="@id/header_text"
tools:textColor="@color/neutral_text" />
android:layout_marginTop="14dp"
android:text="@string/onboarding_manual_sign_in_description"
android:textAppearance="@style/Body14TextStyle"
app:layout_constraintStart_toStartOf="@id/avatar_icon"
app:layout_constraintTop_toBottomOf="@id/avatar_icon" />
<Button
style="@style/NeutralButton"
android:id="@+id/fxa_sign_in_button"
android:background="@drawable/onboarding_padded_background"
style="@style/NeutralOnboardingButton"
android:layout_marginTop="10dp"
android:text="@string/onboarding_firefox_account_sign_in"
app:layout_constraintTop_toBottomOf="@id/learn_more"
android:text="@string/onboarding_firefox_account_sign_in_1"
app:layout_constraintTop_toBottomOf="@id/description_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="parent"
app:backgroundTint="@color/foundation_light_theme" />
app:layout_constraintStart_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -29,7 +29,7 @@
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="@string/onboarding_theme_picker_description1"
android:text="@string/onboarding_theme_picker_description_2"
android:textAppearance="@style/Body14TextStyle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/header_text" />

@ -18,7 +18,7 @@
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingBottom="14dp"
android:text="@string/onboarding_toolbar_position_header"
android:text="@string/onboarding_toolbar_placement_header_1"
android:textAppearance="@style/HeaderTextStyle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -29,52 +29,11 @@
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="@string/onboarding_toolbar_position_description"
android:text="@string/onboarding_toolbar_placement_description_1"
android:textAppearance="@style/Body14TextStyle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/header_text" />
<TextView
android:id="@+id/toolbar_top_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/preference_top_toolbar"
android:textColor="?primaryText"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="@+id/toolbar_top_image"
app:layout_constraintStart_toStartOf="@id/toolbar_top_image"
app:layout_constraintTop_toBottomOf="@id/toolbar_top_image"
app:layout_constraintBottom_toBottomOf="parent"/>
<org.mozilla.fenix.onboarding.OnboardingRadioButton
android:id="@+id/toolbar_top_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/preference_top_toolbar"
android:elevation="1dp"
android:theme="@style/Checkable.Colored"
android:translationX="@dimen/onboarding_dual_pane_radio_button_translation_x"
android:translationY="@dimen/onboarding_dual_pane_radio_button_translation_y"
app:layout_constraintStart_toStartOf="@+id/toolbar_top_image"
app:layout_constraintTop_toBottomOf="@+id/description_text"
app:layout_constraintTop_toTopOf="@+id/toolbar_top_image"
app:onboardingKey="@string/pref_key_toolbar_top" />
<ImageView
android:id="@+id/toolbar_top_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:contentDescription="@string/preference_top_toolbar"
android:foreground="@drawable/rounded_ripple"
app:layout_constraintEnd_toStartOf="@+id/toolbar_bottom_image"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/description_text"
app:srcCompat="@drawable/onboarding_toolbar_top" />
<org.mozilla.fenix.onboarding.OnboardingRadioButton
android:id="@+id/toolbar_bottom_radio_button"
android:layout_width="wrap_content"
@ -98,9 +57,9 @@
android:layout_marginEnd="16dp"
android:contentDescription="@string/preference_bottom_toolbar"
android:foreground="@drawable/rounded_ripple"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/toolbar_top_image"
app:layout_constraintEnd_toStartOf="@+id/toolbar_top_image"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/description_text"
app:srcCompat="@drawable/onboarding_toolbar_bottom" />
@ -117,5 +76,45 @@
app:layout_constraintTop_toBottomOf="@id/toolbar_bottom_image"
app:layout_constraintBottom_toBottomOf="parent"/>
<TextView
android:id="@+id/toolbar_top_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/preference_top_toolbar"
android:textColor="?primaryText"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="@+id/toolbar_top_image"
app:layout_constraintStart_toStartOf="@id/toolbar_top_image"
app:layout_constraintTop_toBottomOf="@id/toolbar_top_image"
app:layout_constraintBottom_toBottomOf="parent"/>
<org.mozilla.fenix.onboarding.OnboardingRadioButton
android:id="@+id/toolbar_top_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/preference_top_toolbar"
android:elevation="1dp"
android:theme="@style/Checkable.Colored"
android:translationX="@dimen/onboarding_dual_pane_radio_button_translation_x"
android:translationY="@dimen/onboarding_dual_pane_radio_button_translation_y"
app:layout_constraintStart_toStartOf="@+id/toolbar_top_image"
app:layout_constraintTop_toBottomOf="@+id/description_text"
app:layout_constraintTop_toTopOf="@+id/toolbar_top_image"
app:onboardingKey="@string/pref_key_toolbar_top" />
<ImageView
android:id="@+id/toolbar_top_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:contentDescription="@string/preference_top_toolbar"
android:foreground="@drawable/rounded_ripple"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/toolbar_bottom_image"
app:layout_constraintTop_toBottomOf="@+id/description_text"
app:srcCompat="@drawable/onboarding_toolbar_top" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -18,23 +18,13 @@
android:drawablePadding="12dp"
android:gravity="center_vertical"
android:lines="1"
android:text="@string/onboarding_tracking_protection_header_2"
android:text="@string/onboarding_tracking_protection_header_3"
android:textAppearance="@style/HeaderTextStyle"
app:layout_constraintEnd_toStartOf="@id/tracking_protection_toggle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:drawableStart="@drawable/ic_onboarding_tracking_protection" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/tracking_protection_toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="48dp"
android:minHeight="48dp"
app:layout_constraintBottom_toBottomOf="@id/header_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/header_text" />
<TextView
android:id="@+id/description_text"
android:layout_width="match_parent"
@ -44,7 +34,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/header_text"
tools:text="@string/onboarding_tracking_protection_description_2" />
tools:text="@string/onboarding_tracking_protection_description_3" />
<org.mozilla.fenix.onboarding.OnboardingRadioButton
@ -64,7 +54,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/description_text"
app:onboardingKey="@string/pref_key_tracking_protection_standard_option"
app:onboardingKeyDescription="@string/onboarding_tracking_protection_standard_button_description_2"
app:onboardingKeyDescription="@string/onboarding_tracking_protection_standard_button_description_3"
app:onboardingKeyTitle="@string/onboarding_tracking_protection_standard_button_2"
tools:text="Standard" />
@ -87,7 +77,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tracking_protection_standard_option"
app:onboardingKey="@string/pref_key_tracking_protection_strict_default"
app:onboardingKeyDescription="@string/onboarding_tracking_protection_strict_button_description_2"
app:onboardingKeyDescription="@string/onboarding_tracking_protection_strict_button_description_3"
app:onboardingKeyTitle="@string/onboarding_tracking_protection_strict_option"
tools:text="Strict" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -1144,9 +1144,6 @@
<string name="onboarding_header">Welcome to %s!</string>
<!-- text for the Firefox Accounts section header -->
<string name="onboarding_fxa_section_header">Already have an account?</string>
<!-- text for the Firefox Preview feature section header
The first parameter is the name of the app (e.g. Firefox Preview) -->
<string name="onboarding_feature_section_header">Get to know %s</string>
<!-- text for the "What's New" onboarding card header -->
<string name="onboarding_whats_new_header1">See whats new</string>
<!-- text for the "what's new" onboarding card description
@ -1155,9 +1152,9 @@
<!-- text for underlined clickable link that is part of "what's new" onboarding card description that links to an FAQ -->
<string name="onboarding_whats_new_description_linktext">Get answers here</string>
<!-- text for the Firefox account onboarding sign in card header -->
<string name="onboarding_account_sign_in_header">Start syncing bookmarks, passwords, and more with your Firefox account.</string>
<string name="onboarding_account_sign_in_header_1">Sync Firefox between devices</string>
<!-- Text for the button to learn more about signing in to your Firefox account -->
<string name="onboarding_manual_sign_in_learn_more">Learn more</string>
<string name="onboarding_manual_sign_in_description">Bring bookmarks, history, and passwords to Firefox on this device.</string>
<!-- text for the firefox account onboarding card header when we detect you're already signed in to
another Firefox browser. (The word `Firefox` should not be translated)
The first parameter is the email of the detected user's account -->
@ -1166,8 +1163,8 @@
<string name="onboarding_firefox_account_auto_signin_confirm">Yes, sign me in</string>
<!-- text for the automatic sign-in button while signing in is in process -->
<string name="onboarding_firefox_account_signing_in">Signing in&#8230;</string>
<!-- text for the button to manually sign into Firefox account. The word "Firefox" should not be translated -->
<string name="onboarding_firefox_account_sign_in">Sign in to Firefox</string>
<!-- text for the button to manually sign into Firefox account. -->
<string name="onboarding_firefox_account_sign_in_1">Sign up</string>
<!-- text for the button to stay signed out when presented with an option to automatically sign-in. -->
<string name="onboarding_firefox_account_stay_signed_out">Stay signed out</string>
<!-- text to display in the snackbar once account is signed-in -->
@ -1175,26 +1172,23 @@
<!-- text to display in the snackbar if automatic sign-in fails. user may try again -->
<string name="onboarding_firefox_account_automatic_signin_failed">Failed to sign-in</string>
<!-- text for the tracking protection onboarding card header -->
<string name="onboarding_tracking_protection_header_2">Automatic privacy</string>
<!-- text for the tracking protection card description
The first parameter is the name of the app (e.g. Firefox Preview) -->
<string name="onboarding_tracking_protection_description_2">Privacy and security settings block trackers, malware, and companies that follow you.</string>
<string name="onboarding_tracking_protection_header_3">Always-on privacy</string>
<!-- text for the tracking protection card description. 'Firefox' intentionally hardcoded here -->
<string name="onboarding_tracking_protection_description_3">Firefox automatically stops companies from secretly following you around the web.</string>
<!-- text for tracking protection radio button option for standard level of blocking -->
<string name="onboarding_tracking_protection_standard_button_2">Standard (default)</string>
<!-- text for standard blocking option button description -->
<string name="onboarding_tracking_protection_standard_button_description_2">Blocks fewer trackers. Pages will load normally.</string>
<string name="onboarding_tracking_protection_standard_button_description_3">Balanced for privacy and performance. Pages load normally.</string>
<!-- text for tracking protection radio button option for strict level of blocking -->
<string name="onboarding_tracking_protection_strict_button">Strict (recommended)</string>
<!-- text for tracking protection radio button option for strict level of blocking -->
<string name="onboarding_tracking_protection_strict_option">Strict</string>
<!-- text for strict blocking option button description -->
<string name="onboarding_tracking_protection_strict_button_description_2">Blocks more trackers, ads, and popups. Pages load faster, but some functionality might not work.</string>
<!-- text for the toolbar position card header
In English this is an idiom for "choose a side as in an argument or fight"
but it is ok to make this more literally about "choosing a position in a physical space -->
<string name="onboarding_toolbar_position_header">Take a position</string>
<string name="onboarding_tracking_protection_strict_button_description_3">Blocks more trackers so pages load faster, but some on-page functionally may break.</string>
<!-- text for the toolbar position card header -->
<string name="onboarding_toolbar_placement_header_1">Pick your toolbar placement</string>
<!-- text for the toolbar position card description -->
<string name="onboarding_toolbar_position_description">Try one-handed browsing with the bottom toolbar or move it to the top.</string>
<string name="onboarding_toolbar_placement_description_1">Put the toolbar within easy reach. Keep it on the bottom, or move it to the top.</string>
<!-- text for the private browsing onboarding card header -->
<string name="onboarding_private_browsing_header">Browse privately</string>
<!-- text for the private browsing onboarding card description
@ -1207,7 +1201,7 @@
<!-- text for the privacy notice onboarding card header -->
<string name="onboarding_privacy_notice_header">Your privacy</string>
<!-- text for the privacy notice onboarding card description
The first parameter is the name of the app (e.g. Firefox Preview) -->
The first parameter is the name of the app (e.g. Firefox Preview) Substitute %s for long browser name. -->
<string name="onboarding_privacy_notice_description2">Weve designed %s to give you control over what you share online and what you share with us.</string>
<!-- Text for the button to read the privacy notice -->
<string name="onboarding_privacy_notice_read_button">Read our privacy notice</string>
@ -1221,7 +1215,7 @@
<!-- text for the theme picker onboarding card header -->
<string name="onboarding_theme_picker_header">Choose your theme</string>
<!-- text for the theme picker onboarding card description -->
<string name="onboarding_theme_picker_description1">Save some battery and your eyesight by enabling dark mode.</string>
<string name="onboarding_theme_picker_description_2">Save some battery and your eyesight with dark mode.</string>
<!-- Automatic theme setting (will follow device setting) -->
<string name="onboarding_theme_automatic_title">Automatic</string>
<!-- Summary of automatic theme setting (will follow device setting) -->
@ -1276,13 +1270,13 @@
<!-- Preference for enhanced tracking protection for the standard protection settings -->
<string name="preference_enhanced_tracking_protection_standard_default_1">Standard (default)</string>
<!-- Preference description for enhanced tracking protection for the standard protection settings -->
<string name="preference_enhanced_tracking_protection_standard_description_3">Blocks fewer trackers. Pages will load normally.</string>
<string name="preference_enhanced_tracking_protection_standard_description_4">Balanced for privacy and performance. Pages load normally.</string>
<!-- Accessibility text for the Standard protection information icon -->
<string name="preference_enhanced_tracking_protection_standard_info_button">Whats blocked by standard tracking protection</string>
<!-- Preference for enhanced tracking protection for the strict protection settings -->
<string name="preference_enhanced_tracking_protection_strict">Strict</string>
<!-- Preference description for enhanced tracking protection for the strict protection settings -->
<string name="preference_enhanced_tracking_protection_strict_description_2">Blocks more trackers, ads, and popups. Pages load faster, but some functionality might not work.</string>
<string name="preference_enhanced_tracking_protection_strict_description_3">Blocks more trackers so pages load faster, but some on-page functionally may break.</string>
<!-- Accessibility text for the Strict protection information icon -->
<string name="preference_enhanced_tracking_protection_strict_info_button">Whats blocked by strict tracking protection</string>
<!-- Preference for enhanced tracking protection for the custom protection settings -->

@ -18,13 +18,13 @@
android:defaultValue="true"
android:dependency="@string/pref_key_tracking_protection"
android:key="@string/pref_key_tracking_protection_standard_option"
android:summary="@string/preference_enhanced_tracking_protection_standard_description_3"
android:summary="@string/preference_enhanced_tracking_protection_standard_description_4"
android:title="@string/preference_enhanced_tracking_protection_standard_default_1" />
<org.mozilla.fenix.settings.RadioButtonInfoPreference
android:defaultValue="false"
android:dependency="@string/pref_key_tracking_protection"
android:key="@string/pref_key_tracking_protection_strict_default"
android:summary="@string/preference_enhanced_tracking_protection_strict_description_2"
android:summary="@string/preference_enhanced_tracking_protection_strict_description_3"
android:title="@string/preference_enhanced_tracking_protection_strict" />
<org.mozilla.fenix.settings.RadioButtonInfoPreference
android:defaultValue="false"

@ -9,9 +9,7 @@ import android.view.View
import android.view.ViewGroup
import androidx.navigation.NavController
import androidx.navigation.Navigation
import io.mockk.Runs
import io.mockk.every
import io.mockk.just
import io.mockk.mockk
import io.mockk.mockkStatic
import io.mockk.unmockkStatic
@ -23,16 +21,15 @@ import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mozilla.fenix.R
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
import org.mozilla.fenix.home.HomeFragmentDirections
import org.mozilla.fenix.onboarding.OnboardingInteractor
@RunWith(FenixRobolectricTestRunner::class)
class OnboardingManualSignInViewHolderTest {
private lateinit var view: View
private lateinit var navController: NavController
private lateinit var interactor: OnboardingInteractor
private lateinit var itemView: ViewGroup
@Before
@ -40,12 +37,10 @@ class OnboardingManualSignInViewHolderTest {
view = LayoutInflater.from(testContext)
.inflate(OnboardingManualSignInViewHolder.LAYOUT_ID, null)
navController = mockk(relaxed = true)
interactor = mockk(relaxUnitFun = true)
itemView = mockk(relaxed = true)
mockkStatic(Navigation::class)
every { itemView.context } returns testContext
every { interactor.onLearnMoreClicked() } just Runs
every { Navigation.findNavController(view) } returns navController
}
@ -57,9 +52,9 @@ class OnboardingManualSignInViewHolderTest {
@Test
fun `bind header text`() {
OnboardingManualSignInViewHolder(view).bind()
val string = testContext.getString(R.string.onboarding_account_sign_in_header_1)
assertEquals(
"Start syncing bookmarks, passwords, and more with your Firefox account.",
string,
view.header_text.text
)
}

@ -32,9 +32,7 @@ class OnboardingTrackingProtectionViewHolderTest {
fun `sets description text`() {
OnboardingTrackingProtectionViewHolder(view)
assertEquals(
"Privacy and security settings block trackers, malware, and companies that follow you.",
view.description_text.text
)
val string = testContext.getString(R.string.onboarding_tracking_protection_description_3)
assertEquals(string, view.description_text.text)
}
}

Loading…
Cancel
Save