|
|
|
|
@ -20,7 +20,7 @@ public class StoreCenter { |
|
|
|
|
fileprivate var _stores: [String: Store] = [:] |
|
|
|
|
|
|
|
|
|
/// Returns a default Store instance |
|
|
|
|
lazy var mainStore: Store = { Store(storeCenter: self) }() |
|
|
|
|
public lazy var mainStore: Store = { Store(storeCenter: self) }() |
|
|
|
|
|
|
|
|
|
/// A KeychainStore object used to store the user's token |
|
|
|
|
var tokenKeychain: KeychainService? = nil |
|
|
|
|
@ -706,12 +706,13 @@ public class StoreCenter { |
|
|
|
|
|
|
|
|
|
fileprivate func _syncRevoke(_ revokeArrays: [ObjectIdentifierArray]) { |
|
|
|
|
|
|
|
|
|
Task { |
|
|
|
|
for revokeArray in revokeArrays { |
|
|
|
|
for revoked in revokeArray.items { |
|
|
|
|
self.synchronizationRevoke(id: revoked.modelId, type: revokeArray.type, storeId: revoked.storeId) |
|
|
|
|
await self.synchronizationRevoke(id: revoked.modelId, type: revokeArray.type, storeId: revoked.storeId) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Returns a Type object for a class name |
|
|
|
|
@ -772,11 +773,10 @@ public class StoreCenter { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Revokes a data that has been shared with the user |
|
|
|
|
@MainActor |
|
|
|
|
func synchronizationRevoke<T: SyncedStorable>(id: String, type: T.Type, storeId: String?) { |
|
|
|
|
|
|
|
|
|
DispatchQueue.main.async { |
|
|
|
|
do { |
|
|
|
|
// let type = try self.classFromName(model) |
|
|
|
|
if self._instanceShared(id: id, type: type) { |
|
|
|
|
let count = self.mainStore.referenceCount(type: type, id: id) |
|
|
|
|
if count == 0 { |
|
|
|
|
@ -787,7 +787,6 @@ public class StoreCenter { |
|
|
|
|
Logger.error(error) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Returns whether an instance has been shared with the user |
|
|
|
|
fileprivate func _instanceShared<T: SyncedStorable>(id: String, type: T.Type) -> Bool { |
|
|
|
|
|