From 435fa59d58577abdcbc86c297a3c98f9cabcdae3 Mon Sep 17 00:00:00 2001 From: Laurent Date: Mon, 5 May 2025 16:16:24 +0200 Subject: [PATCH] Fix bug with purchases retrieved from the server --- PadelClubData/Subscriptions/Guard.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PadelClubData/Subscriptions/Guard.swift b/PadelClubData/Subscriptions/Guard.swift index 06b0aed..9c54419 100644 --- a/PadelClubData/Subscriptions/Guard.swift +++ b/PadelClubData/Subscriptions/Guard.swift @@ -48,7 +48,7 @@ import Combine } @objc func collectionDidLoad(notification: Notification) { - if let _ = notification.object as? StoredCollection { + if let _ = notification.object as? BaseCollection { self._updateBestPlan() } } @@ -189,6 +189,11 @@ import Combine } public var currentPlan: StoreItem? { + if let currentBestPurchase = self.currentBestPurchase, let plan = StoreItem(rawValue: currentBestPurchase.productId) { + return plan + } + + #if DEBUG if let plan = PListReader.readString(plist: "local", key: "plan"), !plan.isEmpty { return StoreItem(rawValue: plan)