Add support for retrieving a folder's last checked time via MessageStore

This commit is contained in:
cketti 2021-08-14 20:48:14 +02:00
parent 3252002629
commit bc366e98eb
2 changed files with 9 additions and 3 deletions

View file

@ -21,6 +21,7 @@ interface FolderDetailsAccessor {
val pushClass: FolderClass
val visibleLimit: Int
val moreMessages: MoreMessages
val lastChecked: Long?
val unreadMessageCount: Int
val starredMessageCount: Int

View file

@ -1,6 +1,7 @@
package com.fsck.k9.storage.messages
import android.database.Cursor
import androidx.core.database.getLongOrNull
import com.fsck.k9.Account.FolderMode
import com.fsck.k9.helper.map
import com.fsck.k9.mail.FolderClass
@ -171,11 +172,14 @@ private class CursorFolderAccessor(val cursor: Cursor) : FolderDetailsAccessor {
override val moreMessages: MoreMessages
get() = MoreMessages.fromDatabaseName(cursor.getString(12))
override val lastChecked: Long?
get() = cursor.getLongOrNull(13)
override val unreadMessageCount: Int
get() = cursor.getInt(13)
get() = cursor.getInt(14)
override val starredMessageCount: Int
get() = cursor.getInt(14)
get() = cursor.getInt(15)
override fun serverIdOrThrow(): String {
return serverId ?: error("No server ID found for folder '$name' ($id)")
@ -199,5 +203,6 @@ private val FOLDER_COLUMNS = arrayOf(
"notify_class",
"push_class",
"visible_limit",
"more_messages"
"more_messages",
"last_updated"
)