Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6beeb1a authored by ByteHamster's avatar ByteHamster
Browse files

Refresh all accounts in unified inbox and account list

parent 686ad00c
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -208,19 +208,20 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K

            accountHeader.setActiveProfile((account.accountNumber + 1 shl DRAWER_ACCOUNT_SHIFT).toLong())
            accountHeader.headerBackgroundView.setColorFilter(account.chipColor, PorterDuff.Mode.MULTIPLY)
            viewModel.loadFolders(account)

            updateFooterItems()
        }

        // Account can be null to refresh all (unified inbox or account list).
        swipeRefreshLayout.setOnRefreshListener {
                messagingController.checkMail(parent, account, true, true, object : SimpleMessagingListener() {
            val accountToRefresh = if (accountHeader.isSelectionListShown) null else account
            messagingController.checkMail(parent, accountToRefresh, true, true, object : SimpleMessagingListener() {
                override fun checkMailFinished(context: Context?, account: Account?) {
                    swipeRefreshLayout.isRefreshing = false
                }
            })
        }

            viewModel.loadFolders(account)

            updateFooterItems()
        }
    }

    private fun updateFooterItems() {