@ -24,7 +24,9 @@ class BookSourceEditViewModel(application: Application) : BaseViewModel(applicat
fun save(bookSource: BookSource, finally: (() -> Unit)? = null) {
execute {
sourceLiveData.value?.let {
if (it.bookSourceUrl != bookSource.bookSourceUrl) {
App.db.bookSourceDao().delete(it)
}
} ?: let {
bookSource.customOrder = App.db.bookSourceDao().maxOrder + 1
@ -25,7 +25,9 @@ class RssSourceEditViewModel(application: Application) : BaseViewModel(applicati
fun save(rssSource: RssSource, success: (() -> Unit)) {
if (it.sourceUrl != rssSource.sourceUrl) {
App.db.rssSourceDao().delete(it)
rssSource.customOrder = App.db.rssSourceDao().maxOrder + 1