Initialize v1 support
This commit is contained in:
@@ -9,5 +9,5 @@ interface RecipeRepo {
|
||||
|
||||
suspend fun clearLocalData()
|
||||
|
||||
suspend fun loadRecipeInfo(recipeId: Long, recipeSlug: String): FullRecipeInfo
|
||||
suspend fun loadRecipeInfo(recipeId: String, recipeSlug: String): FullRecipeInfo
|
||||
}
|
||||
@@ -17,5 +17,5 @@ interface RecipeStorage {
|
||||
|
||||
suspend fun saveRecipeInfo(recipe: GetRecipeResponse)
|
||||
|
||||
suspend fun queryRecipeInfo(recipeId: Long): FullRecipeInfo
|
||||
suspend fun queryRecipeInfo(recipeId: String): FullRecipeInfo
|
||||
}
|
||||
@@ -132,7 +132,7 @@ class RecipeStorageImpl @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun queryRecipeInfo(recipeId: Long): FullRecipeInfo {
|
||||
override suspend fun queryRecipeInfo(recipeId: String): FullRecipeInfo {
|
||||
logger.v { "queryRecipeInfo() called with: recipeId = $recipeId" }
|
||||
val fullRecipeInfo = checkNotNull(recipeDao.queryFullRecipeInfo(recipeId)) {
|
||||
"Can't find recipe by id $recipeId in DB"
|
||||
|
||||
@@ -38,7 +38,7 @@ class RecipeRepoImpl @Inject constructor(
|
||||
storage.clearAllLocalData()
|
||||
}
|
||||
|
||||
override suspend fun loadRecipeInfo(recipeId: Long, recipeSlug: String): FullRecipeInfo {
|
||||
override suspend fun loadRecipeInfo(recipeId: String, recipeSlug: String): FullRecipeInfo {
|
||||
logger.v { "loadRecipeInfo() called with: recipeId = $recipeId, recipeSlug = $recipeSlug" }
|
||||
|
||||
runCatchingExceptCancel {
|
||||
|
||||
@@ -13,7 +13,7 @@ fun GetRecipeResponse.toRecipeEntity() = RecipeEntity(
|
||||
recipeYield = recipeYield
|
||||
)
|
||||
|
||||
fun GetRecipeIngredientResponse.toRecipeIngredientEntity(remoteId: Long) =
|
||||
fun GetRecipeIngredientResponse.toRecipeIngredientEntity(remoteId: String) =
|
||||
RecipeIngredientEntity(
|
||||
recipeId = remoteId,
|
||||
title = title,
|
||||
@@ -24,7 +24,7 @@ fun GetRecipeIngredientResponse.toRecipeIngredientEntity(remoteId: Long) =
|
||||
quantity = quantity
|
||||
)
|
||||
|
||||
fun GetRecipeInstructionResponse.toRecipeInstructionEntity(remoteId: Long) =
|
||||
fun GetRecipeInstructionResponse.toRecipeInstructionEntity(remoteId: String) =
|
||||
RecipeInstructionEntity(
|
||||
recipeId = remoteId,
|
||||
title = title,
|
||||
|
||||
@@ -44,7 +44,7 @@ class RecipeModelLoader private constructor(
|
||||
options: Options?
|
||||
): String? {
|
||||
logger.v { "getUrl() called with: model = $model, width = $width, height = $height, options = $options" }
|
||||
return runBlocking { recipeImageUrlProvider.generateImageUrl(model?.slug) }
|
||||
return runBlocking { recipeImageUrlProvider.generateImageUrl(model?.remoteId) }
|
||||
}
|
||||
|
||||
override fun getHeaders(
|
||||
|
||||
@@ -20,7 +20,7 @@ class RecipeInfoViewModel @Inject constructor(
|
||||
private val _uiState = MutableLiveData(RecipeInfoUiState())
|
||||
val uiState: LiveData<RecipeInfoUiState> get() = _uiState
|
||||
|
||||
fun loadRecipeInfo(recipeId: Long, recipeSlug: String) {
|
||||
fun loadRecipeInfo(recipeId: String, recipeSlug: String) {
|
||||
logger.v { "loadRecipeInfo() called with: recipeId = $recipeId, recipeSlug = $recipeSlug" }
|
||||
_uiState.value = RecipeInfoUiState()
|
||||
viewModelScope.launch {
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
app:argType="string" />
|
||||
<argument
|
||||
android:name="recipe_id"
|
||||
app:argType="long" />
|
||||
app:argType="string" />
|
||||
</dialog>
|
||||
<fragment
|
||||
android:id="@+id/disclaimerFragment"
|
||||
|
||||
Reference in New Issue
Block a user