Files
Reflect/Shared/Views/IAPWarningView.swift
Trey t 0442eab1f8 Rebrand entire project from Feels to Reflect
Complete rename across all bundle IDs, App Groups, CloudKit containers,
StoreKit product IDs, data store filenames, URL schemes, logger subsystems,
Swift identifiers, user-facing strings (7 languages), file names, directory
names, Xcode project, schemes, assets, and documentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 11:47:16 -06:00

64 lines
2.0 KiB
Swift

//
// 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 let expirationDate = iapManager.trialExpirationDate, expirationDate > Date() {
Text(String(localized: "iap_warning_view_title"))
.font(.body)
.foregroundColor(textColor)
Text(expirationDate, style: .relative)
.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))
}
}
.padding()
.background(theme.currentTheme.secondaryBGColor)
.sheet(isPresented: $showSubscriptionStore) {
ReflectSubscriptionStoreView(source: "iap_warning")
}
}
}
#Preview {
IAPWarningView(iapManager: IAPManager())
}