-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Integrate Gravatar Quick Editor #23729
base: trunk
Are you sure you want to change the base?
Conversation
Add forceRefresh option
📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
|
Add email check when handling the notification `GravatarQEAvatarUpdateNotification`
# Conflicts: # WordPress/Classes/Utility/BuildInformation/RemoteFeatureFlag.swift
# Conflicts: # WordPress/WordPress.xcodeproj/project.pbxproj
cc: @kean @crazytonyli |
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.
Purging all cache entries seems a bit aggressive. Would only removing the cached image for email
work?
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.
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
… canonical URL as well
# Conflicts: # WordPress/Classes/Utility/BuildInformation/RemoteFeatureFlag.swift # WordPress/WordPress.xcodeproj/project.pbxproj
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?
@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. ⬆️ |
Fixes #
Integrates the Gravatar Quick Editor into Jetpack.
Changes are behind the remote feature flag:
gravatar_quick_editor
RPReplay_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 toforceRefresh
the avatar, which wasn't present before. To achieveforceRefresh
we 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 Profile
Tap 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 Profile
Tap 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 Flags
Repeat 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.txt
if necessary.Testing checklist: