diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MigrationFlags.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MigrationFlags.kt index 7bd6e8b07..b03de69b6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MigrationFlags.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MigrationFlags.kt @@ -4,10 +4,7 @@ import eu.kanade.domain.manga.model.hasCustomCover import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.cache.CoverCache import eu.kanade.tachiyomi.data.download.DownloadCache -import kotlinx.coroutines.runBlocking import tachiyomi.domain.manga.model.Manga -import tachiyomi.domain.track.interactor.GetTracks -import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy @@ -31,12 +28,10 @@ object MigrationFlags { private const val CHAPTERS = 0b00001 private const val CATEGORIES = 0b00010 - private const val TRACK = 0b00100 private const val CUSTOM_COVER = 0b01000 private const val DELETE_DOWNLOADED = 0b10000 private val coverCache: CoverCache by injectLazy() - private val getTracks: GetTracks = Injekt.get() private val downloadCache: DownloadCache by injectLazy() fun hasChapters(value: Int): Boolean { @@ -47,10 +42,6 @@ object MigrationFlags { return value and CATEGORIES != 0 } - fun hasTracks(value: Int): Boolean { - return value and TRACK != 0 - } - fun hasCustomCover(value: Int): Boolean { return value and CUSTOM_COVER != 0 } @@ -66,9 +57,6 @@ object MigrationFlags { flags += MigrationFlag.create(CATEGORIES, defaultSelectedBitMap, R.string.categories) if (manga != null) { - if (runBlocking { getTracks.await(manga.id) }.isNotEmpty()) { - flags += MigrationFlag.create(TRACK, defaultSelectedBitMap, R.string.track) - } if (manga.hasCustomCover(coverCache)) { flags += MigrationFlag.create(CUSTOM_COVER, defaultSelectedBitMap, R.string.custom_cover) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateDialog.kt index fba1fb25d..ab1431fe8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateDialog.kt @@ -222,7 +222,6 @@ internal class MigrateDialogScreenModel( ) { val migrateChapters = MigrationFlags.hasChapters(flags) val migrateCategories = MigrationFlags.hasCategories(flags) - val migrateTracks = MigrationFlags.hasTracks(flags) val migrateCustomCover = MigrationFlags.hasCustomCover(flags) val deleteDownloaded = MigrationFlags.hasDeleteDownloaded(flags) @@ -273,21 +272,20 @@ internal class MigrateDialogScreenModel( } // Update track - if (migrateTracks) { - val tracks = getTracks.await(oldManga.id).mapNotNull { track -> - val updatedTrack = track.copy(mangaId = newManga.id) + getTracks.await(oldManga.id).mapNotNull { track -> + val updatedTrack = track.copy(mangaId = newManga.id) - val service = enhancedServices - .firstOrNull { it.isTrackFrom(updatedTrack, oldManga, oldSource) } + val service = enhancedServices + .firstOrNull { it.isTrackFrom(updatedTrack, oldManga, oldSource) } - if (service != null) { - service.migrateTrack(updatedTrack, newManga, newSource) - } else { - updatedTrack - } + if (service != null) { + service.migrateTrack(updatedTrack, newManga, newSource) + } else { + updatedTrack } - insertTrack.awaitAll(tracks) } + .takeIf { it.isNotEmpty() } + ?.let { insertTrack.awaitAll(it) } // Delete downloaded if (deleteDownloaded) { diff --git a/app/src/main/res/layout/reader_activity.xml b/app/src/main/res/layout/reader_activity.xml index 1f6039afc..b7e34e987 100644 --- a/app/src/main/res/layout/reader_activity.xml +++ b/app/src/main/res/layout/reader_activity.xml @@ -1,5 +1,4 @@