Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: redesign office chat feature flag #12371

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/fx-core/src/common/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class FeatureFlagName {
static readonly NewProjectType = "TEAMSFX_NEW_PROJECT_TYPE";
static readonly ChatParticipant = "TEAMSFX_CHAT_PARTICIPANT";
static readonly ChatParticipantUIEntries = "TEAMSFX_CHAT_PARTICIPANT_ENTRIES";
static readonly OfficeChatParticipant = "TEAMSFX_OFFICE_CHAT_PARTICIPANT";
static readonly SMEOAuth = "SME_OAUTH";
static readonly ShowDiagnostics = "TEAMSFX_SHOW_DIAGNOSTICS";
static readonly TelemetryTest = "TEAMSFX_TELEMETRY_TEST";
Expand Down Expand Up @@ -79,6 +80,10 @@ export class FeatureFlags {
name: FeatureFlagName.ChatParticipantUIEntries,
defaultValue: "false",
};
static readonly OfficeChatParticipant = {
name: FeatureFlagName.OfficeChatParticipant,
defaultValue: "false",
};
static readonly SMEOAuth = { name: FeatureFlagName.SMEOAuth, defaultValue: "false" };
static readonly ShowDiagnostics = {
name: FeatureFlagName.ShowDiagnostics,
Expand Down
1 change: 1 addition & 0 deletions packages/vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1552,6 +1552,7 @@
"id": "ms-teams-vscode-extension.office",
"name": "office",
"description": "%teamstoolkit.chatParticipants.officeAddIn.description%",
"when": "fx-extension.isOfficeChatParticipantEnabled",
"commands": [
{
"name": "create",
Expand Down
26 changes: 19 additions & 7 deletions packages/vscode-extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ import {
CHAT_CREATE_OFFICE_PROJECT_COMMAND_ID,
officeChatParticipantId,
} from "./officeChat/consts";
import * as extensionPackage from "../package.json";
import {
chatCreateOfficeProjectCommandHandler,
handleOfficeFeedback,
Expand All @@ -197,12 +198,16 @@ import { loadLocalizedStrings } from "./utils/localizeUtils";
import { checkProjectTypeAndSendTelemetry, isM365Project } from "./utils/projectChecker";
import { ReleaseNote } from "./utils/releaseNote";
import { ExtensionSurvey } from "./utils/survey";
import { getSettingsVersion, projectVersionCheck } from "./utils/telemetryUtils";
import { getPackageVersion, getSettingsVersion, projectVersionCheck } from "./utils/telemetryUtils";
import { createPluginWithManifest } from "./handlers/createPluginWithManifestHandler";

export async function activate(context: vscode.ExtensionContext) {
const value = IsChatParticipantEnabled && semver.gte(vscode.version, "1.90.0");
featureFlagManager.setBooleanValue(FeatureFlags.ChatParticipant, value);
const value =
((getPackageVersion(extensionPackage.version) === "beta" &&
featureFlagManager.getBooleanValue(CoreFeatureFlags.OfficeChatParticipant)) ||
getPackageVersion(extensionPackage.version) === "alpha") &&
semver.gte(vscode.version, "1.90.0");
featureFlagManager.setBooleanValue(CoreFeatureFlags.OfficeChatParticipant, value);

context.subscriptions.push(new ExtTelemetry.Reporter(context));

Expand All @@ -220,10 +225,6 @@ export async function activate(context: vscode.ExtensionContext) {

registerInternalCommands(context);

if (featureFlagManager.getBooleanValue(CoreFeatureFlags.ChatParticipant)) {
registerOfficeChatParticipant(context);
}

if (isTeamsFxProject) {
activateTeamsFxRegistration(context);
}
Expand All @@ -248,6 +249,17 @@ export async function activate(context: vscode.ExtensionContext) {
featureFlagManager.getBooleanValue(CoreFeatureFlags.ChatParticipantUIEntries)
);

// control whether to show office chat participant entry in chat
await vscode.commands.executeCommand(
"setContext",
"fx-extension.isOfficeChatParticipantEnabled",
featureFlagManager.getBooleanValue(CoreFeatureFlags.OfficeChatParticipant)
);

if (featureFlagManager.getBooleanValue(CoreFeatureFlags.OfficeChatParticipant)) {
registerOfficeChatParticipant(context);
}

// Flags for "Build Intelligent Apps" walkthrough.
// DEVEOP_COPILOT_PLUGIN: boolean in vscode settings
await vscode.commands.executeCommand(
Expand Down
Loading