iap - wip
This commit is contained in:
@@ -8,10 +8,12 @@
|
||||
import SwiftUI
|
||||
import CloudKitSyncMonitor
|
||||
import UniformTypeIdentifiers
|
||||
import StoreKit
|
||||
|
||||
struct SettingsView: View {
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
||||
@EnvironmentObject var iapManager: IAPManager
|
||||
|
||||
@State private var showingExporter = false
|
||||
@State private var showingImporter = false
|
||||
@State private var importContent = ""
|
||||
@@ -35,6 +37,7 @@ struct SettingsView: View {
|
||||
.padding()
|
||||
|
||||
// cloudKitEnable
|
||||
subscriptionInfoView
|
||||
canDelete
|
||||
showOnboardingButton
|
||||
specialThanksCell
|
||||
@@ -136,6 +139,19 @@ struct SettingsView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private var subscriptionInfoView: some View {
|
||||
ZStack {
|
||||
theme.currentTheme.secondaryBGColor
|
||||
PurchaseButtonView(height: iapManager.currentSubscription != nil ? 300 : 175, iapManager: iapManager, showManageSubClosure: {
|
||||
Task {
|
||||
await
|
||||
self.showManageSubscription()
|
||||
}
|
||||
})
|
||||
}
|
||||
.cornerRadius(Constants.viewsCornerRaidus, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
}
|
||||
|
||||
private var closeButtonView: some View {
|
||||
HStack{
|
||||
Spacer()
|
||||
@@ -483,6 +499,17 @@ struct SettingsView: View {
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.cornerRadius(Constants.viewsCornerRaidus, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
}
|
||||
|
||||
func showManageSubscription() async {
|
||||
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene{
|
||||
do {
|
||||
try await StoreKit.AppStore.showManageSubscriptions(in: windowScene)
|
||||
iapManager.refresh()
|
||||
} catch {
|
||||
print("Sheet can not be opened")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct TextFile: FileDocument {
|
||||
|
||||
Reference in New Issue
Block a user