Skip to content

Commit cbeef33

Browse files
committed
(GH-122) Show Upgrade Message
This commit adds logic to show an upgrade message when an upgrade occurs, and gives user an option to supress upgrade messages.
1 parent b13f210 commit cbeef33

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

client/src/extension.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ export class ConnectionConfiguration implements IConnectionConfiguration {
3333
}
3434

3535
export function activate(context: vscode.ExtensionContext) {
36+
const puppetExtension = vscode.extensions.getExtension('jpogran.puppet-vscode')!;
37+
const puppetExtensionVersion = puppetExtension.packageJSON.version;
38+
39+
notifyOnNewExtensionVersion(context, puppetExtensionVersion)
40+
3641
context.subscriptions.push(new Reporter(context));
3742
var logger = new Logger();
3843
connManager = new ConnectionManager(context, logger);
@@ -48,3 +53,18 @@ export function deactivate() {
4853
connManager.dispose();
4954
}
5055
}
56+
57+
async function notifyOnNewExtensionVersion(context: vscode.ExtensionContext, version: string) {
58+
const viewReleaseNotes = 'View Release Notes';
59+
const suppressUpdateNotice = 'SuppressUpdateNotice';
60+
const dontShowAgainNotice = "Don't show again";
61+
62+
if (context.globalState.get(suppressUpdateNotice, false)) return;
63+
64+
const result = await vscode.window.showInformationMessage(`Puppet VSCode has been updated to v${version}`, dontShowAgainNotice, undefined, viewReleaseNotes);
65+
if (result === viewReleaseNotes) {
66+
vscode.commands.executeCommand('vscode.open', vscode.Uri.parse('https://marketplace.visualstudio.com/items/jpogran.puppet-vscode/changelog'));
67+
} else {
68+
context.globalState.update(suppressUpdateNotice, true);
69+
}
70+
}

0 commit comments

Comments
 (0)