From b70ffbdeee14a19a44fff0e351df68e0b1100e24 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Sat, 8 Apr 2017 14:49:41 -0400 Subject: [PATCH] Adds ability to suppress update notifications --- src/constants.ts | 5 +++-- src/extension.ts | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index 4e8d955..851c486 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -26,10 +26,11 @@ export const DocumentSchemes = { GitLensGit: 'gitlens-git' as DocumentSchemes }; -export type WorkspaceState = 'repoPath'; +export type WorkspaceState = 'repoPath' | 'suppressGitVersionWarning' | 'suppressUpdateNotice'; export const WorkspaceState = { GitLensVersion: 'gitlensVersion' as WorkspaceState, - SuppressGitVersionWarning: 'suppressGitVersionWarning' as WorkspaceState + SuppressGitVersionWarning: 'suppressGitVersionWarning' as WorkspaceState, + SuppressUpdateNotice: 'suppressUpdateNotice' as WorkspaceState }; export const ExtensionId = 'eamodio.gitlens'; diff --git a/src/extension.ts b/src/extension.ts index 4f0e3c2..9c0fe32 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -124,6 +124,8 @@ export async function activate(context: ExtensionContext) { export function deactivate() { } async function notifyOnNewGitLensVersion(context: ExtensionContext, version: string) { + if (context.globalState.get(WorkspaceState.SuppressUpdateNotice, false)) return; + const previousVersion = context.globalState.get(WorkspaceState.GitLensVersion); await context.globalState.update(WorkspaceState.GitLensVersion, version); @@ -134,10 +136,13 @@ async function notifyOnNewGitLensVersion(context: ExtensionContext, version: str if (major === prevMajor && minor === prevMinor) return; } - const result = await window.showInformationMessage(`GitLens has been updated to v${version}`, 'View Release Notes'); + 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')); } + else if (result === `Don't Show Again`) { + context.globalState.update(WorkspaceState.SuppressUpdateNotice, true); + } } async function notifyOnUnsupportedGitVersion(context: ExtensionContext, version: string) {