reposition buttons in Log In and Unlock pages (#1073)

* reposition buttons in Log In and Unlock pages

-   Log In page: move Log In button to primary location below password
    entry, move Get Your Master Password Hint to the More Options menu
-   Unlock page (Verify Master Password): swap position of Unlock
    and Log Out buttons

* finish changes to improved login ui

- move Log Out button in lock screen to secondary menu
- show Get Hint button on login screen in the iOS autofill login flow

Co-authored-by: Matt Portune <59324545+mportune-bw@users.noreply.github.com>
This commit is contained in:
eliykat 2020-11-13 02:23:34 +10:00 committed by GitHub
parent a72f497581
commit 6258a9cff9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 74 additions and 15 deletions

View file

@ -16,11 +16,19 @@
<ContentPage.Resources> <ContentPage.Resources>
<ResourceDictionary> <ResourceDictionary>
<u:InverseBoolConverter x:Key="inverseBool" /> <u:InverseBoolConverter x:Key="inverseBool" />
<ToolbarItem Icon="more_vert.png" Clicked="More_Clicked" Order="Primary"
x:Name="_moreItem" x:Key="moreItem"
AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n Options}" />
<ToolbarItem Text="{u:I18n LogOut}"
x:Key="logOut"
x:Name="_logOut"
Clicked="LogOut_Clicked"
Order="Secondary"/>
</ResourceDictionary> </ResourceDictionary>
</ContentPage.Resources> </ContentPage.Resources>
<ContentPage.ToolbarItems> <ContentPage.ToolbarItems>
<ToolbarItem Text="{u:I18n Unlock}" Clicked="Unlock_Clicked" />
</ContentPage.ToolbarItems> </ContentPage.ToolbarItems>
<ScrollView> <ScrollView>
@ -112,7 +120,7 @@
IsVisible="{Binding BiometricIntegrityValid, Converter={StaticResource inverseBool}}" /> IsVisible="{Binding BiometricIntegrityValid, Converter={StaticResource inverseBool}}" />
<Button Text="{Binding BiometricButtonText}" Clicked="Biometric_Clicked" <Button Text="{Binding BiometricButtonText}" Clicked="Biometric_Clicked"
IsVisible="{Binding BiometricButtonVisible}"></Button> IsVisible="{Binding BiometricButtonVisible}"></Button>
<Button Text="{u:I18n LogOut}" Clicked="LogOut_Clicked"></Button> <Button Text="{u:I18n Unlock}" Clicked="Unlock_Clicked"></Button>
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>
</ScrollView> </ScrollView>

View file

