|
|
|
@ -88,6 +88,14 @@ class DataStore: ObservableObject { |
|
|
|
self.userStorage = store.registerObject(synchronized: synchronized) |
|
|
|
self.userStorage = store.registerObject(synchronized: synchronized) |
|
|
|
self.purchases = Store.main.registerCollection(synchronized: true, inMemory: true) |
|
|
|
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(collectionDidLoad), name: NSNotification.Name.CollectionDidLoad, object: nil) |
|
|
|
NotificationCenter.default.addObserver(self, selector: #selector(collectionDidUpdate), name: NSNotification.Name.CollectionDidChange, 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.userStorage.reset() |
|
|
|
self.purchases.reset() |
|
|
|
self.purchases.reset() |
|
|
|
|
|
|
|
|
|
|
|
// done after because otherwise folders remain |
|
|
|
|
|
|
|
for tournament in tournamendIds { |
|
|
|
|
|
|
|
StoreCenter.main.destroyStore(identifier: tournament.id) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Guard.main.disconnect() |
|
|
|
Guard.main.disconnect() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StoreCenter.main.disconnect() |
|
|
|
self.user = self._temporaryLocalUser.item ?? User.placeHolder() |
|
|
|
self.user = self._temporaryLocalUser.item ?? User.placeHolder() |
|
|
|
self.user.clubs.removeAll() |
|
|
|
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) { |
|
|
|
func copyToLocalServer(tournament: Tournament) { |
|
|
|
|