diff --git a/apps/ios/Shared/Views/Badges/BadgesPayView.swift b/apps/ios/Shared/Views/Badges/BadgesPayView.swift index 1e45f73a63..362d7564a6 100644 --- a/apps/ios/Shared/Views/Badges/BadgesPayView.swift +++ b/apps/ios/Shared/Views/Badges/BadgesPayView.swift @@ -120,7 +120,7 @@ struct BadgesPayView: View { Button { // TODO [badges] wire to purchase API when it lands. } label: { - Text(selectedPeriod == .subscribe ? level.payMonthlyLabel : level.payOnceLabel) + Text(selectedPeriod == .subscribe ? "Pay \(level.priceAmount)/month" : "Pay \(level.priceAmount)") } .buttonStyle(OnboardingButtonStyle(isDisabled: false)) } diff --git a/apps/ios/Shared/Views/Badges/BadgesYourLevelView.swift b/apps/ios/Shared/Views/Badges/BadgesYourLevelView.swift index 30e228034d..3cfd576ea9 100644 --- a/apps/ios/Shared/Views/Badges/BadgesYourLevelView.swift +++ b/apps/ios/Shared/Views/Badges/BadgesYourLevelView.swift @@ -30,34 +30,13 @@ enum BadgeLevel: String, CaseIterable, Identifiable { } } - var monthlyPrice: LocalizedStringKey { - switch self { - case .supporter: "$7/month" - case .legend: "$70/month" - } - } - - var oneMonthPrice: LocalizedStringKey { + var priceAmount: String { switch self { case .supporter: "$7" case .legend: "$70" } } - var payMonthlyLabel: LocalizedStringKey { - switch self { - case .supporter: "Pay $7/month" - case .legend: "Pay $70/month" - } - } - - var payOnceLabel: LocalizedStringKey { - switch self { - case .supporter: "Pay $7" - case .legend: "Pay $70" - } - } - var tagline: LocalizedStringKey { switch self { case .supporter: "Optional profile badge\nand 2GB files" @@ -141,7 +120,7 @@ struct BadgesYourLevelView: View { Text(level.filesDescription) .font(.subheadline) .foregroundColor(theme.colors.secondary) - Text(level.monthlyPrice) + Text("\(level.priceAmount)/month") .font(.body) .padding(.bottom, 20) } diff --git a/apps/ios/Shared/Views/ChatList/ChatListView.swift b/apps/ios/Shared/Views/ChatList/ChatListView.swift index 749cb55b39..f8745a7eaf 100644 --- a/apps/ios/Shared/Views/ChatList/ChatListView.swift +++ b/apps/ios/Shared/Views/ChatList/ChatListView.swift @@ -426,8 +426,6 @@ struct ChatListView: View { .listRowSeparator(.hidden) .listRowBackground(Color.clear) } - // +1 vs SimpleX Lock's threshold (ContentView) accounts for the always-present - // SimpleX Directory contact card, so this still needs 3 real conversations. if !supporterBannerShown && chatModel.chats.count > 3 { SupportSimpleXBanner( onTap: { showBadgesSheet = true }, diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/badges/BadgesPayView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/badges/BadgesPayView.kt index 2256b1c219..c50c0c4aa9 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/badges/BadgesPayView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/badges/BadgesPayView.kt @@ -138,7 +138,8 @@ private fun PeriodCard(period: BadgePeriod, selectedPeriod: BadgePeriod, modifie private fun PayButton(level: BadgeLevel, selectedPeriod: BadgePeriod) { OnboardingActionButton( modifier = if (appPlatform.isAndroid) Modifier.padding(horizontal = DEFAULT_ONBOARDING_HORIZONTAL_PADDING).fillMaxWidth() else Modifier.widthIn(min = 300.dp), - labelId = if (selectedPeriod == BadgePeriod.Subscribe) level.payMonthlyLabel else level.payOnceLabel, + labelId = if (selectedPeriod == BadgePeriod.Subscribe) MR.strings.badges_pay_monthly else MR.strings.badges_pay_once, + labelArg = level.priceAmount, onboarding = null, onclick = { // TODO [badges] wire to purchase API when it lands. diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/badges/BadgesYourLevelView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/badges/BadgesYourLevelView.kt index fa5bdeeaf3..03082526a0 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/badges/BadgesYourLevelView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/badges/BadgesYourLevelView.kt @@ -40,28 +40,10 @@ enum class BadgeLevel { Legend -> MR.strings.badges_level_legend_files } - val monthlyPrice: StringResource + val priceAmount: String get() = when (this) { - Supporter -> MR.strings.badges_level_supporter_monthly - Legend -> MR.strings.badges_level_legend_monthly - } - - val oneMonthPrice: StringResource - get() = when (this) { - Supporter -> MR.strings.badges_level_supporter_one_month - Legend -> MR.strings.badges_level_legend_one_month - } - - val payMonthlyLabel: StringResource - get() = when (this) { - Supporter -> MR.strings.badges_pay_supporter_monthly - Legend -> MR.strings.badges_pay_legend_monthly - } - - val payOnceLabel: StringResource - get() = when (this) { - Supporter -> MR.strings.badges_pay_supporter_once - Legend -> MR.strings.badges_pay_legend_once + Supporter -> "$7" + Legend -> "$70" } val tagline: StringResource @@ -157,7 +139,7 @@ private fun LevelCard(level: BadgeLevel, selectedLevel: BadgeLevel, modifier: Mo ) Text(stringResource(level.title), style = MaterialTheme.typography.h3, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center) Text(stringResource(level.filesDescription), style = MaterialTheme.typography.body2, color = MaterialTheme.colors.secondary, textAlign = TextAlign.Center) - Text(stringResource(level.monthlyPrice), style = MaterialTheme.typography.body1, textAlign = TextAlign.Center) + Text(stringResource(MR.strings.badges_price_monthly).format(level.priceAmount), style = MaterialTheme.typography.body1, textAlign = TextAlign.Center) } } diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListView.kt index 3f4bae02ed..729524ae49 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListView.kt @@ -1001,8 +1001,6 @@ private fun BoxScope.ChatList(searchText: MutableState, listStat ToggleChatListCard() } } - // +1 vs SimpleX Lock's threshold accounts for the always-present SimpleX Directory contact card, - // so this still needs 3 real conversations. if (!supporterBannerShown.value && chatModel.chats.value.size > 3) { item { Box(Modifier.zIndex(1f).padding(16.dp)) { diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/SimpleXInfo.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/SimpleXInfo.kt index 74dadcd671..d97d709953 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/SimpleXInfo.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/SimpleXInfo.kt @@ -190,12 +190,14 @@ expect fun OnboardingActionButton(user: User?, onboardingStage: SharedPreference fun OnboardingActionButton( modifier: Modifier = Modifier, labelId: StringResource, + labelArg: String? = null, onboarding: OnboardingStage?, enabled: Boolean = true, icon: Painter? = null, iconColor: Color = Color.White, onclick: (() -> Unit)? ) { + val label = if (labelArg != null) stringResource(labelId).format(labelArg) else stringResource(labelId) Button( onClick = { onclick?.invoke() @@ -211,9 +213,9 @@ fun OnboardingActionButton( colors = ButtonDefaults.buttonColors(MaterialTheme.colors.primary, disabledBackgroundColor = MaterialTheme.colors.secondary) ) { if (icon != null) { - Icon(icon, stringResource(labelId), Modifier.padding(end = DEFAULT_PADDING_HALF), tint = iconColor) + Icon(icon, label, Modifier.padding(end = DEFAULT_PADDING_HALF), tint = iconColor) } - Text(stringResource(labelId), style = MaterialTheme.typography.h2, color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.Medium) + Text(label, style = MaterialTheme.typography.h2, color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.Medium) } } diff --git a/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml b/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml index 78be943092..dc82bcedcd 100644 --- a/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml +++ b/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml @@ -3202,14 +3202,9 @@ Legend Send 2GB files Send 5GB files - $7/month - $70/month - $7 - $70 - Pay $7/month - Pay $70/month - Pay $7 - Pay $70 + %1$s/month + Pay %1$s/month + Pay %1$s Optional profile badge\nand 2GB files Optional profile badge\nand 5GB files 1 month