1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-09 20:13:18 +00:00
This commit is contained in:
Kyle Spearrin
2019-05-29 15:50:20 -04:00
parent 40484a7bf0
commit a1741fdd67
14 changed files with 265 additions and 139 deletions

View File

@@ -12,7 +12,17 @@ namespace Bit.App.Services
private readonly HashSet<string> _preferenceStorageKeys = new HashSet<string>
{
Constants.LockOptionKey
Constants.LockOptionKey,
Constants.ThemeKey,
Constants.DefaultUriMatch,
Constants.DisableAutoTotpCopyKey,
Constants.DisableFaviconKey,
Constants.ClearClipboardKey,
Constants.AccessibilityAutofillPasswordFieldKey,
Constants.AccessibilityAutofillPersistNotificationKey,
Constants.LastActiveKey,
Constants.PushInitialPromptShownKey,
Constants.LastFileCacheClearKey
};
public MobileStorageService(

View File

@@ -8,7 +8,8 @@ namespace Bit.App.Services
{
public class PreferencesStorageService : IStorageService
{
private readonly string _keyFormat = "bwPreferencesStorage:{0}";
public static string KeyFormat = "bwPreferencesStorage:{0}";
private readonly string _sharedName;
private readonly JsonSerializerSettings _jsonSettings = new JsonSerializerSettings
{
@@ -22,7 +23,7 @@ namespace Bit.App.Services
public Task<T> GetAsync<T>(string key)
{
var formattedKey = string.Format(_keyFormat, key);
var formattedKey = string.Format(KeyFormat, key);
if(!Xamarin.Essentials.Preferences.ContainsKey(formattedKey, _sharedName))
{
return Task.FromResult(default(T));
@@ -73,7 +74,7 @@ namespace Bit.App.Services
return RemoveAsync(key);
}
var formattedKey = string.Format(_keyFormat, key);
var formattedKey = string.Format(KeyFormat, key);
var objType = typeof(T);
if(objType == typeof(string))
{
@@ -109,7 +110,7 @@ namespace Bit.App.Services
public Task RemoveAsync(string key)
{
var formattedKey = string.Format(_keyFormat, key);
var formattedKey = string.Format(KeyFormat, key);
if(Xamarin.Essentials.Preferences.ContainsKey(formattedKey, _sharedName))
{
Xamarin.Essentials.Preferences.Remove(formattedKey, _sharedName);