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 => () =>
{
_googleAnalyticsService.TrackAutofillExtensionEvent("CreatedLogin");
LoginListController?.DismissModal();
};

View file

@ -5,7 +5,7 @@ namespace Bit.iOS.Autofill
{
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; }

View file

@ -22,10 +22,12 @@ namespace Bit.iOS.Core.Controllers
private IFolderService _folderService;
private IConnectivity _connectivity;
private IEnumerable<Folder> _folders;
private IGoogleAnalyticsService _googleAnalyticsService;
protected IGoogleAnalyticsService _googleAnalyticsService;
private bool _isAutofill;
public LoginAddViewController(IntPtr handle) : base(handle)
{ }
{
}
public AppExtensionContext Context { get; set; }
public FormEntryTableViewCell NameCell { get; set; } = new FormEntryTableViewCell(AppResources.Name);
@ -171,7 +173,6 @@ namespace Bit.iOS.Core.Controllers
await loadingAlert.DismissViewControllerAsync(true);
if(saveTask.Result.Succeeded)
{
_googleAnalyticsService.TrackExtensionEvent("CreatedLogin");
Success();
}
else if(saveTask.Result.Errors.Count() > 0)

View file

@ -17,9 +17,12 @@ namespace Bit.iOS.Core.Controllers
{
private IPasswordGenerationService _passwordGenerationService;
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; }
public UITableViewController OptionsTableViewController { get; set; }
@ -146,7 +149,14 @@ namespace Bit.iOS.Core.Controllers
}
GeneratePassword();
GoogleAnalyticsService.TrackExtensionEvent("GeneratedPassword");
if(_isAutofill)
{
GoogleAnalyticsService.TrackAutofillExtensionEvent("GeneratedPassword");
}
else
{
GoogleAnalyticsService.TrackExtensionEvent("GeneratedPassword");
}
base.ViewDidLoad();
}
@ -304,12 +314,26 @@ namespace Bit.iOS.Core.Controllers
{
if(indexPath.Row == 0)
{
_controller.GoogleAnalyticsService.TrackExtensionEvent("RegeneratedPassword");
if(_controller._isAutofill)
{
_controller.GoogleAnalyticsService.TrackAutofillExtensionEvent("RegeneratedPassword");
}
else
{
_controller.GoogleAnalyticsService.TrackExtensionEvent("RegeneratedPassword");
}
_controller.GeneratePassword();
}
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;
clipboard.String = _controller.BasePasswordLabel.Text;
var alert = Dialogs.CreateMessageAlert(AppResources.Copied);

View file

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

View file

@ -5,7 +5,7 @@ namespace Bit.iOS.Extension
{
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; }