mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2025-02-02 16:22:35 +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,17 +373,24 @@ 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 chapterId = db.insertChapter(chapter).executeOnIO().insertedId() ?: return
|
val matchingChapterId = db.getChapters(manga).executeOnIO().find { it.url == chapter.url }?.id
|
||||||
if (chapters.isNotEmpty()) {
|
if (matchingChapterId != null) {
|
||||||
syncChaptersWithSource(
|
withContext(Dispatchers.Main) {
|
||||||
db,
|
this@ReaderPresenter.init(manga, matchingChapterId)
|
||||||
chapters,
|
}
|
||||||
manga,
|
} else {
|
||||||
delegatedSource.delegate!!
|
val chapterId = db.insertChapter(chapter).executeOnIO().insertedId() ?: return
|
||||||
)
|
if (chapters.isNotEmpty()) {
|
||||||
}
|
syncChaptersWithSource(
|
||||||
withContext(Dispatchers.Main) {
|
db,
|
||||||
init(manga, chapterId)
|
chapters,
|
||||||
|
manga,
|
||||||
|
delegatedSource.delegate!!
|
||||||
|
)
|
||||||
|
}
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
|
init(manga, chapterId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else error(preferences.context.getString(R.string.unknown_error))
|
} else error(preferences.context.getString(R.string.unknown_error))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user