From aed673ea5d0d99d08d463b338e67eff578dcaa3f Mon Sep 17 00:00:00 2001 From: Phillip Thelen Date: Mon, 14 Oct 2024 15:49:08 +0200 Subject: [PATCH] fix text --- HabitRPG/Generated/Strings.swift | 2 +- .../SubscriptionDetailView.swift | 20 +++++++++---------- HabitRPG/UI/General/FaintViewController.swift | 5 +++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/HabitRPG/Generated/Strings.swift b/HabitRPG/Generated/Strings.swift index 58c5901c9..2070eb3af 100644 --- a/HabitRPG/Generated/Strings.swift +++ b/HabitRPG/Generated/Strings.swift @@ -1787,7 +1787,7 @@ public enum L10n { public enum Faint { /// Refill Health & Try Again public static var button: String { return L10n.tr("Mainstrings", "faint.button") } - /// Broken equipment can be repurchased from Rewards + /// Broken equipment can be repurchased from the Market public static var disclaimer: String { return L10n.tr("Mainstrings", "faint.disclaimer") } /// Don't despair! public static var dontDespair: String { return L10n.tr("Mainstrings", "faint.dont_despair") } diff --git a/HabitRPG/TableviewCells/SubscriptionDetailView.swift b/HabitRPG/TableviewCells/SubscriptionDetailView.swift index a7dbcb827..1f3259a23 100644 --- a/HabitRPG/TableviewCells/SubscriptionDetailView.swift +++ b/HabitRPG/TableviewCells/SubscriptionDetailView.swift @@ -135,7 +135,16 @@ class SubscriptionDetailView: UITableViewCell { private func setCancelDescription(_ plan: SubscriptionPlanProtocol) { cancelTitleLabel.text = L10n.cancelSubscription cancelDescriptionButton.isHidden = false - if plan.paymentMethod == "Apple" { + if plan.dateTerminated != nil { + cancelDescriptionButton.setTitle(L10n.renewSubscription, for: .normal) + if plan.isGifted { + cancelDescriptionLabel.text = L10n.renewSubscriptionGiftedDescription + cancelTitleLabel.text = L10n.subscribe + } else { + cancelDescriptionLabel.text = L10n.renewSubscriptionDescription + cancelTitleLabel.text = L10n.resubscribe + } + } else if plan.paymentMethod == "Apple" { cancelDescriptionLabel.text = L10n.unsubscribeItunes cancelDescriptionButton.setTitle(L10n.openItunes, for: .normal) } else if plan.paymentMethod == "Google" { @@ -147,15 +156,6 @@ class SubscriptionDetailView: UITableViewCell { } else if plan.isGroupPlanSub { cancelDescriptionLabel.text = L10n.cancelSubscriptionGroupPlan cancelDescriptionButton.isHidden = true - } else if plan.dateTerminated != nil { - cancelDescriptionButton.setTitle(L10n.renewSubscription, for: .normal) - if plan.isGifted { - cancelDescriptionLabel.text = L10n.renewSubscriptionGiftedDescription - cancelTitleLabel.text = L10n.subscribe - } else { - cancelDescriptionLabel.text = L10n.renewSubscriptionDescription - cancelTitleLabel.text = L10n.resubscribe - } } } diff --git a/HabitRPG/UI/General/FaintViewController.swift b/HabitRPG/UI/General/FaintViewController.swift index 2d2701749..cd72646b1 100644 --- a/HabitRPG/UI/General/FaintViewController.swift +++ b/HabitRPG/UI/General/FaintViewController.swift @@ -86,10 +86,11 @@ private class ViewModel: ObservableObject { } userRepository.getUser() - .take(first: 1) .on(value: { user in self.isSubscribed = user.isSubscribed - self.lossText = LocalizedStringKey(L10n.Faint.subtitle(String((user.stats?.level ?? 1) - 1), String(Int(user.stats?.gold ?? 0)))) + if self.lossText == "" { + self.lossText = LocalizedStringKey(L10n.Faint.subtitle(String((user.stats?.level ?? 1) - 1), String(Int(user.stats?.gold ?? 0)))) + } }).start() }