|
|
|
|
@ -433,7 +433,7 @@ public class StoredCollection<T: Storable>: RandomAccessCollection, SomeCollecti |
|
|
|
|
|
|
|
|
|
/// Sends an insert api call for the provided [instance] |
|
|
|
|
fileprivate func _sendInsertionIfNecessary(_ instance: T) { |
|
|
|
|
guard self.synchronized, Store.main.collectionsCanSynchronize else { |
|
|
|
|
guard self.synchronized, self._canSynchronise() else { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
Task { |
|
|
|
|
@ -443,7 +443,7 @@ public class StoredCollection<T: Storable>: RandomAccessCollection, SomeCollecti |
|
|
|
|
|
|
|
|
|
/// Sends an update api call for the provided [instance] |
|
|
|
|
fileprivate func _sendUpdateIfNecessary(_ instance: T) { |
|
|
|
|
guard self.synchronized, self._sendsUpdate, Store.main.collectionsCanSynchronize else { |
|
|
|
|
guard self.synchronized, self._sendsUpdate, self._canSynchronise() else { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
Task { |
|
|
|
|
@ -453,7 +453,7 @@ public class StoredCollection<T: Storable>: RandomAccessCollection, SomeCollecti |
|
|
|
|
|
|
|
|
|
/// Sends an delete api call for the provided [instance] |
|
|
|
|
fileprivate func _sendDeletionIfNecessary(_ instance: T) { |
|
|
|
|
guard self.synchronized, Store.main.collectionsCanSynchronize else { |
|
|
|
|
guard self.synchronized, self._canSynchronise() else { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
Task { |
|
|
|
|
@ -461,6 +461,10 @@ public class StoredCollection<T: Storable>: RandomAccessCollection, SomeCollecti |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fileprivate func _canSynchronise() -> Bool { |
|
|
|
|
return Store.main.collectionsCanSynchronize && Store.main.userIsAllowed() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Reschedule the api calls if possible |
|
|
|
|
func rescheduleApiCallsIfNecessary() { |
|
|
|
|
Task { |
|
|
|
|
|