mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-10 11:08:56 +01:00
delete error from DB when successfully updated
This commit is contained in:
@@ -53,6 +53,7 @@ import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_HAS_U
|
||||
import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_NON_COMPLETED
|
||||
import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_NON_READ
|
||||
import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_OUTSIDE_RELEASE_PERIOD
|
||||
import tachiyomi.domain.libraryUpdateError.interactor.DeleteLibraryUpdateErrors
|
||||
import tachiyomi.domain.libraryUpdateError.interactor.InsertLibraryUpdateErrors
|
||||
import tachiyomi.domain.libraryUpdateError.model.LibraryUpdateError
|
||||
import tachiyomi.domain.libraryUpdateErrorMessage.interactor.InsertLibraryUpdateErrorMessages
|
||||
@@ -87,6 +88,7 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
|
||||
private val fetchInterval: FetchInterval = Injekt.get()
|
||||
private val filterChaptersForDownload: FilterChaptersForDownload = Injekt.get()
|
||||
|
||||
private val deleteLibraryUpdateErrors: DeleteLibraryUpdateErrors = Injekt.get()
|
||||
private val insertLibraryUpdateErrors: InsertLibraryUpdateErrors = Injekt.get()
|
||||
private val insertLibraryUpdateErrorMessages: InsertLibraryUpdateErrorMessages = Injekt.get()
|
||||
|
||||
@@ -283,6 +285,7 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
|
||||
// Convert to the manga that contains new chapters
|
||||
newUpdates.add(manga to newChapters.toTypedArray())
|
||||
}
|
||||
clearErrorFromDB(mangaId = manga.id)
|
||||
} catch (e: Throwable) {
|
||||
val errorMessage = when (e) {
|
||||
is NoChaptersException -> context.stringResource(
|
||||
@@ -379,6 +382,10 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
|
||||
)
|
||||
}
|
||||
|
||||
private suspend fun clearErrorFromDB(mangaId: Long) {
|
||||
deleteLibraryUpdateErrors.deleteMangaError(mangaId = mangaId)
|
||||
}
|
||||
|
||||
private suspend fun writeErrorToDB(error: Pair<Manga, String?>) {
|
||||
val errorMessage = error.second ?: "???"
|
||||
val errorMessageId = insertLibraryUpdateErrorMessages.get(errorMessage)
|
||||
|
||||
Reference in New Issue
Block a user