From 7045bf9d062ee400a7e03ede161a7aa54ad620cf Mon Sep 17 00:00:00 2001 From: Federico Maccaroni Date: Tue, 8 Feb 2022 12:48:32 -0300 Subject: [PATCH] Overriden Equals on AvatarImageSource so it doesn't get set multiple times when it's the same image thus producing blinking on tab chaged --- src/App/Controls/AvatarImageSource.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/App/Controls/AvatarImageSource.cs b/src/App/Controls/AvatarImageSource.cs index ef5d2890a83..1ebe3509a39 100644 --- a/src/App/Controls/AvatarImageSource.cs +++ b/src/App/Controls/AvatarImageSource.cs @@ -11,6 +11,23 @@ public class AvatarImageSource : StreamImageSource { private string _data; + public override bool Equals(object obj) + { + if (obj is null) + { + return false; + } + + if (obj is AvatarImageSource avatar) + { + return avatar._data == _data; + } + + return base.Equals(obj); + } + + public override int GetHashCode() => _data?.GetHashCode() ?? -1; + public AvatarImageSource(string name = null, string email = null) { _data = name;