mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 23:25:45 +03:00
[GDPR] Adjusted TOS/Privacy acceptance (#1138)
* GDPR acceptance flows * Added specialized margin by platform * Changed property name
This commit is contained in:
parent
75b6e69d34
commit
82c96555dc
4 changed files with 99 additions and 1 deletions
|
@ -123,6 +123,39 @@
|
||||||
Text="{u:I18n MasterPasswordHintDescription}"
|
Text="{u:I18n MasterPasswordHintDescription}"
|
||||||
StyleClass="box-footer-label" />
|
StyleClass="box-footer-label" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
<StackLayout StyleClass="box">
|
||||||
|
<StackLayout StyleClass="box-row, box-row-switch"
|
||||||
|
IsVisible="{Binding ShowTerms}">
|
||||||
|
<Switch
|
||||||
|
IsToggled="{Binding AcceptPolicies}"
|
||||||
|
StyleClass="box-value"
|
||||||
|
HorizontalOptions="Start"
|
||||||
|
Margin="{Binding SwitchMargin}"/>
|
||||||
|
<Label StyleClass="box-footer-label"
|
||||||
|
HorizontalOptions="Fill">
|
||||||
|
<Label.FormattedText>
|
||||||
|
<FormattedString>
|
||||||
|
<Span Text="{u:I18n AcceptPolicies}" />
|
||||||
|
<Span Text="{u:I18n TermsOfService}"
|
||||||
|
TextColor="Blue">
|
||||||
|
<Span.GestureRecognizers>
|
||||||
|
<TapGestureRecognizer Command="{Binding PoliciesClickCommand}"
|
||||||
|
CommandParameter="https://bitwarden.com/terms/" />
|
||||||
|
</Span.GestureRecognizers>
|
||||||
|
</Span>
|
||||||
|
<Span Text=", " />
|
||||||
|
<Span Text="{u:I18n PrivacyPolicy}"
|
||||||
|
TextColor="Blue">
|
||||||
|
<Span.GestureRecognizers>
|
||||||
|
<TapGestureRecognizer Command="{Binding PoliciesClickCommand}"
|
||||||
|
CommandParameter="https://bitwarden.com/privacy/" />
|
||||||
|
</Span.GestureRecognizers>
|
||||||
|
</Span>
|
||||||
|
</FormattedString>
|
||||||
|
</Label.FormattedText>
|
||||||
|
</Label>
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ using Bit.Core.Models.Request;
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Bit.App.Pages
|
namespace Bit.App.Pages
|
||||||
|
@ -18,6 +19,7 @@ namespace Bit.App.Pages
|
||||||
private readonly ICryptoService _cryptoService;
|
private readonly ICryptoService _cryptoService;
|
||||||
private readonly IPlatformUtilsService _platformUtilsService;
|
private readonly IPlatformUtilsService _platformUtilsService;
|
||||||
private bool _showPassword;
|
private bool _showPassword;
|
||||||
|
private bool _acceptPolicies;
|
||||||
|
|
||||||
public RegisterPageViewModel()
|
public RegisterPageViewModel()
|
||||||
{
|
{
|
||||||
|
@ -30,8 +32,14 @@ namespace Bit.App.Pages
|
||||||
TogglePasswordCommand = new Command(TogglePassword);
|
TogglePasswordCommand = new Command(TogglePassword);
|
||||||
ToggleConfirmPasswordCommand = new Command(ToggleConfirmPassword);
|
ToggleConfirmPasswordCommand = new Command(ToggleConfirmPassword);
|
||||||
SubmitCommand = new Command(async () => await SubmitAsync());
|
SubmitCommand = new Command(async () => await SubmitAsync());
|
||||||
|
ShowTerms = !_platformUtilsService.IsSelfHost();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ICommand PoliciesClickCommand => new Command<string>((url) =>
|
||||||
|
{
|
||||||
|
_platformUtilsService.LaunchUri(url);
|
||||||
|
});
|
||||||
|
|
||||||
public bool ShowPassword
|
public bool ShowPassword
|
||||||
{
|
{
|
||||||
get => _showPassword;
|
get => _showPassword;
|
||||||
|
@ -42,6 +50,20 @@ namespace Bit.App.Pages
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 SubmitCommand { get; }
|
||||||
public Command TogglePasswordCommand { get; }
|
public Command TogglePasswordCommand { get; }
|
||||||
public Command ToggleConfirmPasswordCommand { get; }
|
public Command ToggleConfirmPasswordCommand { get; }
|
||||||
|
@ -93,6 +115,12 @@ namespace Bit.App.Pages
|
||||||
AppResources.MasterPasswordConfirmationValMessage, AppResources.Ok);
|
AppResources.MasterPasswordConfirmationValMessage, AppResources.Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (ShowTerms && !AcceptPolicies)
|
||||||
|
{
|
||||||
|
await Page.DisplayAlert(AppResources.AnErrorHasOccurred,
|
||||||
|
AppResources.AcceptPoliciesError, AppResources.Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Password strength check?
|
// TODO: Password strength check?
|
||||||
|
|
||||||
|
|
24
src/App/Resources/AppResources.Designer.cs
generated
24
src/App/Resources/AppResources.Designer.cs
generated
|
@ -3050,5 +3050,29 @@ namespace Bit.App.Resources {
|
||||||
return ResourceManager.GetString("Loading", resourceCulture);
|
return ResourceManager.GetString("Loading", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string AcceptPolicies {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("AcceptPolicies", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string AcceptPoliciesError {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("AcceptPoliciesError", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string TermsOfService {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TermsOfService", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string PrivacyPolicy {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("PrivacyPolicy", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1731,4 +1731,17 @@
|
||||||
<data name="Loading" xml:space="preserve">
|
<data name="Loading" xml:space="preserve">
|
||||||
<value>Loading</value>
|
<value>Loading</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="AcceptPolicies" xml:space="preserve">
|
||||||
|
<value>By activating this switch you agree to the following:
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
<data name="AcceptPoliciesError" xml:space="preserve">
|
||||||
|
<value>Terms of Service and Privacy Policy have not been acknowledged.</value>
|
||||||
|
</data>
|
||||||
|
<data name="TermsOfService" xml:space="preserve">
|
||||||
|
<value>Terms of Service</value>
|
||||||
|
</data>
|
||||||
|
<data name="PrivacyPolicy" xml:space="preserve">
|
||||||
|
<value>Privacy Policy</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
Loading…
Reference in a new issue