Skip to content

+semver:minor Added PrivacyDlg to allow control over analytics tracking#1493

Open
tombogle wants to merge 14 commits intomasterfrom
add-dlg-for-analytics-opt-out
Open

+semver:minor Added PrivacyDlg to allow control over analytics tracking#1493
tombogle wants to merge 14 commits intomasterfrom
add-dlg-for-analytics-opt-out

Conversation

@tombogle
Copy link
Copy Markdown
Contributor

@tombogle tombogle commented Mar 2, 2026

Added new SIL.Installer package for common installer components. Includes a Privacy dialog to enable users to opt out of analytics reporting.
Added two public members currently just used in Test App but potentially useful elsewhere:

  • PathUtilities.ParentDirectories extension method.
  • FileLocationUtilities.DistFilesFolderPath property.

Added elements to TestApp to exercise the new Privacy dialog

Added installer for SIL.Windows.Forms.TestApp - not intended for deployment, just a testbed for the wxs files in SIL.Installer

Added elements to TestApp to exercise the new Privacy dialog


Open with Devin

This change is Reviewable

…tics tracking is allowed

Added elements to TestApp to exercise the new Privacy dialog
@tombogle tombogle self-assigned this Mar 2, 2026
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 2, 2026

Palaso Tests

     3 files   -     1       3 suites   - 1   6m 42s ⏱️ - 3m 29s
 5 095 tests ±    0   4 861 ✅  -     1  234 💤 +  1  0 ❌ ±0 
11 483 runs   - 5 114  11 009 ✅  - 4 869  474 💤  - 245  0 ❌ ±0 

Results for commit 4067f22. ± Comparison against base commit ce83cef.

This pull request skips 1 test.
SIL.Tests.IO.FileLocationUtilitiesTests ‑ LocateInProgramFiles_SendValidProgramDeepSearch_ReturnsProgramPath

♻️ This comment has been updated with latest results.

//
// _buttonOK
//
this._buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));

Check warning

Code scanning / CodeQL

Cast to same type Warning

This cast is redundant because the expression already has type AnchorStyles.

Copilot Autofix

AI 13 days ago

To fix the problem in general, remove explicit casts where the compiler already infers the same type for the expression, as they add clutter without changing semantics. For enum flag combinations (like AnchorStyles), the result of a bitwise OR of enum values is already of that enum type, so an explicit cast to the same enum is redundant.

In this specific case in SIL.Windows.Forms/Privacy/PrivacyDlg.Designer.cs, line 138 assigns to _buttonOK.Anchor using:

this._buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));

Here, (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right) is already of type System.Windows.Forms.AnchorStyles, so the outer cast ((System.Windows.Forms.AnchorStyles)( ... )) can be removed safely. The best fix is to replace the entire assignment with a direct use of the bitwise OR expression, preserving all other properties and layout code unchanged. No new methods, imports, or definitions are required; we only simplify this one assignment expression.

Suggested changeset 1
SIL.Windows.Forms/Privacy/PrivacyDlg.Designer.cs

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/SIL.Windows.Forms/Privacy/PrivacyDlg.Designer.cs b/SIL.Windows.Forms/Privacy/PrivacyDlg.Designer.cs
--- a/SIL.Windows.Forms/Privacy/PrivacyDlg.Designer.cs
+++ b/SIL.Windows.Forms/Privacy/PrivacyDlg.Designer.cs
@@ -135,7 +135,7 @@
             // 
             // _buttonOK
             // 
-            this._buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+            this._buttonOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
             this._buttonOK.AutoSize = true;
             this.locExtender.SetLocalizableToolTip(this._buttonOK, null);
             this.locExtender.SetLocalizationComment(this._buttonOK, null);
EOF
@@ -135,7 +135,7 @@
//
// _buttonOK
//
this._buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this._buttonOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
this._buttonOK.AutoSize = true;
this.locExtender.SetLocalizableToolTip(this._buttonOK, null);
this.locExtender.SetLocalizationComment(this._buttonOK, null);
Copilot is powered by AI and may make mistakes. Always verify output.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but this is generated Designer code.

//
// _buttonCancel
//
this._buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));

Check warning

Code scanning / CodeQL

Cast to same type Warning

This cast is redundant because the expression already has type AnchorStyles.

Copilot Autofix

AI 13 days ago

In general, to fix a "cast to same type" issue, remove the explicit cast when the expression already has the target type and no overload resolution or nullability semantics depend on the cast. This reduces noise and potential confusion without changing behavior.

Here, both _buttonOK.Anchor (line 138) and _buttonCancel.Anchor (line 155) are assigned values wrapped in a redundant cast:

this._buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));

The expression (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right) already has type System.Windows.Forms.AnchorStyles. Assigning that directly to the Anchor property is sufficient. The best fix is to remove both outer and inner casts and assign the combined enum values directly, preserving the anchor behavior.

Concretely:

  • On line 155, change the right-hand side to System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right.
  • Make the same simplification on line 138 for _buttonOK.Anchor to keep the code consistent.

No new methods, imports, or definitions are needed; we are only simplifying the enum expression.

Suggested changeset 1
SIL.Windows.Forms/Privacy/PrivacyDlg.Designer.cs

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/SIL.Windows.Forms/Privacy/PrivacyDlg.Designer.cs b/SIL.Windows.Forms/Privacy/PrivacyDlg.Designer.cs
--- a/SIL.Windows.Forms/Privacy/PrivacyDlg.Designer.cs
+++ b/SIL.Windows.Forms/Privacy/PrivacyDlg.Designer.cs
@@ -135,7 +135,7 @@
             // 
             // _buttonOK
             // 
-            this._buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+            this._buttonOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
             this._buttonOK.AutoSize = true;
             this.locExtender.SetLocalizableToolTip(this._buttonOK, null);
             this.locExtender.SetLocalizationComment(this._buttonOK, null);
@@ -152,7 +152,7 @@
             // 
             // _buttonCancel
             // 
-            this._buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+            this._buttonCancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
             this._buttonCancel.AutoSize = true;
             this._buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
             this.locExtender.SetLocalizableToolTip(this._buttonCancel, null);
EOF
@@ -135,7 +135,7 @@
//
// _buttonOK
//
this._buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this._buttonOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
this._buttonOK.AutoSize = true;
this.locExtender.SetLocalizableToolTip(this._buttonOK, null);
this.locExtender.SetLocalizationComment(this._buttonOK, null);
@@ -152,7 +152,7 @@
//
// _buttonCancel
//
this._buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this._buttonCancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
this._buttonCancel.AutoSize = true;
this._buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.locExtender.SetLocalizableToolTip(this._buttonCancel, null);
Copilot is powered by AI and may make mistakes. Always verify output.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but this is generated Designer code.

@tombogle
Copy link
Copy Markdown
Contributor Author

tombogle commented Mar 2, 2026

image

@tombogle
Copy link
Copy Markdown
Contributor Author

tombogle commented Mar 2, 2026

image

Copy link
Copy Markdown
Contributor Author

@tombogle tombogle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tombogle made 2 comments and resolved 2 discussions.
Reviewable status: 0 of 11 files reviewed, all discussions resolved (waiting on andrew-polk, mark-sil, and megahirt).

//
// _buttonOK
//
this._buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but this is generated Designer code.

//
// _buttonCancel
//
this._buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but this is generated Designer code.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

@tombogle tombogle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tombogle made 1 comment.
Reviewable status: 0 of 12 files reviewed, 3 unresolved discussions (waiting on andrew-polk, mark-sil, and megahirt).

devin-ai-integration[bot]

This comment was marked as resolved.

…omponents. Includes a Privacy dialog to enable users to opt out of analytics reporting.

Added PathUtilities.ParentDirectories extension method.
Added FileLocationUtilities.DistFilesFolderPath extension method.
Added installer for SIL.Windows.Forms.TestApp - not intended for deployment, just a testbed for the wxs files in SIL.Installer
@tombogle tombogle force-pushed the add-dlg-for-analytics-opt-out branch from b81717a to a579667 Compare March 26, 2026 05:12
devin-ai-integration[bot]

