Skip to content

Commit

Permalink
Delete remote profiles on local removal
Browse files Browse the repository at this point in the history
Remote copies are retained but stop syncing.
  • Loading branch information
keeshux committed Oct 3, 2024
1 parent 27b7e62 commit 612a535
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,21 @@ extension ProfileManager {

public func remove(withIds profileIds: [Profile.ID]) async {
do {
// remove local profiles
var newAllProfiles = allProfiles
try await repository.removeEntities(withIds: profileIds)
profileIds.forEach {
newAllProfiles.removeValue(forKey: $0)
}
await afterRemove?(profileIds)

// remove remote counterpart too
try? await remoteRepository?.removeEntities(withIds: profileIds)
profileIds.forEach {
allRemoteProfiles.removeValue(forKey: $0)
}

// publish update
allProfiles = newAllProfiles
didChange.send(.remove(profileIds))
} catch {
Expand Down

0 comments on commit 612a535

Please sign in to comment.