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

Provide access to contact's icon #13

Closed
rayankans opened this issue Apr 4, 2019 · 4 comments
Closed

Provide access to contact's icon #13

rayankans opened this issue Apr 4, 2019 · 4 comments

Comments

@rayankans
Copy link
Collaborator

It would be useful to also provide an icon for the contact.

Something like:

enum IconShape { "other", "square", "circle" };

dictionary ContactIcon {
  File icon;
  USVString type;
  IconShape shape;
};

The icon field is provided as a File object so it can be easily converted to either an Image or Bitmap, 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.

@aarongustafson
Copy link

@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).

@rayankans
Copy link
Collaborator Author

@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.

@aarongustafson
Copy link

aarongustafson commented Apr 5, 2019

@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.

@rayankans
Copy link
Collaborator Author

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?

rayankans added a commit that referenced this issue Nov 4, 2019
Add support for selecting icons, resolves #13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants