diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj index 86051dfda..63c1aa3fd 100644 --- a/src/Android/Android.csproj +++ b/src/Android/Android.csproj @@ -99,6 +99,7 @@ + diff --git a/src/Android/Assets/MaterialIcons_Regular.ttf b/src/Android/Assets/MaterialIcons_Regular.ttf new file mode 100644 index 000000000..7015564ad Binary files /dev/null and b/src/Android/Assets/MaterialIcons_Regular.ttf differ diff --git a/src/App/App.csproj b/src/App/App.csproj index 71b8f9f32..a51e1f1d4 100644 --- a/src/App/App.csproj +++ b/src/App/App.csproj @@ -37,6 +37,9 @@ GeneratorPage.xaml + + CiphersPage.xaml + PasswordHistoryPage.xaml diff --git a/src/App/Controls/CipherViewCell/CipherViewCell.xaml b/src/App/Controls/CipherViewCell/CipherViewCell.xaml index 638fc9545..6c3e46283 100644 --- a/src/App/Controls/CipherViewCell/CipherViewCell.xaml +++ b/src/App/Controls/CipherViewCell/CipherViewCell.xaml @@ -58,25 +58,28 @@ StyleClass="list-subtitle, list-subtitle-platform" Text="{Binding Cipher.SubTitle, Mode=OneWay}" /> - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/App/Pages/Vault/CiphersPage.xaml.cs b/src/App/Pages/Vault/CiphersPage.xaml.cs new file mode 100644 index 000000000..2c01b0448 --- /dev/null +++ b/src/App/Pages/Vault/CiphersPage.xaml.cs @@ -0,0 +1,25 @@ +using System; + +namespace Bit.App.Pages +{ + public partial class CiphersPage : BaseContentPage + { + private CiphersPageViewModel _vm; + + public CiphersPage() + { + InitializeComponent(); + SetActivityIndicator(); + _vm = BindingContext as CiphersPageViewModel; + _vm.Page = this; + } + + protected override async void OnAppearing() + { + base.OnAppearing(); + await LoadOnAppearedAsync(_mainLayout, true, async () => { + await _vm.LoadAsync(); + }); + } + } +} diff --git a/src/App/Pages/Vault/CiphersPageViewModel.cs b/src/App/Pages/Vault/CiphersPageViewModel.cs new file mode 100644 index 000000000..a302e5180 --- /dev/null +++ b/src/App/Pages/Vault/CiphersPageViewModel.cs @@ -0,0 +1,67 @@ +using Bit.App.Resources; +using Bit.Core.Abstractions; +using Bit.Core.Models.View; +using Bit.Core.Utilities; +using System.Threading.Tasks; +using Xamarin.Forms; + +namespace Bit.App.Pages +{ + public class CiphersPageViewModel : BaseViewModel + { + private readonly IPlatformUtilsService _platformUtilsService; + private readonly ICipherService _cipherService; + + private string _searchText; + private string _noDataText; + private bool _showNoData; + + public CiphersPageViewModel() + { + _platformUtilsService = ServiceContainer.Resolve("platformUtilsService"); + _cipherService = ServiceContainer.Resolve("cipherService"); + + PageTitle = AppResources.SearchVault; + Ciphers = new ExtendedObservableCollection(); + CipherOptionsCommand = new Command(CipherOptionsAsync); + } + + public Command CipherOptionsCommand { get; set; } + public ExtendedObservableCollection Ciphers { get; set; } + + public string SearchText + { + get => _searchText; + set => SetProperty(ref _searchText, value); + } + + public string NoDataText + { + get => _noDataText; + set => SetProperty(ref _noDataText, value); + } + + public bool ShowNoData + { + get => _showNoData; + set => SetProperty(ref _showNoData, value); + } + + public async Task LoadAsync() + { + var ciphers = await _cipherService.GetAllDecryptedAsync(); + Ciphers.ResetWithRange(ciphers); + ShowNoData = Ciphers.Count == 0; + } + + private async void CipherOptionsAsync(CipherView cipher) + { + var option = await Page.DisplayActionSheet(cipher.Name, AppResources.Cancel, null, "1", "2"); + if(option == AppResources.Cancel) + { + return; + } + // TODO: process options + } + } +} diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml index 80107a19c..26058318a 100644 --- a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml +++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml @@ -13,6 +13,10 @@ + + + + + IsVisible="{Binding ShowNoData}">