mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 18:08:26 +03:00
Fix for short profile Name value crashing app (#1833)
This commit is contained in:
parent
c043528a16
commit
bf33f23c12
5 changed files with 17 additions and 2 deletions
|
@ -62,6 +62,10 @@ namespace Bit.App.Controls
|
|||
upperData = _data.ToUpper();
|
||||
chars = GetFirstLetters(upperData, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
chars = upperData = _data.ToUpper();
|
||||
}
|
||||
|
||||
var bgColor = StringToColor(upperData);
|
||||
var textColor = Color.White;
|
||||
|
@ -122,7 +126,7 @@ namespace Bit.App.Controls
|
|||
{
|
||||
return data.Substring(0, 2);
|
||||
}
|
||||
return null;
|
||||
return data;
|
||||
}
|
||||
|
||||
private Color StringToColor(string str)
|
||||
|
|
|
@ -55,6 +55,7 @@ namespace Bit.Core.Abstractions
|
|||
Task SetAutofillTileAddedAsync(bool? value);
|
||||
Task<string> GetEmailAsync(string userId = null);
|
||||
Task<string> GetNameAsync(string userId = null);
|
||||
Task SetNameAsync(string value, string userId = null);
|
||||
Task<string> GetOrgIdentifierAsync(string userId = null);
|
||||
Task<long?> GetLastActiveTimeAsync(string userId = null);
|
||||
Task SetLastActiveTimeAsync(long? value, string userId = null);
|
||||
|
|
|
@ -470,6 +470,15 @@ namespace Bit.Core.Services
|
|||
))?.Profile?.Name;
|
||||
}
|
||||
|
||||
public async Task SetNameAsync(string value, string userId = null)
|
||||
{
|
||||
var reconciledOptions = ReconcileOptions(new StorageOptions { UserId = userId },
|
||||
await GetDefaultStorageOptionsAsync());
|
||||
var account = await GetAccountAsync(reconciledOptions);
|
||||
account.Profile.Name = value;
|
||||
await SaveAccountAsync(account, reconciledOptions);
|
||||
}
|
||||
|
||||
public async Task<string> GetOrgIdentifierAsync(string userId = null)
|
||||
{
|
||||
return (await GetAccountAsync(
|
||||
|
|
|
@ -327,6 +327,7 @@ namespace Bit.Core.Services
|
|||
var organizations = response.Organizations.ToDictionary(o => o.Id, o => new OrganizationData(o));
|
||||
await _organizationService.ReplaceAsync(organizations);
|
||||
await _stateService.SetEmailVerifiedAsync(response.EmailVerified);
|
||||
await _stateService.SetNameAsync(response.Name);
|
||||
await _keyConnectorService.SetUsesKeyConnector(response.UsesKeyConnector);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace Bit.iOS.Core.Renderers
|
|||
{
|
||||
try
|
||||
{
|
||||
uiBarButtonItem.Image = uiBarButtonItem.Image.ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);
|
||||
uiBarButtonItem.Image = uiBarButtonItem.Image?.ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue