From a6a874dd81a08c84331ba2375f8559b9a2a77d8a Mon Sep 17 00:00:00 2001 From: Clint Rutkas Date: Mon, 30 Jun 2025 04:06:45 +0000 Subject: [PATCH] commenting out action framework code (#40279) Commenting out code from chat with the team for right now. we haven't had time to fully kick the tires and want to be 100% sure the life cycle is great for end users --------- Co-authored-by: Gordon Lam (SH) --- .../Data/IndexerListItem.cs | 11 ++++++++++- .../IndexerCommandsProvider.cs | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Data/IndexerListItem.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Data/IndexerListItem.cs index f2bfbc1c1a..cd56f1c624 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Data/IndexerListItem.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Data/IndexerListItem.cs @@ -14,6 +14,15 @@ namespace Microsoft.CmdPal.Ext.Indexer.Data; internal sealed partial class IndexerListItem : ListItem { + internal static readonly bool IsActionsFeatureEnabled = GetFeatureFlag(); + + private static bool GetFeatureFlag() + { + var env = System.Environment.GetEnvironmentVariable("CMDPAL_ENABLE_ACTIONS_LIST"); + return !string.IsNullOrEmpty(env) && + (env == "1" || env.Equals("true", System.StringComparison.OrdinalIgnoreCase)); + } + internal string FilePath { get; private set; } public IndexerListItem( @@ -45,7 +54,7 @@ internal sealed partial class IndexerListItem : ListItem ..context, new CommandContextItem(new OpenWithCommand(indexerItem))]; - if (ApiInformation.IsApiContractPresent("Windows.AI.Actions.ActionsContract", 4)) + if (IsActionsFeatureEnabled && ApiInformation.IsApiContractPresent("Windows.AI.Actions.ActionsContract", 4)) { var actionsListContextItem = new ActionsListContextItem(indexerItem.FullPath); if (actionsListContextItem.AnyActions()) diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/IndexerCommandsProvider.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/IndexerCommandsProvider.cs index 2633607e11..605e3c70ff 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/IndexerCommandsProvider.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/IndexerCommandsProvider.cs @@ -19,7 +19,8 @@ public partial class IndexerCommandsProvider : CommandProvider Id = "Files"; DisplayName = Resources.IndexerCommandsProvider_DisplayName; Icon = Icons.FileExplorer; - if (ApiInformation.IsApiContractPresent("Windows.AI.Actions.ActionsContract", 4)) + + if (IndexerListItem.IsActionsFeatureEnabled && ApiInformation.IsApiContractPresent("Windows.AI.Actions.ActionsContract", 4)) { _ = ActionRuntimeManager.InstanceAsync; }