# -*- coding: utf-8 -*-
from setuphelpers import *
from setupdevhelpers import *
import waptguihelper
default_appx_list = [
## Windows 11 default apps
"Clipchamp.Clipchamp",
"Microsoft.BingNews",
"Microsoft.Paint",
"Microsoft.PowerAutomateDesktop",
"Microsoft.StorePurchaseApp",
"Microsoft.Todos",
"Microsoft.WindowsNotepad",
"Microsoft.WindowsTerminal",
"MicrosoftCorporationII.QuickAssist",
"MicrosoftTeams",
"MicrosoftWindows.Client.WebExperience",
"Microsoft.OneDriveSync",
"Microsoft.OutlookForWindows",
"Microsoft.Windows.DevHome",
"Microsoft.Windows.DevHomeAzureExtension",
"Microsoft.Windows.DevHomeGitHubExtension",
## Windows 10 default apps
"Microsoft.3DBuilder",
"Microsoft.Print3D",
"Microsoft.Microsoft3DViewer",
"Microsoft.MixedReality.Portal",
"Microsoft.YourPhone",
"Microsoft.WindowsFeedbackHub",
"Microsoft.Windows.Cortana",
"Microsoft.GetHelp",
'Microsoft.Appconnector',
"Microsoft.BingFinance",
"Microsoft.BingNews",
"Microsoft.BingSports",
"Microsoft.BingWeather",
"Microsoft.FreshPaint",
"Microsoft.MSPaint",
"Microsoft.Getstarted",
"Microsoft.MicrosoftOfficeHub",
"Microsoft.MicrosoftSolitaireCollection",
'Microsoft.MicrosoftStickyNotes',
'Microsoft.Office.OneNote',
"Microsoft.OneConnect",
"Microsoft.People",
"Microsoft.SkypeApp",
"Microsoft.Windows.Photos",
"Microsoft.WindowsAlarms",
"Microsoft.WindowsCalculator",
"Microsoft.WindowsCamera",
"Microsoft.WindowsMaps",
"Microsoft.WindowsPhone",
"Microsoft.WindowsSoundRecorder",
"Microsoft.WindowsStore",
"Microsoft.GamingApp",
"Microsoft.XboxApp",
"Microsoft.Xbox.TCUI",
"Microsoft.XboxGameOverlay",
"Microsoft.XboxGamingOverlay",
"Microsoft.XboxIdentityProvider",
"Microsoft.XboxSpeechToTextOverlay",
"Microsoft.ZuneMusic",
"Microsoft.ZuneVideo",
"microsoft.windowscommunicationsapps",
"Microsoft.MinecraftUWP",
"Microsoft.MixedReality.Portal",
"Microsoft.ScreenSketch"
## Threshold 2 apps
"Microsoft.CommsPhone",
'Microsoft.ConnectivityStore',
"Microsoft.Messaging",
'Microsoft.Office.Sway',
## Redstone apps
"Microsoft.BingFoodAndDrink",
"Microsoft.BingTravel",
"Microsoft.BingHealthAndFitness",
"Microsoft.WindowsReadingList",
## non-Microsoft
"9E2F88E3.Twitter",
"Flipboard.Flipboard",
"ShazamEntertainmentLtd.Shazam",
"king.com.*",
"ClearChannelRadioDigital.iHeartRadio",
"4DF9E0F8.Netflix",
"6Wunderkinder.Wunderlist",
"Drawboard.DrawboardPDF",
"2FE3CB00.PicsArt-PhotoStudio",
"D52A8D61.FarmVille2CountryEscape",
"TuneIn.TuneInRadio",
"TheNewYorkTimes.NYTCrossword",
"828B5831.HiddenCityMysteryofShadow",
"Microsoft.Advertising.Xaml",
"SpotifyAB.SpotifyMusic",
"7EE7776C.LinkedInforWindows"
## Apps which cannot be removed using Remove-AppxPackage
'Microsoft.BioEnrollment',
"Microsoft.MicrosoftEdge",
"Microsoft.MicrosoftEdge.Stable",
"Microsoft.MicrosoftEdgeDevToolsClient",
"Windows.ContactSupport",
"Microsoft.XboxGameCallableUI",
"Microsoft.SecHealthUI",
"Microsoft.Windows.CallingShellApp",
"Microsoft.Services.Store.Engagement",
"MicrosoftWindows.UndockedDevKit",
]
grid_metadata = {
"columns": [
{
"propertyname": "name",
"datatype": "String",
"required": False,
"readonly": False,
"width": 403
},
],
"window": {
"height": 512,
"width": 425
}
}
def update_package():
# Declaring local variables
package_updated = False
proxies = get_proxies_from_wapt_console()
if not proxies:
proxies = get_proxies()
app_name = control.name
appx_json_filename = "appx_to_uninstall.json"
# Interact differently with Luti
if params.get("running_as_luti"):
return "OK"
installed_appx = list()
for appx in run_powershell("Get-AppxPackage -AllUsers"):
appx_name = appx['PackageFamilyName'].rsplit('_', 1)[0]
if not '-' in appx_name:
installed_appx.append(appx_name)
appx_dict = [{'name': i} for i in set(default_appx_list + installed_appx)]
appx_selected = ask_grid(
"Select Appx you want to uninstall",
appx_dict,
waptguihelper.GRT_SELECTED,
metadata=json.dumps(grid_metadata),
stay_on_top=True,
raise_error=True
)
# Ask the use to rename the package if it's contains 'template'
if control.package.endswith("template"):
complete_control_package(control)
complete_control_name(control)
if appx_selected:
package_updated = True
appx_list = [appx_name['name'] for appx_name in appx_selected]
json_write_file(appx_json_filename, appx_list)
ask_message("Appx on current user", "If you want to uninstall Appx on the current user, you need to uncomment the 'session_setup' function in the 'setup.py' file!")
package_version = int(control.version.split("-", 1)[-1]) + 1
control.version = f"{control.get_software_version()}-{package_version}"
control.save_control_to_wapt()
return package_updated