Skip to content

Commit

Permalink
DYN-5918 Obsolete Google Analytics (#14213)
Browse files Browse the repository at this point in the history
* obsolete GA

* revert

* Updates

* Update

* Update

* Clean-ups

* updates
  • Loading branch information
QilongTang authored Aug 4, 2023
1 parent c3db776 commit f8fe2e8
Show file tree
Hide file tree
Showing 17 changed files with 571 additions and 725 deletions.
8 changes: 0 additions & 8 deletions LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -299,14 +299,6 @@ Copyright © Autodesk, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


CSharpAnalytics v.1.2.1:
https://github.com/AttackPattern/CSharpAnalytics
http://www.apache.org/licenses/LICENSE-2.0
© 2012-2015 Attack Pattern LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


Ncalc v.1.3.8.0:
http://ncalc.codeplex.com/
© 2011 Sebastien Ros
Expand Down
1,145 changes: 550 additions & 595 deletions doc/distrib/License.rtf

Large diffs are not rendered by default.

File renamed without changes.
2 changes: 1 addition & 1 deletion src/AssemblySharedInfoGenerator/AssemblySharedInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// associated with an assembly.
[assembly: AssemblyCompany("Autodesk, Inc")]
[assembly: AssemblyProduct("Dynamo")]
[assembly: AssemblyCopyright("Copyright © Autodesk, Inc 2023")]
[assembly: AssemblyCopyright("Copyright © Autodesk, Inc 2023")]
[assembly: AssemblyTrademark("")]

//In order to begin building localizable applications, set
Expand Down
1 change: 1 addition & 0 deletions src/DynamoCore/Configuration/IPreferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public interface IPreferences
/// <summary>
/// Indicates whether Google analytics reporting is approved or not.
/// </summary>
[Obsolete("Property will be deprecated in Dynamo 3.0")]
bool IsAnalyticsReportingApproved { get; set; }

/// <summary>
Expand Down
4 changes: 3 additions & 1 deletion src/DynamoCore/Configuration/PreferenceSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ public class PreferenceSettings : NotificationObject, IPreferences, IRenderPreci
/// <summary>
/// Indicates whether Google analytics reporting is approved or not.
/// </summary>
public bool IsAnalyticsReportingApproved { get; set; }
[Obsolete("Property will be deprecated in Dynamo 3.0")]
public bool IsAnalyticsReportingApproved { get { return false; } set { } }

/// <summary>
/// This defines if the user export file path would include timestamp
Expand Down Expand Up @@ -344,6 +345,7 @@ public bool IsBackgroundPreviewActive
/// </summary>
public int RenderPrecision { get; set; }

/// <summary>
/// Indicates whether surface and solid edges will
/// be rendered.
/// </summary>
Expand Down
1 change: 0 additions & 1 deletion src/DynamoCore/DynamoCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@
<Copy SourceFiles="$(SolutionDir)..\README.md" DestinationFiles="$(OutputPath)README.txt" />
<Copy SourceFiles="$(SolutionDir)..\doc\distrib\License.rtf" DestinationFolder="$(OutputPath)" />
<Copy SourceFiles="$(SolutionDir)..\doc\distrib\TermsOfUse.rtf" DestinationFolder="$(OutputPath)" />
<Copy SourceFiles="$(SolutionDir)..\doc\distrib\GoogleAnalyticsConsent.rtf" DestinationFolder="$(OutputPath)" />
<Copy SourceFiles="$(SolutionDir)..\doc\distrib\InstrumentationConsent.rtf" DestinationFolder="$(OutputPath)" />
<Copy SourceFiles="$(SolutionDir)..\doc\distrib\ADPAnalyticsConsent.rtf" DestinationFolder="$(OutputPath)" />
<Copy SourceFiles="@(NodeHelpFiles)" DestinationFolder="$(OutputPath)\en-US\fallback_docs\" />
Expand Down
16 changes: 1 addition & 15 deletions src/DynamoCore/Logging/DynamoAnalyticsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void Dispose() { }
public virtual IAnalyticsSession Session { get; private set; }

/// <summary>
/// Return if Analytics Client is allowed to send any analytics information (Google, ADP etc.)
/// Return if Analytics Client is allowed to send any analytics information
/// </summary>
public bool ReportingAnalytics
{
Expand All @@ -106,20 +106,6 @@ public bool ReportingAnalytics
}
}

/// <summary>
/// Return if Google Analytics Client is allowed to send analytics info
/// </summary>
private bool ReportingGoogleAnalytics
{
get
{
return preferences != null
&& Service.IsInitialized
&& !Analytics.DisableAnalytics
&& preferences.IsAnalyticsReportingApproved;
}
}

/// <summary>
/// Return if Analytics Client is allowed to send instrumentation info
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion src/DynamoCore/Models/DynamoModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2107,10 +2107,11 @@ private bool InsertJsonFileFromPath(string fileContents, string filePath, bool f
throw e;
}
}

/// <summary>
/// Opens a Dynamo workspace from a path to an Xml file on disk.
/// </summary>
/// <param name="xmlDoc">xml file content</param>
/// <param name="filePath">Path to file</param>
/// <param name="forceManualExecutionMode">Set this to true to discard
/// execution mode specified in the file and set manual mode</param>
Expand Down
9 changes: 0 additions & 9 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,6 @@
<data name="CompactLayoutTitle" xml:space="preserve">
<value>Compact</value>
</data>
<data name="ConsentFormGoogleAnalyticsCheckBoxContent" xml:space="preserve">
<value>I agree to contribute to the Google Analytics program.</value>
</data>
<data name="ConsentFormADPAnalyticsCheckBoxContent" xml:space="preserve">
<value>I agree to data collection in desktop products for Autodesk analytics programs.</value>
</data>
Expand Down
3 changes: 0 additions & 3 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1917,9 +1917,6 @@ Do you want to install the latest Dynamo update?</value>
<data name="Autodesk360SignInButtonTitleToolTip" xml:space="preserve">
<value>Autodesk A360</value>
</data>
<data name="ConsentFormGoogleAnalyticsCheckBoxContent" xml:space="preserve">
<value>I agree to contribute to the Google Analytics program.</value>
</data>
<data name="ConsentFormADPAnalyticsCheckBoxContent" xml:space="preserve">
<value>I agree to data collection in desktop products for Autodesk analytics programs.</value>
</data>
Expand Down
62 changes: 7 additions & 55 deletions src/DynamoCoreWpf/UI/Prompts/UsageReportingAgreementPrompt.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
WindowStyle="None"
MinWidth="530"
MaxWidth="650"
Height="605"
Height="310"
ResizeMode="NoResize"
ShowInTaskbar="False"
AllowsTransparency="True"
Expand Down Expand Up @@ -97,7 +97,6 @@

<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="220"></RowDefinition>
<RowDefinition Height="145"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
Expand Down Expand Up @@ -159,32 +158,11 @@

<Rectangle Style="{StaticResource DividerRectangleStyle}" Grid.Row="0" Grid.ColumnSpan="2" Margin="-15 0"/>

<Border Background="#E6E6E6"
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="0 15 3 15"
Padding="0">
<ScrollViewer
Margin="0 0 -18 0"
HorizontalScrollBarVisibility="Disabled" >
<views:RichTextFile x:Name="GoogleAnalyticsConsent"
IsReadOnly="True"
IsEnabled="True"
IsDocumentEnabled="True"
Margin="0 5"
Padding="5 5 15 10"
Background="Transparent"
OpenLinksInBrowser="True"
BorderThickness="0" />
</ScrollViewer>
</Border>

<Border Background="#E6E6E6"
Grid.Row="2"
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="0 0 3 0"
Margin="0 15 3 0"
Padding="0">
<ScrollViewer
Padding="0"
Expand All @@ -204,27 +182,12 @@
</Border>

<StackPanel Orientation="Vertical"
Grid.Row="3"
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="2">

<Rectangle Style="{StaticResource DividerRectangleStyle}" Margin="-15 15 -15 0"/>

<CheckBox x:Name="AcceptGoogleAnalyticsCheck"
Click="ToggleIsGoogleAnalyticsChecked"
Margin="-2 18 0 15"
VerticalAlignment="Center"
FontSize="13.333"
Background="White"
IsChecked="True">
<TextBlock FontWeight="SemiBold"
FontSize="12"
Foreground="{StaticResource DarkThemeInputBoxBackgroundBrush}"
TextWrapping="Wrap"
Name="AcceptGoogleAnalyticsTextBlock"
Text="{x:Static p:Resources.ConsentFormGoogleAnalyticsCheckBoxContent}"/>
</CheckBox>

<!--The instrumentation checkbox will be hidden and unchecked by default-->
<CheckBox x:Name="AcceptUsageReportingCheck"
Click="ToggleIsUsageReportingChecked"
Expand All @@ -244,33 +207,22 @@

</StackPanel>
<!--Configure ADP Consent-->
<Button Grid.Row="4"
<Button Grid.Row="3"
Grid.Column="0"
x:Name="configure_adp_button"
Background="White"
BorderBrush="#BFBFBF"
Foreground="#3C3C3C"
Style="{StaticResource CtaButtonStyle}"
VerticalAlignment="Bottom"
Margin="-4 0 0 0"
Margin="-4 10 0 0"
Width="auto"
HorizontalAlignment="Left"
Content="{x:Static p:Resources.ConfigureADPButtonText}"
Click="configure_adp_button_Click" />

<!--Learn More Button-->
<TextBlock Grid.Row="5"
Grid.Column="0"
Margin="0 0 0 2"
VerticalAlignment="Bottom"
HorizontalAlignment="Stretch">
<Hyperlink Click="OnLearnMoreClick" Foreground="#4790cd">
<TextBlock Name="LearnMore" Text="{x:Static p:Resources.LearnMore}" />
</Hyperlink>
</TextBlock>

<!--Continue Button-->
<Button Grid.Row="5"
<Button Grid.Row="3"
Grid.Column="1"
x:Name="okButton"
BorderBrush="#0696D7"
Expand Down
31 changes: 2 additions & 29 deletions src/DynamoCoreWpf/UI/Prompts/UsageReportingAgreementPrompt.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
Expand Down Expand Up @@ -31,10 +31,7 @@ public UsageReportingAgreementPrompt(IBrandingResourceProvider resourceProvider,
TitleTextBlock.Text = resourceProvider.GetString(Wpf.Interfaces.ResourceNames.ConsentForm.Title);
}
viewModel = dynamoViewModel;
var googleAnalyticsFile = "GoogleAnalyticsConsent.rtf";

if (viewModel.Model.PathManager.ResolveDocumentPath(ref googleAnalyticsFile))
GoogleAnalyticsConsent.File = googleAnalyticsFile;
var adpAnalyticsFile = "ADPAnalyticsConsent.rtf";

if (viewModel.Model.PathManager.ResolveDocumentPath(ref adpAnalyticsFile))
Expand All @@ -44,14 +41,8 @@ public UsageReportingAgreementPrompt(IBrandingResourceProvider resourceProvider,
//also disabled below id all analytics disabled.
configure_adp_button.IsEnabled = AnalyticsService.IsADPAvailable();

AcceptGoogleAnalyticsCheck.IsChecked = UsageReportingManager.Instance.IsAnalyticsReportingApproved;

if (Analytics.DisableAnalytics)
{
AcceptGoogleAnalyticsCheck.IsChecked = false;
AcceptGoogleAnalyticsTextBlock.IsEnabled = false;
AcceptGoogleAnalyticsCheck.IsEnabled = false;

configure_adp_button.IsEnabled = false;
}

Expand All @@ -65,29 +56,11 @@ private void ToggleIsUsageReportingChecked(object sender, RoutedEventArgs e)
AcceptUsageReportingCheck.IsChecked = UsageReportingManager.Instance.IsUsageReportingApproved;
}

private void ToggleIsGoogleAnalyticsChecked(object sender, RoutedEventArgs e)
{
UsageReportingManager.Instance.SetAnalyticsReportingAgreement(
AcceptGoogleAnalyticsCheck.IsChecked.HasValue &&
AcceptGoogleAnalyticsCheck.IsChecked.Value);
}

private void OnContinueClick(object sender, RoutedEventArgs e)
{
// Update user agreement for GA.
//ADP is set via the ADPSDK consent window.
UsageReportingManager.Instance.SetAnalyticsReportingAgreement(AcceptGoogleAnalyticsCheck.IsChecked.Value);
Close();
}

private void OnLearnMoreClick(object sender, RoutedEventArgs e)
{
var aboutBox = viewModel.BrandingResourceProvider.CreateAboutBox(viewModel);
aboutBox.Owner = this;
aboutBox.WindowStartupLocation = WindowStartupLocation.CenterOwner;
aboutBox.ShowDialog();
}

protected override void OnClosed(System.EventArgs e)
{
base.OnClosed(e);
Expand Down Expand Up @@ -158,4 +131,4 @@ private void UIElement_OnMouseDown(object sender, MouseButtonEventArgs e)
DragMove();
}
}
}
}
4 changes: 2 additions & 2 deletions src/NodeServices/Analytics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Dynamo.Logging
public static class Analytics
{
/// <summary>
/// Disables all analytics collection (Google, ADP, etc.) for the lifetime of the process.
/// Disables all analytics collection for the lifetime of the process.
/// To ensure that no analytics get through, please set set this flag to false before the DynamoModel is constructed.
/// </summary>
public static bool DisableAnalytics;
Expand Down Expand Up @@ -54,7 +54,7 @@ internal static bool IsEnabled
}

/// <summary>
/// Returns if any analytics reporting is ON (Google, ADP etc.)
/// Returns if any analytics reporting is ON
/// </summary>
public static bool ReportingAnalytics { get { return client != null && client.ReportingAnalytics; } }

Expand Down
2 changes: 1 addition & 1 deletion test/DynamoCoreTests/AnalyticsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public void AnalyticsTrackingDisabled()
dynamoSettings.IsAnalyticsReportingApproved = true;
dynamoSettings.IsUsageReportingApproved = true;

//1 startup + 1 analytics optin status event (google analytics)
//1 startup + 1 analytics optin status event
trackerMoq.Verify(t => t.Track(It.IsAny<AnalyticsEvent>(), factoryMoq.Object), Times.Exactly(2));
}

Expand Down
2 changes: 1 addition & 1 deletion test/DynamoCoreWpfTests/CoreUITests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ public void PreferenceSetting_AgreeAnalyticsSharing()
// Test loading old settings file with agreement
var filePath = Path.Combine(GetTestDirectory(ExecutingDirectory), @"settings\DynamoSettings-AnalyticsTurnedOn.xml");
var resultSetting = PreferenceSettings.Load(filePath);
Assert.AreEqual(true, resultSetting.IsAnalyticsReportingApproved);
Assert.AreEqual(false, resultSetting.IsAnalyticsReportingApproved);
Assert.AreEqual(false, resultSetting.IsUsageReportingApproved);
Assert.DoesNotThrow(() => Dynamo.Logging.AnalyticsService.ShutDown());
}
Expand Down

0 comments on commit f8fe2e8

Please sign in to comment.