1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-09 03:53:15 +00:00

Added account deletion feature on settings (#1621)

* Added account deletion feature on settings

* Disabled using Microsoft.AppCenter.Crashes for FDroid

* Moved drawable on Android.csproj to be with the others

Co-authored-by: Federico Maccaroni <fmaccaroni@bitwarden.com>
This commit is contained in:
Federico Maccaroni
2021-11-24 16:09:39 -03:00
committed by GitHub
parent 833103b2a0
commit 9fdf2ada6f
22 changed files with 884 additions and 20 deletions

View File

@@ -1,7 +1,7 @@
using System.Threading.Tasks;
using Bit.Core.Abstractions;
using Bit.App.Abstractions;
using Bit.App.Resources;
using Bit.Core.Abstractions;
using System;
using Bit.Core.Utilities;
@@ -22,23 +22,23 @@ namespace Bit.App.Services
public async Task<bool> ShowPasswordPromptAsync()
{
if (!await Enabled())
{
return true;
}
return await _platformUtilsService.ShowPasswordDialogAsync(AppResources.PasswordConfirmation, AppResources.PasswordConfirmationDesc, ValidatePasswordAsync);
}
Func<string, Task<bool>> validator = async (string password) =>
{
// Assume user has canceled.
if (string.IsNullOrWhiteSpace(password))
{
return false;
};
public async Task<(string password, bool valid)> ShowPasswordPromptAndGetItAsync()
{
return await _platformUtilsService.ShowPasswordDialogAndGetItAsync(AppResources.PasswordConfirmation, AppResources.PasswordConfirmationDesc, ValidatePasswordAsync);
}
return await _cryptoService.CompareAndUpdateKeyHashAsync(password, null);
private async Task<bool> ValidatePasswordAsync(string password)
{
// Assume user has canceled.
if (string.IsNullOrWhiteSpace(password))
{
return false;
};
return await _platformUtilsService.ShowPasswordDialogAsync(AppResources.PasswordConfirmation, AppResources.PasswordConfirmationDesc, validator);
return await _cryptoService.CompareAndUpdateKeyHashAsync(password, null);
}
public async Task<bool> Enabled()

View File

@@ -167,13 +167,18 @@ namespace Bit.App.Services
}
public async Task<bool> ShowPasswordDialogAsync(string title, string body, Func<string, Task<bool>> validator)
{
return (await ShowPasswordDialogAndGetItAsync(title, body, validator)).valid;
}
public async Task<(string password, bool valid)> ShowPasswordDialogAndGetItAsync(string title, string body, Func<string, Task<bool>> validator)
{
var password = await _deviceActionService.DisplayPromptAync(AppResources.PasswordConfirmation,
AppResources.PasswordConfirmationDesc, null, AppResources.Submit, AppResources.Cancel, password: true);
if (password == null)
{
return false;
return (password, false);
}
var valid = await validator(password);
@@ -183,7 +188,7 @@ namespace Bit.App.Services
await ShowDialogAsync(AppResources.InvalidMasterPassword, null, AppResources.Ok);
}
return valid;
return (password, valid);
}
public bool IsDev()