Skip to content

Commit

Permalink
fix: call presentPaywallIfNeeded when needed (RevenueCat#1066) by @da…
Browse files Browse the repository at this point in the history
…njocha (RevenueCat#1069)

Merging RevenueCat#1066

Co-authored-by: Daniel Chavez <[email protected]>
  • Loading branch information
vegaro and danjocha authored May 10, 2024
1 parent 80da8d8 commit b2b673b
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions purchases_ui_flutter/ios/Classes/PurchasesUiFlutterPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,24 @@ public class PurchasesUiFlutterPlugin: NSObject, FlutterPlugin {
// This is needed for: https://github.com/RevenueCat/purchases-flutter/issues/1023
PaywallProxy.PaywallOptionsKeys.shouldBlockTouchEvents: true
]

if let offeringIdentifier {
options[PaywallProxy.PaywallOptionsKeys.offeringIdentifier] = offeringIdentifier
}

if let requiredEntitlementIdentifier {
options[PaywallProxy.PaywallOptionsKeys.requiredEntitlementIdentifier] = requiredEntitlementIdentifier

self.paywallProxy.presentPaywallIfNeeded(
options: options,
paywallResultHandler: result
)
} else {
self.paywallProxy.presentPaywall(
options: options,
paywallResultHandler: result
)
}
if let offeringIdentifier {
options[PaywallProxy.PaywallOptionsKeys.offeringIdentifier] = offeringIdentifier
}
self.paywallProxy.presentPaywall(
options: options,
paywallResultHandler: result
)
} else {
NSLog("Presenting paywall requires iOS 15+")
}
Expand Down

0 comments on commit b2b673b

Please sign in to comment.