This comment was marked as resolved.

…rPath set by app.

This addresses a concern raised by Devin (which in practice is probably not really a problem).
@tombogle tombogle force-pushed the add-dlg-for-analytics-opt-out branch from 4cc5955 to 38929ff Compare March 26, 2026 21:14
@tombogle tombogle force-pushed the add-dlg-for-analytics-opt-out branch from 38929ff to df546f8 Compare March 26, 2026 21:24
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 new potential issues.

View 16 additional findings in Devin Review.

Open in Devin Review

<Description>SIL.Windows.Forms.TestApp test app</Description>
<OutputPath>../../output/$(Configuration)</OutputPath>
<Description>SIL.Windows.Forms test app</Description>
<OutputPath>output/$(Configuration)</OutputPath>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 TestApp output path changed — may affect CI or other build integrations

The OutputPath for SIL.Windows.Forms.TestApp was changed from ../../output/$(Configuration) (the shared repo output directory) to output/$(Configuration) (a project-local directory). This was likely done to support the new WiX installer test project which references .\..\SIL.Windows.Forms.TestApp\output\$(Configuration)\net48\. Any existing scripts or CI steps that depend on finding the TestApp binaries in the shared output/ directory at the repo root would need updating.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

… reinstall

Fixed problem of shared fixed GUID being used across all products
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 19 additional findings in Devin Review.

Open in Devin Review

Comment on lines +81 to +90
<Component Id="GlobalAnalyticsSetting" Guid="{5D729D52-F0E1-443F-AA40-664AA754F1C1}">
<Condition><![CDATA[SIL_ANALYTICS_APPLY_GLOBALLY = "1"]]></Condition>
<RegistryKey Root="HKCU" Key="$(var.GlobalAnalyticsRegistryKey)">
<RegistryValue
Name="Enabled"
Type="integer"
Value="[SIL_ANALYTICS_ENABLED_GLOBALLY]"
KeyPath="yes" />
</RegistryKey>
</Component>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 WiX GlobalAnalyticsSetting component uses fixed GUID shared across all SIL products

The GlobalAnalyticsSetting component at line 81 uses a hardcoded GUID {5D729D52-F0E1-443F-AA40-664AA754F1C1} so all SIL products share ownership of the global Software\SIL\Analytics registry key. MSI reference counting means the key is only removed when the last product referencing it is uninstalled. However, the component condition SIL_ANALYTICS_APPLY_GLOBALLY = "1" is evaluated per-product on each install/upgrade. If a product was previously installed with this condition true (global applied) and on reinstall the condition becomes false (e.g., user set a product-specific override via the C# dialog), MSI could deregister this product's reference to the shared component. If no other SIL product is installed, this would delete the global registry key. This edge case is mitigated by the fact that the C# AnalyticsProxy.Update method (not the installer) is the primary mechanism for changing settings at runtime.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

devin-ai-integration[bot]

This comment was marked as resolved.

…not set for the current user in the registry
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 19 additional findings in Devin Review.

Open in Devin Review

Comment on lines +1 to +7
<Project>
<Import Project="..\Directory.Build.props" />

<PropertyGroup>
<Product>$(AssemblyName)</Product>
</PropertyGroup>
</Project> No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 New TestApps/Directory.Build.props changes Product metadata for all test apps

This new file overrides <Product> from libpalaso (root Directory.Build.props:7) to $(AssemblyName) for all projects under TestApps/. This affects Application.ProductName in WinForms apps. Currently only SIL.Windows.Forms.TestApp uses Application.ProductName (at Program.cs:72 for the AnalyticsProxy). Other test apps under TestApps/ (ArchivingTestApp, ClipboardTestApp, etc.) don't reference Application.ProductName, so they're not affected functionally. However, their assembly metadata will change, which could affect things like user settings file paths (Application.UserAppDataPath includes ProductName).

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants