Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ABW-3396] Claim Wallet #1161

Merged
merged 63 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
4652195
Refactor ResetWallet
kugel3 Jun 4, 2024
872ef7c
wip
kugel3 Jun 4, 2024
5d4d434
wip
kugel3 Jun 4, 2024
945aca8
wip
kugel3 Jun 5, 2024
41effd9
wip
kugel3 Jun 5, 2024
84f2e99
wip
kugel3 Jun 5, 2024
e13d995
wip
kugel3 Jun 5, 2024
58bac33
wip, with debug code
kugel3 Jun 5, 2024
790f57b
cleanup
kugel3 Jun 5, 2024
f3ef1c0
Fix TCA error
kugel3 Jun 4, 2024
baafd24
make tests build
kugel3 Jun 5, 2024
77f5626
Change when to show yellow items
kugel3 Jun 6, 2024
ac0c7e7
Remove unneeded reclaimProfile
kugel3 Jun 6, 2024
b8d86a6
Comment fix
kugel3 Jun 6, 2024
86ccf9c
Pass in profile
kugel3 Jun 6, 2024
c5b47c5
Turn off keychain sync less often
kugel3 Jun 6, 2024
b5406c3
remove unused dismiss
kugel3 Jun 6, 2024
b5edba5
add support for TCA dismiss() in fullscreen overlay
kugel3 Jun 6, 2024
4825e87
PROFILESTORE: stop emitting
kugel3 Jun 6, 2024
b7e6a43
remove cloud import
kugel3 Jun 6, 2024
fcd84e9
don't sync new profiles to icloud keychain
kugel3 Jun 6, 2024
531ff3f
Remove isInCloud
kugel3 Jun 6, 2024
f37750b
simplify
kugel3 Jun 6, 2024
c406537
remove lookupProfileSnapshotByHeader
kugel3 Jun 6, 2024
d5316cc
Delete ProfileBackupSettings
kugel3 Jun 6, 2024
895d9fd
Remove loadProfileBackups
kugel3 Jun 6, 2024
82875d9
Rename and refactor backupsclient
kugel3 Jun 6, 2024
631f155
Remove unused
kugel3 Jun 6, 2024
142b97b
saveHash -> saveIdentifier
kugel3 Jun 6, 2024
30b68b7
simplify SecureStorageClient
kugel3 Jun 6, 2024
68d80d5
Simplify AppPreferencesClient
kugel3 Jun 6, 2024
bea783e
Simplify cloudbackupsclient
kugel3 Jun 6, 2024
829590e
wip claim profile
kugel3 Jun 6, 2024
f2baedd
Make import and claiming work correctly
kugel3 Jun 7, 2024
60b4406
Move loading
kugel3 Jun 7, 2024
e73e9ab
Don't stop migration if profile is missing from keychain
kugel3 Jun 7, 2024
91443f0
PROFILESTORE temp
kugel3 Jun 7, 2024
d0758d3
don't migrate if we have newer backed up
kugel3 Jun 7, 2024
d9458f5
fix problems 3 and 9
kugel3 Jun 7, 2024
e1017f5
remove duplicates
kugel3 Jun 7, 2024
eede0cb
SecurityCenterClient improvements (#1167)
matiasbzurovski Jun 7, 2024
aac177b
Stop checking header against profile
kugel3 Jun 7, 2024
0b412dd
small refactor
kugel3 Jun 7, 2024
855098f
Refine backup status
kugel3 Jun 7, 2024
671c988
wip
kugel3 Jun 7, 2024
6c0af5f
wip
kugel3 Jun 7, 2024
11de1f1
wip
kugel3 Jun 7, 2024
b0f1966
wip
kugel3 Jun 7, 2024
f470f44
fixed
kugel3 Jun 7, 2024
fe183f9
matias fix
kugel3 Jun 7, 2024
d9a2d7a
migration speedup
kugel3 Jun 9, 2024
ef04213
PROFILESTORE remove ConflictingOwners
kugel3 Jun 9, 2024
1006b54
LastUSedDevice on backup cards
kugel3 Jun 9, 2024
a868f90
Fix tests
kugel3 Jun 9, 2024
a5a2e33
PROFILESTORE remove mode
kugel3 Jun 9, 2024
4c06211
fix tests
kugel3 Jun 9, 2024
b051682
Avoid a potential claim edge case issue
kugel3 Jun 10, 2024
97cbff1
Update "Last backup" logic
kugel3 Jun 10, 2024
7748ef8
subtly better
kugel3 Jun 10, 2024
c1d06fd
Fix elusive problem
kugel3 Jun 11, 2024
6d06317
check if backup file still exists
kugel3 Jun 11, 2024
b271202
bug or on purpose?
kugel3 Jun 11, 2024
89680e8
changes after Alex feedback
matiasbzurovski Jun 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 15 additions & 35 deletions RadixWallet.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ public struct AppPreferencesClient: Sendable {
public var getPreferences: GetPreferences
public var updatePreferences: UpdatePreferences

/// Needs special treatment since this setting involves Keychain and iCloud
public var setIsCloudProfileSyncEnabled: SetIsCloudProfileSyncEnabled

/// Sets the flag on the profile, does not delete old backups
public var setIsCloudBackupEnabled: SetIsCloudBackupEnabled

Expand All @@ -21,23 +18,20 @@ public struct AppPreferencesClient: Sendable {
updatePreferences: @escaping UpdatePreferences,
extractProfile: @escaping ExtractProfile,
deleteProfileAndFactorSources: @escaping DeleteProfile,
setIsCloudProfileSyncEnabled: @escaping SetIsCloudProfileSyncEnabled,
setIsCloudBackupEnabled: @escaping SetIsCloudBackupEnabled
) {
self.appPreferenceUpdates = appPreferenceUpdates
self.getPreferences = getPreferences
self.updatePreferences = updatePreferences
self.extractProfile = extractProfile
self.deleteProfileAndFactorSources = deleteProfileAndFactorSources
self.setIsCloudProfileSyncEnabled = setIsCloudProfileSyncEnabled
self.setIsCloudBackupEnabled = setIsCloudBackupEnabled
}
}

// MARK: - Typealias
extension AppPreferencesClient {
public typealias AppPreferenceUpdates = @Sendable () async -> AnyAsyncSequence<AppPreferences>
public typealias SetIsCloudProfileSyncEnabled = @Sendable (Bool) async throws -> Void
public typealias SetIsCloudBackupEnabled = @Sendable (Bool) async throws -> Void
public typealias GetPreferences = @Sendable () async -> AppPreferences
public typealias UpdatePreferences = @Sendable (AppPreferences) async throws -> Void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,6 @@ extension AppPreferencesClient: DependencyKey {
deleteProfileAndFactorSources: { keepInICloudIfPresent in
try await profileStore.deleteProfile(keepInICloudIfPresent: keepInICloudIfPresent)
},
setIsCloudProfileSyncEnabled: { isEnabled in
@Dependency(\.secureStorageClient) var secureStorageClient
let profile = await profileStore.profile
let wasEnabled = profile.appPreferences.security.isCloudProfileSyncEnabled
guard wasEnabled != isEnabled else { return }

try await profileStore.updating { profile in
profile.appPreferences.security.isCloudProfileSyncEnabled = isEnabled
}
try secureStorageClient.updateIsCloudProfileSyncEnabled(
profile.id,
isEnabled ? .enable : .disable
)
},
setIsCloudBackupEnabled: { isEnabled in
let profile = await profileStore.profile
let wasEnabled = profile.appPreferences.security.isCloudProfileSyncEnabled
Expand All @@ -46,6 +32,5 @@ extension AppPreferencesClient: DependencyKey {
)
}

public typealias Value = AppPreferencesClient
public static let liveValue: Self = .live()
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ extension AppPreferencesClient: TestDependencyKey {
updatePreferences: unimplemented("\(Self.self).updatePreferences"),
extractProfile: unimplemented("\(Self.self).extractProfile"),
deleteProfileAndFactorSources: unimplemented("\(Self.self).deleteProfileAndFactorSources"),
setIsCloudProfileSyncEnabled: unimplemented("\(Self.self).setIsCloudProfileSyncEnabled"),
setIsCloudBackupEnabled: unimplemented("\(Self.self).setIsCloudBackupEnabled")
)
}
Expand All @@ -20,7 +19,6 @@ extension AppPreferencesClient {
updatePreferences: { _ in },
extractProfile: { fatalError() },
deleteProfileAndFactorSources: { _ in },
setIsCloudProfileSyncEnabled: { _ in },
setIsCloudBackupEnabled: { _ in }
)
}
59 changes: 0 additions & 59 deletions RadixWallet/Clients/BackupsClient/BackupsClient+Interface.swift

This file was deleted.

96 changes: 0 additions & 96 deletions RadixWallet/Clients/BackupsClient/BackupsClient+Live.swift

This file was deleted.

32 changes: 0 additions & 32 deletions RadixWallet/Clients/BackupsClient/BackupsClient+Test.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,44 @@ 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
public let lastBackup: LastBackup
public let loadProfile: LoadProfile
public let loadProfileHeaders: LoadProfileHeaders
public let claimProfileOnICloud: ClaimProfileOnICloud

public init(
startAutomaticBackups: @escaping StartAutomaticBackups,
loadDeviceID: @escaping LoadDeviceID,
migrateProfilesFromKeychain: @escaping MigrateProfilesFromKeychain,
deleteProfileBackup: @escaping DeleteProfileBackup,
checkAccountStatus: @escaping CheckAccountStatus,
lastBackup: @escaping LastBackup,
loadProfile: @escaping LoadProfile,
loadProfileHeaders: @escaping LoadProfileHeaders
loadProfileHeaders: @escaping LoadProfileHeaders,
claimProfileOnICloud: @escaping ClaimProfileOnICloud
) {
self.startAutomaticBackups = startAutomaticBackups
self.loadDeviceID = loadDeviceID
self.migrateProfilesFromKeychain = migrateProfilesFromKeychain
self.deleteProfileBackup = deleteProfileBackup
self.checkAccountStatus = checkAccountStatus
self.lastBackup = lastBackup
self.loadProfile = loadProfile
self.loadProfileHeaders = loadProfileHeaders
self.claimProfileOnICloud = claimProfileOnICloud
}
}

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
public typealias LastBackup = @Sendable (ProfileID) -> AnyAsyncSequence<BackupResult?>
public typealias LoadProfile = @Sendable (ProfileID) async throws -> BackedUpProfile
public typealias LoadProfileHeaders = @Sendable () async throws -> [Profile.Header]
public typealias ClaimProfileOnICloud = @Sendable (Profile) async throws -> Void
}

// MARK: CloudBackupClient.BackedUpProfile
Expand Down
Loading
Loading