From 14d4b2ee297362da5dc082248a099dd70e4d5e26 Mon Sep 17 00:00:00 2001 From: Jake Fink Date: Sun, 10 Apr 2022 13:00:52 -0400 Subject: [PATCH] [BEEEP] add context to search titles (#1878) * add more descriptive titles to search pages * add App Resources --- .../SendGroupingsPage.xaml.cs | 2 +- src/App/Pages/Send/SendsPage.xaml.cs | 15 +++++++++++--- src/App/Pages/Vault/CiphersPage.xaml.cs | 20 ++++--------------- .../Vault/GroupingsPage/GroupingsPage.xaml.cs | 3 +-- src/App/Resources/AppResources.Designer.cs | 14 +++++++++---- src/App/Resources/AppResources.resx | 14 ++++++++----- 6 files changed, 37 insertions(+), 31 deletions(-) diff --git a/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPage.xaml.cs b/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPage.xaml.cs index d15c5e21c..7bdf38b7a 100644 --- a/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPage.xaml.cs +++ b/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPage.xaml.cs @@ -160,7 +160,7 @@ namespace Bit.App.Pages { if (DoOnce()) { - var page = new SendsPage(_vm.Filter, _vm.Type != null); + var page = new SendsPage(_vm.Filter, _vm.Type); await Navigation.PushModalAsync(new NavigationPage(page)); } } diff --git a/src/App/Pages/Send/SendsPage.xaml.cs b/src/App/Pages/Send/SendsPage.xaml.cs index ffffdfd6a..73d2fb3ec 100644 --- a/src/App/Pages/Send/SendsPage.xaml.cs +++ b/src/App/Pages/Send/SendsPage.xaml.cs @@ -2,6 +2,7 @@ using System.Linq; using Bit.App.Controls; using Bit.App.Resources; +using Bit.Core.Enums; using Bit.Core.Models.View; using Xamarin.Forms; @@ -12,15 +13,22 @@ namespace Bit.App.Pages private SendsPageViewModel _vm; private bool _hasFocused; - public SendsPage(Func filter, bool type = false) + public SendsPage(Func filter, SendType? type = null) { InitializeComponent(); _vm = BindingContext as SendsPageViewModel; _vm.Page = this; _vm.Filter = filter; - if (type) + if (type != null) { - _vm.PageTitle = AppResources.SearchType; + if (type == SendType.File) + { + _vm.PageTitle = AppResources.SearchFileSends; + } + else if (type == SendType.Text) + { + _vm.PageTitle = AppResources.SearchTextSends; + } } else { @@ -33,6 +41,7 @@ namespace Bit.App.Pages _searchBar.Placeholder = AppResources.Search; _mainLayout.Children.Insert(0, _searchBar); _mainLayout.Children.Insert(1, _separator); + ShowModalAnimationDelay = 0; } else { diff --git a/src/App/Pages/Vault/CiphersPage.xaml.cs b/src/App/Pages/Vault/CiphersPage.xaml.cs index c29ad69ea..c730eb5ea 100644 --- a/src/App/Pages/Vault/CiphersPage.xaml.cs +++ b/src/App/Pages/Vault/CiphersPage.xaml.cs @@ -17,8 +17,7 @@ namespace Bit.App.Pages private CiphersPageViewModel _vm; private bool _hasFocused; - public CiphersPage(Func filter, bool folder = false, bool collection = false, - bool type = false, string autofillUrl = null, bool deleted = false) + public CiphersPage(Func filter, string pageTitle = null, string autofillUrl = null, bool deleted = false) { InitializeComponent(); _vm = BindingContext as CiphersPageViewModel; @@ -26,21 +25,9 @@ namespace Bit.App.Pages _vm.Filter = filter; _vm.AutofillUrl = _autofillUrl = autofillUrl; _vm.Deleted = deleted; - if (deleted) + if (pageTitle != null) { - _vm.PageTitle = AppResources.SearchTrash; - } - else if (folder) - { - _vm.PageTitle = AppResources.SearchFolder; - } - else if (collection) - { - _vm.PageTitle = AppResources.SearchCollection; - } - else if (type) - { - _vm.PageTitle = AppResources.SearchType; + _vm.PageTitle = string.Format(AppResources.SearchGroup, pageTitle); } else { @@ -53,6 +40,7 @@ namespace Bit.App.Pages _searchBar.Placeholder = AppResources.Search; _mainLayout.Children.Insert(0, _searchBar); _mainLayout.Children.Insert(1, _separator); + ShowModalAnimationDelay = 0; } else { diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs index 7c806a82e..395dd8cf2 100644 --- a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs +++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs @@ -225,8 +225,7 @@ namespace Bit.App.Pages await _accountListOverlay.HideAsync(); if (DoOnce()) { - var page = new CiphersPage(_vm.Filter, _vm.FolderId != null, _vm.CollectionId != null, - _vm.Type != null, deleted: _vm.Deleted); + var page = new CiphersPage(_vm.Filter, _vm.MainPage ? null : _vm.PageTitle, deleted: _vm.Deleted); await Navigation.PushModalAsync(new NavigationPage(page)); } } diff --git a/src/App/Resources/AppResources.Designer.cs b/src/App/Resources/AppResources.Designer.cs index dbcd33416..def2096b2 100644 --- a/src/App/Resources/AppResources.Designer.cs +++ b/src/App/Resources/AppResources.Designer.cs @@ -2387,15 +2387,21 @@ namespace Bit.App.Resources { } } - public static string SearchFolder { + public static string SearchFileSends { get { - return ResourceManager.GetString("SearchFolder", resourceCulture); + return ResourceManager.GetString("SearchFileSends", resourceCulture); } } - public static string SearchType { + public static string SearchTextSends { get { - return ResourceManager.GetString("SearchType", resourceCulture); + return ResourceManager.GetString("SearchTextSends", resourceCulture); + } + } + + public static string SearchGroup { + get { + return ResourceManager.GetString("SearchGroup", resourceCulture); } } diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx index bd7f76cee..cda5cb54b 100644 --- a/src/App/Resources/AppResources.resx +++ b/src/App/Resources/AppResources.resx @@ -659,7 +659,7 @@ Re-type Master Password - Search vault + Search Vault Security @@ -1372,11 +1372,15 @@ Search collection - - Search folder + + Search File Sends - - Search type + + Search Text Sends + + + Search {0} + ex: Search Logins Type