inbox-in-gmail icon indicating copy to clipboard operation
inbox-in-gmail copied to clipboard

Colored Letter Avatar should display inside email if contact has no avatar

Open russelldc opened this issue 5 years ago • 2 comments

When I was searching for more reference images of Inbox from before it shut down, I found this gif made in March 2019:

inbox_anim

When the user clicked on an email, you can see one of the participants in the email thread has a pink 'B' avatar.

Right now, this extension only applies these avatars to the email list, not inside the emails when opened.

russelldc avatar Apr 27 '19 14:04 russelldc

While I haven't yet figured out how to grab profile photos to use as an avatar for the email list, I do know how to check if the currently open email does not have one:

const DEFAULT_PROFILE_PHOTO_URL = 'https://ssl.gstatic.com/ui/v1/icons/mail/profile_mask_2x.png';
const profilePhotoElement = document.querySelector('.ajn');

if (profilePhotoElement.src === DEFAULT_PROFILE_PICTURE_URL ) {
    console.log('No profile pic set');
    console.log('Participant Name:', profilePhotoElement.dataset.name);

    // TODO: replace with first letter avatar
    // retrieve from profilePhotoElement.dataset.name[0].toUpperCase()
}

This needs to be hooked onto an observer (maybe with the Gmail.js lib), because when the email first loads, this default img is always loaded in first.

russelldc avatar Apr 27 '19 21:04 russelldc

I just noticed the Gmail app on Android does this already, I wonder why they didn't do the same for the web version.

Weirdly enough, the Gmail app on Android never shows profile photos at all, both on the email list or an opened email. You can only see it when you click on the contact.

russelldc avatar Apr 28 '19 18:04 russelldc