Tracked a few events in the main app.

This commit is contained in:
Kyle Spearrin 2016-08-04 00:32:37 -04:00
parent 561c972c96
commit 7ba4baa5ce
4 changed files with 17 additions and 3 deletions

View file

@ -184,6 +184,7 @@ namespace Bit.App
private void Logout(string logoutMessage) private void Logout(string logoutMessage)
{ {
_authService.LogOut(); _authService.LogOut();
_googleAnalyticsService.TrackAppEvent("LoggedOut");
_googleAnalyticsService.RefreshUserId(); _googleAnalyticsService.RefreshUserId();
_pushNotification.Unregister(); _pushNotification.Unregister();
Current.MainPage = new HomePage(); Current.MainPage = new HomePage();

View file

@ -181,6 +181,7 @@ namespace Bit.App.Pages
_authService.Email = response.Result?.Profile?.Email; _authService.Email = response.Result?.Profile?.Email;
_settings.AddOrUpdateValue(Constants.SettingLastLoginEmail, _authService.Email); _settings.AddOrUpdateValue(Constants.SettingLastLoginEmail, _authService.Email);
_googleAnalyticsService.RefreshUserId(); _googleAnalyticsService.RefreshUserId();
_googleAnalyticsService.TrackAppEvent("LoggedIn");
if(_authService.IsAuthenticatedTwoFactor) if(_authService.IsAuthenticatedTwoFactor)
{ {

View file

@ -16,12 +16,14 @@ namespace Bit.App.Pages
private ICryptoService _cryptoService; private ICryptoService _cryptoService;
private IUserDialogs _userDialogs; private IUserDialogs _userDialogs;
private IAccountsApiRepository _accountsApiRepository; private IAccountsApiRepository _accountsApiRepository;
private IGoogleAnalyticsService _googleAnalyticsService;
public RegisterPage() public RegisterPage()
{ {
_cryptoService = Resolver.Resolve<ICryptoService>(); _cryptoService = Resolver.Resolve<ICryptoService>();
_userDialogs = Resolver.Resolve<IUserDialogs>(); _userDialogs = Resolver.Resolve<IUserDialogs>();
_accountsApiRepository = Resolver.Resolve<IAccountsApiRepository>(); _accountsApiRepository = Resolver.Resolve<IAccountsApiRepository>();
_googleAnalyticsService = Resolver.Resolve<IGoogleAnalyticsService>();
Init(); Init();
} }
@ -183,6 +185,7 @@ namespace Bit.App.Pages
} }
_userDialogs.Toast("Your new account has been created! You may now log in."); _userDialogs.Toast("Your new account has been created! You may now log in.");
_googleAnalyticsService.TrackAppEvent("Registered");
await Navigation.PopModalAsync(); await Navigation.PopModalAsync();
} }

View file

@ -16,6 +16,7 @@ namespace Bit.App.Pages
private readonly IPasswordGenerationService _passwordGenerationService; private readonly IPasswordGenerationService _passwordGenerationService;
private readonly ISettings _settings; private readonly ISettings _settings;
private readonly IClipboardService _clipboardService; private readonly IClipboardService _clipboardService;
private readonly IGoogleAnalyticsService _googleAnalyticsService;
private readonly Action<string> _passwordValueAction; private readonly Action<string> _passwordValueAction;
public ToolsPasswordGeneratorPage(Action<string> passwordValueAction = null) public ToolsPasswordGeneratorPage(Action<string> passwordValueAction = null)
@ -24,6 +25,7 @@ namespace Bit.App.Pages
_passwordGenerationService = Resolver.Resolve<IPasswordGenerationService>(); _passwordGenerationService = Resolver.Resolve<IPasswordGenerationService>();
_settings = Resolver.Resolve<ISettings>(); _settings = Resolver.Resolve<ISettings>();
_clipboardService = Resolver.Resolve<IClipboardService>(); _clipboardService = Resolver.Resolve<IClipboardService>();
_googleAnalyticsService = Resolver.Resolve<IGoogleAnalyticsService>();
_passwordValueAction = passwordValueAction; _passwordValueAction = passwordValueAction;
Init(); Init();
@ -127,14 +129,14 @@ namespace Bit.App.Pages
protected override void OnAppearing() protected override void OnAppearing()
{ {
Model.Password = _passwordGenerationService.GeneratePassword();
Model.Length = _settings.GetValueOrDefault(Constants.PasswordGeneratorLength, 10).ToString();
base.OnAppearing(); base.OnAppearing();
GeneratePassword();
Model.Length = _settings.GetValueOrDefault(Constants.PasswordGeneratorLength, 10).ToString();
} }
private void RegenerateCell_Tapped(object sender, EventArgs e) private void RegenerateCell_Tapped(object sender, EventArgs e)
{ {
Model.Password = _passwordGenerationService.GeneratePassword(); GeneratePassword();
} }
private void CopyCell_Tapped(object sender, EventArgs e) private void CopyCell_Tapped(object sender, EventArgs e)
@ -147,8 +149,15 @@ 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");
_clipboardService.CopyToClipboard(Password.Text); _clipboardService.CopyToClipboard(Password.Text);
_userDialogs.Toast(string.Format(AppResources.ValueHasBeenCopied, AppResources.Password)); _userDialogs.Toast(string.Format(AppResources.ValueHasBeenCopied, AppResources.Password));
} }