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

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

@ -134,8 +134,12 @@ struct ActivityView: View {
ContentUnavailableView { ContentUnavailableView {
Label("Une erreur est survenue", systemImage: "exclamationmark.circle.fill") Label("Une erreur est survenue", systemImage: "exclamationmark.circle.fill")
} description: { } description: {
Text(error.localizedDescription) Text("Tenup est peut-être en maintenance. " + error.localizedDescription)
} actions: { } actions: {
Link(destination: URLs.tenup.url) {
Text("Voir si tenup est en maintenance")
}
RowButtonView("D'accord.") { RowButtonView("D'accord.") {
self.error = nil self.error = nil
} }
@ -510,15 +514,32 @@ struct ActivityView: View {
.padding() .padding()
} }
} else { } else {
ContentUnavailableView { if federalDataViewModel.lastError == nil {
Label("Aucun tournoi", systemImage: "shield.slash") ContentUnavailableView {
} description: { Label("Aucun tournoi", systemImage: "shield.slash")
Text("Aucun tournoi ne correspond aux critères sélectionnés.") } description: {
} actions: { Text("Aucun tournoi ne correspond aux critères sélectionnés.")
FooterButtonView("modifier vos critères de recherche") { } actions: {
displaySearchView = true 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.levels = Set(levels)
federalDataViewModel.categories = Set(categories) federalDataViewModel.categories = Set(categories)
federalDataViewModel.ageCategories = Set(ages) federalDataViewModel.ageCategories = Set(ages)
federalDataViewModel.lastError = nil
Task { Task {
await getNewPage() await getNewPage()
@ -223,7 +224,12 @@ struct TournamentLookUpView: View {
await getNewBuildForm() await getNewBuildForm()
} else { } 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) 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 }) let resultCommand = commands.first(where: { $0.results != nil })
if let newTournaments = resultCommand?.results?.items { if let newTournaments = resultCommand?.results?.items {
newTournaments.forEach { ft in newTournaments.forEach { ft in
// let isValid = ft.tournaments.anySatisfy({ build in // let isValid = ft.tournaments.anySatisfy({ build in

Loading…
Cancel
Save