Refactor: Cleanup app removal, remove legacy app list generator and CustomAppsList file support (#662)

* remove support for uninstalling old sunset apps

* Add color legend on app removal screen

* Remove legacy app list generator and custom apps file support
Replaced by GUI config export/import, dynamic RemovalMethod, and
CLI app removal settings saved to LastUsedSettings.json.

* Verify app removal by checking actual installation state instead of trusting winget output
This commit is contained in:
Jeffrey
2026-06-22 22:13:01 +02:00
committed by GitHub
parent 71e3f2e44d
commit d1fe541b62
22 changed files with 865 additions and 477 deletions

View File

@@ -20,10 +20,12 @@ function Invoke-FeatureApply {
if ($script:Features.ContainsKey($FeatureId)) {
$feature = $script:Features[$FeatureId]
}
$applyText = if ($feature -and $feature.ApplyText) { $feature.ApplyText } else { $FeatureId }
# ---- Registry-backed features: import .reg file, then handle side effects ----
if ($feature -and $feature.RegistryKey -and $feature.ApplyText) {
ImportRegistryFile "> $($feature.ApplyText)..." $feature.RegistryKey
if ($feature -and $feature.RegistryKey) {
ImportRegistryFile "> $applyText..." $feature.RegistryKey
# Post-import side effects for specific features
switch ($FeatureId) {
@@ -32,8 +34,8 @@ function Invoke-FeatureApply {
RemoveApps @('Microsoft.BingSearch')
}
'DisableCopilot' {
# Also remove the app package for Copilot
RemoveApps @('Microsoft.Copilot')
# Also remove the app packages for Copilot
RemoveApps @('Microsoft.Copilot', 'XP9CXNGPPJ97XX')
}
'DisableTelemetry' {
# Also disable telemetry scheduled tasks
@@ -44,8 +46,6 @@ function Invoke-FeatureApply {
}
# ---- Custom features (no registry backing, or special handling required) ----
# Resolve a safe apply-text fallback in case the feature is missing from Features.json
$applyText = if ($feature -and $feature.ApplyText) { $feature.ApplyText } else { $FeatureId }
switch ($FeatureId) {
'RemoveApps' {
Write-Host "> $applyText for $(GetFriendlyTargetUserName)..."
@@ -61,20 +61,6 @@ function Invoke-FeatureApply {
RemoveApps $appsList
return
}
'RemoveAppsCustom' {
Write-Host "> $applyText..."
$appsList = LoadAppsFromFile $script:CustomAppsListFilePath
if ($appsList.Count -eq 0) {
Write-Host "No valid apps were selected for removal" -ForegroundColor Yellow
Write-Host ""
return
}
Write-Host "$($appsList.Count) apps selected for removal"
RemoveApps $appsList
return
}
'RemoveGamingApps' {
$appsList = @('Microsoft.GamingApp', 'Microsoft.XboxGameOverlay', 'Microsoft.XboxGamingOverlay')
Write-Host "> $applyText..."