pull/2676/head
Horis 2 years ago
parent 2d3c2d2134
commit 4aa96fd1aa
  1. 4
      app/src/main/java/io/legado/app/ui/book/group/GroupViewModel.kt

@ -17,12 +17,14 @@ class GroupViewModel(application: Application) : BaseViewModel(application) {
fun addGroup(groupName: String, cover: String?, finally: () -> Unit) {
execute {
val groupId = appDb.bookGroupDao.getUnusedId()
val bookGroup = BookGroup(
groupId = appDb.bookGroupDao.getUnusedId(),
groupId = groupId,
groupName = groupName,
cover = cover,
order = appDb.bookGroupDao.maxOrder.plus(1)
)
appDb.bookGroupDao.getByID(groupId) ?: appDb.bookDao.removeGroup(groupId)
appDb.bookGroupDao.insert(bookGroup)
}.onFinally {
finally()

Loading…
Cancel
Save