Skip to content

Initial Commit #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

jay-isampelliwar
Copy link

@jay-isampelliwar jay-isampelliwar commented Oct 5, 2024

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

  • My project includes a README.md file with a brief overview of the project, how to set it up, and any relevant information.
  • I have added a screenshot or screen recording showing the functionality of the app.
  • I have tested the project and confirmed it works as expected.

Screenshots

image
image
image

Screen Recording

RMX1851.2024-10-08.20-12-48.mp4

Project README

Please ensure that your project's README.md is detailed and includes:

  • A brief introduction to the project.

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 🥘.

  • Key features.

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!

Copy link
Contributor

@anandwana001 anandwana001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. PR title is not correct
  2. PR Description is not updated
  3. Commit Message is not correct

Copy link
Contributor

@anandwana001 anandwana001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do add screenshots and working video as well

setContent {
JayRecipesXTheme {
val viewModel = RecipeViewModel()
val state = viewModel.recipes.collectAsState()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason why collecting the data even before the screen initialize?

Comment on lines 3 to 11
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why public?


override fun getRandomRecipe(): RecipeModel {
val randomIndex = Random.nextInt(recipes.size)
return recipes[randomIndex];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indexOutOfBound?

import com.example.jay_recipesx.features.RecipeHome.Domain.Repositories.IRecipeRepo

class GetRandomRecipe(private val iRecipeRepo: IRecipeRepo) {
fun call(): RecipeModel = iRecipeRepo.getRandomRecipe()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call() means?

Comment on lines 44 to 47
Column {


AsyncImage(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why empty lines?



AsyncImage(
model = (state.value as RecipeHomeSuccessState).recipes.imageUrl,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will there be a chance of crash as RecipeHomeSuccessState ?

Comment on lines +3 to +6
sealed class RecipeHomeEvent {

class GetRandomRecipeEvent() : RecipeHomeEvent()
class GetSimilarRecipeEvent(id: String) : RecipeHomeEvent()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why sealed class, why not interface?
any rational?

class RecipeViewModel : ViewModel() {

// State Flow
private val iRecipeRepo = RecipeRepoImpl()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why inside viewmodel?

Comment on lines +45 to +49
is RecipeHomeEvent.GetSimilarRecipeEvent -> {
}
else -> {

}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why empty?

Comment on lines +3 to +4
class AppFunctions {
companion object {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why class?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Class provide reusable functions to all over the app.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use Kotlin serialization?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not aware of this will check this.

interface RecipeApi {
@Headers(
"Content-Type: application/json",
"x-api-key: 6b129304251e43469b1faa962b367fed"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it good idea to pass api key publically?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it's not good idea to pass the API will update this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants