mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-10 04:37:25 +01:00
Add interval data layer (#9398)
* Update Manga classes for fetch interval data * Update per review bump version --------- Co-authored-by: quangkieu <qkieu>
This commit is contained in:
parent
392c3492b3
commit
41c89eb61d
@ -22,7 +22,8 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "eu.kanade.tachiyomi"
|
applicationId = "eu.kanade.tachiyomi"
|
||||||
versionCode = 102
|
|
||||||
|
versionCode = 103
|
||||||
versionName = "0.14.6"
|
versionName = "0.14.6"
|
||||||
|
|
||||||
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
|
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
|
||||||
|
@ -501,6 +501,7 @@ class BackupManager(
|
|||||||
favorite = manga.favorite,
|
favorite = manga.favorite,
|
||||||
lastUpdate = manga.lastUpdate,
|
lastUpdate = manga.lastUpdate,
|
||||||
nextUpdate = 0L,
|
nextUpdate = 0L,
|
||||||
|
calculateInterval = 0L,
|
||||||
initialized = manga.initialized,
|
initialized = manga.initialized,
|
||||||
viewerFlags = manga.viewerFlags,
|
viewerFlags = manga.viewerFlags,
|
||||||
chapterFlags = manga.chapterFlags,
|
chapterFlags = manga.chapterFlags,
|
||||||
@ -526,6 +527,8 @@ class BackupManager(
|
|||||||
thumbnailUrl = manga.thumbnailUrl,
|
thumbnailUrl = manga.thumbnailUrl,
|
||||||
favorite = manga.favorite.toLong(),
|
favorite = manga.favorite.toLong(),
|
||||||
lastUpdate = manga.lastUpdate,
|
lastUpdate = manga.lastUpdate,
|
||||||
|
nextUpdate = null,
|
||||||
|
calculateInterval = null,
|
||||||
initialized = manga.initialized.toLong(),
|
initialized = manga.initialized.toLong(),
|
||||||
viewer = manga.viewerFlags,
|
viewer = manga.viewerFlags,
|
||||||
chapterFlags = manga.chapterFlags,
|
chapterFlags = manga.chapterFlags,
|
||||||
|
@ -4,13 +4,15 @@ import eu.kanade.tachiyomi.source.model.UpdateStrategy
|
|||||||
import tachiyomi.domain.library.model.LibraryManga
|
import tachiyomi.domain.library.model.LibraryManga
|
||||||
import tachiyomi.domain.manga.model.Manga
|
import tachiyomi.domain.manga.model.Manga
|
||||||
|
|
||||||
val mangaMapper: (Long, Long, String, String?, String?, String?, List<String>?, String, Long, String?, Boolean, Long?, Long?, Boolean, Long, Long, Long, Long, UpdateStrategy) -> Manga =
|
val mangaMapper: (Long, Long, String, String?, String?, String?, List<String>?, String, Long, String?, Boolean, Long?, Long?, Long, Boolean, Long, Long, Long, Long, UpdateStrategy) -> Manga =
|
||||||
{ id, source, url, artist, author, description, genre, title, status, thumbnailUrl, favorite, lastUpdate, _, initialized, viewerFlags, chapterFlags, coverLastModified, dateAdded, updateStrategy ->
|
{ id, source, url, artist, author, description, genre, title, status, thumbnailUrl, favorite, lastUpdate, nextUpdate, calculateInterval, initialized, viewerFlags, chapterFlags, coverLastModified, dateAdded, updateStrategy ->
|
||||||
Manga(
|
Manga(
|
||||||
id = id,
|
id = id,
|
||||||
source = source,
|
source = source,
|
||||||
favorite = favorite,
|
favorite = favorite,
|
||||||
lastUpdate = lastUpdate ?: 0,
|
lastUpdate = lastUpdate ?: 0,
|
||||||
|
nextUpdate = nextUpdate ?: 0,
|
||||||
|
calculateInterval = calculateInterval.toInt(),
|
||||||
dateAdded = dateAdded,
|
dateAdded = dateAdded,
|
||||||
viewerFlags = viewerFlags,
|
viewerFlags = viewerFlags,
|
||||||
chapterFlags = chapterFlags,
|
chapterFlags = chapterFlags,
|
||||||
@ -28,8 +30,8 @@ val mangaMapper: (Long, Long, String, String?, String?, String?, List<String>?,
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val libraryManga: (Long, Long, String, String?, String?, String?, List<String>?, String, Long, String?, Boolean, Long?, Long?, Boolean, Long, Long, Long, Long, UpdateStrategy, Long, Long, Long, Long, Long, Long, Long) -> LibraryManga =
|
val libraryManga: (Long, Long, String, String?, String?, String?, List<String>?, String, Long, String?, Boolean, Long?, Long?, Long, Boolean, Long, Long, Long, Long, UpdateStrategy, Long, Long, Long, Long, Long, Long, Long) -> LibraryManga =
|
||||||
{ id, source, url, artist, author, description, genre, title, status, thumbnailUrl, favorite, lastUpdate, nextUpdate, initialized, viewerFlags, chapterFlags, coverLastModified, dateAdded, updateStrategy, totalCount, readCount, latestUpload, chapterFetchedAt, lastRead, bookmarkCount, category ->
|
{ id, source, url, artist, author, description, genre, title, status, thumbnailUrl, favorite, lastUpdate, nextUpdate, calculateInterval, initialized, viewerFlags, chapterFlags, coverLastModified, dateAdded, updateStrategy, totalCount, readCount, latestUpload, chapterFetchedAt, lastRead, bookmarkCount, category ->
|
||||||
LibraryManga(
|
LibraryManga(
|
||||||
manga = mangaMapper(
|
manga = mangaMapper(
|
||||||
id,
|
id,
|
||||||
@ -45,6 +47,7 @@ val libraryManga: (Long, Long, String, String?, String?, String?, List<String>?,
|
|||||||
favorite,
|
favorite,
|
||||||
lastUpdate,
|
lastUpdate,
|
||||||
nextUpdate,
|
nextUpdate,
|
||||||
|
calculateInterval,
|
||||||
initialized,
|
initialized,
|
||||||
viewerFlags,
|
viewerFlags,
|
||||||
chapterFlags,
|
chapterFlags,
|
||||||
|
@ -87,7 +87,8 @@ class MangaRepositoryImpl(
|
|||||||
thumbnailUrl = manga.thumbnailUrl,
|
thumbnailUrl = manga.thumbnailUrl,
|
||||||
favorite = manga.favorite,
|
favorite = manga.favorite,
|
||||||
lastUpdate = manga.lastUpdate,
|
lastUpdate = manga.lastUpdate,
|
||||||
nextUpdate = null,
|
nextUpdate = manga.nextUpdate,
|
||||||
|
calculateInterval = manga.calculateInterval.toLong(),
|
||||||
initialized = manga.initialized,
|
initialized = manga.initialized,
|
||||||
viewerFlags = manga.viewerFlags,
|
viewerFlags = manga.viewerFlags,
|
||||||
chapterFlags = manga.chapterFlags,
|
chapterFlags = manga.chapterFlags,
|
||||||
@ -134,6 +135,8 @@ class MangaRepositoryImpl(
|
|||||||
thumbnailUrl = value.thumbnailUrl,
|
thumbnailUrl = value.thumbnailUrl,
|
||||||
favorite = value.favorite?.toLong(),
|
favorite = value.favorite?.toLong(),
|
||||||
lastUpdate = value.lastUpdate,
|
lastUpdate = value.lastUpdate,
|
||||||
|
nextUpdate = value.nextUpdate,
|
||||||
|
calculateInterval = value.calculateInterval?.toLong(),
|
||||||
initialized = value.initialized?.toLong(),
|
initialized = value.initialized?.toLong(),
|
||||||
viewer = value.viewerFlags,
|
viewer = value.viewerFlags,
|
||||||
chapterFlags = value.chapterFlags,
|
chapterFlags = value.chapterFlags,
|
||||||
|
@ -16,6 +16,7 @@ CREATE TABLE mangas(
|
|||||||
favorite INTEGER AS Boolean NOT NULL,
|
favorite INTEGER AS Boolean NOT NULL,
|
||||||
last_update INTEGER AS Long,
|
last_update INTEGER AS Long,
|
||||||
next_update INTEGER AS Long,
|
next_update INTEGER AS Long,
|
||||||
|
calculate_interval INTEGER DEFAULT 0 NOT NULL,
|
||||||
initialized INTEGER AS Boolean NOT NULL,
|
initialized INTEGER AS Boolean NOT NULL,
|
||||||
viewer INTEGER NOT NULL,
|
viewer INTEGER NOT NULL,
|
||||||
chapter_flags INTEGER NOT NULL,
|
chapter_flags INTEGER NOT NULL,
|
||||||
@ -80,8 +81,8 @@ DELETE FROM mangas
|
|||||||
WHERE favorite = 0 AND source IN :sourceIds;
|
WHERE favorite = 0 AND source IN :sourceIds;
|
||||||
|
|
||||||
insert:
|
insert:
|
||||||
INSERT INTO mangas(source,url,artist,author,description,genre,title,status,thumbnail_url,favorite,last_update,next_update,initialized,viewer,chapter_flags,cover_last_modified,date_added,update_strategy)
|
INSERT INTO mangas(source,url,artist,author,description,genre,title,status,thumbnail_url,favorite,last_update,next_update,calculate_interval,initialized,viewer,chapter_flags,cover_last_modified,date_added,update_strategy)
|
||||||
VALUES (:source,:url,:artist,:author,:description,:genre,:title,:status,:thumbnailUrl,:favorite,:lastUpdate,:nextUpdate,:initialized,:viewerFlags,:chapterFlags,:coverLastModified,:dateAdded,:updateStrategy);
|
VALUES (:source,:url,:artist,:author,:description,:genre,:title,:status,:thumbnailUrl,:favorite,:lastUpdate,:nextUpdate,:calculateInterval,:initialized,:viewerFlags,:chapterFlags,:coverLastModified,:dateAdded,:updateStrategy);
|
||||||
|
|
||||||
update:
|
update:
|
||||||
UPDATE mangas SET
|
UPDATE mangas SET
|
||||||
@ -96,6 +97,8 @@ UPDATE mangas SET
|
|||||||
thumbnail_url = coalesce(:thumbnailUrl, thumbnail_url),
|
thumbnail_url = coalesce(:thumbnailUrl, thumbnail_url),
|
||||||
favorite = coalesce(:favorite, favorite),
|
favorite = coalesce(:favorite, favorite),
|
||||||
last_update = coalesce(:lastUpdate, last_update),
|
last_update = coalesce(:lastUpdate, last_update),
|
||||||
|
next_update = coalesce(:nextUpdate, next_update),
|
||||||
|
calculate_interval = coalesce(:calculateInterval, calculate_interval),
|
||||||
initialized = coalesce(:initialized, initialized),
|
initialized = coalesce(:initialized, initialized),
|
||||||
viewer = coalesce(:viewer, viewer),
|
viewer = coalesce(:viewer, viewer),
|
||||||
chapter_flags = coalesce(:chapterFlags, chapter_flags),
|
chapter_flags = coalesce(:chapterFlags, chapter_flags),
|
||||||
|
1
data/src/main/sqldelight/tachiyomi/migrations/24.sqm
Normal file
1
data/src/main/sqldelight/tachiyomi/migrations/24.sqm
Normal file
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE mangas ADD COLUMN calculate_interval INTEGER DEFAULT 0 NOT NULL;
|
@ -8,6 +8,8 @@ data class Manga(
|
|||||||
val source: Long,
|
val source: Long,
|
||||||
val favorite: Boolean,
|
val favorite: Boolean,
|
||||||
val lastUpdate: Long,
|
val lastUpdate: Long,
|
||||||
|
val nextUpdate: Long,
|
||||||
|
val calculateInterval: Int,
|
||||||
val dateAdded: Long,
|
val dateAdded: Long,
|
||||||
val viewerFlags: Long,
|
val viewerFlags: Long,
|
||||||
val chapterFlags: Long,
|
val chapterFlags: Long,
|
||||||
@ -93,6 +95,8 @@ data class Manga(
|
|||||||
source = -1L,
|
source = -1L,
|
||||||
favorite = false,
|
favorite = false,
|
||||||
lastUpdate = 0L,
|
lastUpdate = 0L,
|
||||||
|
nextUpdate = 0L,
|
||||||
|
calculateInterval = 0,
|
||||||
dateAdded = 0L,
|
dateAdded = 0L,
|
||||||
viewerFlags = 0L,
|
viewerFlags = 0L,
|
||||||
chapterFlags = 0L,
|
chapterFlags = 0L,
|
||||||
|
@ -7,6 +7,8 @@ data class MangaUpdate(
|
|||||||
val source: Long? = null,
|
val source: Long? = null,
|
||||||
val favorite: Boolean? = null,
|
val favorite: Boolean? = null,
|
||||||
val lastUpdate: Long? = null,
|
val lastUpdate: Long? = null,
|
||||||
|
val nextUpdate: Long? = null,
|
||||||
|
val calculateInterval: Int? = null,
|
||||||
val dateAdded: Long? = null,
|
val dateAdded: Long? = null,
|
||||||
val viewerFlags: Long? = null,
|
val viewerFlags: Long? = null,
|
||||||
val chapterFlags: Long? = null,
|
val chapterFlags: Long? = null,
|
||||||
@ -29,6 +31,8 @@ fun Manga.toMangaUpdate(): MangaUpdate {
|
|||||||
source = source,
|
source = source,
|
||||||
favorite = favorite,
|
favorite = favorite,
|
||||||
lastUpdate = lastUpdate,
|
lastUpdate = lastUpdate,
|
||||||
|
nextUpdate = nextUpdate,
|
||||||
|
calculateInterval = calculateInterval,
|
||||||
dateAdded = dateAdded,
|
dateAdded = dateAdded,
|
||||||
viewerFlags = viewerFlags,
|
viewerFlags = viewerFlags,
|
||||||
chapterFlags = chapterFlags,
|
chapterFlags = chapterFlags,
|
||||||
|
Loading…
Reference in New Issue
Block a user