From 27beca502b2cf97ede117655e286651d25537b67 Mon Sep 17 00:00:00 2001 From: Laurent Date: Wed, 8 May 2024 14:07:50 +0200 Subject: [PATCH] Renames call as summons --- PadelClub/Data/AppSettings.swift | 2 +- PadelClub/Data/User.swift | 20 ++++++------- PadelClub/Utils/ContactManager.swift | 14 ++++----- .../CallMessageCustomizationView.swift | 30 +++++++++---------- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/PadelClub/Data/AppSettings.swift b/PadelClub/Data/AppSettings.swift index e2a6426..9991be5 100644 --- a/PadelClub/Data/AppSettings.swift +++ b/PadelClub/Data/AppSettings.swift @@ -43,7 +43,7 @@ class AppSettings: MicroStorable { enum CodingKeys: String, CodingKey { case _lastDataSource = "lastDataSource" case _callMessageBody = "callMessageBody" - case _callMessageSignature = "callMessageSignature" + case _callMessageSignature = "summonsMessageSignature" case _callDisplayFormat = "callDisplayFormat" case _callDisplayEntryFee = "callDisplayEntryFee" case _callUseFullCustomMessage = "callUseFullCustomMessage" diff --git a/PadelClub/Data/User.swift b/PadelClub/Data/User.swift index c3dfa46..65b2d85 100644 --- a/PadelClub/Data/User.swift +++ b/PadelClub/Data/User.swift @@ -32,11 +32,11 @@ class User: UserBase, Storable { var phone: String? var country: String? - var callMessageBody : String? = nil - var callMessageSignature: String? = nil - var callDisplayFormat: Bool = false - var callDisplayEntryFee: Bool = false - var callUseFullCustomMessage: Bool = false + var summonsMessageBody : String? = nil + var summonsMessageSignature: String? = nil + var summonsDisplayFormat: Bool = false + var summonsDisplayEntryFee: Bool = false + var summonsUseFullCustomMessage: Bool = false var matchFormatsDefaultDuration: [MatchFormat: Int]? = nil var bracketMatchFormatPreference: MatchFormat? var groupStageMatchFormatPreference: MatchFormat? @@ -103,11 +103,11 @@ class User: UserBase, Storable { case _lastName = "lastName" case _phone = "phone" case _country = "country" - case _callMessageBody = "callMessageBody" - case _callMessageSignature = "callMessageSignature" - case _callDisplayFormat = "callDisplayFormat" - case _callDisplayEntryFee = "callDisplayEntryFee" - case _callUseFullCustomMessage = "callUseFullCustomMessage" + case _summonsMessageBody = "summonsMessageBody" + case _summonsMessageSignature = "summonsMessageSignature" + case _summonsDisplayFormat = "summonsDisplayFormat" + case _summonsDisplayEntryFee = "summonsDisplayEntryFee" + case _summonsUseFullCustomMessage = "summonsUseFullCustomMessage" case _matchFormatsDefaultDuration = "matchFormatsDefaultDuration" case _bracketMatchFormatPreference = "bracketMatchFormatPreference" case _groupStageMatchFormatPreference = "groupStageMatchFormatPreference" diff --git a/PadelClub/Utils/ContactManager.swift b/PadelClub/Utils/ContactManager.swift index 8bfd478..d319183 100644 --- a/PadelClub/Utils/ContactManager.swift +++ b/PadelClub/Utils/ContactManager.swift @@ -34,7 +34,7 @@ extension ContactType { static let defaultSignature = "" static func callingGroupStageCustomMessage(tournament: Tournament?, startDate: Date?, roundLabel: String) -> String { - let tournamentCustomMessage = DataStore.shared.user.callMessageBody ?? defaultCustomMessage + let tournamentCustomMessage = DataStore.shared.user.summonsMessageBody ?? defaultCustomMessage let clubName = tournament?.clubName ?? "" var text = tournamentCustomMessage @@ -49,7 +49,7 @@ extension ContactType { text = text.replacingOccurrences(of: "#jour", with: "\(date.formatted(Date.FormatStyle().weekday(.wide).day().month(.wide)))") text = text.replacingOccurrences(of: "#horaire", with: "\(date.formatted(Date.FormatStyle().hour().minute()))") - let signature = DataStore.shared.user.callMessageSignature ?? defaultSignature + let signature = DataStore.shared.user.summonsMessageSignature ?? defaultSignature text = text.replacingOccurrences(of: "#signature", with: signature) return text @@ -57,7 +57,7 @@ extension ContactType { static func callingGroupStageMessage(tournament: Tournament?, startDate: Date?, roundLabel: String, matchFormat: MatchFormat?) -> String { - let useFullCustomMessage = DataStore.shared.user.callUseFullCustomMessage + let useFullCustomMessage = DataStore.shared.user.summonsUseFullCustomMessage if useFullCustomMessage { return callingGroupStageCustomMessage(tournament: tournament, startDate: startDate, roundLabel: roundLabel) @@ -66,17 +66,17 @@ extension ContactType { let date = startDate ?? tournament?.startDate ?? Date() let clubName = tournament?.clubName ?? "" - let message = DataStore.shared.user.callMessageBody ?? defaultCustomMessage - let signature = DataStore.shared.user.callMessageSignature ?? defaultSignature + let message = DataStore.shared.user.summonsMessageBody ?? defaultCustomMessage + let signature = DataStore.shared.user.summonsMessageSignature ?? defaultSignature let localizedCalled = "convoqué" + (tournament?.tournamentCategory == .women ? "e" : "") + "s" var formatMessage: String? { - (DataStore.shared.user.callDisplayFormat) ? matchFormat?.computedLongLabel.appending(".") : nil + (DataStore.shared.user.summonsDisplayFormat) ? matchFormat?.computedLongLabel.appending(".") : nil } var entryFeeMessage: String? { - (DataStore.shared.user.callDisplayEntryFee) ? tournament?.entryFeeMessage : nil + (DataStore.shared.user.summonsDisplayEntryFee) ? tournament?.entryFeeMessage : nil } var computedMessage: String { diff --git a/PadelClub/Views/Calling/CallMessageCustomizationView.swift b/PadelClub/Views/Calling/CallMessageCustomizationView.swift index a803f93..b2eaacd 100644 --- a/PadelClub/Views/Calling/CallMessageCustomizationView.swift +++ b/PadelClub/Views/Calling/CallMessageCustomizationView.swift @@ -19,8 +19,8 @@ struct CallMessageCustomizationView: View { init(tournament: Tournament) { self.tournament = tournament - _customCallMessageBody = State(wrappedValue: DataStore.shared.user.callMessageBody ?? "") - _customCallMessageSignature = State(wrappedValue: DataStore.shared.user.callMessageSignature ?? "") + _customCallMessageBody = State(wrappedValue: DataStore.shared.user.summonsMessageBody ?? "") + _customCallMessageSignature = State(wrappedValue: DataStore.shared.user.summonsMessageSignature ?? "") _customClubName = State(wrappedValue: tournament.clubName ?? "") } @@ -29,11 +29,11 @@ struct CallMessageCustomizationView: View { } var formatMessage: String? { - dataStore.user.callDisplayFormat ? tournament.matchFormat.computedLongLabel + "." : nil + dataStore.user.summonsDisplayFormat ? tournament.matchFormat.computedLongLabel + "." : nil } var entryFeeMessage: String? { - dataStore.user.callDisplayEntryFee ? tournament.entryFeeMessage : nil + dataStore.user.summonsDisplayEntryFee ? tournament.entryFeeMessage : nil } var computedMessage: String { @@ -74,7 +74,7 @@ struct CallMessageCustomizationView: View { _clubNameView() Section { - if user.callUseFullCustomMessage { + if user.summonsUseFullCustomMessage { Text(self.computedFullCustomMessage()) .contextMenu { Button("Coller dans le presse-papier") { @@ -96,7 +96,7 @@ struct CallMessageCustomizationView: View { Section { LabeledContent { - Toggle(isOn: $user.callUseFullCustomMessage) { + Toggle(isOn: $user.summonsUseFullCustomMessage) { } } label: { @@ -112,13 +112,13 @@ struct CallMessageCustomizationView: View { .toolbar { ToolbarItem(placement: .topBarTrailing) { Menu { - Picker(selection: $user.callDisplayFormat) { + Picker(selection: $user.summonsDisplayFormat) { Text("Afficher le format").tag(true) Text("Masquer le format").tag(false) } label: { } - Picker(selection: $user.callDisplayEntryFee) { + Picker(selection: $user.summonsDisplayEntryFee) { Text("Afficher le prix d'inscription").tag(true) Text("Masquer le prix d'inscription").tag(false) } label: { @@ -139,24 +139,24 @@ struct CallMessageCustomizationView: View { } } } - .onChange(of: user.callUseFullCustomMessage) { - if user.callUseFullCustomMessage == false { - user.callMessageBody = ContactType.defaultCustomMessage + .onChange(of: user.summonsUseFullCustomMessage) { + if user.summonsUseFullCustomMessage == false { + user.summonsMessageBody = ContactType.defaultCustomMessage } _save() } .onChange(of: customCallMessageBody) { - user.callMessageBody = customCallMessageBody + user.summonsMessageBody = customCallMessageBody _save() } .onChange(of: customCallMessageSignature) { - user.callMessageSignature = customCallMessageSignature + user.summonsMessageSignature = customCallMessageSignature _save() } - .onChange(of: user.callDisplayEntryFee) { + .onChange(of: user.summonsDisplayEntryFee) { _save() } - .onChange(of: user.callDisplayFormat) { + .onChange(of: user.summonsDisplayFormat) { _save() } }