From 3d9658d41b5dbea5177f3704a10922ebb912ccaf Mon Sep 17 00:00:00 2001 From: Laurent Date: Tue, 29 Apr 2025 17:51:53 +0200 Subject: [PATCH 1/3] Adds purchase refresh when opening app --- PadelClub/AppDelegate.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PadelClub/AppDelegate.swift b/PadelClub/AppDelegate.swift index a678151..f48fff5 100644 --- a/PadelClub/AppDelegate.swift +++ b/PadelClub/AppDelegate.swift @@ -22,6 +22,10 @@ class AppDelegate : NSObject, UIApplicationDelegate, UNUserNotificationCenterDel return true } + + func applicationWillEnterForeground(_ application: UIApplication) { + Guard.main.refreshPurchasedAppleProducts() + } // MARK: - Remote Notifications From 937edb440b48c76a57fc886c9143dccb15c216d4 Mon Sep 17 00:00:00 2001 From: Laurent Date: Tue, 29 Apr 2025 18:47:48 +0200 Subject: [PATCH 2/3] fix build --- PadelClub/AppDelegate.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PadelClub/AppDelegate.swift b/PadelClub/AppDelegate.swift index f48fff5..6381247 100644 --- a/PadelClub/AppDelegate.swift +++ b/PadelClub/AppDelegate.swift @@ -24,7 +24,9 @@ class AppDelegate : NSObject, UIApplicationDelegate, UNUserNotificationCenterDel } func applicationWillEnterForeground(_ application: UIApplication) { - Guard.main.refreshPurchasedAppleProducts() + Task { + try await Guard.main.refreshPurchasedAppleProducts() + } } // MARK: - Remote Notifications From 4663f321028a216511581bd87b9defe4db73a434 Mon Sep 17 00:00:00 2001 From: Laurent Date: Tue, 29 Apr 2025 19:19:28 +0200 Subject: [PATCH 3/3] fix --- .../Views/Planning/PlanningSettingsView.swift | 2 +- .../Subscription/PaymentStatusView.swift | 42 +++++-------------- 2 files changed, 11 insertions(+), 33 deletions(-) diff --git a/PadelClub/Views/Planning/PlanningSettingsView.swift b/PadelClub/Views/Planning/PlanningSettingsView.swift index a600e66..2ced50d 100644 --- a/PadelClub/Views/Planning/PlanningSettingsView.swift +++ b/PadelClub/Views/Planning/PlanningSettingsView.swift @@ -48,7 +48,7 @@ struct PlanningSettingsView: View { var body: some View { List { if tournament.payment == nil { - ImageInfoView() + PaymentStatusView() // SubscriptionInfoView() } diff --git a/PadelClub/Views/Tournament/Subscription/PaymentStatusView.swift b/PadelClub/Views/Tournament/Subscription/PaymentStatusView.swift index 9a59492..3e141e7 100644 --- a/PadelClub/Views/Tournament/Subscription/PaymentStatusView.swift +++ b/PadelClub/Views/Tournament/Subscription/PaymentStatusView.swift @@ -14,39 +14,20 @@ struct ImageInfoView: View { @State var text: String = "" @State var textColor: Color = .black @State var backgroundColor: Color = .blue.opacity(0.2) - - @State var textOnTap: String? = nil - + @State var showPopover: Bool = false var tip: (any Tip)? = nil var body: some View { - Group { - if #available(iOS 18.4, *) { - HStack { - Image(systemName: self.systemImage) - .font(.title) - .foregroundStyle(.white) - Text(self.text) - .foregroundStyle(self.textColor) - .fontWeight(.semibold) - .frame(maxWidth: .infinity) - }.popoverTip(self.tip) - } else { - HStack { - Image(systemName: self.systemImage) - .font(.title) - .foregroundStyle(.white) - Text(self.text) - .fontWeight(.semibold) - .frame(maxWidth: .infinity) - }.onTapGesture { - if self.tip != nil { - self.showPopover = true - } - } - } + HStack { + Image(systemName: self.systemImage) + .font(.title) + .foregroundStyle(.white) + Text(self.text) + .foregroundStyle(self.textColor) + .fontWeight(.semibold) + .frame(maxWidth: .infinity) } .alert("Message", isPresented: self.$showPopover, actions: { }, message: { if let tip { @@ -58,8 +39,7 @@ struct ImageInfoView: View { .frame(maxWidth: .infinity) .padding() .background(self.backgroundColor) - - .listRowInsets(EdgeInsets()) // Remove default insets + .listRowInsets(EdgeInsets()) } } @@ -76,10 +56,8 @@ struct PaymentStatusView: View { let end = remaining > 1 ? "s" : "" let text = "Tournoi offert (\(remaining) restant\(end))" ImageInfoView(systemImage: "gift.fill", text: text, tip: FreeTournamentTip()) -// TipView(FreeTournamentTip()).tipStyle(tint: nil, background: .blue.opacity(0.2)) case nil: ImageInfoView(systemImage: "exclamationmark.bubble.fill", text: "Veuillez souscrire à une offre pour convoquer ou entrer un résultat", textColor: .white, backgroundColor: .logoRed, tip: NoPaymentTip()) -// TipView(NoPaymentTip()).tipStyle(tint: nil, background: .logoRed) default: EmptyView() }