Skip to content

Commit

Permalink
Simplify cloudbackupsclient
Browse files Browse the repository at this point in the history
  • Loading branch information
kugel3 committed Jun 6, 2024
1 parent 5eb7fa6 commit 1a5814f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import os
// MARK: - CloudBackupClient
public struct CloudBackupClient: DependencyKey, Sendable {
public let startAutomaticBackups: StartAutomaticBackups
public let loadDeviceID: LoadDeviceID
public let migrateProfilesFromKeychain: MigrateProfilesFromKeychain
public let deleteProfileBackup: DeleteProfileBackup
public let checkAccountStatus: CheckAccountStatus
Expand All @@ -16,7 +15,6 @@ public struct CloudBackupClient: DependencyKey, Sendable {

public init(
startAutomaticBackups: @escaping StartAutomaticBackups,
loadDeviceID: @escaping LoadDeviceID,
migrateProfilesFromKeychain: @escaping MigrateProfilesFromKeychain,
deleteProfileBackup: @escaping DeleteProfileBackup,
checkAccountStatus: @escaping CheckAccountStatus,
Expand All @@ -25,7 +23,6 @@ public struct CloudBackupClient: DependencyKey, Sendable {
loadProfileHeaders: @escaping LoadProfileHeaders
) {
self.startAutomaticBackups = startAutomaticBackups
self.loadDeviceID = loadDeviceID
self.migrateProfilesFromKeychain = migrateProfilesFromKeychain
self.deleteProfileBackup = deleteProfileBackup
self.checkAccountStatus = checkAccountStatus
Expand All @@ -37,7 +34,6 @@ public struct CloudBackupClient: DependencyKey, Sendable {

extension CloudBackupClient {
public typealias StartAutomaticBackups = @Sendable () async throws -> Void
public typealias LoadDeviceID = @Sendable () async -> UUID?
public typealias MigrateProfilesFromKeychain = @Sendable () async throws -> [CKRecord]
public typealias DeleteProfileBackup = @Sendable (ProfileID) async throws -> Void
public typealias CheckAccountStatus = @Sendable () async throws -> CKAccountStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,6 @@ extension CloudBackupClient {
}
}
},
loadDeviceID: {
try? secureStorageClient.loadDeviceInfo()?.id
},
migrateProfilesFromKeychain: {
let activeProfile = await profileStore.profile.id
let backedUpRecords = try await fetchAllProfileRecords()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ extension CloudBackupClient: TestDependencyKey {

public static let noop = Self(
startAutomaticBackups: {},
loadDeviceID: { nil },
migrateProfilesFromKeychain: { throw NoopError() },
deleteProfileBackup: { _ in },
checkAccountStatus: { throw NoopError() },
Expand All @@ -27,7 +26,6 @@ extension CloudBackupClient: TestDependencyKey {

public static let testValue = Self(
startAutomaticBackups: unimplemented("\(Self.self).startAutomaticBackups"),
loadDeviceID: unimplemented("\(Self.self).loadDeviceID"),
migrateProfilesFromKeychain: unimplemented("\(Self.self).migrateProfilesFromKeychain"),
deleteProfileBackup: unimplemented("\(Self.self).deleteProfileBackup"),
checkAccountStatus: unimplemented("\(Self.self).checkAccountStatus"),
Expand Down

0 comments on commit 1a5814f

Please sign in to comment.