mirror of
https://github.com/bitwarden/android.git
synced 2025-03-29 00:59:19 +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));
|
var val = Xamarin.Essentials.Preferences.Get(formattedKey, default(string));
|
||||||
return Task.FromResult((T)(object)val);
|
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?))
|
else if(objType == typeof(int) || objType == typeof(int?))
|
||||||
{
|
{
|
||||||
var val = Xamarin.Essentials.Preferences.Get(formattedKey, default(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);
|
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?))
|
else if(objType == typeof(int) || objType == typeof(int?))
|
||||||
{
|
{
|
||||||
Xamarin.Essentials.Preferences.Set(formattedKey, (obj as int?).Value);
|
Xamarin.Essentials.Preferences.Set(formattedKey, (obj as int?).Value);
|
||||||
|
|
Loading…
Add table
Reference in a new issue