diff --git a/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift b/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift index 02ac5fd..b385bee 100644 --- a/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift +++ b/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift @@ -481,12 +481,10 @@ struct InscriptionManagerView: View { // Text("En csv") // } // } - -// if let teamPaste = teamPaste(.championship) { - ShareLink(item: teamPaste(.championship)) { - Text("En csv pour la ligue") - } -// } + + ShareLink(item: teamPaste(.championship), preview: .init("championship")) { + Text("championship") + } } label: { Label("Exporter les paires", systemImage: "square.and.arrow.up") } @@ -877,13 +875,19 @@ struct InscriptionManagerView: View { Button { Task { - gatheringInProgress = true - gathered = 0 - gatheringDone = false + DispatchQueue.main.async { + gatheringInProgress = true + gathered = 0 + gatheringDone = false + } + let unrankedUnsourced = tournament.players().filter { $0.isUnranked() && $0.source == nil } - totalUnrankedUnsourced = Double(unrankedUnsourced.count) - print("total", unrankedUnsourced.count) + DispatchQueue.main.async { + totalUnrankedUnsourced = Double(unrankedUnsourced.count) + print("total", unrankedUnsourced.count) + } + await withTaskGroup(of: Void.self) { group in var playersToSave = [PlayerRegistration]() for player in unrankedUnsourced { @@ -896,7 +900,7 @@ struct InscriptionManagerView: View { player.source = .frenchFederation playersToSave.append(player) } - await MainActor.run { + DispatchQueue.main.async { gathered += 1 print("gathered", gathered) } @@ -1220,10 +1224,6 @@ struct TournamentShareFile: Transferable { } static var transferRepresentation: some TransferRepresentation { - FileRepresentation(exportedContentType: .utf8PlainText) { transferable in - return SentTransferredFile(transferable.shareFile()) - } - ProxyRepresentation { transferable in return transferable.shareFile() }