return commands for accounts pages

This commit is contained in:
Kyle Spearrin 2019-05-31 12:13:14 -04:00
parent 61be796c76
commit a98283f3ff
12 changed files with 56 additions and 8 deletions

View file

@ -31,7 +31,9 @@
Text="{Binding BaseUrl}" Text="{Binding BaseUrl}"
Keyboard="Url" Keyboard="Url"
Placeholder="ex. https://bitwarden.company.com" Placeholder="ex. https://bitwarden.company.com"
StyleClass="box-value" /> StyleClass="box-value"
ReturnType="Go"
ReturnCommand="{Binding SubmitCommand}" />
</StackLayout> </StackLayout>
<Label <Label
Text="{u:I18n SelfHostedEnvironmentFooter}" Text="{u:I18n SelfHostedEnvironmentFooter}"
@ -47,6 +49,7 @@
Text="{u:I18n WebVaultUrl}" Text="{u:I18n WebVaultUrl}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_webVaultEntry"
Text="{Binding WebVaultUrl}" Text="{Binding WebVaultUrl}"
Keyboard="Url" Keyboard="Url"
StyleClass="box-value" /> StyleClass="box-value" />
@ -56,6 +59,7 @@
Text="{u:I18n ApiUrl}" Text="{u:I18n ApiUrl}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_apiEntry"
Text="{Binding ApiUrl}" Text="{Binding ApiUrl}"
Keyboard="Url" Keyboard="Url"
StyleClass="box-value" /> StyleClass="box-value" />
@ -65,6 +69,7 @@
Text="{u:I18n IdentityUrl}" Text="{u:I18n IdentityUrl}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_identityEntry"
Text="{Binding IdentityUrl}" Text="{Binding IdentityUrl}"
Keyboard="Url" Keyboard="Url"
StyleClass="box-value" /> StyleClass="box-value" />
@ -74,9 +79,12 @@
Text="{u:I18n IconsUrl}" Text="{u:I18n IconsUrl}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_iconsEntry"
Text="{Binding IconsUrl}" Text="{Binding IconsUrl}"
Keyboard="Url" Keyboard="Url"
StyleClass="box-value" /> StyleClass="box-value"
ReturnType="Go"
ReturnCommand="{Binding SubmitCommand}" />
</StackLayout> </StackLayout>
<Label <Label
Text="{u:I18n CustomEnvironmentFooter}" Text="{u:I18n CustomEnvironmentFooter}"

View file

@ -1,4 +1,5 @@
using System; using System;
using Xamarin.Forms;
namespace Bit.App.Pages namespace Bit.App.Pages
{ {
@ -11,6 +12,13 @@ namespace Bit.App.Pages
InitializeComponent(); InitializeComponent();
_vm = BindingContext as EnvironmentPageViewModel; _vm = BindingContext as EnvironmentPageViewModel;
_vm.Page = this; _vm.Page = this;
_webVaultEntry.ReturnType = ReturnType.Next;
_webVaultEntry.ReturnCommand = new Command(() => _apiEntry.Focus());
_apiEntry.ReturnType = ReturnType.Next;
_apiEntry.ReturnCommand = new Command(() => _identityEntry.Focus());
_identityEntry.ReturnType = ReturnType.Next;
_identityEntry.ReturnCommand = new Command(() => _iconsEntry.Focus());
} }
private async void Submit_Clicked(object sender, EventArgs e) private async void Submit_Clicked(object sender, EventArgs e)

View file

