Skip to content

Commit

Permalink
Paywalls: disable the close button when an action is in progress (#3474)
Browse files Browse the repository at this point in the history
Disabled and lowered the opacity of the close button while an action is
in progress, to prevent a potentially bad UX state when you exit the
paywall.
  • Loading branch information
aboedo committed Dec 6, 2023
1 parent 07e16b3 commit d99fd9e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions RevenueCatUI/PaywallView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ struct LoadedOfferingPaywallView: View {
if let dismiss = self.dismiss {
NavigationView {
view
.toolbar { Self.toolbar(dismiss) }
.toolbar { self.toolbar(dismiss) }
}
.navigationViewStyle(.stack)

Expand All @@ -329,13 +329,18 @@ struct LoadedOfferingPaywallView: View {
)
}

private static func toolbar(_ dismiss: @escaping () -> Void) -> some ToolbarContent {
private func toolbar(_ dismiss: @escaping () -> Void) -> some ToolbarContent {
ToolbarItem(placement: .destructiveAction) {
Button {
dismiss()
} label: {
Image(systemName: "xmark")
}
.disabled(self.purchaseHandler.actionInProgress)
.opacity(
self.purchaseHandler.actionInProgress
? Constants.purchaseInProgressButtonOpacity
: 1)
}
}

Expand Down

0 comments on commit d99fd9e

Please sign in to comment.