1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-10 13:23:39 +00:00

moved locked sets to AppSettingsService

This commit is contained in:
Kyle Spearrin
2017-04-28 11:34:02 -04:00
parent cc63eb383d
commit b5311e1448
5 changed files with 16 additions and 23 deletions

View File

@@ -6,20 +6,19 @@ using Xamarin.Forms;
using XLabs.Ioc; using XLabs.Ioc;
using Bit.App.Controls; using Bit.App.Controls;
using System.Linq; using System.Linq;
using Plugin.Settings.Abstractions;
namespace Bit.App.Pages namespace Bit.App.Pages
{ {
public class LockPasswordPage : BaseLockPage public class LockPasswordPage : BaseLockPage
{ {
private readonly IAuthService _authService; private readonly IAuthService _authService;
private readonly ISettings _settings; private readonly IAppSettingsService _appSettingsService;
private readonly ICryptoService _cryptoService; private readonly ICryptoService _cryptoService;
public LockPasswordPage() public LockPasswordPage()
{ {
_authService = Resolver.Resolve<IAuthService>(); _authService = Resolver.Resolve<IAuthService>();
_settings = Resolver.Resolve<ISettings>(); _appSettingsService = Resolver.Resolve<IAppSettingsService>();
_cryptoService = Resolver.Resolve<ICryptoService>(); _cryptoService = Resolver.Resolve<ICryptoService>();
Init(); Init();
@@ -122,7 +121,7 @@ namespace Bit.App.Pages
var key = _cryptoService.MakeKeyFromPassword(PasswordCell.Entry.Text, _authService.Email); var key = _cryptoService.MakeKeyFromPassword(PasswordCell.Entry.Text, _authService.Email);
if(key.Key.SequenceEqual(_cryptoService.Key.Key)) if(key.Key.SequenceEqual(_cryptoService.Key.Key))
{ {
_settings.AddOrUpdateValue(Constants.Locked, false); _appSettingsService.Locked = false;
await Navigation.PopModalAsync(); await Navigation.PopModalAsync();
} }
else else

View File

@@ -1,11 +1,8 @@
using System; using System;
using System.Threading.Tasks;
using Acr.UserDialogs;
using Bit.App.Abstractions; using Bit.App.Abstractions;
using Bit.App.Resources; using Bit.App.Resources;
using Xamarin.Forms; using Xamarin.Forms;
using XLabs.Ioc; using XLabs.Ioc;
using Plugin.Settings.Abstractions;
using Bit.App.Models.Page; using Bit.App.Models.Page;
using Bit.App.Controls; using Bit.App.Controls;
@@ -14,13 +11,13 @@ namespace Bit.App.Pages
public class LockPinPage : BaseLockPage public class LockPinPage : BaseLockPage
{ {
private readonly IAuthService _authService; private readonly IAuthService _authService;
private readonly ISettings _settings; private readonly IAppSettingsService _appSettingsService;
private TapGestureRecognizer _tgr; private TapGestureRecognizer _tgr;
public LockPinPage() public LockPinPage()
{ {
_authService = Resolver.Resolve<IAuthService>(); _authService = Resolver.Resolve<IAuthService>();
_settings = Resolver.Resolve<ISettings>(); _appSettingsService = Resolver.Resolve<IAppSettingsService>();
Init(); Init();
} }
@@ -96,7 +93,7 @@ namespace Bit.App.Pages
{ {
if(Model.PIN == _authService.PIN) if(Model.PIN == _authService.PIN)
{ {
_settings.AddOrUpdateValue(Constants.Locked, false); _appSettingsService.Locked = false;
PinControl.Entry.Unfocus(); PinControl.Entry.Unfocus();
Navigation.PopModalAsync(); Navigation.PopModalAsync();
} }

View File

@@ -2,18 +2,17 @@ using System;
using Bit.iOS.Extension.Models; using Bit.iOS.Extension.Models;
using UIKit; using UIKit;
using XLabs.Ioc; using XLabs.Ioc;
using Plugin.Settings.Abstractions;
using Plugin.Fingerprint.Abstractions; using Plugin.Fingerprint.Abstractions;
using System.Threading.Tasks; using System.Threading.Tasks;
using Bit.App;
using Bit.iOS.Core.Controllers; using Bit.iOS.Core.Controllers;
using Bit.App.Resources; using Bit.App.Resources;
using Bit.App.Abstractions;
namespace Bit.iOS.Extension namespace Bit.iOS.Extension
{ {
public partial class LockFingerprintViewController : ExtendedUIViewController public partial class LockFingerprintViewController : ExtendedUIViewController
{ {
private ISettings _settings; private IAppSettingsService _appSettingsService;
private IFingerprint _fingerprint; private IFingerprint _fingerprint;
public LockFingerprintViewController(IntPtr handle) : base(handle) public LockFingerprintViewController(IntPtr handle) : base(handle)
@@ -31,7 +30,7 @@ namespace Bit.iOS.Extension
public override void ViewDidLoad() public override void ViewDidLoad()
{ {
_settings = Resolver.Resolve<ISettings>(); _appSettingsService = Resolver.Resolve<IAppSettingsService>();
_fingerprint = Resolver.Resolve<IFingerprint>(); _fingerprint = Resolver.Resolve<IFingerprint>();
NavItem.Title = AppResources.VerifyFingerprint; NavItem.Title = AppResources.VerifyFingerprint;
@@ -74,7 +73,7 @@ namespace Bit.iOS.Extension
var result = await _fingerprint.AuthenticateAsync(AppResources.FingerprintDirection); var result = await _fingerprint.AuthenticateAsync(AppResources.FingerprintDirection);
if(result.Authenticated) if(result.Authenticated)
{ {
_settings.AddOrUpdateValue(Constants.Locked, false); _appSettingsService.Locked = false;
LoadingController.DismissLockAndContinue(); LoadingController.DismissLockAndContinue();
} }
} }

View File

@@ -2,21 +2,19 @@ using System;
using Bit.iOS.Extension.Models; using Bit.iOS.Extension.Models;
using UIKit; using UIKit;
using XLabs.Ioc; using XLabs.Ioc;
using Plugin.Settings.Abstractions;
using Foundation; using Foundation;
using Bit.iOS.Core.Views; using Bit.iOS.Core.Views;
using Bit.App.Resources; using Bit.App.Resources;
using Bit.iOS.Core.Utilities; using Bit.iOS.Core.Utilities;
using Bit.App.Abstractions; using Bit.App.Abstractions;
using System.Linq; using System.Linq;
using Bit.App;
using Bit.iOS.Core.Controllers; using Bit.iOS.Core.Controllers;
namespace Bit.iOS.Extension namespace Bit.iOS.Extension
{ {
public partial class LockPasswordViewController : ExtendedUITableViewController public partial class LockPasswordViewController : ExtendedUITableViewController
{ {
private ISettings _settings; private IAppSettingsService _appSettingsService;
private IAuthService _authService; private IAuthService _authService;
private ICryptoService _cryptoService; private ICryptoService _cryptoService;
@@ -37,7 +35,7 @@ namespace Bit.iOS.Extension
public override void ViewDidLoad() public override void ViewDidLoad()
{ {
_settings = Resolver.Resolve<ISettings>(); _appSettingsService = Resolver.Resolve<IAppSettingsService>();
_authService = Resolver.Resolve<IAuthService>(); _authService = Resolver.Resolve<IAuthService>();
_cryptoService = Resolver.Resolve<ICryptoService>(); _cryptoService = Resolver.Resolve<ICryptoService>();
@@ -88,7 +86,7 @@ namespace Bit.iOS.Extension
var key = _cryptoService.MakeKeyFromPassword(MasterPasswordCell.TextField.Text, _authService.Email); var key = _cryptoService.MakeKeyFromPassword(MasterPasswordCell.TextField.Text, _authService.Email);
if(key.Key.SequenceEqual(_cryptoService.Key.Key)) if(key.Key.SequenceEqual(_cryptoService.Key.Key))
{ {
_settings.AddOrUpdateValue(Constants.Locked, false); _appSettingsService.Locked = false;
MasterPasswordCell.TextField.ResignFirstResponder(); MasterPasswordCell.TextField.ResignFirstResponder();
LoadingController.DismissLockAndContinue(); LoadingController.DismissLockAndContinue();
} }

View File

@@ -14,7 +14,7 @@ namespace Bit.iOS.Extension
{ {
public partial class LockPinViewController : ExtendedUIViewController public partial class LockPinViewController : ExtendedUIViewController
{ {
private ISettings _settings; private IAppSettingsService _appSettingsService;
private IAuthService _authService; private IAuthService _authService;
public LockPinViewController(IntPtr handle) : base(handle) public LockPinViewController(IntPtr handle) : base(handle)
@@ -32,7 +32,7 @@ namespace Bit.iOS.Extension
public override void ViewDidLoad() public override void ViewDidLoad()
{ {
_settings = Resolver.Resolve<ISettings>(); _appSettingsService = Resolver.Resolve<IAppSettingsService>();
_authService = Resolver.Resolve<IAuthService>(); _authService = Resolver.Resolve<IAuthService>();
NavItem.Title = AppResources.VerifyPIN; NavItem.Title = AppResources.VerifyPIN;
@@ -68,7 +68,7 @@ namespace Bit.iOS.Extension
if(PinTextField.Text == _authService.PIN) if(PinTextField.Text == _authService.PIN)
{ {
Debug.WriteLine("BW Log, Start Dismiss PIN controller."); Debug.WriteLine("BW Log, Start Dismiss PIN controller.");
_settings.AddOrUpdateValue(Constants.Locked, false); _appSettingsService.Locked = false;
PinTextField.ResignFirstResponder(); PinTextField.ResignFirstResponder();
LoadingController.DismissLockAndContinue(); LoadingController.DismissLockAndContinue();
} }