@ -1,4 +1,5 @@
using Bit.App.Models; using Bit.App.Models;
using Bit.App.Resources;
using Bit.Core.Abstractions; using Bit.Core.Abstractions;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using System; using System;
@ -29,6 +30,15 @@ namespace Bit.App.Pages
_vm.UnlockedAction = () => Device.BeginInvokeOnMainThread(async () => await UnlockedAsync()); _vm.UnlockedAction = () => Device.BeginInvokeOnMainThread(async () => await UnlockedAsync());
MasterPasswordEntry = _masterPassword; MasterPasswordEntry = _masterPassword;
PinEntry = _pin; PinEntry = _pin;
if (Device.RuntimePlatform == Device.iOS)
{
ToolbarItems.Add(_moreItem);
}
else
{
ToolbarItems.Add(_logOut);
}
} }
public Entry MasterPasswordEntry { get; set; } public Entry MasterPasswordEntry { get; set; }
@ -97,6 +107,22 @@ namespace Bit.App.Pages
} }
} }
private async void More_Clicked(object sender, System.EventArgs e)
{
if (!DoOnce())
{
return;
}
var selection = await DisplayActionSheet(AppResources.Options,
AppResources.Cancel, null, AppResources.LogOut);
if (selection == AppResources.LogOut)
{
await _vm.LogOutAsync();
}
}
private async Task UnlockedAsync() private async Task UnlockedAsync()
{ {
if (AppHelpers.SetAlternateMainPage(_appOptions)) if (AppHelpers.SetAlternateMainPage(_appOptions))

View file

@ -16,12 +16,20 @@
<ContentPage.Resources> <ContentPage.Resources>
<ResourceDictionary> <ResourceDictionary>
<u:InverseBoolConverter x:Key="inverseBool" /> <u:InverseBoolConverter x:Key="inverseBool" />
<ToolbarItem Icon="more_vert.png" Clicked="More_Clicked" Order="Primary"
x:Name="_moreItem" x:Key="moreItem"
AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n Options}" />
<ToolbarItem Text="{u:I18n GetPasswordHint}"
x:Key="getPasswordHint"
x:Name="_getPasswordHint"
Clicked="Hint_Clicked"
Order="Secondary"/>
</ResourceDictionary> </ResourceDictionary>
</ContentPage.Resources> </ContentPage.Resources>
<ContentPage.ToolbarItems> <ContentPage.ToolbarItems>
<ToolbarItem Text="{u:I18n Close}" Clicked="Close_Clicked" Order="Primary" Priority="-1" /> <ToolbarItem Text="{u:I18n Close}" Clicked="Close_Clicked" Order="Primary" Priority="-1" />
<ToolbarItem Text="{u:I18n LogIn}" Clicked="LogIn_Clicked" />
</ContentPage.ToolbarItems> </ContentPage.ToolbarItems>
<ScrollView> <ScrollView>
@ -73,8 +81,8 @@
AutomationProperties.Name="{u:I18n ToggleVisibility}" /> AutomationProperties.Name="{u:I18n ToggleVisibility}" />
</Grid> </Grid>
</StackLayout> </StackLayout>
<StackLayout Padding="10, 0" IsVisible="{Binding HideHintButton, Converter={StaticResource inverseBool}}"> <StackLayout Padding="10, 0">
<Button Text="{u:I18n GetPasswordHint}" Clicked="Hint_Clicked" /> <Button Text="{u:I18n LogIn}" Clicked="LogIn_Clicked" />
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>
</ScrollView> </ScrollView>

View file

@ -1,4 +1,5 @@
using Bit.App.Models; using Bit.App.Models;
using Bit.App.Resources;
using Bit.Core.Abstractions; using Bit.Core.Abstractions;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using System; using System;
@ -40,6 +41,15 @@ namespace Bit.App.Pages
_email.ReturnType = ReturnType.Next; _email.ReturnType = ReturnType.Next;
_email.ReturnCommand = new Command(() => _masterPassword.Focus()); _email.ReturnCommand = new Command(() => _masterPassword.Focus());
if (Device.RuntimePlatform == Device.iOS)
{
ToolbarItems.Add(_moreItem);
}
else
{
ToolbarItems.Add(_getPasswordHint);
}
} }
public Entry MasterPasswordEntry { get; set; } public Entry MasterPasswordEntry { get; set; }
@ -82,6 +92,22 @@ namespace Bit.App.Pages
} }
} }
private async void More_Clicked(object sender, System.EventArgs e)
{
if (!DoOnce())
{
return;
}
var selection = await DisplayActionSheet(AppResources.Options,
AppResources.Cancel, null, AppResources.GetPasswordHint);
if (selection == AppResources.GetPasswordHint)
{
await Navigation.PushModalAsync(new NavigationPage(new HintPage()));
}
}
private async Task StartTwoFactorAsync() private async Task StartTwoFactorAsync()
{ {
var page = new TwoFactorPage(false, _appOptions); var page = new TwoFactorPage(false, _appOptions);

View file

@ -25,7 +25,6 @@ namespace Bit.App.Pages
private bool _showPassword; private bool _showPassword;
private string _email; private string _email;
private string _masterPassword; private string _masterPassword;
private bool _hideHintButton;
public LoginPageViewModel() public LoginPageViewModel()
{ {
@ -71,12 +70,6 @@ namespace Bit.App.Pages
public Action LogInSuccessAction { get; set; } public Action LogInSuccessAction { get; set; }
public Action CloseAction { get; set; } public Action CloseAction { get; set; }
public bool HideHintButton
{
get => _hideHintButton;
set => SetProperty(ref _hideHintButton, value);
}
public async Task InitAsync() public async Task InitAsync()
{ {
if (string.IsNullOrWhiteSpace(Email)) if (string.IsNullOrWhiteSpace(Email))

View file

@ -372,7 +372,6 @@ namespace Bit.iOS.Autofill
vm.StartTwoFactorAction = () => DismissViewController(false, () => LaunchTwoFactorFlow(false)); vm.StartTwoFactorAction = () => DismissViewController(false, () => LaunchTwoFactorFlow(false));
vm.LogInSuccessAction = () => DismissLockAndContinue(); vm.LogInSuccessAction = () => DismissLockAndContinue();
vm.CloseAction = () => DismissViewController(false, () => LaunchHomePage()); vm.CloseAction = () => DismissViewController(false, () => LaunchHomePage());
vm.HideHintButton = true;
} }
var navigationPage = new NavigationPage(loginPage); var navigationPage = new NavigationPage(loginPage);

View file

@ -498,7 +498,6 @@ namespace Bit.iOS.Extension
vm.StartTwoFactorAction = () => DismissViewController(false, () => LaunchTwoFactorFlow(false)); vm.StartTwoFactorAction = () => DismissViewController(false, () => LaunchTwoFactorFlow(false));
vm.LogInSuccessAction = () => DismissLockAndContinue(); vm.LogInSuccessAction = () => DismissLockAndContinue();
vm.CloseAction = () => CompleteRequest(null, null); vm.CloseAction = () => CompleteRequest(null, null);
vm.HideHintButton = true;
} }
var navigationPage = new NavigationPage(loginPage); var navigationPage = new NavigationPage(loginPage);