1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-05 23:53:33 +00:00

populate add page from autofill

This commit is contained in:
Kyle Spearrin
2019-05-17 15:24:15 -04:00
parent 65f3a146fa
commit 9ab41c5de6
4 changed files with 52 additions and 17 deletions

View File

@@ -9,15 +9,21 @@ namespace Bit.App.Pages
{
private AddEditPageViewModel _vm;
private readonly AppOptions _appOptions;
private bool _fromAutofill;
public AddEditPage(
string cipherId = null,
CipherType? type = null,
string folderId = null,
string collectionId = null,
string name = null,
string uri = null,
bool fromAutofill = false,
AppOptions appOptions = null)
{
_appOptions = appOptions;
_fromAutofill = fromAutofill;
FromAutofillFramework = _appOptions?.FromAutofillFramework ?? false;
InitializeComponent();
_vm = BindingContext as AddEditPageViewModel;
_vm.Page = this;
@@ -25,6 +31,8 @@ namespace Bit.App.Pages
_vm.FolderId = folderId;
_vm.CollectionIds = collectionId != null ? new HashSet<string>(new List<string> { collectionId }) : null;
_vm.Type = type;
_vm.DefaultName = name ?? appOptions?.SaveName;
_vm.DefaultUri = uri ?? appOptions?.Uri;
_vm.Init();
SetActivityIndicator();
if(!_vm.EditMode)
@@ -41,6 +49,8 @@ namespace Bit.App.Pages
_ownershipPicker.ItemDisplayBinding = new Binding("Key");
}
public bool FromAutofillFramework { get; set; }
protected override async void OnAppearing()
{
base.OnAppearing();
@@ -77,6 +87,16 @@ namespace Bit.App.Pages
base.OnDisappearing();
}
protected override bool OnBackButtonPressed()
{
if(FromAutofillFramework)
{
Application.Current.MainPage = new TabsPage();
return true;
}
return base.OnBackButtonPressed();
}
private async void PasswordHistory_Tapped(object sender, System.EventArgs e)
{
if(DoOnce())