Skip to content
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

Moved card Link logic to viewModel #522

Conversation

hemang-mishra
Copy link
Contributor

In this PR, I completed the TODO mentioned in the Artist Screen to move linksMap logic to viewModel.

//TODO: Move this logic to vm and get map to ui state

The changes made are:

  1. The mapping logic is used in both Artist and Album Screen, so I moved it to the util package.
  2. Used linksMap in UiState to get the links.
  3. ImageVector.vectorResource can be called only in compose function, so I have modifed LinksCard data class to contain resource id instead of ImageVector.

Copy link
Collaborator

@07jasjeet 07jasjeet left a comment

Choose a reason for hiding this comment

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

Lgtm! just a tiny nit.

import org.listenbrainz.android.util.Constants.MB_BASE_URL

object LinkUtils {
fun fetchLinks(artistMbid: String?, links: Rels?): Map<ArtistLinksEnum, List<LinkCardData>> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this is not an remote API call of sorts, can we name this parseLinks or anything you feel right. Its easier to recall this function this way when its time to reuse it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure!!

@hemang-mishra
Copy link
Contributor Author

@07jasjeet I have made the required changes. Thanks for the review!

@07jasjeet 07jasjeet merged commit 5fef29a into metabrainz:main Jan 18, 2025
1 check passed
@07jasjeet
Copy link
Collaborator

@hemang-mishra, thanks for the contribution!

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