1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-09-27 03:52:57 +02:00

Fixed locked setting bug. Added no site list message to extension.

This commit is contained in:
Kyle Spearrin 2016-07-21 23:41:50 -04:00
parent ac0a4c3756
commit c206d228fc
8 changed files with 40 additions and 8 deletions

View File

@ -85,6 +85,7 @@ namespace Bit.App.Pages
var result = await _fingerprint.AuthenticateAsync("Use your fingerprint to verify.");
if(result.Authenticated)
{
_settings.AddOrUpdateValue(Constants.SettingLocked, false);
await Navigation.PopModalAsync();
}
}

View File

@ -7,12 +7,14 @@ using Xamarin.Forms;
using XLabs.Ioc;
using Bit.App.Controls;
using System.Linq;
using Plugin.Settings.Abstractions;
namespace Bit.App.Pages
{
public class LockPasswordPage : ExtendedContentPage
{
private readonly IAuthService _authService;
private readonly ISettings _settings;
private readonly IUserDialogs _userDialogs;
private readonly ICryptoService _cryptoService;
@ -20,6 +22,7 @@ namespace Bit.App.Pages
: base(false)
{
_authService = Resolver.Resolve<IAuthService>();
_settings = Resolver.Resolve<ISettings>();
_userDialogs = Resolver.Resolve<IUserDialogs>();
_cryptoService = Resolver.Resolve<ICryptoService>();
@ -104,6 +107,7 @@ namespace Bit.App.Pages
var key = _cryptoService.MakeKeyFromPassword(PasswordCell.Entry.Text, _authService.Email);
if(key.SequenceEqual(_cryptoService.Key))
{
_settings.AddOrUpdateValue(Constants.SettingLocked, false);
await Navigation.PopModalAsync();
}
else

View File

@ -82,6 +82,7 @@ namespace Bit.App.Pages
{
if(Model.PIN == _authService.PIN)
{
_settings.AddOrUpdateValue(Constants.SettingLocked, false);
PinControl.Entry.Unfocus();
Navigation.PopModalAsync();
}

View File

@ -7,6 +7,7 @@ using Foundation;
using MobileCoreServices;
using Plugin.Fingerprint.Abstractions;
using System.Threading.Tasks;
using Bit.App;
namespace Bit.iOS.Extension
{
@ -74,6 +75,7 @@ namespace Bit.iOS.Extension
var result = await _fingerprint.AuthenticateAsync("Use your fingerprint to verify.");
if(result.Authenticated)
{
_settings.AddOrUpdateValue(Constants.SettingLocked, false);
LoadingViewController.DismissLockAndContinue();
}
}

View File

@ -11,6 +11,7 @@ using System.Threading.Tasks;
using Bit.iOS.Core.Utilities;
using Bit.App.Abstractions;
using System.Linq;
using Bit.App;
namespace Bit.iOS.Extension
{
@ -85,6 +86,7 @@ namespace Bit.iOS.Extension
var key = _cryptoService.MakeKeyFromPassword(MasterPasswordCell.TextField.Text, _authService.Email);
if(key.SequenceEqual(_cryptoService.Key))
{
_settings.AddOrUpdateValue(Constants.SettingLocked, false);
MasterPasswordCell.TextField.ResignFirstResponder();
LoadingViewController.DismissLockAndContinue();
}

View File

@ -9,6 +9,7 @@ using Bit.App.Abstractions;
using Bit.iOS.Core.Utilities;
using Bit.App.Resources;
using System.Diagnostics;
using Bit.App;
namespace Bit.iOS.Extension
{
@ -60,6 +61,7 @@ namespace Bit.iOS.Extension
if(PinTextField.Text == _authService.PIN)
{
Debug.WriteLine("BW Log, Start Dismiss PIN controller.");
_settings.AddOrUpdateValue(Constants.SettingLocked, false);
PinTextField.ResignFirstResponder();
LoadingViewController.DismissLockAndContinue();
}

View File

@ -153,10 +153,7 @@ namespace Bit.iOS.Extension
var loadingAlert = Dialogs.CreateLoadingAlert("Saving...");
PresentViewController(loadingAlert, true, null);
await saveTask;
DismissViewController(false, () =>
{
Parent.DismissModal();
});
Parent.DismissModal();
}
public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)

View File

@ -10,6 +10,7 @@ using MobileCoreServices;
using Newtonsoft.Json;
using UIKit;
using XLabs.Ioc;
using Plugin.Settings.Abstractions;
namespace Bit.iOS.Extension
{
@ -88,8 +89,10 @@ namespace Bit.iOS.Extension
public void DismissModal()
{
DismissModalViewController(true);
TableView.ReloadData();
DismissViewController(true, () =>
{
TableView.ReloadData();
});
}
public class TableSource : UITableViewSource
@ -109,16 +112,27 @@ namespace Bit.iOS.Extension
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)
{
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);
// if there are no cells to reuse, create a new one
if(cell == null)
{
Debug.WriteLine("BW Log, Make new cell for list.");
cell = new UITableViewCell(UITableViewCellStyle.Subtitle, CellIdentifier);
}
return cell;
@ -126,7 +140,7 @@ namespace Bit.iOS.Extension
public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath)
{
if(cell == null)
if(_tableItems.Count() == 0 || cell == null)
{
return;
}
@ -139,10 +153,19 @@ namespace Bit.iOS.Extension
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);
if(item == null)
{
_controller.CompleteRequest(null);
return;
}
NSDictionary itemData = null;