From 009006fa700a773dc6c44aaeccbe09b09cbb0ee4 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 2 Aug 2016 19:56:51 -0400 Subject: [PATCH] CanAutoFill logic for extension --- src/iOS.Extension/SiteListViewController.cs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/iOS.Extension/SiteListViewController.cs b/src/iOS.Extension/SiteListViewController.cs index 1fc8676c3..13cc90259 100644 --- a/src/iOS.Extension/SiteListViewController.cs +++ b/src/iOS.Extension/SiteListViewController.cs @@ -10,6 +10,8 @@ using XLabs.Ioc; using Plugin.Settings.Abstractions; using Bit.iOS.Core.Utilities; using System.Threading.Tasks; +using Bit.iOS.Core; +using MobileCoreServices; namespace Bit.iOS.Extension { @@ -31,8 +33,7 @@ namespace Bit.iOS.Extension public async override void ViewDidLoad() { base.ViewDidLoad(); - - if(!Context?.Details?.HasPasswordField ?? false) + if(!CanAutoFill()) { CancelBarButton.Title = "Close"; } @@ -43,6 +44,19 @@ namespace Bit.iOS.Extension 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) { LoadingController.CompleteRequest(null); @@ -168,7 +182,7 @@ namespace Bit.iOS.Extension return; } - if(_context?.Details?.HasPasswordField ?? false && !string.IsNullOrWhiteSpace(item.Password)) + if(_controller.CanAutoFill() && !string.IsNullOrWhiteSpace(item.Password)) { _controller.LoadingController.CompleteUsernamePasswordRequest(item.Username, item.Password); }