Remove now unused BackendFolder.getLastUid()
This commit is contained in:
parent
2331626170
commit
17e69419b8
8 changed files with 0 additions and 67 deletions
|
@ -35,10 +35,6 @@ class K9BackendFolder(
|
|||
visibleLimit = init.visibleLimit
|
||||
}
|
||||
|
||||
override fun getLastUid(): Long? {
|
||||
return messageStore.getLastUid(folderId)
|
||||
}
|
||||
|
||||
override fun getMessageServerIds(): Set<String> {
|
||||
return messageStore.getMessageServerIds(folderId)
|
||||
}
|
||||
|
|
|
@ -130,11 +130,6 @@ interface MessageStore {
|
|||
*/
|
||||
fun getHeaders(folderId: Long, messageServerId: String): List<Header>
|
||||
|
||||
/**
|
||||
* Get highest UID (message server ID)
|
||||
*/
|
||||
fun getLastUid(folderId: Long): Long?
|
||||
|
||||
/**
|
||||
* Return the size of this message store in bytes.
|
||||
*/
|
||||
|
|
|
@ -78,16 +78,6 @@ class K9BackendFolderTest : K9RobolectricTest() {
|
|||
assertEquals(flags, messageFlags)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getLastUid() {
|
||||
createMessageInBackendFolder("200")
|
||||
createMessageInBackendFolder("123")
|
||||
|
||||
val lastUid = backendFolder.getLastUid()
|
||||
|
||||
assertEquals(200L, lastUid)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun saveCompleteMessage_withoutServerId_shouldThrow() {
|
||||
val message = createMessage(messageServerId = null)
|
||||
|
|
|
@ -108,10 +108,6 @@ class K9MessageStore(
|
|||
return retrieveMessageOperations.getHeaders(folderId, messageServerId)
|
||||
}
|
||||
|
||||
override fun getLastUid(folderId: Long): Long? {
|
||||
return retrieveMessageOperations.getLastUid(folderId)
|
||||
}
|
||||
|
||||
override fun destroyMessages(folderId: Long, messageServerIds: Collection<String>) {
|
||||
deleteMessageOperations.destroyMessages(folderId, messageServerIds)
|
||||
}
|
||||
|
|
|
@ -189,19 +189,4 @@ internal class RetrieveMessageOperations(private val lockableDatabase: LockableD
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getLastUid(folderId: Long): Long? {
|
||||
return lockableDatabase.execute(false) { database ->
|
||||
database.rawQuery(
|
||||
"SELECT MAX(uid) FROM messages WHERE folder_id = ?",
|
||||
arrayOf(folderId.toString())
|
||||
).use { cursor ->
|
||||
if (cursor.moveToFirst()) {
|
||||
cursor.getLongOrNull(0)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -169,27 +169,6 @@ class RetrieveMessageOperationsTest : RobolectricTest() {
|
|||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `get highest message uid`() {
|
||||
val folderId = sqliteDatabase.createFolder()
|
||||
sqliteDatabase.createMessage(uid = "42", folderId = folderId)
|
||||
sqliteDatabase.createMessage(uid = "23", folderId = folderId)
|
||||
sqliteDatabase.createMessage(uid = "27", folderId = folderId)
|
||||
|
||||
val highestUid = retrieveMessageOperations.getLastUid(folderId)
|
||||
|
||||
assertThat(highestUid).isEqualTo(42)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `get highest message uid should return null if there are no messages`() {
|
||||
val folderId = sqliteDatabase.createFolder()
|
||||
|
||||
val highestUid = retrieveMessageOperations.getLastUid(folderId)
|
||||
|
||||
assertThat(highestUid).isNull()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `get oldest message date`() {
|
||||
sqliteDatabase.createMessage(folderId = 1, date = 42)
|
||||
|
|
|
@ -14,7 +14,6 @@ interface BackendFolder {
|
|||
fun getAllMessagesAndEffectiveDates(): Map<String, Long?>
|
||||
fun destroyMessages(messageServerIds: List<String>)
|
||||
fun clearAllMessages()
|
||||
fun getLastUid(): Long?
|
||||
fun getMoreMessages(): MoreMessages
|
||||
fun setMoreMessages(moreMessages: MoreMessages)
|
||||
fun setLastChecked(timestamp: Long)
|
||||
|
|
|
@ -82,13 +82,6 @@ class InMemoryBackendFolder(override var name: String, var type: FolderType) : B
|
|||
destroyMessages(messages.keys.toList())
|
||||
}
|
||||
|
||||
override fun getLastUid(): Long? {
|
||||
// This is using string ordering because that's what K9BackendFolder is using, too.
|
||||
return messages.keys
|
||||
.maxOrNull()
|
||||
?.toLongOrNull()
|
||||
}
|
||||
|
||||
override fun getMoreMessages(): MoreMessages = moreMessages
|
||||
|
||||
override fun setMoreMessages(moreMessages: MoreMessages) {
|
||||
|
|
Loading…
Reference in a new issue