diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ee87c6e85..282b29324 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -22,7 +22,8 @@ android { defaultConfig { applicationId = "eu.kanade.tachiyomi" - versionCode = 102 + + versionCode = 103 versionName = "0.14.6" buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"") diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt index c169db30c..36d54a17b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt @@ -501,6 +501,7 @@ class BackupManager( favorite = manga.favorite, lastUpdate = manga.lastUpdate, nextUpdate = 0L, + calculateInterval = 0L, initialized = manga.initialized, viewerFlags = manga.viewerFlags, chapterFlags = manga.chapterFlags, @@ -526,6 +527,8 @@ class BackupManager( thumbnailUrl = manga.thumbnailUrl, favorite = manga.favorite.toLong(), lastUpdate = manga.lastUpdate, + nextUpdate = null, + calculateInterval = null, initialized = manga.initialized.toLong(), viewer = manga.viewerFlags, chapterFlags = manga.chapterFlags, diff --git a/data/src/main/java/tachiyomi/data/manga/MangaMapper.kt b/data/src/main/java/tachiyomi/data/manga/MangaMapper.kt index 67248ab55..6020fd41f 100644 --- a/data/src/main/java/tachiyomi/data/manga/MangaMapper.kt +++ b/data/src/main/java/tachiyomi/data/manga/MangaMapper.kt @@ -4,13 +4,15 @@ import eu.kanade.tachiyomi.source.model.UpdateStrategy import tachiyomi.domain.library.model.LibraryManga import tachiyomi.domain.manga.model.Manga -val mangaMapper: (Long, Long, String, String?, String?, String?, List?, String, Long, String?, Boolean, 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 -> +val mangaMapper: (Long, Long, String, String?, String?, String?, List?, 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, nextUpdate, calculateInterval, initialized, viewerFlags, chapterFlags, coverLastModified, dateAdded, updateStrategy -> Manga( id = id, source = source, favorite = favorite, lastUpdate = lastUpdate ?: 0, + nextUpdate = nextUpdate ?: 0, + calculateInterval = calculateInterval.toInt(), dateAdded = dateAdded, viewerFlags = viewerFlags, chapterFlags = chapterFlags, @@ -28,8 +30,8 @@ val mangaMapper: (Long, Long, String, String?, String?, String?, List?, ) } -val libraryManga: (Long, Long, String, String?, String?, String?, List?, String, Long, String?, Boolean, 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 -> +val libraryManga: (Long, Long, String, String?, String?, String?, List?, 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, calculateInterval, initialized, viewerFlags, chapterFlags, coverLastModified, dateAdded, updateStrategy, totalCount, readCount, latestUpload, chapterFetchedAt, lastRead, bookmarkCount, category -> LibraryManga( manga = mangaMapper( id, @@ -45,6 +47,7 @@ val libraryManga: (Long, Long, String, String?, String?, String?, List?, favorite, lastUpdate, nextUpdate, + calculateInterval, initialized, viewerFlags, chapterFlags, diff --git a/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt b/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt index 25b5f59e7..c7c658f88 100644 --- a/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt +++ b/data/src/main/java/tachiyomi/data/manga/MangaRepositoryImpl.kt @@ -87,7 +87,8 @@ class MangaRepositoryImpl( thumbnailUrl = manga.thumbnailUrl, favorite = manga.favorite, lastUpdate = manga.lastUpdate, - nextUpdate = null, + nextUpdate = manga.nextUpdate, + calculateInterval = manga.calculateInterval.toLong(), initialized = manga.initialized, viewerFlags = manga.viewerFlags, chapterFlags = manga.chapterFlags, @@ -134,6 +135,8 @@ class MangaRepositoryImpl( thumbnailUrl = value.thumbnailUrl, favorite = value.favorite?.toLong(), lastUpdate = value.lastUpdate, + nextUpdate = value.nextUpdate, + calculateInterval = value.calculateInterval?.toLong(), initialized = value.initialized?.toLong(), viewer = value.viewerFlags, chapterFlags = value.chapterFlags, diff --git a/data/src/main/sqldelight/tachiyomi/data/mangas.sq b/data/src/main/sqldelight/tachiyomi/data/mangas.sq index 09522468c..f67131530 100644 --- a/data/src/main/sqldelight/tachiyomi/data/mangas.sq +++ b/data/src/main/sqldelight/tachiyomi/data/mangas.sq @@ -16,6 +16,7 @@ CREATE TABLE mangas( favorite INTEGER AS Boolean NOT NULL, last_update INTEGER AS Long, next_update INTEGER AS Long, + calculate_interval INTEGER DEFAULT 0 NOT NULL, initialized INTEGER AS Boolean NOT NULL, viewer INTEGER NOT NULL, chapter_flags INTEGER NOT NULL, @@ -80,8 +81,8 @@ DELETE FROM mangas WHERE favorite = 0 AND source IN :sourceIds; 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) -VALUES (:source,:url,:artist,:author,:description,:genre,:title,:status,:thumbnailUrl,:favorite,:lastUpdate,:nextUpdate,:initialized,:viewerFlags,:chapterFlags,:coverLastModified,:dateAdded,:updateStrategy); +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,:calculateInterval,:initialized,:viewerFlags,:chapterFlags,:coverLastModified,:dateAdded,:updateStrategy); update: UPDATE mangas SET @@ -96,6 +97,8 @@ UPDATE mangas SET thumbnail_url = coalesce(:thumbnailUrl, thumbnail_url), favorite = coalesce(:favorite, favorite), last_update = coalesce(:lastUpdate, last_update), + next_update = coalesce(:nextUpdate, next_update), + calculate_interval = coalesce(:calculateInterval, calculate_interval), initialized = coalesce(:initialized, initialized), viewer = coalesce(:viewer, viewer), chapter_flags = coalesce(:chapterFlags, chapter_flags), diff --git a/data/src/main/sqldelight/tachiyomi/migrations/24.sqm b/data/src/main/sqldelight/tachiyomi/migrations/24.sqm new file mode 100644 index 000000000..c34ccfa0f --- /dev/null +++ b/data/src/main/sqldelight/tachiyomi/migrations/24.sqm @@ -0,0 +1 @@ +ALTER TABLE mangas ADD COLUMN calculate_interval INTEGER DEFAULT 0 NOT NULL; diff --git a/domain/src/main/java/tachiyomi/domain/manga/model/Manga.kt b/domain/src/main/java/tachiyomi/domain/manga/model/Manga.kt index c92dbdbe3..df7885a92 100644 --- a/domain/src/main/java/tachiyomi/domain/manga/model/Manga.kt +++ b/domain/src/main/java/tachiyomi/domain/manga/model/Manga.kt @@ -8,6 +8,8 @@ data class Manga( val source: Long, val favorite: Boolean, val lastUpdate: Long, + val nextUpdate: Long, + val calculateInterval: Int, val dateAdded: Long, val viewerFlags: Long, val chapterFlags: Long, @@ -93,6 +95,8 @@ data class Manga( source = -1L, favorite = false, lastUpdate = 0L, + nextUpdate = 0L, + calculateInterval = 0, dateAdded = 0L, viewerFlags = 0L, chapterFlags = 0L, diff --git a/domain/src/main/java/tachiyomi/domain/manga/model/MangaUpdate.kt b/domain/src/main/java/tachiyomi/domain/manga/model/MangaUpdate.kt index 28fda84fc..2ca97af1a 100644 --- a/domain/src/main/java/tachiyomi/domain/manga/model/MangaUpdate.kt +++ b/domain/src/main/java/tachiyomi/domain/manga/model/MangaUpdate.kt @@ -7,6 +7,8 @@ data class MangaUpdate( val source: Long? = null, val favorite: Boolean? = null, val lastUpdate: Long? = null, + val nextUpdate: Long? = null, + val calculateInterval: Int? = null, val dateAdded: Long? = null, val viewerFlags: Long? = null, val chapterFlags: Long? = null, @@ -29,6 +31,8 @@ fun Manga.toMangaUpdate(): MangaUpdate { source = source, favorite = favorite, lastUpdate = lastUpdate, + nextUpdate = nextUpdate, + calculateInterval = calculateInterval, dateAdded = dateAdded, viewerFlags = viewerFlags, chapterFlags = chapterFlags,