diff --git a/src/App/App.csproj b/src/App/App.csproj index 6b90347b5..2649ac490 100644 --- a/src/App/App.csproj +++ b/src/App/App.csproj @@ -26,8 +26,8 @@ SettingsPage.xaml - - VaultGroupingsPage.xaml + + GroupingsPage.xaml TabsPage.xaml diff --git a/src/App/Pages/VaultGroupingsPage.xaml b/src/App/Pages/GroupingsPage/GroupingsPage.xaml similarity index 86% rename from src/App/Pages/VaultGroupingsPage.xaml rename to src/App/Pages/GroupingsPage/GroupingsPage.xaml index 920b1c166..b80c03b88 100644 --- a/src/App/Pages/VaultGroupingsPage.xaml +++ b/src/App/Pages/GroupingsPage/GroupingsPage.xaml @@ -2,20 +2,20 @@ - + + x:DataType="pages:GroupingsPageListItem"> - (); + Items = new ExtendedObservableCollection(); LoadCommand = new Command(async () => await LoadAsync()); } @@ -22,7 +22,7 @@ namespace Bit.App.Pages get => _loading; set => SetProperty(ref _loading, value); } - public ExtendedObservableCollection Items { get; set; } + public ExtendedObservableCollection Items { get; set; } public Command LoadCommand { get; set; } public Task LoadAsync() @@ -35,41 +35,41 @@ namespace Bit.App.Pages try { - Items.ResetWithRange(new List + Items.ResetWithRange(new List { - new VaultGroupingsPageListItem + new GroupingsPageListItem { Cipher = new CipherView { Name = "Cipher 1" } }, - new VaultGroupingsPageListItem + new GroupingsPageListItem { Cipher = new CipherView { Name = "Cipher 2" } }, - new VaultGroupingsPageListItem + new GroupingsPageListItem { Cipher = new CipherView { Name = "Cipher 3" } }, - new VaultGroupingsPageListItem + new GroupingsPageListItem { Cipher = new CipherView { Name = "Cipher 4" } }, - new VaultGroupingsPageListItem + new GroupingsPageListItem { Folder = new FolderView { Name = "Folder 1" } }, - new VaultGroupingsPageListItem + new GroupingsPageListItem { Folder = new FolderView { Name = "Folder 2" } }, - new VaultGroupingsPageListItem + new GroupingsPageListItem { Folder = new FolderView { Name = "Folder 3" } }, - new VaultGroupingsPageListItem + new GroupingsPageListItem { Collection = new Core.Models.View.CollectionView { Name = "Collection 1" } }, - new VaultGroupingsPageListItem + new GroupingsPageListItem { Collection = new Core.Models.View.CollectionView { Name = "Collection 2" } }, @@ -83,11 +83,4 @@ namespace Bit.App.Pages return Task.FromResult(0); } } - - public class VaultGroupingsPageListItem - { - public FolderView Folder { get; set; } - public Core.Models.View.CollectionView Collection { get; set; } - public CipherView Cipher { get; set; } - } } diff --git a/src/App/Pages/TabsPage.xaml b/src/App/Pages/TabsPage.xaml index 9bbd0f342..4b8e9e804 100644 --- a/src/App/Pages/TabsPage.xaml +++ b/src/App/Pages/TabsPage.xaml @@ -13,7 +13,7 @@ - + diff --git a/src/App/Pages/VaultGroupingsPage.xaml.cs b/src/App/Pages/VaultGroupingsPage.xaml.cs deleted file mode 100644 index 21fb30400..000000000 --- a/src/App/Pages/VaultGroupingsPage.xaml.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Xamarin.Forms; -using Xamarin.Forms.Xaml; - -namespace Bit.App.Pages -{ - public partial class VaultGroupingsPage : ContentPage - { - private VaultGroupingsPageViewModel _viewModel; - - public VaultGroupingsPage() - { - InitializeComponent(); - _viewModel = BindingContext as VaultGroupingsPageViewModel; - } - - protected async override void OnAppearing() - { - base.OnAppearing(); - await _viewModel.LoadAsync(); - } - } - - public class ListItemDataTemplateSelector : DataTemplateSelector - { - public DataTemplate CipherTemplate { get; set; } - public DataTemplate FolderTemplate { get; set; } - public DataTemplate CollectionTemplate { get; set; } - - protected override DataTemplate OnSelectTemplate(object item, BindableObject container) - { - if(item is VaultGroupingsPageListItem listItem) - { - if(listItem.Collection != null) - { - return CollectionTemplate; - } - else if(listItem.Folder != null) - { - return FolderTemplate; - } - return CipherTemplate; - } - return null; - } - } -}