Skip to content

Commit

Permalink
fix: Select primary mailbox on switch
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeWeidmann committed Apr 19, 2023
1 parent 187c159 commit 28eb1da
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion MailCore/Cache/AccountManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,9 @@ public class AccountManager: RefreshTokenDelegate {

public func switchAccount(newAccount: Account) {
setCurrentAccount(account: newAccount)
setCurrentMailboxForCurrentAccount(mailbox: mailboxes.first!)
if let defaultMailbox = (mailboxes.first(where: { $0.isPrimary }) ?? mailboxes.first) {
setCurrentMailboxForCurrentAccount(mailbox: defaultMailbox)
}
saveAccounts()
}

Expand Down

0 comments on commit 28eb1da

Please sign in to comment.