For #26731 - First run onboarding updates

This commit is contained in:
sarah541 2022-08-31 15:50:35 -04:00 committed by mergify[bot]
parent bd06b626bf
commit adb7f7d48a
18 changed files with 105 additions and 167 deletions

View File

@ -593,14 +593,14 @@ private fun assertWelcomeHeader() =
assertTrue(
mDevice.findObject(
UiSelector().textContains(
getStringResource(R.string.onboarding_header)
getStringResource(R.string.onboarding_header_2)
)
).waitForExists(waitingTime)
)
private fun assertStartSyncHeader() {
scrollToElementByText(STRING_ONBOARDING_ACCOUNT_SIGN_IN_HEADER)
onView(allOf(withText(R.string.onboarding_account_sign_in_header_1)))
onView(allOf(withText(R.string.onboarding_account_sign_in_header)))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}
private fun assertAccountsSignInButton() =
@ -664,7 +664,7 @@ private fun assertAlwaysPrivacyText() {
onView(
allOf(
withText(
"$appName automatically stops companies from secretly following you around the web."
"Featuring Total Cookie Protection to stop trackers from using cookies to stalk you across sites."
)
)
)
@ -672,17 +672,17 @@ private fun assertAlwaysPrivacyText() {
}
private fun assertYourPrivacyHeader() {
scrollToElementByText("Your privacy")
onView(allOf(withText("Your privacy")))
scrollToElementByText("You control your data")
onView(allOf(withText("You control your data")))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}
private fun assertYourPrivacyText() {
scrollToElementByText("Your privacy")
scrollToElementByText("You control your data")
onView(
allOf(
withText(
"Weve designed $appName to give you control over what you share online and what you share with us."
"Firefox gives you control over what you share online and what you share with us."
)
)
)
@ -690,7 +690,7 @@ private fun assertYourPrivacyText() {
}
private fun assertPrivacyNoticeButton() {
scrollToElementByText("Your privacy")
scrollToElementByText("You control your data")
onView(allOf(withText("Read our privacy notice")))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}

View File

@ -4,8 +4,8 @@
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_ACCOUNT_SIGN_IN_HEADER = "Pick up where you left off"
const val STRING_ONBOARDING_TRACKING_PROTECTION_HEADER = "Privacy protection by default"
const val STRING_ONBOARDING_TOOLBAR_PLACEMENT_HEADER = "Pick your toolbar placement"
const val FRENCH_LANGUAGE_HEADER = "Langues"
const val FR_SETTINGS = "Paramètres"

View File

@ -424,7 +424,7 @@ class SessionControlAdapter(
is OnboardingSectionHeaderViewHolder -> holder.bind(
(item as AdapterItem.OnboardingSectionHeader).labelBuilder
)
is OnboardingManualSignInViewHolder -> holder.bind()
is OnboardingManualSignInViewHolder,
is RecentlyVisitedViewHolder,
is RecentBookmarksViewHolder,
is RecentTabViewHolder,

View File

@ -134,7 +134,6 @@ private fun onboardingAdapterItems(onboardingState: OnboardingState): List<Adapt
listOf(
AdapterItem.OnboardingThemePicker,
AdapterItem.OnboardingToolbarPositionPicker,
AdapterItem.OnboardingTrackingProtection
)
)
// Customize FxA items based on where we are with the account state:
@ -151,6 +150,7 @@ private fun onboardingAdapterItems(onboardingState: OnboardingState): List<Adapt
items.addAll(
listOf(
AdapterItem.OnboardingTrackingProtection,
AdapterItem.OnboardingPrivacyNotice,
AdapterItem.OnboardingFinish,
AdapterItem.BottomSpacer

View File

@ -7,17 +7,9 @@ package org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import org.mozilla.fenix.R
import org.mozilla.fenix.databinding.OnboardingHeaderBinding
class OnboardingHeaderViewHolder(view: View) : RecyclerView.ViewHolder(view) {
init {
val binding = OnboardingHeaderBinding.bind(view)
val appName = view.context.getString(R.string.app_name)
binding.headerText.text = view.context.getString(R.string.onboarding_header, appName)
}
companion object {
const val LAYOUT_ID = R.layout.onboarding_header
}

View File

@ -25,15 +25,6 @@ class OnboardingManualSignInViewHolder(view: View) : RecyclerView.ViewHolder(vie
}
}
fun bind() {
val context = itemView.context
val appName = context.getString(R.string.app_name)
binding.headerText.text =
context.getString(R.string.onboarding_account_sign_in_header_1)
binding.descriptionText.text =
context.getString(R.string.onboarding_manual_sign_in_description_2, appName)
}
companion object {
const val LAYOUT_ID = R.layout.onboarding_manual_signin
}

View File

@ -19,10 +19,6 @@ class OnboardingPrivacyNoticeViewHolder(
init {
val binding = OnboardingPrivacyNoticeBinding.bind(view)
binding.headerText.setOnboardingIcon(R.drawable.ic_info)
val appName = view.context.getString(R.string.app_name)
binding.descriptionText.text = view.context.getString(R.string.onboarding_privacy_notice_description2, appName)
binding.readButton.setOnClickListener {
Onboarding.privacyNotice.record(NoExtras())

View File

@ -26,11 +26,6 @@ class OnboardingTrackingProtectionViewHolder(view: View) : RecyclerView.ViewHold
standardTrackingProtection = binding.trackingProtectionStandardOption
strictTrackingProtection = binding.trackingProtectionStrictDefault
val appName = view.context.getString(R.string.app_name)
binding.descriptionText.text = view.context.getString(
R.string.onboarding_tracking_protection_description_4, appName
)
val isTrackingProtectionEnabled = view.context.settings().shouldUseTrackingProtection
setupRadioGroup(isTrackingProtectionEnabled)
updateRadioGroupState(isTrackingProtectionEnabled)

View File

@ -2,11 +2,32 @@
<!-- 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/. -->
<Button xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/PositiveButton"
android:id="@+id/finish_button"
android:background="@drawable/onboarding_padded_background"
android:backgroundTint="?actionPrimary"
android:layout_marginBottom="10dp"
android:layout_marginHorizontal="@dimen/home_item_horizontal_margin"
android:text="@string/onboarding_finish" />
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/conclusion"
android:layout_marginTop="32dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/home_item_horizontal_margin">
<TextView
android:id="@+id/header_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/Header20TextStyle"
android:text="@string/onboarding_conclusion_header"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/finish_button"
style="@style/PositiveButton"
android:layout_marginTop="16dp"
android:layout_marginBottom="10dp"
android:background="@drawable/onboarding_padded_background"
android:backgroundTint="?actionPrimary"
android:text="@string/onboarding_finish"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/header_text" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -2,19 +2,31 @@
<!-- 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/. -->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/onboarding_header"
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/conclusion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginHorizontal="@dimen/home_item_horizontal_margin">
<TextView
android:id="@+id/header_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginHorizontal="@dimen/home_item_horizontal_margin">
android:textAppearance="@style/Header20TextStyle"
android:text="@string/onboarding_header_2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/header_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="@string/onboarding_header"
android:textAppearance="@style/HeaderTextStyle"
android:textSize="22sp" />
</FrameLayout>
android:id="@+id/subheader_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/Body14TextStyle"
android:layout_marginTop="4dp"
android:text="@string/onboarding_message"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/header_text"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -33,14 +33,14 @@
app:layout_constraintStart_toStartOf="@id/avatar_icon"
app:layout_constraintBottom_toBottomOf="@id/avatar_icon"
android:layout_marginStart="52dp"
tools:text="@string/onboarding_account_sign_in_header_1" />
android:text="@string/onboarding_account_sign_in_header" />
<TextView
android:id="@+id/description_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:text="@string/onboarding_manual_sign_in_description_2"
android:text="@string/onboarding_manual_sign_in_description"
android:textAppearance="@style/Body14TextStyle"
app:layout_constraintStart_toStartOf="@id/avatar_icon"
app:layout_constraintTop_toBottomOf="@id/header_text" />
@ -49,7 +49,7 @@
android:id="@+id/fxa_sign_in_button"
style="@style/NeutralOnboardingButton"
android:layout_marginTop="10dp"
android:text="@string/onboarding_firefox_account_sign_in_1"
android:text="@string/onboarding_firefox_account_sign_in"
app:layout_constraintTop_toBottomOf="@id/description_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="parent" />

View File

@ -15,8 +15,7 @@
android:id="@+id/header_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/onboarding_privacy_notice_header"
tools:drawableStart="@drawable/ic_info"
android:text="@string/onboarding_privacy_notice_header_1"
android:drawablePadding="12dp"
android:textAppearance="@style/HeaderTextStyle"
android:gravity="center_vertical"
@ -30,7 +29,7 @@
android:layout_height="wrap_content"
android:textAppearance="@style/Body14TextStyle"
android:layout_marginTop="14dp"
tools:text="@string/onboarding_privacy_notice_description2"
android:text="@string/onboarding_privacy_notice_description"
app:layout_constraintTop_toBottomOf="@id/header_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

View File

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

View File

@ -19,7 +19,7 @@
android:drawablePadding="12dp"
android:gravity="center_vertical"
android:lines="1"
android:text="@string/onboarding_tracking_protection_header_3"
android:text="@string/onboarding_tracking_protection_header"
android:textAppearance="@style/HeaderTextStyle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@ -35,7 +35,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_4" />
android:text="@string/onboarding_tracking_protection_description" />
<org.mozilla.fenix.onboarding.OnboardingRadioButton

View File

@ -1181,19 +1181,33 @@
<!-- Onboarding -->
<!-- Text for onboarding welcome message
The first parameter is the name of the app (e.g. Firefox Preview) -->
<string name="onboarding_header">Welcome to %s!</string>
<string name="onboarding_header" moz:RemovedIn="106" tools:ignore="UnusedResources">Welcome to %s!</string>
<!-- Text for onboarding welcome header. -->
<string name="onboarding_header_2">Welcome to a better internet</string>
<!-- Text for the onboarding welcome message. -->
<string name="onboarding_message">A browser built for people, not profits.</string>
<!-- text for the Firefox account onboarding sign in card header. The word "Firefox" should not be translated -->
<string name="onboarding_account_sign_in_header_1">Sync Firefox between devices</string>
<string name="onboarding_account_sign_in_header_1" moz:removedIn="106" tools:ignore="UnusedResources">Sync Firefox between devices</string>
<!-- Text for the Firefox account onboarding sign in card header. -->
<string name="onboarding_account_sign_in_header">Pick up where you left off</string>
<!-- Text for the button to learn more about signing in to your Firefox account. The first parameter is the name of the application.-->
<string name="onboarding_manual_sign_in_description_2">Bring bookmarks, history, and passwords to %1$s on this device.</string>
<string name="onboarding_manual_sign_in_description_2" moz:removedIn="106" tools:ignore="UnusedResources">Bring bookmarks, history, and passwords to %1$s on this device.</string>
<!-- Text for the button to learn more about signing in to your Firefox account. -->
<string name="onboarding_manual_sign_in_description">Sync tabs and passwords across devices for seamless screen-switching.</string>
<!-- text for the button to manually sign into Firefox account. -->
<string name="onboarding_firefox_account_sign_in_1">Sign up</string>
<string name="onboarding_firefox_account_sign_in_1" moz:removedIn="106" tools:ignore="UnusedResources">Sign up</string>
<!-- Text for the button to manually sign into Firefox account. -->
<string name="onboarding_firefox_account_sign_in">Sign in</string>
<!-- text to display in the snackbar once account is signed-in -->
<string name="onboarding_firefox_account_sync_is_on">Sync is on</string>
<!-- text for the tracking protection onboarding card header -->
<string name="onboarding_tracking_protection_header_3">Always-on privacy</string>
<string name="onboarding_tracking_protection_header_3" moz:removedIn="106" tools:ignore="UnusedResources">Always-on privacy</string>
<!-- Text for the tracking protection onboarding card header -->
<string name="onboarding_tracking_protection_header">Privacy protection by default</string>
<!-- text for the tracking protection card description. The first parameter is the name of the application.-->
<string name="onboarding_tracking_protection_description_4">%1$s automatically stops companies from secretly following you around the web.</string>
<string name="onboarding_tracking_protection_description_4" moz:removedIn="106" tools:ignore="UnusedResources">%1$s automatically stops companies from secretly following you around the web.</string>
<!-- Text for the tracking protection card description. -->
<string name="onboarding_tracking_protection_description">Featuring Total Cookie Protection to stop trackers from using cookies to stalk you across sites.</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 -->
@ -1205,15 +1219,22 @@
<!-- 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_placement_description_1">Put the toolbar within easy reach. Keep it on the bottom, or move it to the top.</string>
<string name="onboarding_toolbar_placement_description_1" moz:removedIn="106" tools:ignore="UnusedResources">Put the toolbar within easy reach. Keep it on the bottom, or move it to the top.</string>
<!-- Text for the toolbar position card description -->
<string name="onboarding_toolbar_placement_description">Keep it on the bottom, or move it to the top.</string>
<!-- text for the privacy notice onboarding card header -->
<string name="onboarding_privacy_notice_header">Your privacy</string>
<string name="onboarding_privacy_notice_header" moz:removedIn="106" tools:ignore="UnusedResources">Your privacy</string>
<!-- Text for the privacy notice onboarding card header -->
<string name="onboarding_privacy_notice_header_1">You control your data</string>
<!-- text for the privacy notice onboarding card description
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>
<string name="onboarding_privacy_notice_description2" moz:removedIn="106" tools:ignore="UnusedResources">Weve designed %s to give you control over what you share online and what you share with us.</string>
<!-- Text for the privacy notice onboarding card description. -->
<string name="onboarding_privacy_notice_description">Firefox gives 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>
<!-- Text for the conclusion onboarding message -->
<string name="onboarding_conclusion_header">Ready to open up an amazing internet?</string>
<!-- text for the button to finish onboarding -->
<string name="onboarding_finish">Start browsing</string>

View File

@ -1,36 +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.home.sessioncontrol.viewholders.onboarding
import android.view.LayoutInflater
import mozilla.components.support.test.robolectric.testContext
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.databinding.OnboardingHeaderBinding
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
@RunWith(FenixRobolectricTestRunner::class)
class OnboardingHeaderViewHolderTest {
private lateinit var binding: OnboardingHeaderBinding
@Before
fun setup() {
binding = OnboardingHeaderBinding.inflate(LayoutInflater.from(testContext))
}
@Test
fun `bind header text`() {
val appName = testContext.getString(R.string.app_name)
val welcomeMessage = testContext.getString(R.string.onboarding_header, appName)
OnboardingHeaderViewHolder(binding.root)
assertEquals(welcomeMessage, binding.headerText.text)
}
}

View File

@ -23,7 +23,6 @@ import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.mozilla.fenix.GleanMetrics.Onboarding
import org.mozilla.fenix.R
import org.mozilla.fenix.databinding.OnboardingManualSigninBinding
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
@ -55,16 +54,6 @@ class OnboardingManualSignInViewHolderTest {
unmockkStatic(Navigation::class)
}
@Test
fun `bind header text`() {
OnboardingManualSignInViewHolder(binding.root).bind()
val string = testContext.getString(R.string.onboarding_account_sign_in_header_1)
assertEquals(
string,
binding.headerText.text
)
}
@Test
fun `navigate on click`() {
every { testContext.components.analytics } returns mockk(relaxed = true)

View File

@ -1,42 +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.home.sessioncontrol.viewholders.onboarding
import android.view.LayoutInflater
import androidx.appcompat.view.ContextThemeWrapper
import io.mockk.every
import mozilla.components.support.test.robolectric.testContext
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.databinding.OnboardingTrackingProtectionBinding
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
import org.mozilla.fenix.utils.Settings
@RunWith(FenixRobolectricTestRunner::class)
class OnboardingTrackingProtectionViewHolderTest {
private lateinit var binding: OnboardingTrackingProtectionBinding
@Before
fun setup() {
val context = ContextThemeWrapper(testContext, R.style.NormalTheme)
binding = OnboardingTrackingProtectionBinding.inflate(LayoutInflater.from(context))
}
@Test
fun `sets description text`() {
every { testContext.components.settings } returns Settings(testContext)
OnboardingTrackingProtectionViewHolder(binding.root)
val appName = testContext.getString(R.string.app_name)
val string =
testContext.getString(R.string.onboarding_tracking_protection_description_4, appName)
assertEquals(string, binding.descriptionText.text)
}
}