mirror of
https://github.com/mihonapp/mihon.git
synced 2025-10-24 03:58:56 +02:00
Move Category model and repository to domain and data layer (#8967)
To keep the commit from being 100+ files the interactors wasn't moved. The domain module like the data module uses `tachiyomi` instead of `eu.kanade.tachiyomi` for package names
This commit is contained in:
1
domain/.gitignore
vendored
Normal file
1
domain/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
19
domain/build.gradle.kts
Normal file
19
domain/build.gradle.kts
Normal file
@@ -0,0 +1,19 @@
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
kotlin("android")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "tachiyomi.domain"
|
||||
|
||||
defaultConfig {
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles("consumer-rules.pro")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(platform(kotlinx.coroutines.bom))
|
||||
implementation(kotlinx.bundles.coroutines)
|
||||
}
|
||||
0
domain/consumer-rules.pro
Normal file
0
domain/consumer-rules.pro
Normal file
21
domain/proguard-rules.pro
vendored
Normal file
21
domain/proguard-rules.pro
vendored
Normal file
@@ -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
|
||||
2
domain/src/main/AndroidManifest.xml
Normal file
2
domain/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest />
|
||||
@@ -0,0 +1,17 @@
|
||||
package tachiyomi.domain.category.model
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
data class Category(
|
||||
val id: Long,
|
||||
val name: String,
|
||||
val order: Long,
|
||||
val flags: Long,
|
||||
) : Serializable {
|
||||
|
||||
val isSystemCategory: Boolean = id == UNCATEGORIZED_ID
|
||||
|
||||
companion object {
|
||||
const val UNCATEGORIZED_ID = 0L
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package tachiyomi.domain.category.model
|
||||
|
||||
data class CategoryUpdate(
|
||||
val id: Long,
|
||||
val name: String? = null,
|
||||
val order: Long? = null,
|
||||
val flags: Long? = null,
|
||||
)
|
||||
@@ -0,0 +1,28 @@
|
||||
package tachiyomi.domain.category.repository
|
||||
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import tachiyomi.domain.category.model.Category
|
||||
import tachiyomi.domain.category.model.CategoryUpdate
|
||||
|
||||
interface CategoryRepository {
|
||||
|
||||
suspend fun get(id: Long): Category?
|
||||
|
||||
suspend fun getAll(): List<Category>
|
||||
|
||||
fun getAllAsFlow(): Flow<List<Category>>
|
||||
|
||||
suspend fun getCategoriesByMangaId(mangaId: Long): List<Category>
|
||||
|
||||
fun getCategoriesByMangaIdAsFlow(mangaId: Long): Flow<List<Category>>
|
||||
|
||||
suspend fun insert(category: Category)
|
||||
|
||||
suspend fun updatePartial(update: CategoryUpdate)
|
||||
|
||||
suspend fun updatePartial(updates: List<CategoryUpdate>)
|
||||
|
||||
suspend fun updateAllFlags(flags: Long?)
|
||||
|
||||
suspend fun delete(categoryId: Long)
|
||||
}
|
||||
Reference in New Issue
Block a user