rename debug options

club_update
Razmig Sarkissian 1 year ago
parent 03069d9505
commit 035e1ac7cf
  1. 4
      PadelClub/Data/DataStore.swift
  2. 8
      PadelClub/Data/GroupStage.swift
  3. 8
      PadelClub/Data/Match.swift
  4. 24
      PadelClub/Data/Round.swift
  5. 16
      PadelClub/Data/Tournament.swift
  6. 2
      PadelClub/Data/TournamentStore.swift
  7. 2
      PadelClub/Views/Calling/CallSettingsView.swift
  8. 30
      PadelClub/Views/Calling/CallView.swift
  9. 22
      PadelClub/Views/Calling/SendToAllView.swift
  10. 2
      PadelClub/Views/Club/ClubsView.swift
  11. 24
      PadelClub/Views/GroupStage/Components/GroupStageTeamView.swift
  12. 2
      PadelClub/Views/GroupStage/GroupStagesSettingsView.swift
  13. 22
      PadelClub/Views/Match/MatchDetailView.swift
  14. 2
      PadelClub/Views/Navigation/Agenda/EventListView.swift
  15. 2
      PadelClub/Views/Navigation/Ongoing/OngoingView.swift
  16. 2
      PadelClub/Views/Navigation/Toolbox/ToolboxView.swift
  17. 2
      PadelClub/Views/Navigation/Umpire/UmpireView.swift
  18. 2
      PadelClub/Views/Round/LoserRoundView.swift
  19. 10
      PadelClub/Views/Round/LoserRoundsView.swift
  20. 2
      PadelClub/Views/Round/RoundView.swift
  21. 22
      PadelClub/Views/Shared/SupportButtonView.swift
  22. 31
      PadelClub/Views/Team/EditingTeamView.swift
  23. 2
      PadelClub/Views/Tournament/Screen/Components/TournamentStatusView.swift
  24. 33
      PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift
  25. 2
      PadelClub/Views/Tournament/Subscription/Guard.swift
  26. 2
      PadelClub/Views/Tournament/Subscription/StoreItem.swift
  27. 2
      PadelClub/Views/Tournament/TournamentBuildView.swift
  28. 2
      PadelClub/Views/Tournament/TournamentView.swift
  29. 2
      PadelClub/Views/User/LoginView.swift

@ -54,7 +54,7 @@ class DataStore: ObservableObject {
let serverURL: String = URLs.api.rawValue
StoreCenter.main.blackListUserName("apple-test")
#if DEBUG
#if _DEBUG_OPTIONS
if let server = PListReader.readString(plist: "local", key: "server") {
StoreCenter.main.synchronizationApiURL = server
} else {
@ -70,7 +70,7 @@ class DataStore: ObservableObject {
_ = Guard.main // init
#if DEBUG
#if _DEBUG_OPTIONS
if let sync = PListReader.readBool(plist: "local", key: "synchronized") {
synchronized = sync
}

@ -201,7 +201,7 @@ final class GroupStage: ModelObject, Storable {
}
func availableToStart(playedMatches: [Match], in runningMatches: [Match]) -> [Match] {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -212,7 +212,7 @@ final class GroupStage: ModelObject, Storable {
}
func runningMatches(playedMatches: [Match]) -> [Match] {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -223,7 +223,7 @@ final class GroupStage: ModelObject, Storable {
}
func readyMatches(playedMatches: [Match]) -> [Match] {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -234,7 +234,7 @@ final class GroupStage: ModelObject, Storable {
}
func finishedMatches(playedMatches: [Match]) -> [Match] {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)

@ -90,7 +90,7 @@ final class Match: ModelObject, Storable {
}
func indexInRound(in matches: [Match]? = nil) -> Int {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -114,7 +114,7 @@ defer {
}
func matchTitle(_ displayStyle: DisplayStyle = .wide, inMatches matches: [Match]? = nil) -> String {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -687,7 +687,7 @@ defer {
}
func teams() -> [TeamRegistration] {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -746,7 +746,7 @@ defer {
}
func team(_ team: TeamPosition) -> TeamRegistration? {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)

@ -157,7 +157,7 @@ final class Round: ModelObject, Storable {
}
func roundProjectedTeam(_ team: TeamPosition, inMatch match: Match, previousRound: Round?) -> TeamRegistration? {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -199,7 +199,7 @@ defer {
}
func upperBracketTopMatch(ofMatchIndex matchIndex: Int, previousRound: Round?) -> Match? {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -214,7 +214,7 @@ defer {
}
func upperBracketBottomMatch(ofMatchIndex matchIndex: Int, previousRound: Round?) -> Match? {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -231,7 +231,7 @@ defer {
func topPreviousRoundMatch(ofMatch match: Match, previousRound: Round?) -> Match? {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -247,7 +247,7 @@ defer {
}
func bottomPreviousRoundMatch(ofMatch match: Match, previousRound: Round?) -> Match? {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -274,7 +274,7 @@ defer {
}
// func displayableMatches() -> [Match] {
//#if DEBUG_TIME //DEBUGING TIME
//#if _DEBUG_TIME //DEBUGING TIME
// let start = Date()
// defer {
// let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -300,7 +300,7 @@ defer {
}
func previousRound() -> Round? {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -428,7 +428,7 @@ defer {
func correspondingLoserRoundTitle(_ displayStyle: DisplayStyle = .wide) -> String {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -469,7 +469,7 @@ defer {
}
func seedInterval(initialMode: Bool = false) -> SeedInterval? {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -540,7 +540,7 @@ defer {
func loserRounds() -> [Round] {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -722,7 +722,7 @@ extension Round: Selectable, Equatable {
}
func badgeValue() -> Int? {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -743,7 +743,7 @@ extension Round: Selectable, Equatable {
}
func badgeImage() -> Badge? {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)

@ -508,7 +508,7 @@ final class Tournament : ModelObject, Storable {
}
func courtUsed() -> [Int] {
#if DEBUG //DEBUGING TIME
#if _DEBUG_OPTIONS //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -592,7 +592,7 @@ defer {
}
func availableSeeds() -> [TeamRegistration] {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -815,7 +815,7 @@ defer {
func selectedSortedTeams() -> [TeamRegistration] {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -1105,7 +1105,7 @@ defer {
}
func availableToStart(_ allMatches: [Match], in runningMatches: [Match]) -> [Match] {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -1116,7 +1116,7 @@ defer {
}
func runningMatches(_ allMatches: [Match]) -> [Match] {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -1127,7 +1127,7 @@ defer {
}
func readyMatches(_ allMatches: [Match]) -> [Match] {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -1138,7 +1138,7 @@ defer {
}
func finishedMatches(_ allMatches: [Match], limit: Int? = nil) -> [Match] {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -1397,7 +1397,7 @@ defer {
func availableQualifiedTeams() -> [TeamRegistration] {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)

@ -38,7 +38,7 @@ class TournamentStore: Store, ObservableObject {
var synchronized: Bool = true
let indexed: Bool = true
#if DEBUG
#if _DEBUG_OPTIONS
if let sync = PListReader.readBool(plist: "local", key: "synchronized") {
synchronized = sync
}

@ -56,7 +56,7 @@ struct CallSettingsView: View {
}
}
// #if DEBUG
// #if _DEBUG_OPTIONS
Section {
RowButtonView("Retirer toutes les convocations", role: .destructive) {
let teams = tournament.unsortedTeams()

@ -125,7 +125,7 @@ struct CallView: View {
Button("OK") {
}
} message: {
Text(self._failureMessage())
Text(_networkErrorMessage)
}
.sheet(item: $contactType) { contactType in
Group {
@ -188,15 +188,7 @@ struct CallView: View {
}
})
}
fileprivate func _failureMessage() -> String {
return [networkMonitor.connected == false ? "L'appareil n'est pas connecté à internet." as String? : nil,
sentError == .mailNotSent ? "Le mail est dans la boîte d'envoi de l'app Mail. Vérifiez son état dans l'app Mail avant d'essayer de le renvoyer." as String? : nil,
(sentError == .messageFailed || sentError == .messageNotSent) ? "Le SMS n'a pas été envoyé" as String? : nil,
sentError == .mailFailed ? "Le mail n'a pas été envoyé" as String? : nil]
.compacted().joined(separator: "\n")
}
@ViewBuilder
private func _summonMenu(byMessage: Bool) -> some View {
if self.reSummon {
@ -267,4 +259,22 @@ struct CallView: View {
tournamentBuild: nil)
}
private var _networkErrorMessage: String {
var errors: [String] = []
if networkMonitor.connected == false {
errors.append("L'appareil n'est pas connecté à internet.")
}
if sentError == .mailNotSent {
errors.append("Le mail est dans la boîte d'envoi de l'app Mail. Vérifiez son état dans l'app Mail avant d'essayer de le renvoyer.")
}
if (sentError == .messageFailed || sentError == .messageNotSent) {
errors.append("Le SMS n'a pas été envoyé")
}
if sentError == .mailFailed {
errors.append("Le mail n'a pas été envoyé")
}
return errors.joined(separator: "\n")
}
}

@ -122,8 +122,7 @@ struct SendToAllView: View {
Button("OK") {
}
} message: {
let message = [networkMonitor.connected == false ? "L'appareil n'est pas connecté à internet." as String? : nil, sentError == .mailNotSent ? "Le mail est dans la boîte d'envoi de l'app Mail. Vérifiez son état dans l'app Mail avant d'essayer de le renvoyer." as String? : nil, (sentError == .messageFailed || sentError == .messageNotSent) ? "Le SMS n'a pas été envoyé" as String? : nil, sentError == .mailFailed ? "Le mail n'a pas été envoyé" as String? : nil].compacted().joined(separator: "\n")
Text(message)
Text(_networkErrorMessage)
}
.sheet(item: $contactType) { contactType in
Group {
@ -253,6 +252,25 @@ struct SendToAllView: View {
self.showSubscriptionView = true
}
}
private var _networkErrorMessage: String {
var errors: [String] = []
if networkMonitor.connected == false {
errors.append("L'appareil n'est pas connecté à internet.")
}
if sentError == .mailNotSent {
errors.append("Le mail est dans la boîte d'envoi de l'app Mail. Vérifiez son état dans l'app Mail avant d'essayer de le renvoyer.")
}
if (sentError == .messageFailed || sentError == .messageNotSent) {
errors.append("Le SMS n'a pas été envoyé")
}
if sentError == .mailFailed {
errors.append("Le mail n'a pas été envoyé")
}
return errors.joined(separator: "\n")
}
}
//#Preview {

@ -27,7 +27,7 @@ struct ClubsView: View {
var body: some View {
List {
#if DEBUG
#if _DEBUG_OPTIONS
Section {
RowButtonView("Delete unexisted clubs", action: {
let ids = dataStore.user.clubs

@ -95,7 +95,7 @@ struct GroupStageTeamView: View {
Button("OK") {
}
} message: {
Text(_getErrorMessage())
Text(_networkErrorMessage)
}
.sheet(item: $contactType) { contactType in
Group {
@ -152,14 +152,22 @@ struct GroupStageTeamView: View {
.navigationTitle("Détail de l'équipe")
}
private func _getErrorMessage() -> String {
let m1 : String? = (networkMonitor.connected == false ? "L'appareil n'est pas connecté à internet." : nil)
let m2 : String? = (sentError == .mailNotSent ? "Le mail est dans la boîte d'envoi de l'app Mail. Vérifiez son état dans l'app Mail avant d'essayer de le renvoyer." : nil)
let m3 : String? = ((sentError == .messageFailed || sentError == .messageNotSent) ? "Le SMS n'a pas été envoyé" : nil)
let m4 : String? = (sentError == .mailFailed ? "Le mail n'a pas été envoyé" : nil)
private var _networkErrorMessage: String {
var errors: [String] = []
let message : String = [m1, m2, m3, m4].compacted().joined(separator: "\n")
return message
if networkMonitor.connected == false {
errors.append("L'appareil n'est pas connecté à internet.")
}
if sentError == .mailNotSent {
errors.append("Le mail est dans la boîte d'envoi de l'app Mail. Vérifiez son état dans l'app Mail avant d'essayer de le renvoyer.")
}
if (sentError == .messageFailed || sentError == .messageNotSent) {
errors.append("Le SMS n'a pas été envoyé")
}
if sentError == .mailFailed {
errors.append("Le mail n'a pas été envoyé")
}
return errors.joined(separator: "\n")
}
private func _save() {

@ -73,7 +73,7 @@ struct GroupStagesSettingsView: View {
}
}
#if DEBUG
#if _DEBUG_OPTIONS
Section {
RowButtonView("delete all group stages") {
tournament.deleteGroupStages()

@ -197,8 +197,7 @@ struct MatchDetailView: View {
Button("OK") {
}
} message: {
let message = [networkMonitor.connected == false ? "L'appareil n'est pas connecté à internet." as String? : nil, sentError == .mailNotSent ? "Le mail est dans la boîte d'envoi de l'app Mail. Vérifiez son état dans l'app Mail avant d'essayer de le renvoyer." as String? : nil, (sentError == .messageFailed || sentError == .messageNotSent) ? "Le SMS n'a pas été envoyé" as String? : nil, sentError == .mailFailed ? "Le mail n'a pas été envoyé" as String? : nil].compacted().joined(separator: "\n")
Text(message)
Text(_networkErrorMessage)
}
.sheet(item: $contactType) { contactType in
Group {
@ -508,6 +507,25 @@ struct MatchDetailView: View {
Logger.error(error)
}
}
private var _networkErrorMessage: String {
var errors: [String] = []
if networkMonitor.connected == false {
errors.append("L'appareil n'est pas connecté à internet.")
}
if sentError == .mailNotSent {
errors.append("Le mail est dans la boîte d'envoi de l'app Mail. Vérifiez son état dans l'app Mail avant d'essayer de le renvoyer.")
}
if (sentError == .messageFailed || sentError == .messageNotSent) {
errors.append("Le SMS n'a pas été envoyé")
}
if sentError == .mailFailed {
errors.append("Le mail n'a pas été envoyé")
}
return errors.joined(separator: "\n")
}
}
//#Preview {

@ -112,7 +112,7 @@ struct EventListView: View {
}
}
}
#if DEBUG
#if _DEBUG_OPTIONS
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
Button(role: .destructive) {
do {

@ -44,7 +44,7 @@ struct OngoingView: View {
} footer: {
HStack {
Text(tournament.eventLabel())
#if DEBUG
#if _DEBUG_OPTIONS
Spacer()
FooterButtonView("copier l'id") {
let pasteboard = UIPasteboard.general

@ -49,7 +49,7 @@ struct ToolboxView: View {
}
#if DEBUG
#if _DEBUG_OPTIONS
Section {
NavigationLink("Settings") {

@ -145,7 +145,7 @@ struct UmpireView: View {
}
.navigationTitle("Juge-Arbitre")
.toolbar {
#if DEBUG
#if _DEBUG_OPTIONS
ToolbarItem(placement: .topBarTrailing) {
if StoreCenter.main.collectionsCanSynchronize {
Image(systemName: "checkmark.icloud")

@ -15,7 +15,7 @@ struct LoserRoundView: View {
let loserBracket: LoserRound
private func _roundDisabled() -> Bool {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)

@ -42,7 +42,7 @@ extension UpperRound: Equatable {
}
func badgeValue() -> Int? {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -57,7 +57,7 @@ extension UpperRound: Equatable {
}
func badgeImage() -> Badge? {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -85,7 +85,7 @@ struct LoserRound: Identifiable, Selectable {
}
var shouldBeDisplayed: Bool {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -97,7 +97,7 @@ struct LoserRound: Identifiable, Selectable {
}
static func updateDestinations(fromLoserRounds loserRounds: [Round], inUpperBracketRound upperBracketRound: Round) -> [LoserRound] {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -146,7 +146,7 @@ extension LoserRound: Equatable {
}
func badgeImage() -> Badge? {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)

@ -254,7 +254,7 @@ struct RoundView: View {
}
}
#if DEBUG
#if _DEBUG_OPTIONS
Spacer()
Text(match.teamScores.count.formatted())

@ -47,8 +47,7 @@ struct SupportButtonView: View {
Button("OK") {
}
} message: {
let message = [networkMonitor.connected == false ? "L'appareil n'est pas connecté à internet." as String? : nil, sentError == .mailNotSent ? "Le mail est dans la boîte d'envoi de l'app Mail. Vérifiez son état dans l'app Mail avant d'essayer de le renvoyer." as String? : nil, (sentError == .messageFailed || sentError == .messageNotSent) ? "Le SMS n'a pas été envoyé" as String? : nil, sentError == .mailFailed ? "Le mail n'a pas été envoyé" as String? : nil].compacted().joined(separator: "\n")
Text(message)
Text(_networkErrorMessage)
}
.sheet(item: $zipFilePath) { zipFilePath in
MailComposeView(recipients: ["support@padelclub.app"], bccRecipients: nil, body: _getBody(), subject: _getSubject(), attachmentURL: zipFilePath) { result in
@ -102,4 +101,23 @@ struct SupportButtonView: View {
Logger.error(error)
}
}
private var _networkErrorMessage: String {
var errors: [String] = []
if networkMonitor.connected == false {
errors.append("L'appareil n'est pas connecté à internet.")
}
if sentError == .mailNotSent {
errors.append("Le mail est dans la boîte d'envoi de l'app Mail. Vérifiez son état dans l'app Mail avant d'essayer de le renvoyer.")
}
if (sentError == .messageFailed || sentError == .messageNotSent) {
errors.append("Le SMS n'a pas été envoyé")
}
if sentError == .mailFailed {
errors.append("Le mail n'a pas été envoyé")
}
return errors.joined(separator: "\n")
}
}

@ -186,7 +186,7 @@ struct EditingTeamView: View {
Button("OK") {
}
} message: {
Text(_getErrorMessage())
Text(_networkErrorMessage)
}
.sheet(item: $contactType) { contactType in
Group {
@ -257,16 +257,6 @@ struct EditingTeamView: View {
.navigationBarTitleDisplayMode(.inline)
}
private func _getErrorMessage() -> String {
let m1 : String? = (networkMonitor.connected == false ? "L'appareil n'est pas connecté à internet." : nil)
let m2 : String? = (sentError == .mailNotSent ? "Le mail est dans la boîte d'envoi de l'app Mail. Vérifiez son état dans l'app Mail avant d'essayer de le renvoyer." : nil)
let m3 : String? = ((sentError == .messageFailed || sentError == .messageNotSent) ? "Le SMS n'a pas été envoyé" : nil)
let m4 : String? = (sentError == .mailFailed ? "Le mail n'a pas été envoyé" : nil)
let message : String = [m1, m2, m3, m4].compacted().joined(separator: "\n")
return message
}
private var hasArrived: Binding<Bool> {
Binding {
team.unsortedPlayers().allSatisfy({ $0.hasArrived })
@ -289,6 +279,25 @@ struct EditingTeamView: View {
Logger.error(error)
}
}
private var _networkErrorMessage: String {
var errors: [String] = []
if networkMonitor.connected == false {
errors.append("L'appareil n'est pas connecté à internet.")
}
if sentError == .mailNotSent {
errors.append("Le mail est dans la boîte d'envoi de l'app Mail. Vérifiez son état dans l'app Mail avant d'essayer de le renvoyer.")
}
if (sentError == .messageFailed || sentError == .messageNotSent) {
errors.append("Le SMS n'a pas été envoyé")
}
if sentError == .mailFailed {
errors.append("Le mail n'a pas été envoyé")
}
return errors.joined(separator: "\n")
}
}
//#Preview {

@ -17,7 +17,7 @@ struct TournamentStatusView: View {
var body: some View {
Form {
#if DEBUG
#if _DEBUG_OPTIONS
RowButtonView("debug: Un-delete le tournoi") {
tournament.endDate = nil
tournament.isDeleted.toggle()

@ -167,7 +167,7 @@ struct InscriptionManagerView: View {
}
private func _setHash() {
#if DEBUG_TIME //DEBUGING TIME
#if _DEBUG_TIME //DEBUGING TIME
let start = Date()
defer {
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000)
@ -242,7 +242,7 @@ struct InscriptionManagerView: View {
Button("OK") {
}
} message: {
Text(_getErrorMessage())
Text(_networkErrorMessage)
}
.sheet(item: $contactType) { contactType in
Group {
@ -960,16 +960,6 @@ struct InscriptionManagerView: View {
}
}
private func _getErrorMessage() -> String {
let m1 : String? = (networkMonitor.connected == false ? "L'appareil n'est pas connecté à internet." : nil)
let m2 : String? = (sentError == .mailNotSent ? "Le mail est dans la boîte d'envoi de l'app Mail. Vérifiez son état dans l'app Mail avant d'essayer de le renvoyer." : nil)
let m3 : String? = ((sentError == .messageFailed || sentError == .messageNotSent) ? "Le SMS n'a pas été envoyé" : nil)
let m4 : String? = (sentError == .mailFailed ? "Le mail n'a pas été envoyé" : nil)
let message : String = [m1, m2, m3, m4].compacted().joined(separator: "\n")
return message
}
private func _save() {
do {
try dataStore.tournaments.addOrUpdate(instance: tournament)
@ -977,6 +967,25 @@ struct InscriptionManagerView: View {
Logger.error(error)
}
}
private var _networkErrorMessage: String {
var errors: [String] = []
if networkMonitor.connected == false {
errors.append("L'appareil n'est pas connecté à internet.")
}
if sentError == .mailNotSent {
errors.append("Le mail est dans la boîte d'envoi de l'app Mail. Vérifiez son état dans l'app Mail avant d'essayer de le renvoyer.")
}
if (sentError == .messageFailed || sentError == .messageNotSent) {
errors.append("Le SMS n'a pas été envoyé")
}
if sentError == .mailFailed {
errors.append("Le mail n'a pas été envoyé")
}
return errors.joined(separator: "\n")
}
}
//#Preview {

@ -141,7 +141,7 @@ import LeStorage
var currentPlan: StoreItem? {
return .monthlyUnlimited
// #if DEBUG
// #if _DEBUG_OPTIONS
// return .monthlyUnlimited
// #else
if let currentBestPlan = self.currentBestPlan, let plan = StoreItem(rawValue: currentBestPlan.productID) {

@ -12,7 +12,7 @@ enum StoreItem: String, Identifiable, CaseIterable {
case fivePerMonth = "app.padelclub.tournament.subscription.five.per.month"
case unit = "app.padelclub.tournament.unit"
#if DEBUG
#if _DEBUG_OPTIONS
static let five: Int = 2
#else
static let five: Int = 5

@ -92,7 +92,7 @@ struct TournamentBuildView: View {
Section {
#if DEBUG
#if _DEBUG_OPTIONS
NavigationLink(value: Screen.rankings) {
LabeledContent {
if tournament.publishRankings == false {

@ -154,7 +154,7 @@ struct TournamentView: View {
ToolbarItem(placement: .topBarTrailing) {
Menu {
#if DEBUG
#if _DEBUG_OPTIONS
Button {
do {
try self.tournament.payIfNecessary()

@ -182,7 +182,7 @@ struct LoginView: View {
}
.navigationTitle("Connexion")
.onAppear {
#if DEBUG
#if _DEBUG_OPTIONS
if let username = PListReader.readString(plist: "local", key: "username") {
self.username = username
}

Loading…
Cancel
Save