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

Fix: Avatar is not visible when the profile is disabled but the Avatar is set to public #568

Merged
merged 3 commits into from
Feb 5, 2025

Conversation

AdamGrzybkowski
Copy link
Contributor

Closes #567

Description

This PR adjusts the ProfileCard component in the QuickEditor to show the Avatar when it's set to public even if the profile is set to private.

To accomplish this I had to create a new Avatar component that takes the Email and not the ComponentState. It now relies on the Coil callback to show either the Loading or Error state. Loading is for the Skeleton and the Error is for the empty avatar image. Here's how it looks now with a private profile:

Avatar private Avatar public
Screenshot 2025-02-04 at 13 45 32 Screenshot 2025-02-04 at 13 45 46

This won't be the default behavior of all the Profile cards from the :ui module though, due to the ComponentState - we can only get the email from the profile once it's loaded, and at that point, this is a bit late. Even if we wanted to fall back when a profile can't be loaded (ComponentState.Empty) we wouldn't have any profile information. So that would require some API updates.

Testing Steps

  1. Go to your Gravatar profile website
  2. Open Account Setting and switch to privacy
  3. Uncheck the public profile but keep the avatar public
  4. Launch the Demo app
  5. Tap Log out
  6. Open the QE
  7. Confirm you can see the Avatar but not the profile
  8. Uncheck the public avatar settings
  9. Reopen the QE
  10. Confirm you can't see the avatar

@AdamGrzybkowski AdamGrzybkowski added Enhance Enhancement [Feature] Gravatar-UI Gravatar ui module [Feature] Gravatar-Quickeditor Gravatar Quick Editor module labels Feb 4, 2025
@AdamGrzybkowski AdamGrzybkowski added this to the 2.3.0 milestone Feb 4, 2025
modifier = Modifier.padding(top = 16.dp),
avatarCacheBuster = uiState.avatarCacheBuster,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We probably don't have to use the cache buster on this page, but:

  • it makes testing easier, and
  • it makes sure the the QE always shows the latest and correct avatar

@@ -144,11 +151,70 @@ private fun EmptyAvatar(size: Dp, modifier: Modifier = Modifier) {
private fun Avatar(model: Any?, size: Dp, modifier: Modifier) {
AsyncImage(
model = model,
contentDescription = "User profile image",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was hardcoded in the component, we could probably skip the waiting for the translation for this one, as it will delay the release again.

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Feb 4, 2025

📲 You can test the changes from this Pull Request in Gravatar Demo by scanning the QR code below to install the corresponding build.
App Name Gravatar Demo
Commit0cfd7f4
Direct Downloadgravatar-demo-prototype-build-pr568-0cfd7f4.apk

Copy link
Member

@mlumeau mlumeau left a comment

Choose a reason for hiding this comment

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

It works! Code changes LGTM too.

@AdamGrzybkowski AdamGrzybkowski merged commit b0733e3 into trunk Feb 5, 2025
17 checks passed
@AdamGrzybkowski AdamGrzybkowski deleted the adam/567_avatar_404 branch February 5, 2025 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhance Enhancement [Feature] Gravatar-Quickeditor Gravatar Quick Editor module [Feature] Gravatar-UI Gravatar ui module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make sure the Avatar is shown even if the profile is private
3 participants