mirror of
https://github.com/bitwarden/android.git
synced 2024-12-18 23:31:52 +03:00
Fixed locked setting bug. Added no site list message to extension.
This commit is contained in:
parent
ac0a4c3756
commit
c206d228fc
8 changed files with 40 additions and 8 deletions
|
@ -85,6 +85,7 @@ namespace Bit.App.Pages
|
||||||
var result = await _fingerprint.AuthenticateAsync("Use your fingerprint to verify.");
|
var result = await _fingerprint.AuthenticateAsync("Use your fingerprint to verify.");
|
||||||
if(result.Authenticated)
|
if(result.Authenticated)
|
||||||
{
|
{
|
||||||
|
_settings.AddOrUpdateValue(Constants.SettingLocked, false);
|
||||||
await Navigation.PopModalAsync();
|
await Navigation.PopModalAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,12 +7,14 @@ 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 : ExtendedContentPage
|
public class LockPasswordPage : ExtendedContentPage
|
||||||
{
|
{
|
||||||
private readonly IAuthService _authService;
|
private readonly IAuthService _authService;
|
||||||
|
private readonly ISettings _settings;
|
||||||
private readonly IUserDialogs _userDialogs;
|
private readonly IUserDialogs _userDialogs;
|
||||||
private readonly ICryptoService _cryptoService;
|
private readonly ICryptoService _cryptoService;
|
||||||
|
|
||||||
|
@ -20,6 +22,7 @@ namespace Bit.App.Pages
|
||||||
: base(false)
|
: base(false)
|
||||||
{
|
{
|
||||||
_authService = Resolver.Resolve<IAuthService>();
|
_authService = Resolver.Resolve<IAuthService>();
|
||||||
|
_settings = Resolver.Resolve<ISettings>();
|
||||||
_userDialogs = Resolver.Resolve<IUserDialogs>();
|
_userDialogs = Resolver.Resolve<IUserDialogs>();
|
||||||
_cryptoService = Resolver.Resolve<ICryptoService>();
|
_cryptoService = Resolver.Resolve<ICryptoService>();
|
||||||
|
|
||||||
|
@ -104,6 +107,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.SequenceEqual(_cryptoService.Key))
|
if(key.SequenceEqual(_cryptoService.Key))
|
||||||
{
|
{
|
||||||
|
_settings.AddOrUpdateValue(Constants.SettingLocked, false);
|
||||||
await Navigation.PopModalAsync();
|
await Navigation.PopModalAsync();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -82,6 +82,7 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
if(Model.PIN == _authService.PIN)
|
if(Model.PIN == _authService.PIN)
|
||||||
{
|
{
|
||||||
|
_settings.AddOrUpdateValue(Constants.SettingLocked, false);
|
||||||
PinControl.Entry.Unfocus();
|
PinControl.Entry.Unfocus();
|
||||||
Navigation.PopModalAsync();
|
Navigation.PopModalAsync();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ using Foundation;
|
||||||
using MobileCoreServices;
|
using MobileCoreServices;
|
||||||
using Plugin.Fingerprint.Abstractions;
|
using Plugin.Fingerprint.Abstractions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Bit.App;
|
||||||
|
|
||||||
namespace Bit.iOS.Extension
|
namespace Bit.iOS.Extension
|
||||||
{
|
{
|
||||||
|
@ -74,6 +75,7 @@ namespace Bit.iOS.Extension
|
||||||
var result = await _fingerprint.AuthenticateAsync("Use your fingerprint to verify.");
|
var result = await _fingerprint.AuthenticateAsync("Use your fingerprint to verify.");
|
||||||
if(result.Authenticated)
|
if(result.Authenticated)
|
||||||
{
|
{
|
||||||
|
_settings.AddOrUpdateValue(Constants.SettingLocked, false);
|
||||||
LoadingViewController.DismissLockAndContinue();
|
LoadingViewController.DismissLockAndContinue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ using System.Threading.Tasks;
|
||||||
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;
|
||||||
|
|
||||||
namespace Bit.iOS.Extension
|
namespace Bit.iOS.Extension
|
||||||
{
|
{
|
||||||
|
@ -85,6 +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.SequenceEqual(_cryptoService.Key))
|
if(key.SequenceEqual(_cryptoService.Key))
|
||||||
{
|
{
|
||||||
|
_settings.AddOrUpdateValue(Constants.SettingLocked, false);
|
||||||
MasterPasswordCell.TextField.ResignFirstResponder();
|
MasterPasswordCell.TextField.ResignFirstResponder();
|
||||||
LoadingViewController.DismissLockAndContinue();
|
LoadingViewController.DismissLockAndContinue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ using Bit.App.Abstractions;
|
||||||
using Bit.iOS.Core.Utilities;
|
using Bit.iOS.Core.Utilities;
|
||||||
using Bit.App.Resources;
|
using Bit.App.Resources;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using Bit.App;
|
||||||
|
|
||||||
namespace Bit.iOS.Extension
|
namespace Bit.iOS.Extension
|
||||||
{
|
{
|
||||||
|
@ -60,6 +61,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.SettingLocked, false);
|
||||||
PinTextField.ResignFirstResponder();
|
PinTextField.ResignFirstResponder();
|
||||||
LoadingViewController.DismissLockAndContinue();
|
LoadingViewController.DismissLockAndContinue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,10 +153,7 @@ namespace Bit.iOS.Extension
|
||||||
var loadingAlert = Dialogs.CreateLoadingAlert("Saving...");
|
var loadingAlert = Dialogs.CreateLoadingAlert("Saving...");
|
||||||
PresentViewController(loadingAlert, true, null);
|
PresentViewController(loadingAlert, true, null);
|
||||||
await saveTask;
|
await saveTask;
|
||||||
DismissViewController(false, () =>
|
Parent.DismissModal();
|
||||||
{
|
|
||||||
Parent.DismissModal();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
|
public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
|
||||||
|
|
|
@ -10,6 +10,7 @@ using MobileCoreServices;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using UIKit;
|
using UIKit;
|
||||||
using XLabs.Ioc;
|
using XLabs.Ioc;
|
||||||
|
using Plugin.Settings.Abstractions;
|
||||||
|
|
||||||
namespace Bit.iOS.Extension
|
namespace Bit.iOS.Extension
|
||||||
{
|
{
|
||||||
|
@ -88,8 +89,10 @@ namespace Bit.iOS.Extension
|
||||||
|
|
||||||
public void DismissModal()
|
public void DismissModal()
|
||||||
{
|
{
|
||||||
DismissModalViewController(true);
|
DismissViewController(true, () =>
|
||||||
TableView.ReloadData();
|
{
|
||||||
|
TableView.ReloadData();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TableSource : UITableViewSource
|
public class TableSource : UITableViewSource
|
||||||
|
@ -109,16 +112,27 @@ namespace Bit.iOS.Extension
|
||||||
|
|
||||||
public override nint RowsInSection(UITableView tableview, nint section)
|
public override nint RowsInSection(UITableView tableview, nint section)
|
||||||
{
|
{
|
||||||
return _tableItems.Count();
|
return _tableItems.Count() == 0 ? 1 : _tableItems.Count();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
|
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
|
||||||
{
|
{
|
||||||
|
if(_tableItems.Count() == 0)
|
||||||
|
{
|
||||||
|
var noDataCell = new UITableViewCell(UITableViewCellStyle.Default, "NoDataCell");
|
||||||
|
noDataCell.TextLabel.Text = "There are no sites in your vault for this website. Tap to add one.";
|
||||||
|
noDataCell.TextLabel.TextAlignment = UITextAlignment.Center;
|
||||||
|
noDataCell.TextLabel.LineBreakMode = UILineBreakMode.WordWrap;
|
||||||
|
noDataCell.TextLabel.Lines = 0;
|
||||||
|
return noDataCell;
|
||||||
|
}
|
||||||
|
|
||||||
var cell = tableView.DequeueReusableCell(CellIdentifier);
|
var cell = tableView.DequeueReusableCell(CellIdentifier);
|
||||||
|
|
||||||
// if there are no cells to reuse, create a new one
|
// if there are no cells to reuse, create a new one
|
||||||
if(cell == null)
|
if(cell == null)
|
||||||
{
|
{
|
||||||
|
Debug.WriteLine("BW Log, Make new cell for list.");
|
||||||
cell = new UITableViewCell(UITableViewCellStyle.Subtitle, CellIdentifier);
|
cell = new UITableViewCell(UITableViewCellStyle.Subtitle, CellIdentifier);
|
||||||
}
|
}
|
||||||
return cell;
|
return cell;
|
||||||
|
@ -126,7 +140,7 @@ namespace Bit.iOS.Extension
|
||||||
|
|
||||||
public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath)
|
public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath)
|
||||||
{
|
{
|
||||||
if(cell == null)
|
if(_tableItems.Count() == 0 || cell == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -139,10 +153,19 @@ namespace Bit.iOS.Extension
|
||||||
|
|
||||||
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
|
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
|
||||||
{
|
{
|
||||||
|
if(_tableItems.Count() == 0)
|
||||||
|
{
|
||||||
|
_controller.PerformSegue("siteAddSegue", this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Resolver.Resolve<ISettings>().AddOrUpdateValue(Bit.App.Constants.SettingLastBackgroundedDate, DateTime.UtcNow);
|
||||||
|
|
||||||
var item = _tableItems.ElementAt(indexPath.Row);
|
var item = _tableItems.ElementAt(indexPath.Row);
|
||||||
if(item == null)
|
if(item == null)
|
||||||
{
|
{
|
||||||
_controller.CompleteRequest(null);
|
_controller.CompleteRequest(null);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSDictionary itemData = null;
|
NSDictionary itemData = null;
|
||||||
|
|
Loading…
Reference in a new issue