From 7ba4baa5ce602c2502fca4470e47628f8be196fa Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 4 Aug 2016 00:32:37 -0400 Subject: [PATCH] Tracked a few events in the main app. --- src/App/App.cs | 1 + src/App/Pages/LoginPage.cs | 1 + src/App/Pages/RegisterPage.cs | 3 +++ src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs | 15 ++++++++++++--- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/App/App.cs b/src/App/App.cs index 14ce606d9..c63532789 100644 --- a/src/App/App.cs +++ b/src/App/App.cs @@ -184,6 +184,7 @@ namespace Bit.App private void Logout(string logoutMessage) { _authService.LogOut(); + _googleAnalyticsService.TrackAppEvent("LoggedOut"); _googleAnalyticsService.RefreshUserId(); _pushNotification.Unregister(); Current.MainPage = new HomePage(); diff --git a/src/App/Pages/LoginPage.cs b/src/App/Pages/LoginPage.cs index a598fae25..9033d646e 100644 --- a/src/App/Pages/LoginPage.cs +++ b/src/App/Pages/LoginPage.cs @@ -181,6 +181,7 @@ namespace Bit.App.Pages _authService.Email = response.Result?.Profile?.Email; _settings.AddOrUpdateValue(Constants.SettingLastLoginEmail, _authService.Email); _googleAnalyticsService.RefreshUserId(); + _googleAnalyticsService.TrackAppEvent("LoggedIn"); if(_authService.IsAuthenticatedTwoFactor) { diff --git a/src/App/Pages/RegisterPage.cs b/src/App/Pages/RegisterPage.cs index 4744ecc3a..7d0e08085 100644 --- a/src/App/Pages/RegisterPage.cs +++ b/src/App/Pages/RegisterPage.cs @@ -16,12 +16,14 @@ namespace Bit.App.Pages private ICryptoService _cryptoService; private IUserDialogs _userDialogs; private IAccountsApiRepository _accountsApiRepository; + private IGoogleAnalyticsService _googleAnalyticsService; public RegisterPage() { _cryptoService = Resolver.Resolve(); _userDialogs = Resolver.Resolve(); _accountsApiRepository = Resolver.Resolve(); + _googleAnalyticsService = Resolver.Resolve(); Init(); } @@ -183,6 +185,7 @@ namespace Bit.App.Pages } _userDialogs.Toast("Your new account has been created! You may now log in."); + _googleAnalyticsService.TrackAppEvent("Registered"); await Navigation.PopModalAsync(); } diff --git a/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs b/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs index 4d2e07bf6..c30a951a5 100644 --- a/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs +++ b/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs @@ -16,6 +16,7 @@ namespace Bit.App.Pages private readonly IPasswordGenerationService _passwordGenerationService; private readonly ISettings _settings; private readonly IClipboardService _clipboardService; + private readonly IGoogleAnalyticsService _googleAnalyticsService; private readonly Action _passwordValueAction; public ToolsPasswordGeneratorPage(Action passwordValueAction = null) @@ -24,6 +25,7 @@ namespace Bit.App.Pages _passwordGenerationService = Resolver.Resolve(); _settings = Resolver.Resolve(); _clipboardService = Resolver.Resolve(); + _googleAnalyticsService = Resolver.Resolve(); _passwordValueAction = passwordValueAction; Init(); @@ -127,14 +129,14 @@ namespace Bit.App.Pages protected override void OnAppearing() { - Model.Password = _passwordGenerationService.GeneratePassword(); - Model.Length = _settings.GetValueOrDefault(Constants.PasswordGeneratorLength, 10).ToString(); base.OnAppearing(); + GeneratePassword(); + Model.Length = _settings.GetValueOrDefault(Constants.PasswordGeneratorLength, 10).ToString(); } private void RegenerateCell_Tapped(object sender, EventArgs e) { - Model.Password = _passwordGenerationService.GeneratePassword(); + GeneratePassword(); } private void CopyCell_Tapped(object sender, EventArgs e) @@ -147,8 +149,15 @@ namespace Bit.App.Pages Navigation.PushAsync(new ToolsPasswordGeneratorSettingsPage()); } + private void GeneratePassword() + { + _googleAnalyticsService.TrackAppEvent("GeneratedPassword"); + Model.Password = _passwordGenerationService.GeneratePassword(); + } + private void CopyPassword() { + _googleAnalyticsService.TrackAppEvent("CopiedGeneratedPassword"); _clipboardService.CopyToClipboard(Password.Text); _userDialogs.Toast(string.Format(AppResources.ValueHasBeenCopied, AppResources.Password)); }