@ -2,6 +2,7 @@
using Bit.Core.Abstractions; using Bit.Core.Abstractions;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms;
namespace Bit.App.Pages namespace Bit.App.Pages
{ {
@ -22,8 +23,10 @@ namespace Bit.App.Pages
IdentityUrl = _environmentService.IdentityUrl; IdentityUrl = _environmentService.IdentityUrl;
IconsUrl = _environmentService.IconsUrl; IconsUrl = _environmentService.IconsUrl;
NotificationsUrls = _environmentService.NotificationsUrl; NotificationsUrls = _environmentService.NotificationsUrl;
SubmitCommand = new Command(async () => await SubmitAsync());
} }
public Command SubmitCommand { get; }
public string BaseUrl { get; set; } public string BaseUrl { get; set; }
public string ApiUrl { get; set; } public string ApiUrl { get; set; }
public string IdentityUrl { get; set; } public string IdentityUrl { get; set; }

View file

@ -25,7 +25,9 @@
<Entry <Entry
Text="{Binding Email}" Text="{Binding Email}"
Keyboard="Email" Keyboard="Email"
StyleClass="box-value" /> StyleClass="box-value"
ReturnType="Go"
ReturnCommand="{Binding SubmitCommand}" />
</StackLayout> </StackLayout>
<Label <Label
Text="{u:I18n EnterEmailForHint}" Text="{u:I18n EnterEmailForHint}"

View file

@ -4,6 +4,7 @@ using Bit.Core.Abstractions;
using Bit.Core.Exceptions; using Bit.Core.Exceptions;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms;
namespace Bit.App.Pages namespace Bit.App.Pages
{ {
@ -18,8 +19,10 @@ namespace Bit.App.Pages
_apiService = ServiceContainer.Resolve<IApiService>("apiService"); _apiService = ServiceContainer.Resolve<IApiService>("apiService");
PageTitle = AppResources.PasswordHint; PageTitle = AppResources.PasswordHint;
SubmitCommand = new Command(async () => await SubmitAsync());
} }
public Command SubmitCommand { get; }
public string Email { get; set; } public string Email { get; set; }
public async Task SubmitAsync() public async Task SubmitAsync()

View file

@ -47,7 +47,9 @@
Keyboard="Numeric" Keyboard="Numeric"
IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}" IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}"
Grid.Row="1" Grid.Row="1"
Grid.Column="0" /> Grid.Column="0"
ReturnType="Go"
ReturnCommand="{Binding SubmitCommand}" />
<controls:FaButton <controls:FaButton
StyleClass="box-row-button, box-row-button-platform" StyleClass="box-row-button, box-row-button-platform"
Text="{Binding ShowPasswordIcon}" Text="{Binding ShowPasswordIcon}"
@ -76,7 +78,9 @@
StyleClass="box-value" StyleClass="box-value"
IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}" IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}"
Grid.Row="1" Grid.Row="1"
Grid.Column="0" /> Grid.Column="0"
ReturnType="Go"
ReturnCommand="{Binding SubmitCommand}" />
<controls:FaButton <controls:FaButton
StyleClass="box-row-button, box-row-button-platform" StyleClass="box-row-button, box-row-button-platform"
Text="{Binding ShowPasswordIcon}" Text="{Binding ShowPasswordIcon}"

View file

@ -45,6 +45,7 @@ namespace Bit.App.Pages
PageTitle = AppResources.VerifyMasterPassword; PageTitle = AppResources.VerifyMasterPassword;
TogglePasswordCommand = new Command(TogglePassword); TogglePasswordCommand = new Command(TogglePassword);
SubmitCommand = new Command(async () => await SubmitAsync());
} }
public bool ShowPassword public bool ShowPassword
@ -87,6 +88,7 @@ namespace Bit.App.Pages
set => SetProperty(ref _lockedVerifyText, value); set => SetProperty(ref _lockedVerifyText, value);
} }
public Command SubmitCommand { get; }
public Command TogglePasswordCommand { get; } public Command TogglePasswordCommand { get; }
public string ShowPasswordIcon => ShowPassword ? "" : ""; public string ShowPasswordIcon => ShowPassword ? "" : "";
public string MasterPassword { get; set; } public string MasterPassword { get; set; }

View file

