Updated generatedpassword events so that slider changing doesn't spam the event

This commit is contained in:
Kyle Spearrin 2016-08-04 00:44:53 -04:00
parent c93eb2eda7
commit fef77e94a4
2 changed files with 7 additions and 9 deletions

View File

@ -110,6 +110,7 @@ namespace Bit.App.Pages
{ {
var selectToolBarItem = new ToolbarItem("Select", null, async () => var selectToolBarItem = new ToolbarItem("Select", null, async () =>
{ {
_googleAnalyticsService.TrackAppEvent("SelectedGeneratedPassword");
_passwordValueAction(Password.Text); _passwordValueAction(Password.Text);
await Navigation.PopModalAsync(); await Navigation.PopModalAsync();
}, ToolbarItemOrder.Default, 0); }, ToolbarItemOrder.Default, 0);
@ -130,13 +131,14 @@ namespace Bit.App.Pages
protected override void OnAppearing() protected override void OnAppearing()
{ {
base.OnAppearing(); base.OnAppearing();
GeneratePassword(); Model.Password = _passwordGenerationService.GeneratePassword();
Model.Length = _settings.GetValueOrDefault(Constants.PasswordGeneratorLength, 10).ToString(); Model.Length = _settings.GetValueOrDefault(Constants.PasswordGeneratorLength, 10).ToString();
} }
private void RegenerateCell_Tapped(object sender, EventArgs e) private void RegenerateCell_Tapped(object sender, EventArgs e)
{ {
GeneratePassword(); Model.Password = _passwordGenerationService.GeneratePassword();
_googleAnalyticsService.TrackAppEvent("RegeneratedPassword");
} }
private void CopyCell_Tapped(object sender, EventArgs e) private void CopyCell_Tapped(object sender, EventArgs e)
@ -149,12 +151,6 @@ namespace Bit.App.Pages
Navigation.PushAsync(new ToolsPasswordGeneratorSettingsPage()); Navigation.PushAsync(new ToolsPasswordGeneratorSettingsPage());
} }
private void GeneratePassword()
{
_googleAnalyticsService.TrackAppEvent("GeneratedPassword");
Model.Password = _passwordGenerationService.GeneratePassword();
}
private void CopyPassword() private void CopyPassword()
{ {
_googleAnalyticsService.TrackAppEvent("CopiedGeneratedPassword"); _googleAnalyticsService.TrackAppEvent("CopiedGeneratedPassword");

View File

@ -160,6 +160,7 @@ namespace Bit.iOS.Extension
partial void SelectBarButton_Activated(UIBarButtonItem sender) partial void SelectBarButton_Activated(UIBarButtonItem sender)
{ {
_googleAnalyticsService.TrackExtensionEvent("SelectedGeneratedPassword");
DismissViewController(true, () => DismissViewController(true, () =>
{ {
Parent.PasswordCell.TextField.Text = PasswordLabel.Text; Parent.PasswordCell.TextField.Text = PasswordLabel.Text;
@ -173,7 +174,6 @@ namespace Bit.iOS.Extension
private void GeneratePassword() private void GeneratePassword()
{ {
_googleAnalyticsService.TrackExtensionEvent("GeneratePassword");
PasswordLabel.Text = _passwordGenerationService.GeneratePassword( PasswordLabel.Text = _passwordGenerationService.GeneratePassword(
length: LengthCell.Value, length: LengthCell.Value,
uppercase: UppercaseCell.Switch.On, uppercase: UppercaseCell.Switch.On,
@ -311,10 +311,12 @@ namespace Bit.iOS.Extension
{ {
if(indexPath.Row == 0) if(indexPath.Row == 0)
{ {
_controller._googleAnalyticsService.TrackExtensionEvent("RegeneratedPassword");
_controller.GeneratePassword(); _controller.GeneratePassword();
} }
else if(indexPath.Row == 1) else if(indexPath.Row == 1)
{ {
_controller._googleAnalyticsService.TrackExtensionEvent("CopiedGeneratedPassword");
UIPasteboard clipboard = UIPasteboard.General; UIPasteboard clipboard = UIPasteboard.General;
clipboard.String = _controller.PasswordLabel.Text; clipboard.String = _controller.PasswordLabel.Text;
var alert = Dialogs.CreateMessageAlert("Copied!"); var alert = Dialogs.CreateMessageAlert("Copied!");