From 47e0ea17aad8f2b6022e8067f02fb48c4aac8829 Mon Sep 17 00:00:00 2001 From: Laurent Date: Tue, 17 Jun 2025 08:28:31 +0200 Subject: [PATCH 1/4] Put deleteNoSync as public --- LeStorage/SyncedCollection.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LeStorage/SyncedCollection.swift b/LeStorage/SyncedCollection.swift index 09b55f5..fc493d4 100644 --- a/LeStorage/SyncedCollection.swift +++ b/LeStorage/SyncedCollection.swift @@ -290,11 +290,11 @@ public class SyncedCollection: BaseCollection, SomeSynced } /// Deletes the instance in the collection without synchronization - func deleteNoSync(instance: T) { + public func deleteNoSync(instance: T, cascading: Bool = false) { defer { self.setChanged() } - self.deleteItem(instance, shouldBeSynchronized: false) + self.deleteItem(instance, shouldBeSynchronized: cascading) } /// Deletes the instance in the collection without synchronization From 678236c7fabfc8044beff42e512378e709efa3f4 Mon Sep 17 00:00:00 2001 From: Laurent Date: Tue, 15 Jul 2025 11:11:19 +0200 Subject: [PATCH 2/4] add a protection from sync --- LeStorage/StoreCenter.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LeStorage/StoreCenter.swift b/LeStorage/StoreCenter.swift index f45f493..ead05f1 100644 --- a/LeStorage/StoreCenter.swift +++ b/LeStorage/StoreCenter.swift @@ -576,7 +576,7 @@ public class StoreCenter { /// Basically asks the server for new content public func synchronizeLastUpdates() async throws { - guard self.isAuthenticated else { + guard self.isAuthenticated, self.useSynchronization else { return } From 94ae4ae654070d31d087d0e3972141c1ca9c8105 Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Sun, 17 Aug 2025 09:03:48 +0200 Subject: [PATCH 3/4] update 2026 rules --- LeStorage/Store.swift | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/LeStorage/Store.swift b/LeStorage/Store.swift index 4965368..bff9a18 100644 --- a/LeStorage/Store.swift +++ b/LeStorage/Store.swift @@ -19,6 +19,29 @@ public enum StoreError: Error, LocalizedError { case synchronizationInactive case storeNotRegistered(id: String) + public var localizedDescription: String { + switch self { + case .missingService: + return "L'instance des services est nulle" + case .missingUsername: + return "Le nom d'utilisateur est manquant" + case .missingUserId: + return "L'identifiant utilisateur est manquant" + case .missingToken: + return "Aucun token n'est stocké" + case .missingKeychainStore: + return "Aucun magasin de trousseau n'est disponible" + case .collectionNotRegistered(let type): + return "La collection \(type) n'est pas enregistrée" + case .apiCallCollectionNotRegistered(let type): + return "La collection d'appels API n'a pas été enregistrée pour \(type)" + case .synchronizationInactive: + return "La synchronisation n'est pas active sur ce StoreCenter" + case .storeNotRegistered(let id): + return "Le magasin avec l'identifiant \(id) n'est pas enregistré" + } + } + public var errorDescription: String? { switch self { case .missingService: From f738092e43a44b272e54f83fb6357caee5e43f42 Mon Sep 17 00:00:00 2001 From: Laurent Date: Wed, 24 Sep 2025 15:26:56 +0200 Subject: [PATCH 4/4] adds a way for other project to call services on the api --- LeStorage/Services.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/LeStorage/Services.swift b/LeStorage/Services.swift index 8066d67..73a7fd0 100644 --- a/LeStorage/Services.swift +++ b/LeStorage/Services.swift @@ -55,6 +55,15 @@ public class Services { // MARK: - Base + /// Runs a request on the API and returns the appropriate response + /// - Parameters: + /// - path: the path of the service in the api, ie. "create-users/" + /// - method: the HTTP method to call + /// - requiresToken: whether the token must be included in the request + public func run(path: String, method: HTTPMethod, requiresToken: Bool) async throws -> U { + return try await self._runRequest(serviceCall: ServiceCall(path: path, method: method, requiresToken: requiresToken)) + } + /// Runs a request using a configuration object /// - Parameters: /// - serviceConf: A instance of ServiceConf