Bug 1847819 - Add new Homescreen description for Total Private Browsing Mode.

fenix/119.0
Harrison Oglesby 9 months ago committed by mergify[bot]
parent 14be2d4b58
commit 491e524698

@ -0,0 +1,88 @@
/* 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
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Card
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import org.mozilla.fenix.R
import org.mozilla.fenix.compose.LinkText
import org.mozilla.fenix.compose.LinkTextState
import org.mozilla.fenix.theme.FirefoxTheme
/**
* Total Private Browsing Mode homepage informational card.
*
* @param onLearnMoreClick Invoked when the user clicks on the who can see my activity link.
*/
@Composable
fun FeltPrivacyModeInfoCard(
onLearnMoreClick: () -> Unit,
) {
Card(
modifier = Modifier
.wrapContentHeight(),
backgroundColor = FirefoxTheme.colors.layerAccentNonOpaque,
shape = RoundedCornerShape(8.dp),
elevation = 5.dp,
) {
Column(
modifier = Modifier.padding(16.dp),
) {
Text(
text = stringResource(id = R.string.felt_privacy_desc_card_title),
style = FirefoxTheme.typography.headline7,
color = FirefoxTheme.colors.textPrimary,
)
Spacer(modifier = Modifier.height(8.dp))
LinkText(
text = stringResource(
id = R.string.felt_privacy_info_card_subtitle,
stringResource(id = R.string.app_name),
stringResource(id = R.string.felt_privacy_info_card_subtitle_link_text),
),
linkTextState = LinkTextState(
text = stringResource(id = R.string.felt_privacy_info_card_subtitle_link_text),
url = "",
onClick = { onLearnMoreClick() },
),
style = FirefoxTheme.typography.body2.copy(
color = FirefoxTheme.colors.textPrimary,
),
linkTextDecoration = TextDecoration.Underline,
)
}
}
}
@Composable
@Preview
private fun FeltPrivacyModeDescriptionPreview() {
FirefoxTheme {
Column(
modifier = Modifier.background(FirefoxTheme.colors.layer1)
.fillMaxSize(),
) {
FeltPrivacyModeInfoCard(
onLearnMoreClick = {},
)
}
}
}

@ -27,6 +27,7 @@ import androidx.compose.ui.unit.sp
import androidx.lifecycle.LifecycleOwner
import org.mozilla.fenix.R
import org.mozilla.fenix.compose.ComposeViewHolder
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.home.privatebrowsing.interactor.PrivateBrowsingInteractor
import org.mozilla.fenix.theme.FirefoxTheme
@ -51,9 +52,17 @@ class PrivateBrowsingDescriptionViewHolder(
@Composable
override fun Content() {
PrivateBrowsingDescription(
onLearnMoreClick = interactor::onLearnMoreClicked,
)
val settings = composeView.context.settings()
if (settings.feltPrivateBrowsingEnabled) {
FeltPrivacyModeInfoCard(
onLearnMoreClick = interactor::onLearnMoreClicked,
)
} else {
PrivateBrowsingDescription(
onLearnMoreClick = interactor::onLearnMoreClicked,
)
}
}
companion object {

@ -65,6 +65,19 @@
Common myths about private browsing
</string>
<!-- True Private Browsing Mode -->
<!-- Title for info card on private homescreen in True Private Browsing Mode. -->
<string name="felt_privacy_desc_card_title">Leave no traces on this device</string>
<!-- Explanation for private browsing displayed to users on home view when they first enable
private mode in our new Total Private Browsing mode.
The first parameter is the name of the app defined in app_name (for example: Firefox Nightly)
The second parameter is the clickable link text in felt_privacy_info_card_subtitle_link_text -->
<string name="felt_privacy_info_card_subtitle">%1$s deletes your cookies, history, and site data when you close all your private windows. %2$s</string>
<!-- Clickable portion of the explanation for private browsing that links the user to our
about privacy page.
This string is used in felt_privacy_info_card_subtitle as the second parameter.-->
<string name="felt_privacy_info_card_subtitle_link_text">Who might be able to see my activity?</string>
<!-- Private mode shortcut "contextual feature recommendation" (CFR) -->
<!-- Text for the Private mode shortcut CFR message for adding a private mode shortcut to open private tabs from the Home screen -->
<string name="private_mode_cfr_message_2">Launch your next private tab in one tap.</string>

Loading…
Cancel
Save