Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to customize spacing applied to SwiftUI-based paywall footer #4340

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions RevenueCatUI/Data/PaywallViewConfiguration.swift
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ struct PaywallViewConfiguration {
var customerInfo: CustomerInfo?
var mode: PaywallViewMode
var fonts: PaywallFontProvider
var spacing: CGFloat?
var displayCloseButton: Bool
var introEligibility: TrialOrIntroEligibilityChecker?
var purchaseHandler: PurchaseHandler
@@ -28,6 +29,7 @@ struct PaywallViewConfiguration {
customerInfo: CustomerInfo? = nil,
mode: PaywallViewMode = .default,
fonts: PaywallFontProvider = DefaultPaywallFontProvider(),
spacing: CGFloat? = nil,
displayCloseButton: Bool = false,
introEligibility: TrialOrIntroEligibilityChecker? = nil,
purchaseHandler: PurchaseHandler,
@@ -37,6 +39,7 @@ struct PaywallViewConfiguration {
self.customerInfo = customerInfo
self.mode = mode
self.fonts = fonts
self.spacing = spacing
self.displayCloseButton = displayCloseButton
self.introEligibility = introEligibility
self.purchaseHandler = purchaseHandler
6 changes: 5 additions & 1 deletion RevenueCatUI/View+PresentPaywallFooter.swift
Original file line number Diff line number Diff line change
@@ -81,6 +81,7 @@ extension View {
public func paywallFooter(
condensed: Bool = false,
fonts: PaywallFontProvider = DefaultPaywallFontProvider(),
spacing: CGFloat? = nil,
myAppPurchaseLogic: MyAppPurchaseLogic? = nil,
purchaseStarted: PurchaseOfPackageStartedHandler? = nil,
purchaseCompleted: PurchaseOrRestoreCompletedHandler? = nil,
@@ -97,6 +98,7 @@ extension View {
customerInfo: nil,
condensed: condensed,
fonts: fonts,
spacing: spacing,
introEligibility: nil,
purchaseHandler: purchaseHandler,
purchaseStarted: purchaseStarted,
@@ -206,6 +208,7 @@ extension View {
customerInfo: CustomerInfo?,
condensed: Bool = false,
fonts: PaywallFontProvider = DefaultPaywallFontProvider(),
spacing: CGFloat? = nil,
introEligibility: TrialOrIntroEligibilityChecker? = nil,
purchaseHandler: PurchaseHandler,
purchaseStarted: PurchaseOfPackageStartedHandler? = nil,
@@ -224,6 +227,7 @@ extension View {
customerInfo: customerInfo,
mode: condensed ? .condensedFooter : .footer,
fonts: fonts,
spacing: spacing,
displayCloseButton: false,
introEligibility: introEligibility,
purchaseHandler: purchaseHandler
@@ -267,7 +271,7 @@ private struct PresentingPaywallFooterModifier: ViewModifier {

func body(content: Content) -> some View {
content
.safeAreaInset(edge: .bottom) {
.safeAreaInset(edge: .bottom, spacing: configuration.spacing) {
PaywallView(configuration: self.configuration)
.onPurchaseStarted {
self.purchaseStarted?($0)