diff --git a/Sources/Purchasing/Purchases/Purchases.swift b/Sources/Purchasing/Purchases/Purchases.swift index 75e781da80..47fc4c5db4 100644 --- a/Sources/Purchasing/Purchases/Purchases.swift +++ b/Sources/Purchasing/Purchases/Purchases.swift @@ -1611,19 +1611,24 @@ private extension Purchases { self.offeringsManager.updateOfferingsCache(appUserID: self.appUserID, isAppBackgrounded: isAppBackgrounded) { offerings in if let offering = offerings.value?.current, let paywall = offering.paywall { - let packageTypes = Set(paywall.config.packages) - let products: [String] = offering.availablePackages - .lazy - .filter { packageTypes.contains($0.packageType) } - .map(\.storeProduct.productIdentifier) - - Logger.debug(Strings.eligibility.warming_up_eligibility_cache(paywall)) - - self.trialOrIntroPriceEligibilityChecker.checkEligibility(productIdentifiers: products) { _ in } + self.operationDispatcher.dispatchOnWorkerThread { + self.warmUpEligibilityCache(offering: offering, paywall: paywall) + } } } } + private func warmUpEligibilityCache(offering: RCOffering, paywall: PaywallData) { + let packageTypes = Set(paywall.config.packages) + let products: [String] = offering.availablePackages + .lazy + .filter { packageTypes.contains($0.packageType) } + .map(\.storeProduct.productIdentifier) + + Logger.debug(Strings.eligibility.warming_up_eligibility_cache(paywall)) + self.trialOrIntroPriceEligibilityChecker.checkEligibility(productIdentifiers: products) { _ in } + } + } // MARK: - Deprecations diff --git a/Sources/Support/FrameworkDisambiguation.swift b/Sources/Support/FrameworkDisambiguation.swift index ffb9c7b706..f07da393d3 100644 --- a/Sources/Support/FrameworkDisambiguation.swift +++ b/Sources/Support/FrameworkDisambiguation.swift @@ -23,4 +23,5 @@ typealias RCRefundRequestStatus = RefundRequestStatus typealias RCErrorCode = ErrorCode +typealias RCOffering = Offering let RCDefaultLogHandler = defaultLogHandler diff --git a/Tests/BackendIntegrationTests/__Snapshots__/StoreKitIntegrationTests/testCanGetOfferings.1.json b/Tests/BackendIntegrationTests/__Snapshots__/StoreKitIntegrationTests/testCanGetOfferings.1.json index 44176be12c..8982dc36a6 100644 --- a/Tests/BackendIntegrationTests/__Snapshots__/StoreKitIntegrationTests/testCanGetOfferings.1.json +++ b/Tests/BackendIntegrationTests/__Snapshots__/StoreKitIntegrationTests/testCanGetOfferings.1.json @@ -21,7 +21,50 @@ "platform_product_identifier" : "com.revenuecat.weekly_1.99.3_day_intro" } ], - "paywall" : null + "paywall" : { + "asset_base_url" : "https://d35rwhxn1vk1te.cloudfront.net", + "config" : { + "blurred_background_image" : true, + "colors" : { + "light" : { + "accent1" : "#ec64e5", + "accent2" : "#d9d9d9", + "background" : "#ffffff", + "call_to_action_background" : "#45c186", + "call_to_action_foreground" : "#ffffff", + "text1" : "#000000" + } + }, + "default_package" : "$rc_monthly", + "display_restore_purchases" : true, + "images" : { + "background" : "300883_1690710097.jpg", + "icon" : "300883_1690710150.jpg" + }, + "packages" : [ + "$rc_monthly", + "$rc_annual" + ], + "privacy_url" : "https://revenuecat.com/privacy", + "tos_url" : "https://revenuecat.com/tos" + }, + "default_locale" : "en_US", + "localized_strings" : { + "en_US" : { + "call_to_action" : "Purchase for {{ price_per_month }} per month", + "call_to_action_with_intro_offer" : "Start your {{ intro_duration }} trial, then {{ price_per_month }} per month", + "features" : [ + + ], + "offer_details" : "{{ total_price_and_per_month }}", + "offer_details_with_intro_offer" : "{{ total_price_and_per_month }} after {{ intro_duration }} trial", + "offer_name" : "{{ period }}", + "subtitle" : "Gert access to all our educational content trusted by thousands of parents", + "title" : "Ignite your child's curiosity" + } + }, + "template_name" : "multi_package_bold" + } }, { "description" : "Coins",