mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-08-23 08:02:07 +00:00
fix: match tweak presets and app-removal scope by stable ID instead of translatable text (#737)
This commit is contained in:
@@ -219,8 +219,8 @@ function Get-TweakPresetControlMap {
|
||||
.PARAMETER Window
|
||||
The window that owns the visible tweak controls.
|
||||
|
||||
.PARAMETER Category
|
||||
The category whose mapped controls are included.
|
||||
.PARAMETER CategoryId
|
||||
The stable CategoryId (from Features.json) whose mapped controls are included.
|
||||
|
||||
.OUTPUTS
|
||||
System.Collections.Hashtable. Control metadata keyed by control name.
|
||||
@@ -228,7 +228,7 @@ function Get-TweakPresetControlMap {
|
||||
function Get-CategoryTweakPresetMap {
|
||||
param(
|
||||
[System.Windows.Window]$Window,
|
||||
[string]$Category
|
||||
[string]$CategoryId
|
||||
)
|
||||
|
||||
$presetMap = @{}
|
||||
@@ -236,7 +236,7 @@ function Get-CategoryTweakPresetMap {
|
||||
|
||||
foreach ($controlName in $script:UiControlMappings.Keys) {
|
||||
$mapping = $script:UiControlMappings[$controlName]
|
||||
if ($mapping.Category -ne $Category) { continue }
|
||||
if ($mapping.CategoryId -ne $CategoryId) { continue }
|
||||
|
||||
$control = $Window.FindName($controlName)
|
||||
if (-not $control -or $control.Visibility -ne 'Visible') { continue }
|
||||
@@ -403,8 +403,8 @@ function Initialize-TweakPresetSources {
|
||||
|
||||
$script:DefaultTweakPresetMap = Get-TweakPresetControlMap -Window $Window -SettingsJson $DefaultSettingsJson
|
||||
$script:LastUsedTweakPresetMap = Get-TweakPresetControlMap -Window $Window -SettingsJson $LastUsedSettingsJson
|
||||
$script:PrivacyTweakPresetMap = Get-CategoryTweakPresetMap -Window $Window -Category 'Privacy & Suggested Content'
|
||||
$script:AITweakPresetMap = Get-CategoryTweakPresetMap -Window $Window -Category 'AI'
|
||||
$script:PrivacyTweakPresetMap = Get-CategoryTweakPresetMap -Window $Window -CategoryId 'PrivacySuggestedContent'
|
||||
$script:AITweakPresetMap = Get-CategoryTweakPresetMap -Window $Window -CategoryId 'AI'
|
||||
|
||||
$presetLastUsedTweaksBtn = $Window.FindName('PresetLastUsedTweaksBtn')
|
||||
if ($presetLastUsedTweaksBtn) {
|
||||
@@ -478,11 +478,14 @@ function Test-OtherUsername {
|
||||
[System.Windows.Window]$Window,
|
||||
[System.Windows.Controls.ComboBox]$UserSelectionCombo,
|
||||
[System.Windows.Controls.TextBox]$OtherUsernameTextBox,
|
||||
[System.Windows.Controls.TextBlock]$UsernameValidationMessage
|
||||
[System.Windows.Controls.TextBlock]$UsernameValidationMessage,
|
||||
[System.Windows.Controls.ComboBox]$AppRemovalScopeCombo
|
||||
)
|
||||
|
||||
# Only validate if "Other User" is selected
|
||||
if ($UserSelectionCombo.SelectedIndex -ne 1) {
|
||||
# Only validate if "Other User" is the deployment target, or "Target user only" is the app-removal scope
|
||||
$isOtherUserSelected = ($UserSelectionCombo.SelectedIndex -eq 1)
|
||||
$isAppRemovalTargetUserSelected = Test-AppRemovalScopeTargetsOtherUser -AppRemovalScopeCombo $AppRemovalScopeCombo
|
||||
if (-not $isOtherUserSelected -and -not $isAppRemovalTargetUserSelected) {
|
||||
return $true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user