From b5311e1448b4039cad12255039081bbf5af99d1a Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 28 Apr 2017 11:34:02 -0400 Subject: [PATCH] moved locked sets to AppSettingsService --- src/App/Pages/Lock/LockPasswordPage.cs | 7 +++---- src/App/Pages/Lock/LockPinPage.cs | 9 +++------ src/iOS.Extension/LockFingerprintViewController.cs | 9 ++++----- src/iOS.Extension/LockPasswordViewController.cs | 8 +++----- src/iOS.Extension/LockPinViewController.cs | 6 +++--- 5 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/App/Pages/Lock/LockPasswordPage.cs b/src/App/Pages/Lock/LockPasswordPage.cs index 31118af1b..7c863df5f 100644 --- a/src/App/Pages/Lock/LockPasswordPage.cs +++ b/src/App/Pages/Lock/LockPasswordPage.cs @@ -6,20 +6,19 @@ using Xamarin.Forms; using XLabs.Ioc; using Bit.App.Controls; using System.Linq; -using Plugin.Settings.Abstractions; namespace Bit.App.Pages { public class LockPasswordPage : BaseLockPage { private readonly IAuthService _authService; - private readonly ISettings _settings; + private readonly IAppSettingsService _appSettingsService; private readonly ICryptoService _cryptoService; public LockPasswordPage() { _authService = Resolver.Resolve(); - _settings = Resolver.Resolve(); + _appSettingsService = Resolver.Resolve(); _cryptoService = Resolver.Resolve(); Init(); @@ -122,7 +121,7 @@ namespace Bit.App.Pages var key = _cryptoService.MakeKeyFromPassword(PasswordCell.Entry.Text, _authService.Email); if(key.Key.SequenceEqual(_cryptoService.Key.Key)) { - _settings.AddOrUpdateValue(Constants.Locked, false); + _appSettingsService.Locked = false; await Navigation.PopModalAsync(); } else diff --git a/src/App/Pages/Lock/LockPinPage.cs b/src/App/Pages/Lock/LockPinPage.cs index 53e56303a..66021f692 100644 --- a/src/App/Pages/Lock/LockPinPage.cs +++ b/src/App/Pages/Lock/LockPinPage.cs @@ -1,11 +1,8 @@ using System; -using System.Threading.Tasks; -using Acr.UserDialogs; using Bit.App.Abstractions; using Bit.App.Resources; using Xamarin.Forms; using XLabs.Ioc; -using Plugin.Settings.Abstractions; using Bit.App.Models.Page; using Bit.App.Controls; @@ -14,13 +11,13 @@ namespace Bit.App.Pages public class LockPinPage : BaseLockPage { private readonly IAuthService _authService; - private readonly ISettings _settings; + private readonly IAppSettingsService _appSettingsService; private TapGestureRecognizer _tgr; public LockPinPage() { _authService = Resolver.Resolve(); - _settings = Resolver.Resolve(); + _appSettingsService = Resolver.Resolve(); Init(); } @@ -96,7 +93,7 @@ namespace Bit.App.Pages { if(Model.PIN == _authService.PIN) { - _settings.AddOrUpdateValue(Constants.Locked, false); + _appSettingsService.Locked = false; PinControl.Entry.Unfocus(); Navigation.PopModalAsync(); } diff --git a/src/iOS.Extension/LockFingerprintViewController.cs b/src/iOS.Extension/LockFingerprintViewController.cs index 93fbd5330..94c28e349 100644 --- a/src/iOS.Extension/LockFingerprintViewController.cs +++ b/src/iOS.Extension/LockFingerprintViewController.cs @@ -2,18 +2,17 @@ using System; using Bit.iOS.Extension.Models; using UIKit; using XLabs.Ioc; -using Plugin.Settings.Abstractions; using Plugin.Fingerprint.Abstractions; using System.Threading.Tasks; -using Bit.App; using Bit.iOS.Core.Controllers; using Bit.App.Resources; +using Bit.App.Abstractions; namespace Bit.iOS.Extension { public partial class LockFingerprintViewController : ExtendedUIViewController { - private ISettings _settings; + private IAppSettingsService _appSettingsService; private IFingerprint _fingerprint; public LockFingerprintViewController(IntPtr handle) : base(handle) @@ -31,7 +30,7 @@ namespace Bit.iOS.Extension public override void ViewDidLoad() { - _settings = Resolver.Resolve(); + _appSettingsService = Resolver.Resolve(); _fingerprint = Resolver.Resolve(); NavItem.Title = AppResources.VerifyFingerprint; @@ -74,7 +73,7 @@ namespace Bit.iOS.Extension var result = await _fingerprint.AuthenticateAsync(AppResources.FingerprintDirection); if(result.Authenticated) { - _settings.AddOrUpdateValue(Constants.Locked, false); + _appSettingsService.Locked = false; LoadingController.DismissLockAndContinue(); } } diff --git a/src/iOS.Extension/LockPasswordViewController.cs b/src/iOS.Extension/LockPasswordViewController.cs index 1384077d0..a7e4e5b63 100644 --- a/src/iOS.Extension/LockPasswordViewController.cs +++ b/src/iOS.Extension/LockPasswordViewController.cs @@ -2,21 +2,19 @@ using System; using Bit.iOS.Extension.Models; using UIKit; using XLabs.Ioc; -using Plugin.Settings.Abstractions; using Foundation; using Bit.iOS.Core.Views; using Bit.App.Resources; using Bit.iOS.Core.Utilities; using Bit.App.Abstractions; using System.Linq; -using Bit.App; using Bit.iOS.Core.Controllers; namespace Bit.iOS.Extension { public partial class LockPasswordViewController : ExtendedUITableViewController { - private ISettings _settings; + private IAppSettingsService _appSettingsService; private IAuthService _authService; private ICryptoService _cryptoService; @@ -37,7 +35,7 @@ namespace Bit.iOS.Extension public override void ViewDidLoad() { - _settings = Resolver.Resolve(); + _appSettingsService = Resolver.Resolve(); _authService = Resolver.Resolve(); _cryptoService = Resolver.Resolve(); @@ -88,7 +86,7 @@ namespace Bit.iOS.Extension var key = _cryptoService.MakeKeyFromPassword(MasterPasswordCell.TextField.Text, _authService.Email); if(key.Key.SequenceEqual(_cryptoService.Key.Key)) { - _settings.AddOrUpdateValue(Constants.Locked, false); + _appSettingsService.Locked = false; MasterPasswordCell.TextField.ResignFirstResponder(); LoadingController.DismissLockAndContinue(); } diff --git a/src/iOS.Extension/LockPinViewController.cs b/src/iOS.Extension/LockPinViewController.cs index 9bebc9d14..97987067d 100644 --- a/src/iOS.Extension/LockPinViewController.cs +++ b/src/iOS.Extension/LockPinViewController.cs @@ -14,7 +14,7 @@ namespace Bit.iOS.Extension { public partial class LockPinViewController : ExtendedUIViewController { - private ISettings _settings; + private IAppSettingsService _appSettingsService; private IAuthService _authService; public LockPinViewController(IntPtr handle) : base(handle) @@ -32,7 +32,7 @@ namespace Bit.iOS.Extension public override void ViewDidLoad() { - _settings = Resolver.Resolve(); + _appSettingsService = Resolver.Resolve(); _authService = Resolver.Resolve(); NavItem.Title = AppResources.VerifyPIN; @@ -68,7 +68,7 @@ namespace Bit.iOS.Extension if(PinTextField.Text == _authService.PIN) { Debug.WriteLine("BW Log, Start Dismiss PIN controller."); - _settings.AddOrUpdateValue(Constants.Locked, false); + _appSettingsService.Locked = false; PinTextField.ResignFirstResponder(); LoadingController.DismissLockAndContinue(); }