Skip to content

Commit

Permalink
fix: MLS account not being deleted when logging out - WPB-15774 (#2572)
Browse files Browse the repository at this point in the history
  • Loading branch information
jullianm authored Feb 21, 2025
1 parent 6d22faf commit 46cc050
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
12 changes: 5 additions & 7 deletions wire-ios-sync-engine/Source/SessionManager/SessionManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -889,17 +889,15 @@ public final class SessionManager: NSObject, SessionManagerType {

requireInternal(activeUserSession.userId == account.userIdentifier, "User session and account are different")

delegate?.sessionManagerWillLogout(error: error, userSessionCanBeTornDown: { [dispatchGroup] in
dispatchGroup.enter()

delegate?.sessionManagerWillLogout(error: error) { [weak self] in
activeUserSession.close(deleteCookie: deleteCookie) {
if deleteAccount {
self.deleteAccountData(for: account)
self?.deleteAccountData(for: account)
}
dispatchGroup.leave()
}
self.activeUserSession = nil
})

self?.activeUserSession = nil
}
}

/// Loads a session for a given account
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ extension ZMUserSession {
deleteUserKeychainItems()
}

syncManagedObjectContext.dispatchGroup?.notify(on: .main) {
syncManagedObjectContext.perform {
self.tearDown()
completion()
}

completion()
}

public func logout(credentials: UserEmailCredentials, _ completion: @escaping (Result<Void, Error>) -> Void) {
Expand Down

0 comments on commit 46cc050

Please sign in to comment.