From b1713337f64399deb9d9fc8a77ab8eb3899ba1ff Mon Sep 17 00:00:00 2001 From: treyt Date: Fri, 27 Feb 2026 13:00:53 -0600 Subject: [PATCH] fix: issue #146 - make trial always says days on every trial banner in the app Automated fix by Tony CI v3. Refs #146 Co-Authored-By: Claude --- Shared/Views/IAPWarningView.swift | 4 ++-- Shared/Views/PurchaseButtonView.swift | 4 ++-- Shared/Views/SettingsView/SettingsTabView.swift | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Shared/Views/IAPWarningView.swift b/Shared/Views/IAPWarningView.swift index f716ddc..201f45c 100644 --- a/Shared/Views/IAPWarningView.swift +++ b/Shared/Views/IAPWarningView.swift @@ -22,12 +22,12 @@ struct IAPWarningView: View { Image(systemName: "clock") .foregroundColor(.orange) - if let expirationDate = iapManager.trialExpirationDate, expirationDate > Date() { + if iapManager.daysLeftInTrial > 0 { Text(String(localized: "iap_warning_view_title")) .font(.body) .foregroundColor(textColor) - Text(expirationDate, style: .relative) + Text("\(iapManager.daysLeftInTrial) days") .font(.body) .bold() .foregroundColor(.orange) diff --git a/Shared/Views/PurchaseButtonView.swift b/Shared/Views/PurchaseButtonView.swift index 1e7edf7..0c46eb8 100644 --- a/Shared/Views/PurchaseButtonView.swift +++ b/Shared/Views/PurchaseButtonView.swift @@ -192,8 +192,8 @@ struct PurchaseButtonView: View { Image(systemName: "clock") .foregroundColor(.orange) - if let expirationDate = iapManager.trialExpirationDate, expirationDate > Date() { - Text("\(Text(String(localized: "purchase_view_trial_expires_in")).foregroundColor(textColor)) \(Text(expirationDate, style: .relative).foregroundColor(.orange).bold())") + if iapManager.daysLeftInTrial > 0 { + Text("\(Text(String(localized: "purchase_view_trial_expires_in")).foregroundColor(textColor)) \(Text("\(iapManager.daysLeftInTrial) days").foregroundColor(.orange).bold())") } else { Text(String(localized: "purchase_view_trial_expired")) .foregroundColor(.orange) diff --git a/Shared/Views/SettingsView/SettingsTabView.swift b/Shared/Views/SettingsView/SettingsTabView.swift index 20fc229..a0061a5 100644 --- a/Shared/Views/SettingsView/SettingsTabView.swift +++ b/Shared/Views/SettingsView/SettingsTabView.swift @@ -41,7 +41,7 @@ struct SettingsTabView: View { UpgradeBannerView( showWhyUpgrade: $showWhyUpgrade, showSubscriptionStore: $showSubscriptionStore, - trialExpirationDate: iapManager.trialExpirationDate + daysRemaining: iapManager.daysLeftInTrial ) .padding(.horizontal, 16) .padding(.top, 12) @@ -86,7 +86,7 @@ struct SettingsTabView: View { struct UpgradeBannerView: View { @Binding var showWhyUpgrade: Bool @Binding var showSubscriptionStore: Bool - let trialExpirationDate: Date? + let daysRemaining: Int @Environment(\.colorScheme) private var colorScheme @AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system @@ -101,8 +101,8 @@ struct UpgradeBannerView: View { .font(.subheadline.weight(.medium)) .foregroundColor(.orange) - if let expirationDate = trialExpirationDate, expirationDate > Date() { - Text("\(Text("Trial expires in ").font(.subheadline.weight(.medium)).foregroundColor(textColor.opacity(0.8)))\(Text(expirationDate, style: .relative).font(.subheadline.weight(.bold)).foregroundColor(.orange))") + if daysRemaining > 0 { + Text("\(Text("Trial expires in ").font(.subheadline.weight(.medium)).foregroundColor(textColor.opacity(0.8)))\(Text("\(daysRemaining) days").font(.subheadline.weight(.bold)).foregroundColor(.orange))") } else { Text("Trial expired") .font(.subheadline.weight(.medium))