From e95066913227fe73f5f95c58dba69576225cf85f Mon Sep 17 00:00:00 2001 From: Laurent Date: Fri, 20 Sep 2024 11:12:50 +0200 Subject: [PATCH 1/2] Improve fi --- PadelClub/Data/Tournament.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PadelClub/Data/Tournament.swift b/PadelClub/Data/Tournament.swift index 94a57d8..cab2239 100644 --- a/PadelClub/Data/Tournament.swift +++ b/PadelClub/Data/Tournament.swift @@ -353,19 +353,19 @@ final class Tournament : ModelObject, Storable { override func deleteDependencies() throws { let store = self.tournamentStore - let teams = Array(self.tournamentStore.teamRegistrations) + let teams = self.tournamentStore.teamRegistrations for team in teams { try team.deleteDependencies() } store.teamRegistrations.deleteDependencies(teams) - let groups = Array(self.tournamentStore.groupStages) + let groups = self.tournamentStore.groupStages for group in groups { try group.deleteDependencies() } store.groupStages.deleteDependencies(groups) - let rounds = Array(self.tournamentStore.rounds) + let rounds = self.tournamentStore.rounds for round in rounds { try round.deleteDependencies() } From be89a1bda06facbd2aafc5da79adeaa236437668 Mon Sep 17 00:00:00 2001 From: Laurent Date: Fri, 20 Sep 2024 11:34:16 +0200 Subject: [PATCH 2/2] now accepts purchase without appAccountToken --- PadelClub/Views/Navigation/Umpire/UmpireView.swift | 10 +++++++--- PadelClub/Views/Tournament/Subscription/Guard.swift | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/PadelClub/Views/Navigation/Umpire/UmpireView.swift b/PadelClub/Views/Navigation/Umpire/UmpireView.swift index 5345e4f..347c4ba 100644 --- a/PadelClub/Views/Navigation/Umpire/UmpireView.swift +++ b/PadelClub/Views/Navigation/Umpire/UmpireView.swift @@ -271,10 +271,14 @@ struct ProductIdsView: View { List { LabeledContent("count", value: String(self.transactions.count)) ForEach(self.transactions) { transaction in - if let offerType = transaction.offerType?.rawValue { - LabeledContent(transaction.productID, value: "\(offerType)") + if #available(iOS 17.2, *) { + if let offer = transaction.offer { + LabeledContent(transaction.productID, value: "\(offer.type)") + } else { + LabeledContent(transaction.productID, value: "no offer") + } } else { - LabeledContent(transaction.productID, value: "no offer") + Text("need ios 17.2") } } }.onAppear { diff --git a/PadelClub/Views/Tournament/Subscription/Guard.swift b/PadelClub/Views/Tournament/Subscription/Guard.swift index 49ba138..0ad429a 100644 --- a/PadelClub/Views/Tournament/Subscription/Guard.swift +++ b/PadelClub/Views/Tournament/Subscription/Guard.swift @@ -195,7 +195,7 @@ import LeStorage return [] } - let userTransactions = self.purchasedTransactions.filter { currentUserUUID == $0.appAccountToken || $0.offerType == .code } + let userTransactions = self.purchasedTransactions.filter { currentUserUUID == $0.appAccountToken || $0.appAccountToken == nil } let now: Date = Date() // print("now = \(now)")