Merge pull request #67 from kirmanak/convention-plugin
Extract database to Gradle module
This commit is contained in:
@@ -4,14 +4,12 @@ import com.google.protobuf.gradle.builtins
|
|||||||
import com.google.protobuf.gradle.generateProtoTasks
|
import com.google.protobuf.gradle.generateProtoTasks
|
||||||
import com.google.protobuf.gradle.protobuf
|
import com.google.protobuf.gradle.protobuf
|
||||||
import com.google.protobuf.gradle.protoc
|
import com.google.protobuf.gradle.protoc
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
||||||
import java.io.FileInputStream
|
import java.io.FileInputStream
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("kotlin-android")
|
id("gq.kirmanak.mealient.application")
|
||||||
id("kotlin-kapt")
|
id("kotlin-kapt")
|
||||||
id("com.android.application")
|
|
||||||
id("androidx.navigation.safeargs.kotlin")
|
id("androidx.navigation.safeargs.kotlin")
|
||||||
id("dagger.hilt.android.plugin")
|
id("dagger.hilt.android.plugin")
|
||||||
id("org.jetbrains.kotlin.plugin.serialization")
|
id("org.jetbrains.kotlin.plugin.serialization")
|
||||||
@@ -19,23 +17,14 @@ plugins {
|
|||||||
id("com.google.firebase.crashlytics")
|
id("com.google.firebase.crashlytics")
|
||||||
alias(libs.plugins.appsweep)
|
alias(libs.plugins.appsweep)
|
||||||
alias(libs.plugins.protobuf)
|
alias(libs.plugins.protobuf)
|
||||||
alias(libs.plugins.ksp)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdk = libs.versions.compileSdk.get().toInt()
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "gq.kirmanak.mealient"
|
applicationId = "gq.kirmanak.mealient"
|
||||||
minSdk = libs.versions.minSdk.get().toInt()
|
|
||||||
targetSdk = libs.versions.targetSdk.get().toInt()
|
|
||||||
versionCode = 13
|
versionCode = 13
|
||||||
versionName = "0.2.4"
|
versionName = "0.2.4"
|
||||||
|
|
||||||
ksp {
|
|
||||||
arg("room.schemaLocation", "$projectDir/schemas")
|
|
||||||
}
|
|
||||||
|
|
||||||
buildConfigField("Boolean", "LOG_NETWORK", "false")
|
buildConfigField("Boolean", "LOG_NETWORK", "false")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,64 +62,16 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buildFeatures {
|
|
||||||
viewBinding = true
|
|
||||||
}
|
|
||||||
|
|
||||||
testOptions {
|
|
||||||
unitTests {
|
|
||||||
isIncludeAndroidResources = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lint {
|
|
||||||
disable += listOf("ObsoleteLintCustomCheck", "IconMissingDensityFolder")
|
|
||||||
enable += listOf(
|
|
||||||
"ConvertToWebp",
|
|
||||||
"DuplicateStrings",
|
|
||||||
"EasterEgg",
|
|
||||||
"ExpensiveAssertion",
|
|
||||||
"IconExpectedSize",
|
|
||||||
"ImplicitSamInstance",
|
|
||||||
"InvalidPackage",
|
|
||||||
"KotlinPropertyAccess",
|
|
||||||
"LambdaLast",
|
|
||||||
"MinSdkTooLow",
|
|
||||||
"NegativeMargin",
|
|
||||||
"NoHardKeywords",
|
|
||||||
"Registered",
|
|
||||||
"RequiredSize",
|
|
||||||
"UnknownNullness",
|
|
||||||
"WrongThreadInterprocedural"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace = "gq.kirmanak.mealient"
|
namespace = "gq.kirmanak.mealient"
|
||||||
|
|
||||||
packagingOptions {
|
packagingOptions {
|
||||||
resources.excludes += "DebugProbesKt.bin"
|
resources.excludes += "DebugProbesKt.bin"
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
|
||||||
isCoreLibraryDesugaringEnabled = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<Test>().configureEach {
|
|
||||||
configure<JacocoTaskExtension> {
|
|
||||||
isIncludeNoLocationClasses = true
|
|
||||||
excludes = listOf("jdk.internal.*")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<KotlinCompile> {
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
coreLibraryDesugaring(libs.android.tools.desugar)
|
|
||||||
|
implementation(project(":database"))
|
||||||
|
|
||||||
implementation(libs.android.material.material)
|
implementation(libs.android.material.material)
|
||||||
|
|
||||||
@@ -169,11 +110,6 @@ dependencies {
|
|||||||
implementation(libs.androidx.paging.runtimeKtx)
|
implementation(libs.androidx.paging.runtimeKtx)
|
||||||
testImplementation(libs.androidx.paging.commonKtx)
|
testImplementation(libs.androidx.paging.commonKtx)
|
||||||
|
|
||||||
implementation(libs.androidx.room.runtime)
|
|
||||||
implementation(libs.androidx.room.ktx)
|
|
||||||
implementation(libs.androidx.room.paging)
|
|
||||||
ksp(libs.androidx.room.compiler)
|
|
||||||
testImplementation(libs.androidx.room.testing)
|
|
||||||
|
|
||||||
implementation(libs.jetbrains.kotlinx.datetime)
|
implementation(libs.jetbrains.kotlinx.datetime)
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package gq.kirmanak.mealient.data.recipes
|
package gq.kirmanak.mealient.data.recipes
|
||||||
|
|
||||||
import androidx.paging.Pager
|
import androidx.paging.Pager
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
import gq.kirmanak.mealient.database.recipe.entity.FullRecipeInfo
|
||||||
import gq.kirmanak.mealient.data.recipes.impl.FullRecipeInfo
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
|
|
||||||
interface RecipeRepo {
|
interface RecipeRepo {
|
||||||
fun createPager(): Pager<Int, RecipeSummaryEntity>
|
fun createPager(): Pager<Int, RecipeSummaryEntity>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package gq.kirmanak.mealient.data.recipes.db
|
package gq.kirmanak.mealient.data.recipes.db
|
||||||
|
|
||||||
import androidx.paging.PagingSource
|
import androidx.paging.PagingSource
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
|
||||||
import gq.kirmanak.mealient.data.recipes.impl.FullRecipeInfo
|
|
||||||
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeResponse
|
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeResponse
|
||||||
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeSummaryResponse
|
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeSummaryResponse
|
||||||
|
import gq.kirmanak.mealient.database.recipe.entity.FullRecipeInfo
|
||||||
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
|
|
||||||
interface RecipeStorage {
|
interface RecipeStorage {
|
||||||
suspend fun saveRecipes(recipes: List<GetRecipeSummaryResponse>)
|
suspend fun saveRecipes(recipes: List<GetRecipeSummaryResponse>)
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package gq.kirmanak.mealient.data.recipes.db
|
|||||||
|
|
||||||
import androidx.paging.PagingSource
|
import androidx.paging.PagingSource
|
||||||
import androidx.room.withTransaction
|
import androidx.room.withTransaction
|
||||||
import gq.kirmanak.mealient.data.AppDb
|
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.*
|
|
||||||
import gq.kirmanak.mealient.data.recipes.impl.FullRecipeInfo
|
|
||||||
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeResponse
|
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeResponse
|
||||||
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeSummaryResponse
|
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeSummaryResponse
|
||||||
|
import gq.kirmanak.mealient.database.AppDb
|
||||||
|
import gq.kirmanak.mealient.database.recipe.RecipeDao
|
||||||
|
import gq.kirmanak.mealient.database.recipe.entity.*
|
||||||
import gq.kirmanak.mealient.extensions.recipeEntity
|
import gq.kirmanak.mealient.extensions.recipeEntity
|
||||||
import gq.kirmanak.mealient.extensions.toRecipeEntity
|
import gq.kirmanak.mealient.extensions.toRecipeEntity
|
||||||
import gq.kirmanak.mealient.extensions.toRecipeIngredientEntity
|
import gq.kirmanak.mealient.extensions.toRecipeIngredientEntity
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ import androidx.paging.Pager
|
|||||||
import androidx.paging.PagingConfig
|
import androidx.paging.PagingConfig
|
||||||
import gq.kirmanak.mealient.data.recipes.RecipeRepo
|
import gq.kirmanak.mealient.data.recipes.RecipeRepo
|
||||||
import gq.kirmanak.mealient.data.recipes.db.RecipeStorage
|
import gq.kirmanak.mealient.data.recipes.db.RecipeStorage
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
|
||||||
import gq.kirmanak.mealient.data.recipes.network.RecipeDataSource
|
import gq.kirmanak.mealient.data.recipes.network.RecipeDataSource
|
||||||
|
import gq.kirmanak.mealient.database.recipe.entity.FullRecipeInfo
|
||||||
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
import gq.kirmanak.mealient.extensions.runCatchingExceptCancel
|
import gq.kirmanak.mealient.extensions.runCatchingExceptCancel
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import androidx.paging.*
|
|||||||
import androidx.paging.LoadType.PREPEND
|
import androidx.paging.LoadType.PREPEND
|
||||||
import androidx.paging.LoadType.REFRESH
|
import androidx.paging.LoadType.REFRESH
|
||||||
import gq.kirmanak.mealient.data.recipes.db.RecipeStorage
|
import gq.kirmanak.mealient.data.recipes.db.RecipeStorage
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
|
||||||
import gq.kirmanak.mealient.data.recipes.network.RecipeDataSource
|
import gq.kirmanak.mealient.data.recipes.network.RecipeDataSource
|
||||||
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
import gq.kirmanak.mealient.extensions.runCatchingExceptCancel
|
import gq.kirmanak.mealient.extensions.runCatchingExceptCancel
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|||||||
@@ -5,14 +5,12 @@ import androidx.datastore.core.DataStore
|
|||||||
import androidx.datastore.preferences.core.PreferenceDataStoreFactory
|
import androidx.datastore.preferences.core.PreferenceDataStoreFactory
|
||||||
import androidx.datastore.preferences.core.Preferences
|
import androidx.datastore.preferences.core.Preferences
|
||||||
import androidx.datastore.preferences.preferencesDataStoreFile
|
import androidx.datastore.preferences.preferencesDataStoreFile
|
||||||
import androidx.room.Room
|
|
||||||
import dagger.Binds
|
import dagger.Binds
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
import dagger.hilt.InstallIn
|
import dagger.hilt.InstallIn
|
||||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
import dagger.hilt.components.SingletonComponent
|
import dagger.hilt.components.SingletonComponent
|
||||||
import gq.kirmanak.mealient.data.AppDb
|
|
||||||
import gq.kirmanak.mealient.data.storage.PreferencesStorage
|
import gq.kirmanak.mealient.data.storage.PreferencesStorage
|
||||||
import gq.kirmanak.mealient.data.storage.PreferencesStorageImpl
|
import gq.kirmanak.mealient.data.storage.PreferencesStorageImpl
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
@@ -22,11 +20,6 @@ import javax.inject.Singleton
|
|||||||
interface AppModule {
|
interface AppModule {
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
@Provides
|
|
||||||
@Singleton
|
|
||||||
fun createDb(@ApplicationContext context: Context): AppDb =
|
|
||||||
Room.databaseBuilder(context, AppDb::class.java, "app.db").build()
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
fun provideDataStore(@ApplicationContext context: Context): DataStore<Preferences> =
|
fun provideDataStore(@ApplicationContext context: Context): DataStore<Preferences> =
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import com.bumptech.glide.load.model.ModelLoaderFactory
|
|||||||
import dagger.hilt.EntryPoint
|
import dagger.hilt.EntryPoint
|
||||||
import dagger.hilt.InstallIn
|
import dagger.hilt.InstallIn
|
||||||
import dagger.hilt.components.SingletonComponent
|
import dagger.hilt.components.SingletonComponent
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import javax.inject.Named
|
import javax.inject.Named
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ import gq.kirmanak.mealient.data.network.createServiceFactory
|
|||||||
import gq.kirmanak.mealient.data.recipes.RecipeRepo
|
import gq.kirmanak.mealient.data.recipes.RecipeRepo
|
||||||
import gq.kirmanak.mealient.data.recipes.db.RecipeStorage
|
import gq.kirmanak.mealient.data.recipes.db.RecipeStorage
|
||||||
import gq.kirmanak.mealient.data.recipes.db.RecipeStorageImpl
|
import gq.kirmanak.mealient.data.recipes.db.RecipeStorageImpl
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
|
||||||
import gq.kirmanak.mealient.data.recipes.impl.RecipeImageUrlProvider
|
import gq.kirmanak.mealient.data.recipes.impl.RecipeImageUrlProvider
|
||||||
import gq.kirmanak.mealient.data.recipes.impl.RecipeImageUrlProviderImpl
|
import gq.kirmanak.mealient.data.recipes.impl.RecipeImageUrlProviderImpl
|
||||||
import gq.kirmanak.mealient.data.recipes.impl.RecipeRepoImpl
|
import gq.kirmanak.mealient.data.recipes.impl.RecipeRepoImpl
|
||||||
import gq.kirmanak.mealient.data.recipes.network.RecipeDataSource
|
import gq.kirmanak.mealient.data.recipes.network.RecipeDataSource
|
||||||
import gq.kirmanak.mealient.data.recipes.network.RecipeDataSourceImpl
|
import gq.kirmanak.mealient.data.recipes.network.RecipeDataSourceImpl
|
||||||
import gq.kirmanak.mealient.data.recipes.network.RecipeService
|
import gq.kirmanak.mealient.data.recipes.network.RecipeService
|
||||||
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
import gq.kirmanak.mealient.ui.recipes.images.RecipeModelLoaderFactory
|
import gq.kirmanak.mealient.ui.recipes.images.RecipeModelLoaderFactory
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
|
|||||||
@@ -2,14 +2,14 @@ package gq.kirmanak.mealient.extensions
|
|||||||
|
|
||||||
import gq.kirmanak.mealient.data.baseurl.VersionInfo
|
import gq.kirmanak.mealient.data.baseurl.VersionInfo
|
||||||
import gq.kirmanak.mealient.data.baseurl.impl.VersionResponse
|
import gq.kirmanak.mealient.data.baseurl.impl.VersionResponse
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeEntity
|
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeIngredientEntity
|
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeInstructionEntity
|
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
|
||||||
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeIngredientResponse
|
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeIngredientResponse
|
||||||
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeInstructionResponse
|
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeInstructionResponse
|
||||||
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeResponse
|
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeResponse
|
||||||
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeSummaryResponse
|
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeSummaryResponse
|
||||||
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeEntity
|
||||||
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeIngredientEntity
|
||||||
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeInstructionEntity
|
||||||
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
|
|
||||||
fun GetRecipeResponse.toRecipeEntity() = RecipeEntity(
|
fun GetRecipeResponse.toRecipeEntity() = RecipeEntity(
|
||||||
remoteId = remoteId,
|
remoteId = remoteId,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader
|
|||||||
import com.bumptech.glide.load.model.GlideUrl
|
import com.bumptech.glide.load.model.GlideUrl
|
||||||
import com.bumptech.glide.module.AppGlideModule
|
import com.bumptech.glide.module.AppGlideModule
|
||||||
import dagger.hilt.android.EntryPointAccessors.fromApplication
|
import dagger.hilt.android.EntryPointAccessors.fromApplication
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
import gq.kirmanak.mealient.di.GlideModuleEntryPoint
|
import gq.kirmanak.mealient.di.GlideModuleEntryPoint
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package gq.kirmanak.mealient.ui.recipes
|
|||||||
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import gq.kirmanak.mealient.R
|
import gq.kirmanak.mealient.R
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
import gq.kirmanak.mealient.databinding.ViewHolderRecipeBinding
|
import gq.kirmanak.mealient.databinding.ViewHolderRecipeBinding
|
||||||
import gq.kirmanak.mealient.ui.recipes.images.RecipeImageLoader
|
import gq.kirmanak.mealient.ui.recipes.images.RecipeImageLoader
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import androidx.navigation.fragment.findNavController
|
|||||||
import by.kirich1409.viewbindingdelegate.viewBinding
|
import by.kirich1409.viewbindingdelegate.viewBinding
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import gq.kirmanak.mealient.R
|
import gq.kirmanak.mealient.R
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
import gq.kirmanak.mealient.databinding.FragmentRecipesBinding
|
import gq.kirmanak.mealient.databinding.FragmentRecipesBinding
|
||||||
import gq.kirmanak.mealient.extensions.collectWhenViewResumed
|
import gq.kirmanak.mealient.extensions.collectWhenViewResumed
|
||||||
import gq.kirmanak.mealient.extensions.refreshRequestFlow
|
import gq.kirmanak.mealient.extensions.refreshRequestFlow
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import android.view.LayoutInflater
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.paging.PagingDataAdapter
|
import androidx.paging.PagingDataAdapter
|
||||||
import androidx.recyclerview.widget.DiffUtil
|
import androidx.recyclerview.widget.DiffUtil
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
import gq.kirmanak.mealient.databinding.ViewHolderRecipeBinding
|
import gq.kirmanak.mealient.databinding.ViewHolderRecipeBinding
|
||||||
import gq.kirmanak.mealient.ui.recipes.images.RecipeImageLoader
|
import gq.kirmanak.mealient.ui.recipes.images.RecipeImageLoader
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package gq.kirmanak.mealient.ui.recipes.images
|
package gq.kirmanak.mealient.ui.recipes.images
|
||||||
|
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
|
|
||||||
interface RecipeImageLoader {
|
interface RecipeImageLoader {
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import androidx.fragment.app.Fragment
|
|||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.request.RequestOptions
|
import com.bumptech.glide.request.RequestOptions
|
||||||
import dagger.hilt.android.scopes.FragmentScoped
|
import dagger.hilt.android.scopes.FragmentScoped
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import com.bumptech.glide.load.model.GlideUrl
|
|||||||
import com.bumptech.glide.load.model.ModelCache
|
import com.bumptech.glide.load.model.ModelCache
|
||||||
import com.bumptech.glide.load.model.ModelLoader
|
import com.bumptech.glide.load.model.ModelLoader
|
||||||
import com.bumptech.glide.load.model.stream.BaseGlideUrlLoader
|
import com.bumptech.glide.load.model.stream.BaseGlideUrlLoader
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
|
||||||
import gq.kirmanak.mealient.data.recipes.impl.RecipeImageUrlProvider
|
import gq.kirmanak.mealient.data.recipes.impl.RecipeImageUrlProvider
|
||||||
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package gq.kirmanak.mealient.ui.recipes.images
|
package gq.kirmanak.mealient.ui.recipes.images
|
||||||
|
|
||||||
import com.bumptech.glide.load.model.*
|
import com.bumptech.glide.load.model.*
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
|
||||||
import gq.kirmanak.mealient.data.recipes.impl.RecipeImageUrlProvider
|
import gq.kirmanak.mealient.data.recipes.impl.RecipeImageUrlProvider
|
||||||
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import com.bumptech.glide.ListPreloader
|
|||||||
import com.bumptech.glide.RequestBuilder
|
import com.bumptech.glide.RequestBuilder
|
||||||
import com.bumptech.glide.request.RequestOptions
|
import com.bumptech.glide.request.RequestOptions
|
||||||
import dagger.hilt.android.scopes.FragmentScoped
|
import dagger.hilt.android.scopes.FragmentScoped
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package gq.kirmanak.mealient.ui.recipes.images
|
|||||||
|
|
||||||
import androidx.paging.PagingDataAdapter
|
import androidx.paging.PagingDataAdapter
|
||||||
import com.bumptech.glide.integration.recyclerview.RecyclerViewPreloader
|
import com.bumptech.glide.integration.recyclerview.RecyclerViewPreloader
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
|
|
||||||
interface RecipePreloaderFactory {
|
interface RecipePreloaderFactory {
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import androidx.paging.PagingDataAdapter
|
|||||||
import com.bumptech.glide.integration.recyclerview.RecyclerViewPreloader
|
import com.bumptech.glide.integration.recyclerview.RecyclerViewPreloader
|
||||||
import com.bumptech.glide.util.ViewPreloadSizeProvider
|
import com.bumptech.glide.util.ViewPreloadSizeProvider
|
||||||
import dagger.hilt.android.scopes.FragmentScoped
|
import dagger.hilt.android.scopes.FragmentScoped
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@FragmentScoped
|
@FragmentScoped
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package gq.kirmanak.mealient.ui.recipes.info
|
package gq.kirmanak.mealient.ui.recipes.info
|
||||||
|
|
||||||
import gq.kirmanak.mealient.data.recipes.impl.FullRecipeInfo
|
import gq.kirmanak.mealient.database.recipe.entity.FullRecipeInfo
|
||||||
|
|
||||||
data class RecipeInfoUiState(
|
data class RecipeInfoUiState(
|
||||||
val areIngredientsVisible: Boolean = false,
|
val areIngredientsVisible: Boolean = false,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import android.view.ViewGroup
|
|||||||
import androidx.recyclerview.widget.DiffUtil
|
import androidx.recyclerview.widget.DiffUtil
|
||||||
import androidx.recyclerview.widget.ListAdapter
|
import androidx.recyclerview.widget.ListAdapter
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeIngredientEntity
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeIngredientEntity
|
||||||
import gq.kirmanak.mealient.databinding.ViewHolderIngredientBinding
|
import gq.kirmanak.mealient.databinding.ViewHolderIngredientBinding
|
||||||
import gq.kirmanak.mealient.ui.recipes.info.RecipeIngredientsAdapter.RecipeIngredientViewHolder
|
import gq.kirmanak.mealient.ui.recipes.info.RecipeIngredientsAdapter.RecipeIngredientViewHolder
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import androidx.recyclerview.widget.DiffUtil
|
|||||||
import androidx.recyclerview.widget.ListAdapter
|
import androidx.recyclerview.widget.ListAdapter
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import gq.kirmanak.mealient.R
|
import gq.kirmanak.mealient.R
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeInstructionEntity
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeInstructionEntity
|
||||||
import gq.kirmanak.mealient.databinding.ViewHolderInstructionBinding
|
import gq.kirmanak.mealient.databinding.ViewHolderInstructionBinding
|
||||||
import gq.kirmanak.mealient.ui.recipes.info.RecipeInstructionsAdapter.RecipeInstructionViewHolder
|
import gq.kirmanak.mealient.ui.recipes.info.RecipeInstructionsAdapter.RecipeInstructionViewHolder
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package gq.kirmanak.mealient.data.recipes.db
|
|||||||
|
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.hilt.android.testing.HiltAndroidTest
|
import dagger.hilt.android.testing.HiltAndroidTest
|
||||||
import gq.kirmanak.mealient.data.AppDb
|
import gq.kirmanak.mealient.database.AppDb
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.CategoryEntity
|
import gq.kirmanak.mealient.database.recipe.entity.CategoryEntity
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.CategoryRecipeEntity
|
import gq.kirmanak.mealient.database.recipe.entity.CategoryRecipeEntity
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.TagEntity
|
import gq.kirmanak.mealient.database.recipe.entity.TagEntity
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.TagRecipeEntity
|
import gq.kirmanak.mealient.database.recipe.entity.TagRecipeEntity
|
||||||
import gq.kirmanak.mealient.test.HiltRobolectricTest
|
import gq.kirmanak.mealient.test.HiltRobolectricTest
|
||||||
import gq.kirmanak.mealient.test.RecipeImplTestData.BREAD_INGREDIENT
|
import gq.kirmanak.mealient.test.RecipeImplTestData.BREAD_INGREDIENT
|
||||||
import gq.kirmanak.mealient.test.RecipeImplTestData.CAKE_BREAD_RECIPE_INGREDIENT_ENTITY
|
import gq.kirmanak.mealient.test.RecipeImplTestData.CAKE_BREAD_RECIPE_INGREDIENT_ENTITY
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import androidx.paging.InvalidatingPagingSourceFactory
|
|||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import gq.kirmanak.mealient.data.recipes.RecipeRepo
|
import gq.kirmanak.mealient.data.recipes.RecipeRepo
|
||||||
import gq.kirmanak.mealient.data.recipes.db.RecipeStorage
|
import gq.kirmanak.mealient.data.recipes.db.RecipeStorage
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
|
||||||
import gq.kirmanak.mealient.data.recipes.network.RecipeDataSource
|
import gq.kirmanak.mealient.data.recipes.network.RecipeDataSource
|
||||||
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
import gq.kirmanak.mealient.test.RecipeImplTestData.FULL_CAKE_INFO_ENTITY
|
import gq.kirmanak.mealient.test.RecipeImplTestData.FULL_CAKE_INFO_ENTITY
|
||||||
import gq.kirmanak.mealient.test.RecipeImplTestData.GET_CAKE_RESPONSE
|
import gq.kirmanak.mealient.test.RecipeImplTestData.GET_CAKE_RESPONSE
|
||||||
import io.mockk.MockKAnnotations
|
import io.mockk.MockKAnnotations
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import androidx.paging.LoadType.*
|
|||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import gq.kirmanak.mealient.data.network.NetworkError.Unauthorized
|
import gq.kirmanak.mealient.data.network.NetworkError.Unauthorized
|
||||||
import gq.kirmanak.mealient.data.recipes.db.RecipeStorage
|
import gq.kirmanak.mealient.data.recipes.db.RecipeStorage
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
|
||||||
import gq.kirmanak.mealient.data.recipes.network.RecipeDataSource
|
import gq.kirmanak.mealient.data.recipes.network.RecipeDataSource
|
||||||
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
import gq.kirmanak.mealient.test.RecipeImplTestData.TEST_RECIPE_SUMMARIES
|
import gq.kirmanak.mealient.test.RecipeImplTestData.TEST_RECIPE_SUMMARIES
|
||||||
import io.mockk.MockKAnnotations
|
import io.mockk.MockKAnnotations
|
||||||
import io.mockk.coEvery
|
import io.mockk.coEvery
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
package gq.kirmanak.mealient.test
|
package gq.kirmanak.mealient.test
|
||||||
|
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeEntity
|
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeIngredientEntity
|
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeInstructionEntity
|
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
|
||||||
import gq.kirmanak.mealient.data.recipes.impl.FullRecipeInfo
|
|
||||||
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeIngredientResponse
|
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeIngredientResponse
|
||||||
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeInstructionResponse
|
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeInstructionResponse
|
||||||
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeResponse
|
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeResponse
|
||||||
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeSummaryResponse
|
import gq.kirmanak.mealient.data.recipes.network.response.GetRecipeSummaryResponse
|
||||||
|
import gq.kirmanak.mealient.database.recipe.entity.*
|
||||||
import kotlinx.datetime.LocalDate
|
import kotlinx.datetime.LocalDate
|
||||||
import kotlinx.datetime.LocalDateTime
|
import kotlinx.datetime.LocalDateTime
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
/build
|
/build
|
||||||
|
|
||||||
23
build-logic/convention/build.gradle.kts
Normal file
23
build-logic/convention/build.gradle.kts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
plugins {
|
||||||
|
`kotlin-dsl`
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "gq.kirmanak.mealient.buildlogic"
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(libs.jetbrains.kotlinPlugin)
|
||||||
|
implementation(libs.android.gradlePlugin)
|
||||||
|
}
|
||||||
|
|
||||||
|
gradlePlugin {
|
||||||
|
plugins {
|
||||||
|
register("androidApplication") {
|
||||||
|
id = "gq.kirmanak.mealient.application"
|
||||||
|
implementationClass = "AndroidApplicationConventionPlugin"
|
||||||
|
}
|
||||||
|
register("androidLibrary") {
|
||||||
|
id = "gq.kirmanak.mealient.library"
|
||||||
|
implementationClass = "AndroidLibraryConventionPlugin"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
|
||||||
|
import gq.kirmanak.mealient.Versions
|
||||||
|
import gq.kirmanak.mealient.configureKotlinAndroid
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
|
||||||
|
class AndroidApplicationConventionPlugin : Plugin<Project> {
|
||||||
|
|
||||||
|
override fun apply(target: Project) {
|
||||||
|
with(target) {
|
||||||
|
with(pluginManager) {
|
||||||
|
apply("com.android.application")
|
||||||
|
apply("org.jetbrains.kotlin.android")
|
||||||
|
}
|
||||||
|
|
||||||
|
extensions.configure<BaseAppModuleExtension> {
|
||||||
|
configureKotlinAndroid(this)
|
||||||
|
defaultConfig.targetSdk = Versions.TARGET_SDK_VERSION
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import com.android.build.gradle.LibraryExtension
|
||||||
|
import gq.kirmanak.mealient.Versions
|
||||||
|
import gq.kirmanak.mealient.configureKotlinAndroid
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
|
||||||
|
class AndroidLibraryConventionPlugin : Plugin<Project> {
|
||||||
|
override fun apply(target: Project) {
|
||||||
|
with(target) {
|
||||||
|
with(pluginManager) {
|
||||||
|
apply("com.android.library")
|
||||||
|
apply("org.jetbrains.kotlin.android")
|
||||||
|
}
|
||||||
|
|
||||||
|
extensions.configure<LibraryExtension> {
|
||||||
|
configureKotlinAndroid(this)
|
||||||
|
defaultConfig.targetSdk = Versions.TARGET_SDK_VERSION
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
@file:Suppress("UnstableApiUsage")
|
||||||
|
|
||||||
|
package gq.kirmanak.mealient
|
||||||
|
|
||||||
|
import com.android.build.api.dsl.CommonExtension
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.plugins.ExtensionAware
|
||||||
|
import org.gradle.api.tasks.testing.Test
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
import org.gradle.kotlin.dsl.dependencies
|
||||||
|
import org.gradle.kotlin.dsl.withType
|
||||||
|
import org.gradle.testing.jacoco.plugins.JacocoTaskExtension
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
|
||||||
|
|
||||||
|
internal fun Project.configureKotlinAndroid(
|
||||||
|
commonExtension: CommonExtension<*, *, *, *>,
|
||||||
|
) {
|
||||||
|
commonExtension.apply {
|
||||||
|
compileSdk = Versions.COMPILE_SDK_VERSION
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdk = Versions.MIN_SDK_VERSION
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
isCoreLibraryDesugaringEnabled = true
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlinOptions {
|
||||||
|
freeCompilerArgs = freeCompilerArgs + listOf("-opt-in=kotlin.RequiresOptIn")
|
||||||
|
}
|
||||||
|
|
||||||
|
lint {
|
||||||
|
disable += listOf("ObsoleteLintCustomCheck", "IconMissingDensityFolder")
|
||||||
|
enable += listOf(
|
||||||
|
"ConvertToWebp",
|
||||||
|
"DuplicateStrings",
|
||||||
|
"EasterEgg",
|
||||||
|
"ExpensiveAssertion",
|
||||||
|
"IconExpectedSize",
|
||||||
|
"ImplicitSamInstance",
|
||||||
|
"InvalidPackage",
|
||||||
|
"KotlinPropertyAccess",
|
||||||
|
"LambdaLast",
|
||||||
|
"MinSdkTooLow",
|
||||||
|
"NegativeMargin",
|
||||||
|
"NoHardKeywords",
|
||||||
|
"Registered",
|
||||||
|
"RequiredSize",
|
||||||
|
"UnknownNullness",
|
||||||
|
"WrongThreadInterprocedural"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
buildFeatures {
|
||||||
|
viewBinding = true
|
||||||
|
}
|
||||||
|
|
||||||
|
testOptions {
|
||||||
|
unitTests {
|
||||||
|
isIncludeAndroidResources = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
add("coreLibraryDesugaring", libs.findLibrary("android-tools-desugar").get())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<Test>().configureEach {
|
||||||
|
configure<JacocoTaskExtension> {
|
||||||
|
isIncludeNoLocationClasses = true
|
||||||
|
excludes = listOf("jdk.internal.*")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun CommonExtension<*, *, *, *>.kotlinOptions(block: KotlinJvmOptions.() -> Unit) {
|
||||||
|
(this as ExtensionAware).extensions.configure("kotlinOptions", block)
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package gq.kirmanak.mealient
|
||||||
|
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.artifacts.VersionCatalog
|
||||||
|
import org.gradle.api.artifacts.VersionCatalogsExtension
|
||||||
|
import org.gradle.kotlin.dsl.getByType
|
||||||
|
|
||||||
|
object Versions {
|
||||||
|
const val MIN_SDK_VERSION = 23
|
||||||
|
const val TARGET_SDK_VERSION = 32
|
||||||
|
const val COMPILE_SDK_VERSION = 32
|
||||||
|
}
|
||||||
|
|
||||||
|
val Project.libs: VersionCatalog
|
||||||
|
get() = extensions.getByType<VersionCatalogsExtension>().named("libs")
|
||||||
4
build-logic/gradle.properties
Normal file
4
build-logic/gradle.properties
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Gradle properties are not passed to included builds https://github.com/gradle/gradle/issues/2534
|
||||||
|
org.gradle.parallel=true
|
||||||
|
org.gradle.caching=true
|
||||||
|
org.gradle.configureondemand=true
|
||||||
15
build-logic/settings.gradle.kts
Normal file
15
build-logic/settings.gradle.kts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
@file:Suppress("UnstableApiUsage")
|
||||||
|
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
versionCatalogs {
|
||||||
|
create("libs") {
|
||||||
|
from(files("../gradle/libs.versions.toml"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
include(":convention")
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
`kotlin-dsl`
|
|
||||||
}
|
|
||||||
1
database/.gitignore
vendored
Normal file
1
database/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
43
database/build.gradle.kts
Normal file
43
database/build.gradle.kts
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
plugins {
|
||||||
|
id("gq.kirmanak.mealient.library")
|
||||||
|
id("kotlin-kapt")
|
||||||
|
id("dagger.hilt.android.plugin")
|
||||||
|
alias(libs.plugins.ksp)
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
defaultConfig {
|
||||||
|
ksp {
|
||||||
|
arg("room.schemaLocation", "$projectDir/schemas")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace = "gq.kirmanak.mealient.database"
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(libs.google.dagger.hiltAndroid)
|
||||||
|
kapt(libs.google.dagger.hiltCompiler)
|
||||||
|
kaptTest(libs.google.dagger.hiltAndroidCompiler)
|
||||||
|
testImplementation(libs.google.dagger.hiltAndroidTesting)
|
||||||
|
|
||||||
|
// withTransaction is used in the app module
|
||||||
|
api(libs.androidx.room.ktx)
|
||||||
|
|
||||||
|
implementation(libs.androidx.room.runtime)
|
||||||
|
implementation(libs.androidx.room.paging)
|
||||||
|
ksp(libs.androidx.room.compiler)
|
||||||
|
testImplementation(libs.androidx.room.testing)
|
||||||
|
|
||||||
|
implementation(libs.jetbrains.kotlinx.datetime)
|
||||||
|
|
||||||
|
implementation(libs.jetbrains.kotlinx.coroutinesAndroid)
|
||||||
|
testImplementation(libs.jetbrains.kotlinx.coroutinesTest)
|
||||||
|
|
||||||
|
testImplementation(libs.androidx.test.junit)
|
||||||
|
|
||||||
|
testImplementation(libs.google.truth)
|
||||||
|
|
||||||
|
testImplementation(libs.io.mockk)
|
||||||
|
|
||||||
|
}
|
||||||
1
database/src/main/AndroidManifest.xml
Normal file
1
database/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<manifest />
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
package gq.kirmanak.mealient.data
|
package gq.kirmanak.mealient.database
|
||||||
|
|
||||||
import androidx.room.AutoMigration
|
import androidx.room.AutoMigration
|
||||||
import androidx.room.Database
|
import androidx.room.Database
|
||||||
import androidx.room.RoomDatabase
|
import androidx.room.RoomDatabase
|
||||||
import androidx.room.TypeConverters
|
import androidx.room.TypeConverters
|
||||||
import gq.kirmanak.mealient.data.recipes.db.RecipeDao
|
import gq.kirmanak.mealient.database.recipe.RecipeDao
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.*
|
import gq.kirmanak.mealient.database.recipe.entity.*
|
||||||
import gq.kirmanak.mealient.extensions.RoomTypeConverters
|
|
||||||
|
|
||||||
@Database(
|
@Database(
|
||||||
version = 2,
|
version = 2,
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package gq.kirmanak.mealient.database
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.room.Room
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.Provides
|
||||||
|
import dagger.hilt.InstallIn
|
||||||
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
|
import dagger.hilt.components.SingletonComponent
|
||||||
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
@Module
|
||||||
|
@InstallIn(SingletonComponent::class)
|
||||||
|
interface DatabaseModule {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
fun createDb(@ApplicationContext context: Context): AppDb =
|
||||||
|
Room.databaseBuilder(context, AppDb::class.java, "app.db").build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package gq.kirmanak.mealient.extensions
|
package gq.kirmanak.mealient.database
|
||||||
|
|
||||||
import androidx.room.TypeConverter
|
import androidx.room.TypeConverter
|
||||||
import kotlinx.datetime.*
|
import kotlinx.datetime.*
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
package gq.kirmanak.mealient.data.recipes.db
|
package gq.kirmanak.mealient.database.recipe
|
||||||
|
|
||||||
import androidx.paging.PagingSource
|
import androidx.paging.PagingSource
|
||||||
import androidx.room.*
|
import androidx.room.*
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.*
|
import gq.kirmanak.mealient.database.recipe.entity.*
|
||||||
import gq.kirmanak.mealient.data.recipes.impl.FullRecipeInfo
|
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
interface RecipeDao {
|
interface RecipeDao {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package gq.kirmanak.mealient.data.recipes.db.entity
|
package gq.kirmanak.mealient.database.recipe.entity
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package gq.kirmanak.mealient.data.recipes.db.entity
|
package gq.kirmanak.mealient.database.recipe.entity
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
@@ -1,11 +1,7 @@
|
|||||||
package gq.kirmanak.mealient.data.recipes.impl
|
package gq.kirmanak.mealient.database.recipe.entity
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Relation
|
import androidx.room.Relation
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeEntity
|
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeIngredientEntity
|
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeInstructionEntity
|
|
||||||
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeSummaryEntity
|
|
||||||
|
|
||||||
data class FullRecipeInfo(
|
data class FullRecipeInfo(
|
||||||
@Embedded val recipeEntity: RecipeEntity,
|
@Embedded val recipeEntity: RecipeEntity,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package gq.kirmanak.mealient.data.recipes.db.entity
|
package gq.kirmanak.mealient.database.recipe.entity
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package gq.kirmanak.mealient.data.recipes.db.entity
|
package gq.kirmanak.mealient.database.recipe.entity
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package gq.kirmanak.mealient.data.recipes.db.entity
|
package gq.kirmanak.mealient.database.recipe.entity
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package gq.kirmanak.mealient.data.recipes.db.entity
|
package gq.kirmanak.mealient.database.recipe.entity
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package gq.kirmanak.mealient.data.recipes.db.entity
|
package gq.kirmanak.mealient.database.recipe.entity
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package gq.kirmanak.mealient.data.recipes.db.entity
|
package gq.kirmanak.mealient.database.recipe.entity
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package gq.kirmanak.mealient.extensions
|
package gq.kirmanak.mealient.database
|
||||||
|
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import kotlinx.datetime.LocalDate
|
import kotlinx.datetime.LocalDate
|
||||||
@@ -1,8 +1,4 @@
|
|||||||
[versions]
|
[versions]
|
||||||
compileSdk = "32"
|
|
||||||
minSdk = "23"
|
|
||||||
targetSdk = "32"
|
|
||||||
|
|
||||||
# https://maven.google.com/web/index.html?q=com.android.tools.build#com.android.tools.build:gradle
|
# https://maven.google.com/web/index.html?q=com.android.tools.build#com.android.tools.build:gradle
|
||||||
androidGradlePlugin = "7.2.1"
|
androidGradlePlugin = "7.2.1"
|
||||||
# https://developers.google.com/android/guides/google-services-plugin
|
# https://developers.google.com/android/guides/google-services-plugin
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
@file:Suppress("UnstableApiUsage")
|
@file:Suppress("UnstableApiUsage")
|
||||||
|
|
||||||
|
pluginManagement {
|
||||||
|
includeBuild("build-logic")
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
repositories {
|
repositories {
|
||||||
@@ -7,5 +16,8 @@ dependencyResolutionManagement {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootProject.name = "Mealient"
|
rootProject.name = "Mealient"
|
||||||
|
|
||||||
include(":app")
|
include(":app")
|
||||||
|
include(":database")
|
||||||
|
|||||||
Reference in New Issue
Block a user