Skip to content

Commit

Permalink
Revert "Always call readyForPromotedProduct on the main actor"
Browse files Browse the repository at this point in the history
  • Loading branch information
fire-at-will authored Dec 16, 2024
1 parent 7a425d8 commit 838eb1c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
8 changes: 1 addition & 7 deletions Sources/Purchasing/Purchases/Purchases.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1597,13 +1597,7 @@ extension Purchases: PurchasesOrchestratorDelegate {
*/
func readyForPromotedProduct(_ product: StoreProduct,
purchase startPurchase: @escaping StartPurchaseBlock) {
OperationDispatcher.dispatchOnMainActor {
self.delegate?.purchases?(
self,
readyForPromotedProduct: product,
purchase: startPurchase
)
}
self.delegate?.purchases?(self, readyForPromotedProduct: product, purchase: startPurchase)
}

#if os(iOS) || targetEnvironment(macCatalyst) || VISION_OS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ class PurchaseDeferredPurchasesTests: BasePurchasesTests {
shouldAddStorePayment: payment,
for: self.product)

waitUntil { completed in
if self.purchasesDelegate.makeDeferredPurchase != nil {
completed()
}
}

expect(self.purchasesDelegate.makeDeferredPurchase).toNot(beNil())
expect(self.storeKit1Wrapper.payment).to(beNil())

Expand All @@ -65,12 +59,6 @@ class PurchaseDeferredPurchasesTests: BasePurchasesTests {
shouldAddStorePayment: payment,
for: self.product)

waitUntil { completed in
if self.purchasesDelegate.makeDeferredPurchase != nil {
completed()
}
}

expect(self.purchasesDelegate.makeDeferredPurchase).toNot(beNil())
expect(self.storeKit1Wrapper.payment).to(beNil())

Expand Down Expand Up @@ -99,7 +87,7 @@ class PurchaseDeferredPurchasesTests: BasePurchasesTests {
shouldAddStorePayment: payment,
for: self.product)

expect(self.purchasesDelegate.promoProduct).toEventually(equal(StoreProduct(sk1Product: self.product)))
expect(self.purchasesDelegate.promoProduct) == StoreProduct(sk1Product: self.product)
}

func testShouldAddStorePaymentReturnsFalseForNilProductIdentifier() throws {
Expand Down Expand Up @@ -189,9 +177,10 @@ class PurchaseDeferredPurchasesSK2Tests: BasePurchasesTests {
for: self.product
)

expect(self.purchasesDelegate.makeDeferredPurchase).toEventuallyNot(beNil())
expect(self.purchasesDelegate.promoProduct).toEventually(equal(StoreProduct(sk1Product: self.product)))
expect(self.purchasesDelegate.makeDeferredPurchase).toEventuallyNot(beNil())
expect(self.purchasesDelegate.makeDeferredPurchase).toNot(beNil())

expect(self.purchasesDelegate.promoProduct) == StoreProduct(sk1Product: self.product)
expect(self.purchasesDelegate.makeDeferredPurchase).toNot(beNil())
}

}

0 comments on commit 838eb1c

Please sign in to comment.