Fixes and improvements

sync2
Laurent 11 months ago
parent 9ebdffddd7
commit ce4f0d11d7
  1. 12
      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 let store = Store.main
StoreCenter.main.blackListUserName("apple-test") StoreCenter.main.blackListUserName("apple-test")
let httpScheme: String = URLs.httpScheme.rawValue // let secureScheme = true
let domain: String = URLs.activationHost.rawValue let domain: String = URLs.activationHost.rawValue
#if DEBUG #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"){ let domain = PListReader.readString(plist: "local", key: "server_domain") {
StoreCenter.main.configureURLs(httpScheme: scheme, domain: domain) StoreCenter.main.configureURLs(secureScheme: secure, domain: domain)
} else { } else {
StoreCenter.main.configureURLs(httpScheme: httpScheme, domain: domain) StoreCenter.main.configureURLs(secureScheme: true, domain: domain)
} }
#else #else
StoreCenter.main.configureURLs(httpScheme: httpScheme, domain: domain) StoreCenter.main.configureURLs(secureScheme: true, domain: domain)
#endif #endif
StoreCenter.main.logsFailedAPICalls() StoreCenter.main.logsFailedAPICalls()

@ -125,10 +125,13 @@ final class PlayerRegistration: BasePlayerRegistration, SideStorable {
} }
var tournamentStore: TournamentStore { var tournamentStore: TournamentStore {
if let store = self.store as? TournamentStore { guard let storeId else {
return store 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? { var computedAge: Int? {

@ -51,10 +51,15 @@ final class TeamScore: BaseTeamScore, SideStorable {
} }
var tournamentStore: TournamentStore { var tournamentStore: TournamentStore {
if let store = self.store as? TournamentStore { guard let storeId else {
return store 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 // MARK: - Computed dependencies

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

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

@ -70,7 +70,7 @@ struct ShareModelView<T: SyncedStorable> : View {
.listStyle(PlainListStyle()) .listStyle(PlainListStyle())
.navigationTitle("Partage") .navigationTitle("Partage")
} else { } 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 { }.onAppear {

Loading…
Cancel
Save