Bug 1833118 - Rename OnboardingPageState `image` to `imageRes` and update class desc @param to @property

fenix/115.2.0
t-p-white 1 year ago committed by mergify[bot]
parent 2cbd3b5020
commit e399f1b314

@ -86,7 +86,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)),

@ -70,7 +70,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.image].
* @param imageResContentScale The [ContentScale] for the [OnboardingPageState.imageRes].
*/
@Composable
@Suppress("LongMethod")
@ -114,7 +114,7 @@ fun OnboardingPage(
horizontalAlignment = Alignment.CenterHorizontally,
) {
Image(
painter = painterResource(id = pageState.image),
painter = painterResource(id = pageState.imageRes),
contentDescription = null,
contentScale = imageResContentScale,
modifier = Modifier
@ -249,7 +249,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(

@ -15,7 +15,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(
@ -54,7 +54,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),
@ -88,7 +88,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