diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt index cf1c8535c..68b739f20 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt +++ b/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, groups: String) { execute { - val list = arrayListOf() 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, groups: String) { execute { - val list = arrayListOf() sources.forEach { source -> - list.add(source.copy().removeGroup(groups)) + source.removeGroup(groups) } - appDb.bookSourceDao.update(*list.toTypedArray()) + appDb.bookSourceDao.update(*sources.toTypedArray()) } }