mirror of
https://github.com/bitwarden/android.git
synced 2024-12-19 15:52:29 +03:00
Instrumented key events in extension
This commit is contained in:
parent
a831c9ac4f
commit
561c972c96
6 changed files with 40 additions and 5 deletions
|
@ -36,12 +36,25 @@ namespace Bit.Android.Services
|
|||
_setUserId = true;
|
||||
}
|
||||
|
||||
public void TrackEvent(string category, string eventName)
|
||||
public void TrackAppEvent(string eventName, string label = null)
|
||||
{
|
||||
TrackEvent("App", eventName, label);
|
||||
}
|
||||
|
||||
public void TrackExtensionEvent(string eventName, string label = null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public void TrackEvent(string category, string eventName, string label = null)
|
||||
{
|
||||
var builder = new HitBuilders.EventBuilder();
|
||||
builder.SetCategory(category);
|
||||
builder.SetAction(eventName);
|
||||
builder.SetLabel("AppEvent");
|
||||
if(label != null)
|
||||
{
|
||||
builder.SetLabel(label);
|
||||
}
|
||||
|
||||
SetUserId();
|
||||
_tracker.Send(builder.Build());
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
{
|
||||
void RefreshUserId();
|
||||
void TrackPage(string pageName);
|
||||
void TrackEvent(string category, string eventName);
|
||||
void TrackAppEvent(string eventName, string label = null);
|
||||
void TrackExtensionEvent(string eventName, string label = null);
|
||||
void TrackEvent(string category, string eventName, string label = null);
|
||||
void TrackException(string message, bool fatal);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,10 +28,20 @@ namespace Bit.iOS.Core.Services
|
|||
_setUserId = true;
|
||||
}
|
||||
|
||||
public void TrackEvent(string category, string eventName)
|
||||
public void TrackAppEvent(string eventName, string label = null)
|
||||
{
|
||||
TrackEvent("App", eventName, label);
|
||||
}
|
||||
|
||||
public void TrackExtensionEvent(string eventName, string label = null)
|
||||
{
|
||||
TrackEvent("Extension", eventName, label);
|
||||
}
|
||||
|
||||
public void TrackEvent(string category, string eventName, string label = null)
|
||||
{
|
||||
SetUserId();
|
||||
var dict = DictionaryBuilder.CreateEvent(category, eventName, "AppEvent", null).Build();
|
||||
var dict = DictionaryBuilder.CreateEvent(category, eventName, label, null).Build();
|
||||
_tracker.Send(dict);
|
||||
Gai.SharedInstance.Dispatch();
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace Bit.iOS.Extension
|
|||
private bool _setupHockeyApp = false;
|
||||
private readonly JsonSerializerSettings _jsonSettings =
|
||||
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
|
||||
private IGoogleAnalyticsService _googleAnalyticsService;
|
||||
|
||||
public LoadingViewController(IntPtr handle) : base(handle)
|
||||
{ }
|
||||
|
@ -36,6 +37,7 @@ namespace Bit.iOS.Extension
|
|||
public override void ViewDidLoad()
|
||||
{
|
||||
base.ViewDidLoad();
|
||||
_googleAnalyticsService = Resolver.Resolve<IGoogleAnalyticsService>();
|
||||
View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);
|
||||
_context.ExtContext = ExtensionContext;
|
||||
|
||||
|
@ -293,6 +295,8 @@ namespace Bit.iOS.Extension
|
|||
var dict = list as NSDictionary;
|
||||
action(dict);
|
||||
|
||||
_googleAnalyticsService.TrackExtensionEvent("ProviderType", type);
|
||||
|
||||
Debug.WriteLine("BW LOG, ProviderType: " + _context.ProviderType);
|
||||
Debug.WriteLine("BW LOG, Url: " + _context.Url);
|
||||
Debug.WriteLine("BW LOG, Title: " + _context.SiteTitle);
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace Bit.iOS.Extension
|
|||
{
|
||||
private IPasswordGenerationService _passwordGenerationService;
|
||||
private ISettings _settings;
|
||||
private IGoogleAnalyticsService _googleAnalyticsService;
|
||||
|
||||
public PasswordGeneratorViewController(IntPtr handle) : base(handle)
|
||||
{ }
|
||||
|
@ -44,6 +45,7 @@ namespace Bit.iOS.Extension
|
|||
{
|
||||
_passwordGenerationService = Resolver.Resolve<IPasswordGenerationService>();
|
||||
_settings = Resolver.Resolve<ISettings>();
|
||||
_googleAnalyticsService = Resolver.Resolve<IGoogleAnalyticsService>();
|
||||
|
||||
View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);
|
||||
|
||||
|
@ -171,6 +173,7 @@ namespace Bit.iOS.Extension
|
|||
|
||||
private void GeneratePassword()
|
||||
{
|
||||
_googleAnalyticsService.TrackExtensionEvent("GeneratePassword");
|
||||
PasswordLabel.Text = _passwordGenerationService.GeneratePassword(
|
||||
length: LengthCell.Value,
|
||||
uppercase: UppercaseCell.Switch.On,
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace Bit.iOS.Extension
|
|||
private IFolderService _folderService;
|
||||
private IConnectivity _connectivity;
|
||||
private IEnumerable<Folder> _folders;
|
||||
private IGoogleAnalyticsService _googleAnalyticsService;
|
||||
|
||||
public SiteAddViewController(IntPtr handle) : base(handle)
|
||||
{ }
|
||||
|
@ -51,6 +52,7 @@ namespace Bit.iOS.Extension
|
|||
_siteService = Resolver.Resolve<ISiteService>();
|
||||
_connectivity = Resolver.Resolve<IConnectivity>();
|
||||
_folderService = Resolver.Resolve<IFolderService>();
|
||||
_googleAnalyticsService = Resolver.Resolve<IGoogleAnalyticsService>();
|
||||
|
||||
View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);
|
||||
|
||||
|
@ -164,6 +166,7 @@ namespace Bit.iOS.Extension
|
|||
|
||||
if(saveTask.Result.Succeeded)
|
||||
{
|
||||
_googleAnalyticsService.TrackExtensionEvent("SiteCreated");
|
||||
if(SiteListController != null)
|
||||
{
|
||||
SiteListController.DismissModal();
|
||||
|
|
Loading…
Reference in a new issue