mirror of
https://github.com/bitwarden/mobile
synced 2025-12-12 14:23:26 +00:00
* Opt-out of Google Analytics * Move OptOut to Other in Settings * Change OptOut Order and Resource key
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user