pull/1551/head
gedoor 3 years ago
parent e00907ba33
commit 2cb23a2ef4
  1. 10
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt

@ -91,21 +91,19 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application)
fun selectionAddToGroups(sources: List<BookSource>, groups: String) {
execute {
val list = arrayListOf<BookSource>()
sources.forEach { source ->
list.add(source.copy().addGroup(groups))
source.addGroup(groups)
}
appDb.bookSourceDao.update(*list.toTypedArray())
appDb.bookSourceDao.update(*sources.toTypedArray())
}
}
fun selectionRemoveFromGroups(sources: List<BookSource>, groups: String) {
execute {
val list = arrayListOf<BookSource>()
sources.forEach { source ->
list.add(source.copy().removeGroup(groups))
source.removeGroup(groups)
}
appDb.bookSourceDao.update(*list.toTypedArray())
appDb.bookSourceDao.update(*sources.toTypedArray())
}
}

Loading…
Cancel
Save