1
0
mirror of https://github.com/bitwarden/mobile.git synced 2025-02-18 01:31:42 +01:00

Added remember last email login. adjsuted sizing on extension slider. Added fallback logout to fingerprint.

This commit is contained in:
Kyle Spearrin 2016-07-30 13:28:13 -04:00
parent c84ec2e947
commit c59549f25a
5 changed files with 29 additions and 4 deletions

View File

@ -7,6 +7,7 @@
public const string SettingLockSeconds = "setting:lockSeconds"; public const string SettingLockSeconds = "setting:lockSeconds";
public const string SettingLastBackgroundedDate = "lastBackgroundedDate"; public const string SettingLastBackgroundedDate = "lastBackgroundedDate";
public const string SettingLocked = "locked"; public const string SettingLocked = "locked";
public const string SettingLastLoginEmail = "lastLoginEmail";
public const string PasswordGeneratorLength = "pwGenerator:length"; public const string PasswordGeneratorLength = "pwGenerator:length";
public const string PasswordGeneratorUppercase = "pwGenerator:uppercase"; public const string PasswordGeneratorUppercase = "pwGenerator:uppercase";

View File

@ -100,6 +100,10 @@ namespace Bit.App.Pages
_settings.AddOrUpdateValue(Constants.SettingLocked, false); _settings.AddOrUpdateValue(Constants.SettingLocked, false);
await Navigation.PopModalAsync(); await Navigation.PopModalAsync();
} }
else if(result.Status == FingerprintAuthenticationResultStatus.FallbackRequested)
{
MessagingCenter.Send(Application.Current, "Logout", (string)null);
}
} }
} }
} }

View File

@ -9,6 +9,7 @@ using Xamarin.Forms;
using XLabs.Ioc; using XLabs.Ioc;
using Acr.UserDialogs; using Acr.UserDialogs;
using System.Threading.Tasks; using System.Threading.Tasks;
using Plugin.Settings.Abstractions;
namespace Bit.App.Pages namespace Bit.App.Pages
{ {
@ -20,6 +21,7 @@ namespace Bit.App.Pages
private IAppIdService _appIdService; private IAppIdService _appIdService;
private IUserDialogs _userDialogs; private IUserDialogs _userDialogs;
private ISyncService _syncService; private ISyncService _syncService;
private ISettings _settings;
public LoginPage() public LoginPage()
{ {
@ -29,6 +31,7 @@ namespace Bit.App.Pages
_appIdService = Resolver.Resolve<IAppIdService>(); _appIdService = Resolver.Resolve<IAppIdService>();
_userDialogs = Resolver.Resolve<IUserDialogs>(); _userDialogs = Resolver.Resolve<IUserDialogs>();
_syncService = Resolver.Resolve<ISyncService>(); _syncService = Resolver.Resolve<ISyncService>();
_settings = Resolver.Resolve<ISettings>();
Init(); Init();
} }
@ -48,6 +51,12 @@ namespace Bit.App.Pages
entryKeyboard: Keyboard.Email, useLabelAsPlaceholder: true, imageSource: "envelope", entryKeyboard: Keyboard.Email, useLabelAsPlaceholder: true, imageSource: "envelope",
containerPadding: padding); containerPadding: padding);
var lastLoginEmail = _settings.GetValueOrDefault<string>(Constants.SettingLastLoginEmail);
if(!string.IsNullOrWhiteSpace(lastLoginEmail))
{
EmailCell.Entry.Text = lastLoginEmail;
}
PasswordCell.Entry.ReturnType = Enums.ReturnType.Go; PasswordCell.Entry.ReturnType = Enums.ReturnType.Go;
PasswordCell.Entry.Completed += Entry_Completed; PasswordCell.Entry.Completed += Entry_Completed;
@ -110,7 +119,15 @@ namespace Bit.App.Pages
{ {
base.OnAppearing(); base.OnAppearing();
MessagingCenter.Send(Application.Current, "ShowStatusBar", true); MessagingCenter.Send(Application.Current, "ShowStatusBar", true);
EmailCell.Entry.Focus();
if(!string.IsNullOrWhiteSpace(EmailCell.Entry.Text))
{
PasswordCell.Entry.Focus();
}
else
{
EmailCell.Entry.Focus();
}
} }
private async void Entry_Completed(object sender, EventArgs e) private async void Entry_Completed(object sender, EventArgs e)
@ -160,6 +177,7 @@ namespace Bit.App.Pages
_authService.Token = response.Result.Token; _authService.Token = response.Result.Token;
_authService.UserId = response.Result?.Profile?.Id; _authService.UserId = response.Result?.Profile?.Id;
_authService.Email = response.Result?.Profile?.Email; _authService.Email = response.Result?.Profile?.Email;
_settings.AddOrUpdateValue(Constants.SettingLastLoginEmail, _authService.Email);
if(_authService.IsAuthenticatedTwoFactor) if(_authService.IsAuthenticatedTwoFactor)
{ {

View File

@ -316,13 +316,14 @@ namespace Bit.App.Pages
return; return;
} }
if(cell.On) if(cell.On && !_settings.GetValueOrDefault(Constants.SettingPinUnlockOn, false))
{ {
cell.On = false;
var pinPage = new SettingsPinPage(); var pinPage = new SettingsPinPage();
pinPage.OnPinEntered += PinEntered; pinPage.OnPinEntered += PinEntered;
Navigation.PushAsync(pinPage); Navigation.PushAsync(pinPage);
} }
else else if(!cell.On)
{ {
_settings.AddOrUpdateValue(Constants.SettingPinUnlockOn, false); _settings.AddOrUpdateValue(Constants.SettingPinUnlockOn, false);
} }
@ -337,6 +338,7 @@ namespace Bit.App.Pages
_settings.AddOrUpdateValue(Constants.SettingPinUnlockOn, true); _settings.AddOrUpdateValue(Constants.SettingPinUnlockOn, true);
_settings.AddOrUpdateValue(Constants.SettingFingerprintUnlockOn, false); _settings.AddOrUpdateValue(Constants.SettingFingerprintUnlockOn, false);
PinCell.On = true;
FingerprintCell.On = false; FingerprintCell.On = false;
} }

View File

@ -19,7 +19,7 @@ namespace Bit.iOS.Core.Views
MinValue = min, MinValue = min,
MaxValue = max, MaxValue = max,
TintColor = new UIColor(red: 0.24f, green: 0.55f, blue: 0.74f, alpha: 1.0f), TintColor = new UIColor(red: 0.24f, green: 0.55f, blue: 0.74f, alpha: 1.0f),
Frame = new CoreGraphics.CGRect(0, 0, 180, 20) Frame = new CoreGraphics.CGRect(0, 0, 180, 30)
}; };
Slider.ValueChanged += Slider_ValueChanged; Slider.ValueChanged += Slider_ValueChanged;
Value = value; Value = value;