Fixes and improvements

sync2
Laurent 11 months ago
parent 9ebdffddd7
commit ce4f0d11d7
  1. 10
      PadelClub/Data/DataStore.swift
  2. 9
      PadelClub/Data/PlayerRegistration.swift
  3. 11
      PadelClub/Data/TeamScore.swift
  4. 2
      PadelClub/Utils/URLs.swift
  5. 6
      PadelClub/Views/Navigation/Toolbox/DebugSettingsView.swift
  6. 2
      PadelClub/Views/User/ShareModelView.swift

@ -54,18 +54,18 @@ class DataStore: ObservableObject {
let store = Store.main
StoreCenter.main.blackListUserName("apple-test")
let httpScheme: String = URLs.httpScheme.rawValue
// let secureScheme = true
let domain: String = URLs.activationHost.rawValue
#if DEBUG
if let scheme = PListReader.readString(plist: "local", key: "server_scheme"),
if let secure = PListReader.readBool(plist: "local", key: "secure_server"),
let domain = PListReader.readString(plist: "local", key: "server_domain") {
StoreCenter.main.configureURLs(httpScheme: scheme, domain: domain)
StoreCenter.main.configureURLs(secureScheme: secure, domain: domain)
} else {
StoreCenter.main.configureURLs(httpScheme: httpScheme, domain: domain)
StoreCenter.main.configureURLs(secureScheme: true, domain: domain)
}
#else
StoreCenter.main.configureURLs(httpScheme: httpScheme, domain: domain)
StoreCenter.main.configureURLs(secureScheme: true, domain: domain)
#endif
StoreCenter.main.logsFailedAPICalls()

@ -125,10 +125,13 @@ final class PlayerRegistration: BasePlayerRegistration, SideStorable {
}
var tournamentStore: TournamentStore {
if let store = self.store as? TournamentStore {
return store
guard let storeId else {
fatalError("missing store id for \(String(describing: type(of: self)))")
}
fatalError("missing store for \(String(describing: type(of: self)))")
return TournamentLibrary.shared.store(tournamentId: storeId)
// if let store = self.store as? TournamentStore {
// return store
// }
}
var computedAge: Int? {

@ -51,10 +51,15 @@ final class TeamScore: BaseTeamScore, SideStorable {
}
var tournamentStore: TournamentStore {
if let store = self.store as? TournamentStore {
return store
guard let storeId else {
fatalError("missing store id for \(String(describing: type(of: self)))")
}
fatalError("missing store for \(String(describing: type(of: self)))")
return TournamentLibrary.shared.store(tournamentId: storeId)
//
// if let store = self.store as? TournamentStore {
// return store
// }
// fatalError("missing store for \(String(describing: type(of: self)))")
}
// MARK: - Computed dependencies

@ -8,7 +8,7 @@
import Foundation
enum URLs: String, Identifiable {
case httpScheme = "https://"
// case httpScheme = "https://"
#if DEBUG
case activationHost = "xlr.alwaysdata.net"
case main = "https://xlr.alwaysdata.net/"

@ -14,7 +14,7 @@ struct DebugSettingsView: View {
LabeledContent("UUID", value: self._userId)
LabeledContent("User Name", value: self._userName)
LabeledContent("Token", value: self._token)
LabeledContent("Server", value: self._server)
LabeledContent("Server", value: self._apiURL)
LabeledContent("Synchronized", value: self._synchronized)
LabeledContent("CollectionsCanSynchronize", value: self._canSynchronize)
}
@ -32,8 +32,8 @@ struct DebugSettingsView: View {
return StoreCenter.main.token() ?? ""
}
fileprivate var _server: String {
return PListReader.readString(plist: "local", key: "server") ?? ""
fileprivate var _apiURL: String {
return StoreCenter.main.apiURL ?? "not configured"
}
fileprivate var _synchronized: String {

@ -70,7 +70,7 @@ struct ShareModelView<T: SyncedStorable> : View {
.listStyle(PlainListStyle())
.navigationTitle("Partage")
} else {
ContentUnavailableView("Si vous souhaitez partager votre tournoi avec d'autres utilisateurs, veuillez contacter notre support", image: "person.fill.xmark")
ContentUnavailableView("Si vous souhaitez partager votre tournoi avec d'autres utilisateurs, veuillez contacter notre support", image: "person.crop.circle.badge.xmark")
}
}.onAppear {

Loading…
Cancel
Save