Follow weekday and monthly release patterns for next update and back it up
This commit is contained in:
+1
@@ -99,4 +99,5 @@ private fun Manga.toBackupManga() =
|
||||
notes = this.notes,
|
||||
initialized = this.initialized,
|
||||
memo = this.memo.toByteArray(),
|
||||
nextUpdate = this.nextUpdate.toEpochMillisOrZero(),
|
||||
)
|
||||
|
||||
@@ -48,6 +48,7 @@ class BackupManga(
|
||||
@ProtoNumber(110) var notes: String = "",
|
||||
@ProtoNumber(111) var initialized: Boolean = false,
|
||||
@ProtoNumber(112) var memo: ByteArray = JsonObjectEmptyBytes,
|
||||
@ProtoNumber(113) var nextUpdate: Long = 0,
|
||||
) {
|
||||
fun getMangaImpl(): Manga {
|
||||
return Manga.create().copy(
|
||||
@@ -75,6 +76,7 @@ class BackupManga(
|
||||
notes = this@BackupManga.notes,
|
||||
initialized = this@BackupManga.initialized,
|
||||
memo = this@BackupManga.memo.toJsonObject(),
|
||||
nextUpdate = this@BackupManga.nextUpdate.toInstantOrNull(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+7
-2
@@ -58,8 +58,13 @@ class MangaRestorer(
|
||||
)
|
||||
}
|
||||
|
||||
restoreRepository.restoreManga(entries) {
|
||||
fetchInterval.withFetchInterval(it, now, timeZone, currentFetchWindow)
|
||||
restoreRepository.restoreManga(entries) { manga ->
|
||||
fetchInterval.withFetchInterval(manga, now, timeZone, currentFetchWindow).apply {
|
||||
// A next update still ahead was worked out with the chapters the backup came from
|
||||
manga.nextUpdate
|
||||
?.takeIf { it >= currentFetchWindow.start }
|
||||
?.let { nextUpdate = it }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user