From 4035beb0e7b58aa721770eaf2003082fd6e077ba Mon Sep 17 00:00:00 2001 From: Pinar Olguc Date: Wed, 21 Feb 2024 11:48:59 +0300 Subject: [PATCH] Replace the download avatar via email with the SDK implementation (#22641) Co-authored-by: Pinar Olguc --- .../Blog/Blog + Me/UIBarButtonItem+MeBarButton.swift | 2 +- .../ViewRelated/Comments/CommentContentTableViewCell.swift | 2 +- .../ViewRelated/Me/My Profile/MyProfileHeaderView.swift | 2 +- WordPress/Classes/ViewRelated/Me/Views/Header/MeHeaderView.m | 3 ++- WordPress/Classes/ViewRelated/NUX/EpilogueUserInfoCell.swift | 2 +- .../Notifications/Views/NoteBlockCommentTableViewCell.swift | 2 +- WordPress/Classes/ViewRelated/Post/AuthorFilterButton.swift | 2 +- .../Classes/ViewRelated/Post/AuthorFilterViewController.swift | 2 +- .../Classes/ViewRelated/Views/List/ListTableViewCell.swift | 2 +- 9 files changed, 10 insertions(+), 9 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Blog/Blog + Me/UIBarButtonItem+MeBarButton.swift b/WordPress/Classes/ViewRelated/Blog/Blog + Me/UIBarButtonItem+MeBarButton.swift index 2cfab9b8c8b7..3f0b9968b74f 100644 --- a/WordPress/Classes/ViewRelated/Blog/Blog + Me/UIBarButtonItem+MeBarButton.swift +++ b/WordPress/Classes/ViewRelated/Blog/Blog + Me/UIBarButtonItem+MeBarButton.swift @@ -68,7 +68,7 @@ fileprivate extension UIBarButtonItem { gravatarImageView.contentMode = .scaleAspectFill if let email = email { - gravatarImageView.downloadGravatarWithEmail(email, placeholderImage: GravatarConfiguration.fallBackImage) + gravatarImageView.downloadGravatar(for: email, placeholderImage: GravatarConfiguration.fallBackImage) } else { gravatarImageView.image = GravatarConfiguration.fallBackImage } diff --git a/WordPress/Classes/ViewRelated/Comments/CommentContentTableViewCell.swift b/WordPress/Classes/ViewRelated/Comments/CommentContentTableViewCell.swift index 0dc0d0ceca3b..755508322046 100644 --- a/WordPress/Classes/ViewRelated/Comments/CommentContentTableViewCell.swift +++ b/WordPress/Classes/ViewRelated/Comments/CommentContentTableViewCell.swift @@ -375,7 +375,7 @@ private extension CommentContentTableViewCell { return } - avatarImageView.downloadGravatarWithEmail(someEmail, placeholderImage: Style.placeholderImage) + avatarImageView.downloadGravatar(for: someEmail, placeholderImage: Style.placeholderImage) } func updateContainerLeadingConstraint() { diff --git a/WordPress/Classes/ViewRelated/Me/My Profile/MyProfileHeaderView.swift b/WordPress/Classes/ViewRelated/Me/My Profile/MyProfileHeaderView.swift index f3c651c56bf9..1133df4f4310 100644 --- a/WordPress/Classes/ViewRelated/Me/My Profile/MyProfileHeaderView.swift +++ b/WordPress/Classes/ViewRelated/Me/My Profile/MyProfileHeaderView.swift @@ -25,7 +25,7 @@ class MyProfileHeaderView: UITableViewHeaderFooterView { var gravatarEmail: String? = nil { didSet { if let email = gravatarEmail { - gravatarImageView.downloadGravatarWithEmail(email, rating: GravatarRatings.x) + gravatarImageView.downloadGravatar(for: email, gravatarRating: .x) } } } diff --git a/WordPress/Classes/ViewRelated/Me/Views/Header/MeHeaderView.m b/WordPress/Classes/ViewRelated/Me/Views/Header/MeHeaderView.m index b3ba0f2ace3c..17673c4f418a 100644 --- a/WordPress/Classes/ViewRelated/Me/Views/Header/MeHeaderView.m +++ b/WordPress/Classes/ViewRelated/Me/Views/Header/MeHeaderView.m @@ -1,6 +1,7 @@ #import "MeHeaderView.h" #import "Blog.h" #import "WordPress-Swift.h" +#import "Gravatar-Swift.h" const CGFloat MeHeaderViewHeight = 154; const CGFloat MeHeaderViewGravatarSize = 64.0; @@ -67,7 +68,7 @@ - (NSString *)username - (void)setGravatarEmail:(NSString *)gravatarEmail { // Since this view is only visible to the current user, we should show all ratings - [self.gravatarImageView downloadGravatarWithEmail:gravatarEmail rating:GravatarRatingsX]; + [self.gravatarImageView downloadGravatarFor:gravatarEmail gravatarRating:GravatarRatingX]; _gravatarEmail = gravatarEmail; } diff --git a/WordPress/Classes/ViewRelated/NUX/EpilogueUserInfoCell.swift b/WordPress/Classes/ViewRelated/NUX/EpilogueUserInfoCell.swift index 42f154108c7f..d15c42cfe5e4 100644 --- a/WordPress/Classes/ViewRelated/NUX/EpilogueUserInfoCell.swift +++ b/WordPress/Classes/ViewRelated/NUX/EpilogueUserInfoCell.swift @@ -60,7 +60,7 @@ class EpilogueUserInfoCell: UITableViewCell { gravatarView.downloadImage(from: url) } else { let placeholder: UIImage = allowGravatarUploads ? .gravatarUploadablePlaceholderImage : .gravatarPlaceholderImage - gravatarView.downloadGravatarWithEmail(userInfo.email, rating: .x, placeholderImage: placeholder) + gravatarView.downloadGravatar(for: userInfo.email, gravatarRating: .x, placeholderImage: placeholder) } } } diff --git a/WordPress/Classes/ViewRelated/Notifications/Views/NoteBlockCommentTableViewCell.swift b/WordPress/Classes/ViewRelated/Notifications/Views/NoteBlockCommentTableViewCell.swift index 8f1201c14304..09cbf57f3c7d 100644 --- a/WordPress/Classes/ViewRelated/Notifications/Views/NoteBlockCommentTableViewCell.swift +++ b/WordPress/Classes/ViewRelated/Notifications/Views/NoteBlockCommentTableViewCell.swift @@ -111,7 +111,7 @@ class NoteBlockCommentTableViewCell: NoteBlockTextTableViewCell { return } - gravatarImageView.downloadGravatarWithEmail(unwrappedEmail, placeholderImage: placeholderImage) + gravatarImageView.downloadGravatar(for: unwrappedEmail, placeholderImage: placeholderImage) } // MARK: - View Methods diff --git a/WordPress/Classes/ViewRelated/Post/AuthorFilterButton.swift b/WordPress/Classes/ViewRelated/Post/AuthorFilterButton.swift index e8b07987998e..caf4ec690bf8 100644 --- a/WordPress/Classes/ViewRelated/Post/AuthorFilterButton.swift +++ b/WordPress/Classes/ViewRelated/Post/AuthorFilterButton.swift @@ -39,7 +39,7 @@ final class AuthorFilterButton: UIControl { case .user(let email): authorImageView.contentMode = .scaleAspectFill if let email = email { - authorImageView.downloadGravatarWithEmail(email, placeholderImage: gravatarPlaceholder) + authorImageView.downloadGravatar(for: email, placeholderImage: gravatarPlaceholder) } else { authorImageView.image = gravatarPlaceholder } diff --git a/WordPress/Classes/ViewRelated/Post/AuthorFilterViewController.swift b/WordPress/Classes/ViewRelated/Post/AuthorFilterViewController.swift index f352c20191c6..b60ebc26b7f2 100644 --- a/WordPress/Classes/ViewRelated/Post/AuthorFilterViewController.swift +++ b/WordPress/Classes/ViewRelated/Post/AuthorFilterViewController.swift @@ -253,7 +253,7 @@ private class AuthorFilterCell: UITableViewCell { let placeholder = UIImage(named: "comment-author-gravatar") if let email = email { - gravatarImageView.downloadGravatarWithEmail(email, placeholderImage: placeholder ?? UIImage()) + gravatarImageView.downloadGravatar(for: email, placeholderImage: placeholder ?? UIImage()) } else { gravatarImageView.image = placeholder } diff --git a/WordPress/Classes/ViewRelated/Views/List/ListTableViewCell.swift b/WordPress/Classes/ViewRelated/Views/List/ListTableViewCell.swift index 0fca0b6ab46a..b7b222a15cbb 100644 --- a/WordPress/Classes/ViewRelated/Views/List/ListTableViewCell.swift +++ b/WordPress/Classes/ViewRelated/Views/List/ListTableViewCell.swift @@ -102,7 +102,7 @@ class ListTableViewCell: UITableViewCell, NibReusable { return } - avatarView.downloadGravatarWithEmail(someEmail, placeholderImage: placeholderImage) + avatarView.downloadGravatar(for: someEmail, placeholderImage: placeholderImage) } // MARK: Overlay View Support