Merge pull request #5145 from k9mail/message_list_back_button

Go to Unified Inbox when pressing back in message list
This commit is contained in:
cketti 2021-02-16 17:09:02 +01:00 committed by GitHub
commit 998c5d1fbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -586,12 +586,20 @@ open class MessageList :
showMessageList()
} else {
if (isDrawerEnabled && account != null && supportFragmentManager.backStackEntryCount == 0) {
val defaultFolderId = defaultFolderProvider.getDefaultFolder(account!!)
val currentFolder = if (singleFolderMode) search!!.folderIds[0] else null
if (currentFolder == null || defaultFolderId != currentFolder) {
openFolderImmediately(defaultFolderId)
if (K9.isShowUnifiedInbox) {
if (search!!.id != SearchAccount.UNIFIED_INBOX) {
openUnifiedInbox()
} else {
super.onBackPressed()
}
} else {
super.onBackPressed()
val defaultFolderId = defaultFolderProvider.getDefaultFolder(account!!)
val currentFolder = if (singleFolderMode) search!!.folderIds[0] else null
if (currentFolder == null || defaultFolderId != currentFolder) {
openFolderImmediately(defaultFolderId)
} else {
super.onBackPressed()
}
}
} else {
super.onBackPressed()