|
|
|
@ -6,6 +6,7 @@ import org.koitharu.kotatsu.core.model.isLocal
|
|
|
|
import org.koitharu.kotatsu.core.parser.CachingMangaRepository
|
|
|
|
import org.koitharu.kotatsu.core.parser.CachingMangaRepository
|
|
|
|
import org.koitharu.kotatsu.core.parser.MangaRepository
|
|
|
|
import org.koitharu.kotatsu.core.parser.MangaRepository
|
|
|
|
import org.koitharu.kotatsu.core.util.MultiMutex
|
|
|
|
import org.koitharu.kotatsu.core.util.MultiMutex
|
|
|
|
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.printStackTraceDebug
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.toInstantOrNull
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.toInstantOrNull
|
|
|
|
import org.koitharu.kotatsu.history.data.HistoryRepository
|
|
|
|
import org.koitharu.kotatsu.history.data.HistoryRepository
|
|
|
|
import org.koitharu.kotatsu.local.data.LocalMangaRepository
|
|
|
|
import org.koitharu.kotatsu.local.data.LocalMangaRepository
|
|
|
|
@ -41,6 +42,7 @@ class CheckNewChaptersUseCase @Inject constructor(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
suspend operator fun invoke(manga: Manga, currentChapterId: Long) = mutex.withLock(manga.id) {
|
|
|
|
suspend operator fun invoke(manga: Manga, currentChapterId: Long) = mutex.withLock(manga.id) {
|
|
|
|
|
|
|
|
runCatchingCancellable {
|
|
|
|
repository.updateTracks()
|
|
|
|
repository.updateTracks()
|
|
|
|
val details = getFullManga(manga)
|
|
|
|
val details = getFullManga(manga)
|
|
|
|
val chapters = details.chapters ?: return@withLock
|
|
|
|
val chapters = details.chapters ?: return@withLock
|
|
|
|
@ -61,6 +63,9 @@ class CheckNewChaptersUseCase @Inject constructor(
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
repository.mergeWith(tracking)
|
|
|
|
repository.mergeWith(tracking)
|
|
|
|
|
|
|
|
}.onFailure { e ->
|
|
|
|
|
|
|
|
e.printStackTraceDebug()
|
|
|
|
|
|
|
|
}.isSuccess
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private suspend fun invokeImpl(track: MangaTracking): MangaUpdates = runCatchingCancellable {
|
|
|
|
private suspend fun invokeImpl(track: MangaTracking): MangaUpdates = runCatchingCancellable {
|
|
|
|
|