1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-11 13:53:29 +00:00

Fixes #8 Disable Google Analytics (#55)

* Opt-out of Google Analytics

* Move OptOut to Other in Settings

* Change OptOut Order and Resource key
This commit is contained in:
Shan
2017-03-31 03:52:14 +05:30
committed by Kyle Spearrin
parent a45773e1ca
commit fb35b9b10a
7 changed files with 59 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
using System;
using Bit.App;
using Bit.App.Abstractions;
using Plugin.Settings.Abstractions;
using Android.Gms.Analytics;
using Android.Content;
@@ -17,7 +19,8 @@ namespace Bit.Android.Services
public GoogleAnalyticsService(
Context appContext,
IAppIdService appIdService,
IAuthService authService)
IAuthService authService,
ISettings settings)
{
_authService = authService;
@@ -29,6 +32,9 @@ namespace Bit.Android.Services
_tracker.EnableAdvertisingIdCollection(true);
_tracker.EnableAutoActivityTracking(true);
_tracker.SetClientId(appIdService.AnonymousAppId);
var gaOptOut = settings.GetValueOrDefault(Constants.SettingGAOptOut, false);
SetAppOptOut(gaOptOut);
}
public void RefreshUserId()
@@ -92,5 +98,10 @@ namespace Bit.Android.Services
_instance.DispatchLocalHits();
completionHandler?.Invoke();
}
public void SetAppOptOut(bool optOut)
{
_instance.AppOptOut = optOut;
}
}
}