diff --git a/feature/funding/googleplay/src/debug/kotlin/app/k9mail/feature/funding/googleplay/ui/contribution/FakeData.kt b/feature/funding/googleplay/src/debug/kotlin/app/k9mail/feature/funding/googleplay/ui/contribution/FakeData.kt index e125a6cfa0f..895e2e39bd4 100644 --- a/feature/funding/googleplay/src/debug/kotlin/app/k9mail/feature/funding/googleplay/ui/contribution/FakeData.kt +++ b/feature/funding/googleplay/src/debug/kotlin/app/k9mail/feature/funding/googleplay/ui/contribution/FakeData.kt @@ -7,7 +7,7 @@ import kotlinx.collections.immutable.persistentListOf internal object FakeData { val recurringContribution = RecurringContribution( - id = "monthly_subscription_50", + id = "contribution_tfa_monthly_m", title = "Monthly subscription: $50", description = "Monthly subscription for $50", price = 5000L, @@ -16,42 +16,42 @@ internal object FakeData { val recurringContributions = persistentListOf( RecurringContribution( - id = "monthly_subscription_250", + id = "contribution_tfa_monthly_xxl", title = "Monthly subscription: $250", description = "Monthly subscription for $250", price = 25000L, priceFormatted = "250 $", ), RecurringContribution( - id = "monthly_subscription_140", + id = "contribution_tfa_monthly_xl", title = "Monthly subscription: $140", description = "Monthly subscription for $140", price = 14000L, priceFormatted = "140 $", ), RecurringContribution( - id = "monthly_subscription_80", + id = "contribution_tfa_monthly_l", title = "Monthly subscription: $80", description = "Monthly subscription for $80", price = 8000L, priceFormatted = "80 $", ), RecurringContribution( - id = "monthly_subscription_50", + id = "contribution_tfa_monthly_m", title = "Monthly subscription: $50", description = "Monthly subscription for $50", price = 5000L, priceFormatted = "50 $", ), RecurringContribution( - id = "monthly_subscription_25", + id = "contribution_tfa_monthly_s", title = "Monthly subscription: $25", description = "Monthly subscription for $25", price = 2500L, priceFormatted = "25 $", ), RecurringContribution( - id = "monthly_subscription_15", + id = "contribution_tfa_monthly_xs", title = "Monthly subscription: $15", description = "Monthly subscription for $15", price = 1500L, @@ -60,7 +60,7 @@ internal object FakeData { ) val oneTimeContribution = OneTimeContribution( - id = "one_time_payment_50", + id = "contribution_tfa_onetime_m", title = "One time payment: $50", description = "One time payment for $50", price = 5000L, @@ -69,42 +69,42 @@ internal object FakeData { val oneTimeContributions = persistentListOf( OneTimeContribution( - id = "one_time_payment_250", + id = "contribution_tfa_onetime_xxl", title = "One time payment: $250", description = "One time payment for $250", price = 25000L, priceFormatted = "250 $", ), OneTimeContribution( - id = "one_time_payment_140", + id = "contribution_tfa_onetime_xl", title = "One time payment: $140", description = "One time payment for $140", price = 14000L, priceFormatted = "140 $", ), OneTimeContribution( - id = "one_time_payment_80", + id = "contribution_tfa_onetime_l", title = "One time payment: $80", description = "One time payment for $80", price = 8000L, priceFormatted = "80 $", ), OneTimeContribution( - id = "one_time_payment_50", + id = "contribution_tfa_onetime_m", title = "One time payment: $50", description = "One time payment for $50", price = 5000L, priceFormatted = "50 $", ), OneTimeContribution( - id = "one_time_payment_25", + id = "contribution_tfa_onetime_s", title = "One time payment: $25", description = "One time payment for $25", price = 2500L, priceFormatted = "25 $", ), OneTimeContribution( - id = "one_time_payment_15", + id = "contribution_tfa_onetime_xs", title = "One time payment: $15", description = "One time payment for $15", price = 1500L, diff --git a/feature/funding/googleplay/src/main/kotlin/app/k9mail/feature/funding/googleplay/ui/contribution/ContributionHeader.kt b/feature/funding/googleplay/src/main/kotlin/app/k9mail/feature/funding/googleplay/ui/contribution/ContributionHeader.kt index 3dd91cfdb1c..37b8d1f98fe 100644 --- a/feature/funding/googleplay/src/main/kotlin/app/k9mail/feature/funding/googleplay/ui/contribution/ContributionHeader.kt +++ b/feature/funding/googleplay/src/main/kotlin/app/k9mail/feature/funding/googleplay/ui/contribution/ContributionHeader.kt @@ -4,15 +4,19 @@ import androidx.compose.animation.AnimatedContent import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign +import app.k9mail.core.ui.compose.designsystem.atom.icon.Icon +import app.k9mail.core.ui.compose.designsystem.atom.icon.Icons import app.k9mail.core.ui.compose.designsystem.atom.image.FixedScaleImage import app.k9mail.core.ui.compose.designsystem.atom.text.TextBodyMedium import app.k9mail.core.ui.compose.designsystem.atom.text.TextHeadlineSmall @@ -21,6 +25,8 @@ import app.k9mail.feature.funding.googleplay.R import app.k9mail.feature.funding.googleplay.domain.entity.Contribution import app.k9mail.feature.funding.googleplay.ui.contribution.image.GoldenHearthSunburst import app.k9mail.feature.funding.googleplay.ui.contribution.image.HearthSunburst +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.persistentListOf @Composable internal fun ContributionHeader( @@ -36,11 +42,13 @@ internal fun ContributionHeader( val contribution = purchasedContribution!! ContributionHeaderView( logo = GoldenHearthSunburst, - title = contribution.title, - description = contribution.description, + title = ContributionIdStringMapper.mapToContributionTitle(contribution.id), + description = ContributionIdStringMapper.mapToContributionDescription(contribution.id), + benefits = ContributionIdStringMapper.mapToContributionBenefits(contribution.id), modifier = modifier, ) } + false -> { ContributionHeaderView( logo = HearthSunburst, @@ -59,6 +67,7 @@ private fun ContributionHeaderView( title: String, description: String, modifier: Modifier = Modifier, + benefits: ImmutableList = persistentListOf(), ) { Column( modifier = modifier, @@ -85,8 +94,39 @@ private fun ContributionHeaderView( textAlign = TextAlign.Center, ) + if (benefits.isNotEmpty()) { + Column( + verticalArrangement = Arrangement.spacedBy(MainTheme.spacings.default), + ) { + benefits.forEach { benefit -> + ContributionBenefit( + benefit = benefit, + ) + } + } + } + TextBodyMedium( text = description, ) } } + +@Composable +private fun ContributionBenefit( + benefit: String, + modifier: Modifier = Modifier, +) { + Row( + modifier = modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.spacedBy(MainTheme.spacings.half), + ) { + Icon( + imageVector = Icons.Filled.Dot, + modifier = Modifier.size(MainTheme.sizes.small), + ) + TextBodyMedium( + text = benefit, + ) + } +} diff --git a/feature/funding/googleplay/src/main/kotlin/app/k9mail/feature/funding/googleplay/ui/contribution/ContributionIdStringMapper.kt b/feature/funding/googleplay/src/main/kotlin/app/k9mail/feature/funding/googleplay/ui/contribution/ContributionIdStringMapper.kt new file mode 100644 index 00000000000..e50483a75bf --- /dev/null +++ b/feature/funding/googleplay/src/main/kotlin/app/k9mail/feature/funding/googleplay/ui/contribution/ContributionIdStringMapper.kt @@ -0,0 +1,154 @@ +package app.k9mail.feature.funding.googleplay.ui.contribution + +import androidx.compose.runtime.Composable +import androidx.compose.ui.res.stringArrayResource +import androidx.compose.ui.res.stringResource +import app.k9mail.feature.funding.googleplay.R +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.persistentListOf +import kotlinx.collections.immutable.toImmutableList + +// Ids need to be kept in sync with ContributionIdProvider.kt +internal object ContributionIdStringMapper { + + @Composable + fun mapToContributionTitle(contributionId: String): String { + return when (contributionId) { + "contribution_tfa_onetime_xs" -> stringResource( + R.string.funding_googleplay_contribution_tfa_onetime_xs_title, + ) + + "contribution_tfa_onetime_s" -> stringResource( + R.string.funding_googleplay_contribution_tfa_onetime_s_title, + ) + + "contribution_tfa_onetime_m" -> stringResource( + R.string.funding_googleplay_contribution_tfa_onetime_m_title, + ) + + "contribution_tfa_onetime_l" -> stringResource( + R.string.funding_googleplay_contribution_tfa_onetime_l_title, + ) + + "contribution_tfa_onetime_xl" -> stringResource( + R.string.funding_googleplay_contribution_tfa_onetime_xl_title, + ) + + "contribution_tfa_onetime_xxl" -> stringResource( + R.string.funding_googleplay_contribution_tfa_onetime_xxl_title, + ) + + "contribution_tfa_monthly_xs" -> stringResource( + R.string.funding_googleplay_contribution_tfa_recurring_xs_title, + ) + + "contribution_tfa_monthly_s" -> stringResource( + R.string.funding_googleplay_contribution_tfa_recurring_s_title, + ) + + "contribution_tfa_monthly_m" -> stringResource( + R.string.funding_googleplay_contribution_tfa_recurring_m_title, + ) + + "contribution_tfa_monthly_l" -> stringResource( + R.string.funding_googleplay_contribution_tfa_recurring_l_title, + ) + + "contribution_tfa_monthly_xl" -> stringResource( + R.string.funding_googleplay_contribution_tfa_recurring_xl_title, + ) + + "contribution_tfa_monthly_xxl" -> stringResource( + R.string.funding_googleplay_contribution_tfa_recurring_xxl_title, + ) + + else -> throw IllegalArgumentException("Unknown contribution ID: $contributionId") + } + } + + @Composable + fun mapToContributionDescription(contributionId: String): String { + return when (contributionId) { + "contribution_tfa_onetime_xs" -> stringResource( + R.string.funding_googleplay_contribution_tfa_onetime_xs_description, + ) + + "contribution_tfa_onetime_s" -> stringResource( + R.string.funding_googleplay_contribution_tfa_onetime_s_description, + ) + + "contribution_tfa_onetime_m" -> stringResource( + R.string.funding_googleplay_contribution_tfa_onetime_m_description, + ) + + "contribution_tfa_onetime_l" -> stringResource( + R.string.funding_googleplay_contribution_tfa_onetime_l_description, + ) + + "contribution_tfa_onetime_xl" -> stringResource( + R.string.funding_googleplay_contribution_tfa_onetime_xl_description, + ) + + "contribution_tfa_onetime_xxl" -> stringResource( + R.string.funding_googleplay_contribution_tfa_onetime_xxl_description, + ) + + "contribution_tfa_monthly_xs" -> stringResource( + R.string.funding_googleplay_contribution_tfa_recurring_xs_description, + ) + + "contribution_tfa_monthly_s" -> stringResource( + R.string.funding_googleplay_contribution_tfa_recurring_s_description, + ) + + "contribution_tfa_monthly_m" -> stringResource( + R.string.funding_googleplay_contribution_tfa_recurring_m_description, + ) + + "contribution_tfa_monthly_l" -> stringResource( + R.string.funding_googleplay_contribution_tfa_recurring_l_description, + ) + + "contribution_tfa_monthly_xl" -> stringResource( + R.string.funding_googleplay_contribution_tfa_recurring_xl_description, + ) + + "contribution_tfa_monthly_xxl" -> stringResource( + R.string.funding_googleplay_contribution_tfa_recurring_xxl_description, + ) + + else -> throw IllegalArgumentException("Unknown contribution ID: $contributionId") + } + } + + @Composable + fun mapToContributionBenefits(contributionId: String): ImmutableList { + return when (contributionId) { + "contribution_tfa_monthly_xs" -> stringArrayResource( + R.array.funding_googleplay_contribution_tfa_recurring_xs_benefits, + ).toImmutableList() + + "contribution_tfa_monthly_s" -> stringArrayResource( + R.array.funding_googleplay_contribution_tfa_recurring_s_benefits, + ).toImmutableList() + + "contribution_tfa_monthly_m" -> stringArrayResource( + R.array.funding_googleplay_contribution_tfa_recurring_m_benefits, + ).toImmutableList() + + "contribution_tfa_monthly_l" -> stringArrayResource( + R.array.funding_googleplay_contribution_tfa_recurring_l_benefits, + ).toImmutableList() + + "contribution_tfa_monthly_xl" -> stringArrayResource( + R.array.funding_googleplay_contribution_tfa_recurring_xl_benefits, + ).toImmutableList() + + "contribution_tfa_monthly_xxl" -> stringArrayResource( + R.array.funding_googleplay_contribution_tfa_recurring_xxl_benefits, + ).toImmutableList() + + else -> persistentListOf() + } + } +} diff --git a/feature/funding/googleplay/src/main/res/values/strings.xml b/feature/funding/googleplay/src/main/res/values/strings.xml index a6a3bf0bc6e..2bf587a2312 100644 --- a/feature/funding/googleplay/src/main/res/values/strings.xml +++ b/feature/funding/googleplay/src/main/res/values/strings.xml @@ -25,4 +25,69 @@ Unknown error Purchase failed. Contributions are currently unavailable. + + Essential Contribution + Valued Contribution + Significant Contribution + Major Contribution + Outstanding Contribution + Exceptional Contribution + + Your support keeps us moving forward! Even the smallest contributions create ripples of change, and we’re so grateful to have you on board. + You’re helping us make great things happen! By contributing at this level, you’re helping us take meaningful steps forward allowing us to continue growing. + Your contribution really shines! You’re playing a major role in advancing our mission, helping us reach important milestones and achieve a greater impact. + You’re a big reason we’re able to do what we do! Thanks to your generosity, we can take on bigger projects and reach new milestones together. + Your support is truly inspiring! Thanks to your substantial contribution, we’re able to push boundaries, innovate, and make significant strides toward our goals. + You’re really helping us dream big! Your incredible support empowers us to achieve the extraordinary, leaving a lasting impact on everything we do. + + Essential Monthly Contribution + Valued Monthly Contribution + Significant Monthly Contribution + Major Monthly Contribution + Outstanding Monthly Contribution + Exceptional Monthly Contribution + + Your support drives us forward! Every contribution creates change—thank you! + Your contribution helps us grow and take meaningful steps forward—thank you! + Your contribution shines! You’re key to advancing our mission and achieving impact. + You’re a big reason we can do what we do! Your generosity helps us reach new milestones. + Your support is inspiring! Your contribution helps us push boundaries and achieve our goals. + You’re helping us dream big! Your support empowers us to achieve extraordinary things. + + + A monthly, voluntary contribution + Support the backbone of our efforts + Keep us moving forward + Contributions are not tax-deductible + + + A monthly, voluntary contribution + Enable us to build new features + Help us take meaningful steps forward + Contributions are not tax-deductible + + + A monthly, voluntary contribution + Play a major role in aiding our mission + Support key improvements + Contributions are not tax-deductible + + + A monthly, voluntary contribution + Be a driving force behind our success + Enable us to take on larger projects + Contributions are not tax-deductible + + + A monthly, voluntary contribution + Enable us to make significant strides + Help us push boundaries + Contributions are not tax-deductible + + + A monthly, voluntary contribution + Empower us to dream bigger + Make our boldest ideas a reality + Contributions are not tax-deductible +