Skip to content

Commit

Permalink
Merge branch 'master' of github.com:DynamoDS/Dynamo into dyn-6394
Browse files Browse the repository at this point in the history
  • Loading branch information
aparajit-pratap committed Nov 22, 2023
2 parents 16d50d4 + 3e97cbd commit 2d96ffd
Show file tree
Hide file tree
Showing 25 changed files with 381 additions and 180 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ui_smoke_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ env:
TEST_EXECUTE_DOWNLOAD_URL: https://downloads.smartbear.com/TestExecute1552SLM.exe
ACTOR: ${{ github.actor }}
WORKFLOW_ID: ${{ github.event.workflow_run.workflow_id }}
RUN_ID: ${{ github.event.workflow_run.id }}
RUN_NAME: ${{ github.event.workflow_run.name }}
RUN_URL: ${{ github.event.workflow_run.html_url }}
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }}
PR_URL: ${{ github.event.workflow_run.pull_requests[0].html_url }}

jobs:
ui_smoke_tests:
name: UI Smoke Tests
timeout-minutes: 60
runs-on: windows-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -38,6 +38,7 @@ jobs:
with:
name: DynamoSandbox
workflow: ${{ env.WORKFLOW_ID }}
run_id: ${{ env.RUN_ID }}
path: ${{ github.workspace }}\build
- name: Run UI Smoke Tests
shell: cmd
Expand All @@ -55,4 +56,3 @@ jobs:
Get-Content summary.md >> $env:GITHUB_STEP_SUMMARY
Write-Output "Actor: @${{ env.ACTOR }}" >> $env:GITHUB_STEP_SUMMARY
Write-Output "Workflow Run: [${{ env.RUN_NAME }}](${{ env.RUN_URL }})" >> $env:GITHUB_STEP_SUMMARY
Write-Output "Pull Request: [${{ env.PR_NUMBER }}](${{ env.PR_URL }})" >> $env:GITHUB_STEP_SUMMARY
4 changes: 2 additions & 2 deletions src/DynamoCLI/CommandLineRunner.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
Expand Down Expand Up @@ -46,7 +46,7 @@ private static XmlDocument RunCommandLineArgs(DynamoModel model, StartupUtils.Co
Console.WriteLine("geometryFilePath option is only available when running DynamoWPFCLI, not DynamoCLI");
}

model.HostAnalyticsInfo = cmdLineArgs.AnalyticsInfo;
DynamoModel.HostAnalyticsInfo = cmdLineArgs.AnalyticsInfo;

cmdLineArgs.ImportedPaths.ToList().ForEach(path =>
{
Expand Down
4 changes: 2 additions & 2 deletions src/DynamoCore/Extensions/ReadyParams.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Dynamo.Graph.Workspaces;
Expand Down Expand Up @@ -78,7 +78,7 @@ public virtual ICommandExecutive CommandExecutive
/// <summary>
/// HostInfo object, Useful to determine what host context Dynamo is running in.
/// </summary>
internal HostAnalyticsInfo HostInfo => dynamoModel.HostAnalyticsInfo;
internal HostAnalyticsInfo HostInfo => DynamoModel.HostAnalyticsInfo;


/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/DynamoCore/Extensions/StartupParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ internal StartupParams(DynamoModel dynamoModel)
pathManager = dynamoModel.PathManager;
libraryLoader = new ExtensionLibraryLoader(dynamoModel);
customNodeManager = dynamoModel.CustomNodeManager;
dynamoVersion = new Version(dynamoModel.Version);
dynamoVersion = new Version(DynamoModel.Version);
preferences = dynamoModel.PreferenceSettings;
linterManager = dynamoModel.LinterManager;
IsGeometryLibraryLoaded = dynamoModel.IsASMLoaded;
Expand Down
47 changes: 15 additions & 32 deletions src/DynamoCore/Logging/AnalyticsService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Dynamo.Graph.Workspaces;
using Dynamo.Models;
using Autodesk.Analytics.ADP;
using Autodesk.Analytics.Core;
Expand All @@ -9,49 +8,29 @@ namespace Dynamo.Logging
/// <summary>
/// Utility class to support analytics tracking.
/// </summary>
class AnalyticsService
internal class AnalyticsService
{
// Use the Analytics.Core interface so that we do not have to load the ADP assembly at this time.
private static IAnalyticsUI adpAnalyticsUI;

/// <summary>
/// Starts the client when DynamoModel is created. This method initializes
/// Indicates that we don't want to shut down analytics when DynamoModel shuts down.
/// Sometimes we want to keep Analytics service running even when we don't have a DynamoModel started.
/// </summary>
internal static bool KeepAlive { get; set; }

/// <summary>
/// Starts the Analytics client. This method initializes
/// the Analytics service and application life cycle start is tracked.
/// </summary>
/// <param name="model">DynamoModel</param>
/// <param name="isHeadless">Analytics won't be started if IsHeadless, but ADP may be loaded to be disabled.</param>
/// <param name="isTestMode">Analytics won't be started if isTestMode, ADP will not be loaded.</param>
internal static void Start(DynamoModel model, bool isHeadless, bool isTestMode)
internal static void Start()
{
if (isTestMode)
{
if (Analytics.DisableAnalytics)
{
model.Logger.Log("Incompatible configuration: [IsTestMode] and [Analytics disabled] ");
}
return;
}

if (isHeadless)
{
return;
}

// Initialize the concrete class only when we initialize the Service.
// This will also load the Analytics.Net.ADP assembly
// We must initialize the ADPAnalyticsUI instance before the Analytics.Start call.
adpAnalyticsUI = new ADPAnalyticsUI();

Analytics.Start(new DynamoAnalyticsClient(model));
model.WorkspaceAdded += OnWorkspaceAdded;
}

static void OnWorkspaceAdded(WorkspaceModel obj)
{
if (obj is CustomNodeWorkspaceModel)
Analytics.TrackScreenView("CustomWorkspace");
else
Analytics.TrackScreenView("Workspace");
Analytics.Start(new DynamoAnalyticsClient(DynamoModel.HostAnalyticsInfo));
}

/// <summary>
Expand Down Expand Up @@ -99,7 +78,10 @@ internal static bool IsADPAvailable()
/// </summary>
internal static void ShutDown()
{
Analytics.ShutDown();
if (!KeepAlive)
{
Analytics.ShutDown();
}
}

/// <summary>
Expand All @@ -113,6 +95,7 @@ internal static void ShowADPConsentDialog(IntPtr? host)
adpAnalyticsUI.ShowOptInDialog(System.Threading.Thread.CurrentThread.CurrentUICulture.Name, false, host);
}
}

internal static string GetUserIDForSession()
{
if (Analytics.client is DynamoAnalyticsClient dac)
Expand Down
Loading

0 comments on commit 2d96ffd

Please sign in to comment.