This commit is contained in:
spaced4ndy
2026-08-03 14:15:04 +04:00
parent 2acc248c43
commit 5495162e0b
10 changed files with 13 additions and 25 deletions
@@ -126,11 +126,12 @@ struct BadgesPayView: View {
.buttonStyle(OnboardingButtonStyle(isDisabled: false))
}
// TODO [badges] source the actual renewal/end date from the purchase state machine when wired.
private var billingFooter: LocalizedStringKey {
// TODO [badges] source the actual date from the purchase state machine when wired.
let date = "July 22, 2026"
switch selectedPeriod {
case .subscribe: "Renews on July 22, 2026. Cancel anytime."
case .oneMonth: "Ends on August 22, 2026."
case .subscribe: return "Renews on \(date). Cancel anytime."
case .oneMonth: return "Ends on \(date)."
}
}
}
@@ -64,7 +64,6 @@ struct BadgesSupportSimplexView: View {
.frame(height: g.size.height)
}
.frame(maxHeight: .infinity)
.modifier(ThemedBackground())
.navigationBarTitleDisplayMode(.inline)
}
@@ -66,13 +66,6 @@ enum BadgeLevel: String, CaseIterable, Identifiable {
}
}
var badgeAsset: String {
switch self {
case .supporter: "badge-supporter"
case .legend: "badge-legend"
}
}
var badgeType: BadgeType {
switch self {
case .supporter: .supporter
@@ -138,7 +131,7 @@ struct BadgesYourLevelView: View {
selectedLevel = level
} label: {
VStack(spacing: 10) {
Image(level.badgeAsset)
Image(badgeImageName(level.badgeType))
.resizable()
.scaledToFit()
.frame(width: 60, height: 60)
@@ -216,6 +216,7 @@ struct ChatListView: View {
.appSheet(isPresented: $showBadgesSheet) {
NavigationView {
BadgesSupportSimplexView(showsAsSheet: true)
.modifier(ThemedBackground())
}
}
.onChange(of: activeUserPickerSheet) {
@@ -95,7 +95,7 @@ struct NameBadge: View {
}
}
private func badgeImageName(_ t: BadgeType) -> String {
func badgeImageName(_ t: BadgeType) -> String {
switch t {
case .legend: "badge-legend"
case .investor: "badge-investor"
@@ -393,7 +393,7 @@ struct SettingsView: View {
NavigationLink {
VersionView()
.navigationBarTitle("App version")
.modifier(ThemedBackground())
.modifier(ThemedBackground(grouped: true))
} label: {
Text(verbatim: "v\(appVersion ?? "?")")
}
@@ -96,7 +96,7 @@ fun BadgesPayView(level: BadgeLevel) {
modifier = Modifier.padding(top = 7.5.dp, bottom = 7.5.dp).clip(CircleShape)
) {
Text(
stringResource(billingFooter(selectedPeriod)),
stringResource(billingFooter(selectedPeriod)).format("July 22, 2026"),
Modifier.padding(vertical = 5.dp),
style = MaterialTheme.typography.body2,
color = MaterialTheme.colors.secondary,
@@ -71,12 +71,6 @@ enum class BadgeLevel {
Legend -> MR.strings.badges_level_legend_tagline
}
val badgeAsset: dev.icerock.moko.resources.ImageResource
get() = when (this) {
Supporter -> MR.images.badge_supporter
Legend -> MR.images.badge_legend
}
val badgeType: BadgeType
get() = when (this) {
Supporter -> BadgeType.Supporter
@@ -157,7 +151,7 @@ private fun LevelCard(level: BadgeLevel, selectedLevel: BadgeLevel, modifier: Mo
verticalArrangement = Arrangement.spacedBy(10.dp)
) {
Image(
painterResource(level.badgeAsset),
painterResource(badgeImage(level.badgeType)),
contentDescription = null,
contentScale = ContentScale.Fit,
modifier = Modifier.size(60.dp)
@@ -245,7 +245,7 @@ fun showBadgeInfoAlert(name: String, badge: LocalBadge, uriHandler: UriHandler)
}
}
private fun badgeImage(t: BadgeType): ImageResource = when (t) {
fun badgeImage(t: BadgeType): ImageResource = when (t) {
is BadgeType.Legend -> MR.images.badge_legend
is BadgeType.Investor -> MR.images.badge_investor
else -> MR.images.badge_supporter // Supporter + Unknown
@@ -3214,8 +3214,8 @@
<string name="badges_level_legend_tagline">Optional profile badge\nand 5GB files</string>
<string name="badges_period_one_month">1 month</string>
<string name="badges_period_subscribe">Subscribe</string>
<string name="badges_billing_footer_subscribe">Renews on July 22, 2026. Cancel anytime.</string>
<string name="badges_billing_footer_one_month">Ends on August 22, 2026.</string>
<string name="badges_billing_footer_subscribe">Renews on %1$s. Cancel anytime.</string>
<string name="badges_billing_footer_one_month">Ends on %1$s.</string>
<string name="badges_your_level_title">Your level</string>
<string name="badges_support_simplex_title">Support SimpleX</string>
<string name="badges_support_simplex_body">SimpleX doesn\'t sell ads or data. It\'s funded by its users and by investors who share the mission. You can support the project and show a badge on your profile.</string>