Rename RecipeEntity to RecipeSummaryEntity
This commit is contained in:
@@ -9,7 +9,7 @@ import javax.inject.Singleton
|
|||||||
|
|
||||||
@Database(
|
@Database(
|
||||||
version = 1,
|
version = 1,
|
||||||
entities = [CategoryEntity::class, CategoryRecipeEntity::class, TagEntity::class, TagRecipeEntity::class, RecipeEntity::class],
|
entities = [CategoryEntity::class, CategoryRecipeEntity::class, TagEntity::class, TagRecipeEntity::class, RecipeSummaryEntity::class],
|
||||||
exportSchema = false
|
exportSchema = false
|
||||||
)
|
)
|
||||||
@TypeConverters(RoomTypeConverters::class)
|
@TypeConverters(RoomTypeConverters::class)
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package gq.kirmanak.mealie.data.recipes
|
package gq.kirmanak.mealie.data.recipes
|
||||||
|
|
||||||
import androidx.paging.Pager
|
import androidx.paging.Pager
|
||||||
import gq.kirmanak.mealie.data.recipes.db.RecipeEntity
|
import gq.kirmanak.mealie.data.recipes.db.RecipeSummaryEntity
|
||||||
|
|
||||||
interface RecipeRepo {
|
interface RecipeRepo {
|
||||||
fun createPager(): Pager<Int, RecipeEntity>
|
fun createPager(): Pager<Int, RecipeSummaryEntity>
|
||||||
|
|
||||||
suspend fun clearLocalData()
|
suspend fun clearLocalData()
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,7 @@ import androidx.room.Index
|
|||||||
onDelete = ForeignKey.CASCADE,
|
onDelete = ForeignKey.CASCADE,
|
||||||
onUpdate = ForeignKey.CASCADE
|
onUpdate = ForeignKey.CASCADE
|
||||||
), ForeignKey(
|
), ForeignKey(
|
||||||
entity = RecipeEntity::class,
|
entity = RecipeSummaryEntity::class,
|
||||||
parentColumns = ["local_id"],
|
parentColumns = ["local_id"],
|
||||||
childColumns = ["recipe_id"],
|
childColumns = ["recipe_id"],
|
||||||
onDelete = ForeignKey.CASCADE,
|
onDelete = ForeignKey.CASCADE,
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ interface RecipeDao {
|
|||||||
@Query("SELECT * FROM categories")
|
@Query("SELECT * FROM categories")
|
||||||
suspend fun queryAllCategories(): List<CategoryEntity>
|
suspend fun queryAllCategories(): List<CategoryEntity>
|
||||||
|
|
||||||
@Query("SELECT * FROM recipes ORDER BY date_added DESC")
|
@Query("SELECT * FROM recipe_summaries ORDER BY date_added DESC")
|
||||||
fun queryRecipesByPages(): PagingSource<Int, RecipeEntity>
|
fun queryRecipesByPages(): PagingSource<Int, RecipeSummaryEntity>
|
||||||
|
|
||||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
suspend fun insertRecipe(recipeEntity: RecipeEntity): Long
|
suspend fun insertRecipe(recipeSummaryEntity: RecipeSummaryEntity): Long
|
||||||
|
|
||||||
@Insert(onConflict = OnConflictStrategy.IGNORE)
|
@Insert(onConflict = OnConflictStrategy.IGNORE)
|
||||||
suspend fun insertTag(tagEntity: TagEntity): Long
|
suspend fun insertTag(tagEntity: TagEntity): Long
|
||||||
@@ -38,7 +38,7 @@ interface RecipeDao {
|
|||||||
@Insert(onConflict = OnConflictStrategy.IGNORE)
|
@Insert(onConflict = OnConflictStrategy.IGNORE)
|
||||||
suspend fun insertCategoryRecipeEntities(categoryRecipeEntities: Set<CategoryRecipeEntity>)
|
suspend fun insertCategoryRecipeEntities(categoryRecipeEntities: Set<CategoryRecipeEntity>)
|
||||||
|
|
||||||
@Query("DELETE FROM recipes")
|
@Query("DELETE FROM recipe_summaries")
|
||||||
suspend fun removeAllRecipes()
|
suspend fun removeAllRecipes()
|
||||||
|
|
||||||
@Query("DELETE FROM tags")
|
@Query("DELETE FROM tags")
|
||||||
@@ -47,8 +47,8 @@ interface RecipeDao {
|
|||||||
@Query("DELETE FROM categories")
|
@Query("DELETE FROM categories")
|
||||||
suspend fun removeAllCategories()
|
suspend fun removeAllCategories()
|
||||||
|
|
||||||
@Query("SELECT * FROM recipes ORDER BY date_updated DESC")
|
@Query("SELECT * FROM recipe_summaries ORDER BY date_updated DESC")
|
||||||
suspend fun queryAllRecipes(): List<RecipeEntity>
|
suspend fun queryAllRecipes(): List<RecipeSummaryEntity>
|
||||||
|
|
||||||
@Query("SELECT * FROM category_recipe")
|
@Query("SELECT * FROM category_recipe")
|
||||||
suspend fun queryAllCategoryRecipes(): List<CategoryRecipeEntity>
|
suspend fun queryAllCategoryRecipes(): List<CategoryRecipeEntity>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import gq.kirmanak.mealie.data.recipes.network.GetRecipeSummaryResponse
|
|||||||
interface RecipeStorage {
|
interface RecipeStorage {
|
||||||
suspend fun saveRecipes(recipes: List<GetRecipeSummaryResponse>)
|
suspend fun saveRecipes(recipes: List<GetRecipeSummaryResponse>)
|
||||||
|
|
||||||
fun queryRecipes(): PagingSource<Int, RecipeEntity>
|
fun queryRecipes(): PagingSource<Int, RecipeSummaryEntity>
|
||||||
|
|
||||||
suspend fun refreshAll(recipes: List<GetRecipeSummaryResponse>)
|
suspend fun refreshAll(recipes: List<GetRecipeSummaryResponse>)
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class RecipeStorageImpl @Inject constructor(
|
|||||||
return tagId
|
return tagId
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun GetRecipeSummaryResponse.recipeEntity() = RecipeEntity(
|
private fun GetRecipeSummaryResponse.recipeEntity() = RecipeSummaryEntity(
|
||||||
remoteId = remoteId,
|
remoteId = remoteId,
|
||||||
name = name,
|
name = name,
|
||||||
slug = slug,
|
slug = slug,
|
||||||
@@ -87,7 +87,7 @@ class RecipeStorageImpl @Inject constructor(
|
|||||||
dateUpdated = dateUpdated,
|
dateUpdated = dateUpdated,
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun queryRecipes(): PagingSource<Int, RecipeEntity> {
|
override fun queryRecipes(): PagingSource<Int, RecipeSummaryEntity> {
|
||||||
Timber.v("queryRecipes() called")
|
Timber.v("queryRecipes() called")
|
||||||
return recipeDao.queryRecipesByPages()
|
return recipeDao.queryRecipesByPages()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import androidx.room.PrimaryKey
|
|||||||
import kotlinx.datetime.LocalDate
|
import kotlinx.datetime.LocalDate
|
||||||
import kotlinx.datetime.LocalDateTime
|
import kotlinx.datetime.LocalDateTime
|
||||||
|
|
||||||
@Entity(tableName = "recipes", indices = [Index(value = ["remote_id"], unique = true)])
|
@Entity(tableName = "recipe_summaries", indices = [Index(value = ["remote_id"], unique = true)])
|
||||||
data class RecipeEntity(
|
data class RecipeSummaryEntity(
|
||||||
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "local_id") val localId: Long = 0,
|
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "local_id") val localId: Long = 0,
|
||||||
@ColumnInfo(name = "remote_id") val remoteId: Long,
|
@ColumnInfo(name = "remote_id") val remoteId: Long,
|
||||||
@ColumnInfo(name = "name") val name: String,
|
@ColumnInfo(name = "name") val name: String,
|
||||||
@@ -14,7 +14,7 @@ import androidx.room.ForeignKey
|
|||||||
onDelete = ForeignKey.CASCADE,
|
onDelete = ForeignKey.CASCADE,
|
||||||
onUpdate = ForeignKey.CASCADE
|
onUpdate = ForeignKey.CASCADE
|
||||||
), ForeignKey(
|
), ForeignKey(
|
||||||
entity = RecipeEntity::class,
|
entity = RecipeSummaryEntity::class,
|
||||||
parentColumns = ["local_id"],
|
parentColumns = ["local_id"],
|
||||||
childColumns = ["recipe_id"],
|
childColumns = ["recipe_id"],
|
||||||
onDelete = ForeignKey.CASCADE,
|
onDelete = ForeignKey.CASCADE,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package gq.kirmanak.mealie.data.recipes.impl
|
package gq.kirmanak.mealie.data.recipes.impl
|
||||||
|
|
||||||
import androidx.paging.PagingSource
|
import androidx.paging.PagingSource
|
||||||
import gq.kirmanak.mealie.data.recipes.db.RecipeEntity
|
|
||||||
import gq.kirmanak.mealie.data.recipes.db.RecipeStorage
|
import gq.kirmanak.mealie.data.recipes.db.RecipeStorage
|
||||||
|
import gq.kirmanak.mealie.data.recipes.db.RecipeSummaryEntity
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
@@ -10,10 +10,10 @@ import javax.inject.Singleton
|
|||||||
@Singleton
|
@Singleton
|
||||||
class RecipePagingSourceFactory @Inject constructor(
|
class RecipePagingSourceFactory @Inject constructor(
|
||||||
private val recipeStorage: RecipeStorage
|
private val recipeStorage: RecipeStorage
|
||||||
) : () -> PagingSource<Int, RecipeEntity> {
|
) : () -> PagingSource<Int, RecipeSummaryEntity> {
|
||||||
private val sources: MutableList<PagingSource<Int, RecipeEntity>> = mutableListOf()
|
private val sources: MutableList<PagingSource<Int, RecipeSummaryEntity>> = mutableListOf()
|
||||||
|
|
||||||
override fun invoke(): PagingSource<Int, RecipeEntity> {
|
override fun invoke(): PagingSource<Int, RecipeSummaryEntity> {
|
||||||
Timber.v("invoke() called")
|
Timber.v("invoke() called")
|
||||||
val newSource = recipeStorage.queryRecipes()
|
val newSource = recipeStorage.queryRecipes()
|
||||||
sources.add(newSource)
|
sources.add(newSource)
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import androidx.paging.ExperimentalPagingApi
|
|||||||
import androidx.paging.Pager
|
import androidx.paging.Pager
|
||||||
import androidx.paging.PagingConfig
|
import androidx.paging.PagingConfig
|
||||||
import gq.kirmanak.mealie.data.recipes.RecipeRepo
|
import gq.kirmanak.mealie.data.recipes.RecipeRepo
|
||||||
import gq.kirmanak.mealie.data.recipes.db.RecipeEntity
|
|
||||||
import gq.kirmanak.mealie.data.recipes.db.RecipeStorage
|
import gq.kirmanak.mealie.data.recipes.db.RecipeStorage
|
||||||
|
import gq.kirmanak.mealie.data.recipes.db.RecipeSummaryEntity
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ class RecipeRepoImpl @Inject constructor(
|
|||||||
private val storage: RecipeStorage,
|
private val storage: RecipeStorage,
|
||||||
private val pagingSourceFactory: RecipePagingSourceFactory
|
private val pagingSourceFactory: RecipePagingSourceFactory
|
||||||
) : RecipeRepo {
|
) : RecipeRepo {
|
||||||
override fun createPager(): Pager<Int, RecipeEntity> {
|
override fun createPager(): Pager<Int, RecipeSummaryEntity> {
|
||||||
Timber.v("createPager() called")
|
Timber.v("createPager() called")
|
||||||
val pagingConfig = PagingConfig(pageSize = 30, enablePlaceholders = true)
|
val pagingConfig = PagingConfig(pageSize = 30, enablePlaceholders = true)
|
||||||
return Pager(
|
return Pager(
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import androidx.paging.LoadType.PREPEND
|
|||||||
import androidx.paging.LoadType.REFRESH
|
import androidx.paging.LoadType.REFRESH
|
||||||
import androidx.paging.PagingState
|
import androidx.paging.PagingState
|
||||||
import androidx.paging.RemoteMediator
|
import androidx.paging.RemoteMediator
|
||||||
import gq.kirmanak.mealie.data.recipes.db.RecipeEntity
|
|
||||||
import gq.kirmanak.mealie.data.recipes.db.RecipeStorage
|
import gq.kirmanak.mealie.data.recipes.db.RecipeStorage
|
||||||
|
import gq.kirmanak.mealie.data.recipes.db.RecipeSummaryEntity
|
||||||
import gq.kirmanak.mealie.data.recipes.network.RecipeDataSource
|
import gq.kirmanak.mealie.data.recipes.network.RecipeDataSource
|
||||||
import kotlinx.coroutines.CancellationException
|
import kotlinx.coroutines.CancellationException
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
@@ -19,14 +19,14 @@ class RecipesRemoteMediator @Inject constructor(
|
|||||||
private val storage: RecipeStorage,
|
private val storage: RecipeStorage,
|
||||||
private val network: RecipeDataSource,
|
private val network: RecipeDataSource,
|
||||||
private val pagingSourceFactory: RecipePagingSourceFactory,
|
private val pagingSourceFactory: RecipePagingSourceFactory,
|
||||||
) : RemoteMediator<Int, RecipeEntity>() {
|
) : RemoteMediator<Int, RecipeSummaryEntity>() {
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
var lastRequestEnd: Int = 0
|
var lastRequestEnd: Int = 0
|
||||||
|
|
||||||
override suspend fun load(
|
override suspend fun load(
|
||||||
loadType: LoadType,
|
loadType: LoadType,
|
||||||
state: PagingState<Int, RecipeEntity>
|
state: PagingState<Int, RecipeSummaryEntity>
|
||||||
): MediatorResult {
|
): MediatorResult {
|
||||||
Timber.v("load() called with: lastRequestEnd = $lastRequestEnd, loadType = $loadType, state = $state")
|
Timber.v("load() called with: lastRequestEnd = $lastRequestEnd, loadType = $loadType, state = $state")
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package gq.kirmanak.mealie.ui.recipes
|
|||||||
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import gq.kirmanak.mealie.R
|
import gq.kirmanak.mealie.R
|
||||||
import gq.kirmanak.mealie.data.recipes.db.RecipeEntity
|
import gq.kirmanak.mealie.data.recipes.db.RecipeSummaryEntity
|
||||||
import gq.kirmanak.mealie.databinding.ViewHolderRecipeBinding
|
import gq.kirmanak.mealie.databinding.ViewHolderRecipeBinding
|
||||||
|
|
||||||
class RecipeViewHolder(
|
class RecipeViewHolder(
|
||||||
@@ -13,7 +13,7 @@ class RecipeViewHolder(
|
|||||||
binding.root.resources.getString(R.string.view_holder_recipe_text_placeholder)
|
binding.root.resources.getString(R.string.view_holder_recipe_text_placeholder)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun bind(item: RecipeEntity?) {
|
fun bind(item: RecipeSummaryEntity?) {
|
||||||
binding.name.text = item?.name ?: loadingPlaceholder
|
binding.name.text = item?.name ?: loadingPlaceholder
|
||||||
recipeViewModel.loadRecipeImage(binding.image, item)
|
recipeViewModel.loadRecipeImage(binding.image, item)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import androidx.lifecycle.viewModelScope
|
|||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import gq.kirmanak.mealie.data.recipes.RecipeImageLoader
|
import gq.kirmanak.mealie.data.recipes.RecipeImageLoader
|
||||||
import gq.kirmanak.mealie.data.recipes.RecipeRepo
|
import gq.kirmanak.mealie.data.recipes.RecipeRepo
|
||||||
import gq.kirmanak.mealie.data.recipes.db.RecipeEntity
|
import gq.kirmanak.mealie.data.recipes.db.RecipeSummaryEntity
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@@ -17,9 +17,9 @@ class RecipeViewModel @Inject constructor(
|
|||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
val recipeFlow = recipeRepo.createPager().flow
|
val recipeFlow = recipeRepo.createPager().flow
|
||||||
|
|
||||||
fun loadRecipeImage(view: ImageView, recipe: RecipeEntity?) {
|
fun loadRecipeImage(view: ImageView, recipeSummary: RecipeSummaryEntity?) {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
recipeImageLoader.loadRecipeImage(view, recipe?.slug)
|
recipeImageLoader.loadRecipeImage(view, recipeSummary?.slug)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,13 +4,13 @@ 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.mealie.data.recipes.db.RecipeEntity
|
import gq.kirmanak.mealie.data.recipes.db.RecipeSummaryEntity
|
||||||
import gq.kirmanak.mealie.databinding.ViewHolderRecipeBinding
|
import gq.kirmanak.mealie.databinding.ViewHolderRecipeBinding
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
class RecipesPagingAdapter(
|
class RecipesPagingAdapter(
|
||||||
private val viewModel: RecipeViewModel
|
private val viewModel: RecipeViewModel
|
||||||
) : PagingDataAdapter<RecipeEntity, RecipeViewHolder>(RecipeDiffCallback) {
|
) : PagingDataAdapter<RecipeSummaryEntity, RecipeViewHolder>(RecipeDiffCallback) {
|
||||||
override fun onBindViewHolder(holder: RecipeViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: RecipeViewHolder, position: Int) {
|
||||||
val item = getItem(position)
|
val item = getItem(position)
|
||||||
holder.bind(item)
|
holder.bind(item)
|
||||||
@@ -23,12 +23,18 @@ class RecipesPagingAdapter(
|
|||||||
return RecipeViewHolder(binding, viewModel)
|
return RecipeViewHolder(binding, viewModel)
|
||||||
}
|
}
|
||||||
|
|
||||||
private object RecipeDiffCallback : DiffUtil.ItemCallback<RecipeEntity>() {
|
private object RecipeDiffCallback : DiffUtil.ItemCallback<RecipeSummaryEntity>() {
|
||||||
override fun areItemsTheSame(oldItem: RecipeEntity, newItem: RecipeEntity): Boolean {
|
override fun areItemsTheSame(
|
||||||
|
oldItem: RecipeSummaryEntity,
|
||||||
|
newItem: RecipeSummaryEntity
|
||||||
|
): Boolean {
|
||||||
return oldItem.remoteId == newItem.remoteId
|
return oldItem.remoteId == newItem.remoteId
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun areContentsTheSame(oldItem: RecipeEntity, newItem: RecipeEntity): Boolean {
|
override fun areContentsTheSame(
|
||||||
|
oldItem: RecipeSummaryEntity,
|
||||||
|
newItem: RecipeSummaryEntity
|
||||||
|
): Boolean {
|
||||||
return oldItem.name == newItem.name && oldItem.slug == newItem.slug
|
return oldItem.name == newItem.name && oldItem.slug == newItem.slug
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package gq.kirmanak.mealie.data.recipes
|
package gq.kirmanak.mealie.data.recipes
|
||||||
|
|
||||||
import gq.kirmanak.mealie.data.recipes.db.RecipeEntity
|
import gq.kirmanak.mealie.data.recipes.db.RecipeSummaryEntity
|
||||||
import gq.kirmanak.mealie.data.recipes.network.GetRecipeSummaryResponse
|
import gq.kirmanak.mealie.data.recipes.network.GetRecipeSummaryResponse
|
||||||
import kotlinx.datetime.LocalDate
|
import kotlinx.datetime.LocalDate
|
||||||
import kotlinx.datetime.LocalDateTime
|
import kotlinx.datetime.LocalDateTime
|
||||||
@@ -67,7 +67,7 @@ object RecipeImplTestData {
|
|||||||
{"detail":"Unauthorized"}
|
{"detail":"Unauthorized"}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
val CAKE_RECIPE_ENTITY = RecipeEntity(
|
val CAKE_RECIPE_ENTITY = RecipeSummaryEntity(
|
||||||
localId = 1,
|
localId = 1,
|
||||||
remoteId = 1,
|
remoteId = 1,
|
||||||
name = "Cake",
|
name = "Cake",
|
||||||
@@ -79,7 +79,7 @@ object RecipeImplTestData {
|
|||||||
dateUpdated = LocalDateTime.parse("2021-11-13T15:30:13")
|
dateUpdated = LocalDateTime.parse("2021-11-13T15:30:13")
|
||||||
)
|
)
|
||||||
|
|
||||||
val PORRIDGE_RECIPE_ENTITY = RecipeEntity(
|
val PORRIDGE_RECIPE_ENTITY = RecipeSummaryEntity(
|
||||||
localId = 2,
|
localId = 2,
|
||||||
remoteId = 2,
|
remoteId = 2,
|
||||||
name = "Porridge",
|
name = "Porridge",
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import gq.kirmanak.mealie.data.recipes.RecipeImplTestData.PORRIDGE_RECIPE_ENTITY
|
|||||||
import gq.kirmanak.mealie.data.recipes.RecipeImplTestData.TEST_RECIPE_ENTITIES
|
import gq.kirmanak.mealie.data.recipes.RecipeImplTestData.TEST_RECIPE_ENTITIES
|
||||||
import gq.kirmanak.mealie.data.recipes.RecipeImplTestData.enqueueSuccessfulRecipeSummaryResponse
|
import gq.kirmanak.mealie.data.recipes.RecipeImplTestData.enqueueSuccessfulRecipeSummaryResponse
|
||||||
import gq.kirmanak.mealie.data.recipes.RecipeImplTestData.enqueueUnsuccessfulRecipeSummaryResponse
|
import gq.kirmanak.mealie.data.recipes.RecipeImplTestData.enqueueUnsuccessfulRecipeSummaryResponse
|
||||||
import gq.kirmanak.mealie.data.recipes.db.RecipeEntity
|
import gq.kirmanak.mealie.data.recipes.db.RecipeSummaryEntity
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@@ -127,9 +127,9 @@ class RecipesRemoteMediatorTest : MockServerTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun pagingState(
|
private fun pagingState(
|
||||||
pages: List<PagingSource.LoadResult.Page<Int, RecipeEntity>> = emptyList(),
|
pages: List<PagingSource.LoadResult.Page<Int, RecipeSummaryEntity>> = emptyList(),
|
||||||
anchorPosition: Int? = null
|
anchorPosition: Int? = null
|
||||||
): PagingState<Int, RecipeEntity> = PagingState(
|
): PagingState<Int, RecipeSummaryEntity> = PagingState(
|
||||||
pages = pages,
|
pages = pages,
|
||||||
anchorPosition = anchorPosition,
|
anchorPosition = anchorPosition,
|
||||||
config = pagingConfig,
|
config = pagingConfig,
|
||||||
|
|||||||
Reference in New Issue
Block a user