Skip to content

Commit

Permalink
AGD-2857 : cache adp analytics optin (#13678) (#13685)
Browse files Browse the repository at this point in the history
* cache adp analytics optin

* add comment

Co-authored-by: Bogdan Zavu <bogdan.zavu@autodesk.com>

Co-authored-by: Bogdan Zavu <bogdan.zavu@autodesk.com>
(cherry picked from commit 806231e)

# Conflicts:
#	src/DynamoCore/Configuration/PreferenceSettings.cs
  • Loading branch information
BogdanZavu authored and twastvedt committed Oct 18, 2024
1 parent 46988c1 commit e1ec900
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
16 changes: 15 additions & 1 deletion src/DynamoCore/Configuration/PreferenceSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public class PreferenceSettings : NotificationObject, IPreferences, IRenderPreci
private bool isBackgroundGridVisible;
private bool disableTrustWarnings = false;
private bool isNotificationCenterEnabled;
private bool isADPChecked = false;
private bool isADPOptedIn = false;

#region Constants
/// <summary>
/// Indicates the maximum number of files shown in Recent Files
Expand Down Expand Up @@ -77,12 +80,23 @@ public class PreferenceSettings : NotificationObject, IPreferences, IRenderPreci

/// <summary>
/// Indicates whether ADP analytics reporting is approved or not.
/// Note that this property is called often and the inner call to IsADPOptinIn can be slow sometimes
/// especially when there is an error involved. And therefore we will only check this once per instance.
/// </summary>
[XmlIgnore]
[Obsolete("Setter is obsolete - ADP consent should not be set directly, it should be set using the consent dialog.")]
public bool IsADPAnalyticsReportingApproved
{
get { return Logging.AnalyticsService.IsADPOptedIn; }
get
{
if (!isADPChecked)
{
isADPChecked = true;
isADPOptedIn = AnalyticsService.IsADPOptedIn;
}

return isADPOptedIn;
}
set { throw new Exception("do not use"); }
}
#endregion
Expand Down
6 changes: 3 additions & 3 deletions src/DynamoCore/Logging/AnalyticsService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Dynamo.Graph.Workspaces;
using Dynamo.Graph.Workspaces;
using Dynamo.Models;
using Analytics.NET.ADP;
using Autodesk.Analytics.Core;
Expand Down Expand Up @@ -66,7 +66,7 @@ internal static bool IsADPOptedIn
{
return false;
}
return adpAnalyticsUI.IsOptedIn(150,200);
return adpAnalyticsUI.IsOptedIn(5,500);
}

set
Expand Down Expand Up @@ -121,4 +121,4 @@ internal static string GetUserIDForSession()
return null;
}
}
}
}

0 comments on commit e1ec900

Please sign in to comment.