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>
  • Loading branch information
BogdanZavu and zavub authored Jan 18, 2023
1 parent e7001d8 commit 806231e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
15 changes: 14 additions & 1 deletion src/DynamoCore/Configuration/PreferenceSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public class PreferenceSettings : NotificationObject, IPreferences, IRenderPreci
private bool isNotificationCenterEnabled;
private bool isStaticSplashScreenEnabled;
private bool isCreatedFromValidFile = true;
private bool isADPChecked = false;
private bool isADPOptedIn = false;

#region Constants
/// <summary>
Expand Down Expand Up @@ -110,12 +112,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 Autodesk.Analytics.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 @@ -115,4 +115,4 @@ internal static string GetUserIDForSession()
return null;
}
}
}
}

0 comments on commit 806231e

Please sign in to comment.