From 700643cacf515499172632b7e6186bb2f48e04a6 Mon Sep 17 00:00:00 2001 From: Joel-David Date: Sun, 6 Oct 2024 18:27:54 +0800 Subject: [PATCH] Fix sync issue --- Chronos/App/Onboarding/WelcomeView.swift | 2 -- Chronos/Services/CryptoService.swift | 1 - Chronos/Services/SwiftDataService.swift | 7 +------ 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/Chronos/App/Onboarding/WelcomeView.swift b/Chronos/App/Onboarding/WelcomeView.swift index 674503f..13dd20c 100644 --- a/Chronos/App/Onboarding/WelcomeView.swift +++ b/Chronos/App/Onboarding/WelcomeView.swift @@ -4,7 +4,6 @@ import SwiftData import SwiftUI struct WelcomeView: View { - let swiftDataService = Container.shared.swiftDataService() let stateService = Container.shared.stateService() @Query var vaults: [Vault] @@ -89,7 +88,6 @@ struct WelcomeView: View { } } .onAppear(perform: { - swiftDataService.resetModelContainers() iCloudSyncLastAttempt = 0 syncTimer = Timer.scheduledTimer(withTimeInterval: 2.5, repeats: false) { _ in diff --git a/Chronos/Services/CryptoService.swift b/Chronos/Services/CryptoService.swift index a0c0858..7bd09dc 100644 --- a/Chronos/Services/CryptoService.swift +++ b/Chronos/Services/CryptoService.swift @@ -14,7 +14,6 @@ public class CryptoService { private let stateService = Container.shared.stateService() private let vaultService = Container.shared.vaultService() - private let swiftDataService = Container.shared.swiftDataService() // scrypt paramaters - n: 2^17, r: 8, p: 1 private let kdfParams = KdfParams(type: 0, n: 1 << 17, r: 8, p: 1) diff --git a/Chronos/Services/SwiftDataService.swift b/Chronos/Services/SwiftDataService.swift index b88acd6..ef18da4 100644 --- a/Chronos/Services/SwiftDataService.swift +++ b/Chronos/Services/SwiftDataService.swift @@ -100,11 +100,6 @@ public class SwiftDataService { } } - public func resetModelContainers() { - localModelContainer = setupModelContainer(storeName: "localChronos.sqlite", cloudKitDatabase: .none) - cloudModelContainer = setupModelContainer(storeName: "onlineChronos.sqlite", cloudKitDatabase: .automatic) - } - public func getCloudModelContainer() -> ModelContainer { return cloudModelContainer } @@ -151,7 +146,7 @@ extension SwiftDataService { func deleteLocallyPersistedChronosData() { getLocalModelContainer().deleteAllData() - resetModelContainers() + localModelContainer = setupModelContainer(storeName: "localChronos.sqlite", cloudKitDatabase: .none) } func permentalyDeleteAllIcloudData() {