multistore
Razmig Sarkissian 2 years ago
parent fceb61c08e
commit cf44ce1310
  1. 4
      PadelClub.xcodeproj/project.pbxproj
  2. 8
      PadelClub/Data/Tournament.swift
  3. 28
      PadelClub/Views/Tournament/Screen/BroadcastView.swift

@ -1830,7 +1830,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 6; CURRENT_PROJECT_VERSION = 7;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6; DEVELOPMENT_TEAM = BQ3Y44M3Q6;
@ -1868,7 +1868,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 6; CURRENT_PROJECT_VERSION = 7;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6; DEVELOPMENT_TEAM = BQ3Y44M3Q6;

@ -303,7 +303,11 @@ class Tournament : ModelObject, Storable {
} }
func areTeamsPublished() -> Bool { func areTeamsPublished() -> Bool {
Date() >= startDate Date() >= startDate || publishTeams
}
func areSummonsPublished() -> Bool {
Date() >= startDate || publishSummons
} }
func publishedGroupStagesDate() -> Date? { func publishedGroupStagesDate() -> Date? {
@ -319,6 +323,7 @@ class Tournament : ModelObject, Storable {
} }
func areGroupStagesPublished() -> Bool { func areGroupStagesPublished() -> Bool {
if publishGroupStages { return true }
if let publishedGroupStagesDate = publishedGroupStagesDate() { if let publishedGroupStagesDate = publishedGroupStagesDate() {
return Date() >= publishedGroupStagesDate return Date() >= publishedGroupStagesDate
} else { } else {
@ -339,6 +344,7 @@ class Tournament : ModelObject, Storable {
} }
func areBracketsPublished() -> Bool { func areBracketsPublished() -> Bool {
if publishBrackets { return true }
if let publishedBracketsDate = publishedBracketsDate() { if let publishedBracketsDate = publishedBracketsDate() {
return Date() >= publishedBracketsDate return Date() >= publishedBracketsDate
} else { } else {

@ -58,22 +58,25 @@ struct BroadcastView: View {
Text("Liste des équipes") Text("Liste des équipes")
} footer: { } footer: {
if Date() < tournament.publishedTeamsDate() { if Date() < tournament.publishedTeamsDate() {
HStack {
Spacer()
FooterButtonView(tournament.publishTeams ? "masquer sur le site" : "publier maintenant") { FooterButtonView(tournament.publishTeams ? "masquer sur le site" : "publier maintenant") {
tournament.publishTeams.toggle() tournament.publishTeams.toggle()
} }
} }
} }
}
Section { Section {
LabeledContent { LabeledContent {
if tournament.areTeamsPublished() { if tournament.areSummonsPublished() {
Image(systemName:"checkmark").foregroundStyle(.green) Image(systemName:"checkmark").foregroundStyle(.green)
} else { } else {
Text(tournament.publishedTeamsDate().formatted()) Text(tournament.publishedTeamsDate().formatted())
} }
} label: { } label: {
if tournament.areTeamsPublished() { if tournament.areSummonsPublished() {
Text("Publiée") Text("Publiées")
} else { } else {
Text("Publication prévue") Text("Publication prévue")
} }
@ -82,11 +85,14 @@ struct BroadcastView: View {
Text("Convocations") Text("Convocations")
} footer: { } footer: {
if Date() < tournament.publishedTeamsDate() { if Date() < tournament.publishedTeamsDate() {
HStack {
Spacer()
FooterButtonView(tournament.publishSummons ? "masquer sur le site" : "publier maintenant") { FooterButtonView(tournament.publishSummons ? "masquer sur le site" : "publier maintenant") {
tournament.publishSummons.toggle() tournament.publishSummons.toggle()
} }
} }
} }
}
if let publishedGroupStagesDate = tournament.publishedGroupStagesDate() { if let publishedGroupStagesDate = tournament.publishedGroupStagesDate() {
Section { Section {
@ -99,7 +105,7 @@ struct BroadcastView: View {
} }
} label: { } label: {
if areGroupStagesPublished { if areGroupStagesPublished {
Text("Publiée") Text("Publiées")
} else { } else {
Text("Publication prévue") Text("Publication prévue")
} }
@ -108,12 +114,15 @@ struct BroadcastView: View {
Text("Poules") Text("Poules")
} footer: { } footer: {
if Date() < publishedGroupStagesDate { if Date() < publishedGroupStagesDate {
HStack {
Spacer()
FooterButtonView(tournament.publishGroupStages ? "masquer sur le site" : "publier maintenant") { FooterButtonView(tournament.publishGroupStages ? "masquer sur le site" : "publier maintenant") {
tournament.publishGroupStages.toggle() tournament.publishGroupStages.toggle()
} }
} }
} }
} }
}
if let publishedBracketsDate = tournament.publishedBracketsDate() { if let publishedBracketsDate = tournament.publishedBracketsDate() {
Section { Section {
@ -126,7 +135,7 @@ struct BroadcastView: View {
} }
} label: { } label: {
if areBracketsPublished { if areBracketsPublished {
Text("Publiée") Text("Publié")
} else { } else {
Text("Publication prévue") Text("Publication prévue")
} }
@ -134,13 +143,16 @@ struct BroadcastView: View {
} header: { } header: {
Text("Tableau") Text("Tableau")
} footer: { } footer: {
if Date() < publishedBracketsDate{ if Date() < publishedBracketsDate {
HStack {
Spacer()
FooterButtonView(tournament.publishBrackets ? "masquer sur le site" : "publier maintenant") { FooterButtonView(tournament.publishBrackets ? "masquer sur le site" : "publier maintenant") {
tournament.publishBrackets.toggle() tournament.publishBrackets.toggle()
} }
} }
} }
} }
}
//todo waitinglist & info //todo waitinglist & info
@ -149,7 +161,7 @@ struct BroadcastView: View {
Text("Tournoi privé") Text("Tournoi privé")
} }
} footer: { } footer: {
let footerString = "Le tournoi sera masqué sur le site [Padel Club]\(URLs.main.rawValue)" let footerString = "Le tournoi sera masqué sur le site [Padel Club](\(URLs.main.rawValue))"
Text(.init(footerString)) Text(.init(footerString))
} }
@ -204,7 +216,7 @@ struct BroadcastView: View {
UIPasteboard.general.string = urlToShow UIPasteboard.general.string = urlToShow
} }
} }
.onChange(of: tournament.isPrivate) { .onChange(of: [tournament.isPrivate, tournament.publishTeams, tournament.publishSummons, tournament.publishBrackets, tournament.publishGroupStages]) {
_save() _save()
} }
} }

Loading…
Cancel
Save