From 19a8f712199da234a351f655c8b6bf39308290cb Mon Sep 17 00:00:00 2001 From: vince-fugnitto Date: Wed, 16 Jun 2021 11:24:39 -0400 Subject: [PATCH] Update 'about' and 'getting-started' api-version The commit updates the vscode api version for the `about` and `getting-started` views to use a non-deprecated way to determine the currently supported API version following recent changes to the framework. Signed-off-by: vince-fugnitto --- .../browser/theia-blueprint-about-dialog.tsx | 18 +++++++++++++----- ...theia-blueprint-getting-started-widget.tsx | 19 ++++++++++++++----- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/theia-extensions/theia-blueprint-product/src/browser/theia-blueprint-about-dialog.tsx b/theia-extensions/theia-blueprint-product/src/browser/theia-blueprint-about-dialog.tsx index df9165d5f..40966015e 100644 --- a/theia-extensions/theia-blueprint-product/src/browser/theia-blueprint-about-dialog.tsx +++ b/theia-extensions/theia-blueprint-product/src/browser/theia-blueprint-about-dialog.tsx @@ -16,15 +16,17 @@ import * as React from 'react'; import { AboutDialog, AboutDialogProps, ABOUT_CONTENT_CLASS } from '@theia/core/lib/browser/about-dialog'; -import { injectable, inject } from 'inversify'; +import { injectable, inject, postConstruct } from 'inversify'; import { renderDocumentation, renderDownloads, renderSourceCode, renderTickets, renderWhatIs, renderWhatIsNot } from './branding-util'; -import { VSXApiVersionProvider } from '@theia/vsx-registry/lib/common/vsx-api-version-provider'; +import { VSXEnvironment } from '@theia/vsx-registry/lib/common/vsx-environment'; @injectable() export class TheiaBlueprintAboutDialog extends AboutDialog { - @inject(VSXApiVersionProvider) - protected readonly apiVersionProvider: VSXApiVersionProvider; + @inject(VSXEnvironment) + protected readonly environment: VSXEnvironment; + + protected vscodeApiVersion: string; constructor( @inject(AboutDialogProps) protected readonly props: AboutDialogProps @@ -32,6 +34,12 @@ export class TheiaBlueprintAboutDialog extends AboutDialog { super(props); } + @postConstruct() + protected async init(): Promise { + this.vscodeApiVersion = await this.environment.getVscodeApiVersion(); + super.init(); + } + protected render(): React.ReactNode { return
{this.renderContent()} @@ -95,7 +103,7 @@ export class TheiaBlueprintAboutDialog extends AboutDialog {

- {'VS Code API Version: ' + this.apiVersionProvider.getApiVersion()} + {'VS Code API Version: ' + this.vscodeApiVersion}

; } diff --git a/theia-extensions/theia-blueprint-product/src/browser/theia-blueprint-getting-started-widget.tsx b/theia-extensions/theia-blueprint-product/src/browser/theia-blueprint-getting-started-widget.tsx index be0bb3d1a..6c84aa874 100644 --- a/theia-extensions/theia-blueprint-product/src/browser/theia-blueprint-getting-started-widget.tsx +++ b/theia-extensions/theia-blueprint-product/src/browser/theia-blueprint-getting-started-widget.tsx @@ -15,17 +15,26 @@ ********************************************************************************/ import * as React from 'react'; -import { inject, injectable } from 'inversify'; +import { inject, injectable, postConstruct } from 'inversify'; import { renderDocumentation, renderDownloads, renderSourceCode, renderTickets, renderWhatIs, renderWhatIsNot } from './branding-util'; import { GettingStartedWidget } from '@theia/getting-started/lib/browser/getting-started-widget'; -import { VSXApiVersionProvider } from '@theia/vsx-registry/lib/common/vsx-api-version-provider'; +import { VSXEnvironment } from '@theia/vsx-registry/lib/common/vsx-environment'; @injectable() export class TheiaBlueprintGettingStartedWidget extends GettingStartedWidget { - @inject(VSXApiVersionProvider) - protected readonly apiVersionProvider: VSXApiVersionProvider; + @inject(VSXEnvironment) + protected readonly environment: VSXEnvironment; + + protected vscodeApiVersion: string; + + @postConstruct() + protected async init(): Promise { + super.init(); + this.vscodeApiVersion = await this.environment.getVscodeApiVersion(); + this.update(); + } protected render(): React.ReactNode { return
@@ -108,7 +117,7 @@ export class TheiaBlueprintGettingStartedWidget extends GettingStartedWidget {

- {'VS Code API Version: ' + this.apiVersionProvider.getApiVersion()} + {'VS Code API Version: ' + this.vscodeApiVersion}

; }