From d01c592533bc294d7c11b569d319dcbf0906c921 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 5 Jun 2017 18:53:43 -0400 Subject: [PATCH] Adds welcome message for first-time users --- src/constants.ts | 5 +++-- src/extension.ts | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index f192f92..c467dc5 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -31,9 +31,10 @@ export const DocumentSchemes = { GitLensGit: 'gitlens-git' as DocumentSchemes }; -export type WorkspaceState = 'repoPath' | 'suppressGitVersionWarning' | 'suppressUpdateNotice'; +export type WorkspaceState = 'repoPath' | 'suppressGitVersionWarning' | 'suppressUpdateNotice' | 'suppressWelcomeNotice'; export const WorkspaceState = { GitLensVersion: 'gitlensVersion' as WorkspaceState, SuppressGitVersionWarning: 'suppressGitVersionWarning' as WorkspaceState, - SuppressUpdateNotice: 'suppressUpdateNotice' as WorkspaceState + SuppressUpdateNotice: 'suppressUpdateNotice' as WorkspaceState, + SuppressWelcomeNotice: 'suppressWelcomeNotice' as WorkspaceState }; \ No newline at end of file diff --git a/src/extension.ts b/src/extension.ts index 86fcfb9..d743140 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -129,6 +129,20 @@ async function notifyOnNewGitLensVersion(context: ExtensionContext, version: str const previousVersion = context.globalState.get(WorkspaceState.GitLensVersion); + if (!context.globalState.get(WorkspaceState.SuppressWelcomeNotice, false)) { + await context.globalState.update(WorkspaceState.SuppressWelcomeNotice, true); + + if (previousVersion === undefined) { + const result = await window.showInformationMessage(`Thank you for choosing GitLens! GitLens is powerful, feature rich, and highly configurable, so please be sure to view the docs and tailor it to suit your needs.`, 'View Docs'); + if (result === 'View Docs') { + // TODO: Reset before release + // commands.executeCommand(BuiltInCommands.Open, Uri.parse('https://marketplace.visualstudio.com/items/eamodio.gitlens')); + commands.executeCommand(BuiltInCommands.Open, Uri.parse('https://github.com/eamodio/vscode-gitlens/blob/develop/README.md')); + } + return; + } + } + await context.globalState.update(WorkspaceState.GitLensVersion, version); if (previousVersion) { @@ -139,7 +153,9 @@ async function notifyOnNewGitLensVersion(context: ExtensionContext, version: str const result = await window.showInformationMessage(`GitLens has been updated to v${version}`, 'View Release Notes', `Don't Show Again`); if (result === 'View Release Notes') { - commands.executeCommand(BuiltInCommands.Open, Uri.parse('https://marketplace.visualstudio.com/items/eamodio.gitlens/changelog')); + // TODO: Reset before release + // commands.executeCommand(BuiltInCommands.Open, Uri.parse('https://marketplace.visualstudio.com/items/eamodio.gitlens/changelog')); + commands.executeCommand(BuiltInCommands.Open, Uri.parse('https://github.com/eamodio/vscode-gitlens/blob/develop/CHANGELOG.md')); } else if (result === `Don't Show Again`) { context.globalState.update(WorkspaceState.SuppressUpdateNotice, true);