Files
Reflect/Shared/Views/IAPWarningView.swift
Trey t e0330dbc8d Replace EventLogger with typed AnalyticsManager using PostHog
Complete analytics overhaul: delete EventLogger.swift, create Analytics.swift
with typed event enum (~45 events), screen tracking, super properties
(theme, icon pack, voting layout, etc.), session replay with kill switch,
autocapture, and network telemetry. Replace all 99 call sites across 38 files
with compiler-enforced typed events in object_action naming convention.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 15:12:33 -06:00

64 lines
2.0 KiB
Swift

//
// IAPWarningView.swift
// Feels
//
// 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) {
FeelsSubscriptionStoreView(source: "iap_warning")
}
}
}
#Preview {
IAPWarningView(iapManager: IAPManager())
}