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

Commit ce78315f authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽
Browse files

Merge branch '5023-Add_load_more_functionality_for_allAccountList_page' into 'main'

5023-Add_load_more_functionality_for_allAccountList_page

See merge request !124
parents f32a3397 a5489dd3
Loading
Loading
Loading
Loading
Loading
+30 −4
Original line number Diff line number Diff line
@@ -399,6 +399,10 @@ class MessageListFragment :
    }

    override fun onFooterClicked() {
        if (onFooterClickForUnifiedInbox()) {
            return
        }

        val currentFolder = this.currentFolder ?: return

        if (currentFolder.moreMessages && !localSearch.isManualSearch) {
@@ -429,6 +433,20 @@ class MessageListFragment :
        }
    }

    private fun onFooterClickForUnifiedInbox(): Boolean {
        if (!isUnifiedInbox) {
            return false
        }

        preferences.accounts
            .filter { account -> account.isFinishedSetup && account.inboxFolderId != null }
            .forEach {
                messagingController.loadMoreMessages(it, it.inboxFolderId!!, null)
            }
        updateFooterText(null)
        return true
    }

    override fun onMessageClicked(messageListItem: MessageListItem) {
        if (!isActive) {
            // Ignore click events that are delivered after the Fragment is no longer active. This could happen when
@@ -801,12 +819,20 @@ class MessageListFragment :
    }

    private fun updateFooterText() {
        if (initialMessageListLoad) {
            updateFooterText(null)
            return
        }

        if(isUnifiedInbox && adapter.messages.isNotEmpty()) {
            updateFooterText(getString(R.string.message_list_load_more_messages_action))
            return
        }

        val currentFolder = this.currentFolder
        val account = this.account

        val footerText = if (initialMessageListLoad) {
            null
        } else if (localSearch.isManualSearch || currentFolder == null || account == null) {
        val footerText = if (localSearch.isManualSearch || currentFolder == null || account == null) {
            null
        } else if (currentFolder.loading) {
            getString(R.string.status_loading_more)
@@ -1374,8 +1400,8 @@ class MessageListFragment :

        currentFolder?.let { currentFolder ->
            currentFolder.moreMessages = messageListInfo.hasMoreMessages
            updateFooterText()
        }
        updateFooterText()
        adapter.checkSelectedMode()
    }