mirror of
https://github.com/microsoft/PowerToys
synced 2025-09-05 08:55:13 +00:00
Prevent apps from appearing in top-level search when Installed apps extension is disabled (#40132)
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Prevents installed applications from appearing in the top-level search when Installed Apps extension is disabled. Previously, application commands were still returned in the global search results even when the *Installed Apps* extension was turned off. To match user expectations, the search now respects the extension’s enabled state. - Added `IsActive` property to `CommandProviderWrapper` to indicate whether the provider is both valid and enabled by the user in the settings. - Updated `MainListPage` to verify that the provider for `AllApps` is active before including apps in filtered results. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Closes:** #39937 - [x] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [x] **Tests:** Added/updated and all pass - [x] **Localization:** All end-user-facing strings can be localized - [x] **Dev docs:** nothing to update - [x] **New binaries:** none - [x] **Documentation updated:** nothing to update <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Verified that the Installed app entries are shown in the top-level search only when the Installed apps extension is enabled. Verified that turning the Installed apps extension on or off has an immediate effect, and that the behavior persists after an application restart.
This commit is contained in:
@@ -40,6 +40,8 @@ public sealed class CommandProviderWrapper
|
||||
|
||||
public CommandSettingsViewModel? Settings { get; private set; }
|
||||
|
||||
public bool IsActive { get; private set; }
|
||||
|
||||
public string ProviderId
|
||||
{
|
||||
get
|
||||
@@ -124,12 +126,14 @@ public sealed class CommandProviderWrapper
|
||||
{
|
||||
if (!isValid)
|
||||
{
|
||||
IsActive = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var settings = serviceProvider.GetService<SettingsModel>()!;
|
||||
|
||||
if (!GetProviderSettings(settings).IsEnabled)
|
||||
IsActive = GetProviderSettings(settings).IsEnabled;
|
||||
if (!IsActive)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user