From 9a8ff86f56e5f0ad6b1a745dacf6c541d2b435df Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Wed, 3 Jan 2024 19:10:28 +0600 Subject: [PATCH 1/2] Revert "caching operation in IO dispatchers" This reverts commit 62a084d4e9b2ffe15ce6d5ff7d8c7fcab3536f09. --- .../java/com/fsck/k9/ui/messagelist/EmailCache.kt | 3 ++- .../fsck/k9/ui/messagelist/MessageListLiveData.kt | 12 +++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/EmailCache.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/EmailCache.kt index d4e6839294..f1ff13198c 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/EmailCache.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/EmailCache.kt @@ -20,6 +20,7 @@ import android.content.Context import androidx.datastore.preferences.core.edit import androidx.datastore.preferences.core.stringPreferencesKey import androidx.datastore.preferences.preferencesDataStore +import com.fsck.k9.Account import com.fsck.k9.controller.MessageReference import com.google.gson.Gson import com.google.gson.TypeAdapter @@ -54,7 +55,7 @@ class EmailCache constructor(private val context: Context, private val gson: Gso } suspend fun saveLatestMails(mailList: List) { - if (mailList.size < MAX_CACHE_SIZE || isCacheShown) return + if (isCacheShown) return isCacheShown = true val cachedMailsWithLatest = getLatestMails(mailList) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListLiveData.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListLiveData.kt index 77cb52c9c9..3644e3fa3c 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListLiveData.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListLiveData.kt @@ -25,21 +25,15 @@ class MessageListLiveData( private fun loadMessageListAsync() { coroutineScope.launch(Dispatchers.Main) { - val cachedMessages = withContext(Dispatchers.IO) { - emailCache.getCachedMails() - } - - cachedMessages?.let { + emailCache.getCachedMails()?.let { value = MessageListInfo(it, true) } val messageList = withContext(Dispatchers.IO) { - val result = messageListLoader.getMessageList(config) - emailCache.saveLatestMails(result.messageListItems) - result + messageListLoader.getMessageList(config) } - value = messageList + emailCache.saveLatestMails(messageList.messageListItems) } } -- GitLab From 0d8fdc8a284e53171de87eb70084c4e8bab62cdf Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Wed, 3 Jan 2024 19:17:08 +0600 Subject: [PATCH 2/2] fix button text not visible in lightmode issue --- app/ui/legacy/src/main/res/layout/message.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/ui/legacy/src/main/res/layout/message.xml b/app/ui/legacy/src/main/res/layout/message.xml index 37f9cec399..6c21110d5c 100644 --- a/app/ui/legacy/src/main/res/layout/message.xml +++ b/app/ui/legacy/src/main/res/layout/message.xml @@ -41,6 +41,7 @@ the 'message view theme' setting).