Remove Folder.serverId property
This commit is contained in:
parent
01ae362ae5
commit
1a96ef4641
3 changed files with 17 additions and 24 deletions
|
@ -44,7 +44,6 @@ class FolderRepository(
|
|||
"folders",
|
||||
arrayOf(
|
||||
"id",
|
||||
"server_id",
|
||||
"name",
|
||||
"local_only"
|
||||
),
|
||||
|
@ -58,10 +57,9 @@ class FolderRepository(
|
|||
val id = cursor.getLong(0)
|
||||
Folder(
|
||||
id = id,
|
||||
serverId = cursor.getString(1),
|
||||
name = cursor.getString(2),
|
||||
name = cursor.getString(1),
|
||||
type = folderTypeOf(id),
|
||||
isLocalOnly = cursor.getInt(3) == 1
|
||||
isLocalOnly = cursor.getInt(2) == 1
|
||||
)
|
||||
} else {
|
||||
null
|
||||
|
@ -77,7 +75,6 @@ class FolderRepository(
|
|||
"folders",
|
||||
arrayOf(
|
||||
"id",
|
||||
"server_id",
|
||||
"name",
|
||||
"top_group",
|
||||
"integrate",
|
||||
|
@ -98,17 +95,16 @@ class FolderRepository(
|
|||
FolderDetails(
|
||||
folder = Folder(
|
||||
id = id,
|
||||
serverId = cursor.getString(1),
|
||||
name = cursor.getString(2),
|
||||
name = cursor.getString(1),
|
||||
type = folderTypeOf(id),
|
||||
isLocalOnly = cursor.getInt(9) == 1
|
||||
isLocalOnly = cursor.getInt(8) == 1
|
||||
),
|
||||
isInTopGroup = cursor.getInt(3) == 1,
|
||||
isIntegrate = cursor.getInt(4) == 1,
|
||||
syncClass = cursor.getStringOrNull(5).toFolderClass(),
|
||||
displayClass = cursor.getStringOrNull(6).toFolderClass(),
|
||||
notifyClass = cursor.getStringOrNull(7).toFolderClass(),
|
||||
pushClass = cursor.getStringOrNull(8).toFolderClass()
|
||||
isInTopGroup = cursor.getInt(2) == 1,
|
||||
isIntegrate = cursor.getInt(3) == 1,
|
||||
syncClass = cursor.getStringOrNull(4).toFolderClass(),
|
||||
displayClass = cursor.getStringOrNull(5).toFolderClass(),
|
||||
notifyClass = cursor.getStringOrNull(6).toFolderClass(),
|
||||
pushClass = cursor.getStringOrNull(7).toFolderClass()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -227,7 +223,7 @@ class FolderRepository(
|
|||
|
||||
private fun getDisplayFolders(db: SQLiteDatabase, displayMode: FolderMode): List<DisplayFolder> {
|
||||
val queryBuilder = StringBuilder("""
|
||||
SELECT f.id, f.server_id, f.name, f.top_group, f.local_only, (
|
||||
SELECT f.id, f.name, f.top_group, f.local_only, (
|
||||
SELECT COUNT(m.id)
|
||||
FROM messages m
|
||||
WHERE m.folder_id = f.id AND m.empty = 0 AND m.deleted = 0 AND m.read = 0
|
||||
|
@ -244,14 +240,13 @@ class FolderRepository(
|
|||
|
||||
while (cursor.moveToNext()) {
|
||||
val id = cursor.getLong(0)
|
||||
val serverId = cursor.getString(1)
|
||||
val name = cursor.getString(2)
|
||||
val name = cursor.getString(1)
|
||||
val type = folderTypeOf(id)
|
||||
val isInTopGroup = cursor.getInt(3) == 1
|
||||
val isLocalOnly = cursor.getInt(4) == 1
|
||||
val unreadCount = cursor.getInt(5)
|
||||
val isInTopGroup = cursor.getInt(2) == 1
|
||||
val isLocalOnly = cursor.getInt(3) == 1
|
||||
val unreadCount = cursor.getInt(4)
|
||||
|
||||
val folder = Folder(id, serverId, name, type, isLocalOnly)
|
||||
val folder = Folder(id, name, type, isLocalOnly)
|
||||
displayFolders.add(DisplayFolder(folder, isInTopGroup, unreadCount))
|
||||
}
|
||||
|
||||
|
@ -334,7 +329,7 @@ class FolderRepository(
|
|||
}
|
||||
}
|
||||
|
||||
data class Folder(val id: Long, val serverId: String, val name: String, val type: FolderType, val isLocalOnly: Boolean)
|
||||
data class Folder(val id: Long, val name: String, val type: FolderType, val isLocalOnly: Boolean)
|
||||
|
||||
data class RemoteFolder(val id: Long, val serverId: String, val name: String, val type: FolderType)
|
||||
|
||||
|
|
|
@ -132,7 +132,6 @@ class UnreadWidgetDataProviderTest : AppRobolectricTest() {
|
|||
const val LOCALIZED_FOLDER_NAME = "Posteingang"
|
||||
val FOLDER = Folder(
|
||||
id = FOLDER_ID,
|
||||
serverId = "irrelevant",
|
||||
name = "INBOX",
|
||||
type = FolderType.INBOX,
|
||||
isLocalOnly = false
|
||||
|
|
|
@ -20,7 +20,6 @@ class FolderInfoHolder(
|
|||
val folderId = localFolder.databaseId
|
||||
val folder = Folder(
|
||||
id = folderId,
|
||||
serverId = localFolder.serverId,
|
||||
name = localFolder.name,
|
||||
type = getFolderType(account, folderId),
|
||||
isLocalOnly = localFolder.isLocalOnly
|
||||
|
|
Loading…
Reference in a new issue