mirror of
https://github.com/bitwarden/android.git
synced 2024-12-18 23:31:52 +03:00
CanAutoFill logic for extension
This commit is contained in:
parent
ae37c634ef
commit
009006fa70
1 changed files with 17 additions and 3 deletions
|
@ -10,6 +10,8 @@ using XLabs.Ioc;
|
||||||
using Plugin.Settings.Abstractions;
|
using Plugin.Settings.Abstractions;
|
||||||
using Bit.iOS.Core.Utilities;
|
using Bit.iOS.Core.Utilities;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Bit.iOS.Core;
|
||||||
|
using MobileCoreServices;
|
||||||
|
|
||||||
namespace Bit.iOS.Extension
|
namespace Bit.iOS.Extension
|
||||||
{
|
{
|
||||||
|
@ -31,8 +33,7 @@ namespace Bit.iOS.Extension
|
||||||
public async override void ViewDidLoad()
|
public async override void ViewDidLoad()
|
||||||
{
|
{
|
||||||
base.ViewDidLoad();
|
base.ViewDidLoad();
|
||||||
|
if(!CanAutoFill())
|
||||||
if(!Context?.Details?.HasPasswordField ?? false)
|
|
||||||
{
|
{
|
||||||
CancelBarButton.Title = "Close";
|
CancelBarButton.Title = "Close";
|
||||||
}
|
}
|
||||||
|
@ -43,6 +44,19 @@ namespace Bit.iOS.Extension
|
||||||
await ((TableSource)TableView.Source).LoadItemsAsync();
|
await ((TableSource)TableView.Source).LoadItemsAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CanAutoFill()
|
||||||
|
{
|
||||||
|
if(Context.ProviderType != Constants.UTTypeAppExtensionFillBrowserAction
|
||||||
|
&& Context.ProviderType != Constants.UTTypeAppExtensionFillWebViewAction
|
||||||
|
&& Context.ProviderType != UTType.PropertyList)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Context.Details?.HasPasswordField ?? false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
partial void CancelBarButton_Activated(UIBarButtonItem sender)
|
partial void CancelBarButton_Activated(UIBarButtonItem sender)
|
||||||
{
|
{
|
||||||
LoadingController.CompleteRequest(null);
|
LoadingController.CompleteRequest(null);
|
||||||
|
@ -168,7 +182,7 @@ namespace Bit.iOS.Extension
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_context?.Details?.HasPasswordField ?? false && !string.IsNullOrWhiteSpace(item.Password))
|
if(_controller.CanAutoFill() && !string.IsNullOrWhiteSpace(item.Password))
|
||||||
{
|
{
|
||||||
_controller.LoadingController.CompleteUsernamePasswordRequest(item.Username, item.Password);
|
_controller.LoadingController.CompleteUsernamePasswordRequest(item.Username, item.Password);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue