mirror of
https://github.com/bitwarden/android.git
synced 2025-01-01 05:48:34 +03:00
d61bc4b5c1
* [SG-886] MasterPassword Strength Indicator (#2238) * [SG-886] Add password strength indicator control * [SG-570] Add weak password dialog check * [SG-886] rename enum password strength * [SG-886] Change control scale * [SG-886] Move calculate user inputs to IPasswordGenerationService, refactor. * [SG-886] Move formatted string to xaml. Move minimum chars to constant * [SG-886] String to enum converter * [SG-886] PR fixes. Code refactor control * [SG-886] Update UI on OS theme change. * [SG-886] Move colors to view * [SG-886] Fixed password strength validation * [SG-564][SG-565] Check Exposed Password (#2239) * [SG-886] Add password strength indicator control * [SG-570] Add weak password dialog check * [SG-886] rename enum password strength * [SG-564] [SG-565] Add check for exposed password and show dialog * code format * [SG-886] Change control scale * [SG-886] Move calculate user inputs to IPasswordGenerationService, refactor. * [SG-886] Move formatted string to xaml. Move minimum chars to constant * [SG-886] String to enum converter * [SG-886] Remove import * [SG-886] Update UI on OS theme change. * [SG-886] Move colors to view * [SG-886] Fixed password strength validation
51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
using System;
|
|
using Bit.App.Abstractions;
|
|
using Bit.App.Controls;
|
|
using Bit.App.Resources;
|
|
using Bit.Core.Abstractions;
|
|
using Bit.Core.Exceptions;
|
|
using Bit.Core.Services;
|
|
using Bit.Core.Utilities;
|
|
using Xamarin.Forms;
|
|
|
|
namespace Bit.App.Pages
|
|
{
|
|
public abstract class BaseViewModel : ExtendedViewModel
|
|
{
|
|
private string _pageTitle = string.Empty;
|
|
private AvatarImageSource _avatar;
|
|
private LazyResolve<IDeviceActionService> _deviceActionService = new LazyResolve<IDeviceActionService>();
|
|
private LazyResolve<IPlatformUtilsService> _platformUtilsService = new LazyResolve<IPlatformUtilsService>();
|
|
private LazyResolve<ILogger> _logger = new LazyResolve<ILogger>();
|
|
|
|
public string PageTitle
|
|
{
|
|
get => _pageTitle;
|
|
set => SetProperty(ref _pageTitle, value);
|
|
}
|
|
|
|
public AvatarImageSource AvatarImageSource
|
|
{
|
|
get => _avatar ?? new AvatarImageSource();
|
|
set => SetProperty(ref _avatar, value);
|
|
}
|
|
|
|
public ContentPage Page { get; set; }
|
|
|
|
protected void HandleException(Exception ex, string message = null)
|
|
{
|
|
if (ex is ApiException apiException && apiException.Error != null)
|
|
{
|
|
message = apiException.Error.GetSingleMessage();
|
|
}
|
|
|
|
Xamarin.Essentials.MainThread.InvokeOnMainThreadAsync(async () =>
|
|
{
|
|
await _deviceActionService.Value.HideLoadingAsync();
|
|
await _platformUtilsService.Value.ShowDialogAsync(message ?? AppResources.GenericErrorMessage);
|
|
}).FireAndForget();
|
|
_logger.Value.Exception(ex);
|
|
}
|
|
|
|
}
|
|
}
|