mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 18:08:26 +03:00
remove analytics
This commit is contained in:
parent
7ed015aeb1
commit
5b6becc63f
7 changed files with 2 additions and 86 deletions
|
@ -861,9 +861,6 @@
|
||||||
<PackageReference Include="Xamarin.Firebase.Messaging">
|
<PackageReference Include="Xamarin.Firebase.Messaging">
|
||||||
<Version>60.1142.1</Version>
|
<Version>60.1142.1</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Xamarin.GooglePlayServices.Analytics">
|
|
||||||
<Version>60.1142.1</Version>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="SimpleInjector">
|
<PackageReference Include="SimpleInjector">
|
||||||
<Version>4.4.0</Version>
|
<Version>4.4.0</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|
|
@ -1,88 +1,49 @@
|
||||||
#if !FDROID
|
#if !FDROID
|
||||||
using System;
|
using System;
|
||||||
using Bit.App;
|
|
||||||
using Bit.App.Abstractions;
|
using Bit.App.Abstractions;
|
||||||
using Plugin.Settings.Abstractions;
|
using Plugin.Settings.Abstractions;
|
||||||
using Android.Gms.Analytics;
|
|
||||||
using Android.Content;
|
using Android.Content;
|
||||||
|
|
||||||
namespace Bit.Android.Services
|
namespace Bit.Android.Services
|
||||||
{
|
{
|
||||||
public class GoogleAnalyticsService : IGoogleAnalyticsService
|
public class GoogleAnalyticsService : IGoogleAnalyticsService
|
||||||
{
|
{
|
||||||
private readonly GoogleAnalytics _instance;
|
|
||||||
private readonly Tracker _tracker;
|
|
||||||
|
|
||||||
public GoogleAnalyticsService(
|
public GoogleAnalyticsService(
|
||||||
Context appContext,
|
Context appContext,
|
||||||
IAppIdService appIdService,
|
IAppIdService appIdService,
|
||||||
ISettings settings)
|
ISettings settings)
|
||||||
{
|
{ }
|
||||||
_instance = GoogleAnalytics.GetInstance(appContext.ApplicationContext);
|
|
||||||
_instance.SetLocalDispatchPeriod(10);
|
|
||||||
|
|
||||||
_tracker = _instance.NewTracker("UA-81915606-2");
|
|
||||||
_tracker.EnableExceptionReporting(false);
|
|
||||||
_tracker.EnableAdvertisingIdCollection(true);
|
|
||||||
_tracker.EnableAutoActivityTracking(true);
|
|
||||||
_tracker.SetClientId(appIdService.AnonymousAppId);
|
|
||||||
|
|
||||||
var gaOptOut = settings.GetValueOrDefault(Constants.SettingGaOptOut, false);
|
|
||||||
SetAppOptOut(gaOptOut);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void TrackAppEvent(string eventName, string label = null)
|
public void TrackAppEvent(string eventName, string label = null)
|
||||||
{
|
{
|
||||||
TrackEvent("App", eventName, label);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TrackExtensionEvent(string eventName, string label = null)
|
public void TrackExtensionEvent(string eventName, string label = null)
|
||||||
{
|
{
|
||||||
TrackEvent("AutofillService", eventName, label);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TrackAutofillExtensionEvent(string eventName, string label = null)
|
public void TrackAutofillExtensionEvent(string eventName, string label = null)
|
||||||
{
|
{
|
||||||
TrackExtensionEvent(eventName, label);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TrackEvent(string category, string eventName, string label = null)
|
public void TrackEvent(string category, string eventName, string label = null)
|
||||||
{
|
{
|
||||||
var builder = new HitBuilders.EventBuilder();
|
|
||||||
builder.SetCategory(category);
|
|
||||||
builder.SetAction(eventName);
|
|
||||||
if(label != null)
|
|
||||||
{
|
|
||||||
builder.SetLabel(label);
|
|
||||||
}
|
|
||||||
|
|
||||||
_tracker.Send(builder.Build());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TrackException(string message, bool fatal)
|
public void TrackException(string message, bool fatal)
|
||||||
{
|
{
|
||||||
var builder = new HitBuilders.ExceptionBuilder();
|
|
||||||
builder.SetDescription(message);
|
|
||||||
builder.SetFatal(fatal);
|
|
||||||
|
|
||||||
_tracker.Send(builder.Build());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TrackPage(string pageName)
|
public void TrackPage(string pageName)
|
||||||
{
|
{
|
||||||
_tracker.SetScreenName(pageName);
|
|
||||||
_tracker.Send(new HitBuilders.ScreenViewBuilder().Build());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispatch(Action completionHandler = null)
|
public void Dispatch(Action completionHandler = null)
|
||||||
{
|
{
|
||||||
_instance.DispatchLocalHits();
|
|
||||||
completionHandler?.Invoke();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAppOptOut(bool optOut)
|
public void SetAppOptOut(bool optOut)
|
||||||
{
|
{
|
||||||
_instance.AppOptOut = optOut;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,9 +284,6 @@
|
||||||
<PackageReference Include="SimpleInjector">
|
<PackageReference Include="SimpleInjector">
|
||||||
<Version>4.4.0</Version>
|
<Version>4.4.0</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Xamarin.Google.iOS.Analytics">
|
|
||||||
<Version>3.17.0.1</Version>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="XLabs.IoC.SimpleInjector">
|
<PackageReference Include="XLabs.IoC.SimpleInjector">
|
||||||
<Version>2.0.5782</Version>
|
<Version>2.0.5782</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|
|
@ -1,74 +1,46 @@
|
||||||
using System;
|
using System;
|
||||||
using Bit.App.Abstractions;
|
using Bit.App.Abstractions;
|
||||||
using Google.Analytics;
|
|
||||||
using Plugin.Settings.Abstractions;
|
using Plugin.Settings.Abstractions;
|
||||||
|
|
||||||
namespace Bit.iOS.Core.Services
|
namespace Bit.iOS.Core.Services
|
||||||
{
|
{
|
||||||
public class GoogleAnalyticsService : IGoogleAnalyticsService
|
public class GoogleAnalyticsService : IGoogleAnalyticsService
|
||||||
{
|
{
|
||||||
private readonly ITracker _tracker;
|
|
||||||
|
|
||||||
public GoogleAnalyticsService(
|
public GoogleAnalyticsService(
|
||||||
IAppIdService appIdService,
|
IAppIdService appIdService,
|
||||||
ISettings settings)
|
ISettings settings)
|
||||||
{
|
{}
|
||||||
Gai.SharedInstance.DispatchInterval = 10;
|
|
||||||
Gai.SharedInstance.TrackUncaughtExceptions = false;
|
|
||||||
_tracker = Gai.SharedInstance.GetTracker("UA-81915606-1");
|
|
||||||
_tracker.SetAllowIdfaCollection(true);
|
|
||||||
_tracker.Set(GaiConstants.ClientId, appIdService.AnonymousAppId);
|
|
||||||
|
|
||||||
var gaOptOut = settings.GetValueOrDefault(App.Constants.SettingGaOptOut, false);
|
|
||||||
SetAppOptOut(gaOptOut);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void TrackAppEvent(string eventName, string label = null)
|
public void TrackAppEvent(string eventName, string label = null)
|
||||||
{
|
{
|
||||||
TrackEvent("App", eventName, label);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TrackExtensionEvent(string eventName, string label = null)
|
public void TrackExtensionEvent(string eventName, string label = null)
|
||||||
{
|
{
|
||||||
TrackEvent("Extension", eventName, label);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TrackAutofillExtensionEvent(string eventName, string label = null)
|
public void TrackAutofillExtensionEvent(string eventName, string label = null)
|
||||||
{
|
{
|
||||||
TrackEvent("AutofillExtension", eventName, label);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TrackEvent(string category, string eventName, string label = null)
|
public void TrackEvent(string category, string eventName, string label = null)
|
||||||
{
|
{
|
||||||
var dict = DictionaryBuilder.CreateEvent(category, eventName, label, null).Build();
|
|
||||||
_tracker.Send(dict);
|
|
||||||
Gai.SharedInstance.Dispatch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TrackException(string message, bool fatal)
|
public void TrackException(string message, bool fatal)
|
||||||
{
|
{
|
||||||
var dict = DictionaryBuilder.CreateException(message, fatal).Build();
|
|
||||||
_tracker.Send(dict);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TrackPage(string pageName)
|
public void TrackPage(string pageName)
|
||||||
{
|
{
|
||||||
_tracker.Set(GaiConstants.ScreenName, pageName);
|
|
||||||
var dict = DictionaryBuilder.CreateScreenView().Build();
|
|
||||||
_tracker.Send(dict);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispatch(Action completionHandler = null)
|
public void Dispatch(Action completionHandler = null)
|
||||||
{
|
{
|
||||||
Gai.SharedInstance.Dispatch((result) =>
|
|
||||||
{
|
|
||||||
completionHandler?.Invoke();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAppOptOut(bool optOut)
|
public void SetAppOptOut(bool optOut)
|
||||||
{
|
{
|
||||||
Gai.SharedInstance.OptOut = optOut;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,10 +82,5 @@
|
||||||
<Name>App</Name>
|
<Name>App</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Xamarin.Google.iOS.Analytics">
|
|
||||||
<Version>3.17.0.1</Version>
|
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
|
@ -284,9 +284,6 @@
|
||||||
<PackageReference Include="SimpleInjector">
|
<PackageReference Include="SimpleInjector">
|
||||||
<Version>4.4.0</Version>
|
<Version>4.4.0</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Xamarin.Google.iOS.Analytics">
|
|
||||||
<Version>3.17.0.1</Version>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="XLabs.IoC.SimpleInjector">
|
<PackageReference Include="XLabs.IoC.SimpleInjector">
|
||||||
<Version>2.0.5782</Version>
|
<Version>2.0.5782</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|
|
@ -710,9 +710,6 @@
|
||||||
<PackageReference Include="SimpleInjector">
|
<PackageReference Include="SimpleInjector">
|
||||||
<Version>4.4.0</Version>
|
<Version>4.4.0</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Xamarin.Google.iOS.Analytics">
|
|
||||||
<Version>3.17.0.1</Version>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="XLabs.IoC.SimpleInjector">
|
<PackageReference Include="XLabs.IoC.SimpleInjector">
|
||||||
<Version>2.0.5782</Version>
|
<Version>2.0.5782</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|
Loading…
Reference in a new issue