Rename shared property of Synced objects

sync3
Laurent 6 months ago
parent 7e9de23986
commit 0a83bddaf6
  1. 1
      LeStorage/ApiCallCollection.swift
  2. 6
      LeStorage/ModelObject.swift
  3. 1
      LeStorage/StoreCenter.swift

@ -251,6 +251,7 @@ actor ApiCallCollection<T: SyncedStorable>: SomeCallCollection {
@discardableResult func _executeGetCall(apiCall: ApiCall<T>) async throws -> Data {
let data = try await self.storeCenter.executeGet(apiCall: apiCall)
Logger.log("GET received = \(T.resourceName())")
if T.self == GetSyncData.self {
let syncData = try SyncData(data: data, storeCenter: self.storeCenter)

@ -65,7 +65,7 @@ open class SyncedModelObject: BaseModelObject {
enum CodingKeys: String, CodingKey {
case relatedUser
case lastUpdate
case shared = "_shared"
case sharing = "_sharing"
}
// Required initializer for Decodable
@ -73,7 +73,7 @@ open class SyncedModelObject: BaseModelObject {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.relatedUser = try container.decodeIfPresent(String.self, forKey: .relatedUser)
self.lastUpdate = try container.decodeIfPresent(Date.self, forKey: .lastUpdate) ?? Date()
self.sharing = try container.decodeIfPresent(SharingStatus.self, forKey: .shared)
self.sharing = try container.decodeIfPresent(SharingStatus.self, forKey: .sharing)
try super.init(from: decoder)
}
@ -84,7 +84,7 @@ open class SyncedModelObject: BaseModelObject {
try container.encode(relatedUser, forKey: .relatedUser)
try container.encode(lastUpdate, forKey: .lastUpdate)
if self.sharing != nil {
try container.encodeIfPresent(sharing, forKey: .shared)
try container.encodeIfPresent(sharing, forKey: .sharing)
}
try super.encode(to: encoder)

@ -615,6 +615,7 @@ public class StoreCenter {
}
let lastSync = self._settingsStorage.item.lastSynchronization
Logger.log("REQUEST sync: \(lastSync)")
let syncGetCollection: ApiCallCollection<GetSyncData> = try self.apiCallCollection()
if await syncGetCollection.hasPendingCalls() {

Loading…
Cancel
Save