mirror of
https://github.com/bitwarden/mobile
synced 2025-12-14 15:23:35 +00:00
log autofill events
This commit is contained in:
@@ -62,7 +62,7 @@ namespace Bit.iOS.Extension
|
||||
{
|
||||
var alert = Dialogs.CreateAlert(null, AppResources.MustLogInMainApp, AppResources.Ok, (a) =>
|
||||
{
|
||||
CompleteRequest(null);
|
||||
CompleteRequest(null, null);
|
||||
});
|
||||
PresentViewController(alert, true, null);
|
||||
return;
|
||||
@@ -131,7 +131,7 @@ namespace Bit.iOS.Extension
|
||||
}
|
||||
}
|
||||
|
||||
public void CompleteUsernamePasswordRequest(string username, string password,
|
||||
public void CompleteUsernamePasswordRequest(string id, string username, string password,
|
||||
List<Tuple<string, string>> fields, string totp)
|
||||
{
|
||||
NSDictionary itemData = null;
|
||||
@@ -172,10 +172,10 @@ namespace Bit.iOS.Extension
|
||||
{
|
||||
UIPasteboard.General.String = totp;
|
||||
}
|
||||
CompleteRequest(itemData);
|
||||
CompleteRequest(id, itemData);
|
||||
}
|
||||
|
||||
public void CompleteRequest(NSDictionary itemData)
|
||||
public void CompleteRequest(string id, NSDictionary itemData)
|
||||
{
|
||||
ServiceContainer.Reset();
|
||||
|
||||
@@ -183,6 +183,11 @@ namespace Bit.iOS.Extension
|
||||
var resultsProvider = new NSItemProvider(itemData, UTType.PropertyList);
|
||||
var resultsItem = new NSExtensionItem { Attachments = new NSItemProvider[] { resultsProvider } };
|
||||
var returningItems = new NSExtensionItem[] { resultsItem };
|
||||
if(!string.IsNullOrWhiteSpace(id) && itemData != null)
|
||||
{
|
||||
var eventService = ServiceContainer.Resolve<IEventService>("eventService");
|
||||
var task = eventService.CollectAsync(Bit.Core.Enums.EventType.Cipher_ClientAutofilled, id);
|
||||
}
|
||||
NSRunLoop.Main.BeginInvokeOnMainThread(() => ExtensionContext?.CompleteRequest(returningItems, null));
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Bit.iOS.Extension
|
||||
public override UIBarButtonItem BaseCancelButton => CancelButton;
|
||||
public override UIBarButtonItem BaseSubmitButton => SubmitButton;
|
||||
public override Action Success => () => LoadingController.DismissLockAndContinue();
|
||||
public override Action Cancel => () => LoadingController.CompleteRequest(null);
|
||||
public override Action Cancel => () => LoadingController.CompleteRequest(null, null);
|
||||
|
||||
public override void ViewDidLoad()
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Bit.iOS.Extension
|
||||
CancelBarButton.TintColor = ThemeHelpers.NavBarTextColor;
|
||||
}
|
||||
|
||||
public override Action Success => () =>
|
||||
public override Action<string> Success => id =>
|
||||
{
|
||||
if(LoginListController != null)
|
||||
{
|
||||
@@ -33,7 +33,7 @@ namespace Bit.iOS.Extension
|
||||
}
|
||||
else if(LoadingController != null)
|
||||
{
|
||||
LoadingController.CompleteUsernamePasswordRequest(UsernameCell.TextField.Text,
|
||||
LoadingController.CompleteUsernamePasswordRequest(id, UsernameCell.TextField.Text,
|
||||
PasswordCell.TextField.Text, null, null);
|
||||
}
|
||||
};
|
||||
@@ -46,7 +46,7 @@ namespace Bit.iOS.Extension
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadingController.CompleteRequest(null);
|
||||
LoadingController.CompleteRequest(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Bit.iOS.Extension
|
||||
|
||||
partial void CancelBarButton_Activated(UIBarButtonItem sender)
|
||||
{
|
||||
LoadingController.CompleteRequest(null);
|
||||
LoadingController.CompleteRequest(null, null);
|
||||
}
|
||||
|
||||
partial void AddBarButton_Activated(UIBarButtonItem sender)
|
||||
@@ -110,7 +110,7 @@ namespace Bit.iOS.Extension
|
||||
var item = Items.ElementAt(indexPath.Row);
|
||||
if(item == null)
|
||||
{
|
||||
_controller.LoadingController.CompleteRequest(null);
|
||||
_controller.LoadingController.CompleteRequest(null, null);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace Bit.iOS.Extension
|
||||
totp = GetTotpAsync(item).GetAwaiter().GetResult();
|
||||
}
|
||||
_controller.LoadingController.CompleteUsernamePasswordRequest(
|
||||
item.Username, item.Password, item.Fields, totp);
|
||||
item.Id, item.Username, item.Password, item.Fields, totp);
|
||||
}
|
||||
else if(!string.IsNullOrWhiteSpace(item.Username) || !string.IsNullOrWhiteSpace(item.Password) ||
|
||||
!string.IsNullOrWhiteSpace(item.Totp))
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Bit.iOS.Extension
|
||||
|
||||
partial void BackButton_Activated(UIBarButtonItem sender)
|
||||
{
|
||||
LoadingController.CompleteRequest(null);
|
||||
LoadingController.CompleteRequest(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user