From 3589b9eff088b3a85103a37b6f326fff96381807 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 21 Jan 2021 17:47:50 +0000 Subject: [PATCH] sync version key --- src/Manager.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Manager.ts b/src/Manager.ts index c027c04..4fb5939 100644 --- a/src/Manager.ts +++ b/src/Manager.ts @@ -19,6 +19,7 @@ export class WhatsNewManager { private sponsorProvider: SponsorProvider | undefined; private extension!: vscode.Extension; + private versionKey!: string; constructor(context: vscode.ExtensionContext) { this.context = context; @@ -28,6 +29,9 @@ export class WhatsNewManager { this.publisher = publisher; this.extensionName = extensionName this.contentProvider = contentProvider; + this.versionKey = `${this.extensionName}.version`; + + this.context.globalState.setKeysForSync([this.versionKey]); return this; } @@ -47,7 +51,7 @@ export class WhatsNewManager { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion this.extension = vscode.extensions.getExtension(`${this.publisher}.${this.extensionName}`)!; - const previousExtensionVersion = this.context.globalState.get(`${this.extensionName}.version`); + const previousExtensionVersion = this.context.globalState.get(this.versionKey); this.showPageIfVersionDiffers(this.extension.packageJSON.version, previousExtensionVersion); } @@ -88,7 +92,7 @@ export class WhatsNewManager { } // "major", "minor" - this.context.globalState.update(`${this.extensionName}.version`, currentVersion); + this.context.globalState.update(this.versionKey, currentVersion); this.showPage(); }