mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 18:38:27 +03:00
improvement to lock screen
This commit is contained in:
parent
caa0af1258
commit
9145fa1c48
6 changed files with 45 additions and 15 deletions
|
@ -97,5 +97,11 @@ namespace Bit.Core.Utilities
|
||||||
}
|
}
|
||||||
throw new Exception($"Service {serviceName} is not registered.");
|
throw new Exception($"Service {serviceName} is not registered.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Reset()
|
||||||
|
{
|
||||||
|
Inited = false;
|
||||||
|
RegisteredServices.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace Bit.iOS.Core.Controllers
|
||||||
public abstract Action Cancel { get; }
|
public abstract Action Cancel { get; }
|
||||||
|
|
||||||
public FormEntryTableViewCell MasterPasswordCell { get; set; } = new FormEntryTableViewCell(
|
public FormEntryTableViewCell MasterPasswordCell { get; set; } = new FormEntryTableViewCell(
|
||||||
AppResources.MasterPassword, useLabelAsPlaceholder: true);
|
AppResources.MasterPassword);
|
||||||
|
|
||||||
public override void ViewWillAppear(bool animated)
|
public override void ViewWillAppear(bool animated)
|
||||||
{
|
{
|
||||||
|
@ -70,7 +70,7 @@ namespace Bit.iOS.Core.Controllers
|
||||||
|
|
||||||
var descriptor = UIFontDescriptor.PreferredBody;
|
var descriptor = UIFontDescriptor.PreferredBody;
|
||||||
|
|
||||||
MasterPasswordCell.TextField.Placeholder = _pinLock ? AppResources.PIN : AppResources.MasterPassword;
|
MasterPasswordCell.Label.Text = _pinLock ? AppResources.PIN : AppResources.MasterPassword;
|
||||||
MasterPasswordCell.TextField.SecureTextEntry = true;
|
MasterPasswordCell.TextField.SecureTextEntry = true;
|
||||||
MasterPasswordCell.TextField.ReturnKeyType = UIReturnKeyType.Go;
|
MasterPasswordCell.TextField.ReturnKeyType = UIReturnKeyType.Go;
|
||||||
MasterPasswordCell.TextField.ShouldReturn += (UITextField tf) =>
|
MasterPasswordCell.TextField.ShouldReturn += (UITextField tf) =>
|
||||||
|
@ -78,6 +78,10 @@ namespace Bit.iOS.Core.Controllers
|
||||||
CheckPasswordAsync().GetAwaiter().GetResult();
|
CheckPasswordAsync().GetAwaiter().GetResult();
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
if(_pinLock)
|
||||||
|
{
|
||||||
|
MasterPasswordCell.TextField.KeyboardType = UIKeyboardType.NumberPad;
|
||||||
|
}
|
||||||
|
|
||||||
TableView.RowHeight = UITableView.AutomaticDimension;
|
TableView.RowHeight = UITableView.AutomaticDimension;
|
||||||
TableView.EstimatedRowHeight = 70;
|
TableView.EstimatedRowHeight = 70;
|
||||||
|
@ -94,7 +98,7 @@ namespace Bit.iOS.Core.Controllers
|
||||||
var tasks = Task.Run(async () =>
|
var tasks = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
await Task.Delay(500);
|
await Task.Delay(500);
|
||||||
PromptFingerprintAsync().GetAwaiter().GetResult();
|
NSRunLoop.Main.BeginInvokeOnMainThread(async () => await PromptFingerprintAsync());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,8 +112,6 @@ namespace Bit.iOS.Core.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Try fingerprint again button action
|
|
||||||
|
|
||||||
protected async Task CheckPasswordAsync()
|
protected async Task CheckPasswordAsync()
|
||||||
{
|
{
|
||||||
if(string.IsNullOrWhiteSpace(MasterPasswordCell.TextField.Text))
|
if(string.IsNullOrWhiteSpace(MasterPasswordCell.TextField.Text))
|
||||||
|
@ -254,6 +256,16 @@ namespace Bit.iOS.Core.Controllers
|
||||||
return _controller.MasterPasswordCell;
|
return _controller.MasterPasswordCell;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(indexPath.Section == 1)
|
||||||
|
{
|
||||||
|
if(indexPath.Row == 0)
|
||||||
|
{
|
||||||
|
var cell = new UITableViewCell();
|
||||||
|
cell.TextLabel.TextColor = new UIColor(red: 0.24f, green: 0.55f, blue: 0.74f, alpha: 1.0f);
|
||||||
|
cell.TextLabel.Text = AppResources.UseFingerprintToUnlock;
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
}
|
||||||
return new UITableViewCell();
|
return new UITableViewCell();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,12 +276,12 @@ namespace Bit.iOS.Core.Controllers
|
||||||
|
|
||||||
public override nint NumberOfSections(UITableView tableView)
|
public override nint NumberOfSections(UITableView tableView)
|
||||||
{
|
{
|
||||||
return 1;
|
return _controller._fingerprintLock ? 2 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override nint RowsInSection(UITableView tableview, nint section)
|
public override nint RowsInSection(UITableView tableview, nint section)
|
||||||
{
|
{
|
||||||
if(section == 0)
|
if(section <= 1)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -278,7 +290,7 @@ namespace Bit.iOS.Core.Controllers
|
||||||
|
|
||||||
public override nfloat GetHeightForHeader(UITableView tableView, nint section)
|
public override nfloat GetHeightForHeader(UITableView tableView, nint section)
|
||||||
{
|
{
|
||||||
return UITableView.AutomaticDimension;
|
return section == 1 ? 0.00001f : UITableView.AutomaticDimension;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string TitleForHeader(UITableView tableView, nint section)
|
public override string TitleForHeader(UITableView tableView, nint section)
|
||||||
|
@ -290,6 +302,11 @@ namespace Bit.iOS.Core.Controllers
|
||||||
{
|
{
|
||||||
tableView.DeselectRow(indexPath, true);
|
tableView.DeselectRow(indexPath, true);
|
||||||
tableView.EndEditing(true);
|
tableView.EndEditing(true);
|
||||||
|
if(indexPath.Section == 1 && indexPath.Row == 0)
|
||||||
|
{
|
||||||
|
var task = _controller.PromptFingerprintAsync();
|
||||||
|
return;
|
||||||
|
}
|
||||||
var cell = tableView.CellAt(indexPath);
|
var cell = tableView.CellAt(indexPath);
|
||||||
if(cell == null)
|
if(cell == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,9 +22,9 @@ namespace Bit.iOS.Core.Controllers
|
||||||
private IFolderService _folderService;
|
private IFolderService _folderService;
|
||||||
private IEnumerable<FolderView> _folders;
|
private IEnumerable<FolderView> _folders;
|
||||||
|
|
||||||
public LoginAddViewController(IntPtr handle) : base(handle)
|
public LoginAddViewController(IntPtr handle)
|
||||||
{
|
: base(handle)
|
||||||
}
|
{ }
|
||||||
|
|
||||||
public AppExtensionContext Context { get; set; }
|
public AppExtensionContext Context { get; set; }
|
||||||
public FormEntryTableViewCell NameCell { get; set; } = new FormEntryTableViewCell(AppResources.Name);
|
public FormEntryTableViewCell NameCell { get; set; } = new FormEntryTableViewCell(AppResources.Name);
|
||||||
|
|
|
@ -182,7 +182,11 @@ namespace Bit.iOS.Extension
|
||||||
var resultsProvider = new NSItemProvider(itemData, UTType.PropertyList);
|
var resultsProvider = new NSItemProvider(itemData, UTType.PropertyList);
|
||||||
var resultsItem = new NSExtensionItem { Attachments = new NSItemProvider[] { resultsProvider } };
|
var resultsItem = new NSExtensionItem { Attachments = new NSItemProvider[] { resultsProvider } };
|
||||||
var returningItems = new NSExtensionItem[] { resultsItem };
|
var returningItems = new NSExtensionItem[] { resultsItem };
|
||||||
NSRunLoop.Main.BeginInvokeOnMainThread(() => ExtensionContext?.CompleteRequest(returningItems, null));
|
NSRunLoop.Main.BeginInvokeOnMainThread(() =>
|
||||||
|
{
|
||||||
|
ServiceContainer.Reset();
|
||||||
|
ExtensionContext?.CompleteRequest(returningItems, null);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ProcessItemProvider(NSItemProvider itemProvider, string type, Action<NSDictionary> dictAction,
|
private bool ProcessItemProvider(NSItemProvider itemProvider, string type, Action<NSDictionary> dictAction,
|
||||||
|
|
|
@ -5,7 +5,8 @@ namespace Bit.iOS.Extension
|
||||||
{
|
{
|
||||||
public partial class LockPasswordViewController : Core.Controllers.LockPasswordViewController
|
public partial class LockPasswordViewController : Core.Controllers.LockPasswordViewController
|
||||||
{
|
{
|
||||||
public LockPasswordViewController(IntPtr handle) : base(handle)
|
public LockPasswordViewController(IntPtr handle)
|
||||||
|
: base(handle)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public LoadingViewController LoadingController { get; set; }
|
public LoadingViewController LoadingController { get; set; }
|
||||||
|
|
|
@ -276,8 +276,10 @@ namespace Bit.iOS
|
||||||
private void ShowAppExtension()
|
private void ShowAppExtension()
|
||||||
{
|
{
|
||||||
var itemProvider = new NSItemProvider(new NSDictionary(), Core.Constants.UTTypeAppExtensionSetup);
|
var itemProvider = new NSItemProvider(new NSDictionary(), Core.Constants.UTTypeAppExtensionSetup);
|
||||||
var extensionItem = new NSExtensionItem();
|
var extensionItem = new NSExtensionItem
|
||||||
extensionItem.Attachments = new NSItemProvider[] { itemProvider };
|
{
|
||||||
|
Attachments = new NSItemProvider[] { itemProvider }
|
||||||
|
};
|
||||||
var activityViewController = new UIActivityViewController(new NSExtensionItem[] { extensionItem }, null);
|
var activityViewController = new UIActivityViewController(new NSExtensionItem[] { extensionItem }, null);
|
||||||
activityViewController.CompletionHandler = (activityType, completed) =>
|
activityViewController.CompletionHandler = (activityType, completed) =>
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue