Skip to content

Commit

Permalink
Force cast SubscriptionProduct to Product in Debug menu code
Browse files Browse the repository at this point in the history
  • Loading branch information
aataraxiaa committed Dec 6, 2024
1 parent 9316e5d commit b6cd7f0
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,16 @@ public final class DebugPurchaseViewController: NSViewController {
}

manager.$availableProducts.combineLatest(manager.$purchasedProductIDs, manager.$purchaseQueue).receive(on: RunLoop.main).sink { [weak self] availableProducts, purchasedProductIDs, purchaseQueue in

// swiftlint:disable:next force_cast
let products = availableProducts as! [Product]

print(" -- got combineLatest -")
print(" -- got combineLatest - availableProducts: \(availableProducts.map { $0.id }.joined(separator: ","))")
print(" -- got combineLatest - purchasedProducts: \(purchasedProductIDs.joined(separator: ","))")
print(" -- got combineLatest - purchaseQueue: \(purchaseQueue.joined(separator: ","))")

let sortedProducts = availableProducts.sorted(by: { $0.price > $1.price })
let sortedProducts = products.sorted(by: { $0.price > $1.price })

self?.model.subscriptions = sortedProducts.map { SubscriptionRowModel(product: $0,
isPurchased: purchasedProductIDs.contains($0.id),
Expand Down

0 comments on commit b6cd7f0

Please sign in to comment.