提交 01c2f555 编写于 作者: J Joao Moreno

fixes #77583

上级 752e2048
...@@ -30,6 +30,7 @@ import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; ...@@ -30,6 +30,7 @@ import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
import { CommandsRegistry } from 'vs/platform/commands/common/commands'; import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { FalseContext } from 'vs/platform/contextkey/common/contextkeys'; import { FalseContext } from 'vs/platform/contextkey/common/contextkeys';
import { ShowCurrentReleaseNotesActionId } from 'vs/workbench/contrib/update/common/update'; import { ShowCurrentReleaseNotesActionId } from 'vs/workbench/contrib/update/common/update';
import { IWindowService, IWindowsService } from 'vs/platform/windows/common/windows';
const CONTEXT_UPDATE_STATE = new RawContextKey<string>('updateState', StateType.Uninitialized); const CONTEXT_UPDATE_STATE = new RawContextKey<string>('updateState', StateType.Uninitialized);
...@@ -120,36 +121,44 @@ export class ProductContribution implements IWorkbenchContribution { ...@@ -120,36 +121,44 @@ export class ProductContribution implements IWorkbenchContribution {
@INotificationService notificationService: INotificationService, @INotificationService notificationService: INotificationService,
@IEnvironmentService environmentService: IEnvironmentService, @IEnvironmentService environmentService: IEnvironmentService,
@IOpenerService openerService: IOpenerService, @IOpenerService openerService: IOpenerService,
@IConfigurationService configurationService: IConfigurationService @IConfigurationService configurationService: IConfigurationService,
@IWindowService windowService: IWindowService,
@IWindowsService windowsService: IWindowsService
) { ) {
const lastVersion = storageService.get(ProductContribution.KEY, StorageScope.GLOBAL, ''); windowsService.getActiveWindowId().then(async windowId => {
const shouldShowReleaseNotes = configurationService.getValue<boolean>('update.showReleaseNotes'); if (windowId !== windowService.windowId) {
return;
// was there an update? if so, open release notes }
if (shouldShowReleaseNotes && !environmentService.skipReleaseNotes && product.releaseNotesUrl && lastVersion && pkg.version !== lastVersion) {
showReleaseNotes(instantiationService, pkg.version) const lastVersion = storageService.get(ProductContribution.KEY, StorageScope.GLOBAL, '');
.then(undefined, () => { const shouldShowReleaseNotes = configurationService.getValue<boolean>('update.showReleaseNotes');
notificationService.prompt(
severity.Info, // was there an update? if so, open release notes
nls.localize('read the release notes', "Welcome to {0} v{1}! Would you like to read the Release Notes?", product.nameLong, pkg.version), if (shouldShowReleaseNotes && !environmentService.skipReleaseNotes && product.releaseNotesUrl && lastVersion && pkg.version !== lastVersion) {
[{ showReleaseNotes(instantiationService, pkg.version)
label: nls.localize('releaseNotes', "Release Notes"), .then(undefined, () => {
run: () => { notificationService.prompt(
const uri = URI.parse(product.releaseNotesUrl); severity.Info,
openerService.open(uri); nls.localize('read the release notes', "Welcome to {0} v{1}! Would you like to read the Release Notes?", product.nameLong, pkg.version),
} [{
}], label: nls.localize('releaseNotes', "Release Notes"),
{ sticky: true } run: () => {
); const uri = URI.parse(product.releaseNotesUrl);
}); openerService.open(uri);
} }
}],
// should we show the new license? { sticky: true }
if (product.licenseUrl && lastVersion && semver.satisfies(lastVersion, '<1.0.0') && semver.satisfies(pkg.version, '>=1.0.0')) { );
notificationService.info(nls.localize('licenseChanged', "Our license terms have changed, please click [here]({0}) to go through them.", product.licenseUrl)); });
} }
storageService.store(ProductContribution.KEY, pkg.version, StorageScope.GLOBAL); // should we show the new license?
if (product.licenseUrl && lastVersion && semver.satisfies(lastVersion, '<1.0.0') && semver.satisfies(pkg.version, '>=1.0.0')) {
notificationService.info(nls.localize('licenseChanged', "Our license terms have changed, please click [here]({0}) to go through them.", product.licenseUrl));
}
storageService.store(ProductContribution.KEY, pkg.version, StorageScope.GLOBAL);
});
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册