HasCiphers and HasFolders props

This commit is contained in:
Kyle Spearrin 2019-06-05 00:29:49 -04:00
parent a239ee80bc
commit c3f91761f6
2 changed files with 6 additions and 1 deletions

View file

@ -94,7 +94,7 @@ namespace Bit.App.Pages
} }
// Forced sync if for some reason we have no data after a v1 migration // Forced sync if for some reason we have no data after a v1 migration
if(_vm.MainPage && !_syncService.SyncInProgress && migratedFromV1.GetValueOrDefault() && 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) Xamarin.Essentials.Connectivity.NetworkAccess != Xamarin.Essentials.NetworkAccess.None)
{ {
var triedV1ReSync = await _storageService.GetAsync<bool?>(Constants.TriedV1Resync); var triedV1ReSync = await _storageService.GetAsync<bool?>(Constants.TriedV1Resync);

View file

@ -68,6 +68,8 @@ namespace Bit.App.Pages
public string CollectionId { get; set; } public string CollectionId { get; set; }
public Func<CipherView, bool> Filter { get; set; } public Func<CipherView, bool> Filter { get; set; }
public bool HasCiphers { get; set; }
public bool HasFolders { get; set; }
public List<CipherView> Ciphers { get; set; } public List<CipherView> Ciphers { get; set; }
public List<CipherView> FavoriteCiphers { get; set; } public List<CipherView> FavoriteCiphers { get; set; }
public List<CipherView> NoFolderCiphers { get; set; } public List<CipherView> NoFolderCiphers { get; set; }
@ -292,11 +294,13 @@ namespace Bit.App.Pages
{ {
NoDataText = AppResources.NoItems; NoDataText = AppResources.NoItems;
_allCiphers = await _cipherService.GetAllDecryptedAsync(); _allCiphers = await _cipherService.GetAllDecryptedAsync();
HasCiphers = _allCiphers.Any();
FavoriteCiphers?.Clear(); FavoriteCiphers?.Clear();
NoFolderCiphers?.Clear(); NoFolderCiphers?.Clear();
_folderCounts.Clear(); _folderCounts.Clear();
_collectionCounts.Clear(); _collectionCounts.Clear();
_typeCounts.Clear(); _typeCounts.Clear();
HasFolders = false;
Filter = null; Filter = null;
if(MainPage) if(MainPage)
@ -305,6 +309,7 @@ namespace Bit.App.Pages
{ {
Folders = await _folderService.GetAllDecryptedAsync(); Folders = await _folderService.GetAllDecryptedAsync();
NestedFolders = await _folderService.GetAllNestedAsync(); NestedFolders = await _folderService.GetAllNestedAsync();
HasFolders = Folders.Any();
} }
if(ShowCollections) if(ShowCollections)
{ {