mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-08-23 08:02:07 +00:00
Fix: Show reboot warning for undoing features that require it (#699)
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Resolves display labels for selected features that require reboot.
|
||||
|
||||
.DESCRIPTION
|
||||
Combines parameter keys from both forward and undo selections, removes duplicates,
|
||||
and returns the feature label that should be shown to users. Undo selections use
|
||||
UndoLabel when available.
|
||||
#>
|
||||
function Get-RebootFeatureLabels {
|
||||
$rebootFeatureLabels = [System.Collections.Generic.List[string]]::new()
|
||||
$candidateParamKeys = (@($script:Params.Keys) + @($script:UndoParams.Keys)) | Select-Object -Unique
|
||||
|
||||
foreach ($paramKey in $candidateParamKeys) {
|
||||
if ($script:Features.ContainsKey($paramKey) -and $script:Features[$paramKey].RequiresReboot -eq $true) {
|
||||
$feature = $script:Features[$paramKey]
|
||||
$isUndo = $script:UndoParams.ContainsKey($paramKey)
|
||||
$displayLabel = if ($isUndo -and $feature.UndoLabel) { $feature.UndoLabel } else { $feature.Label }
|
||||
|
||||
if (-not [string]::IsNullOrWhiteSpace([string]$displayLabel)) {
|
||||
[void]$rebootFeatureLabels.Add([string]$displayLabel)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $rebootFeatureLabels
|
||||
}
|
||||
Reference in New Issue
Block a user