@ -104,8 +104,11 @@
Text="{u:I18n MasterPasswordHint}" Text="{u:I18n MasterPasswordHint}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_hint"
Text="{Binding Hint}" Text="{Binding Hint}"
StyleClass="box-value" /> StyleClass="box-value"
ReturnType="Go"
ReturnCommand="{Binding SubmitCommand}" />
</StackLayout> </StackLayout>
<Label <Label
Text="{u:I18n MasterPasswordHintDescription}" Text="{u:I18n MasterPasswordHintDescription}"

View file

@ -14,6 +14,13 @@ namespace Bit.App.Pages
_vm.Page = this; _vm.Page = this;
MasterPasswordEntry = _masterPassword; MasterPasswordEntry = _masterPassword;
ConfirmMasterPasswordEntry = _confirmMasterPassword; ConfirmMasterPasswordEntry = _confirmMasterPassword;
_email.ReturnType = ReturnType.Next;
_email.ReturnCommand = new Command(() => _masterPassword.Focus());
_masterPassword.ReturnType = ReturnType.Next;
_masterPassword.ReturnCommand = new Command(() => _confirmMasterPassword.Focus());
_confirmMasterPassword.ReturnType = ReturnType.Next;
_confirmMasterPassword.ReturnCommand = new Command(() => _hint.Focus());
} }
public Entry MasterPasswordEntry { get; set; } public Entry MasterPasswordEntry { get; set; }

View file

@ -27,6 +27,7 @@ namespace Bit.App.Pages
PageTitle = AppResources.Bitwarden; PageTitle = AppResources.Bitwarden;
TogglePasswordCommand = new Command(TogglePassword); TogglePasswordCommand = new Command(TogglePassword);
ToggleConfirmPasswordCommand = new Command(ToggleConfirmPassword); ToggleConfirmPasswordCommand = new Command(ToggleConfirmPassword);
SubmitCommand = new Command(async () => await SubmitAsync());
} }
public bool ShowPassword public bool ShowPassword
@ -39,6 +40,7 @@ namespace Bit.App.Pages
}); });
} }
public Command SubmitCommand { get; }
public Command TogglePasswordCommand { get; } public Command TogglePasswordCommand { get; }
public Command ToggleConfirmPasswordCommand { get; } public Command ToggleConfirmPasswordCommand { get; }
public string ShowPasswordIcon => ShowPassword ? "" : ""; public string ShowPasswordIcon => ShowPassword ? "" : "";

View file

@ -38,7 +38,9 @@
Text="{Binding Token}" Text="{Binding Token}"
x:Name="_totpEntry" x:Name="_totpEntry"
Keyboard="Numeric" Keyboard="Numeric"
StyleClass="box-value" /> StyleClass="box-value"
ReturnType="Go"
ReturnCommand="{Binding SubmitCommand}" />
</StackLayout> </StackLayout>
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
@ -67,7 +69,9 @@
<StackLayout StyleClass="box-row, box-row-input"> <StackLayout StyleClass="box-row, box-row-input">
<Entry <Entry
Text="{Binding Token}" Text="{Binding Token}"
StyleClass="box-value" /> StyleClass="box-value"
ReturnType="Go"
ReturnCommand="{Binding SubmitCommand}" />
</StackLayout> </StackLayout>
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label

View file

@ -42,6 +42,7 @@ namespace Bit.App.Pages
_broadcasterService = ServiceContainer.Resolve<IBroadcasterService>("broadcasterService"); _broadcasterService = ServiceContainer.Resolve<IBroadcasterService>("broadcasterService");
PageTitle = AppResources.TwoStepLogin; PageTitle = AppResources.TwoStepLogin;
SubmitCommand = new Command(async () => await SubmitAsync());
} }
public string TotpInstruction public string TotpInstruction
@ -80,6 +81,7 @@ namespace Bit.App.Pages
nameof(TotpMethod), nameof(TotpMethod),
}); });
} }
public Command SubmitCommand { get; }
public void Init() public void Init()
{ {