1
0
mirror of https://github.com/bitwarden/mobile synced 2024-12-28 09:42:08 +01: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 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<IAuthService>();
_settings = Resolver.Resolve<ISettings>();
_appSettingsService = Resolver.Resolve<IAppSettingsService>();
_cryptoService = Resolver.Resolve<ICryptoService>();
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

View File

@ -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<IAuthService>();
_settings = Resolver.Resolve<ISettings>();
_appSettingsService = Resolver.Resolve<IAppSettingsService>();
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();
}

View File

@ -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<ISettings>();
_appSettingsService = Resolver.Resolve<IAppSettingsService>();
_fingerprint = Resolver.Resolve<IFingerprint>();
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();
}
}

View File

@ -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<ISettings>();
_appSettingsService = Resolver.Resolve<IAppSettingsService>();
_authService = Resolver.Resolve<IAuthService>();
_cryptoService = Resolver.Resolve<ICryptoService>();
@ -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();
}

View File

@ -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<ISettings>();
_appSettingsService = Resolver.Resolve<IAppSettingsService>();
_authService = Resolver.Resolve<IAuthService>();
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();
}