mirror of https://github.com/readrops/Readrops.git
Implement Nextcloud News add/update/delete folder actions
This commit is contained in:
parent
116a1b9722
commit
23fd22afff
|
@ -111,6 +111,23 @@ class NextcloudNewsRepository(
|
|||
super.deleteFeed(feed)
|
||||
}
|
||||
|
||||
override suspend fun addFolder(folder: Folder) {
|
||||
val folders = dataSource.createFolder(folder.name!!)
|
||||
.onEach { it.accountId = account.id }
|
||||
|
||||
database.newFolderDao().insert(folders)
|
||||
}
|
||||
|
||||
override suspend fun updateFolder(folder: Folder) {
|
||||
dataSource.renameFolder(folder.name!!, folder.remoteId!!.toInt())
|
||||
super.updateFolder(folder)
|
||||
}
|
||||
|
||||
override suspend fun deleteFolder(folder: Folder) {
|
||||
dataSource.deleteFolder(folder.remoteId!!.toInt())
|
||||
super.deleteFolder(folder)
|
||||
}
|
||||
|
||||
private suspend fun insertFolders(folders: List<Folder>) {
|
||||
folders.forEach { it.accountId = account.id }
|
||||
database.newFolderDao().upsertFolders(folders, account)
|
||||
|
@ -140,6 +157,7 @@ class NextcloudNewsRepository(
|
|||
) {
|
||||
database.newItemDao()
|
||||
.updateReadAndStarState(item.remoteId!!, item.isRead, item.isStarred)
|
||||
continue
|
||||
}
|
||||
|
||||
item.feedId = feedId
|
||||
|
|
|
@ -55,7 +55,9 @@ abstract class BaseRepository(
|
|||
|
||||
open suspend fun deleteFeed(feed: Feed) = database.newFeedDao().delete(feed)
|
||||
|
||||
open suspend fun addFolder(folder: Folder) = database.newFolderDao().insert(folder)
|
||||
open suspend fun addFolder(folder: Folder) {
|
||||
database.newFolderDao().insert(folder)
|
||||
}
|
||||
|
||||
open suspend fun updateFolder(folder: Folder) = database.newFolderDao().update(folder)
|
||||
|
||||
|
|
Loading…
Reference in New Issue