mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 01:48:25 +03:00
support bool type
This commit is contained in:
parent
4ef8ccaa8e
commit
24b4073616
1 changed files with 9 additions and 0 deletions
|
@ -22,6 +22,11 @@ namespace Bit.Core.Services
|
|||
var val = Xamarin.Essentials.Preferences.Get(formattedKey, default(string));
|
||||
return Task.FromResult((T)(object)val);
|
||||
}
|
||||
else if(objType == typeof(bool) || objType == typeof(bool?))
|
||||
{
|
||||
var val = Xamarin.Essentials.Preferences.Get(formattedKey, default(bool));
|
||||
return Task.FromResult((T)Convert.ChangeType(val, objType));
|
||||
}
|
||||
else if(objType == typeof(int) || objType == typeof(int?))
|
||||
{
|
||||
var val = Xamarin.Essentials.Preferences.Get(formattedKey, default(int));
|
||||
|
@ -61,6 +66,10 @@ namespace Bit.Core.Services
|
|||
{
|
||||
Xamarin.Essentials.Preferences.Set(formattedKey, obj as string);
|
||||
}
|
||||
else if(objType == typeof(bool) || objType == typeof(bool?))
|
||||
{
|
||||
Xamarin.Essentials.Preferences.Set(formattedKey, (obj as bool?).Value);
|
||||
}
|
||||
else if(objType == typeof(int) || objType == typeof(int?))
|
||||
{
|
||||
Xamarin.Essentials.Preferences.Set(formattedKey, (obj as int?).Value);
|
||||
|
|
Loading…
Reference in a new issue