From c3f91761f6e959474799037aca3ef896d414c942 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 5 Jun 2019 00:29:49 -0400 Subject: [PATCH] HasCiphers and HasFolders props --- src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs | 2 +- src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs index c55ad6c05..34b9edbea 100644 --- a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs +++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs @@ -94,7 +94,7 @@ namespace Bit.App.Pages } // Forced sync if for some reason we have no data after a v1 migration if(_vm.MainPage && !_syncService.SyncInProgress && migratedFromV1.GetValueOrDefault() && - (!_vm.Ciphers?.Any() ?? true) && (!_vm.Folders?.Any() ?? true) && + !_vm.HasCiphers && !_vm.HasFolders && Xamarin.Essentials.Connectivity.NetworkAccess != Xamarin.Essentials.NetworkAccess.None) { var triedV1ReSync = await _storageService.GetAsync(Constants.TriedV1Resync); diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs b/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs index a5572a777..a1cc911c8 100644 --- a/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs +++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs @@ -68,6 +68,8 @@ namespace Bit.App.Pages public string CollectionId { get; set; } public Func Filter { get; set; } + public bool HasCiphers { get; set; } + public bool HasFolders { get; set; } public List Ciphers { get; set; } public List FavoriteCiphers { get; set; } public List NoFolderCiphers { get; set; } @@ -292,11 +294,13 @@ namespace Bit.App.Pages { NoDataText = AppResources.NoItems; _allCiphers = await _cipherService.GetAllDecryptedAsync(); + HasCiphers = _allCiphers.Any(); FavoriteCiphers?.Clear(); NoFolderCiphers?.Clear(); _folderCounts.Clear(); _collectionCounts.Clear(); _typeCounts.Clear(); + HasFolders = false; Filter = null; if(MainPage) @@ -305,6 +309,7 @@ namespace Bit.App.Pages { Folders = await _folderService.GetAllDecryptedAsync(); NestedFolders = await _folderService.GetAllNestedAsync(); + HasFolders = Folders.Any(); } if(ShowCollections) {