Add more logging

This commit is contained in:
Kirill Kamakin
2022-12-13 21:34:27 +01:00
parent 127153cac7
commit 700614427c

View File

@@ -66,6 +66,7 @@ class RecipesRemoteMediator @Inject constructor(
limit: Int, limit: Int,
loadType: LoadType = REFRESH, loadType: LoadType = REFRESH,
): Int = coroutineScope { ): Int = coroutineScope {
logger.v { "updateRecipes() called with: start = $start, limit = $limit, loadType = $loadType" }
val deferredRecipes = async { network.requestRecipes(start, limit) } val deferredRecipes = async { network.requestRecipes(start, limit) }
val favorites = network.getFavoriteRecipes().toHashSet() val favorites = network.getFavoriteRecipes().toHashSet()
val recipes = deferredRecipes.await() val recipes = deferredRecipes.await()
@@ -81,6 +82,7 @@ class RecipesRemoteMediator @Inject constructor(
} }
suspend fun onFavoritesChange() { suspend fun onFavoritesChange() {
logger.v { "onFavoritesChange() called" }
val favorites = network.getFavoriteRecipes() val favorites = network.getFavoriteRecipes()
storage.updateFavoriteRecipes(favorites) storage.updateFavoriteRecipes(favorites)
pagingSourceFactory.invalidate() pagingSourceFactory.invalidate()