Skip to content

Conversation

@PlMrs
Copy link

@PlMrs PlMrs commented Feb 22, 2024

Here is the result :

Screenshot_2024-02-23-09-04-21-44_1c96a7295b118b6cfe055c416c14f508

Because the fetch to pokemons list does not provide the pokemon id, i need to fetch pokemon infos by pokemon to catch it. It may slow down the loading of the application, but the result is here.

We could potentially check if the info of the pokemon is already stored in the data, if yes, use the stored data, if no, download it. It may reduce the number of pokeapi infos call.

Closes #93

Guidelines

Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.

Types of changes

What types of changes does your code introduce?

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Preparing a pull request for review

Ensure your change is properly formatted by running:

$ ./gradlew spotlessApply

Please correct any failures before requesting a review.

@inson1
Copy link

inson1 commented Feb 22, 2024

@inson1
Copy link

inson1 commented Feb 22, 2024

@skydoves What do you think?

@emenjivar
Copy link

emenjivar commented Apr 21, 2025

@PlMrs there's no need to perform a second fetch to obtain the ID.
It can be extracted from the URL by doing an string manipulation.

val url = "https://pokeapi.co/api/v2/pokemon/1/"
val part = url.split("/").filter { it.isNotBlank() }
val id = part.lastOrNull() // Handle nullability here

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.

Add Pokemon number to Pokemons in Index page

3 participants