48 lines
1.3 KiB
Swift
48 lines
1.3 KiB
Swift
//
|
|
// FeelsSubscriptionStoreView.swift
|
|
// Feels
|
|
//
|
|
// Native StoreKit 2 subscription purchase view.
|
|
//
|
|
|
|
import SwiftUI
|
|
import StoreKit
|
|
|
|
struct FeelsSubscriptionStoreView: View {
|
|
@Environment(\.dismiss) private var dismiss
|
|
@EnvironmentObject var iapManager: IAPManager
|
|
|
|
var body: some View {
|
|
SubscriptionStoreView(groupID: IAPManager.subscriptionGroupID) {
|
|
VStack(spacing: 16) {
|
|
Image(systemName: "heart.fill")
|
|
.font(.system(size: 60))
|
|
.foregroundStyle(.pink)
|
|
|
|
Text(String(localized: "subscription_store_title"))
|
|
.font(.title)
|
|
.bold()
|
|
|
|
Text(String(localized: "subscription_store_subtitle"))
|
|
.font(.body)
|
|
.foregroundStyle(.secondary)
|
|
.multilineTextAlignment(.center)
|
|
}
|
|
.padding()
|
|
}
|
|
.subscriptionStoreControlStyle(.prominentPicker)
|
|
.storeButton(.visible, for: .restorePurchases)
|
|
.subscriptionStoreButtonLabel(.multiline)
|
|
.onInAppPurchaseCompletion { _, result in
|
|
if case .success(.success(_)) = result {
|
|
dismiss()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
FeelsSubscriptionStoreView()
|
|
.environmentObject(IAPManager())
|
|
}
|