@codingame/monaco-vscode-update-service-override 5.2.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-update-service-override",
3
- "version": "5.2.0",
3
+ "version": "6.0.0",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -26,6 +26,6 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "vscode": "npm:@codingame/monaco-vscode-api@5.2.0"
29
+ "vscode": "npm:@codingame/monaco-vscode-api@6.0.0"
30
30
  }
31
31
  }
package/update.js CHANGED
@@ -1,7 +1,12 @@
1
+ import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
2
+ import { IUpdateService } from 'vscode/vscode/vs/platform/update/common/update.service';
3
+ import { BrowserUpdateService } from './vscode/src/vs/workbench/services/update/browser/updateService.js';
1
4
  import './vscode/src/vs/workbench/contrib/update/browser/update.contribution.js';
2
5
 
3
6
  function getServiceOverride() {
4
- return {};
7
+ return {
8
+ [( IUpdateService.toString())]: new SyncDescriptor(BrowserUpdateService, [], true)
9
+ };
5
10
  }
6
11
 
7
12
  export { getServiceOverride as default };
@@ -1,6 +1,6 @@
1
1
  import { isWindows, isWeb } from 'vscode/vscode/vs/base/common/platform';
2
2
  import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
- import { Extensions } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
3
+ import { Extensions, ConfigurationScope } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
4
4
  import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
5
5
 
6
6
  const _moduleId = "vs/platform/update/common/update.config.contribution";
