Skip to content

Commit 38d1bda

Browse files
authored
CloseButton Bugfix
-Update CloseButton handler to correctly handle showsupport in userpreferences.json file
1 parent a83cb3f commit 38d1bda

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

Winhance.ps1

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11010,7 +11010,6 @@ $CloseButton.Add_Click({
1101011010
$response = Show-MessageBox -Message "Thanks for using Winhance! $heart
1101111011

1101211012
If you found this tool helpful, please consider:
11013-
1101411013
- Making a small donation via PayPal
1101511014
- Giving us a Star on GitHub
1101611015

@@ -11024,19 +11023,27 @@ Click 'Yes' to show your support!" `
1102411023
Start-Process "https://paypal.me/memstech"
1102511024
}
1102611025
else {
11027-
# Update preferences to not show dialog again
11026+
# Create new preferences hashtable
11027+
$newPreferences = @{}
11028+
11029+
# Get existing preferences and copy them
1102811030
if ($preferences) {
11029-
$preferences.DontShowSupport = $true
11030-
}
11031-
else {
11032-
$preferences = @{
11033-
DontShowSupport = $true
11031+
$preferences.PSObject.Properties | ForEach-Object {
11032+
$newPreferences[$_.Name] = $_.Value
1103411033
}
1103511034
}
11036-
Save-UserPreferences -Preferences $preferences
11035+
11036+
# Update or add the DontShowSupport preference
11037+
$newPreferences["DontShowSupport"] = $true
11038+
11039+
# Save updated preferences
11040+
$saveResult = Save-UserPreferences -Preferences $newPreferences
11041+
if (-not $saveResult) {
11042+
Write-Log -Message "Failed to save support preference" -Severity "WARNING"
11043+
}
1103711044
}
1103811045
}
11039-
11046+
1104011047
Exit
1104111048
})
1104211049

0 commit comments

Comments
 (0)