1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-25 12:05:59 +01:00

[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()) 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)); await Navigation.PushModalAsync(new NavigationPage(page));
} }
} }

View File

@ -2,6 +2,7 @@
using System.Linq; using System.Linq;
using Bit.App.Controls; using Bit.App.Controls;
using Bit.App.Resources; using Bit.App.Resources;
using Bit.Core.Enums;
using Bit.Core.Models.View; using Bit.Core.Models.View;
using Xamarin.Forms; using Xamarin.Forms;
@ -12,15 +13,22 @@ namespace Bit.App.Pages
private SendsPageViewModel _vm; private SendsPageViewModel _vm;
private bool _hasFocused; private bool _hasFocused;
public SendsPage(Func<SendView, bool> filter, bool type = false) public SendsPage(Func<SendView, bool> filter, SendType? type = null)
{ {
InitializeComponent(); InitializeComponent();
_vm = BindingContext as SendsPageViewModel; _vm = BindingContext as SendsPageViewModel;
_vm.Page = this; _vm.Page = this;
_vm.Filter = filter; _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 else
{ {
@ -33,6 +41,7 @@ namespace Bit.App.Pages
_searchBar.Placeholder = AppResources.Search; _searchBar.Placeholder = AppResources.Search;
_mainLayout.Children.Insert(0, _searchBar); _mainLayout.Children.Insert(0, _searchBar);
_mainLayout.Children.Insert(1, _separator); _mainLayout.Children.Insert(1, _separator);
ShowModalAnimationDelay = 0;
} }
else else
{ {

View File

@ -17,8 +17,7 @@ namespace Bit.App.Pages
private CiphersPageViewModel _vm; private CiphersPageViewModel _vm;
private bool _hasFocused; private bool _hasFocused;
public CiphersPage(Func<CipherView, bool> filter, bool folder = false, bool collection = false, public CiphersPage(Func<CipherView, bool> filter, string pageTitle = null, string autofillUrl = null, bool deleted = false)
bool type = false, string autofillUrl = null, bool deleted = false)
{ {
InitializeComponent(); InitializeComponent();
_vm = BindingContext as CiphersPageViewModel; _vm = BindingContext as CiphersPageViewModel;
@ -26,21 +25,9 @@ namespace Bit.App.Pages
_vm.Filter = filter; _vm.Filter = filter;
_vm.AutofillUrl = _autofillUrl = autofillUrl; _vm.AutofillUrl = _autofillUrl = autofillUrl;
_vm.Deleted = deleted; _vm.Deleted = deleted;
if (deleted) if (pageTitle != null)
{ {
_vm.PageTitle = AppResources.SearchTrash; _vm.PageTitle = string.Format(AppResources.SearchGroup, pageTitle);
}
else if (folder)
{
_vm.PageTitle = AppResources.SearchFolder;
}
else if (collection)
{
_vm.PageTitle = AppResources.SearchCollection;
}
else if (type)
{
_vm.PageTitle = AppResources.SearchType;
} }
else else
{ {
@ -53,6 +40,7 @@ namespace Bit.App.Pages
_searchBar.Placeholder = AppResources.Search; _searchBar.Placeholder = AppResources.Search;
_mainLayout.Children.Insert(0, _searchBar); _mainLayout.Children.Insert(0, _searchBar);
_mainLayout.Children.Insert(1, _separator); _mainLayout.Children.Insert(1, _separator);
ShowModalAnimationDelay = 0;
} }
else else
{ {

View File

@ -225,8 +225,7 @@ namespace Bit.App.Pages
await _accountListOverlay.HideAsync(); await _accountListOverlay.HideAsync();
if (DoOnce()) if (DoOnce())
{ {
var page = new CiphersPage(_vm.Filter, _vm.FolderId != null, _vm.CollectionId != null, var page = new CiphersPage(_vm.Filter, _vm.MainPage ? null : _vm.PageTitle, deleted: _vm.Deleted);
_vm.Type != null, deleted: _vm.Deleted);
await Navigation.PushModalAsync(new NavigationPage(page)); 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 { get {
return ResourceManager.GetString("SearchFolder", resourceCulture); return ResourceManager.GetString("SearchFileSends", resourceCulture);
} }
} }
public static string SearchType { public static string SearchTextSends {
get { 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> <value>Re-type Master Password</value>
</data> </data>
<data name="SearchVault" xml:space="preserve"> <data name="SearchVault" xml:space="preserve">
<value>Search vault</value> <value>Search Vault</value>
</data> </data>
<data name="Security" xml:space="preserve"> <data name="Security" xml:space="preserve">
<value>Security</value> <value>Security</value>
@ -1372,11 +1372,15 @@
<data name="SearchCollection" xml:space="preserve"> <data name="SearchCollection" xml:space="preserve">
<value>Search collection</value> <value>Search collection</value>
</data> </data>
<data name="SearchFolder" xml:space="preserve"> <data name="SearchFileSends" xml:space="preserve">
<value>Search folder</value> <value>Search File Sends</value>
</data> </data>
<data name="SearchType" xml:space="preserve"> <data name="SearchTextSends" xml:space="preserve">
<value>Search type</value> <value>Search Text Sends</value>
</data>
<data name="SearchGroup" xml:space="preserve">
<value>Search {0}</value>
<comment>ex: Search Logins</comment>
</data> </data>
<data name="Type" xml:space="preserve"> <data name="Type" xml:space="preserve">
<value>Type</value> <value>Type</value>