[BEEEP] add context to search titles (#1878)

* add more descriptive titles to search pages

* add App Resources
This commit is contained in:
Jake Fink 2022-04-10 13:00:52 -04:00 committed by GitHub
parent b6ad3527db
commit 14d4b2ee29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 37 additions and 31 deletions

View File

@ -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));
}
}

View File

@ -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<SendView, bool> filter, bool type = false)
public SendsPage(Func<SendView, bool> 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
{

View File

@ -17,8 +17,7 @@ namespace Bit.App.Pages
private CiphersPageViewModel _vm;
private bool _hasFocused;
public CiphersPage(Func<CipherView, bool> filter, bool folder = false, bool collection = false,
bool type = false, string autofillUrl = null, bool deleted = false)
public CiphersPage(Func<CipherView, bool> 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
{

View File

@ -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));
}
}

View File

@ -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);
}
}

View File

@ -659,7 +659,7 @@
<value>Re-type Master Password</value>
</data>
<data name="SearchVault" xml:space="preserve">
<value>Search vault</value>
<value>Search Vault</value>
</data>
<data name="Security" xml:space="preserve">
<value>Security</value>
@ -1372,11 +1372,15 @@
<data name="SearchCollection" xml:space="preserve">
<value>Search collection</value>
</data>
<data name="SearchFolder" xml:space="preserve">
<value>Search folder</value>
<data name="SearchFileSends" xml:space="preserve">
<value>Search File Sends</value>
</data>
<data name="SearchType" xml:space="preserve">
<value>Search type</value>
<data name="SearchTextSends" xml:space="preserve">
<value>Search Text Sends</value>
</data>
<data name="SearchGroup" xml:space="preserve">
<value>Search {0}</value>
<comment>ex: Search Logins</comment>
</data>
<data name="Type" xml:space="preserve">
<value>Type</value>