diff --git a/Sources/Purchasing/Purchases/Purchases.swift b/Sources/Purchasing/Purchases/Purchases.swift index 8582d24517..18cea3e8a8 100644 --- a/Sources/Purchasing/Purchases/Purchases.swift +++ b/Sources/Purchasing/Purchases/Purchases.swift @@ -1611,21 +1611,26 @@ 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: Set = .init( - 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: Set = .init( + 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 8a36af032a..e6e848f309 100644 --- a/Sources/Support/FrameworkDisambiguation.swift +++ b/Sources/Support/FrameworkDisambiguation.swift @@ -23,6 +23,7 @@ typealias RCRefundRequestStatus = RefundRequestStatus typealias RCErrorCode = ErrorCode +typealias RCOffering = Offering typealias RCStorefront = Storefront let RCDefaultLogHandler = defaultLogHandler