Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Adding GravatarImageSource #347

Merged
merged 8 commits into from Oct 5, 2020
Merged

Conversation

dansiegel
Copy link
Contributor

Description of Change

Adds a new GravatarImageSource that can be easily added for any image source using a user's email address. This utilizes the image provided by gravatar.com and supports all of their default image results to handle when an email address has no associated Gravatar.

2020-09-30_14-57-33 (2)

Issues

Platforms Supported

  • Android
  • iOS
  • macOS
  • UWP
  • WPF
  • Tizen

API Changes

Added:

public enum DefaultGravatar
{
	FileNotFound,
	MysteryPerson,
	Identicon,
	MonsterId,
	Wavatar,
	Retro,
	Robohash,
	Blank
}

public class GravatarImageSource : ImageSource
{
    public string Email { get; set; }
    public int Size { get; set; }
    public DefaultGravatar Default { get; set; }
    public boo CachingEnabled { get; set; }
    public TimeSpan CacheValidity { get; set; }
}

Note that by default Caching is enabled for 7 days. An additional XAML Extension has been provided to make it even easier to use.

Behavioral Changes

none

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Updated documentation

Copy link
Contributor

@pictos pictos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dansiegel thanks for this amazing contribution. I didn't run the code yet to test. Do you mind adding some unit tests? If you can't do it don't worry I'll do it in the future (:

Copy link
Contributor

@AndreiMisiukevich AndreiMisiukevich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it

Copy link
Contributor

@pictos pictos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dansiegel we are getting there❣ Most of the comments are about code style.

Copy link
Contributor

@AndreiMisiukevich AndreiMisiukevich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs others review

@AndreiMisiukevich AndreiMisiukevich added a/views This issue/PR is related to views awaiting-review This PR needs to have a set of eyes on it labels Oct 5, 2020
Copy link
Member

@jfversluis jfversluis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build seems to fail

Views/GravatarImageSource/Android/GravatarImageSourceHandler.android.cs(20,13): error CS1996: Cannot await in the body of a lock statement

@dansiegel
Copy link
Contributor Author

@jfversluis good catch... I'll update that shortly

@jfversluis jfversluis merged commit bae8d70 into xamarin:main Oct 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/views This issue/PR is related to views awaiting-review This PR needs to have a set of eyes on it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Spec] Gravatar Image Source
4 participants