From e221813fba7d2faba5fdbc7d7e34fe7d88d40476 Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Wed, 15 May 2024 09:48:29 +0200 Subject: [PATCH] add french loc fix minor stuff add publish option (swift only) --- PadelClub.xcodeproj/project.pbxproj | 26 +++++++++ PadelClub/Data/Tournament.swift | 21 +++++++- .../Localization/en.lproj/Localizable.strings | 7 +++ .../Localization/fr.lproj/Localizable.strings | 7 +++ PadelClub/Utils/Tips.swift | 30 +++++++++++ PadelClub/Utils/URLs.swift | 1 + PadelClub/Views/Match/MatchDetailView.swift | 3 +- .../Views/Navigation/Umpire/UmpireView.swift | 12 +++-- .../Tournament/Screen/BroadcastView.swift | 53 ++++++++++++++++++- .../Views/Tournament/TournamentView.swift | 6 ++- 10 files changed, 157 insertions(+), 9 deletions(-) create mode 100644 PadelClub/Localization/en.lproj/Localizable.strings create mode 100644 PadelClub/Localization/fr.lproj/Localizable.strings diff --git a/PadelClub.xcodeproj/project.pbxproj b/PadelClub.xcodeproj/project.pbxproj index a4926b2..b2adcc1 100644 --- a/PadelClub.xcodeproj/project.pbxproj +++ b/PadelClub.xcodeproj/project.pbxproj @@ -254,6 +254,7 @@ FFDB1C732BB2CFE900F1E467 /* MySortDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFDB1C722BB2CFE900F1E467 /* MySortDescriptor.swift */; }; FFDDD40C2B93B2BB00C91A49 /* DeferredViewModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFDDD40B2B93B2BB00C91A49 /* DeferredViewModifier.swift */; }; FFEF7F4E2BDE69130033D0F0 /* MenuWarningView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFEF7F4D2BDE69130033D0F0 /* MenuWarningView.swift */; }; + FFF0241E2BF48B15001F14B4 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = FFF0241D2BF48B15001F14B4 /* Localizable.strings */; }; FFF03C942BD91D0C00B516FC /* ButtonValidateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFF03C932BD91D0C00B516FC /* ButtonValidateView.swift */; }; FFF116E12BD2A9B600A33B06 /* DateInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFF116E02BD2A9B600A33B06 /* DateInterval.swift */; }; FFF116E32BD2AF4800A33B06 /* CourtAvailabilitySettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFF116E22BD2AF4800A33B06 /* CourtAvailabilitySettingsView.swift */; }; @@ -553,6 +554,8 @@ FFDB1C722BB2CFE900F1E467 /* MySortDescriptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MySortDescriptor.swift; sourceTree = ""; }; FFDDD40B2B93B2BB00C91A49 /* DeferredViewModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeferredViewModifier.swift; sourceTree = ""; }; FFEF7F4D2BDE69130033D0F0 /* MenuWarningView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuWarningView.swift; sourceTree = ""; }; + FFF0241C2BF48B15001F14B4 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = ""; }; + FFF0241F2BF48B1A001F14B4 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; FFF03C932BD91D0C00B516FC /* ButtonValidateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonValidateView.swift; sourceTree = ""; }; FFF116E02BD2A9B600A33B06 /* DateInterval.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateInterval.swift; sourceTree = ""; }; FFF116E22BD2AF4800A33B06 /* CourtAvailabilitySettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourtAvailabilitySettingsView.swift; sourceTree = ""; }; @@ -633,6 +636,7 @@ FFF8ACD02B9238A2008466FA /* Utils */, FFF8ACD72B923F26008466FA /* Extensions */, C425D4042B6D249E002A7B48 /* Assets.xcassets */, + FFF024192BF48AEE001F14B4 /* Localization */, FF0EC54D2BB195CA0056B6D1 /* CSV */, C425D4062B6D249E002A7B48 /* Preview Content */, ); @@ -1195,6 +1199,14 @@ path = Components; sourceTree = ""; }; + FFF024192BF48AEE001F14B4 /* Localization */ = { + isa = PBXGroup; + children = ( + FFF0241D2BF48B15001F14B4 /* Localizable.strings */, + ); + path = Localization; + sourceTree = ""; + }; FFF8ACD02B9238A2008466FA /* Utils */ = { isa = PBXGroup; children = ( @@ -1342,6 +1354,7 @@ knownRegions = ( en, Base, + fr, ); mainGroup = C425D3F42B6D249D002A7B48; packageReferences = ( @@ -1373,6 +1386,7 @@ FF0EC5532BB195E20056B6D1 /* CLASSEMENT-PADEL-MESSIEURS-2-09-2022.csv in Resources */, FF0EC5542BB195E20056B6D1 /* CLASSEMENT-PADEL-MESSIEURS-2-04-2023.csv in Resources */, FF0EC5552BB195E20056B6D1 /* CLASSEMENT PADEL MESSIEURS_2-08-2023.csv in Resources */, + FFF0241E2BF48B15001F14B4 /* Localizable.strings in Resources */, FF0EC5562BB195E20056B6D1 /* CLASSEMENT-PADEL-MESSIEURS-2-10-2022.csv in Resources */, FF0EC5572BB195E20056B6D1 /* CLASSEMENT-PADEL-DAMES-10-2022.csv in Resources */, FF0EC5582BB195E20056B6D1 /* CLASSEMENT-PADEL-MESSIEURS-3-05-2023.csv in Resources */, @@ -1678,6 +1692,18 @@ }; /* End PBXTargetDependency section */ +/* Begin PBXVariantGroup section */ + FFF0241D2BF48B15001F14B4 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + FFF0241C2BF48B15001F14B4 /* fr */, + FFF0241F2BF48B1A001F14B4 /* en */, + ); + name = Localizable.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ C425D41F2B6D249E002A7B48 /* Debug */ = { isa = XCBuildConfiguration; diff --git a/PadelClub/Data/Tournament.swift b/PadelClub/Data/Tournament.swift index 29262c3..02ef416 100644 --- a/PadelClub/Data/Tournament.swift +++ b/PadelClub/Data/Tournament.swift @@ -44,6 +44,12 @@ class Tournament : ModelObject, Storable { var additionalEstimationDuration: Int = 0 var isDeleted: Bool = false var isCanceled: Bool = false + var publishManually: Bool = false + var publishTeams: Bool = false + var publishWaitingList: Bool = false + var publishSummons: Bool = false + var publishGroupStages: Bool = false + var publishBrackets: Bool = false @ObservationIgnored var navigationPath: [Screen] = [] @@ -82,9 +88,15 @@ class Tournament : ModelObject, Storable { case _isDeleted = "isDeleted" case _isCanceled = "localId" case _payment = "globalId" + case _publishManually = "publishManually" + case _publishTeams = "publishTeams" + case _publishWaitingList = "publishWaitingList" + case _publishSummons = "publishSummons" + case _publishGroupStages = "publishGroupStages" + case _publishBrackets = "publishBrackets" } - internal init(event: String? = nil, name: String? = nil, startDate: Date = Date(), endDate: Date? = nil, creationDate: Date = Date(), isPrivate: Bool = true, groupStageFormat: MatchFormat? = nil, roundFormat: MatchFormat? = nil, loserRoundFormat: MatchFormat? = nil, groupStageSortMode: GroupStageOrderingMode, groupStageCount: Int = 4, rankSourceDate: Date? = nil, dayDuration: Int = 1, teamCount: Int = 24, teamSorting: TeamSortingType? = nil, federalCategory: TournamentCategory, federalLevelCategory: TournamentLevel, federalAgeCategory: FederalTournamentAge, groupStageCourtCount: Int? = nil, closedRegistrationDate: Date? = nil, groupStageAdditionalQualified: Int = 0, courtCount: Int = 2, prioritizeClubMembers: Bool = false, qualifiedPerGroupStage: Int = 1, teamsPerGroupStage: Int = 4, entryFee: Double? = nil, additionalEstimationDuration: Int = 0, isDeleted: Bool = false) { + internal init(event: String? = nil, name: String? = nil, startDate: Date = Date(), endDate: Date? = nil, creationDate: Date = Date(), isPrivate: Bool = true, groupStageFormat: MatchFormat? = nil, roundFormat: MatchFormat? = nil, loserRoundFormat: MatchFormat? = nil, groupStageSortMode: GroupStageOrderingMode, groupStageCount: Int = 4, rankSourceDate: Date? = nil, dayDuration: Int = 1, teamCount: Int = 24, teamSorting: TeamSortingType? = nil, federalCategory: TournamentCategory, federalLevelCategory: TournamentLevel, federalAgeCategory: FederalTournamentAge, groupStageCourtCount: Int? = nil, closedRegistrationDate: Date? = nil, groupStageAdditionalQualified: Int = 0, courtCount: Int = 2, prioritizeClubMembers: Bool = false, qualifiedPerGroupStage: Int = 1, teamsPerGroupStage: Int = 4, entryFee: Double? = nil, additionalEstimationDuration: Int = 0, isDeleted: Bool = false, publishManually: Bool = false, publishTeams: Bool = false, publishWaitingList: Bool = false, publishSummons: Bool = false, publishGroupStages: Bool = false, publishBrackets: Bool = false) { self.event = event self.name = name self.startDate = startDate @@ -148,6 +160,13 @@ class Tournament : ModelObject, Storable { additionalEstimationDuration = try container.decode(Int.self, forKey: ._additionalEstimationDuration) isDeleted = try container.decode(Bool.self, forKey: ._isDeleted) isCanceled = try Tournament._decodeCanceled(container: container) + publishManually = try container.decodeIfPresent(Bool.self, forKey: ._publishManually) ?? false + publishTeams = try container.decodeIfPresent(Bool.self, forKey: ._publishTeams) ?? false + publishWaitingList = try container.decodeIfPresent(Bool.self, forKey: ._publishWaitingList) ?? false + publishSummons = try container.decodeIfPresent(Bool.self, forKey: ._publishSummons) ?? false + publishGroupStages = try container.decodeIfPresent(Bool.self, forKey: ._publishGroupStages) ?? false + publishBrackets = try container.decodeIfPresent(Bool.self, forKey: ._publishBrackets) ?? false + } fileprivate static let _numberFormatter: NumberFormatter = NumberFormatter() diff --git a/PadelClub/Localization/en.lproj/Localizable.strings b/PadelClub/Localization/en.lproj/Localizable.strings new file mode 100644 index 0000000..f23b6d8 --- /dev/null +++ b/PadelClub/Localization/en.lproj/Localizable.strings @@ -0,0 +1,7 @@ +/* + Localizable.strings + Padel Tournament + + Created by razmig on 06/04/2023. + +*/ diff --git a/PadelClub/Localization/fr.lproj/Localizable.strings b/PadelClub/Localization/fr.lproj/Localizable.strings new file mode 100644 index 0000000..f23b6d8 --- /dev/null +++ b/PadelClub/Localization/fr.lproj/Localizable.strings @@ -0,0 +1,7 @@ +/* + Localizable.strings + Padel Tournament + + Created by razmig on 06/04/2023. + +*/ diff --git a/PadelClub/Utils/Tips.swift b/PadelClub/Utils/Tips.swift index 34cd474..2dc9503 100644 --- a/PadelClub/Utils/Tips.swift +++ b/PadelClub/Utils/Tips.swift @@ -334,6 +334,36 @@ struct NotFoundAreWalkOutTip: Tip { } } +struct TournamentPublishingTip: Tip { + var title: Text { + Text("Gestion de la publication") + } + + var message: Text? { + let messageString = "Padel Club vous permet de publier votre tournoi et rendre accessible à tous les résultats des matchs et l'évolution de l'événement. Les informations seront accessible sur le site [Padel Club](\(URLs.padelClub))." + return Text(.init(messageString)) + } + + var image: Image? { + Image("PadelClub_logo_fondclair_transparent") + } +} + +struct TournamentTVBroadcastTip: Tip { + var title: Text { + Text("Lien TV") + } + + var message: Text? { + return Text("Padel Club vous propose un site spéficique à utiliser sur les écrans de votre club, présentant de manière intelligente l'évolution de votre tournoi.") + } + + var image: Image? { + Image(systemName: "sparkles.tv") + } +} + + struct TipStyleModifier: ViewModifier { @Environment(\.colorScheme) var colorScheme var tint: Color? diff --git a/PadelClub/Utils/URLs.swift b/PadelClub/Utils/URLs.swift index 51d4b4f..a54c678 100644 --- a/PadelClub/Utils/URLs.swift +++ b/PadelClub/Utils/URLs.swift @@ -11,6 +11,7 @@ enum URLs: String, Identifiable { case subscriptions = "https://apple.co/2Th4vqI" case main = "https://xlr.alwaysdata.net/" case beachPadel = "https://beach-padel.app.fft.fr/beachja/index/" + case padelClub = "https://padelclub.app" var id: String { return self.rawValue } diff --git a/PadelClub/Views/Match/MatchDetailView.swift b/PadelClub/Views/Match/MatchDetailView.swift index d467e89..f9598e2 100644 --- a/PadelClub/Views/Match/MatchDetailView.swift +++ b/PadelClub/Views/Match/MatchDetailView.swift @@ -373,7 +373,8 @@ struct MatchDetailView: View { } } - shareView + //todo + //shareView // if let followUpMatch = match.followUpMatch { // Section { diff --git a/PadelClub/Views/Navigation/Umpire/UmpireView.swift b/PadelClub/Views/Navigation/Umpire/UmpireView.swift index 5bac23e..0e729d3 100644 --- a/PadelClub/Views/Navigation/Umpire/UmpireView.swift +++ b/PadelClub/Views/Navigation/Umpire/UmpireView.swift @@ -51,11 +51,13 @@ struct UmpireView: View { let currentPlayerData = dataStore.user.currentPlayerData() Section { if let currentPlayerData { - NavigationLink { - - } label: { - ImportedPlayerView(player: currentPlayerData) - } + //todo palmares + ImportedPlayerView(player: currentPlayerData) +// NavigationLink { +// +// } label: { +// ImportedPlayerView(player: currentPlayerData) +// } } else { RowButtonView("Ma fiche joueur", systemImage: "person.bust") { presentSearchView = true diff --git a/PadelClub/Views/Tournament/Screen/BroadcastView.swift b/PadelClub/Views/Tournament/Screen/BroadcastView.swift index 286b90b..abc750d 100644 --- a/PadelClub/Views/Tournament/Screen/BroadcastView.swift +++ b/PadelClub/Views/Tournament/Screen/BroadcastView.swift @@ -8,6 +8,7 @@ import SwiftUI import CoreImage.CIFilterBuiltins import LeStorage +import TipKit extension String : Identifiable { public var id: String { self } @@ -21,9 +22,58 @@ struct BroadcastView: View { @State private var urlToShow: String? @State private var tvMode: Bool = false + let tournamentPublishingTip = TournamentPublishingTip() + let tournamentTVBroadcastTip = TournamentTVBroadcastTip() + var body: some View { @Bindable var tournament = tournament List { + TipView(tournamentPublishingTip) + .tipStyle(tint: nil) + TipView(tournamentTVBroadcastTip) + .tipStyle(tint: nil) + + if tournament.publishManually == false { + Section { + Text("En mode automatique, Padel Club détermine le meilleur moment pour publier les informations du tournoi.\n\n• La liste des équipes sera visible au maximum 2 jours après la clôture des inscriptions. À partir des p500, la liste d'attente à la clôture sera également publiée.\n\n• Les convocations ne seront visibles qu'à partir du premier jour du tournoi.\n\n• Les poules ne seront visibles qu'au premier jour des poules.\n\n• Le tableau ne sera visible qu'au premier jour du tableau.") + } header: { + Text("Mode Automatique") + } footer: { + FooterButtonView("désactiver le mode automatique") { + tournament.publishManually.toggle() + } + } + } + + if tournament.publishManually == true { + Section { + Text("En mode manuel, vous devez indiquer à Padel Club le moment où vous souhaitez publier les informations du tournoi") + + Toggle(isOn: $tournament.publishTeams) { + Text("Publier la liste des équipes") + Text("Les horaires de convocations ne seront pas publiés") + } + Toggle(isOn: $tournament.publishWaitingList) { + Text("Inclure les équipes en liste d'attente") + } + Toggle(isOn: $tournament.publishSummons) { + Text("Publier les convocations") + } + Toggle(isOn: $tournament.publishGroupStages) { + Text("Publier les poules") + } + Toggle(isOn: $tournament.publishBrackets) { + Text("Publier le tableau") + } + } header: { + Text("Mode Manuel") + } footer: { + FooterButtonView("activer le mode automatique") { + tournament.publishManually.toggle() + } + } + } + Section { Toggle(isOn: $tournament.isPrivate) { Text("Tournoi privé") @@ -69,7 +119,8 @@ struct BroadcastView: View { } } - .navigationTitle("Diffusion") + .headerProminence(.increased) + .navigationTitle("Publication") .navigationBarTitleDisplayMode(.inline) .toolbarBackground(.visible, for: .navigationBar) .sheet(item: $urlToShow) { urlToShow in diff --git a/PadelClub/Views/Tournament/TournamentView.swift b/PadelClub/Views/Tournament/TournamentView.swift index d1299c7..544d276 100644 --- a/PadelClub/Views/Tournament/TournamentView.swift +++ b/PadelClub/Views/Tournament/TournamentView.swift @@ -74,7 +74,11 @@ struct TournamentView: View { TournamentInitView() NavigationLink(value: Screen.broadcast) { - Text("Diffusion") + LabeledContent { + Text(tournament.publishManually ? "manuel" : "auto.") + } label: { + Text("Publication") + } } case .build: