diff --git a/src/extension.ts b/src/extension.ts index aad5f4288..4bdf1d9cf 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -26,6 +26,8 @@ import { SimulatorDebugConfigurationProvider } from "./simulatorDebugConfigurati import TelemetryAI from "./telemetry/telemetryAI"; import { UsbDetector } from "./usbDetector"; import { VSCODE_MESSAGES_TO_WEBVIEW, WEBVIEW_MESSAGES } from "./view/constants"; +import { PopupService } from "./service/PopupService"; +import getPackageInfo from "./telemetry/getPackageInfo"; import { registerDefaultFontFaces } from "office-ui-fabric-react"; let currentFileAbsPath: string = ""; @@ -120,6 +122,18 @@ export async function activate(context: vscode.ExtensionContext) { } ); + const currVersionReleaseName = + "release_note_" + getPackageInfo(context).extensionVersion; + const viewedReleaseNote = context.globalState.get( + currVersionReleaseName, + false + ); + + if (!viewedReleaseNote) { + PopupService.openReleaseNote(); + context.globalState.update(currVersionReleaseName, true); + } + const openWebview = () => { if (currentPanel) { messagingService.setWebview(currentPanel.webview); @@ -893,6 +907,22 @@ export async function activate(context: vscode.ExtensionContext) { } ); + const showReleaseNote = vscode.commands.registerCommand( + "deviceSimulatorExpress.", + (port, showWarning = true) => { + if (serialMonitor) { + telemetryAI.runWithLatencyMeasure(() => { + serialMonitor.closeSerialMonitor(port, showWarning); + }, TelemetryEventName.CPX_COMMAND_SERIAL_MONITOR_CLOSE); + } else { + vscode.window.showErrorMessage( + CONSTANTS.ERROR.NO_FOLDER_OPENED + ); + console.info("Serial monitor is not defined."); + } + } + ); + UsbDetector.getInstance().initialize(context.extensionPath); UsbDetector.getInstance().startListening(); diff --git a/src/latest_release_note.ts b/src/latest_release_note.ts new file mode 100644 index 000000000..500d18d79 --- /dev/null +++ b/src/latest_release_note.ts @@ -0,0 +1,63 @@ +// TODO: find a better way of loading html into a string +export const LATEST_RELEASE_NOTE = `

Device Simulator Express Release Notes 👩🏾‍💻 👨🏾‍💻 (Feb. 27, 2020)

+

+ Welcome to the first update to the Device Simulator Express! Please feel free to enable our feature flag in + Settings + (under the setting titled “deviceSimulatorExpress.previewMode” in the User settings). +

+

Changes

+

+

Fixes (enabled by default):

+ +

New features (only available with feature flag enabled):

+ +

+ +

Happy Hacking! ✨✨🐍🐍🍰
+       - The Device Simulator Express Team

`; diff --git a/src/service/PopupService.ts b/src/service/PopupService.ts new file mode 100644 index 000000000..9bff8ba5b --- /dev/null +++ b/src/service/PopupService.ts @@ -0,0 +1,16 @@ +// import { Webview } from "vscode"; +import * as vscode from "vscode"; +import { LATEST_RELEASE_NOTE } from "../latest_release_note"; + +export class PopupService { + public static openReleaseNote() { + const panel = vscode.window.createWebviewPanel( + "releaseNote", + "Release Note", + vscode.ViewColumn.One, + {} + ); + + panel.webview.html = LATEST_RELEASE_NOTE; + } +}