diff --git a/src/App/Pages/Vault/AutofillCiphersPageViewModel.cs b/src/App/Pages/Vault/AutofillCiphersPageViewModel.cs index 7a8e93292..bf7b46afe 100644 --- a/src/App/Pages/Vault/AutofillCiphersPageViewModel.cs +++ b/src/App/Pages/Vault/AutofillCiphersPageViewModel.cs @@ -82,17 +82,19 @@ namespace Bit.App.Pages var groupedItems = new List(); var ciphers = await _cipherService.GetAllDecryptedByUrlAsync(Uri, null); var matching = ciphers.Item1?.Select(c => new GroupingsPageListItem { Cipher = c }).ToList(); + var hasMatching = matching?.Any() ?? false; if(matching?.Any() ?? false) { groupedItems.Add( - new GroupingsPageListGroup(matching, AppResources.MatchingItems, matching.Count, false)); + new GroupingsPageListGroup(matching, AppResources.MatchingItems, matching.Count, false, true)); } var fuzzy = ciphers.Item2?.Select(c => new GroupingsPageListItem { Cipher = c, FuzzyAutofill = true }).ToList(); if(fuzzy?.Any() ?? false) { groupedItems.Add( - new GroupingsPageListGroup(fuzzy, AppResources.PossibleMatchingItems, fuzzy.Count, false)); + new GroupingsPageListGroup(fuzzy, AppResources.PossibleMatchingItems, fuzzy.Count, false, + !hasMatching)); } GroupedItems.ResetWithRange(groupedItems); ShowList = groupedItems.Any(); diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml index 77c4b19b5..514fd8168 100644 --- a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml +++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml @@ -20,6 +20,8 @@ + + - - diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPageListGroup.cs b/src/App/Pages/Vault/GroupingsPage/GroupingsPageListGroup.cs index b216b6d0a..23d5c949e 100644 --- a/src/App/Pages/Vault/GroupingsPage/GroupingsPageListGroup.cs +++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPageListGroup.cs @@ -4,12 +4,12 @@ namespace Bit.App.Pages { public class GroupingsPageListGroup : List { - public GroupingsPageListGroup(string name, int count, bool doUpper = true) - : this(new List(), name, count, doUpper) + public GroupingsPageListGroup(string name, int count, bool doUpper = true, bool first = false) + : this(new List(), name, count, doUpper, first) { } public GroupingsPageListGroup(List groupItems, string name, int count, - bool doUpper = true) + bool doUpper = true, bool first = false) { AddRange(groupItems); if(string.IsNullOrWhiteSpace(name)) @@ -25,8 +25,10 @@ namespace Bit.App.Pages Name = name; } ItemCount = count.ToString("N0"); + First = first; } + public bool First { get; set; } public string Name { get; set; } public string NameShort => string.IsNullOrWhiteSpace(Name) || Name.Length == 0 ? "-" : Name[0].ToString(); public string ItemCount { get; set; } diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs b/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs index 52b1bc4ae..47c21f297 100644 --- a/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs +++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs @@ -150,15 +150,16 @@ namespace Bit.App.Pages _collectionCounts[c.Node.Id] : 0).ToString("N0") }).ToList(); + var hasFavorites = favListItems?.Any() ?? false; if(favListItems?.Any() ?? false) { groupedItems.Add(new GroupingsPageListGroup(favListItems, AppResources.Favorites, - favListItems.Count, Device.RuntimePlatform == Device.iOS)); + favListItems.Count, Device.RuntimePlatform == Device.iOS, true)); } if(MainPage) { groupedItems.Add(new GroupingsPageListGroup( - AppResources.Types, 4, Device.RuntimePlatform == Device.iOS) + AppResources.Types, 4, Device.RuntimePlatform == Device.iOS, !hasFavorites) { new GroupingsPageListItem { @@ -189,17 +190,18 @@ namespace Bit.App.Pages if(folderListItems?.Any() ?? false) { groupedItems.Add(new GroupingsPageListGroup(folderListItems, AppResources.Folders, - folderListItems.Count, Device.RuntimePlatform == Device.iOS)); + folderListItems.Count, Device.RuntimePlatform == Device.iOS, !MainPage)); } if(collectionListItems?.Any() ?? false) { groupedItems.Add(new GroupingsPageListGroup(collectionListItems, AppResources.Collections, - collectionListItems.Count, Device.RuntimePlatform == Device.iOS)); + collectionListItems.Count, Device.RuntimePlatform == Device.iOS, !MainPage)); } if(ciphersListItems?.Any() ?? false) { groupedItems.Add(new GroupingsPageListGroup(ciphersListItems, AppResources.Items, - ciphersListItems.Count, Device.RuntimePlatform == Device.iOS)); + ciphersListItems.Count, Device.RuntimePlatform == Device.iOS, + !MainPage && !groupedItems.Any())); } GroupedItems.ResetWithRange(groupedItems); }