feat(store): add In-App Purchase system with Pro subscription
Implement freemium model with StoreKit 2: - StoreManager singleton for purchase/restore/entitlements - ProFeature enum defining gated features - PaywallView and OnboardingPaywallView for upsell UI - ProGate view modifier and ProBadge component Feature gating: - Trip saving: 1 free trip, then requires Pro - PDF export: Pro only with badge indicator - Progress tab: Shows ProLockedView for free users - Settings: Subscription management section Also fixes pre-existing test issues with StadiumVisit and ItineraryOption model signature changes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
46
SportsTime/Features/Paywall/Views/ProBadge.swift
Normal file
46
SportsTime/Features/Paywall/Views/ProBadge.swift
Normal file
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// ProBadge.swift
|
||||
// SportsTime
|
||||
//
|
||||
// Small "PRO" badge indicator for locked features.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ProBadge: View {
|
||||
var body: some View {
|
||||
Text("PRO")
|
||||
.font(.caption2.bold())
|
||||
.foregroundStyle(.white)
|
||||
.padding(.horizontal, 6)
|
||||
.padding(.vertical, 2)
|
||||
.background(Theme.warmOrange, in: Capsule())
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - View Modifier
|
||||
|
||||
extension View {
|
||||
/// Adds a small PRO badge overlay to indicate locked feature
|
||||
func proBadge(alignment: Alignment = .topTrailing) -> some View {
|
||||
overlay(alignment: alignment) {
|
||||
if !StoreManager.shared.isPro {
|
||||
ProBadge()
|
||||
.padding(4)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
VStack(spacing: 20) {
|
||||
ProBadge()
|
||||
|
||||
// Example usage
|
||||
RoundedRectangle(cornerRadius: 12)
|
||||
.fill(.blue.opacity(0.2))
|
||||
.frame(width: 100, height: 60)
|
||||
.proBadge()
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
Reference in New Issue
Block a user