From 823749fc1ed16dbf52d43839888a70de089d65b1 Mon Sep 17 00:00:00 2001 From: Andreas Date: Sat, 21 Jan 2023 16:37:07 +0100 Subject: [PATCH] Move SQLDelight to data module (#8954) And use tachiyomi instead of eu.kanade.tachiyomi for package names in the module --- app/build.gradle.kts | 12 +-------- .../data/category/CategoryRepositoryImpl.kt | 4 +-- .../data/chapter/ChapterRepositoryImpl.kt | 2 +- .../data/history/HistoryRepositoryImpl.kt | 2 +- .../kanade/data/manga/MangaRepositoryImpl.kt | 6 ++--- .../data/source/SourceDataRepositoryImpl.kt | 2 +- .../data/source/SourceRepositoryImpl.kt | 2 +- .../kanade/data/track/TrackRepositoryImpl.kt | 2 +- .../data/updates/UpdatesRepositoryImpl.kt | 2 +- .../settings/screen/ClearDatabaseScreen.kt | 2 +- app/src/main/java/eu/kanade/tachiyomi/App.kt | 2 +- .../java/eu/kanade/tachiyomi/AppModule.kt | 15 ++++++----- .../tachiyomi/data/backup/BackupManager.kt | 8 +++--- .../glance/UpdatesGridGlanceWidget.kt | 4 +-- .../source/model/SChapterExtensions.kt | 2 +- .../source/model/SMangaExtensions.kt | 4 +-- data/.gitignore | 1 + data/build.gradle.kts | 27 +++++++++++++++++++ data/consumer-rules.pro | 0 data/proguard-rules.pro | 21 +++++++++++++++ data/src/main/AndroidManifest.xml | 4 +++ .../tachiyomi}/data/AndroidDatabaseHandler.kt | 3 +-- .../java/tachiyomi}/data/DatabaseAdapter.kt | 2 +- .../java/tachiyomi}/data/DatabaseHandler.kt | 3 +-- .../java/tachiyomi}/data/QueryPagingSource.kt | 3 +-- .../tachiyomi}/data/TransactionContext.kt | 2 +- .../sqldelight/tachiyomi}/data/categories.sq | 0 .../sqldelight/tachiyomi}/data/chapters.sq | 0 .../sqldelight/tachiyomi}/data/history.sq | 0 .../sqldelight/tachiyomi}/data/manga_sync.sq | 0 .../main/sqldelight/tachiyomi}/data/mangas.sq | 0 .../tachiyomi}/data/mangas_categories.sq | 0 .../sqldelight/tachiyomi}/data/sources.sq | 0 .../sqldelight/tachiyomi}/migrations/1.sqm | 0 .../sqldelight/tachiyomi}/migrations/10.sqm | 0 .../sqldelight/tachiyomi}/migrations/11.sqm | 0 .../sqldelight/tachiyomi}/migrations/12.sqm | 0 .../sqldelight/tachiyomi}/migrations/13.sqm | 0 .../sqldelight/tachiyomi}/migrations/14.sqm | 0 .../sqldelight/tachiyomi}/migrations/15.sqm | 0 .../sqldelight/tachiyomi}/migrations/16.sqm | 0 .../sqldelight/tachiyomi}/migrations/17.sqm | 0 .../sqldelight/tachiyomi}/migrations/18.sqm | 0 .../sqldelight/tachiyomi}/migrations/19.sqm | 0 .../sqldelight/tachiyomi}/migrations/2.sqm | 0 .../sqldelight/tachiyomi}/migrations/20.sqm | 0 .../sqldelight/tachiyomi}/migrations/21.sqm | 0 .../sqldelight/tachiyomi}/migrations/22.sqm | 0 .../sqldelight/tachiyomi}/migrations/23.sqm | 0 .../sqldelight/tachiyomi}/migrations/3.sqm | 0 .../sqldelight/tachiyomi}/migrations/4.sqm | 0 .../sqldelight/tachiyomi}/migrations/5.sqm | 0 .../sqldelight/tachiyomi}/migrations/6.sqm | 0 .../sqldelight/tachiyomi}/migrations/7.sqm | 0 .../sqldelight/tachiyomi}/migrations/8.sqm | 0 .../sqldelight/tachiyomi}/migrations/9.sqm | 0 .../sqldelight/tachiyomi}/view/historyView.sq | 0 .../sqldelight/tachiyomi}/view/libraryView.sq | 0 .../sqldelight/tachiyomi}/view/updatesView.sq | 0 settings.gradle.kts | 1 + 60 files changed, 90 insertions(+), 48 deletions(-) create mode 100644 data/.gitignore create mode 100644 data/build.gradle.kts create mode 100644 data/consumer-rules.pro create mode 100644 data/proguard-rules.pro create mode 100644 data/src/main/AndroidManifest.xml rename {app/src/main/java/eu/kanade => data/src/main/java/tachiyomi}/data/AndroidDatabaseHandler.kt (98%) rename {app/src/main/java/eu/kanade => data/src/main/java/tachiyomi}/data/DatabaseAdapter.kt (97%) rename {app/src/main/java/eu/kanade => data/src/main/java/tachiyomi}/data/DatabaseHandler.kt (94%) rename {app/src/main/java/eu/kanade => data/src/main/java/tachiyomi}/data/QueryPagingSource.kt (97%) rename {app/src/main/java/eu/kanade => data/src/main/java/tachiyomi}/data/TransactionContext.kt (99%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/data/categories.sq (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/data/chapters.sq (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/data/history.sq (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/data/manga_sync.sq (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/data/mangas.sq (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/data/mangas_categories.sq (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/data/sources.sq (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/1.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/10.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/11.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/12.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/13.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/14.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/15.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/16.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/17.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/18.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/19.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/2.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/20.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/21.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/22.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/23.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/3.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/4.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/5.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/6.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/7.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/8.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/migrations/9.sqm (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/view/historyView.sq (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/view/libraryView.sq (100%) rename {app/src/main/sqldelight => data/src/main/sqldelight/tachiyomi}/view/updatesView.sq (100%) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index b2570e8876..5359ed226e 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -7,7 +7,6 @@ plugins { kotlin("android") kotlin("plugin.serialization") id("com.github.zellius.shortcut-helper") - id("com.squareup.sqldelight") } if (gradle.startParameter.taskRequests.toString().contains("Standard")) { @@ -136,19 +135,13 @@ android { composeOptions { kotlinCompilerExtensionVersion = compose.versions.compiler.get() } - - sqldelight { - database("Database") { - packageName = "eu.kanade.tachiyomi" - dialect = "sqlite:3.24" - } - } } dependencies { implementation(project(":i18n")) implementation(project(":core")) implementation(project(":source-api")) + implementation(project(":data")) // Compose implementation(platform(compose.bom)) @@ -171,9 +164,6 @@ dependencies { implementation(androidx.paging.compose) implementation(libs.bundles.sqlite) - implementation(libs.sqldelight.android.driver) - implementation(libs.sqldelight.coroutines) - implementation(libs.sqldelight.android.paging) implementation(kotlinx.reflect) diff --git a/app/src/main/java/eu/kanade/data/category/CategoryRepositoryImpl.kt b/app/src/main/java/eu/kanade/data/category/CategoryRepositoryImpl.kt index cfbd2eb64b..2fb6971d40 100644 --- a/app/src/main/java/eu/kanade/data/category/CategoryRepositoryImpl.kt +++ b/app/src/main/java/eu/kanade/data/category/CategoryRepositoryImpl.kt @@ -1,11 +1,11 @@ package eu.kanade.data.category -import eu.kanade.data.DatabaseHandler import eu.kanade.domain.category.model.Category import eu.kanade.domain.category.model.CategoryUpdate import eu.kanade.domain.category.repository.CategoryRepository -import eu.kanade.tachiyomi.Database import kotlinx.coroutines.flow.Flow +import tachiyomi.data.Database +import tachiyomi.data.DatabaseHandler class CategoryRepositoryImpl( private val handler: DatabaseHandler, diff --git a/app/src/main/java/eu/kanade/data/chapter/ChapterRepositoryImpl.kt b/app/src/main/java/eu/kanade/data/chapter/ChapterRepositoryImpl.kt index 5083b5479a..0d5592e5a8 100644 --- a/app/src/main/java/eu/kanade/data/chapter/ChapterRepositoryImpl.kt +++ b/app/src/main/java/eu/kanade/data/chapter/ChapterRepositoryImpl.kt @@ -1,6 +1,5 @@ package eu.kanade.data.chapter -import eu.kanade.data.DatabaseHandler import eu.kanade.domain.chapter.model.Chapter import eu.kanade.domain.chapter.model.ChapterUpdate import eu.kanade.domain.chapter.repository.ChapterRepository @@ -8,6 +7,7 @@ import eu.kanade.tachiyomi.util.system.logcat import eu.kanade.tachiyomi.util.system.toLong import kotlinx.coroutines.flow.Flow import logcat.LogPriority +import tachiyomi.data.DatabaseHandler class ChapterRepositoryImpl( private val handler: DatabaseHandler, diff --git a/app/src/main/java/eu/kanade/data/history/HistoryRepositoryImpl.kt b/app/src/main/java/eu/kanade/data/history/HistoryRepositoryImpl.kt index 1716a9c370..806571ac67 100644 --- a/app/src/main/java/eu/kanade/data/history/HistoryRepositoryImpl.kt +++ b/app/src/main/java/eu/kanade/data/history/HistoryRepositoryImpl.kt @@ -1,12 +1,12 @@ package eu.kanade.data.history -import eu.kanade.data.DatabaseHandler import eu.kanade.domain.history.model.HistoryUpdate import eu.kanade.domain.history.model.HistoryWithRelations import eu.kanade.domain.history.repository.HistoryRepository import eu.kanade.tachiyomi.util.system.logcat import kotlinx.coroutines.flow.Flow import logcat.LogPriority +import tachiyomi.data.DatabaseHandler class HistoryRepositoryImpl( private val handler: DatabaseHandler, diff --git a/app/src/main/java/eu/kanade/data/manga/MangaRepositoryImpl.kt b/app/src/main/java/eu/kanade/data/manga/MangaRepositoryImpl.kt index 7e542f3141..60d4dbb74c 100644 --- a/app/src/main/java/eu/kanade/data/manga/MangaRepositoryImpl.kt +++ b/app/src/main/java/eu/kanade/data/manga/MangaRepositoryImpl.kt @@ -1,8 +1,5 @@ package eu.kanade.data.manga -import eu.kanade.data.DatabaseHandler -import eu.kanade.data.listOfStringsAdapter -import eu.kanade.data.updateStrategyAdapter import eu.kanade.domain.library.model.LibraryManga import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.model.MangaUpdate @@ -11,6 +8,9 @@ import eu.kanade.tachiyomi.util.system.logcat import eu.kanade.tachiyomi.util.system.toLong import kotlinx.coroutines.flow.Flow import logcat.LogPriority +import tachiyomi.data.DatabaseHandler +import tachiyomi.data.listOfStringsAdapter +import tachiyomi.data.updateStrategyAdapter class MangaRepositoryImpl( private val handler: DatabaseHandler, diff --git a/app/src/main/java/eu/kanade/data/source/SourceDataRepositoryImpl.kt b/app/src/main/java/eu/kanade/data/source/SourceDataRepositoryImpl.kt index 44e68a8773..6bd19a7670 100644 --- a/app/src/main/java/eu/kanade/data/source/SourceDataRepositoryImpl.kt +++ b/app/src/main/java/eu/kanade/data/source/SourceDataRepositoryImpl.kt @@ -1,9 +1,9 @@ package eu.kanade.data.source -import eu.kanade.data.DatabaseHandler import eu.kanade.domain.source.model.SourceData import eu.kanade.domain.source.repository.SourceDataRepository import kotlinx.coroutines.flow.Flow +import tachiyomi.data.DatabaseHandler class SourceDataRepositoryImpl( private val handler: DatabaseHandler, diff --git a/app/src/main/java/eu/kanade/data/source/SourceRepositoryImpl.kt b/app/src/main/java/eu/kanade/data/source/SourceRepositoryImpl.kt index 45846d3628..28a1742dae 100644 --- a/app/src/main/java/eu/kanade/data/source/SourceRepositoryImpl.kt +++ b/app/src/main/java/eu/kanade/data/source/SourceRepositoryImpl.kt @@ -1,6 +1,5 @@ package eu.kanade.data.source -import eu.kanade.data.DatabaseHandler import eu.kanade.domain.source.model.Source import eu.kanade.domain.source.model.SourcePagingSourceType import eu.kanade.domain.source.model.SourceWithCount @@ -11,6 +10,7 @@ import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.model.FilterList import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map +import tachiyomi.data.DatabaseHandler class SourceRepositoryImpl( private val sourceManager: SourceManager, diff --git a/app/src/main/java/eu/kanade/data/track/TrackRepositoryImpl.kt b/app/src/main/java/eu/kanade/data/track/TrackRepositoryImpl.kt index fdf6584240..56c13a8608 100644 --- a/app/src/main/java/eu/kanade/data/track/TrackRepositoryImpl.kt +++ b/app/src/main/java/eu/kanade/data/track/TrackRepositoryImpl.kt @@ -1,9 +1,9 @@ package eu.kanade.data.track -import eu.kanade.data.DatabaseHandler import eu.kanade.domain.track.model.Track import eu.kanade.domain.track.repository.TrackRepository import kotlinx.coroutines.flow.Flow +import tachiyomi.data.DatabaseHandler class TrackRepositoryImpl( private val handler: DatabaseHandler, diff --git a/app/src/main/java/eu/kanade/data/updates/UpdatesRepositoryImpl.kt b/app/src/main/java/eu/kanade/data/updates/UpdatesRepositoryImpl.kt index e9bccf92d8..6dd8b629ca 100644 --- a/app/src/main/java/eu/kanade/data/updates/UpdatesRepositoryImpl.kt +++ b/app/src/main/java/eu/kanade/data/updates/UpdatesRepositoryImpl.kt @@ -1,9 +1,9 @@ package eu.kanade.data.updates -import eu.kanade.data.DatabaseHandler import eu.kanade.domain.updates.model.UpdatesWithRelations import eu.kanade.domain.updates.repository.UpdatesRepository import kotlinx.coroutines.flow.Flow +import tachiyomi.data.DatabaseHandler class UpdatesRepositoryImpl( val databaseHandler: DatabaseHandler, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/ClearDatabaseScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/ClearDatabaseScreen.kt index 34b0788d34..f09ac28b65 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/ClearDatabaseScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/ClearDatabaseScreen.kt @@ -46,7 +46,6 @@ import eu.kanade.presentation.components.FastScrollLazyColumn import eu.kanade.presentation.components.LoadingScreen import eu.kanade.presentation.components.Scaffold import eu.kanade.presentation.util.selectedBackground -import eu.kanade.tachiyomi.Database import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.lang.launchIO import eu.kanade.tachiyomi.util.lang.launchUI @@ -54,6 +53,7 @@ import eu.kanade.tachiyomi.util.lang.withNonCancellableContext import eu.kanade.tachiyomi.util.system.toast import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.update +import tachiyomi.data.Database import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/App.kt b/app/src/main/java/eu/kanade/tachiyomi/App.kt index 5a714b1a9b..48175dba93 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/App.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/App.kt @@ -24,7 +24,6 @@ import coil.decode.GifDecoder import coil.decode.ImageDecoderDecoder import coil.disk.DiskCache import coil.util.DebugLogger -import eu.kanade.data.DatabaseHandler import eu.kanade.domain.DomainModule import eu.kanade.domain.base.BasePreferences import eu.kanade.domain.ui.UiPreferences @@ -59,6 +58,7 @@ import org.acra.config.httpSender import org.acra.ktx.initAcra import org.acra.sender.HttpSender import org.conscrypt.Conscrypt +import tachiyomi.data.DatabaseHandler import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy diff --git a/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt b/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt index 3a34c0ec36..707349229e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt @@ -7,13 +7,6 @@ import androidx.sqlite.db.SupportSQLiteDatabase import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory import com.squareup.sqldelight.android.AndroidSqliteDriver import com.squareup.sqldelight.db.SqlDriver -import data.History -import data.Mangas -import eu.kanade.data.AndroidDatabaseHandler -import eu.kanade.data.DatabaseHandler -import eu.kanade.data.dateAdapter -import eu.kanade.data.listOfStringsAdapter -import eu.kanade.data.updateStrategyAdapter import eu.kanade.domain.backup.service.BackupPreferences import eu.kanade.domain.base.BasePreferences import eu.kanade.domain.download.service.DownloadPreferences @@ -47,6 +40,14 @@ import nl.adaptivity.xmlutil.XmlDeclMode import nl.adaptivity.xmlutil.core.XmlVersion import nl.adaptivity.xmlutil.serialization.UnknownChildHandler import nl.adaptivity.xmlutil.serialization.XML +import tachiyomi.data.AndroidDatabaseHandler +import tachiyomi.data.Database +import tachiyomi.data.DatabaseHandler +import tachiyomi.data.History +import tachiyomi.data.Mangas +import tachiyomi.data.dateAdapter +import tachiyomi.data.listOfStringsAdapter +import tachiyomi.data.updateStrategyAdapter import uy.kohesive.injekt.api.InjektModule import uy.kohesive.injekt.api.InjektRegistrar import uy.kohesive.injekt.api.addSingleton 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 380ca2e17e..f8441933b4 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 @@ -4,10 +4,6 @@ import android.Manifest import android.content.Context import android.net.Uri import com.hippo.unifile.UniFile -import data.Manga_sync -import data.Mangas -import eu.kanade.data.DatabaseHandler -import eu.kanade.data.updateStrategyAdapter import eu.kanade.domain.backup.service.BackupPreferences import eu.kanade.domain.category.interactor.GetCategories import eu.kanade.domain.category.model.Category @@ -45,6 +41,10 @@ import logcat.LogPriority import okio.buffer import okio.gzip import okio.sink +import tachiyomi.data.DatabaseHandler +import tachiyomi.data.Manga_sync +import tachiyomi.data.Mangas +import tachiyomi.data.updateStrategyAdapter import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.io.FileOutputStream diff --git a/app/src/main/java/eu/kanade/tachiyomi/glance/UpdatesGridGlanceWidget.kt b/app/src/main/java/eu/kanade/tachiyomi/glance/UpdatesGridGlanceWidget.kt index 0958341517..5c85e87be8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/glance/UpdatesGridGlanceWidget.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/glance/UpdatesGridGlanceWidget.kt @@ -43,7 +43,6 @@ import coil.request.ImageRequest import coil.size.Precision import coil.size.Scale import coil.transform.RoundedCornersTransformation -import eu.kanade.data.DatabaseHandler import eu.kanade.domain.manga.model.MangaCover import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.core.security.SecurityPreferences @@ -52,10 +51,11 @@ import eu.kanade.tachiyomi.util.Constants import eu.kanade.tachiyomi.util.lang.launchIO import eu.kanade.tachiyomi.util.system.dpToPx import kotlinx.coroutines.MainScope +import tachiyomi.data.DatabaseHandler +import tachiyomi.view.UpdatesView import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy -import view.UpdatesView import java.util.Calendar import java.util.Date diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/model/SChapterExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/source/model/SChapterExtensions.kt index c54f782344..ad13c090a7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/model/SChapterExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/model/SChapterExtensions.kt @@ -1,6 +1,6 @@ package eu.kanade.tachiyomi.source.model -import data.Chapters +import tachiyomi.data.Chapters fun SChapter.copyFrom(other: Chapters) { name = other.name diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/model/SMangaExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/source/model/SMangaExtensions.kt index 7df175fc55..e6e8d7bc66 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/model/SMangaExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/model/SMangaExtensions.kt @@ -1,6 +1,6 @@ package eu.kanade.tachiyomi.source.model -import data.Mangas +import tachiyomi.data.Mangas fun SManga.copyFrom(other: Mangas) { if (other.author != null) { @@ -16,7 +16,7 @@ fun SManga.copyFrom(other: Mangas) { } if (other.genre != null) { - genre = other.genre.joinToString(separator = ", ") + genre = other.genre!!.joinToString(separator = ", ") } if (other.thumbnail_url != null) { diff --git a/data/.gitignore b/data/.gitignore new file mode 100644 index 0000000000..42afabfd2a --- /dev/null +++ b/data/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/data/build.gradle.kts b/data/build.gradle.kts new file mode 100644 index 0000000000..250b0a8b42 --- /dev/null +++ b/data/build.gradle.kts @@ -0,0 +1,27 @@ +plugins { + id("com.android.library") + kotlin("android") + id("com.squareup.sqldelight") +} + +android { + namespace = "tachiyomi.data" + + defaultConfig { + consumerProguardFiles("consumer-rules.pro") + } + + sqldelight { + database("Database") { + packageName = "tachiyomi.data" + dialect = "sqlite:3.24" + } + } +} + +dependencies { + implementation(project(":source-api")) + api(libs.sqldelight.android.driver) + api(libs.sqldelight.coroutines) + api(libs.sqldelight.android.paging) +} diff --git a/data/consumer-rules.pro b/data/consumer-rules.pro new file mode 100644 index 0000000000..e69de29bb2 diff --git a/data/proguard-rules.pro b/data/proguard-rules.pro new file mode 100644 index 0000000000..481bb43481 --- /dev/null +++ b/data/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/data/src/main/AndroidManifest.xml b/data/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..a5918e68ab --- /dev/null +++ b/data/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/main/java/eu/kanade/data/AndroidDatabaseHandler.kt b/data/src/main/java/tachiyomi/data/AndroidDatabaseHandler.kt similarity index 98% rename from app/src/main/java/eu/kanade/data/AndroidDatabaseHandler.kt rename to data/src/main/java/tachiyomi/data/AndroidDatabaseHandler.kt index 9f4f804c3a..d359114fa3 100644 --- a/app/src/main/java/eu/kanade/data/AndroidDatabaseHandler.kt +++ b/data/src/main/java/tachiyomi/data/AndroidDatabaseHandler.kt @@ -1,4 +1,4 @@ -package eu.kanade.data +package tachiyomi.data import androidx.paging.PagingSource import com.squareup.sqldelight.Query @@ -7,7 +7,6 @@ import com.squareup.sqldelight.runtime.coroutines.asFlow import com.squareup.sqldelight.runtime.coroutines.mapToList import com.squareup.sqldelight.runtime.coroutines.mapToOne import com.squareup.sqldelight.runtime.coroutines.mapToOneOrNull -import eu.kanade.tachiyomi.Database import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.Flow diff --git a/app/src/main/java/eu/kanade/data/DatabaseAdapter.kt b/data/src/main/java/tachiyomi/data/DatabaseAdapter.kt similarity index 97% rename from app/src/main/java/eu/kanade/data/DatabaseAdapter.kt rename to data/src/main/java/tachiyomi/data/DatabaseAdapter.kt index bf6e205f4c..db6d902093 100644 --- a/app/src/main/java/eu/kanade/data/DatabaseAdapter.kt +++ b/data/src/main/java/tachiyomi/data/DatabaseAdapter.kt @@ -1,4 +1,4 @@ -package eu.kanade.data +package tachiyomi.data import com.squareup.sqldelight.ColumnAdapter import eu.kanade.tachiyomi.source.model.UpdateStrategy diff --git a/app/src/main/java/eu/kanade/data/DatabaseHandler.kt b/data/src/main/java/tachiyomi/data/DatabaseHandler.kt similarity index 94% rename from app/src/main/java/eu/kanade/data/DatabaseHandler.kt rename to data/src/main/java/tachiyomi/data/DatabaseHandler.kt index 99da8474db..a300256e0c 100644 --- a/app/src/main/java/eu/kanade/data/DatabaseHandler.kt +++ b/data/src/main/java/tachiyomi/data/DatabaseHandler.kt @@ -1,8 +1,7 @@ -package eu.kanade.data +package tachiyomi.data import androidx.paging.PagingSource import com.squareup.sqldelight.Query -import eu.kanade.tachiyomi.Database import kotlinx.coroutines.flow.Flow interface DatabaseHandler { diff --git a/app/src/main/java/eu/kanade/data/QueryPagingSource.kt b/data/src/main/java/tachiyomi/data/QueryPagingSource.kt similarity index 97% rename from app/src/main/java/eu/kanade/data/QueryPagingSource.kt rename to data/src/main/java/tachiyomi/data/QueryPagingSource.kt index cd80ace101..0d630c9649 100644 --- a/app/src/main/java/eu/kanade/data/QueryPagingSource.kt +++ b/data/src/main/java/tachiyomi/data/QueryPagingSource.kt @@ -1,9 +1,8 @@ -package eu.kanade.data +package tachiyomi.data import androidx.paging.PagingSource import androidx.paging.PagingState import com.squareup.sqldelight.Query -import eu.kanade.tachiyomi.Database import kotlin.properties.Delegates class QueryPagingSource( diff --git a/app/src/main/java/eu/kanade/data/TransactionContext.kt b/data/src/main/java/tachiyomi/data/TransactionContext.kt similarity index 99% rename from app/src/main/java/eu/kanade/data/TransactionContext.kt rename to data/src/main/java/tachiyomi/data/TransactionContext.kt index 34990576ca..63a2b7519a 100644 --- a/app/src/main/java/eu/kanade/data/TransactionContext.kt +++ b/data/src/main/java/tachiyomi/data/TransactionContext.kt @@ -1,4 +1,4 @@ -package eu.kanade.data +package tachiyomi.data import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Job diff --git a/app/src/main/sqldelight/data/categories.sq b/data/src/main/sqldelight/tachiyomi/data/categories.sq similarity index 100% rename from app/src/main/sqldelight/data/categories.sq rename to data/src/main/sqldelight/tachiyomi/data/categories.sq diff --git a/app/src/main/sqldelight/data/chapters.sq b/data/src/main/sqldelight/tachiyomi/data/chapters.sq similarity index 100% rename from app/src/main/sqldelight/data/chapters.sq rename to data/src/main/sqldelight/tachiyomi/data/chapters.sq diff --git a/app/src/main/sqldelight/data/history.sq b/data/src/main/sqldelight/tachiyomi/data/history.sq similarity index 100% rename from app/src/main/sqldelight/data/history.sq rename to data/src/main/sqldelight/tachiyomi/data/history.sq diff --git a/app/src/main/sqldelight/data/manga_sync.sq b/data/src/main/sqldelight/tachiyomi/data/manga_sync.sq similarity index 100% rename from app/src/main/sqldelight/data/manga_sync.sq rename to data/src/main/sqldelight/tachiyomi/data/manga_sync.sq diff --git a/app/src/main/sqldelight/data/mangas.sq b/data/src/main/sqldelight/tachiyomi/data/mangas.sq similarity index 100% rename from app/src/main/sqldelight/data/mangas.sq rename to data/src/main/sqldelight/tachiyomi/data/mangas.sq diff --git a/app/src/main/sqldelight/data/mangas_categories.sq b/data/src/main/sqldelight/tachiyomi/data/mangas_categories.sq similarity index 100% rename from app/src/main/sqldelight/data/mangas_categories.sq rename to data/src/main/sqldelight/tachiyomi/data/mangas_categories.sq diff --git a/app/src/main/sqldelight/data/sources.sq b/data/src/main/sqldelight/tachiyomi/data/sources.sq similarity index 100% rename from app/src/main/sqldelight/data/sources.sq rename to data/src/main/sqldelight/tachiyomi/data/sources.sq diff --git a/app/src/main/sqldelight/migrations/1.sqm b/data/src/main/sqldelight/tachiyomi/migrations/1.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/1.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/1.sqm diff --git a/app/src/main/sqldelight/migrations/10.sqm b/data/src/main/sqldelight/tachiyomi/migrations/10.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/10.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/10.sqm diff --git a/app/src/main/sqldelight/migrations/11.sqm b/data/src/main/sqldelight/tachiyomi/migrations/11.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/11.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/11.sqm diff --git a/app/src/main/sqldelight/migrations/12.sqm b/data/src/main/sqldelight/tachiyomi/migrations/12.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/12.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/12.sqm diff --git a/app/src/main/sqldelight/migrations/13.sqm b/data/src/main/sqldelight/tachiyomi/migrations/13.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/13.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/13.sqm diff --git a/app/src/main/sqldelight/migrations/14.sqm b/data/src/main/sqldelight/tachiyomi/migrations/14.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/14.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/14.sqm diff --git a/app/src/main/sqldelight/migrations/15.sqm b/data/src/main/sqldelight/tachiyomi/migrations/15.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/15.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/15.sqm diff --git a/app/src/main/sqldelight/migrations/16.sqm b/data/src/main/sqldelight/tachiyomi/migrations/16.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/16.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/16.sqm diff --git a/app/src/main/sqldelight/migrations/17.sqm b/data/src/main/sqldelight/tachiyomi/migrations/17.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/17.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/17.sqm diff --git a/app/src/main/sqldelight/migrations/18.sqm b/data/src/main/sqldelight/tachiyomi/migrations/18.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/18.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/18.sqm diff --git a/app/src/main/sqldelight/migrations/19.sqm b/data/src/main/sqldelight/tachiyomi/migrations/19.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/19.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/19.sqm diff --git a/app/src/main/sqldelight/migrations/2.sqm b/data/src/main/sqldelight/tachiyomi/migrations/2.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/2.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/2.sqm diff --git a/app/src/main/sqldelight/migrations/20.sqm b/data/src/main/sqldelight/tachiyomi/migrations/20.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/20.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/20.sqm diff --git a/app/src/main/sqldelight/migrations/21.sqm b/data/src/main/sqldelight/tachiyomi/migrations/21.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/21.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/21.sqm diff --git a/app/src/main/sqldelight/migrations/22.sqm b/data/src/main/sqldelight/tachiyomi/migrations/22.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/22.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/22.sqm diff --git a/app/src/main/sqldelight/migrations/23.sqm b/data/src/main/sqldelight/tachiyomi/migrations/23.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/23.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/23.sqm diff --git a/app/src/main/sqldelight/migrations/3.sqm b/data/src/main/sqldelight/tachiyomi/migrations/3.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/3.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/3.sqm diff --git a/app/src/main/sqldelight/migrations/4.sqm b/data/src/main/sqldelight/tachiyomi/migrations/4.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/4.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/4.sqm diff --git a/app/src/main/sqldelight/migrations/5.sqm b/data/src/main/sqldelight/tachiyomi/migrations/5.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/5.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/5.sqm diff --git a/app/src/main/sqldelight/migrations/6.sqm b/data/src/main/sqldelight/tachiyomi/migrations/6.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/6.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/6.sqm diff --git a/app/src/main/sqldelight/migrations/7.sqm b/data/src/main/sqldelight/tachiyomi/migrations/7.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/7.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/7.sqm diff --git a/app/src/main/sqldelight/migrations/8.sqm b/data/src/main/sqldelight/tachiyomi/migrations/8.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/8.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/8.sqm diff --git a/app/src/main/sqldelight/migrations/9.sqm b/data/src/main/sqldelight/tachiyomi/migrations/9.sqm similarity index 100% rename from app/src/main/sqldelight/migrations/9.sqm rename to data/src/main/sqldelight/tachiyomi/migrations/9.sqm diff --git a/app/src/main/sqldelight/view/historyView.sq b/data/src/main/sqldelight/tachiyomi/view/historyView.sq similarity index 100% rename from app/src/main/sqldelight/view/historyView.sq rename to data/src/main/sqldelight/tachiyomi/view/historyView.sq diff --git a/app/src/main/sqldelight/view/libraryView.sq b/data/src/main/sqldelight/tachiyomi/view/libraryView.sq similarity index 100% rename from app/src/main/sqldelight/view/libraryView.sq rename to data/src/main/sqldelight/tachiyomi/view/libraryView.sq diff --git a/app/src/main/sqldelight/view/updatesView.sq b/data/src/main/sqldelight/tachiyomi/view/updatesView.sq similarity index 100% rename from app/src/main/sqldelight/view/updatesView.sq rename to data/src/main/sqldelight/tachiyomi/view/updatesView.sq diff --git a/settings.gradle.kts b/settings.gradle.kts index a1b80d38d7..b10f164d5e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -41,3 +41,4 @@ include(":i18n") include(":source-api") include(":core") include(":macrobenchmark") +include(":data")