mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-10 12:47:26 +01:00
Fix cancelling library updates not working
This commit is contained in:
parent
0a54901eb0
commit
c4716a3f4c
@ -34,6 +34,7 @@ import eu.kanade.tachiyomi.util.storage.getUriCompat
|
|||||||
import eu.kanade.tachiyomi.util.system.acquireWakeLock
|
import eu.kanade.tachiyomi.util.system.acquireWakeLock
|
||||||
import eu.kanade.tachiyomi.util.system.createFileInCacheDir
|
import eu.kanade.tachiyomi.util.system.createFileInCacheDir
|
||||||
import eu.kanade.tachiyomi.util.system.isServiceRunning
|
import eu.kanade.tachiyomi.util.system.isServiceRunning
|
||||||
|
import kotlinx.coroutines.CancellationException
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
@ -258,6 +259,10 @@ class LibraryUpdateService(
|
|||||||
|
|
||||||
mangaToUpdate
|
mangaToUpdate
|
||||||
.map { manga ->
|
.map { manga ->
|
||||||
|
if (updateJob?.isActive != true) {
|
||||||
|
throw CancellationException()
|
||||||
|
}
|
||||||
|
|
||||||
// Notify manga that will update.
|
// Notify manga that will update.
|
||||||
notifier.showProgressNotification(manga, progressCount.andIncrement, mangaToUpdate.size)
|
notifier.showProgressNotification(manga, progressCount.andIncrement, mangaToUpdate.size)
|
||||||
|
|
||||||
@ -354,6 +359,10 @@ class LibraryUpdateService(
|
|||||||
var progressCount = 0
|
var progressCount = 0
|
||||||
|
|
||||||
mangaToUpdate.forEach { manga ->
|
mangaToUpdate.forEach { manga ->
|
||||||
|
if (updateJob?.isActive != true) {
|
||||||
|
throw CancellationException()
|
||||||
|
}
|
||||||
|
|
||||||
notifier.showProgressNotification(manga, progressCount++, mangaToUpdate.size)
|
notifier.showProgressNotification(manga, progressCount++, mangaToUpdate.size)
|
||||||
|
|
||||||
sourceManager.get(manga.source)?.let { source ->
|
sourceManager.get(manga.source)?.let { source ->
|
||||||
@ -384,6 +393,10 @@ class LibraryUpdateService(
|
|||||||
val loggedServices = trackManager.services.filter { it.isLogged }
|
val loggedServices = trackManager.services.filter { it.isLogged }
|
||||||
|
|
||||||
mangaToUpdate.forEach { manga ->
|
mangaToUpdate.forEach { manga ->
|
||||||
|
if (updateJob?.isActive != true) {
|
||||||
|
throw CancellationException()
|
||||||
|
}
|
||||||
|
|
||||||
// Notify manga that will update.
|
// Notify manga that will update.
|
||||||
notifier.showProgressNotification(manga, progressCount++, mangaToUpdate.size)
|
notifier.showProgressNotification(manga, progressCount++, mangaToUpdate.size)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user