Skip to content

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

Open
tombogle wants to merge 1 commit intomasterfrom
add-dlg-for-analytics-opt-out
Open

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

Conversation

@tombogle
Copy link
Contributor

@tombogle tombogle commented Mar 2, 2026

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

@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

github-actions bot commented Mar 2, 2026

Palaso Tests

     4 files  ±0       4 suites  ±0   9m 41s ⏱️ -17s
 5 092 tests ±0   4 859 ✅ +1  233 💤  - 1  0 ❌ ±0 
16 591 runs  ±0  15 872 ✅ +2  719 💤  - 2  0 ❌ ±0 

Results for commit a5fdc13. ± Comparison against base commit 0b3665c.

//
// _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 this problem, remove the unnecessary cast so that the code directly assigns the AnchorStyles expression to the Anchor property. In general, whenever an expression already has the target type, you should not cast it again.

Concretely, in SIL.Windows.Forms/Privacy/PrivacyDlg.Designer.cs, update the line that sets _buttonOK.Anchor. Currently it casts the result of the bitwise OR between AnchorStyles.Bottom and AnchorStyles.Right back to AnchorStyles, even though both operands are already of that enum type and the result is also AnchorStyles. Remove the outer cast and keep the bitwise OR expression as-is. No new methods, imports, or definitions are required; this is a straightforward one-line change that preserves existing functionality.

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
@@ -136,7 +136,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._buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
             this.locExtender.SetLocalizableToolTip(this._buttonOK, null);
EOF
@@ -136,7 +136,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._buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.locExtender.SetLocalizableToolTip(this._buttonOK, null);
Copilot is powered by AI and may make mistakes. Always verify output.
Copy link
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

To fix the problem, remove the redundant cast to System.Windows.Forms.AnchorStyles while preserving the combined anchor style expression. The property Anchor already expects an AnchorStyles value, and the bitwise-or of AnchorStyles.Bottom and AnchorStyles.Right yields that type, so you can assign the expression directly.

Concretely, in SIL.Windows.Forms/Privacy/PrivacyDlg.Designer.cs, within the InitializeComponent method (or equivalent region where controls are initialized), update the assignment to _buttonCancel.Anchor to remove the outer cast and the inner cast, leaving a plain bitwise-or expression. No additional imports, methods, or definitions are required; this is a pure cleanup of the existing expression. The same pattern for _buttonOK.Anchor appears above but was not flagged; per the instructions, only the shown, highlighted code on line 156 will be changed.

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
@@ -153,7 +153,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
@@ -153,7 +153,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
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
Contributor Author

tombogle commented Mar 2, 2026

image

@tombogle
Copy link
Contributor Author

tombogle commented Mar 2, 2026

image

Copy link
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
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
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.

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.

1 participant