|
|
@ -329,13 +329,20 @@ class LibraryUpdateService(
|
|
|
|
.doOnCompleted {
|
|
|
|
.doOnCompleted {
|
|
|
|
if (newUpdates.isNotEmpty()) {
|
|
|
|
if (newUpdates.isNotEmpty()) {
|
|
|
|
showResultNotification(newUpdates)
|
|
|
|
showResultNotification(newUpdates)
|
|
|
|
if (downloadNew && hasDownloads) {
|
|
|
|
|
|
|
|
DownloadService.start(this)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (preferences.refreshCoversToo().getOrDefault()) {
|
|
|
|
if (preferences.refreshCoversToo().getOrDefault()) {
|
|
|
|
updateDetails(newUpdates.map { it.first }).observeOn(Schedulers.io())
|
|
|
|
updateDetails(newUpdates.map { it.first }).observeOn(Schedulers.io())
|
|
|
|
|
|
|
|
.doOnCompleted {
|
|
|
|
|
|
|
|
cancelProgressNotification()
|
|
|
|
|
|
|
|
if (downloadNew && hasDownloads) {
|
|
|
|
|
|
|
|
DownloadService.start(this)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
.subscribeOn(Schedulers.io()).subscribe {}
|
|
|
|
.subscribeOn(Schedulers.io()).subscribe {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (downloadNew && hasDownloads) {
|
|
|
|
|
|
|
|
DownloadService.start(this)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (failedUpdates.isNotEmpty()) {
|
|
|
|
if (failedUpdates.isNotEmpty()) {
|
|
|
@ -391,7 +398,6 @@ class LibraryUpdateService(
|
|
|
|
fun updateDetails(mangaToUpdate: List<LibraryManga>): Observable<LibraryManga> {
|
|
|
|
fun updateDetails(mangaToUpdate: List<LibraryManga>): Observable<LibraryManga> {
|
|
|
|
// Initialize the variables holding the progress of the updates.
|
|
|
|
// Initialize the variables holding the progress of the updates.
|
|
|
|
val count = AtomicInteger(0)
|
|
|
|
val count = AtomicInteger(0)
|
|
|
|
val coverCache by injectLazy<CoverCache>()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Emit each manga and update it sequentially.
|
|
|
|
// Emit each manga and update it sequentially.
|
|
|
|
return Observable.from(mangaToUpdate)
|
|
|
|
return Observable.from(mangaToUpdate)
|
|
|
@ -406,7 +412,6 @@ class LibraryUpdateService(
|
|
|
|
.map { networkManga ->
|
|
|
|
.map { networkManga ->
|
|
|
|
manga.copyFrom(networkManga)
|
|
|
|
manga.copyFrom(networkManga)
|
|
|
|
db.insertManga(manga).executeAsBlocking()
|
|
|
|
db.insertManga(manga).executeAsBlocking()
|
|
|
|
coverCache.deleteFromCache(manga.thumbnail_url)
|
|
|
|
|
|
|
|
MangaImpl.setLastCoverFetch(manga.id!!, Date().time)
|
|
|
|
MangaImpl.setLastCoverFetch(manga.id!!, Date().time)
|
|
|
|
manga
|
|
|
|
manga
|
|
|
|
}
|
|
|
|
}
|
|
|
|