add some progressview

main
Razmig Sarkissian 4 days ago
parent 425451424a
commit a58541b5bf
  1. 8
      PadelClub.xcodeproj/project.pbxproj
  2. 41
      PadelClub/Views/Navigation/Agenda/EventListView.swift
  3. 30
      PadelClub/Views/Tournament/Shared/TournamentCellView.swift

@ -3245,7 +3245,7 @@
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
@ -3272,7 +3272,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.63;
MARKETING_VERSION = 1.2.64;
PRODUCT_BUNDLE_IDENTIFIER = app.padelclub;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -3293,7 +3293,7 @@
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6;
@ -3319,7 +3319,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.63;
MARKETING_VERSION = 1.2.64;
PRODUCT_BUNDLE_IDENTIFIER = app.padelclub;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

@ -37,7 +37,15 @@ struct EventListView: View {
if let _tournaments = groupedTournamentsByDate[section]?.sorted(by: sortAscending ? { $0.startDate < $1.startDate } : { $0.startDate > $1.startDate }
) {
Section {
_listView(_tournaments)
if sectionImporting == sectionIndex {
LabeledContent {
ProgressView()
} label: {
Text("Récupération en cours")
}
} else {
_listView(_tournaments)
}
} header: {
HStack {
Text(section.monthYearFormatted)
@ -50,21 +58,16 @@ struct EventListView: View {
if let pcTournaments = _tournaments as? [Tournament] {
_menuOptions(pcTournaments)
} else if let federalTournaments = _tournaments as? [FederalTournament], navigation.agendaDestination == .tenup {
HStack {
FooterButtonView("Tout récupérer", role: .destructive) {
Task {
sectionImporting = sectionIndex
for federalTournament in federalTournaments {
await _importFederalTournamentBatch(federalTournament: federalTournament)
}
sectionImporting = nil
FooterButtonView("Tout récupérer", role: .destructive) {
Task {
sectionImporting = sectionIndex
for federalTournament in federalTournaments {
await _importFederalTournamentBatch(federalTournament: federalTournament)
}
}
if sectionImporting == sectionIndex {
Spacer()
ProgressView()
sectionImporting = nil
}
}
.disabled(sectionImporting == sectionIndex)
}
}
}
@ -373,6 +376,18 @@ struct EventListView: View {
} label: {
Text("Terminer les tournois encore ouverts")
}
#if DEBUG
Button {
Task {
await pcTournaments.concurrentForEach { tournament in
dataStore.deleteTournament(tournament)
}
}
} label: {
Text("(DEBUG) Tout effacer")
}
#endif
} label: {
Text("Options avancées")
}

@ -18,6 +18,7 @@ struct TournamentCellView: View {
var displayStyle: DisplayStyle = .wide
var displayContext: DisplayContext = .edition
@State var shouldTournamentBeOver: Bool = false
@State private var inProgressBuild: (String, any TournamentBuildHolder)? = nil
var event: Event? {
guard let federalTournament = tournament as? FederalTournament else { return nil }
@ -144,15 +145,20 @@ struct TournamentCellView: View {
Text(teamCount.formatted())
}
} else if let federalTournament = tournament as? FederalTournament, navigation.agendaDestination != .around {
Button {
_createOrShow(federalTournament: federalTournament, existingTournament: existingTournament, build: build)
} label: {
Image(systemName: existingTournament != nil ? "checkmark.circle.fill" : "square.and.arrow.down")
.resizable()
.scaledToFit()
.frame(height: 28)
.accessibilityLabel("importer ou ouvrir")
.tint(existingTournament != nil ? Color.green : nil)
if let inProgressBuild, build.age == inProgressBuild.1.age, build.level == inProgressBuild.1.level, build.category == inProgressBuild.1.category, inProgressBuild.0 == federalTournament.id {
ProgressView()
} else {
Button {
_createOrShow(federalTournament: federalTournament, existingTournament: existingTournament, build: build)
} label: {
Image(systemName: existingTournament != nil ? "checkmark.circle.fill" : "square.and.arrow.down")
.resizable()
.scaledToFit()
.frame(height: 28)
.accessibilityLabel("importer ou ouvrir")
.tint(existingTournament != nil ? Color.green : nil)
}
}
}
}
@ -221,6 +227,8 @@ struct TournamentCellView: View {
newTournament.umpireCustomMail = federalTournament.mailLabel()
}
inProgressBuild = (federalTournament.id, build)
Task {
do {
let umpireData = try await NetworkFederalService.shared.getUmpireData(idTournament: federalTournament.id)
@ -240,6 +248,10 @@ struct TournamentCellView: View {
} catch {
Logger.error(error)
}
await MainActor.run {
inProgressBuild = nil
}
}
}
}

Loading…
Cancel
Save