Merge remote-tracking branch 'refs/remotes/origin/main'

sync2
Raz 1 year ago
commit 3b62bd8a79
  1. 20
      PadelClub/Data/DataStore.swift

@ -88,6 +88,14 @@ class DataStore: ObservableObject {
self.userStorage = store.registerObject(synchronized: synchronized)
self.purchases = Store.main.registerCollection(synchronized: true, inMemory: true)
// Load ApiCallCollection, making them restart at launch and deletable on disconnect
StoreCenter.main.loadApiCallCollection(type: GroupStage.self)
StoreCenter.main.loadApiCallCollection(type: Round.self)
StoreCenter.main.loadApiCallCollection(type: PlayerRegistration.self)
StoreCenter.main.loadApiCallCollection(type: TeamRegistration.self)
StoreCenter.main.loadApiCallCollection(type: Match.self)
StoreCenter.main.loadApiCallCollection(type: TeamScore.self)
NotificationCenter.default.addObserver(self, selector: #selector(collectionDidLoad), name: NSNotification.Name.CollectionDidLoad, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(collectionDidUpdate), name: NSNotification.Name.CollectionDidChange, object: nil)
@ -210,17 +218,17 @@ class DataStore: ObservableObject {
self.userStorage.reset()
self.purchases.reset()
// done after because otherwise folders remain
for tournament in tournamendIds {
StoreCenter.main.destroyStore(identifier: tournament.id)
}
Guard.main.disconnect()
StoreCenter.main.disconnect()
self.user = self._temporaryLocalUser.item ?? User.placeHolder()
self.user.clubs.removeAll()
StoreCenter.main.disconnect()
// done after because otherwise folders remain
for tournament in tournamendIds {
StoreCenter.main.destroyStore(identifier: tournament.id)
}
}
func copyToLocalServer(tournament: Tournament) {

Loading…
Cancel
Save