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

MOBILE-213: Implementation of CreatedForYou screen #535

Merged

Conversation

hemang-mishra
Copy link
Contributor

In this PR, I have added the created for you screen in the profile tab.
Ticket

Changes Made and features implemented:

  1. Added relevant data classes for fetching data related to CreatedFor screen.
  2. Created a separate service called PlaylistService and repository called PlaylistDataRepository for actions related to fetching and saving playlists. API calls related to Playlist screen will also be made in these files.
  3. Made UI for the playlist screen.
  4. Moved removeHtmlTags function to Util package as it was being used in CreateForYouScreen as well.
  5. Kept UI components in separate files for better readability.
  6. Previews of all major components.
  7. Share Fuctionality: User can share a particular playlist and identifier of the playlist will be shared.
  8. Retry fetching playlist: If playlists couldn't be fetched initially.
  9. Dropdown: Implemented similar to other screens.
  10. Play: User can play a particular track.
  11. Go to artist page: User can go to artist of a particular track.

Screenshots:

Light Dark
ScreenRecordingCreatedForUScreen.mp4

@07jasjeet 07jasjeet self-requested a review January 26, 2025 14:47
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.

Hi @hemang-mishra, fantastic work! some things need to reworked but overall amazing work!!

* @param onReorderClick Lambda to be executed when the reorder button is clicked.
*/
@Composable
fun PlaylistTrackComposable(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use ListenCardSmallDefault instead of creating new cards, it is very hard to maintain duplicates + consistency is sacrificed. What every extra options you many want to show, show it in trailingContent composable lambda.

Also, please do not add the play icon, rather play the song when card click, i.e., when onClick is invoked.

}


fun formatSeconds(seconds: Int): String {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Put functions like these in utils whenever possible :)

val context = LocalContext.current
val scope = rememberCoroutineScope()
val socialUiState by socialViewModel.uiState.collectAsState()
CreatedForYouScreen(uiState = uiState,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good work with this abstraction, just add a preview and it would be chef's kiss.

else uiState.createdForTabUIState.createdForYouPlaylists[0].playlist
)
}
var dropdownItemIndex by remember {
Copy link
Collaborator

Choose a reason for hiding this comment

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

No requirement for this variable when we use ListenCardSmallDefault.

@hemang-mishra
Copy link
Contributor Author

@07jasjeet I have made the required changes.
Thanks for your support.
Let me know if any further changes are required.

@07jasjeet 07jasjeet self-requested a review January 27, 2025 18:28
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.

Hi @hemang-mishra, you are doing high quality work and I really appreciate it. There are changes regarding some performance issues that I've pointed out. Also, the empty and retry states look half baked. With a bit of center alignment, the page will look polished!

onSaveClick: (CreatedForYouPlaylist) -> Unit,
onPlaylistSelect: (CreatedForYouPlaylist) -> Unit
) {
Row(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use LazyRow here.

}
) {
Text(
text = removeExcessiveSpaces(removeHtmlTags(description)).trim(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wrap this in remember with description as key

) {
playlists.forEachIndexed { index, playlist->
PlaylistTitleCard(
title = modifyTitle(playlist),
Copy link
Collaborator

Choose a reason for hiding this comment

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

remember with playlist as key

playlists.forEachIndexed { index, playlist->
PlaylistTitleCard(
title = modifyTitle(playlist),
fractionLeft = getFractionLeft(
Copy link
Collaborator

Choose a reason for hiding this comment

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

use remember here with necessary keys

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.

Hi @hemang-mishra, did some changes on top of your work to polish some areas. Changes LGTM, good work!

@07jasjeet 07jasjeet merged commit 0e64d71 into metabrainz:main Jan 28, 2025
1 check passed
@07jasjeet
Copy link
Collaborator

Thanks for the contribution @hemang-mishra!

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