From 538b30e772c36cc69365aff45498a670091ebf36 Mon Sep 17 00:00:00 2001 From: Mehmedalija Karisik Date: Tue, 4 Feb 2025 03:32:38 +0100 Subject: [PATCH] Resolve comments --- .../api/model/MembershipStatusResponse.kt | 2 +- .../android/premium/home/PremiumHomeScreen.kt | 55 ++++++++----------- .../android/premium/ui/PrimalPremiumTable.kt | 14 ++--- app/src/main/res/values/strings.xml | 37 ++++++------- 4 files changed, 49 insertions(+), 59 deletions(-) diff --git a/app/src/main/kotlin/net/primal/android/premium/api/model/MembershipStatusResponse.kt b/app/src/main/kotlin/net/primal/android/premium/api/model/MembershipStatusResponse.kt index ab8ab5928..73c49e982 100644 --- a/app/src/main/kotlin/net/primal/android/premium/api/model/MembershipStatusResponse.kt +++ b/app/src/main/kotlin/net/primal/android/premium/api/model/MembershipStatusResponse.kt @@ -20,5 +20,5 @@ data class MembershipStatusResponse( @SerialName("renews_on") val renewsOn: Long? = null, @SerialName("origin") val origin: String? = null, @SerialName("edited_shoutout") val editedShoutout: String? = null, - @SerialName("donated_btc") val donatedBtc: String?, + @SerialName("donated_btc") val donatedBtc: String? = null, ) diff --git a/app/src/main/kotlin/net/primal/android/premium/home/PremiumHomeScreen.kt b/app/src/main/kotlin/net/primal/android/premium/home/PremiumHomeScreen.kt index 2781c2d64..a1f8ba050 100644 --- a/app/src/main/kotlin/net/primal/android/premium/home/PremiumHomeScreen.kt +++ b/app/src/main/kotlin/net/primal/android/premium/home/PremiumHomeScreen.kt @@ -99,7 +99,7 @@ private fun PremiumHomeScreen( Scaffold( topBar = { PrimalTopAppBar( - title = stringResource(id = R.string.premium_member_title), + title = stringResource(id = R.string.premium_home_member_title), navigationIcon = PrimalIcons.ArrowBack, onNavigationIconClick = onClose, showDivider = false, @@ -108,14 +108,14 @@ private fun PremiumHomeScreen( bottomBar = { if (state.membership?.isExpired() == true) { BottomBarButton( - text = stringResource(id = R.string.premium_renew_subscription), + text = stringResource(id = R.string.premium_home_renew_subscription), onClick = { onRenewSubscription(state.membership.premiumName) }, ) } else { BottomBarButton( - text = stringResource(id = R.string.premium_manage_premium_button), + text = stringResource(id = R.string.premium_home_premium_button), onClick = onManagePremium, ) } @@ -166,7 +166,7 @@ private fun PremiumHomeScreen( if (state.membership.isPremiumFreeTier()) { Text( modifier = Modifier.padding(horizontal = 36.dp), - text = stringResource(id = R.string.premium_member_early_primal_user), + text = stringResource(id = R.string.premium_home_member_early_primal_user), color = AppTheme.extraColorScheme.onSurfaceVariantAlt2, style = AppTheme.typography.bodyMedium, textAlign = TextAlign.Center, @@ -188,7 +188,7 @@ private fun PremiumHomeScreen( state.membership.isExpired() -> { Text( color = AppTheme.extraColorScheme.onSurfaceVariantAlt2, - text = stringResource(id = R.string.premium_expired_subscription_notice), + text = stringResource(id = R.string.premium_home_expired_subscription_notice), style = AppTheme.typography.bodyMedium, textAlign = TextAlign.Center, ) @@ -196,19 +196,16 @@ private fun PremiumHomeScreen( else -> { if (state.showSupportUsNotice) { - when (state.membership.isPrimalLegendTier()) { - true -> { - SupportUsNoticeLegend( - visible = state.membership.donatedBtc != null, - donatedSats = state.membership.donatedBtc?.toSats()?.toLong() ?: 0L, - onSupportPrimal = onSupportPrimal, - ) - } - false -> { - SupportUsNoticePremium( - onSupportPrimal = onSupportPrimal, - ) - } + if (state.membership.isPrimalLegendTier()) { + SupportUsNoticeLegend( + visible = state.membership.donatedBtc != null, + donatedSats = state.membership.donatedBtc?.toSats()?.toLong() ?: 0L, + onSupportPrimal = onSupportPrimal, + ) + } else { + SupportUsNoticePremium( + onSupportPrimal = onSupportPrimal, + ) } } } @@ -252,21 +249,18 @@ private fun SupportUsNoticePremium(onSupportPrimal: () -> Unit) { ) { Text( color = AppTheme.extraColorScheme.onSurfaceVariantAlt2, - text = stringResource(id = R.string.premium_enjoying_primal), + text = stringResource(id = R.string.premium_home_enjoying_primal), style = AppTheme.typography.bodyMedium, textAlign = TextAlign.Center, ) Row { Text( color = AppTheme.extraColorScheme.onSurfaceVariantAlt2, - text = stringResource(id = R.string.premium_enjoying_primal_if_so) + " ", + text = stringResource(id = R.string.premium_home_enjoying_primal_if_so) + " ", style = AppTheme.typography.bodyMedium, ) Text( - modifier = Modifier - .clickable( - onClick = onSupportPrimal, - ), + modifier = Modifier.clickable(onClick = onSupportPrimal), style = AppTheme.typography.bodyMedium, text = buildAnnotatedString { withStyle( @@ -274,7 +268,7 @@ private fun SupportUsNoticePremium(onSupportPrimal: () -> Unit) { color = AppTheme.colorScheme.secondary, ), ) { - append(stringResource(id = R.string.premium_support_us)) + append(stringResource(id = R.string.premium_home_support_us)) } withStyle( style = SpanStyle( @@ -303,14 +297,11 @@ private fun SupportUsNoticeLegend( Row { Text( color = AppTheme.extraColorScheme.onSurfaceVariantAlt2, - text = stringResource(id = R.string.legend_contribution_title) + " ", + text = stringResource(id = R.string.premium_home_legend_contribution_title) + " ", style = AppTheme.typography.bodyMedium, ) Text( - modifier = Modifier - .clickable( - onClick = onSupportPrimal, - ), + modifier = Modifier.clickable(onClick = onSupportPrimal), style = AppTheme.typography.bodyMedium, fontWeight = FontWeight.SemiBold, text = buildAnnotatedString { @@ -327,7 +318,7 @@ private fun SupportUsNoticeLegend( if (donatedSats > 0L) { Text( color = AppTheme.extraColorScheme.onSurfaceVariantAlt2, - text = stringResource(id = R.string.legend_support_appreciation), + text = stringResource(id = R.string.premium_home_legend_support_appreciation), style = AppTheme.typography.bodyMedium, textAlign = TextAlign.Center, ) @@ -338,7 +329,7 @@ private fun SupportUsNoticeLegend( onClick = onSupportPrimal, ), color = AppTheme.colorScheme.secondary, - text = stringResource(id = R.string.legend_contribute_more), + text = stringResource(id = R.string.premium_home_legend_contribute_more), style = AppTheme.typography.bodyMedium, textAlign = TextAlign.Center, ) diff --git a/app/src/main/kotlin/net/primal/android/premium/ui/PrimalPremiumTable.kt b/app/src/main/kotlin/net/primal/android/premium/ui/PrimalPremiumTable.kt index 02b13142d..576f6a49c 100644 --- a/app/src/main/kotlin/net/primal/android/premium/ui/PrimalPremiumTable.kt +++ b/app/src/main/kotlin/net/primal/android/premium/ui/PrimalPremiumTable.kt @@ -61,16 +61,16 @@ fun PrimalPremiumTable( PrimalDivider() if (premiumMembership.isPrimalLegendTier()) { PrimalPremiumTableRow( - key = stringResource(id = R.string.premium_table_expires), - value = stringResource(id = R.string.premium_table_never), + key = stringResource(id = R.string.premium_home_table_expires), + value = stringResource(id = R.string.premium_home_table_never), alwaysHideApply = true, ) } else { PrimalPremiumTableRow( key = when { - premiumMembership.isExpired() -> stringResource(id = R.string.premium_table_expired_on) - premiumMembership.recurring -> stringResource(id = R.string.premium_table_renews_on) - else -> stringResource(id = R.string.premium_table_expires_on) + premiumMembership.isExpired() -> stringResource(id = R.string.premium_home_table_expired_on) + premiumMembership.recurring -> stringResource(id = R.string.premium_home_table_renews_on) + else -> stringResource(id = R.string.premium_home_table_expires_on) }, value = when { premiumMembership.recurring && premiumMembership.renewsOn != null -> @@ -80,7 +80,7 @@ fun PrimalPremiumTable( premiumMembership.expiresOn != null -> Instant.ofEpochSecond(premiumMembership.expiresOn) .formatToDefaultDateFormat(FormatStyle.LONG) - else -> stringResource(R.string.premium_table_never) + else -> stringResource(R.string.premium_home_table_never) }, alwaysHideApply = true, ) @@ -148,7 +148,7 @@ private fun PrimalPremiumTableRow( } Text( modifier = Modifier.clickable { onApplyClick?.invoke() }, - text = stringResource(id = R.string.premium_table_apply), + text = stringResource(id = R.string.premium_home_table_apply), color = AppTheme.colorScheme.secondary, style = AppTheme.typography.bodyMedium, ) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ff22e062d..28cb5e02c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -160,28 +160,27 @@ Apply Promo Code Cancel - Premium - Hey there! You are an early Primal user who interacted with our team, so we gave you 6 months of Primal Premium for free. ♥\uFE0F\uD83E\uDEC2 - Manage Premium - Renew Subscription - Extend Subscription - Are you enjoying Primal? - If so, see how you can - support us - Expires - Never - Renews on - Expires on - Expired on - apply - Your Primal Premium subscription has expired.\nYou can renew it below: + Premium + Hey there! You are an early Primal user who interacted with our team, so we gave you 6 months of Primal Premium for free. ♥\uFE0F\uD83E\uDEC2 + Manage Premium + Renew Subscription + Extend Subscription + Are you enjoying Primal? + If so, see how you can + support us + Expires + Never + Renews on + Expires on + Expired on + apply + Your Primal Premium subscription has expired.\nYou can renew it below: + Your contribution to Primal: + Thank you for your support! 💜🫂 + Want to contribute more? Support Primal - Your contribution to Primal: - Thank you for your support! 💜🫂 - Want to contribute more? - Primal Legend The Legend tier was created to recognize users who have made a significant\ncontribution to Primal. Donate $1000 or more to gain: