1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-23 19:53:50 +00:00

[GDPR] Adjusted TOS/Privacy acceptance (#1138)

* GDPR acceptance flows

* Added specialized margin by platform

* Changed property name
This commit is contained in:
Vincent Salucci
2020-11-05 10:50:18 -06:00
committed by GitHub
parent 75b6e69d34
commit 82c96555dc
4 changed files with 99 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ using Bit.Core.Models.Request;
using Bit.Core.Utilities;
using System;
using System.Threading.Tasks;
using System.Windows.Input;
using Xamarin.Forms;
namespace Bit.App.Pages
@@ -18,6 +19,7 @@ namespace Bit.App.Pages
private readonly ICryptoService _cryptoService;
private readonly IPlatformUtilsService _platformUtilsService;
private bool _showPassword;
private bool _acceptPolicies;
public RegisterPageViewModel()
{
@@ -30,7 +32,13 @@ namespace Bit.App.Pages
TogglePasswordCommand = new Command(TogglePassword);
ToggleConfirmPasswordCommand = new Command(ToggleConfirmPassword);
SubmitCommand = new Command(async () => await SubmitAsync());
ShowTerms = !_platformUtilsService.IsSelfHost();
}
public ICommand PoliciesClickCommand => new Command<string>((url) =>
{
_platformUtilsService.LaunchUri(url);
});
public bool ShowPassword
{
@@ -41,7 +49,21 @@ namespace Bit.App.Pages
nameof(ShowPasswordIcon)
});
}
public bool AcceptPolicies
{
get => _acceptPolicies;
set => SetProperty(ref _acceptPolicies, value);
}
public Thickness SwitchMargin
{
get => Device.RuntimePlatform == Device.Android
? new Thickness(0, 0, 0, 0)
: new Thickness(0, 0, 10, 0);
}
public bool ShowTerms { get; set; }
public Command SubmitCommand { get; }
public Command TogglePasswordCommand { get; }
public Command ToggleConfirmPasswordCommand { get; }
@@ -93,6 +115,12 @@ namespace Bit.App.Pages
AppResources.MasterPasswordConfirmationValMessage, AppResources.Ok);
return;
}
if (ShowTerms && !AcceptPolicies)
{
await Page.DisplayAlert(AppResources.AnErrorHasOccurred,
AppResources.AcceptPoliciesError, AppResources.Ok);
return;
}
// TODO: Password strength check?