Skip to content

Commit

Permalink
Fix sync issue
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldavidw committed Oct 6, 2024
1 parent 34cf48e commit 700643c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 9 deletions.
2 changes: 0 additions & 2 deletions Chronos/App/Onboarding/WelcomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -89,7 +88,6 @@ struct WelcomeView: View {
}
}
.onAppear(perform: {
swiftDataService.resetModelContainers()
iCloudSyncLastAttempt = 0

syncTimer = Timer.scheduledTimer(withTimeInterval: 2.5, repeats: false) { _ in
Expand Down
1 change: 0 additions & 1 deletion Chronos/Services/CryptoService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 1 addition & 6 deletions Chronos/Services/SwiftDataService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -151,7 +146,7 @@ extension SwiftDataService {

func deleteLocallyPersistedChronosData() {
getLocalModelContainer().deleteAllData()
resetModelContainers()
localModelContainer = setupModelContainer(storeName: "localChronos.sqlite", cloudKitDatabase: .none)
}

func permentalyDeleteAllIcloudData() {
Expand Down

0 comments on commit 700643c

Please sign in to comment.