|
|
@ -161,7 +161,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
) |
|
|
|
) |
|
|
|
book.durChapterTitle = chapters[book.durChapterIndex].title |
|
|
|
book.durChapterTitle = chapters[book.durChapterIndex].title |
|
|
|
if (inBookshelf) { |
|
|
|
if (inBookshelf) { |
|
|
|
App.db.bookDao().insert(book) |
|
|
|
App.db.bookDao().update(book) |
|
|
|
App.db.bookChapterDao().insert(*chapters.toTypedArray()) |
|
|
|
App.db.bookChapterDao().insert(*chapters.toTypedArray()) |
|
|
|
} |
|
|
|
} |
|
|
|
bookData.postValue(book) |
|
|
|
bookData.postValue(book) |
|
|
@ -179,7 +179,11 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
book.durChapterPos = it.durChapterPos |
|
|
|
book.durChapterPos = it.durChapterPos |
|
|
|
book.durChapterTitle = it.durChapterTitle |
|
|
|
book.durChapterTitle = it.durChapterTitle |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (App.db.bookDao().getBook(book.bookUrl) != null) { |
|
|
|
|
|
|
|
App.db.bookDao().update(book) |
|
|
|
|
|
|
|
} else { |
|
|
|
App.db.bookDao().insert(book) |
|
|
|
App.db.bookDao().insert(book) |
|
|
|
|
|
|
|
} |
|
|
|
if (ReadBook.book?.name == book.name && ReadBook.book?.author == book.author) { |
|
|
|
if (ReadBook.book?.name == book.name && ReadBook.book?.author == book.author) { |
|
|
|
ReadBook.book = book |
|
|
|
ReadBook.book = book |
|
|
|
} |
|
|
|
} |
|
|
|