Don't allow multiple tap on purchase button Close #393

This commit is contained in:
Sean Goldin 2023-01-29 00:37:23 -06:00 committed by GitHub
parent 8a40799a3d
commit c25f94eed1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -97,16 +97,20 @@ struct SupportAppView: View {
}
Spacer()
Button {
if !isProcessingPurchase {
isProcessingPurchase = true
Task {
do {
_ = try await Purchases.shared.purchase(product: product)
let result = try await Purchases.shared.purchase(product: product)
if !result.userCancelled {
purchaseSuccessDisplayed = true
}
} catch {
purchaseErrorDisplayed = true
}
isProcessingPurchase = false
}
}
} label: {
if isProcessingPurchase {
ProgressView()