1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-12-26 16:57:59 +01:00

fix analytics for autofill events

This commit is contained in:
Kyle Spearrin 2018-09-20 23:02:53 -04:00
parent f57db917d1
commit cc9a4a288a
6 changed files with 37 additions and 10 deletions

View File

@ -17,6 +17,7 @@ namespace Bit.iOS.Autofill
public override Action Success => () => public override Action Success => () =>
{ {
_googleAnalyticsService.TrackAutofillExtensionEvent("CreatedLogin");
LoginListController?.DismissModal(); LoginListController?.DismissModal();
}; };

View File

@ -5,7 +5,7 @@ namespace Bit.iOS.Autofill
{ {
public partial class PasswordGeneratorViewController : Core.Controllers.PasswordGeneratorViewController public partial class PasswordGeneratorViewController : Core.Controllers.PasswordGeneratorViewController
{ {
public PasswordGeneratorViewController(IntPtr handle) : base(handle) public PasswordGeneratorViewController(IntPtr handle) : base(handle, true)
{ } { }
public LoginAddViewController Parent { get; set; } public LoginAddViewController Parent { get; set; }

View File

@ -22,10 +22,12 @@ namespace Bit.iOS.Core.Controllers
private IFolderService _folderService; private IFolderService _folderService;
private IConnectivity _connectivity; private IConnectivity _connectivity;
private IEnumerable<Folder> _folders; private IEnumerable<Folder> _folders;
private IGoogleAnalyticsService _googleAnalyticsService; protected IGoogleAnalyticsService _googleAnalyticsService;
private bool _isAutofill;
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);
@ -171,7 +173,6 @@ namespace Bit.iOS.Core.Controllers
await loadingAlert.DismissViewControllerAsync(true); await loadingAlert.DismissViewControllerAsync(true);
if(saveTask.Result.Succeeded) if(saveTask.Result.Succeeded)
{ {
_googleAnalyticsService.TrackExtensionEvent("CreatedLogin");
Success(); Success();
} }
else if(saveTask.Result.Errors.Count() > 0) else if(saveTask.Result.Errors.Count() > 0)

View File

@ -17,9 +17,12 @@ namespace Bit.iOS.Core.Controllers
{ {
private IPasswordGenerationService _passwordGenerationService; private IPasswordGenerationService _passwordGenerationService;
private ISettings _settings; private ISettings _settings;
private bool _isAutofill;
public PasswordGeneratorViewController(IntPtr handle) : base(handle) public PasswordGeneratorViewController(IntPtr handle, bool autofill) : base(handle)
{ } {
_isAutofill = autofill;
}
protected IGoogleAnalyticsService GoogleAnalyticsService { get; private set; } protected IGoogleAnalyticsService GoogleAnalyticsService { get; private set; }
public UITableViewController OptionsTableViewController { get; set; } public UITableViewController OptionsTableViewController { get; set; }
@ -146,7 +149,14 @@ namespace Bit.iOS.Core.Controllers
} }
GeneratePassword(); GeneratePassword();
GoogleAnalyticsService.TrackExtensionEvent("GeneratedPassword"); if(_isAutofill)
{
GoogleAnalyticsService.TrackAutofillExtensionEvent("GeneratedPassword");
}
else
{
GoogleAnalyticsService.TrackExtensionEvent("GeneratedPassword");
}
base.ViewDidLoad(); base.ViewDidLoad();
} }
@ -304,12 +314,26 @@ namespace Bit.iOS.Core.Controllers
{ {
if(indexPath.Row == 0) if(indexPath.Row == 0)
{ {
_controller.GoogleAnalyticsService.TrackExtensionEvent("RegeneratedPassword"); if(_controller._isAutofill)
{
_controller.GoogleAnalyticsService.TrackAutofillExtensionEvent("RegeneratedPassword");
}
else
{
_controller.GoogleAnalyticsService.TrackExtensionEvent("RegeneratedPassword");
}
_controller.GeneratePassword(); _controller.GeneratePassword();
} }
else if(indexPath.Row == 1) else if(indexPath.Row == 1)
{ {
_controller.GoogleAnalyticsService.TrackExtensionEvent("CopiedGeneratedPassword"); if(_controller._isAutofill)
{
_controller.GoogleAnalyticsService.TrackAutofillExtensionEvent("CopiedGeneratedPassword");
}
else
{
_controller.GoogleAnalyticsService.TrackExtensionEvent("CopiedGeneratedPassword");
}
UIPasteboard clipboard = UIPasteboard.General; UIPasteboard clipboard = UIPasteboard.General;
clipboard.String = _controller.BasePasswordLabel.Text; clipboard.String = _controller.BasePasswordLabel.Text;
var alert = Dialogs.CreateMessageAlert(AppResources.Copied); var alert = Dialogs.CreateMessageAlert(AppResources.Copied);

View File

@ -18,6 +18,7 @@ namespace Bit.iOS.Extension
public override Action Success => () => public override Action Success => () =>
{ {
_googleAnalyticsService.TrackExtensionEvent("CreatedLogin");
if(LoginListController != null) if(LoginListController != null)
{ {
LoginListController.DismissModal(); LoginListController.DismissModal();

View File

@ -5,7 +5,7 @@ namespace Bit.iOS.Extension
{ {
public partial class PasswordGeneratorViewController : Core.Controllers.PasswordGeneratorViewController public partial class PasswordGeneratorViewController : Core.Controllers.PasswordGeneratorViewController
{ {
public PasswordGeneratorViewController(IntPtr handle) : base(handle) public PasswordGeneratorViewController(IntPtr handle) : base(handle, false)
{ } { }
public LoginAddViewController Parent { get; set; } public LoginAddViewController Parent { get; set; }