Files
Sportstime/SportsTime/Features/Paywall/Views/ProBadge.swift
Trey t 22772fa57f 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>
2026-01-13 11:41:40 -06:00

47 lines
1002 B
Swift

//
// 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()
}