Implement Update of Library/Category (#235)

* Implement Update Controller tests

* Basic Threading and notify

* WIP

* Reworked using coroutines

* Use Map for JobSummary Tracking

* Change Tests

* Clean up

* Changes based on review

* Rethrow cancellationexception

* Clean up

* Fix Merge Error

* Actually handle messages

* Clean up

* Remove useless annotation
This commit is contained in:
Sascha Hahne
2021-11-10 20:08:41 +01:00
committed by GitHub
parent 14e02bee6c
commit 2cb2ded2d9
14 changed files with 419 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
package suwayomi.tachidesk.manga.impl.update
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import suwayomi.tachidesk.manga.model.dataclass.MangaDataClass
class TestUpdater : IUpdater {
private val updateQueue = ArrayList<UpdateJob>()
private var isRunning = false
override fun addMangaToQueue(manga: MangaDataClass) {
updateQueue.add(UpdateJob(manga))
isRunning = true
}
override fun getStatus(): StateFlow<UpdateStatus> {
return MutableStateFlow(UpdateStatus(updateQueue, isRunning))
}
override suspend fun reset() {
updateQueue.clear()
isRunning = false
}
}