Skip to content

Commit

Permalink
Merge pull request #707 from Infomaniak/switch-primary-mailbox
Browse files Browse the repository at this point in the history
fix: Select primary mailbox on switch
  • Loading branch information
Ambrdctr committed Apr 20, 2023
2 parents 187c159 + 28eb1da commit 891f0a3
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 891f0a3

Please sign in to comment.