Loading app/core/src/main/java/com/fsck/k9/controller/MessagingController.java +12 −9 Original line number Diff line number Diff line Loading @@ -508,16 +508,19 @@ public class MessagingController { public void loadMoreMessages(Account account, long folderId, MessagingListener listener) { try { LocalStore localStore = localStoreProvider.getInstance(account); LocalFolder localFolder = localStore.getFolder(folderId); if (localFolder.getVisibleLimit() > 0) { localFolder.setVisibleLimit(localFolder.getVisibleLimit() + account.getDisplayCount()); MessageStore messageStore = messageStoreManager.getMessageStore(account); Integer visibleLimit = messageStore.getFolder(folderId, FolderDetailsAccessor::getVisibleLimit); if (visibleLimit == null) { Timber.v("loadMoreMessages(%s, %d): Folder not found", account, folderId); return; } synchronizeMailbox(account, folderId, false, listener); } catch (MessagingException me) { throw new RuntimeException("Unable to set visible limit on folder", me); if (visibleLimit > 0) { int newVisibleLimit = visibleLimit + account.getDisplayCount(); messageStore.setVisibleLimit(folderId, newVisibleLimit); } synchronizeMailbox(account, folderId, false, listener); } /** Loading app/core/src/main/java/com/fsck/k9/mailstore/LocalFolder.java +0 −5 Original line number Diff line number Diff line Loading @@ -269,11 +269,6 @@ public class LocalFolder { }); } public int getVisibleLimit() throws MessagingException { open(); return visibleLimit; } public void setVisibleLimit(final int visibleLimit) throws MessagingException { updateMoreMessagesOnVisibleLimitChange(visibleLimit, this.visibleLimit); Loading app/core/src/main/java/com/fsck/k9/mailstore/MessageStore.kt +5 −0 Original line number Diff line number Diff line Loading @@ -276,6 +276,11 @@ interface MessageStore { */ fun setStatus(folderId: Long, status: String?) /** * Update a folder's "visible limit" value. */ fun setVisibleLimit(folderId: Long, visibleLimit: Int) /** * Delete folders. */ Loading app/storage/src/main/java/com/fsck/k9/storage/messages/K9MessageStore.kt +4 −0 Original line number Diff line number Diff line Loading @@ -224,6 +224,10 @@ class K9MessageStore( updateFolderOperations.setStatus(folderId, status) } override fun setVisibleLimit(folderId: Long, visibleLimit: Int) { updateFolderOperations.setVisibleLimit(folderId, visibleLimit) } override fun deleteFolders(folderServerIds: List<String>) { deleteFolderOperations.deleteFolders(folderServerIds) } Loading app/storage/src/main/java/com/fsck/k9/storage/messages/UpdateFolderOperations.kt +10 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,16 @@ internal class UpdateFolderOperations(private val lockableDatabase: LockableData setString(folderId = folderId, columnName = "status", value = status) } fun setVisibleLimit(folderId: Long, visibleLimit: Int) { lockableDatabase.execute(false) { db -> val contentValues = ContentValues().apply { put("visible_limit", visibleLimit) } db.update("folders", contentValues, "id = ?", arrayOf(folderId.toString())) } } private fun setString(folderId: Long, columnName: String, value: String?) { lockableDatabase.execute(false) { db -> val contentValues = ContentValues().apply { Loading Loading
app/core/src/main/java/com/fsck/k9/controller/MessagingController.java +12 −9 Original line number Diff line number Diff line Loading @@ -508,16 +508,19 @@ public class MessagingController { public void loadMoreMessages(Account account, long folderId, MessagingListener listener) { try { LocalStore localStore = localStoreProvider.getInstance(account); LocalFolder localFolder = localStore.getFolder(folderId); if (localFolder.getVisibleLimit() > 0) { localFolder.setVisibleLimit(localFolder.getVisibleLimit() + account.getDisplayCount()); MessageStore messageStore = messageStoreManager.getMessageStore(account); Integer visibleLimit = messageStore.getFolder(folderId, FolderDetailsAccessor::getVisibleLimit); if (visibleLimit == null) { Timber.v("loadMoreMessages(%s, %d): Folder not found", account, folderId); return; } synchronizeMailbox(account, folderId, false, listener); } catch (MessagingException me) { throw new RuntimeException("Unable to set visible limit on folder", me); if (visibleLimit > 0) { int newVisibleLimit = visibleLimit + account.getDisplayCount(); messageStore.setVisibleLimit(folderId, newVisibleLimit); } synchronizeMailbox(account, folderId, false, listener); } /** Loading
app/core/src/main/java/com/fsck/k9/mailstore/LocalFolder.java +0 −5 Original line number Diff line number Diff line Loading @@ -269,11 +269,6 @@ public class LocalFolder { }); } public int getVisibleLimit() throws MessagingException { open(); return visibleLimit; } public void setVisibleLimit(final int visibleLimit) throws MessagingException { updateMoreMessagesOnVisibleLimitChange(visibleLimit, this.visibleLimit); Loading
app/core/src/main/java/com/fsck/k9/mailstore/MessageStore.kt +5 −0 Original line number Diff line number Diff line Loading @@ -276,6 +276,11 @@ interface MessageStore { */ fun setStatus(folderId: Long, status: String?) /** * Update a folder's "visible limit" value. */ fun setVisibleLimit(folderId: Long, visibleLimit: Int) /** * Delete folders. */ Loading
app/storage/src/main/java/com/fsck/k9/storage/messages/K9MessageStore.kt +4 −0 Original line number Diff line number Diff line Loading @@ -224,6 +224,10 @@ class K9MessageStore( updateFolderOperations.setStatus(folderId, status) } override fun setVisibleLimit(folderId: Long, visibleLimit: Int) { updateFolderOperations.setVisibleLimit(folderId, visibleLimit) } override fun deleteFolders(folderServerIds: List<String>) { deleteFolderOperations.deleteFolders(folderServerIds) } Loading
app/storage/src/main/java/com/fsck/k9/storage/messages/UpdateFolderOperations.kt +10 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,16 @@ internal class UpdateFolderOperations(private val lockableDatabase: LockableData setString(folderId = folderId, columnName = "status", value = status) } fun setVisibleLimit(folderId: Long, visibleLimit: Int) { lockableDatabase.execute(false) { db -> val contentValues = ContentValues().apply { put("visible_limit", visibleLimit) } db.update("folders", contentValues, "id = ?", arrayOf(folderId.toString())) } } private fun setString(folderId: Long, columnName: String, value: String?) { lockableDatabase.execute(false) { db -> val contentValues = ContentValues().apply { Loading