inbox-in-gmail
inbox-in-gmail copied to clipboard
Colored Letter Avatar should display inside email if contact has no avatar
When I was searching for more reference images of Inbox from before it shut down, I found this gif made in March 2019:
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.
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.
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.