@@ -15,7 +15,7 @@ configurationRegistry.registerConfiguration({
15
15
  type: 'string',
16
16
  enum: ['none', 'manual', 'start', 'default'],
17
17
  default: 'default',
18
- scope: 1 ,
18
+ scope: ConfigurationScope.APPLICATION,
19
19
  description: ( localizeWithPath(
20
20
  _moduleId,
21
21
  1,
@@ -48,7 +48,7 @@ configurationRegistry.registerConfiguration({
48
48
  'update.channel': {
49
49
  type: 'string',
50
50
  default: 'default',
51
- scope: 1 ,
51
+ scope: ConfigurationScope.APPLICATION,
52
52
  description: ( localizeWithPath(
53
53
  _moduleId,
54
54
  1,
@@ -64,7 +64,7 @@ configurationRegistry.registerConfiguration({
64
64
  'update.enableWindowsBackgroundUpdates': {
65
65
  type: 'boolean',
66
66
  default: true,
67
- scope: 1 ,
67
+ scope: ConfigurationScope.APPLICATION,
68
68
  title: ( localizeWithPath(_moduleId, 7, "Enable Background Updates on Windows")),
69
69
  description: ( localizeWithPath(
70
70
  _moduleId,
@@ -76,7 +76,7 @@ configurationRegistry.registerConfiguration({
76
76
  'update.showReleaseNotes': {
77
77
  type: 'boolean',
78
78
  default: true,
79
- scope: 1 ,
79
+ scope: ConfigurationScope.APPLICATION,
80
80
  description: ( localizeWithPath(
81
81
  _moduleId,
82
82
  9,
@@ -3,6 +3,7 @@ import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
3
  import { IPreferencesService } from 'vscode/vscode/vs/workbench/services/preferences/common/preferences.service';
4
4
  import { settingKeyToDisplayFormat } from 'vscode/vscode/vs/workbench/contrib/preferences/browser/settingsTreeModels';
5
5
  import { Schemas } from 'vscode/vscode/vs/base/common/network';
6
+ import { ConfigurationTarget } from 'vscode/vscode/vs/platform/configuration/common/configuration';
6
7
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
7
8
  import { DefaultSettings } from 'vscode/vscode/vs/workbench/services/preferences/common/preferencesModels';
8
9
  import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView.service';
@@ -23,7 +24,7 @@ let SimpleSettingRenderer = class SimpleSettingRenderer {
23
24
  this._encounteredSettings = ( (new Map()));
24
25
  this._featuredSettings = ( (new Map()));
25
26
  this.settingsGroups = undefined;
26
- this._defaultSettings = ( (new DefaultSettings([], 2 )));
27
+ this._defaultSettings = ( (new DefaultSettings([], ConfigurationTarget.USER)));
27
28
  }
28
29
  get featuredSettingStates() {
29
30
  const result = ( (new Map()));
@@ -195,11 +196,11 @@ let SimpleSettingRenderer = class SimpleSettingRenderer {
195
196
  async restoreSetting(settingId) {
196
197
  const userOriginalSettingValue = this._updatedSettings.get(settingId);
197
198
  this._updatedSettings.delete(settingId);
198
- return this._configurationService.updateValue(settingId, userOriginalSettingValue, 2 );
199
+ return this._configurationService.updateValue(settingId, userOriginalSettingValue, ConfigurationTarget.USER);
199
200
  }
200
201
  async setSetting(settingId, currentSettingValue, newSettingValue) {
201
202
  this._updatedSettings.set(settingId, currentSettingValue);
202
- return this._configurationService.updateValue(settingId, newSettingValue, 2 );
203
+ return this._configurationService.updateValue(settingId, newSettingValue, ConfigurationTarget.USER);
203
204
  }
204
205
  getActions(uri) {
205
206
  if (uri.scheme !== Schemas.codeSetting) {
@@ -25,6 +25,7 @@ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/commo
25
25
  import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions.service';
26
26
  import { supportsTelemetry, getTelemetryLevel } from 'vscode/vscode/vs/platform/telemetry/common/telemetryUtils';
27
27
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
28
+ import { TelemetryLevel } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
28
29
  import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
29
30
  import { SimpleSettingRenderer } from '../../markdown/browser/markdownSettingRenderer.js';
30
31
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
@@ -200,7 +201,7 @@ let ReleaseNotesManager = class ReleaseNotesManager {
200
201
  }
201
202
  }
202
203
  async addGAParameters(uri, origin, experiment = '1') {
203
- if (supportsTelemetry(this._productService, this._environmentService) && getTelemetryLevel(this._configurationService) === 3 ) {
204
+ if (supportsTelemetry(this._productService, this._environmentService) && getTelemetryLevel(this._configurationService) === TelemetryLevel.USAGE) {
204
205
  if (uri.scheme === 'https' && uri.authority === 'code.visualstudio.com') {
205
206
  return uri.with({ query: `${uri.query ? uri.query + '&' : ''}utm_source=VsCode&utm_medium=${encodeURIComponent(origin)}&utm_content=${encodeURIComponent(experiment)}` });
206
207
  }
@@ -5,7 +5,9 @@ import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
5
5
  import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
6
6
  import { Action2, MenuId, registerAction2 } from 'vscode/vscode/vs/platform/actions/common/actions';
7
7
  import { ProductContribution, UpdateContribution, SwitchProductQualityContribution, RELEASE_NOTES_URL, showReleaseNotesInEditor, CONTEXT_UPDATE_STATE, DOWNLOAD_URL } from './update.js';
8
+ import { LifecyclePhase } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
8
9
  import product$1 from 'vscode/vscode/vs/platform/product/common/product';
10
+ import { StateType } from 'vscode/vscode/vs/platform/update/common/update';
9
11
  import { IUpdateService } from 'vscode/vscode/vs/platform/update/common/update.service';
10
12
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
11
13
  import { isWindows } from 'vscode/vscode/vs/base/common/platform';
@@ -20,9 +22,9 @@ import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/cont
20
22
 
21
23
  const _moduleId = "vs/workbench/contrib/update/browser/update.contribution";
22
24
  const workbench = ( (Registry.as(Extensions.Workbench)));
23
- workbench.registerWorkbenchContribution(ProductContribution, 3 );
24
- workbench.registerWorkbenchContribution(UpdateContribution, 3 );
25
- workbench.registerWorkbenchContribution(SwitchProductQualityContribution, 3 );
25
+ workbench.registerWorkbenchContribution(ProductContribution, LifecyclePhase.Restored);
26
+ workbench.registerWorkbenchContribution(UpdateContribution, LifecyclePhase.Restored);
27
+ workbench.registerWorkbenchContribution(SwitchProductQualityContribution, LifecyclePhase.Restored);
26
28
  class ShowCurrentReleaseNotesAction extends Action2 {
27
29
  constructor() {
28
30
  super({
@@ -99,7 +101,7 @@ class CheckForUpdateAction extends Action2 {
99
101
  title: ( localize2WithPath(_moduleId, 6, 'Check for Updates...')),
100
102
  category: { value: product$1.nameShort, original: product$1.nameShort },
101
103
  f1: true,
102
- precondition: ( (CONTEXT_UPDATE_STATE.isEqualTo("idle" ))),
104
+ precondition: ( (CONTEXT_UPDATE_STATE.isEqualTo(StateType.Idle))),
103
105
  });
104
106
  }
105
107
  async run(accessor) {
@@ -114,7 +116,7 @@ class DownloadUpdateAction extends Action2 {
114
116
  title: ( localize2WithPath(_moduleId, 7, 'Download Update')),
115
117
  category: { value: product$1.nameShort, original: product$1.nameShort },
116
118
  f1: true,
117
- precondition: ( (CONTEXT_UPDATE_STATE.isEqualTo("available for download" )))
119
+ precondition: ( (CONTEXT_UPDATE_STATE.isEqualTo(StateType.AvailableForDownload)))
118
120
  });
119
121
  }
120
122
  async run(accessor) {
@@ -128,7 +130,7 @@ class InstallUpdateAction extends Action2 {
128
130
  title: ( localize2WithPath(_moduleId, 8, 'Install Update')),
129
131
  category: { value: product$1.nameShort, original: product$1.nameShort },
130
132
  f1: true,
131
- precondition: ( (CONTEXT_UPDATE_STATE.isEqualTo("downloaded" )))
133
+ precondition: ( (CONTEXT_UPDATE_STATE.isEqualTo(StateType.Downloaded)))
132
134
  });
133
135
  }
134
136
  async run(accessor) {
@@ -142,7 +144,7 @@ class RestartToUpdateAction extends Action2 {
142
144
  title: ( localize2WithPath(_moduleId, 9, 'Restart to Update')),
143
145
  category: { value: product$1.nameShort, original: product$1.nameShort },
144
146
  f1: true,
145
- precondition: ( (CONTEXT_UPDATE_STATE.isEqualTo("ready" )))
147
+ precondition: ( (CONTEXT_UPDATE_STATE.isEqualTo(StateType.Ready)))
146
148
  });
147
149
  }
148
150
  async run(accessor) {
@@ -184,7 +186,7 @@ if (isWindows) {
184
186
  title: ( localize2WithPath(_moduleId, 11, 'Apply Update...')),
185
187
  category: Categories.Developer,
186
188
  f1: true,
187
- precondition: ( (CONTEXT_UPDATE_STATE.isEqualTo("idle" )))
189
+ precondition: ( (CONTEXT_UPDATE_STATE.isEqualTo(StateType.Idle)))
188
190
  });
189
191
  }
190
192
  async run(accessor) {
@@ -7,7 +7,9 @@ import { NumberBadge, ProgressBadge } from 'vscode/vscode/vs/workbench/services/
7
7
  import { IActivityService } from 'vscode/vscode/vs/workbench/services/activity/common/activity.service';
8
8
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
9
9
  import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener.service';
10
+ import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
10
11
  import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
12
+ import { StateType, DisablementReason } from 'vscode/vscode/vs/platform/update/common/update';
11
13
  import { IUpdateService } from 'vscode/vscode/vs/platform/update/common/update.service';
12
14
  import 'vscode/vscode/vs/platform/notification/common/notification';
13
15
  import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification.service';
@@ -22,6 +24,7 @@ import { MenuRegistry, MenuId, registerAction2, Action2 } from 'vscode/vscode/vs
22
24
  import { CommandsRegistry } from 'vscode/vscode/vs/platform/commands/common/commands';
23
25
  import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host.service';
24
26
  import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
27
+ import { SyncStatus } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync';
25
28
  import { IUserDataSyncEnablementService, IUserDataSyncStoreManagementService, IUserDataSyncService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync.service';
26
29
  import { IsWebContext } from 'vscode/vscode/vs/platform/contextkey/common/contextkeys';
27
30
  import { Promises } from 'vscode/vscode/vs/base/common/async';
@@ -31,7 +34,7 @@ import { Action } from 'vscode/vscode/vs/base/common/actions';
31
34
 
32
35
  var ProductContribution_1;
33
36
  const _moduleId = "vs/workbench/contrib/update/browser/update";
34
- const CONTEXT_UPDATE_STATE = ( (new RawContextKey('updateState', "uninitialized" )));
37
+ const CONTEXT_UPDATE_STATE = ( (new RawContextKey('updateState', StateType.Uninitialized)));
35
38
  const MAJOR_MINOR_UPDATE_AVAILABLE = ( (new RawContextKey('majorMinorUpdateAvailable', false)));
36
39
  const RELEASE_NOTES_URL = ( (new RawContextKey('releaseNotesUrl', '')));
37
40
  const DOWNLOAD_URL = ( (new RawContextKey('downloadUrl', '')));
@@ -105,7 +108,7 @@ let ProductContribution = class ProductContribution {
105
108
  if (!hadLastFocus) {
106
109
  return;
107
110
  }
108
- const lastVersion = parseVersion(storageService.get(ProductContribution_1.KEY, -1 , ''));
111
+ const lastVersion = parseVersion(storageService.get(ProductContribution_1.KEY, StorageScope.APPLICATION, ''));
109
112
  const currentVersion = parseVersion(productService.version);
110
113
  const shouldShowReleaseNotes = configurationService.getValue('update.showReleaseNotes');
111
114
  const releaseNotesUrl = productService.releaseNotesUrl;
@@ -127,7 +130,7 @@ let ProductContribution = class ProductContribution {
127
130
  }]);
128
131
  });
129
132
  }
130
- storageService.store(ProductContribution_1.KEY, productService.version, -1 , 1 );
133
+ storageService.store(ProductContribution_1.KEY, productService.version, StorageScope.APPLICATION, StorageTarget.MACHINE);
131
134
  });
132
135
  }
133
136
  };
@@ -163,18 +166,18 @@ let UpdateContribution = class UpdateContribution extends Disposable {
163
166
  this._register(updateService.onStateChange(this.onUpdateStateChange, this));
164
167
  this.onUpdateStateChange(this.updateService.state);
165
168
  const currentVersion = this.productService.commit;
166
- const lastKnownVersion = this.storageService.get('update/lastKnownVersion', -1 );
169
+ const lastKnownVersion = this.storageService.get('update/lastKnownVersion', StorageScope.APPLICATION);
167
170
  if (currentVersion !== lastKnownVersion) {
168
- this.storageService.remove('update/lastKnownVersion', -1 );
169
- this.storageService.remove('update/updateNotificationTime', -1 );
171
+ this.storageService.remove('update/lastKnownVersion', StorageScope.APPLICATION);
172
+ this.storageService.remove('update/updateNotificationTime', StorageScope.APPLICATION);
170
173
  }
171
174
  this.registerGlobalActivityActions();
172
175
  }
173
176
  async onUpdateStateChange(state) {
174
177
  this.updateStateContextKey.set(state.type);
175
178
  switch (state.type) {
176
- case "disabled" :
177
- if (state.reason === 5 ) {
179
+ case StateType.Disabled:
180
+ if (state.reason === DisablementReason.RunningAsAdmin) {
178
181
  this.notificationService.notify({
179
182
  severity: Severity$1.Info,
180
183
  message: ( localizeWithPath(
@@ -194,21 +197,21 @@ let UpdateContribution = class UpdateContribution extends Disposable {
194
197
  });
195
198
  }
196
199
  break;
197
- case "idle" :
200
+ case StateType.Idle:
198
201
  if (state.error) {
199
202
  this.onError(state.error);
200
203
  }
201
- else if (this.state.type === "checking for updates" && this.state.explicit && (await this.hostService.hadLastFocus())) {
204
+ else if (this.state.type === StateType.CheckingForUpdates && this.state.explicit && (await this.hostService.hadLastFocus())) {
202
205
  this.onUpdateNotAvailable();
203
206
  }
204
207
  break;
205
- case "available for download" :
208
+ case StateType.AvailableForDownload:
206
209
  this.onUpdateAvailable(state.update);
207
210
  break;
208
- case "downloaded" :
211
+ case StateType.Downloaded:
209
212
  this.onUpdateDownloaded(state.update);
210
213
  break;
211
- case "ready" : {
214
+ case StateType.Ready: {
212
215
  const productVersion = state.update.productVersion;
213
216
  if (productVersion) {
214
217
  const currentVersion = parseVersion(this.productService.version);
@@ -221,18 +224,18 @@ let UpdateContribution = class UpdateContribution extends Disposable {
221
224
  }
222
225
  let badge = undefined;
223
226
  let priority = undefined;
224
- if (state.type === "available for download" || state.type === "downloaded" || state.type === "ready" ) {
227
+ if (state.type === StateType.AvailableForDownload || state.type === StateType.Downloaded || state.type === StateType.Ready) {
225
228
  badge = ( (new NumberBadge(1, () => ( localizeWithPath(_moduleId, 5, "New {0} update available.", this.productService.nameShort)))));
226
229
  }
227
- else if (state.type === "checking for updates" ) {
230
+ else if (state.type === StateType.CheckingForUpdates) {
228
231
  badge = ( (new ProgressBadge(() => ( localizeWithPath(_moduleId, 6, "Checking for Updates...")))));
229
232
  priority = 1;
230
233
  }
231
- else if (state.type === "downloading" ) {
234
+ else if (state.type === StateType.Downloading) {
232
235
  badge = ( (new ProgressBadge(() => ( localizeWithPath(_moduleId, 7, "Downloading...")))));
233
236
  priority = 1;
234
237
  }
235
- else if (state.type === "updating" ) {
238
+ else if (state.type === StateType.Updating) {
236
239
  badge = ( (new ProgressBadge(() => ( localizeWithPath(_moduleId, 8, "Updating...")))));
237
240
  priority = 1;
238
241
  }
@@ -340,12 +343,12 @@ let UpdateContribution = class UpdateContribution extends Disposable {
340
343
  shouldShowNotification() {
341
344
  const currentVersion = this.productService.commit;
342
345
  const currentMillis = ( (new Date())).getTime();
343
- const lastKnownVersion = this.storageService.get('update/lastKnownVersion', -1 );
346
+ const lastKnownVersion = this.storageService.get('update/lastKnownVersion', StorageScope.APPLICATION);
344
347
  if (currentVersion !== lastKnownVersion) {
345
- this.storageService.store('update/lastKnownVersion', currentVersion, -1 , 1 );
346
- this.storageService.store('update/updateNotificationTime', currentMillis, -1 , 1 );
348
+ this.storageService.store('update/lastKnownVersion', currentVersion, StorageScope.APPLICATION, StorageTarget.MACHINE);
349
+ this.storageService.store('update/updateNotificationTime', currentMillis, StorageScope.APPLICATION, StorageTarget.MACHINE);
347
350
  }
348
- const updateNotificationMillis = this.storageService.getNumber('update/updateNotificationTime', -1 , currentMillis);
351
+ const updateNotificationMillis = this.storageService.getNumber('update/updateNotificationTime', StorageScope.APPLICATION, currentMillis);
349
352
  const diffDays = (currentMillis - updateNotificationMillis) / (1000 * 60 * 60 * 24);
350
353
  return diffDays > 5;
351
354
  }
@@ -357,7 +360,7 @@ let UpdateContribution = class UpdateContribution extends Disposable {
357
360
  id: 'update.check',
358
361
  title: ( localizeWithPath(_moduleId, 18, "Check for Updates..."))
359
362
  },
360
- when: ( (CONTEXT_UPDATE_STATE.isEqualTo("idle" )))
363
+ when: ( (CONTEXT_UPDATE_STATE.isEqualTo(StateType.Idle)))
361
364
  });
362
365
  CommandsRegistry.registerCommand('update.checking', () => { });
363
366
  MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
@@ -367,7 +370,7 @@ let UpdateContribution = class UpdateContribution extends Disposable {
367
370
  title: ( localizeWithPath(_moduleId, 6, "Checking for Updates...")),
368
371
  precondition: ( (ContextKeyExpr.false()))
369
372
  },
370
- when: ( (CONTEXT_UPDATE_STATE.isEqualTo("checking for updates" )))
373
+ when: ( (CONTEXT_UPDATE_STATE.isEqualTo(StateType.CheckingForUpdates)))
371
374
  });
372
375
  CommandsRegistry.registerCommand('update.downloadNow', () => this.updateService.downloadUpdate());
373
376
  MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
@@ -376,7 +379,7 @@ let UpdateContribution = class UpdateContribution extends Disposable {
376
379
  id: 'update.downloadNow',
377
380
  title: ( localizeWithPath(_moduleId, 19, "Download Update (1)"))
378
381
  },
379
- when: ( (CONTEXT_UPDATE_STATE.isEqualTo("available for download" )))
382
+ when: ( (CONTEXT_UPDATE_STATE.isEqualTo(StateType.AvailableForDownload)))
380
383
  });
381
384
  CommandsRegistry.registerCommand('update.downloading', () => { });
382
385
  MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
@@ -386,7 +389,7 @@ let UpdateContribution = class UpdateContribution extends Disposable {
386
389
  title: ( localizeWithPath(_moduleId, 20, "Downloading Update...")),
387
390
  precondition: ( (ContextKeyExpr.false()))
388
391
  },
389
- when: ( (CONTEXT_UPDATE_STATE.isEqualTo("downloading" )))
392
+ when: ( (CONTEXT_UPDATE_STATE.isEqualTo(StateType.Downloading)))
390
393
  });
391
394
  CommandsRegistry.registerCommand('update.install', () => this.updateService.applyUpdate());
392
395
  MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
@@ -395,7 +398,7 @@ let UpdateContribution = class UpdateContribution extends Disposable {
395
398
  id: 'update.install',
396
399
  title: ( localizeWithPath(_moduleId, 21, "Install Update... (1)"))
397
400
  },
398
- when: ( (CONTEXT_UPDATE_STATE.isEqualTo("downloaded" )))
401
+ when: ( (CONTEXT_UPDATE_STATE.isEqualTo(StateType.Downloaded)))
399
402
  });
400
403
  CommandsRegistry.registerCommand('update.updating', () => { });
401
404
  MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
@@ -405,11 +408,11 @@ let UpdateContribution = class UpdateContribution extends Disposable {
405
408
  title: ( localizeWithPath(_moduleId, 22, "Installing Update...")),
406
409
  precondition: ( (ContextKeyExpr.false()))
407
410
  },
408
- when: ( (CONTEXT_UPDATE_STATE.isEqualTo("updating" )))
411
+ when: ( (CONTEXT_UPDATE_STATE.isEqualTo(StateType.Updating)))
409
412
  });
410
413
  if (this.productService.quality === 'stable') {
411
414
  CommandsRegistry.registerCommand('update.showUpdateReleaseNotes', () => {
412
- if (this.updateService.state.type !== "ready" ) {
415
+ if (this.updateService.state.type !== StateType.Ready) {
413
416
  return;
414
417
  }
415
418
  const productVersion = this.updateService.state.update.productVersion;
@@ -425,7 +428,7 @@ let UpdateContribution = class UpdateContribution extends Disposable {
425
428
  title: ( localizeWithPath(_moduleId, 23, "Show Update Release Notes"))
426
429
  },
427
430
  when: ( (ContextKeyExpr.and(
428
- (CONTEXT_UPDATE_STATE.isEqualTo("ready" )),
431
+ (CONTEXT_UPDATE_STATE.isEqualTo(StateType.Ready)),
429
432
  MAJOR_MINOR_UPDATE_AVAILABLE
430
433
  )))
431
434
  });
@@ -438,7 +441,7 @@ let UpdateContribution = class UpdateContribution extends Disposable {
438
441
  id: 'update.restart',
439
442
  title: ( localizeWithPath(_moduleId, 24, "Restart to Update (1)"))
440
443
  },
441
- when: ( (CONTEXT_UPDATE_STATE.isEqualTo("ready" )))
444
+ when: ( (CONTEXT_UPDATE_STATE.isEqualTo(StateType.Ready)))
442
445
  });
443
446
  CommandsRegistry.registerCommand('_update.state', () => {
444
447
  return this.state;
@@ -498,12 +501,12 @@ let SwitchProductQualityContribution = class SwitchProductQualityContribution ex
498
501
  const userDataSyncStore = userDataSyncStoreManagementService.userDataSyncStore;
499
502
  let userDataSyncStoreType;
500
503
  if (userDataSyncStore && isSwitchingToInsiders && userDataSyncEnablementService.isEnabled()
501
- && !storageService.getBoolean(selectSettingsSyncServiceDialogShownKey, -1 , false)) {
504
+ && !storageService.getBoolean(selectSettingsSyncServiceDialogShownKey, StorageScope.APPLICATION, false)) {
502
505
  userDataSyncStoreType = await this.selectSettingsSyncService(dialogService);
503
506
  if (!userDataSyncStoreType) {
504
507
  return;
505
508
  }
506
- storageService.store(selectSettingsSyncServiceDialogShownKey, true, -1 , 0 );
509
+ storageService.store(selectSettingsSyncServiceDialogShownKey, true, StorageScope.APPLICATION, StorageTarget.USER);
507
510
  if (userDataSyncStoreType === 'stable') {
508
511
  await userDataSyncStoreManagementService.switch(userDataSyncStoreType);
509
512
  }
@@ -526,8 +529,8 @@ let SwitchProductQualityContribution = class SwitchProductQualityContribution ex
526
529
  });
527
530
  if (res.confirmed) {
528
531
  const promises = [];
529
- if (userDataSyncService.status === "syncing" ) {
530
- promises.push(Event.toPromise(Event.filter(userDataSyncService.onDidChangeStatus, status => status !== "syncing" )));
532
+ if (userDataSyncService.status === SyncStatus.Syncing) {
533
+ promises.push(Event.toPromise(Event.filter(userDataSyncService.onDidChangeStatus, status => status !== SyncStatus.Syncing)));
531
534
  }
532
535
  if (isSwitchingToInsiders && userDataSyncStoreType) {
533
536
  promises.push(userDataSyncWorkbenchService.synchroniseUserDataSyncStoreType());
@@ -537,7 +540,7 @@ let SwitchProductQualityContribution = class SwitchProductQualityContribution ex
537
540
  }
538
541
  else {
539
542
  if (userDataSyncStoreType) {
540
- storageService.remove(selectSettingsSyncServiceDialogShownKey, -1 );
543
+ storageService.remove(selectSettingsSyncServiceDialogShownKey, StorageScope.APPLICATION);
541
544
  }
542
545
  }
543
546
  }
@@ -0,0 +1,66 @@
1
+ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
+ import { Emitter } from 'vscode/vscode/vs/base/common/event';
3
+ import { State, UpdateType } from 'vscode/vscode/vs/platform/update/common/update';
4
+ import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
5
+ import 'vscode/vscode/vs/platform/instantiation/common/extensions';
6
+ import { IBrowserWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/browser/environmentService.service';
7
+ import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host.service';
8
+ import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
9
+
10
+ let BrowserUpdateService = class BrowserUpdateService extends Disposable {
11
+ get state() { return this._state; }
12
+ set state(state) {
13
+ this._state = state;
14
+ this._onStateChange.fire(state);
15
+ }
16
+ constructor(environmentService, hostService) {
17
+ super();
18
+ this.environmentService = environmentService;
19
+ this.hostService = hostService;
20
+ this._onStateChange = this._register(( new Emitter()));
21
+ this.onStateChange = this._onStateChange.event;
22
+ this._state = State.Uninitialized;
23
+ this.checkForUpdates(false);
24
+ }
25
+ async isLatestVersion() {
26
+ const update = await this.doCheckForUpdates(false);
27
+ if (update === undefined) {
28
+ return undefined;
29
+ }
30
+ return !!update;
31
+ }
32
+ async checkForUpdates(explicit) {
33
+ await this.doCheckForUpdates(explicit);
34
+ }
35
+ async doCheckForUpdates(explicit) {
36
+ if (this.environmentService.options && this.environmentService.options.updateProvider) {
37
+ const updateProvider = this.environmentService.options.updateProvider;
38
+ this.state = State.CheckingForUpdates(explicit);
39
+ const update = await updateProvider.checkForUpdate();
40
+ if (update) {
41
+ this.state = State.Ready({ version: update.version, productVersion: update.version });
42
+ }
43
+ else {
44
+ this.state = State.Idle(UpdateType.Archive);
45
+ }
46
+ return update;
47
+ }
48
+ return undefined;
49
+ }
50
+ async downloadUpdate() {
51
+ }
52
+ async applyUpdate() {
53
+ this.hostService.reload();
54
+ }
55
+ async quitAndInstall() {
56
+ this.hostService.reload();
57
+ }
58
+ async _applySpecificUpdate(packagePath) {
59
+ }
60
+ };
61
+ BrowserUpdateService = ( __decorate([
62
+ ( __param(0, IBrowserWorkbenchEnvironmentService)),
63
+ ( __param(1, IHostService))
64
+ ], BrowserUpdateService));
65
+
66
+ export { BrowserUpdateService };