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

[Gravatar] Gravatar SDK integration umbrella task #22543

Closed
14 of 15 tasks
pinarol opened this issue Feb 5, 2024 · 4 comments · Fixed by #22921 or wordpress-mobile/WordPressUI-iOS#156
Closed
14 of 15 tasks

[Gravatar] Gravatar SDK integration umbrella task #22543

pinarol opened this issue Feb 5, 2024 · 4 comments · Fixed by #22921 or wordpress-mobile/WordPressUI-iOS#156
Assignees

Comments

@pinarol
Copy link
Contributor

pinarol commented Feb 5, 2024

Let's list and track work items related with Gravatar integration here.

Replace avatar fetching calls with SDK calls in following places, make sure each flow is tested:

  • CommentContentTableViewCell
  • MyProfileHeaderView
  • NoteBlockCommentTableViewCell
  • EpilogueUserInfoCell
  • AuthorFilterButton
  • AuthorFilterViewController
  • ListTableViewCell
  • GravatarEmailTableViewCell
  • LoginLinkRequestViewController
  • UIBarButtonItem+MeBarButton

Investigate following methods in the existing UIImageView+Gravatar extension, make sure we don't break the functionality for them after integrating the SDK

  • overrideGravatarImageCache
  • listenForGravatarChanges

  • Profile fetching: We won't replace this, the code is unreachable.

Task list for profile uploading:

  • Avatar uploading

Task list for rename types in Gravatar SDK when Gravatar is used unnecessarily:

  • ImageCache and ImageCaching
@pinarol
Copy link
Contributor Author

pinarol commented Feb 16, 2024

List of places that download avatar via "URL"

This list is intended to be used for regression testing.

CommentContentTableViewCell

  • Go to notifications
  • Tap on a notification of type “comment” ([Person] commented on [your post])

NoteBlockHeaderTableViewCell

  • Go to notifications

  • Tap on a notification "XXX liked your comment"

  • Check the image at the header:

LoginNavigationController

As the name describes, this VC is shown when logging in:

PeopleCell

My Site > People

PersonViewController

Tap on one of the people on the previous step:

RevisionsTableViewCell

My Site > Posts > Select a post > … button on the navigation bar > History

ListTableViewCell

ListTableViewCell is not used for notifications after the PR: #22593

So this test case is cancelled.

Notifications tab, each cell is a ListTableViewCell:

NotificationContentView

Note: This target is not used and there's a task to remove it: #19535 The code is basically unreachable.

So we don't need to test it.
This one requires for us to generate a push notification

Alternatively we should be able to drag and drop an .apns file to the simulator and simulate the push notification. I tried this method but couldn't get the result I wanted. I tried running the project with the targets of our notification service extensions. I am able to generate the notification but I couldn't get the didReceive() to be called (which is in extension NotificationViewController: UNNotificationContentExtension).

For WP:

{
    "Simulator Target Bundle": "org.wordpress",
    "aps": {
        "alert": {
            "body": "Holy Moly, a notification!",
            "title": "WordPress"
        },
        "category": "like"
    },
    "richNotificationViewModel": { }
}

For JP:

{
    "Simulator Target Bundle": "com.automattic.jetpack",
    "aps": {
        "alert": {
            "body": "Holy Moly, a notification!",
            "title": "Jetpack"
        },
        "category": "like"
    },
    "richNotificationViewModel": { }
}

Related PRs
#12542
#15253

NoSitesView

This one normally shows when there's no sites in your account and the appUIType == .simplified.

Since it is difficult to reproduce those conditions, I manipulated the code this way to be able to see that screen:

Screenshot 2024-02-16 at 12 55 23 Screenshot 2024-02-16 at 12 55 17

Unreachable code

NoteBlockCommentTableViewCell

Unreachable.

That cell is only used by NotificationDetailsViewController if the note type is .comment but we don’t open NotificationDetailsViewController when tapped on a .comment, we instead open NotificationCommentDetailViewController.

NoteBlockUserTableViewCell - XXXX and 2 others liked your post YYYYY

Unreachable. Notifications of type "like" are displayed in LikesListController anymore so this one become unreachable as far as I understand.

let likesListController = LikesListController(tableView: tableView, notification: note, delegate: self) {

@pinarol
Copy link
Contributor Author

pinarol commented Feb 20, 2024

List of places that download avatar via "email"

This list is intended to be used for regression testing.

MeHeaderView

  • Go to "Me"
  • The avatar at the top:

MyProfileHeaderView

  • Go to "Me" > My Profile
  • The avatar at the top:

UIBarButtonItem+MeBarButton

  • My Site > (The down arrow at the top right of the page, right near your site title/url)
  • Check the avatar in the navigation bar

The avatar here will be visible only if there are no sites, so I manipulated the code this way to see it:


AuthorFilterViewController

  • Go to Posts
  • Tap on the navigation bar right button
  • The filtering sheet opens. Content of that sheet is "AuthorFilterViewController".
  • Check the avatar:

AuthorFilterButton

  • Tap on the "Posts by me" option shown in the previous step
  • Check the avatar on the navigation bar

EpilogueUserInfoCell

  • Login to the app
  • After the login this page will appear
  • Check the avatar:

Refer to #22543 (comment) for the below cases:

  • ListTableViewCell
  • NoteBlockCommentTableViewCell
  • CommentContentTableViewCell

@etoledom
Copy link
Contributor

List of places where Profile Fetch is used:

Gravatar profile fetch is used here:

func loadEpilogueForSelfhosted(username: String, password: String, xmlrpc: String, completion: @escaping (LoginEpilogueUserInfo?) -> ()) {

Though it seems to be currently unreachable since #18608

To test this code path, is needed to first comment out:

// If adding a self-hosted site, skip the Epilogue
if let wporg = credentials.wporg,
let blog = Blog.lookup(username: wporg.username, xmlrpc: wporg.xmlrpc, in: ContextManager.shared.mainContext) {
if self.windowManager.isShowingFullscreenSignIn {
self.windowManager.dismissFullscreenSignIn(blogToShow: blog)
} else {
navigationController.dismiss(animated: true)
}
return
}

Other pre- requisites:

  • Have a self-hosted site with Jetpack.
  • If you don't have any, you can create one fast using https://jurassic.ninja/ (the default will install Jetpack connected to your logged-in WPCom account).

After commenting out the mentioned lines and building the app again:

  • Log out of any WPCom account.
  • Log in using the self hosted site.
    • Check that you see your information from Gravatar in the epilogue screen.

@etoledom
Copy link
Contributor

List of places where Image Upload is used:

MyProfileController

  • Go to Me tab bar option
  • My profile
    • Tapping on Update Profile Photo will trigger the image picking and upload process

EpilogueUserInfoCell

  • Create a new account using WPCom signup process.
  • When the account is created, the epilogue user info will prompt to update a user image (+ button at the avatar's top right corner)
    • Tapping on the avatar image, will trigger the image picking and upload process.

Test the results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants