Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set IsFirstRun to false if hide report options is true #11530

Merged
merged 3 commits into from
Mar 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/DynamoCoreWpf/Services/UsageReportingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ public void CheckIsFirstRun(Window ownerWindow, IBrandingResourceProvider resour
{
resourceProvider = resource;
// First run of Dynamo
if (dynamoViewModel.Model.PreferenceSettings.IsFirstRun)
if (dynamoViewModel.Model.PreferenceSettings.IsFirstRun
&& !dynamoViewModel.HideReportOptions
&& !DynamoModel.IsTestMode)
{
FirstRun = false;

//Prompt user for detailed reporting
if (!DynamoModel.IsTestMode)
ShowUsageReportingPrompt(ownerWindow);
}
FirstRun = false;
}

[Obsolete("Function will be removed in Dynamo 3.0, please set IsUsageReportingApproved.")]
Expand Down
2 changes: 1 addition & 1 deletion src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ public bool BackgroundPreviewActive
get { return BackgroundPreviewViewModel.Active; }
}

public bool HideReportOptions { get; }
public bool HideReportOptions { get; internal set; }

/// <summary>
/// Indicates if whether the Iron Python dialog box should be displayed before each new session.
Expand Down
8 changes: 3 additions & 5 deletions src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -909,11 +909,9 @@ private void DynamoView_Loaded(object sender, EventArgs e)
//Backing up IsFirstRun to determine whether to show Gallery
var isFirstRun = dynamoViewModel.Model.PreferenceSettings.IsFirstRun;

if (!dynamoViewModel.HideReportOptions)
{
// If first run, Collect Info Prompt will appear
UsageReportingManager.Instance.CheckIsFirstRun(this, dynamoViewModel.BrandingResourceProvider);
}
// If first run, Collect Info Prompt will appear
UsageReportingManager.Instance.CheckIsFirstRun(this, dynamoViewModel.BrandingResourceProvider);


WorkspaceTabs.SelectedIndex = 0;
dynamoViewModel = (DataContext as DynamoViewModel);
Expand Down
11 changes: 11 additions & 0 deletions test/DynamoCoreWpfTests/CoreUITests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,17 @@ public void PreferenceSettings_ShowEdges_Save()
Assert.True(resultSetting.ShowEdges);
}

[Test]
public void PreferenceSettings_IsFirstRun_And_HideReportOptions()
{
ViewModel.HideReportOptions = true;
ViewModel.Model.PreferenceSettings.IsFirstRun = true;
//force the dynamoview's loaded handler to be called again -
View.RaiseEvent(new RoutedEventArgs(FrameworkElement.LoadedEvent));

Assert.IsFalse(ViewModel.PreferenceSettings.IsFirstRun);
}

private void RestartTestSetup(bool startInTestMode)
{
// Shutdown Dynamo and restart it
Expand Down