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 () =>
{
_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");

View File

@ -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!");