Merge pull request #5370 from k9mail/inbox_push_class
Set push class of Inbox to 'first class' by default
This commit is contained in:
commit
ec6e976198
7 changed files with 35 additions and 0 deletions
|
@ -201,6 +201,11 @@ class FolderRepository(
|
|||
messageStore.setSyncClass(folderId, folderClass)
|
||||
}
|
||||
|
||||
fun setPushClass(folderId: Long, folderClass: FolderClass) {
|
||||
val messageStore = messageStoreManager.getMessageStore(account)
|
||||
messageStore.setPushClass(folderId, folderClass)
|
||||
}
|
||||
|
||||
fun setNotificationClass(folderId: Long, folderClass: FolderClass) {
|
||||
val messageStore = messageStoreManager.getMessageStore(account)
|
||||
messageStore.setNotificationClass(folderId, folderClass)
|
||||
|
|
|
@ -36,6 +36,11 @@ class ListenableMessageStore(private val messageStore: MessageStore) : MessageSt
|
|||
notifyFolderSettingsChanged()
|
||||
}
|
||||
|
||||
override fun setPushClass(folderId: Long, folderClass: FolderClass) {
|
||||
messageStore.setPushClass(folderId, folderClass)
|
||||
notifyFolderSettingsChanged()
|
||||
}
|
||||
|
||||
override fun setNotificationClass(folderId: Long, folderClass: FolderClass) {
|
||||
messageStore.setNotificationClass(folderId, folderClass)
|
||||
notifyFolderSettingsChanged()
|
||||
|
|
|
@ -196,6 +196,11 @@ interface MessageStore {
|
|||
*/
|
||||
fun setSyncClass(folderId: Long, folderClass: FolderClass)
|
||||
|
||||
/**
|
||||
* Update the push class of a folder.
|
||||
*/
|
||||
fun setPushClass(folderId: Long, folderClass: FolderClass)
|
||||
|
||||
/**
|
||||
* Update the notification class of a folder.
|
||||
*/
|
||||
|
|
|
@ -49,6 +49,7 @@ class SpecialFolderUpdater(
|
|||
folderRepository.setIncludeInUnifiedInbox(newInboxId, true)
|
||||
folderRepository.setDisplayClass(newInboxId, FolderClass.FIRST_CLASS)
|
||||
folderRepository.setSyncClass(newInboxId, FolderClass.FIRST_CLASS)
|
||||
folderRepository.setPushClass(newInboxId, FolderClass.FIRST_CLASS)
|
||||
folderRepository.setNotificationClass(newInboxId, FolderClass.FIRST_CLASS)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,6 +153,10 @@ class K9MessageStore(
|
|||
updateFolderOperations.setSyncClass(folderId, folderClass)
|
||||
}
|
||||
|
||||
override fun setPushClass(folderId: Long, folderClass: FolderClass) {
|
||||
updateFolderOperations.setPushClass(folderId, folderClass)
|
||||
}
|
||||
|
||||
override fun setNotificationClass(folderId: Long, folderClass: FolderClass) {
|
||||
updateFolderOperations.setNotificationClass(folderId, folderClass)
|
||||
}
|
||||
|
|
|
@ -53,6 +53,10 @@ internal class UpdateFolderOperations(private val lockableDatabase: LockableData
|
|||
setString(folderId = folderId, columnName = "poll_class", value = folderClass.name)
|
||||
}
|
||||
|
||||
fun setPushClass(folderId: Long, folderClass: FolderClass) {
|
||||
setString(folderId = folderId, columnName = "push_class", value = folderClass.name)
|
||||
}
|
||||
|
||||
fun setNotificationClass(folderId: Long, folderClass: FolderClass) {
|
||||
setString(folderId = folderId, columnName = "notify_class", value = folderClass.name)
|
||||
}
|
||||
|
|
|
@ -98,6 +98,17 @@ class UpdateFolderOperationsTest : RobolectricTest() {
|
|||
assertThat(folder.syncClass).isEqualTo("NO_CLASS")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `update push class`() {
|
||||
val folderId = sqliteDatabase.createFolder(pushClass = "FIRST_CLASS")
|
||||
|
||||
updateFolderOperations.setPushClass(folderId = folderId, folderClass = FolderClass.NO_CLASS)
|
||||
|
||||
val folder = sqliteDatabase.readFolders().first()
|
||||
assertThat(folder.id).isEqualTo(folderId)
|
||||
assertThat(folder.pushClass).isEqualTo("NO_CLASS")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `update notification class`() {
|
||||
val folderId = sqliteDatabase.createFolder(syncClass = "FIRST_CLASS")
|
||||
|
|
Loading…
Reference in a new issue