1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-17 16:53:26 +00:00

[Autofill] Apply locked autofill flow to logged out state (#827)

* Initial commit: apply locked auto-fill flow to log out auto-fill

* Alphabetized imports

* Removed unnecessary else conditional

* Fix for talkback slider control (#828)

* Initial commit: apply locked auto-fill flow to log out auto-fill

* Alphabetized imports

* Removed unnecessary else conditional

* Fixed variable init order

Co-authored-by: Matt Portune <59324545+mportune-bw@users.noreply.github.com>
This commit is contained in:
Vincent Salucci
2020-04-13 11:32:23 -05:00
committed by GitHub
parent b2abcda111
commit 1dc027cf49
7 changed files with 88 additions and 13 deletions

View File

@@ -1,4 +1,6 @@
using Bit.App.Controls;
using Bit.App.Models;
using Bit.Core;
using Bit.Core.Abstractions;
using Bit.Core.Utilities;
using System;
@@ -11,18 +13,23 @@ namespace Bit.App.Pages
{
private readonly IBroadcasterService _broadcasterService;
private readonly IMessagingService _messagingService;
private readonly IStorageService _storageService;
private readonly AppOptions _appOptions;
private TwoFactorPageViewModel _vm;
private bool _inited;
public TwoFactorPage()
public TwoFactorPage(AppOptions appOptions = null)
{
InitializeComponent();
SetActivityIndicator();
_appOptions = appOptions;
_storageService = ServiceContainer.Resolve<IStorageService>("storageService");
_broadcasterService = ServiceContainer.Resolve<IBroadcasterService>("broadcasterService");
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
_vm = BindingContext as TwoFactorPageViewModel;
_vm.Page = this;
_vm.TwoFactorAction = () => Device.BeginInvokeOnMainThread(async () => await TwoFactorAuthAsync());
DuoWebView = _duoWebView;
if (Device.RuntimePlatform == Device.Android)
{
@@ -151,5 +158,28 @@ namespace Bit.App.Pages
}
}
}
private async Task TwoFactorAuthAsync()
{
if (_appOptions != null)
{
if (_appOptions.FromAutofillFramework && _appOptions.SaveType.HasValue)
{
Application.Current.MainPage = new NavigationPage(new AddEditPage(appOptions: _appOptions));
return;
}
if (_appOptions.Uri != null)
{
Application.Current.MainPage = new NavigationPage(new AutofillCiphersPage(_appOptions));
return;
}
}
var previousPage = await _storageService.GetAsync<PreviousPageInfo>(Constants.PreviousPageKey);
if (previousPage != null)
{
await _storageService.RemoveAsync(Constants.PreviousPageKey);
}
Application.Current.MainPage = new TabsPage(_appOptions, previousPage);
}
}
}