-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Integrate Gravatar Quick Editor #23729
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
Conversation
Add forceRefresh option
|
| App Name | WordPress Alpha |
|
| Configuration | Release-Alpha | |
| Build Number | pr23729-157f792 | |
| Version | 25.4.2 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 157f792 | |
| App Center Build | WPiOS - One-Offs #11057 |
|
| App Name | Jetpack Alpha |
|
| Configuration | Release-Alpha | |
| Build Number | pr23729-157f792 | |
| Version | 25.4.2 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 157f792 | |
| App Center Build | jetpack-installable-builds #10097 |
Add email check when handling the notification `GravatarQEAvatarUpdateNotification`
# Conflicts: # WordPress/Classes/Utility/BuildInformation/RemoteFeatureFlag.swift
# Conflicts: # WordPress/WordPress.xcodeproj/project.pbxproj
|
cc: @kean @crazytonyli |
pinarol
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review @crazytonyli 🙇 This is ready for another look. (I was AFK last week so this is a bit of a late response)
WordPressAuthenticator/Sources/Signin/LoginLinkRequestViewController.swift
Outdated
Show resolved
Hide resolved
...henticator/Sources/Unified Auth/View Related/Reusable Views/GravatarEmailTableViewCell.swift
Outdated
Show resolved
Hide resolved
| Task { | ||
| // Purge the cache otherwise the old avatars remain around. | ||
| await ImageDownloader.shared.clearURLSessionCache() | ||
| await ImageDownloader.shared.clearMemoryCache() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Despite being connected to the same email, avatars scattered throughout the app have usually different URLs depending on the query parameters like size, default image option, rating etc.
And unfortunately URLCache or NSCache doesn't give us chance to iterate over the cache keys and filter based on host and path. We need to know the exact URL to remove an entry which we don't.
Alternatively, we can remove these calls altogether but this causes some avatars to remain old in different places of the app which looks inconsistent and faulty. Also, killing & reopening the app can bring in the old avatar since URLCache has a disk cache. So I recommend keeping these purge operations but let me know if you prefer otherwise.
| } | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not so sure about these changes. @kean Can you have a look please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The app clears caches on onAvatarUpdated and they will be automatically re-populated later. I'm not sure it's worth adding complexity and making task getter internal for this scenario.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally we shouldn't need this yes. But unfortunately there's a delay at the backend that causes the old avatar to return for like 25 seconds after selecting a different avatar. So the old avatar comes back on the next request that doesn't have the cache buster parameter and looks like this:
I reported this issue to systems and following it. In the meantime I update the memory cache for the cache buster-less version of the URL so the correct image can be shown next time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this doesn't look great, especially since it replaced the new avatar with the old one. I don't see anything particular wrong with adding this bit of code, so I'm going to leave it up to you.
|
@pinarol Thanks for addressing my comments. They look good to me. I'm not familiar with the image downloading implementation, and asked Alex to have to a look. ⬆️ |
kean
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a couple of minor comments.
Some additional feedback:
- Clearing all caches isn't ideal but seems acceptable for this scenario. Ideally, it would use a separate cache and/or would rely on HTTP caching.
- (UX) It's a bit odd that after you upload a new image, it doesn't change your profile picture.
- There is no way to delete an avatar (pretty sure it is also the case in production)
| } | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The app clears caches on onAvatarUpdated and they will be automatically re-populated later. I'm not sure it's worth adding complexity and making task getter internal for this scenario.
| didSet { | ||
| if let email = gravatarEmail { | ||
| gravatarImageView.downloadGravatar(for: email, gravatarRating: .x) | ||
| downloadAvatar() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It produces a new Xcode warning (email unused).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I missed this. Fixed. 👍
|
Thanks for the review @kean !
Yeah this is the same with web's Avatar Quick Editor as well as in gravatar.com, and a consistent UX was targeted. If no avatar is selected though, the uploaded avatar will be set immediately. But if there's already a selected avatar, the user needs to deliberately change the selection. A kind of precaution to prevent unintended changes to the user's global avatar.
This is coming in a couple of months. For now, avatars can be deleted via gravatar.com only. We are waiting for the corresponding REST endpoint and we'll be adding this feature to the QE along with some other improvements. |
This reverts commit f0b3eb9.
It just it appeared broken to me. You can change it back is a single click, so does it need a precaution? If it's not a precaution, it's not clear what user scenario it solves by making a two-step process.
It's be nice if it also includes removing your current avatar as I couldn't find a way to do it. |
Let me take this feedback to our designer. I know that we want a unified experience between web/iOS/Android so I can't change this for iOS only but I am sure we can consider and discuss this.
You mean on the web? https://gravatar.com/profile/avatars
|
Yeah, it would be nice to add soon too, but I think it needs a separate way to "remove current avatar" though without actually deleting it. Overall, the new experience looks pretty great. |



Fixes #
Integrates the Gravatar Quick Editor into Jetpack.
Changes are behind the remote feature flag:
gravatar_quick_editorRPReplay_Final1730303727.MP4
RPReplay_Final1730303545.MP4
Technical Details
The new structure depends on the Quick Editor's update callback and fires a notification
GravatarQEAvatarUpdateNotification. The UI components that render the avatar subscribe to that notification. Once received, they fetch the latest version of the avatar from the BE. To achieve this we introduce a way toforceRefreshthe avatar, which wasn't present before. To achieveforceRefreshwe add a cache buster query parameter otherwise the backend cache gets in the way and the latest version of the avatar can't be fetched.To test:
Enable the feature flag "Gravatar Quick Editor" in
Me > App Settings > Debug > Feature Flags(It's enabled by default in DEBUG config)Log out from the Jetpack app
Log in with a new email (Highly recommend getting a temp email via https://tempmail.so/us , you should go to your inbox in your mobile device since the login depends on a magic link)
Use the email magic link to continue to the app
Observe: You landed on the signup epilogue, the avatar placeholder has a + on it and tapping on the avatar opens the Quick Editor.
Upload & change the avatar via the Quick Editor
Observe: The avatar on the signup page also gets updated
Close the Quick Editor
Continue to the app
Go to
Me > My ProfileTap either on the avatar or on the "Update profile photo" button
Observe: Quick Editor opens
Upload & change the avatar via the Quick Editor
Observe: The avatars on the main app gets updated as well (the one on the profile header, and the "Me" tab bar item at the bottom)
Appearance Test
Go to Me > App Settings > Appearance
Switch the appearance
Go to
Me > My ProfileTap either on the avatar or on the "Update profile photo" button
Observe: Quick Editor opens and the appearance matched with the app.
Disable the feature flag "Gravatar Quick Editor" in
Me > App Settings > Debug > Feature FlagsRepeat the tests ☝️
This time instead of the Gravatar Quick Editor you should observe that the system photo picker appears and the selected image is uploaded & set as the avatar.
Regression Notes
Potential unintended areas of impact
The existing upload flow
What I did to test those areas of impact (or what existing automated tests I relied on)
Tested with the feature flag off
What automated tests I added (or what prevented me from doing so)
x
PR submission checklist:
RELEASE-NOTES.txtif necessary.Testing checklist: