Merge manga favorite related fields into favorite_at
Migration 16 replaces favorite, date_added and favorite_modified_at with one nullable favorite_at. A favorite whose date_added is 0 falls back to favorite_modified_at. Manga.favorite and dateAdded become getters derived from it, and restore merges it by taking the earliest non-zero time.
This commit is contained in:
@@ -19,11 +19,10 @@ import java.io.Serializable as JavaSerializable
|
||||
data class Manga(
|
||||
val id: Long,
|
||||
val source: Long,
|
||||
val favorite: Boolean,
|
||||
val lastUpdate: Long,
|
||||
val nextUpdate: Long,
|
||||
val fetchInterval: Int,
|
||||
val dateAdded: Long,
|
||||
val favoriteAt: Long?,
|
||||
val viewerFlags: Long,
|
||||
val chapterFlags: Long,
|
||||
val coverLastModified: Long,
|
||||
@@ -37,11 +36,13 @@ data class Manga(
|
||||
val thumbnailUrl: String?,
|
||||
val updateStrategy: UpdateStrategy,
|
||||
val initialized: Boolean,
|
||||
val favoriteModifiedAt: Long?,
|
||||
val notes: String,
|
||||
val memo: JsonObject,
|
||||
) : JavaSerializable {
|
||||
|
||||
val favorite: Boolean
|
||||
get() = favoriteAt != null
|
||||
|
||||
val expectedNextUpdate: Instant?
|
||||
get() = nextUpdate
|
||||
.takeIf { status != SManga.COMPLETED.toLong() }
|
||||
@@ -115,11 +116,10 @@ data class Manga(
|
||||
url = "",
|
||||
title = "",
|
||||
source = -1L,
|
||||
favorite = false,
|
||||
lastUpdate = 0L,
|
||||
nextUpdate = 0L,
|
||||
fetchInterval = 0,
|
||||
dateAdded = 0L,
|
||||
favoriteAt = null,
|
||||
viewerFlags = 0L,
|
||||
chapterFlags = 0L,
|
||||
coverLastModified = 0L,
|
||||
@@ -131,7 +131,6 @@ data class Manga(
|
||||
thumbnailUrl = null,
|
||||
updateStrategy = UpdateStrategy.ALWAYS_UPDATE,
|
||||
initialized = false,
|
||||
favoriteModifiedAt = null,
|
||||
notes = "",
|
||||
memo = JsonObject.EMPTY,
|
||||
)
|
||||
|
||||
@@ -3,11 +3,10 @@ package tachiyomi.domain.manga.model
|
||||
import mihon.domain.common.PartialUpdate
|
||||
|
||||
class MangaUpdate(val id: Long, block: MangaUpdate.() -> Unit) : PartialUpdate() {
|
||||
var favorite: Boolean? by field(null)
|
||||
var favoriteAt: Long? by field(null)
|
||||
var lastUpdate: Long? by field(null)
|
||||
var nextUpdate: Long? by field(null)
|
||||
var fetchInterval: Int? by field(null)
|
||||
var dateAdded: Long? by field(null)
|
||||
var viewerFlags: Long? by field(null)
|
||||
var chapterFlags: Long? by field(null)
|
||||
var coverLastModified: Long? by field(null)
|
||||
|
||||
Reference in New Issue
Block a user