// // IAPWarningView.swift // Reflect // // Trial warning banner shown at bottom of Month/Year views. // import SwiftUI struct IAPWarningView: View { @AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system private var textColor: Color { theme.currentTheme.labelColor } @ObservedObject var iapManager: IAPManager @State private var showSubscriptionStore = false var body: some View { VStack(spacing: 8) { HStack { Image(systemName: "clock") .foregroundColor(.orange) if iapManager.daysLeftInTrial > 0 { Text(String(localized: "iap_warning_view_title")) .font(.body) .foregroundColor(textColor) Text("\(iapManager.daysLeftInTrial) days") .font(.body) .bold() .foregroundColor(.orange) } else { Text(String(localized: "purchase_view_trial_expired")) .font(.body) .bold() .foregroundColor(.orange) } } Button { showSubscriptionStore = true } label: { Text(String(localized: "iap_warning_view_buy_button")) .font(.headline) .foregroundColor(.white) .frame(maxWidth: .infinity) .padding(.vertical, 12) .background(RoundedRectangle(cornerRadius: 10).fill(Color.pink)) } .accessibilityIdentifier(AccessibilityID.IAPWarning.subscribeButton) } .padding() .background(theme.currentTheme.secondaryBGColor) .sheet(isPresented: $showSubscriptionStore) { ReflectSubscriptionStoreView(source: "iap_warning") } } } #Preview { IAPWarningView(iapManager: IAPManager()) }