forked from thunderbird/thunderbird-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add contribution title, description and benefit texts
(cherry picked from commit bce5220219cb35ae5f66151c00930f152871ad0f)
- Loading branch information
Showing
4 changed files
with
275 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
154 changes: 154 additions & 0 deletions
154
...otlin/app/k9mail/feature/funding/googleplay/ui/contribution/ContributionIdStringMapper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String> { | ||
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() | ||
} | ||
} | ||
} |
Oops, something went wrong.