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-188/Features such as recommend,review in profile screen #366

Merged

Conversation

pranavkonidena
Copy link
Contributor

Link to ticket

https://tickets.metabrainz.org/browse/MOBILE-188?filter=-2

Problem

The features in the feed such as writing review , recommend etc were not present in the profile screen even tho the listen cards were there. This made it very bland, hence I refactored so that those features can be done from the profile screen as well!

Solution

I used the socialViewModel and called fns for pin and recommend to followers directly. For review and personal recommendation, I had to use feedViewModel as well for filtering out user's followers and had to make a dialog system as was done for the feed. Also , I made sure a toast (snackbar) is displayed every time a successful event is triggered so that the user gets feedback as well. I have added those messages inside constants file as they may be reused.

Demo

2024_02_15_18_27_37.1.1.mp4

metadata = metadata,
onRecommend = {
try {
socialViewModel.recommend(metadata)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is wrong, we do not propagate errors to the UI right now so this will always result in a successful toast. If you want, you can propagate the error via Resource class and then check if the response was successful then return error. We can ditch errorFlow for this as well.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Remember its okay to change the core code if you feel its right. At most I will say is "This is wrong" and you will learn a thing or two. Great work overall.

Dialog.NONE -> Unit
Dialog.PIN -> {
PinDialog(trackName = listens[currentIndex!!].trackMetadata.trackName, artistName = listens[currentIndex].trackMetadata.artistName, onDismiss = deactivateDialog, onSubmit = {
blurbContent -> try {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here as well. Please take care everywhere you've done this.

@07jasjeet
Copy link
Collaborator

Also, can we please use Snackbar instead of toasts. I will choose the same on feed as well so it makes sense we have it here.

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.

Great work! After these last set of changes, I think we would be good to go :)

@pranavkonidena
Copy link
Contributor Author

@07jasjeet Please review the updated PR when u r able! Thanks :)

@07jasjeet
Copy link
Collaborator

I think we can improve on the structure by just using one flow but LGTM for now. @akshaaatt good to merge.

@@ -35,6 +35,11 @@ object Constants {
const val REFRESH_TOKEN = "refresh_token"
const val STATUS_LOGGED_IN = 1
const val STATUS_LOGGED_OUT = 0
const val RECOMMENDATION_GREETING = "Song recommended successfully!"
Copy link
Member

Choose a reason for hiding this comment

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

@pranavkonidena Please move these to the strings file in res. That would enable us to be able to translate these.

Copy link
Member

Choose a reason for hiding this comment

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

@pranavkonidena please remove the strings from Constants and use them directly from res/strings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@akshaaatt So sorry , I misunderstood what I needed to do.. hopefully it is fixed now

@akshaaatt akshaaatt merged commit dadf9bb into metabrainz:dev Feb 21, 2024
1 check passed
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.

3 participants