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

View File

@ -1,4 +1,5 @@
using System;
using Xamarin.Forms;
namespace Bit.App.Pages
{
@ -11,6 +12,13 @@ namespace Bit.App.Pages
InitializeComponent();
_vm = BindingContext as EnvironmentPageViewModel;
_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)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -14,6 +14,13 @@ namespace Bit.App.Pages
_vm.Page = this;
MasterPasswordEntry = _masterPassword;
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; }

View File

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

View File

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

View File

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