Automattic / Gravatar-SDK-iOS

Gravatar SDK is a Swift library that allows you to integrate Gravatar features into your own iOS applications.
https://gravatar.com
Mozilla Public License 2.0
36 stars 1 forks source link

Implementing v3 version of image upload endpoint #336

Closed etoledom closed 1 month ago

etoledom commented 1 month ago

Description

This PR implements POST api.gravatar.com/v3/me/avatars.

One big difference between v1 and v3 is that v1 was able to square an image if it wasn't square already. V3 in contrast won't square the image but expect it to be square or return an error otherwise.

The Native image picker on iOS won't always crop a perfect square:

On this PR, we solve the problem in the demo app side, by rendering a square image and embedding the original photo in it, which is what the v1 endpoint was doing on the backend.

For example:

On the image picker, we can have this logic internally, or build our own cropper without these issues.

Testing Steps