@@ -9,7 +9,7 @@ import { Action } from 'vs/base/common/actions';
99import { Disposable , MutableDisposable } from 'vs/base/common/lifecycle' ;
1010import { URI } from 'vs/base/common/uri' ;
1111import { IActivityService , NumberBadge , IBadge , ProgressBadge } from 'vs/workbench/services/activity/common/activity' ;
12- import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
12+ import { IInstantiationService , optional } from 'vs/platform/instantiation/common/instantiation' ;
1313import { GLOBAL_ACTIVITY_ID } from 'vs/workbench/common/activity' ;
1414import { IOpenerService } from 'vs/platform/opener/common/opener' ;
1515import { IWorkbenchContribution } from 'vs/workbench/common/contributions' ;
@@ -30,6 +30,10 @@ import { ShowCurrentReleaseNotesActionId } from 'vs/workbench/contrib/update/com
3030import { IHostService } from 'vs/workbench/services/host/browser/host' ;
3131import { IProductService } from 'vs/platform/product/common/productService' ;
3232
33+ // TODO@Joao layer breaker
34+ // tslint:disable-next-line: layering
35+ import { IElectronEnvironmentService } from 'vs/workbench/services/electron/electron-browser/electronEnvironmentService' ;
36+
3337const CONTEXT_UPDATE_STATE = new RawContextKey < string > ( 'updateState' , StateType . Uninitialized ) ;
3438
3539let releaseNotesManager : ReleaseNotesManager | undefined = undefined ;
@@ -167,16 +171,18 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
167171 private readonly badgeDisposable = this . _register ( new MutableDisposable ( ) ) ;
168172 private updateStateContextKey : IContextKey < string > ;
169173
174+ private windowId : number | undefined = this . electronEnvironmentService ? this . electronEnvironmentService . windowId : undefined ;
175+
170176 constructor (
171177 @IStorageService private readonly storageService : IStorageService ,
172178 @IInstantiationService private readonly instantiationService : IInstantiationService ,
173179 @INotificationService private readonly notificationService : INotificationService ,
174180 @IDialogService private readonly dialogService : IDialogService ,
175181 @IUpdateService private readonly updateService : IUpdateService ,
176182 @IActivityService private readonly activityService : IActivityService ,
177- @IWorkbenchEnvironmentService private readonly environmentService : IWorkbenchEnvironmentService ,
178183 @IContextKeyService private readonly contextKeyService : IContextKeyService ,
179- @IProductService private readonly productService : IProductService
184+ @IProductService private readonly productService : IProductService ,
185+ @optional ( IElectronEnvironmentService ) private readonly electronEnvironmentService : IElectronEnvironmentService
180186 ) {
181187 super ( ) ;
182188 this . state = updateService . state ;
@@ -212,7 +218,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
212218 case StateType . Idle :
213219 if ( state . error ) {
214220 this . onError ( state . error ) ;
215- } else if ( this . state . type === StateType . CheckingForUpdates && this . state . context && this . state . context . windowId === this . environmentService . configuration . windowId ) {
221+ } else if ( this . state . type === StateType . CheckingForUpdates && this . state . context && this . state . context . windowId === this . windowId ) {
216222 this . onUpdateNotAvailable ( ) ;
217223 }
218224 break ;
@@ -395,7 +401,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
395401 }
396402
397403 private registerGlobalActivityActions ( ) : void {
398- CommandsRegistry . registerCommand ( 'update.check' , ( ) => this . updateService . checkForUpdates ( { windowId : this . environmentService . configuration . windowId } ) ) ;
404+ CommandsRegistry . registerCommand ( 'update.check' , ( ) => this . updateService . checkForUpdates ( { windowId : this . windowId } ) ) ;
399405 MenuRegistry . appendMenuItem ( MenuId . GlobalActivity , {
400406 group : '6_update' ,
401407 command : {
0 commit comments