From e4dd5077bf579eb1d2d351b46ae3c02b937acb32 Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Thu, 20 Jun 2024 10:13:45 +0200 Subject: [PATCH] support email button --- PadelClub.xcodeproj/project.pbxproj | 4 ++-- PadelClub/PadelClubApp.swift | 5 +++++ PadelClub/Views/Calling/CallView.swift | 2 +- PadelClub/Views/GroupStage/GroupStagesView.swift | 5 ----- PadelClub/Views/Navigation/Agenda/ActivityView.swift | 4 +++- PadelClub/Views/Navigation/Toolbox/ToolboxView.swift | 5 +++-- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/PadelClub.xcodeproj/project.pbxproj b/PadelClub.xcodeproj/project.pbxproj index f5c3bdf..fdf44ce 100644 --- a/PadelClub.xcodeproj/project.pbxproj +++ b/PadelClub.xcodeproj/project.pbxproj @@ -1897,7 +1897,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 57; + CURRENT_PROJECT_VERSION = 58; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; @@ -1937,7 +1937,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 57; + CURRENT_PROJECT_VERSION = 58; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_TEAM = BQ3Y44M3Q6; diff --git a/PadelClub/PadelClubApp.swift b/PadelClub/PadelClubApp.swift index c79c829..043c4aa 100644 --- a/PadelClub/PadelClubApp.swift +++ b/PadelClub/PadelClubApp.swift @@ -53,6 +53,11 @@ struct PadelClubApp: App { UserDefaults.standard.set(false, forKey: "_UIConstraintBasedLayoutLogUnsatisfiable") } + static func openMail(emailTo: String = "support@padelclub.app", subject: String = "Support Padel Club") { + if let url = URL(string: "mailto:\(emailTo)?subject=\(subject)"), UIApplication.shared.canOpenURL(url) { + UIApplication.shared.open(url, options: [:], completionHandler: nil) + } + } } class AppDelegate: NSObject, UIApplicationDelegate { diff --git a/PadelClub/Views/Calling/CallView.swift b/PadelClub/Views/Calling/CallView.swift index 606e61c..7462768 100644 --- a/PadelClub/Views/Calling/CallView.swift +++ b/PadelClub/Views/Calling/CallView.swift @@ -186,7 +186,7 @@ struct CallView: View { .underline() } } else { - Button(byMessage ? "sms" : "mail") { + FooterButtonView(byMessage ? "sms" : "mail") { _summon(byMessage: byMessage, reSummon: false) } } diff --git a/PadelClub/Views/GroupStage/GroupStagesView.swift b/PadelClub/Views/GroupStage/GroupStagesView.swift index 248ce5c..7827c32 100644 --- a/PadelClub/Views/GroupStage/GroupStagesView.swift +++ b/PadelClub/Views/GroupStage/GroupStagesView.swift @@ -107,11 +107,6 @@ struct GroupStagesView: View { availableToStart = await tournament.availableToStart(allMatches, in: runningMatches ?? []) readyMatches = await tournament.readyMatches(allMatches) } - .overlay { - if availableToStart?.isEmpty == true && runningMatches?.isEmpty == true && readyMatches?.isEmpty == true && finishedMatches.isEmpty == true { - ContentUnavailableView("Aucun match à afficher", systemImage: "tennisball") - } - } .navigationTitle("Toutes les poules") case .groupStage(let groupStage): GroupStageView(groupStage: groupStage).id(groupStage.id) diff --git a/PadelClub/Views/Navigation/Agenda/ActivityView.swift b/PadelClub/Views/Navigation/Agenda/ActivityView.swift index ccc4d2d..b3fbae2 100644 --- a/PadelClub/Views/Navigation/Agenda/ActivityView.swift +++ b/PadelClub/Views/Navigation/Agenda/ActivityView.swift @@ -327,7 +327,9 @@ struct ActivityView: View { } } - SupportButtonView() + FooterButtonView("Besoin d'aide ? Un problème ? Contactez-nous !") { + PadelClubApp.openMail() + } } } diff --git a/PadelClub/Views/Navigation/Toolbox/ToolboxView.swift b/PadelClub/Views/Navigation/Toolbox/ToolboxView.swift index f8f2de4..9a9bd77 100644 --- a/PadelClub/Views/Navigation/Toolbox/ToolboxView.swift +++ b/PadelClub/Views/Navigation/Toolbox/ToolboxView.swift @@ -19,8 +19,9 @@ struct ToolboxView: View { Section { Text("Version de l'application").badge(PadelClubApp.appVersion) - } footer: { - SupportButtonView() + Button("Contactez-nous") { + PadelClubApp.openMail() + } } #if DEBUG