1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-04 08:50:18 +01:00

support bool type

This commit is contained in:
Kyle Spearrin 2019-04-08 20:33:52 -04:00
parent 4ef8ccaa8e
commit 24b4073616

View File

@ -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);