mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 02:18:27 +03:00
null and length check on name when sorting
This commit is contained in:
parent
8b6d2d2b83
commit
8cd3a21468
2 changed files with 8 additions and 5 deletions
|
@ -23,7 +23,7 @@ namespace Bit.App.Models.Page
|
||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(Name) || Name.Length == 0)
|
if(string.IsNullOrWhiteSpace(Name) || Name.Length == 0)
|
||||||
{
|
{
|
||||||
NameGroup = AppResources.Other;
|
NameGroup = "-";
|
||||||
}
|
}
|
||||||
else if(Char.IsLetter(Name[0]))
|
else if(Char.IsLetter(Name[0]))
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ namespace Bit.App.Models.Page
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NameGroup = AppResources.Other;
|
NameGroup = "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(cipher.Type)
|
switch(cipher.Type)
|
||||||
|
|
|
@ -341,9 +341,12 @@ namespace Bit.App.Pages
|
||||||
.Select(s => new Cipher(s, _appSettingsService))
|
.Select(s => new Cipher(s, _appSettingsService))
|
||||||
.OrderBy(s =>
|
.OrderBy(s =>
|
||||||
{
|
{
|
||||||
// Sort numbers and letters before special characters
|
if(string.IsNullOrWhiteSpace(s.Name))
|
||||||
return !string.IsNullOrWhiteSpace(s.Name) && s.Name.Length > 0 &&
|
{
|
||||||
Char.IsDigit(s.Name[0]) ? 0 : (Char.IsLetter(s.Name[0]) ? 1 : 2);
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return s.Name.Length > 0 && Char.IsDigit(s.Name[0]) ? 0 : (Char.IsLetter(s.Name[0]) ? 1 : 2);
|
||||||
})
|
})
|
||||||
.ThenBy(s => s.Name)
|
.ThenBy(s => s.Name)
|
||||||
.ThenBy(s => s.Subtitle)
|
.ThenBy(s => s.Subtitle)
|
||||||
|
|
Loading…
Reference in a new issue