Closed rayankans closed 5 years ago
@rayankans Do you have any insight around how the image files are maintained within an address book system? I always assumed the transformations (clipping to a shape) were applied in real-time and not actually applied to the bitmap itself. I have no basis for that assumption beyond it’s how I would handle it (especially in case the design changed later).
@aarongustafson I'm not sure if the clipping to a shape is applied in real time or not, but what matters here is how the user agent receives the icon. As a concrete example, the Android contacts provider API, which will likely be the contact source for user agents running on Android phones, returns circular contact icons.
@rayankans Interesting. We should definitely do a survey of the different providers and potentially reach out to them about how they store (and supply) the photos. To be honest I'm a little shocked that a provider would impose it's design choices—which in this case I'd argue are data-destructive—on data like that. I'll do a bit more digging to see what other systems do after BlinkOn.
So I took another look at this, and it turns out you can get a square version of an icon from the Android contacts provider API (@aarongustafson FYI). So the whole IconShape
thing seems like overkill at this point.
I think we can do with just returning a Blob
, which will work fine since the type
property will also reveal the mime type.
A downside would be is that ContactInfo
won't be serializable. We could create a ContactIcon
interface with a Blob
member and a toJSON
method. I'm not sure I want to do that though, as it will enforce certain serialization decisions (binary vs base64, should we include the mime type, etc). Maybe it's best to leave uploading icons as an exercise to developers?
It would be useful to also provide an icon for the contact.
Something like:
The icon field is provided as a
File
object so it can be easily converted to either anImage
orBitmap
, depending on the developer's intent.The type field will contain the MIME type, to not force user agents into using a specific format. It should be exposed to the developers.
IconShape
is an enum describing the shape of the provided icon. It can't cover all of the cases, but at least it can optimize for the most common use-cases, so that developers know how to style the icon with the surroundings it's presented in. The spec can also enforce that the area outside the provided icon should be transparent for the remaining cases.