ProximaEPFL / proxima

A social app that encourages users to visit places in order to see posts.
8 stars 1 forks source link

Bug fix: user avatar does not update on challenge completion #348

Closed CHOOSEIT closed 5 months ago

CHOOSEIT commented 5 months ago

Fixes: #342

This PR aims to fix the user avatar not updating properly on challenge completion.

image

As you can see with the line changes, this was not a straight-forward bug fix. We had not any updates on the user avatars. The user avatars were also not linked to any provider, hence, on challenge completion, we had no way to update every user avatar at once.

This PR creates a new provider userCentauriPointsViewModelProvider, that gets the centauri points of a user given its user id. This provider is refreshable, allowing us to watch on it in every user avatar.

Note that the user avatar had not access to the user id of the displayed user, so a considerable part of this PR is giving this access to this information.

CHOOSEIT commented 5 months ago

Thank you, @yoannLafore, for your review 🎉

As this PR changes a lot of things, we are going to wait for a second reviewer before merging 💯 (@JoachimFavre)

CHOOSEIT commented 5 months ago

I just have another general comment. I feel like you no longer a DynamicUserAvatar and a UserAvatar, we can get rid of DyanmicUserAvatar, can't we?

You are completely right ! I answered in this comment: https://github.com/ProximaEPFL/proxima/pull/348#discussion_r1615254059

CHOOSEIT commented 5 months ago

As I changed a big chunk since the approval of @yoannLafore, I think he should take a look at the new code.