diff --git a/Adapty/Classes/Adapty.swift b/Adapty/Classes/Adapty.swift index b2c9aa6e..e862c123 100644 --- a/Adapty/Classes/Adapty.swift +++ b/Adapty/Classes/Adapty.swift @@ -15,7 +15,10 @@ import UIKit func didReceiveUpdatedPurchaserInfo(_ purchaserInfo: PurchaserInfoModel) func didReceivePromo(_ promo: PromoModel) - @objc optional func paymentQueue(shouldAddStorePaymentFor product: ProductModel, defermentCompletion makeDeferredPurchase: @escaping DeferredPurchaseCompletion) + @objc optional func paymentQueue(shouldAddStorePaymentFor + product: ProductModel, + defermentCompletion makeDeferredPurchase: @escaping DeferredPurchaseCompletion) + @objc optional func didReceivePaywallsForConfig(paywalls: [PaywallModel]) } diff --git a/Adapty/Classes/IAPManager.swift b/Adapty/Classes/IAPManager.swift index 80c8f574..860904a5 100644 --- a/Adapty/Classes/IAPManager.swift +++ b/Adapty/Classes/IAPManager.swift @@ -121,18 +121,23 @@ class IAPManager: NSObject { let params: Parameters = ["profile_id": profileId, "paywall_padding_top": topOffset, "automatic_paywalls_screen_reporting_enabled": false] paywallsRequest = apiManager.getPaywalls(params: params) { (paywalls, products, error) in - guard let error = error else { + func handlePaywalls(_ paywalls: [PaywallModel]?, products: [ProductModel]?) { self.shortPaywalls = paywalls self.shortProducts = products self.requestProducts() + if let paywalls = paywalls { + Adapty.delegate?.didReceivePaywallsForConfig?(paywalls: paywalls) + } + } + + guard let error = error else { + handlePaywalls(paywalls, products: products) return } if let paywalls = self.paywalls, let products = self.products { // request products with cached data - self.shortPaywalls = paywalls - self.shortProducts = products - self.requestProducts() + handlePaywalls(paywalls, products: products) } else { self.callPaywallsCompletionAndCleanCallback(.failure(error)) } diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 27a607df..70c4884d 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - Adapty (1.16.1) + - Adapty (1.16.3) - Adjust (4.29.6): - Adjust/Core (= 4.29.6) - Adjust/Core (4.29.6) @@ -25,7 +25,7 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - Adapty: 58980d056a394eb5d8ae553c298ad0a402945e5e + Adapty: a7b0104b17ca45ff9ee86bbb0eb3c0702bb93e3a Adjust: 94f1c99429fb2a7ebe530294fd66a88d63a54922 AppsFlyerFramework: 57fb1fc68a5b8103353ce94d6e57861cbc4a55c3 Branch: 65d05ffb137ef504777cff6bd4fb6f770f17145a