mirror of
https://github.com/bitwarden/mobile
synced 2025-02-10 00:40:54 +01:00
support bool type
This commit is contained in:
parent
4ef8ccaa8e
commit
24b4073616
@ -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…
x
Reference in New Issue
Block a user