lock page work with autofill

This commit is contained in:
Kyle Spearrin 2019-05-17 16:36:29 -04:00
parent 3c58775ae2
commit 29951207ec
3 changed files with 27 additions and 5 deletions

View file

@ -174,7 +174,7 @@ namespace Bit.App
{
if(await _lockService.IsLockedAsync())
{
Current.MainPage = new NavigationPage(new LockPage());
Current.MainPage = new NavigationPage(new LockPage(_appOptions));
}
else if(_appOptions.FromAutofillFramework && _appOptions.SaveType.HasValue)
{

View file

@ -1,4 +1,5 @@
using System;
using Bit.App.Models;
using System;
using System.Threading.Tasks;
using Xamarin.Forms;
@ -6,13 +7,32 @@ namespace Bit.App.Pages
{
public partial class LockPage : BaseContentPage
{
private LockPageViewModel _vm;
private readonly AppOptions _appOptions;
private readonly LockPageViewModel _vm;
public LockPage()
public LockPage(AppOptions appOptions = null)
{
_appOptions = appOptions;
InitializeComponent();
_vm = BindingContext as LockPageViewModel;
_vm.Page = this;
_vm.UnlockedAction = () =>
{
if(_appOptions != null)
{
if(_appOptions.FromAutofillFramework && _appOptions.SaveType.HasValue)
{
Application.Current.MainPage = new NavigationPage(new AddEditPage(appOptions: _appOptions));
return;
}
else if(_appOptions.Uri != null)
{
Application.Current.MainPage = new NavigationPage(new AutofillCiphersPage(_appOptions));
return;
}
}
Application.Current.MainPage = new TabsPage();
};
MasterPasswordEntry = _masterPassword;
PinEntry = _pin;
}

View file

@ -1,4 +1,5 @@
using Bit.App.Abstractions;
using Bit.App.Models;
using Bit.App.Resources;
using Bit.Core;
using Bit.Core.Abstractions;
@ -90,6 +91,7 @@ namespace Bit.App.Pages
public string ShowPasswordIcon => ShowPassword ? "" : "";
public string MasterPassword { get; set; }
public string Pin { get; set; }
public Action UnlockedAction { get; set; }
public async Task InitAsync()
{
@ -251,7 +253,7 @@ namespace Bit.App.Pages
private void DoContinue()
{
_messagingService.Send("unlocked");
Application.Current.MainPage = new TabsPage();
UnlockedAction?.Invoke();
}
}
}