Merge pull request #2244 from mozilla-mobile/mergify/bp/releases_v114/pr-2057

fenix/114.1.0^2
Pascal Chevrel 12 months ago committed by GitHub
commit 23c1225c38

@ -78,7 +78,7 @@ private fun createOnboardingPageState(
onNegativeButtonClick: () -> Unit,
onUrlClick: (String) -> Unit = {},
): OnboardingPageState = OnboardingPageState(
image = onboardingPageUiData.imageRes,
imageRes = onboardingPageUiData.imageRes,
title = onboardingPageUiData.title,
description = onboardingPageUiData.description,
linkTextState = onboardingPageUiData.linkText?.let {

@ -28,7 +28,7 @@ fun NotificationPermissionDialogScreen(
) {
OnboardingPage(
pageState = OnboardingPageState(
image = R.drawable.ic_notification_permission,
imageRes = R.drawable.ic_notification_permission,
title = stringResource(
id = R.string.onboarding_home_enable_notifications_title,
formatArgs = arrayOf(stringResource(R.string.app_name)),

@ -66,6 +66,7 @@ private const val URL_TAG = "URL_TAG"
* @param modifier The modifier to be applied to the Composable.
* @param onDismiss Invoked when the user clicks the close button. This defaults to null. When null,
* it doesn't show the close button.
* @param imageResContentScale The [ContentScale] for the [OnboardingPageState.imageRes].
*/
@Composable
fun OnboardingPage(
@ -107,7 +108,7 @@ fun OnboardingPage(
horizontalAlignment = Alignment.CenterHorizontally,
) {
Image(
painter = painterResource(id = pageState.image),
painter = painterResource(id = pageState.imageRes),
contentDescription = null,
modifier = Modifier.height(imageHeight(boxWithConstraintsScope)),
)
@ -237,7 +238,7 @@ private fun OnboardingPagePreview() {
FirefoxTheme {
OnboardingPage(
pageState = OnboardingPageState(
image = R.drawable.ic_notification_permission,
imageRes = R.drawable.ic_notification_permission,
title = stringResource(
id = R.string.onboarding_home_enable_notifications_title,
formatArgs = arrayOf(stringResource(R.string.app_name)),

@ -9,16 +9,16 @@ import androidx.annotation.DrawableRes
/**
* Model containing data for [OnboardingPage].
*
* @param image [DrawableRes] displayed on the page.
* @param title [String] title of the page.
* @param description [String] description of the page.
* @param linkTextState [LinkTextState] part of description text with a link.
* @param primaryButton [Action] action for the primary button.
* @param secondaryButton [Action] action for the secondary button.
* @param onRecordImpressionEvent Callback for recording impression event.
* @property imageRes [DrawableRes] displayed on the page.
* @property title [String] title of the page.
* @property description [String] description of the page.
* @property linkTextState [LinkTextState] part of description text with a link.
* @property primaryButton [Action] action for the primary button.
* @property secondaryButton [Action] action for the secondary button.
* @property onRecordImpressionEvent Callback for recording impression event.
*/
data class OnboardingPageState(
@DrawableRes val image: Int,
@DrawableRes val imageRes: Int,
val title: String,
val description: String,
val linkTextState: LinkTextState? = null,

@ -69,7 +69,7 @@ fun UpgradeOnboarding(
OnboardingPage(
pageState = when (onboardingState) {
UpgradeOnboardingState.Welcome -> OnboardingPageState(
image = R.drawable.ic_onboarding_welcome,
imageRes = R.drawable.ic_onboarding_welcome,
title = stringResource(id = R.string.onboarding_home_welcome_title_2),
description = stringResource(id = R.string.onboarding_home_welcome_description),
primaryButton = Action(
@ -88,7 +88,7 @@ fun UpgradeOnboarding(
},
)
UpgradeOnboardingState.SyncSignIn -> OnboardingPageState(
image = R.drawable.ic_onboarding_sync,
imageRes = R.drawable.ic_onboarding_sync,
title = stringResource(id = R.string.onboarding_home_sync_title_3),
description = stringResource(id = R.string.onboarding_home_sync_description),
primaryButton = Action(

@ -14,7 +14,7 @@ class JunoOnboardingMapperTest {
@Test
fun `GIVEN a default browser page WHEN mapToOnboardingPageState is called THEN creates the expected OnboardingPageState`() {
val expected = OnboardingPageState(
image = R.drawable.ic_onboarding_welcome,
imageRes = R.drawable.ic_onboarding_welcome,
title = "default browser title",
description = "default browser body with link text",
linkTextState = LinkTextState(
@ -52,7 +52,7 @@ class JunoOnboardingMapperTest {
@Test
fun `GIVEN a sync page WHEN mapToOnboardingPageState is called THEN creates the expected OnboardingPageState`() {
val expected = OnboardingPageState(
image = R.drawable.ic_onboarding_sync,
imageRes = R.drawable.ic_onboarding_sync,
title = "sync title",
description = "sync body",
primaryButton = Action("sync primary button text", unitLambda),
@ -85,7 +85,7 @@ class JunoOnboardingMapperTest {
@Test
fun `GIVEN a notification page WHEN mapToOnboardingPageState is called THEN creates the expected OnboardingPageState`() {
val expected = OnboardingPageState(
image = R.drawable.ic_notification_permission,
imageRes = R.drawable.ic_notification_permission,
title = "notification title",
description = "notification body",
primaryButton = Action("notification primary button text", unitLambda),

Loading…
Cancel
Save