From 9b6a37e07a83fa1c96ee130aed695a7259d2586d Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 3 Oct 2019 15:08:56 +0800 Subject: [PATCH] up --- .../legado/app/ui/book/source/edit/BookSourceEditViewModel.kt | 4 +++- .../legado/app/ui/rss/source/edit/RssSourceEditViewModel.kt | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditViewModel.kt b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditViewModel.kt index 9c8a1d8ca..910c461a7 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditViewModel.kt @@ -24,7 +24,9 @@ class BookSourceEditViewModel(application: Application) : BaseViewModel(applicat fun save(bookSource: BookSource, finally: (() -> Unit)? = null) { execute { sourceLiveData.value?.let { - App.db.bookSourceDao().delete(it) + if (it.bookSourceUrl != bookSource.bookSourceUrl) { + App.db.bookSourceDao().delete(it) + } } ?: let { bookSource.customOrder = App.db.bookSourceDao().maxOrder + 1 } diff --git a/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditViewModel.kt b/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditViewModel.kt index b6dd3af87..f87438b9c 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditViewModel.kt @@ -25,7 +25,9 @@ class RssSourceEditViewModel(application: Application) : BaseViewModel(applicati fun save(rssSource: RssSource, success: (() -> Unit)) { execute { sourceLiveData.value?.let { - App.db.rssSourceDao().delete(it) + if (it.sourceUrl != rssSource.sourceUrl) { + App.db.rssSourceDao().delete(it) + } } ?: let { rssSource.customOrder = App.db.rssSourceDao().maxOrder + 1 }