add maintenance tenup message

paca_championship
Raz 1 year ago
parent 585cb9cf9f
commit 8eadd30759
  1. 4
      PadelClub.xcodeproj/project.pbxproj
  2. 1
      PadelClub/ViewModel/FederalDataViewModel.swift
  3. 39
      PadelClub/Views/Navigation/Agenda/ActivityView.swift
  4. 6
      PadelClub/Views/Navigation/Agenda/TournamentLookUpView.swift

@ -3174,7 +3174,7 @@
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 9;
CURRENT_PROJECT_VERSION = 10;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
@ -3219,7 +3219,7 @@
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 9;
CURRENT_PROJECT_VERSION = 10;
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6;

@ -22,6 +22,7 @@ class FederalDataViewModel {
var searchAttemptCount: Int = 0
var dayDuration: Int?
var dayPeriod: DayPeriod = .all
var lastError: NetworkManagerError?
func filterStatus() -> String {
var labels: [String] = []

@ -134,8 +134,12 @@ struct ActivityView: View {
ContentUnavailableView {
Label("Une erreur est survenue", systemImage: "exclamationmark.circle.fill")
} description: {
Text(error.localizedDescription)
Text("Tenup est peut-être en maintenance. " + error.localizedDescription)
} actions: {
Link(destination: URLs.tenup.url) {
Text("Voir si tenup est en maintenance")
}
RowButtonView("D'accord.") {
self.error = nil
}
@ -510,15 +514,32 @@ struct ActivityView: View {
.padding()
}
} else {
ContentUnavailableView {
Label("Aucun tournoi", systemImage: "shield.slash")
} description: {
Text("Aucun tournoi ne correspond aux critères sélectionnés.")
} actions: {
FooterButtonView("modifier vos critères de recherche") {
displaySearchView = true
if federalDataViewModel.lastError == nil {
ContentUnavailableView {
Label("Aucun tournoi", systemImage: "shield.slash")
} description: {
Text("Aucun tournoi ne correspond aux critères sélectionnés.")
} actions: {
FooterButtonView("modifier vos critères de recherche") {
displaySearchView = true
}
.padding()
}
} else {
ContentUnavailableView {
Label("Une erreur est survenue", systemImage: "exclamationmark.circle.fill")
} description: {
Text("Tenup est peut-être en maintenance, veuillez ré-essayer plus tard.")
} actions: {
Link(destination: URLs.tenup.url) {
Text("Voir si tenup est en maintenance")
}
FooterButtonView("modifier vos critères de recherche") {
displaySearchView = true
}
.padding()
}
.padding()
}
}
}

@ -181,6 +181,7 @@ struct TournamentLookUpView: View {
federalDataViewModel.levels = Set(levels)
federalDataViewModel.categories = Set(categories)
federalDataViewModel.ageCategories = Set(ages)
federalDataViewModel.lastError = nil
Task {
await getNewPage()
@ -223,7 +224,12 @@ struct TournamentLookUpView: View {
await getNewBuildForm()
} else {
let commands = try await NetworkFederalService.shared.getAllFederalTournaments(sortingOption: dataStore.appSettings.sortingOption, page: page, startDate: dataStore.appSettings.startDate, endDate: dataStore.appSettings.endDate, city: dataStore.appSettings.city, distance: dataStore.appSettings.distance, categories: categories, levels: levels, lat: locationManager.location?.coordinate.latitude.formatted(.number.locale(Locale(identifier: "us"))), lng: locationManager.location?.coordinate.longitude.formatted(.number.locale(Locale(identifier: "us"))), ages: ages, types: types, nationalCup: dataStore.appSettings.nationalCup)
if commands.anySatisfy({ $0.command == "alert" }) {
federalDataViewModel.lastError = .maintenance
}
let resultCommand = commands.first(where: { $0.results != nil })
if let newTournaments = resultCommand?.results?.items {
newTournaments.forEach { ft in
// let isValid = ft.tournaments.anySatisfy({ build in

Loading…
Cancel
Save