-
Notifications
You must be signed in to change notification settings - Fork 7
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
Use Gravatar.ImageCaching protocol instead of defining our own #146
Use Gravatar.ImageCaching protocol instead of defining our own #146
Conversation
public protocol ImageCaching: GravatarImageCaching { | ||
func setImage(_ image: UIImage, forKey key: String) | ||
func getImage(forKey key: String) -> UIImage? | ||
} | ||
|
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.
Is there a reason we were creating our own protocol in WPUI that conforms to the Gravatar protocol? After the renaming, this got tricky. And it seemed to make sense to drop this in favor of using the Gravatar.ImageCaching protocol.
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.
This probably existed before Gravatar SDK, and now we have the same name for the same definition of protocol.
I agree, we can drop it unless it's used somewhere else as argument independently from Gravatar, which doesn't seem to be the case 🤔
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.
Is there a reason we were creating our own protocol in WPUI that conforms to the Gravatar protocol?
We didn't. This was here already.
Unfortunately we can't just drop a public type from an open source library. We can't easily know where it's been used. We should always deprecate first even if we want to remove it in the future.
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.
Unfortunately we can't just drop a public type from an open source library
Oh that's right!
One alternative, if we don't want to re-define the procotol, we can do this:
@_exported import protocol Gravatar.ImageCaching
With @_exported
, WPUI will re-export ImageCaching
as public, and the API won't change.
Making the changes on WPiOS not needed.
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.
Great! This can 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.
Oh nice! Didn't know about this. Perfection. I'll push this. Thanks!
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.
Looks good to me!
@pinarol - Any thoughts?
public protocol ImageCaching: GravatarImageCaching { | ||
func setImage(_ image: UIImage, forKey key: String) | ||
func getImage(forKey key: String) -> UIImage? | ||
} | ||
|
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.
This probably existed before Gravatar SDK, and now we have the same name for the same definition of protocol.
I agree, we can drop it unless it's used somewhere else as argument independently from Gravatar, which doesn't seem to be the case 🤔
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.
Check out https://github.com/wordpress-mobile/WordPressUI-iOS/pull/146/files#r1500335800
We will need one more change 🙏
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.
3de7421
into
task/gravatar-integration
This updates the module so that it implements (and re-exports) the
Gravatar.ImageCaching
protocol instead of a local protocol that conforms to it.Note that since this preserves the
WordPressUI-iOS
public interfaces, no changes toWordPress-iOS
should be necessary.This should be tested via the WordPress-iOS PR that requires it:
wordpress-mobile/WordPress-iOS#22663
Checkout this branch of
WordPressUI-iOS
Checkout Gravatar branch: Automattic/Gravatar-SDK-iOS#50
Checkout WordPress-iOS task/gravatar-integration branch: https://github.com/wordpress-mobile/WordPress-iOS/tree/task/gravatar-integration
Follow the steps mentioned here: wordpress-mobile/WordPress-iOS#22543 (comment)
CHANGELOG.md
if necessary.