mirror of
https://github.com/bitwarden/mobile
synced 2025-12-05 23:53:33 +00:00
* [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
95 lines
2.3 KiB
C#
95 lines
2.3 KiB
C#
using Bit.Core;
|
|
using Bit.Core.Enums;
|
|
using Bit.Core.Models.View;
|
|
using Bit.Core.Utilities;
|
|
|
|
namespace Bit.App.Controls
|
|
{
|
|
public class AccountViewCellViewModel : ExtendedViewModel
|
|
{
|
|
private AccountView _accountView;
|
|
private AvatarImageSource _avatar;
|
|
|
|
public AccountViewCellViewModel(AccountView accountView)
|
|
{
|
|
AccountView = accountView;
|
|
AvatarImageSource = ServiceContainer.Resolve<IAvatarImageSourcePool>("avatarImageSourcePool")
|
|
?.GetOrCreateAvatar(AccountView.UserId, AccountView.Name, AccountView.Email, AccountView.AvatarColor);
|
|
}
|
|
|
|
public AccountView AccountView
|
|
{
|
|
get => _accountView;
|
|
set => SetProperty(ref _accountView, value);
|
|
}
|
|
|
|
public AvatarImageSource AvatarImageSource
|
|
{
|
|
get => _avatar;
|
|
set => SetProperty(ref _avatar, value);
|
|
}
|
|
|
|
public bool IsAccount
|
|
{
|
|
get => AccountView.IsAccount;
|
|
}
|
|
|
|
public bool ShowHostname
|
|
{
|
|
get => !string.IsNullOrWhiteSpace(AccountView.Hostname) && AccountView.Hostname != "vault.bitwarden.com";
|
|
}
|
|
|
|
public bool IsActive
|
|
{
|
|
get => AccountView.IsActive;
|
|
}
|
|
|
|
public bool IsUnlocked
|
|
{
|
|
get => AccountView.AuthStatus == AuthenticationStatus.Unlocked;
|
|
}
|
|
|
|
public bool IsUnlockedAndNotActive
|
|
{
|
|
get => IsUnlocked && !IsActive;
|
|
}
|
|
|
|
public bool IsLocked
|
|
{
|
|
get => AccountView.AuthStatus == AuthenticationStatus.Locked;
|
|
}
|
|
|
|
public bool IsLockedAndNotActive
|
|
{
|
|
get => IsLocked && !IsActive;
|
|
}
|
|
|
|
public bool IsLoggedOut
|
|
{
|
|
get => AccountView.AuthStatus == AuthenticationStatus.LoggedOut;
|
|
}
|
|
|
|
public bool IsLoggedOutAndNotActive
|
|
{
|
|
get => IsLoggedOut && !IsActive;
|
|
}
|
|
|
|
public string AuthStatusIconActive
|
|
{
|
|
get => BitwardenIcons.CheckCircle;
|
|
}
|
|
|
|
public string AuthStatusIconNotActive
|
|
{
|
|
get
|
|
{
|
|
if (IsUnlocked)
|
|
{
|
|
return BitwardenIcons.Unlock;
|
|
}
|
|
return BitwardenIcons.Lock;
|
|
}
|
|
}
|
|
}
|
|
}
|