Fix jumping recipe info sheet

This commit is contained in:
Kirill Kamakin
2022-11-05 14:24:59 +01:00
parent ff38ce655d
commit cc73f68751
6 changed files with 55 additions and 29 deletions

View File

@@ -10,4 +10,6 @@ interface RecipeRepo {
suspend fun clearLocalData()
suspend fun loadRecipeInfo(recipeId: String, recipeSlug: String): FullRecipeEntity
suspend fun loadRecipeInfoFromDb(recipeId: String, recipeSlug: String): FullRecipeEntity?
}

View File

@@ -49,4 +49,14 @@ class RecipeRepoImpl @Inject constructor(
return storage.queryRecipeInfo(recipeId)
}
override suspend fun loadRecipeInfoFromDb(
recipeId: String,
recipeSlug: String
): FullRecipeEntity? {
logger.v { "loadRecipeInfoFromDb() called with: recipeId = $recipeId, recipeSlug = $recipeSlug" }
return runCatchingExceptCancel { storage.queryRecipeInfo(recipeId) }
.onFailure { logger.e(it) { "loadRecipeInfoFromDb failed" } }
.getOrNull()
}
}