1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-12-25 16:47:55 +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 => () =>
{
_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();
if(_isAutofill)
{
GoogleAnalyticsService.TrackAutofillExtensionEvent("GeneratedPassword");
}
else
{
GoogleAnalyticsService.TrackExtensionEvent("GeneratedPassword");
}
base.ViewDidLoad();
}
@ -303,13 +313,27 @@ namespace Bit.iOS.Core.Controllers
if(indexPath.Section == 0)
{
if(indexPath.Row == 0)
{
if(_controller._isAutofill)
{
_controller.GoogleAnalyticsService.TrackAutofillExtensionEvent("RegeneratedPassword");
}
else
{
_controller.GoogleAnalyticsService.TrackExtensionEvent("RegeneratedPassword");
}
_controller.GeneratePassword();
}
else if(indexPath.Row == 1)
{
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; }