mirror of
https://github.com/bitwarden/mobile
synced 2025-12-15 15:53:44 +00:00
[SG-912] Modify the mobile app to retrieve the user's avatar color (#2284)
* [SG-912] Modify the mobile app to retrieve the user's avatar color (#2277) * work: baseline * fix: dont use profile for store * fiix: use userid in key * fix: lookup on AccountView list create * fix my own bad advice + tweaks * Autosync the updated translations (#2279) * fix my own bad advice + tweaks * fiix: use userid in key * [PS-1352] Fix ignore diacritics in search (#2044) * Fix ignore diacritics in search This change updates the search function to ignore diacritical marks in search results. Marks are stripped from both the search input and results. * Removed logs, added null or whitespace validation and improved formatting * [PS-2145] add rainsee browser series support (#2272) * fix: lookup on AccountView list create * Autosync the updated translations (#2279) * fix my own bad advice + tweaks * fix: single state grab is cool
This commit is contained in:
@@ -13,6 +13,7 @@ namespace Bit.App.Controls
|
||||
{
|
||||
private readonly string _text;
|
||||
private readonly string _id;
|
||||
private readonly string _color;
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
@@ -23,7 +24,7 @@ namespace Bit.App.Controls
|
||||
|
||||
if (obj is AvatarImageSource avatar)
|
||||
{
|
||||
return avatar._id == _id && avatar._text == _text;
|
||||
return avatar._id == _id && avatar._text == _text && avatar._color == _color;
|
||||
}
|
||||
|
||||
return base.Equals(obj);
|
||||
@@ -31,7 +32,7 @@ namespace Bit.App.Controls
|
||||
|
||||
public override int GetHashCode() => _id?.GetHashCode() ?? _text?.GetHashCode() ?? -1;
|
||||
|
||||
public AvatarImageSource(string userId = null, string name = null, string email = null)
|
||||
public AvatarImageSource(string userId = null, string name = null, string email = null, string color = null)
|
||||
{
|
||||
_id = userId;
|
||||
_text = name;
|
||||
@@ -39,6 +40,7 @@ namespace Bit.App.Controls
|
||||
{
|
||||
_text = email;
|
||||
}
|
||||
_color = color;
|
||||
}
|
||||
|
||||
public override Func<CancellationToken, Task<Stream>> Stream => GetStreamAsync;
|
||||
@@ -71,7 +73,7 @@ namespace Bit.App.Controls
|
||||
chars = upperCaseText = _text.ToUpper();
|
||||
}
|
||||
|
||||
var bgColor = CoreHelpers.StringToColor(_id ?? upperCaseText, "#33ffffff");
|
||||
var bgColor = _color ?? CoreHelpers.StringToColor(_id ?? upperCaseText, "#33ffffff");
|
||||
var textColor = CoreHelpers.TextColorFromBgColor(bgColor);
|
||||
var size = 50;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user