Conversation
anandwana001
left a comment
There was a problem hiding this comment.
- PR title is not correct
- PR Description is not updated
- Commit Message is not correct
anandwana001
left a comment
There was a problem hiding this comment.
Do add screenshots and working video as well
| setContent { | ||
| JayRecipesXTheme { | ||
| val viewModel = RecipeViewModel() | ||
| val state = viewModel.recipes.collectAsState() |
There was a problem hiding this comment.
any reason why collecting the data even before the screen initialize?
| data class RecipeModel( | ||
| val id: Int, | ||
| val name: String, | ||
| val ingredients: List<String>, | ||
| val instructions: String, | ||
| val cookingTime: Int, | ||
| val servings: Int, | ||
| val isVegetarian: Boolean, | ||
| val imageUrl: String |
There was a problem hiding this comment.
what if any of them null or empty or not come from API?
Will it crash?
| import kotlin.random.Random | ||
|
|
||
| class RecipeRepoImpl : IRecipeRepo { | ||
| val recipes = mutableListOf( |
|
|
||
| override fun getRandomRecipe(): RecipeModel { | ||
| val randomIndex = Random.nextInt(recipes.size) | ||
| return recipes[randomIndex]; |
| import com.example.jay_recipesx.features.RecipeHome.Domain.Repositories.IRecipeRepo | ||
|
|
||
| class GetRandomRecipe(private val iRecipeRepo: IRecipeRepo) { | ||
| fun call(): RecipeModel = iRecipeRepo.getRandomRecipe() |
| Column { | ||
|
|
||
|
|
||
| AsyncImage( |
|
|
||
|
|
||
| AsyncImage( | ||
| model = (state.value as RecipeHomeSuccessState).recipes.imageUrl, |
There was a problem hiding this comment.
will there be a chance of crash as RecipeHomeSuccessState ?
| sealed class RecipeHomeEvent { | ||
|
|
||
| class GetRandomRecipeEvent() : RecipeHomeEvent() | ||
| class GetSimilarRecipeEvent(id: String) : RecipeHomeEvent() |
There was a problem hiding this comment.
why sealed class, why not interface?
any rational?
| class RecipeViewModel : ViewModel() { | ||
|
|
||
| // State Flow | ||
| private val iRecipeRepo = RecipeRepoImpl() |
| is RecipeHomeEvent.GetSimilarRecipeEvent -> { | ||
| } | ||
| else -> { | ||
|
|
||
| } |
| class AppFunctions { | ||
| companion object { |
There was a problem hiding this comment.
This Class provide reusable functions to all over the app.
There was a problem hiding this comment.
why can't we just use function, and use it directly?
| fun provideRecipeApi(): RecipeApi { | ||
| return Retrofit.Builder() | ||
| .baseUrl("https://api.spoonacular.com") | ||
| .addConverterFactory(GsonConverterFactory.create()) |
There was a problem hiding this comment.
can we use Kotlin serialization?
There was a problem hiding this comment.
Not aware of this will check this.
| interface RecipeApi { | ||
| @Headers( | ||
| "Content-Type: application/json", | ||
| "x-api-key: 6b129304251e43469b1faa962b367fed" |
There was a problem hiding this comment.
is it good idea to pass api key publically?
There was a problem hiding this comment.
No it's not good idea to pass the API will update this
Fixed Bugs, Added DI and Retrofit
Description
Please include a summary of the changes you have made. Highlight the key aspects of your project.
Checklist
README.mdfile with a brief overview of the project, how to set it up, and any relevant information.Screenshots
Screen Recording
RMX1851.2024-10-08.20-12-48.mp4
Project README
Please ensure that your project's
README.mdis detailed and includes:The Recipe App 🍽️ is a user-friendly application designed to fetch and display one random recipe at a time. It provides users with a summary of the recipe's instructions and steps, making it easy to explore new culinary delights 🌟. The app aims to inspire home cooks 👩🍳👨🍳 by offering a diverse selection of recipes and encourages experimentation in the kitchen 🥘.
Random Recipe Fetching: The app fetches one random recipe from a predefined API or database each time it is launched or when the user presses a button.
Recipe Summary: Each recipe displays a concise summary, including key ingredients and steps for easy understanding.
User-Friendly Interface: Designed with simplicity in mind, allowing users to navigate easily and enjoy their cooking experience.
Interactive Button: A dedicated button to fetch a new random recipe, encouraging users to discover more cooking ideas.
Additional Notes
Is there anything else the maintainers should know about your contribution?
Thank you for your contribution!