Browse Source

Adds ability to suppress update notifications

main
Eric Amodio 7 years ago
parent
commit
b70ffbdeee
2 changed files with 9 additions and 3 deletions
  1. +3
    -2
      src/constants.ts
  2. +6
    -1
      src/extension.ts

+ 3
- 2
src/constants.ts View File

@ -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';

+ 6
- 1
src/extension.ts View File

@ -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<string>(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) {

Loading…
Cancel
Save