From fef77e94a48b55b7dc24aea20091329f651f1e4a Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 4 Aug 2016 00:44:53 -0400 Subject: [PATCH] Updated generatedpassword events so that slider changing doesn't spam the event --- src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs | 12 ++++-------- src/iOS.Extension/PasswordGeneratorViewController.cs | 4 +++- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs b/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs index c30a951a5..92c0354b3 100644 --- a/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs +++ b/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs @@ -110,6 +110,7 @@ namespace Bit.App.Pages { var selectToolBarItem = new ToolbarItem("Select", null, async () => { + _googleAnalyticsService.TrackAppEvent("SelectedGeneratedPassword"); _passwordValueAction(Password.Text); await Navigation.PopModalAsync(); }, ToolbarItemOrder.Default, 0); @@ -130,13 +131,14 @@ namespace Bit.App.Pages protected override void OnAppearing() { base.OnAppearing(); - GeneratePassword(); + Model.Password = _passwordGenerationService.GeneratePassword(); Model.Length = _settings.GetValueOrDefault(Constants.PasswordGeneratorLength, 10).ToString(); } private void RegenerateCell_Tapped(object sender, EventArgs e) { - GeneratePassword(); + Model.Password = _passwordGenerationService.GeneratePassword(); + _googleAnalyticsService.TrackAppEvent("RegeneratedPassword"); } private void CopyCell_Tapped(object sender, EventArgs e) @@ -149,12 +151,6 @@ namespace Bit.App.Pages Navigation.PushAsync(new ToolsPasswordGeneratorSettingsPage()); } - private void GeneratePassword() - { - _googleAnalyticsService.TrackAppEvent("GeneratedPassword"); - Model.Password = _passwordGenerationService.GeneratePassword(); - } - private void CopyPassword() { _googleAnalyticsService.TrackAppEvent("CopiedGeneratedPassword"); diff --git a/src/iOS.Extension/PasswordGeneratorViewController.cs b/src/iOS.Extension/PasswordGeneratorViewController.cs index 300e47469..1e801a318 100644 --- a/src/iOS.Extension/PasswordGeneratorViewController.cs +++ b/src/iOS.Extension/PasswordGeneratorViewController.cs @@ -160,6 +160,7 @@ namespace Bit.iOS.Extension partial void SelectBarButton_Activated(UIBarButtonItem sender) { + _googleAnalyticsService.TrackExtensionEvent("SelectedGeneratedPassword"); DismissViewController(true, () => { Parent.PasswordCell.TextField.Text = PasswordLabel.Text; @@ -173,7 +174,6 @@ namespace Bit.iOS.Extension private void GeneratePassword() { - _googleAnalyticsService.TrackExtensionEvent("GeneratePassword"); PasswordLabel.Text = _passwordGenerationService.GeneratePassword( length: LengthCell.Value, uppercase: UppercaseCell.Switch.On, @@ -311,10 +311,12 @@ namespace Bit.iOS.Extension { if(indexPath.Row == 0) { + _controller._googleAnalyticsService.TrackExtensionEvent("RegeneratedPassword"); _controller.GeneratePassword(); } else if(indexPath.Row == 1) { + _controller._googleAnalyticsService.TrackExtensionEvent("CopiedGeneratedPassword"); UIPasteboard clipboard = UIPasteboard.General; clipboard.String = _controller.PasswordLabel.Text; var alert = Dialogs.CreateMessageAlert("Copied!");