mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-20 05:59:17 +01:00
More prevention fixes to make sure db doesn't add dup chapters when deeplinked
This commit is contained in:
parent
dcf3f56a05
commit
8df63bd384
@ -373,6 +373,12 @@ class ReaderPresenter(
|
|||||||
val id = db.insertManga(manga).executeOnIO().insertedId()
|
val id = db.insertManga(manga).executeOnIO().insertedId()
|
||||||
manga.id = id ?: manga.id
|
manga.id = id ?: manga.id
|
||||||
chapter.manga_id = manga.id
|
chapter.manga_id = manga.id
|
||||||
|
val matchingChapterId = db.getChapters(manga).executeOnIO().find { it.url == chapter.url }?.id
|
||||||
|
if (matchingChapterId != null) {
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
|
this@ReaderPresenter.init(manga, matchingChapterId)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
val chapterId = db.insertChapter(chapter).executeOnIO().insertedId() ?: return
|
val chapterId = db.insertChapter(chapter).executeOnIO().insertedId() ?: return
|
||||||
if (chapters.isNotEmpty()) {
|
if (chapters.isNotEmpty()) {
|
||||||
syncChaptersWithSource(
|
syncChaptersWithSource(
|
||||||
@ -385,6 +391,7 @@ class ReaderPresenter(
|
|||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
init(manga, chapterId)
|
init(manga, chapterId)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else error(preferences.context.getString(R.string.unknown_error))
|
} else error(preferences.context.getString(R.string.unknown_error))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user