未验证 提交 22316bec 编写于 作者: B Benjamin Pasero 提交者: GitHub

introduce sessionId (#83144)

......@@ -635,6 +635,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
// Set window ID
windowConfiguration.windowId = this._win.id;
windowConfiguration.sessionId = `window:${this._win.id}`;
windowConfiguration.logLevel = this.logService.getLevel();
// Set zoomlevel
......
......@@ -551,8 +551,8 @@ export class Menubar {
label: this.mnemonicLabel(nls.localize('miCheckForUpdates', "Check for &&Updates...")), click: () => setTimeout(() => {
this.reportMenuActionTelemetry('CheckForUpdate');
const focusedWindow = BrowserWindow.getFocusedWindow();
const context = focusedWindow ? { windowId: focusedWindow.id } : null;
const window = this.windowsMainService.getLastActiveWindow();
const context = window?.config?.sessionId;
this.updateService.checkForUpdates(context);
}, 0)
})];
......
......@@ -220,7 +220,8 @@ export interface IAddFoldersRequest {
export interface IWindowConfiguration extends ParsedArgs {
machineId: string;
windowId: number;
windowId: number; // TODO: should we deprecate this in favor of sessionId?
sessionId: string;
logLevel: LogLevel;
mainPid: number;
......
......@@ -293,6 +293,7 @@ export class CustomMenubarControl extends MenubarControl {
@IThemeService private readonly themeService: IThemeService,
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService,
@IHostService protected readonly hostService: IHostService,
@IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService,
@optional(IElectronService) private readonly electronService: IElectronService,
@optional(IElectronEnvironmentService) private readonly electronEnvironmentService: IElectronEnvironmentService
) {
......@@ -444,9 +445,8 @@ export class CustomMenubarControl extends MenubarControl {
return null;
case StateType.Idle:
const context = `window:${this.electronEnvironmentService ? this.electronEnvironmentService.windowId : 'any'}`;
return new Action('update.check', nls.localize({ key: 'checkForUpdates', comment: ['&& denotes a mnemonic'] }, "Check for &&Updates..."), undefined, true, () =>
this.updateService.checkForUpdates(context));
this.updateService.checkForUpdates(this.workbenchEnvironmentService.configuration.sessionId));
case StateType.CheckingForUpdates:
return new Action('update.checking', nls.localize('checkingForUpdates', "Checking for Updates..."), undefined, false);
......
......@@ -9,7 +9,7 @@ import { Action } from 'vs/base/common/actions';
import { Disposable, MutableDisposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { IActivityService, NumberBadge, IBadge, ProgressBadge } from 'vs/workbench/services/activity/common/activity';
import { IInstantiationService, optional } from 'vs/platform/instantiation/common/instantiation';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { GLOBAL_ACTIVITY_ID } from 'vs/workbench/common/activity';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
......@@ -30,10 +30,6 @@ import { ShowCurrentReleaseNotesActionId } from 'vs/workbench/contrib/update/com
import { IHostService } from 'vs/workbench/services/host/browser/host';
import { IProductService } from 'vs/platform/product/common/productService';
// TODO@Joao layer breaker
// tslint:disable-next-line: layering
import { IElectronEnvironmentService } from 'vs/workbench/services/electron/electron-browser/electronEnvironmentService';
const CONTEXT_UPDATE_STATE = new RawContextKey<string>('updateState', StateType.Uninitialized);
let releaseNotesManager: ReleaseNotesManager | undefined = undefined;
......@@ -171,8 +167,6 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
private readonly badgeDisposable = this._register(new MutableDisposable());
private updateStateContextKey: IContextKey<string>;
private context = `window:${this.electronEnvironmentService ? this.electronEnvironmentService.windowId : 'any'}`;
constructor(
@IStorageService private readonly storageService: IStorageService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
......@@ -182,7 +176,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
@IActivityService private readonly activityService: IActivityService,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IProductService private readonly productService: IProductService,
@optional(IElectronEnvironmentService) private readonly electronEnvironmentService: IElectronEnvironmentService
@IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService
) {
super();
this.state = updateService.state;
......@@ -218,7 +212,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
case StateType.Idle:
if (state.error) {
this.onError(state.error);
} else if (this.state.type === StateType.CheckingForUpdates && this.state.context === this.context) {
} else if (this.state.type === StateType.CheckingForUpdates && this.state.context === this.workbenchEnvironmentService.configuration.sessionId) {
this.onUpdateNotAvailable();
}
break;
......@@ -401,7 +395,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
}
private registerGlobalActivityActions(): void {
CommandsRegistry.registerCommand('update.check', () => this.updateService.checkForUpdates(this.context));
CommandsRegistry.registerCommand('update.check', () => this.updateService.checkForUpdates(this.workbenchEnvironmentService.configuration.sessionId));
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
group: '6_update',
command: {
......
......@@ -43,6 +43,7 @@ export class BrowserWindowConfiguration implements IWindowConfiguration {
readonly machineId = generateUuid();
windowId!: number;
sessionId!: string;
logLevel!: LogLevel;
mainPid!: number;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册