1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-30 15:13:24 +00:00

re-use groupings page for ciphers listing

This commit is contained in:
Kyle Spearrin
2019-04-24 16:50:34 -04:00
parent 3d50133fa8
commit 003092a55b
9 changed files with 190 additions and 179 deletions

View File

@@ -1,4 +1,5 @@
using Bit.Core.Abstractions;
using Bit.Core.Enums;
using Bit.Core.Utilities;
using System;
using System.Collections.Generic;
@@ -17,12 +18,25 @@ namespace Bit.App.Pages
private readonly GroupingsPageViewModel _viewModel;
public GroupingsPage()
: this(true)
{ }
public GroupingsPage(bool mainPage, CipherType? type = null, string folderId = null,
string collectionId = null, string pageTitle = null)
{
InitializeComponent();
_broadcasterService = ServiceContainer.Resolve<IBroadcasterService>("broadcasterService");
_syncService = ServiceContainer.Resolve<ISyncService>("syncService");
_viewModel = BindingContext as GroupingsPageViewModel;
_viewModel.Page = this;
_viewModel.MainPage = mainPage;
_viewModel.Type = type;
_viewModel.FolderId = folderId;
_viewModel.CollectionId = collectionId;
if(pageTitle != null)
{
_viewModel.PageTitle = pageTitle;
}
}
protected async override void OnAppearing()
@@ -68,9 +82,13 @@ namespace Bit.App.Pages
{
await _viewModel.SelectCipherAsync(item.Cipher);
}
else if(item.Folder != null || item.Collection != null)
else if(item.Folder != null)
{
// TODO
await _viewModel.SelectFolderAsync(item.Folder);
}
else if(item.Collection != null)
{
await _viewModel.SelectCollectionAsync(item.Collection);
}
}
}