mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-02 03:40:16 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/21413 - Remove unused OnboardingPrivateBrowsingViewHolder and OnboardingWhatsNewViewHolder
This commit is contained in:
parent
4a6c5b8296
commit
450055a729
@ -7422,17 +7422,6 @@
|
||||
column="1"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="UnusedResources"
|
||||
message="The resource `R.drawable.ic_whats_new_notification` appears to be unused"
|
||||
errorLine1="<layer-list xmlns:android="http://schemas.android.com/apk/res/android">"
|
||||
errorLine2="^">
|
||||
<location
|
||||
file="src/main/res/drawable/ic_whats_new_notification.xml"
|
||||
line="5"
|
||||
column="1"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="UnusedResources"
|
||||
message="The resource `R.integer.strike_thru_start_offset` appears to be unused"
|
||||
|
@ -441,23 +441,6 @@ onboarding:
|
||||
- android-probes@mozilla.com
|
||||
- erichards@mozilla.com
|
||||
expires: "2022-02-01"
|
||||
pref_toggled_private_browsing:
|
||||
type: event
|
||||
description:
|
||||
The private browsing preference was selected from the onboarding card.
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/10824
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11867
|
||||
- https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068
|
||||
- https://github.com/mozilla-mobile/fenix/pull/19924#issuecomment-861423789
|
||||
- https://github.com/mozilla-mobile/fenix/pull/20517#pullrequestreview-718069041
|
||||
data_sensitivity:
|
||||
- interaction
|
||||
notification_emails:
|
||||
- android-probes@mozilla.com
|
||||
- erichards@mozilla.com
|
||||
expires: "2022-02-01"
|
||||
pref_toggled_toolbar_position:
|
||||
type: event
|
||||
description:
|
||||
|
@ -134,7 +134,6 @@ sealed class Event {
|
||||
object OnboardingAutoSignIn : Event()
|
||||
object OnboardingManualSignIn : Event()
|
||||
object OnboardingPrivacyNotice : Event()
|
||||
object OnboardingPrivateBrowsing : Event()
|
||||
object OnboardingFinish : Event()
|
||||
object ChangedToDefaultBrowser : Event()
|
||||
object DefaultBrowserNotifTapped : Event()
|
||||
|
@ -515,9 +515,6 @@ private val Event.wrapper: EventWrapper<*>?
|
||||
{ Events.tabCounterMenuAction.record(it) },
|
||||
{ Events.tabCounterMenuActionKeys.valueOf(it) }
|
||||
)
|
||||
is Event.OnboardingPrivateBrowsing -> EventWrapper<NoExtraKeys>(
|
||||
{ Onboarding.prefToggledPrivateBrowsing.record(it) }
|
||||
)
|
||||
is Event.OnboardingPrivacyNotice -> EventWrapper<NoExtraKeys>(
|
||||
{ Onboarding.privacyNotice.record(it) }
|
||||
)
|
||||
|
@ -42,12 +42,10 @@ import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.OnboardingFi
|
||||
import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.OnboardingHeaderViewHolder
|
||||
import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.OnboardingManualSignInViewHolder
|
||||
import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.OnboardingPrivacyNoticeViewHolder
|
||||
import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.OnboardingPrivateBrowsingViewHolder
|
||||
import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.OnboardingSectionHeaderViewHolder
|
||||
import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.OnboardingThemePickerViewHolder
|
||||
import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.OnboardingToolbarPositionPickerViewHolder
|
||||
import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.OnboardingTrackingProtectionViewHolder
|
||||
import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.OnboardingWhatsNewViewHolder
|
||||
import org.mozilla.fenix.home.sessioncontrol.viewholders.pocket.PocketStoriesViewHolder
|
||||
import org.mozilla.fenix.home.tips.ButtonTipViewHolder
|
||||
import mozilla.components.feature.tab.collections.Tab as ComponentTab
|
||||
@ -156,14 +154,11 @@ sealed class AdapterItem(@LayoutRes val viewType: Int) {
|
||||
object OnboardingTrackingProtection :
|
||||
AdapterItem(OnboardingTrackingProtectionViewHolder.LAYOUT_ID)
|
||||
|
||||
object OnboardingPrivateBrowsing : AdapterItem(OnboardingPrivateBrowsingViewHolder.LAYOUT_ID)
|
||||
object OnboardingPrivacyNotice : AdapterItem(OnboardingPrivacyNoticeViewHolder.LAYOUT_ID)
|
||||
object OnboardingFinish : AdapterItem(OnboardingFinishViewHolder.LAYOUT_ID)
|
||||
object OnboardingToolbarPositionPicker :
|
||||
AdapterItem(OnboardingToolbarPositionPickerViewHolder.LAYOUT_ID)
|
||||
|
||||
object OnboardingWhatsNew : AdapterItem(OnboardingWhatsNewViewHolder.LAYOUT_ID)
|
||||
|
||||
object CustomizeHomeButton : AdapterItem(CustomizeHomeButtonViewHolder.LAYOUT_ID)
|
||||
|
||||
object RecentTabsHeader : AdapterItem(RecentTabsHeaderViewHolder.LAYOUT_ID)
|
||||
@ -299,17 +294,12 @@ class SessionControlAdapter(
|
||||
OnboardingTrackingProtectionViewHolder.LAYOUT_ID -> OnboardingTrackingProtectionViewHolder(
|
||||
view
|
||||
)
|
||||
OnboardingPrivateBrowsingViewHolder.LAYOUT_ID -> OnboardingPrivateBrowsingViewHolder(
|
||||
view,
|
||||
interactor
|
||||
)
|
||||
OnboardingPrivacyNoticeViewHolder.LAYOUT_ID -> OnboardingPrivacyNoticeViewHolder(
|
||||
view,
|
||||
interactor
|
||||
)
|
||||
CustomizeHomeButtonViewHolder.LAYOUT_ID -> CustomizeHomeButtonViewHolder(view, interactor)
|
||||
OnboardingFinishViewHolder.LAYOUT_ID -> OnboardingFinishViewHolder(view, interactor)
|
||||
OnboardingWhatsNewViewHolder.LAYOUT_ID -> OnboardingWhatsNewViewHolder(view, interactor)
|
||||
OnboardingToolbarPositionPickerViewHolder.LAYOUT_ID -> OnboardingToolbarPositionPickerViewHolder(
|
||||
view
|
||||
)
|
||||
|
@ -123,16 +123,6 @@ interface SessionControlController {
|
||||
*/
|
||||
fun handleStartBrowsingClicked()
|
||||
|
||||
/**
|
||||
* @see [OnboardingInteractor.onOpenSettingsClicked]
|
||||
*/
|
||||
fun handleOpenSettingsClicked()
|
||||
|
||||
/**
|
||||
* @see [OnboardingInteractor.onWhatsNewGetAnswersClicked]
|
||||
*/
|
||||
fun handleWhatsNewGetAnswersClicked()
|
||||
|
||||
/**
|
||||
* @see [OnboardingInteractor.onReadPrivacyNoticeClicked]
|
||||
*/
|
||||
@ -452,25 +442,12 @@ class DefaultSessionControlController(
|
||||
hideOnboarding()
|
||||
}
|
||||
|
||||
override fun handleOpenSettingsClicked() {
|
||||
val directions = HomeFragmentDirections.actionGlobalPrivateBrowsingFragment()
|
||||
navController.nav(R.id.homeFragment, directions)
|
||||
}
|
||||
|
||||
override fun handleCustomizeHomeTapped() {
|
||||
val directions = HomeFragmentDirections.actionGlobalCustomizationFragment()
|
||||
navController.nav(R.id.homeFragment, directions)
|
||||
metrics.track(Event.HomeScreenCustomizedHomeClicked)
|
||||
}
|
||||
|
||||
override fun handleWhatsNewGetAnswersClicked() {
|
||||
activity.openToBrowserAndLoad(
|
||||
searchTermOrURL = SupportUtils.getWhatsNewUrl(activity),
|
||||
newTab = true,
|
||||
from = BrowserDirection.FromHome
|
||||
)
|
||||
}
|
||||
|
||||
override fun handleReadPrivacyNoticeClicked() {
|
||||
activity.openToBrowserAndLoad(
|
||||
searchTermOrURL = SupportUtils.getMozillaPageUrl(SupportUtils.MozillaPage.PRIVATE_NOTICE),
|
||||
|
@ -142,16 +142,6 @@ interface OnboardingInteractor {
|
||||
*/
|
||||
fun onStartBrowsingClicked()
|
||||
|
||||
/**
|
||||
* Hides the onboarding and navigates to Settings. Called when a user clicks on the "Open settings" button.
|
||||
*/
|
||||
fun onOpenSettingsClicked()
|
||||
|
||||
/**
|
||||
* Opens a custom tab to what's new url. Called when a user clicks on the "Get answers here" link.
|
||||
*/
|
||||
fun onWhatsNewGetAnswersClicked()
|
||||
|
||||
/**
|
||||
* Opens a custom tab to privacy notice url. Called when a user clicks on the "read our privacy notice" button.
|
||||
*/
|
||||
@ -295,14 +285,6 @@ class SessionControlInteractor(
|
||||
controller.handleStartBrowsingClicked()
|
||||
}
|
||||
|
||||
override fun onOpenSettingsClicked() {
|
||||
controller.handleOpenSettingsClicked()
|
||||
}
|
||||
|
||||
override fun onWhatsNewGetAnswersClicked() {
|
||||
controller.handleWhatsNewGetAnswersClicked()
|
||||
}
|
||||
|
||||
override fun onReadPrivacyNoticeClicked() {
|
||||
controller.handleReadPrivacyNoticeClicked()
|
||||
}
|
||||
|
@ -1,95 +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.content.Context
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Paint
|
||||
import android.text.SpannableString
|
||||
import android.text.Spanned
|
||||
import android.text.style.ImageSpan
|
||||
import android.view.View
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import mozilla.components.support.ktx.android.content.getColorFromAttr
|
||||
import mozilla.components.support.ktx.android.content.getDrawableWithTint
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.metrics.Event
|
||||
import org.mozilla.fenix.databinding.OnboardingPrivateBrowsingBinding
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.fenix.ext.setBounds
|
||||
import org.mozilla.fenix.home.sessioncontrol.OnboardingInteractor
|
||||
|
||||
class OnboardingPrivateBrowsingViewHolder(
|
||||
view: View,
|
||||
private val interactor: OnboardingInteractor
|
||||
) : RecyclerView.ViewHolder(view) {
|
||||
|
||||
init {
|
||||
val binding = OnboardingPrivateBrowsingBinding.bind(view)
|
||||
binding.headerText.setOnboardingIcon(R.drawable.ic_onboarding_private_browsing)
|
||||
|
||||
// Display a private browsing icon as a character inside the description text.
|
||||
val inlineIcon = PrivateBrowsingImageSpan(
|
||||
view.context,
|
||||
R.drawable.ic_private_browsing,
|
||||
tint = view.context.getColorFromAttr(R.attr.primaryText),
|
||||
size = binding.descriptionTextOnce.lineHeight
|
||||
)
|
||||
|
||||
val text = SpannableString(view.context.getString(R.string.onboarding_private_browsing_description1)).apply {
|
||||
val spanStartIndex = indexOf(IMAGE_PLACEHOLDER)
|
||||
setSpan(
|
||||
inlineIcon,
|
||||
spanStartIndex,
|
||||
spanStartIndex + IMAGE_PLACEHOLDER.length,
|
||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
)
|
||||
}
|
||||
|
||||
binding.descriptionTextOnce.text = text
|
||||
binding.descriptionTextOnce.contentDescription = String.format(text.toString(), binding.headerText.text)
|
||||
binding.openSettingsButton.setOnClickListener {
|
||||
it.context.components.analytics.metrics.track(Event.OnboardingPrivateBrowsing)
|
||||
interactor.onOpenSettingsClicked()
|
||||
}
|
||||
}
|
||||
|
||||
class PrivateBrowsingImageSpan(
|
||||
context: Context,
|
||||
@DrawableRes drawableId: Int,
|
||||
@ColorInt tint: Int,
|
||||
size: Int
|
||||
) : ImageSpan(
|
||||
context.getDrawableWithTint(drawableId, tint)!!.apply { setBounds(size) }
|
||||
) {
|
||||
override fun draw(
|
||||
canvas: Canvas,
|
||||
text: CharSequence?,
|
||||
start: Int,
|
||||
end: Int,
|
||||
x: Float,
|
||||
top: Int,
|
||||
y: Int,
|
||||
bottom: Int,
|
||||
paint: Paint
|
||||
) {
|
||||
canvas.save()
|
||||
val fmPaint = paint.fontMetricsInt
|
||||
val fontHeight = fmPaint.descent - fmPaint.ascent
|
||||
val centerY = y + fmPaint.descent - fontHeight / 2
|
||||
val transY = (centerY - (drawable.bounds.bottom - drawable.bounds.top) / 2).toFloat()
|
||||
canvas.translate(x, transY)
|
||||
drawable.draw(canvas)
|
||||
canvas.restore()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val IMAGE_PLACEHOLDER = "%s"
|
||||
const val LAYOUT_ID = R.layout.onboarding_private_browsing
|
||||
}
|
||||
}
|
@ -1,35 +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.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.databinding.OnboardingWhatsNewBinding
|
||||
import org.mozilla.fenix.ext.addUnderline
|
||||
import org.mozilla.fenix.home.sessioncontrol.OnboardingInteractor
|
||||
|
||||
class OnboardingWhatsNewViewHolder(
|
||||
view: View,
|
||||
private val interactor: OnboardingInteractor
|
||||
) : RecyclerView.ViewHolder(view) {
|
||||
|
||||
init {
|
||||
val binding = OnboardingWhatsNewBinding.bind(view)
|
||||
binding.headerText.setOnboardingIcon(R.drawable.ic_whats_new)
|
||||
|
||||
val appName = view.context.getString(R.string.app_name)
|
||||
binding.descriptionText.text = view.context.getString(R.string.onboarding_whats_new_description, appName)
|
||||
|
||||
binding.getAnswers.addUnderline()
|
||||
binding.getAnswers.setOnClickListener {
|
||||
interactor.onWhatsNewGetAnswersClicked()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val LAYOUT_ID = R.layout.onboarding_whats_new
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
<?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/. -->
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M17.5 17c-2.1 0-3.5-2.5-5.5-2.5S8.4 17 6.5 17C3.9 17 2 14.6 2 10.4 2 7.8 2.8 7 6.1 7s4.3 1.4 5.9 1.4c1.6 0 2.6-1.4 5.9-1.4 3.3 0 4.1 0.8 4.1 3.4 0 4.2-1.9 6.6-4.5 6.6zm-9.8-6.8c-2 0.1-2.9 1.3-2.9 1.6 0 0.3 1.3 1.1 2.7 1.1 1.3 0 2.9-0.5 2.9-0.9 0-0.5-0.8-1.9-2.7-1.8zm8.6 0c-1.9-0.1-2.7 1.3-2.7 1.8 0 0.4 1.5 0.9 2.9 0.9s2.7-0.8 2.7-1.1c-0.1-0.3-0.9-1.5-2.9-1.6z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:type="linear"
|
||||
android:tileMode="clamp"
|
||||
android:startX="23.24"
|
||||
android:startY="-0.94"
|
||||
android:endX="1.81"
|
||||
android:endY="16.33">
|
||||
<item android:color="#5C29CC" android:offset="0" />
|
||||
<item android:color="#7A145C" android:offset="1" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
</vector>
|
@ -1,19 +0,0 @@
|
||||
<?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/. -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_whats_new" />
|
||||
<item
|
||||
android:left="200dp"
|
||||
android:bottom="200dp">
|
||||
<shape
|
||||
android:shape="oval">
|
||||
|
||||
<solid android:color="@color/whats_new_notification_color" />
|
||||
<size
|
||||
android:width="48dp"
|
||||
android:height="48dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
@ -1,58 +0,0 @@
|
||||
<?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"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/onboarding_card"
|
||||
style="@style/OnboardingCardLightWithPadding"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/header_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
tools:drawableStart="@drawable/ic_onboarding_private_browsing"
|
||||
android:drawablePadding="12dp"
|
||||
android:text="@string/onboarding_private_browsing_header"
|
||||
android:textAppearance="@style/HeaderTextStyle"
|
||||
android:gravity="center_vertical"
|
||||
android:lines="1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
<TextView
|
||||
android:id="@+id/description_text_once"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/Body14TextStyle"
|
||||
android:layout_marginTop="14dp"
|
||||
tools:text="@string/onboarding_private_browsing_description1"
|
||||
app:layout_constraintTop_toBottomOf="@id/header_text"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/description_text_always" />
|
||||
<TextView
|
||||
android:id="@+id/description_text_always"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/Body14TextStyle"
|
||||
android:layout_marginTop="14dp"
|
||||
android:text="@string/onboarding_private_browsing_always_description"
|
||||
app:layout_constraintTop_toBottomOf="@id/description_text_once"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/open_settings_button" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/open_settings_button"
|
||||
style="@style/NeutralOnboardingButton"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/onboarding_private_browsing_button"
|
||||
app:layout_constraintTop_toBottomOf="@id/description_text_always"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1,55 +0,0 @@
|
||||
<?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"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/onboarding_card"
|
||||
style="@style/OnboardingCardLight"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/header_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="12dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/onboarding_whats_new_header1"
|
||||
android:textAppearance="@style/HeaderTextStyle"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:drawableStart="@drawable/ic_whats_new" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:textAppearance="@style/Body14TextStyle"
|
||||
app:layout_constraintBottom_toTopOf="@id/get_answers"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/header_text"
|
||||
tools:text="@string/onboarding_whats_new_description" />
|
||||
|
||||
<org.mozilla.fenix.utils.LinkTextView
|
||||
android:id="@+id/get_answers"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="18dp"
|
||||
android:text="@string/onboarding_whats_new_description_linktext"
|
||||
android:textAppearance="@style/Body14TextStyle"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/description_text" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1239,12 +1239,12 @@
|
||||
<!-- text for the Firefox Accounts section header -->
|
||||
<string name="onboarding_fxa_section_header">Already have an account?</string>
|
||||
<!-- text for the "What's New" onboarding card header -->
|
||||
<string name="onboarding_whats_new_header1">See what’s new</string>
|
||||
<string name="onboarding_whats_new_header1" moz:removedIn="94" tools:ignore="UnusedResources">See what’s new</string>
|
||||
<!-- text for the "what's new" onboarding card description
|
||||
The first parameter is the short name of the app (e.g. Firefox) -->
|
||||
<string name="onboarding_whats_new_description">Have questions about the redesigned %s? Want to know what’s changed?</string>
|
||||
<string name="onboarding_whats_new_description" moz:removedIn="94" tools:ignore="UnusedResources">Have questions about the redesigned %s? Want to know what’s changed?</string>
|
||||
<!-- 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>
|
||||
<string name="onboarding_whats_new_description_linktext" moz:removedIn="94" tools:ignore="UnusedResources">Get answers here</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>
|
||||
<!-- Text for the button to learn more about signing in to your Firefox account -->
|
||||
@ -1284,14 +1284,14 @@
|
||||
<!-- 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>
|
||||
<!-- text for the private browsing onboarding card header -->
|
||||
<string name="onboarding_private_browsing_header">Browse privately</string>
|
||||
<string name="onboarding_private_browsing_header" moz:removedIn="94" tools:ignore="UnusedResources">Browse privately</string>
|
||||
<!-- text for the private browsing onboarding card description
|
||||
The first parameter is an icon that represents private browsing -->
|
||||
<string name="onboarding_private_browsing_description1">Open a private tab once: Tap the %s icon.</string>
|
||||
<string name="onboarding_private_browsing_description1" moz:removedIn="94" tools:ignore="UnusedResources">Open a private tab once: Tap the %s icon.</string>
|
||||
<!-- text for the private browsing onboarding card description, explaining how to always using private browsing -->
|
||||
<string name="onboarding_private_browsing_always_description">Open private tabs every time: Update your private browsing settings.</string>
|
||||
<string name="onboarding_private_browsing_always_description" moz:removedIn="94" tools:ignore="UnusedResources">Open private tabs every time: Update your private browsing settings.</string>
|
||||
<!-- text for the private browsing onbording card button, that launches settings -->
|
||||
<string name="onboarding_private_browsing_button">Open settings</string>
|
||||
<string name="onboarding_private_browsing_button" moz:removedIn="94" tools:ignore="UnusedResources">Open settings</string>
|
||||
<!-- 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
|
||||
|
@ -603,30 +603,6 @@ class DefaultSessionControlControllerTest {
|
||||
assertTrue(hideOnboardingInvoked)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun handleOpenSettingsClicked() {
|
||||
createController().handleOpenSettingsClicked()
|
||||
verify {
|
||||
navController.navigate(
|
||||
match<NavDirections> { it.actionId == R.id.action_global_privateBrowsingFragment },
|
||||
null
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun handleWhatsNewGetAnswersClicked() {
|
||||
createController().handleWhatsNewGetAnswersClicked()
|
||||
val whatsNewUrl = SupportUtils.getWhatsNewUrl(activity)
|
||||
verify {
|
||||
activity.openToBrowserAndLoad(
|
||||
searchTermOrURL = whatsNewUrl,
|
||||
newTab = true,
|
||||
from = BrowserDirection.FromHome
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun handleReadPrivacyNoticeClicked() {
|
||||
createController().handleReadPrivacyNoticeClicked()
|
||||
|
@ -1,40 +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.mockk
|
||||
import io.mockk.verify
|
||||
import mozilla.components.support.test.robolectric.testContext
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.databinding.OnboardingPrivateBrowsingBinding
|
||||
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
|
||||
import org.mozilla.fenix.home.sessioncontrol.OnboardingInteractor
|
||||
|
||||
@RunWith(FenixRobolectricTestRunner::class)
|
||||
class OnboardingPrivacyBrowsingViewHolderTest {
|
||||
|
||||
private lateinit var binding: OnboardingPrivateBrowsingBinding
|
||||
private lateinit var interactor: OnboardingInteractor
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
val context = ContextThemeWrapper(testContext, R.style.NormalTheme)
|
||||
binding = OnboardingPrivateBrowsingBinding.inflate(LayoutInflater.from(context))
|
||||
interactor = mockk(relaxed = true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `call interactor on click`() {
|
||||
OnboardingPrivateBrowsingViewHolder(binding.root, interactor)
|
||||
|
||||
binding.openSettingsButton.performClick()
|
||||
verify { interactor.onOpenSettingsClicked() }
|
||||
}
|
||||
}
|
@ -1,72 +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.content.res.Resources
|
||||
import android.text.Spanned
|
||||
import android.view.LayoutInflater
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.core.text.HtmlCompat.TO_HTML_PARAGRAPH_LINES_CONSECUTIVE
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.mockk.mockkStatic
|
||||
import io.mockk.unmockkStatic
|
||||
import io.mockk.verify
|
||||
import mozilla.components.support.ktx.android.content.res.resolveAttribute
|
||||
import mozilla.components.support.test.robolectric.testContext
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.databinding.OnboardingWhatsNewBinding
|
||||
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
|
||||
import org.mozilla.fenix.home.sessioncontrol.OnboardingInteractor
|
||||
|
||||
@RunWith(FenixRobolectricTestRunner::class)
|
||||
class OnboardingWhatsNewViewHolderTest {
|
||||
|
||||
private lateinit var binding: OnboardingWhatsNewBinding
|
||||
private lateinit var interactor: OnboardingInteractor
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
mockkStatic("mozilla.components.support.ktx.android.content.res.ThemeKt")
|
||||
binding = OnboardingWhatsNewBinding.inflate(LayoutInflater.from(testContext))
|
||||
interactor = mockk(relaxed = true)
|
||||
|
||||
every {
|
||||
any<Resources.Theme>().resolveAttribute(R.attr.onboardingSelected)
|
||||
} returns R.color.onboarding_illustration_selected_normal_theme
|
||||
}
|
||||
|
||||
@After
|
||||
fun teardown() {
|
||||
unmockkStatic("mozilla.components.support.ktx.android.content.res.ThemeKt")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `sets and styles strings`() {
|
||||
OnboardingWhatsNewViewHolder(binding.root, interactor)
|
||||
|
||||
assertEquals(
|
||||
"Have questions about the redesigned Firefox Preview? Want to know what’s changed?",
|
||||
binding.descriptionText.text
|
||||
)
|
||||
|
||||
val getAnswersHtml = HtmlCompat.toHtml(binding.getAnswers.text as Spanned, TO_HTML_PARAGRAPH_LINES_CONSECUTIVE)
|
||||
assertTrue(getAnswersHtml, "<u>Get answers here</u>" in getAnswersHtml)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `call interactor on click`() {
|
||||
OnboardingWhatsNewViewHolder(binding.root, interactor)
|
||||
|
||||
binding.getAnswers.performClick()
|
||||
verify { interactor.onWhatsNewGetAnswersClicked() }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user