Show Toast when recipe favorite status is updated

This commit is contained in:
Kirill Kamakin
2023-04-07 14:14:25 +02:00
parent b78d30790f
commit 9b03cfcbb4
5 changed files with 16 additions and 2 deletions

View File

@@ -177,6 +177,15 @@ class RecipesListFragment : Fragment(R.layout.fragment_recipes_list) {
logger.d { "onFavoriteClick: result is $it" }
if (it.isFailure) {
showLongToast(R.string.fragment_recipes_favorite_update_failed)
} else {
val name = event.recipeSummaryEntity.name
val isFavorite = it.getOrThrow()
val message = if (isFavorite) {
getString(R.string.fragment_recipes_favorite_added, name)
} else {
getString(R.string.fragment_recipes_favorite_removed, name)
}
showLongToast(message)
}
}
}