Skip to content

Commit 9d13f96

Browse files
committed
AdaptyUI: fix intro offers displaying
1 parent 8a3fb6d commit 9d13f96

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

AdaptyUI/Logic/AdaptyProductsViewModel.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ package class AdaptyProductsViewModel: ObservableObject {
103103
func loadProductsIfNeeded() {
104104
guard !productsLoadingInProgress else { return }
105105

106-
guard adaptyProducts != nil, introductoryOffersEligibilities == nil else {
106+
guard let adaptyProducts, introductoryOffersEligibilities == nil else {
107107
loadProducts()
108108
return
109109
}
110110

111-
loadProductsIntroductoryEligibilities()
111+
loadProductsIntroductoryEligibilities(products: adaptyProducts)
112112
}
113113

114114
func selectedProductId(by groupId: String) -> String? {
@@ -147,7 +147,7 @@ package class AdaptyProductsViewModel: ObservableObject {
147147
self?.productsLoadingInProgress = false
148148
}
149149

150-
self?.loadProductsIntroductoryEligibilities()
150+
self?.loadProductsIntroductoryEligibilities(products: products)
151151
case let .failure(error):
152152
self?.eventsHandler.log(.error, "loadProducts fail: \(error)")
153153

@@ -165,9 +165,7 @@ package class AdaptyProductsViewModel: ObservableObject {
165165
}
166166
}
167167

168-
private func loadProductsIntroductoryEligibilities() {
169-
guard let products = adaptyProducts else { return }
170-
168+
private func loadProductsIntroductoryEligibilities(products: [AdaptyPaywallProduct]) {
171169
eventsHandler.log(.verbose, "loadProductsIntroductoryEligibilities begin")
172170

173171
Adapty.getProductsIntroductoryOfferEligibility(products: products) { [weak self] result in

0 commit comments

Comments
 (0)