mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-14 22:20:35 +00:00
wip
This commit is contained in:
@@ -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))
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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 },
|
||||
|
||||
+2
-1
@@ -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.
|
||||
|
||||
+4
-22
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-2
@@ -1001,8 +1001,6 @@ private fun BoxScope.ChatList(searchText: MutableState<TextFieldValue>, 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)) {
|
||||
|
||||
+4
-2
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3202,14 +3202,9 @@
|
||||
<string name="badges_level_legend">Legend</string>
|
||||
<string name="badges_level_supporter_files">Send 2GB files</string>
|
||||
<string name="badges_level_legend_files">Send 5GB files</string>
|
||||
<string name="badges_level_supporter_monthly">$7/month</string>
|
||||
<string name="badges_level_legend_monthly">$70/month</string>
|
||||
<string name="badges_level_supporter_one_month">$7</string>
|
||||
<string name="badges_level_legend_one_month">$70</string>
|
||||
<string name="badges_pay_supporter_monthly">Pay $7/month</string>
|
||||
<string name="badges_pay_legend_monthly">Pay $70/month</string>
|
||||
<string name="badges_pay_supporter_once">Pay $7</string>
|
||||
<string name="badges_pay_legend_once">Pay $70</string>
|
||||
<string name="badges_price_monthly">%1$s/month</string>
|
||||
<string name="badges_pay_monthly">Pay %1$s/month</string>
|
||||
<string name="badges_pay_once">Pay %1$s</string>
|
||||
<string name="badges_level_supporter_tagline">Optional profile badge\nand 2GB files</string>
|
||||
<string name="badges_level_legend_tagline">Optional profile badge\nand 5GB files</string>
|
||||
<string name="badges_period_one_month">1 month</string>
|
||||
|
||||
Reference in New Issue
Block a user