1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-12 14:23:26 +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,6 +1,7 @@
using System;
using Bit.App.Abstractions;
using Google.Analytics;
using Plugin.Settings.Abstractions;
namespace Bit.iOS.Core.Services
{
@@ -12,7 +13,8 @@ namespace Bit.iOS.Core.Services
public GoogleAnalyticsService(
IAppIdService appIdService,
IAuthService authService)
IAuthService authService,
ISettings settings)
{
_authService = authService;
@@ -21,6 +23,9 @@ namespace Bit.iOS.Core.Services
_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 RefreshUserId()
@@ -78,5 +83,10 @@ namespace Bit.iOS.Core.Services
_setUserId = false;
}
}
public void SetAppOptOut(bool optOut)
{
Gai.SharedInstance.OptOut = optOut;
}
}
}