1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-12-18 15:37:42 +01:00

add/remove continue button

This commit is contained in:
Kyle Spearrin 2019-05-28 09:12:05 -04:00
parent 29ab7f7a30
commit 822fc7f308
3 changed files with 22 additions and 6 deletions

View File

@ -17,13 +17,11 @@
<ResourceDictionary> <ResourceDictionary>
<u:InverseBoolConverter x:Key="inverseBool" /> <u:InverseBoolConverter x:Key="inverseBool" />
<u:IsNullConverter x:Key="isNull" /> <u:IsNullConverter x:Key="isNull" />
<ToolbarItem Text="{u:I18n Continue}" Clicked="Continue_Clicked"
x:Name="_continueItem" x:Key="continueItem" />
</ResourceDictionary> </ResourceDictionary>
</ContentPage.Resources> </ContentPage.Resources>
<ContentPage.ToolbarItems>
<ToolbarItem Text="{u:I18n Continue}" Clicked="Continue_Clicked" x:Name="_continueItem" />
</ContentPage.ToolbarItems>
<ScrollView x:Name="_scrollView"> <ScrollView x:Name="_scrollView">
<StackLayout Spacing="10" Padding="0, 0, 0, 10" VerticalOptions="FillAndExpand"> <StackLayout Spacing="10" Padding="0, 0, 0, 10" VerticalOptions="FillAndExpand">
<StackLayout Spacing="20" Padding="0" IsVisible="{Binding TotpMethod, Mode=OneWay}"> <StackLayout Spacing="20" Padding="0" IsVisible="{Binding TotpMethod, Mode=OneWay}">
@ -108,7 +106,7 @@
IsVisible="{Binding SelectedProviderType, Mode=OneWay, Converter={StaticResource isNull}}"> IsVisible="{Binding SelectedProviderType, Mode=OneWay, Converter={StaticResource isNull}}">
<Label <Label
Text="{u:I18n NoTwoStepAvailable}" Text="{u:I18n NoTwoStepAvailable}"
Margin="10, 20, 10, 0" Margin="10, 20, 10, 10"
HorizontalTextAlignment="Center" /> HorizontalTextAlignment="Center" />
</StackLayout> </StackLayout>
<Button Text="{u:I18n UseAnotherTwoStepMethod}" <Button Text="{u:I18n UseAnotherTwoStepMethod}"

View File

@ -19,6 +19,21 @@ namespace Bit.App.Pages
public HybridWebView DuoWebView { get; set; } public HybridWebView DuoWebView { get; set; }
public void AddContinueButton()
{
if(ToolbarItems.Count == 0)
{
ToolbarItems.Add(_continueItem);
}
}
public void RemoveContinueButton()
{
if(ToolbarItems.Count > 0)
{
ToolbarItems.Remove(_continueItem);
}
}
protected async override void OnAppearing() protected async override void OnAppearing()
{ {
base.OnAppearing(); base.OnAppearing();

View File

@ -114,6 +114,7 @@ namespace Bit.App.Pages
PageTitle = AppResources.LoginUnavailable; PageTitle = AppResources.LoginUnavailable;
return; return;
} }
var page = Page as TwoFactorPage;
PageTitle = _authService.TwoFactorProviders[SelectedProviderType.Value].Name; PageTitle = _authService.TwoFactorProviders[SelectedProviderType.Value].Name;
var providerData = _authService.TwoFactorProvidersData[SelectedProviderType.Value]; var providerData = _authService.TwoFactorProvidersData[SelectedProviderType.Value];
switch(SelectedProviderType.Value) switch(SelectedProviderType.Value)
@ -123,9 +124,9 @@ namespace Bit.App.Pages
break; break;
case TwoFactorProviderType.Duo: case TwoFactorProviderType.Duo:
case TwoFactorProviderType.OrganizationDuo: case TwoFactorProviderType.OrganizationDuo:
page.RemoveContinueButton();
var host = WebUtility.UrlEncode(providerData["Host"] as string); var host = WebUtility.UrlEncode(providerData["Host"] as string);
var req = WebUtility.UrlEncode(providerData["Signature"] as string); var req = WebUtility.UrlEncode(providerData["Signature"] as string);
var page = Page as TwoFactorPage;
page.DuoWebView.Uri = $"{_webVaultUrl}/duo-connector.html?host={host}&request={req}"; page.DuoWebView.Uri = $"{_webVaultUrl}/duo-connector.html?host={host}&request={req}";
page.DuoWebView.RegisterAction(async sig => page.DuoWebView.RegisterAction(async sig =>
{ {
@ -134,6 +135,7 @@ namespace Bit.App.Pages
}); });
break; break;
case TwoFactorProviderType.Email: case TwoFactorProviderType.Email:
page.AddContinueButton();
TwoFactorEmail = providerData["Email"] as string; TwoFactorEmail = providerData["Email"] as string;
if(_authService.TwoFactorProvidersData.Count > 1) if(_authService.TwoFactorProvidersData.Count > 1)
{ {
@ -141,6 +143,7 @@ namespace Bit.App.Pages
} }
break; break;
default: default:
page.AddContinueButton();
break; break;
} }
} }