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:
35
SportsTimeTests/Store/ProFeatureTests.swift
Normal file
35
SportsTimeTests/Store/ProFeatureTests.swift
Normal file
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// ProFeatureTests.swift
|
||||
// SportsTimeTests
|
||||
//
|
||||
|
||||
import Testing
|
||||
@testable import SportsTime
|
||||
|
||||
struct ProFeatureTests {
|
||||
@Test func allCases_containsExpectedFeatures() {
|
||||
let features = ProFeature.allCases
|
||||
#expect(features.contains(.unlimitedTrips))
|
||||
#expect(features.contains(.pdfExport))
|
||||
#expect(features.contains(.progressTracking))
|
||||
#expect(features.count == 3)
|
||||
}
|
||||
|
||||
@Test func displayName_returnsHumanReadableString() {
|
||||
#expect(ProFeature.unlimitedTrips.displayName == "Unlimited Trips")
|
||||
#expect(ProFeature.pdfExport.displayName == "PDF Export")
|
||||
#expect(ProFeature.progressTracking.displayName == "Progress Tracking")
|
||||
}
|
||||
|
||||
@Test func description_returnsMarketingCopy() {
|
||||
#expect(ProFeature.unlimitedTrips.description.contains("trips"))
|
||||
#expect(ProFeature.pdfExport.description.contains("PDF"))
|
||||
#expect(ProFeature.progressTracking.description.contains("stadium"))
|
||||
}
|
||||
|
||||
@Test func icon_returnsValidSFSymbol() {
|
||||
#expect(!ProFeature.unlimitedTrips.icon.isEmpty)
|
||||
#expect(!ProFeature.pdfExport.icon.isEmpty)
|
||||
#expect(!ProFeature.progressTracking.icon.isEmpty)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user