@codingame/monaco-vscode-update-service-override 37.2.0 → 37.3.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.
Files changed (19) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/platform/update/common/update.config.contribution.js +18 -18
  3. package/vscode/src/vs/workbench/contrib/update/browser/postUpdateWidget.js +5 -5
  4. package/vscode/src/vs/workbench/contrib/update/browser/update.contribution.js +19 -19
  5. package/vscode/src/vs/workbench/browser/media/code-icon.svg +0 -1
  6. package/vscode/src/vs/workbench/contrib/markdown/browser/markdownSettingRenderer.d.ts +0 -43
  7. package/vscode/src/vs/workbench/contrib/markdown/browser/markdownSettingRenderer.js +0 -330
  8. package/vscode/src/vs/workbench/contrib/update/browser/media/updateTitleBarEntry.css +0 -91
  9. package/vscode/src/vs/workbench/contrib/update/browser/media/updateTooltip.css +0 -165
  10. package/vscode/src/vs/workbench/contrib/update/browser/releaseNotesEditor.d.ts +0 -67
  11. package/vscode/src/vs/workbench/contrib/update/browser/releaseNotesEditor.js +0 -646
  12. package/vscode/src/vs/workbench/contrib/update/browser/update.d.ts +0 -65
  13. package/vscode/src/vs/workbench/contrib/update/browser/update.js +0 -498
  14. package/vscode/src/vs/workbench/contrib/update/browser/updateTitleBarEntry.d.ts +0 -64
  15. package/vscode/src/vs/workbench/contrib/update/browser/updateTitleBarEntry.js +0 -364
  16. package/vscode/src/vs/workbench/contrib/update/browser/updateTooltip.d.ts +0 -61
  17. package/vscode/src/vs/workbench/contrib/update/browser/updateTooltip.js +0 -395
  18. package/vscode/src/vs/workbench/contrib/update/common/updateUtils.d.ts +0 -61
  19. package/vscode/src/vs/workbench/contrib/update/common/updateUtils.js +0 -129
@@ -1,65 +0,0 @@
1
- import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
- import { IActivityService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/activity/common/activity.service";
3
- import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
4
- import { IOpenerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service";
5
- import { IWorkbenchContribution } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions";
6
- import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
7
- import { IUpdateService } from "@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update.service";
8
- import { INotificationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service";
9
- import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
10
- import { IBrowserWorkbenchEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/browser/environmentService.service";
11
- import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
12
- import { RawContextKey } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey";
13
- import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
14
- import { MenuId } from "@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions";
15
- import { IHostService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service";
16
- import { IProductService } from "@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service";
17
- import { IDefaultAccountService } from "@codingame/monaco-vscode-api/vscode/vs/platform/defaultAccount/common/defaultAccount.service";
18
- export declare const CONTEXT_UPDATE_STATE: RawContextKey<string>;
19
- export declare const MAJOR_MINOR_UPDATE_AVAILABLE: RawContextKey<boolean>;
20
- export declare function showReleaseNotesInEditor(instantiationService: IInstantiationService, version: string, useCurrentFile: boolean): Promise<boolean>;
21
- /**
22
- * Appends update-related menu items to the given menu. This registers menu items
23
- * for all update states (idle, checking, downloading, etc.) that show the current
24
- * update status. The underlying commands (`update.check`, `update.restart`, etc.)
25
- * must be registered separately.
26
- */
27
- export declare function appendUpdateMenuItems(menuId: MenuId, group: string): void;
28
- export declare class ProductContribution implements IWorkbenchContribution {
29
- private static readonly KEY;
30
- constructor(storageService: IStorageService, instantiationService: IInstantiationService, notificationService: INotificationService, environmentService: IBrowserWorkbenchEnvironmentService, openerService: IOpenerService, configurationService: IConfigurationService, hostService: IHostService, productService: IProductService);
31
- }
32
- export declare class UpdateContribution extends Disposable implements IWorkbenchContribution {
33
- private readonly instantiationService;
34
- private readonly dialogService;
35
- private readonly updateService;
36
- private readonly activityService;
37
- private readonly contextKeyService;
38
- private readonly productService;
39
- private readonly hostService;
40
- private state;
41
- private readonly badgeDisposable;
42
- private updateStateContextKey;
43
- private majorMinorUpdateAvailableContextKey;
44
- constructor(storageService: IStorageService, instantiationService: IInstantiationService, dialogService: IDialogService, updateService: IUpdateService, activityService: IActivityService, contextKeyService: IContextKeyService, productService: IProductService, hostService: IHostService);
45
- private onUpdateStateChange;
46
- private updateBadge;
47
- private registerGlobalActivityActions;
48
- }
49
- export declare class SwitchProductQualityContribution extends Disposable implements IWorkbenchContribution {
50
- private readonly productService;
51
- private readonly environmentService;
52
- constructor(productService: IProductService, environmentService: IBrowserWorkbenchEnvironmentService);
53
- private registerGlobalActivityActions;
54
- }
55
- export declare class DefaultAccountUpdateContribution extends Disposable implements IWorkbenchContribution {
56
- #private;
57
- private readonly updateService;
58
- private readonly defaultAccountService;
59
- private readonly storageService;
60
- private static readonly STORAGE_KEY;
61
- private throttler;
62
- constructor(updateService: IUpdateService, defaultAccountService: IDefaultAccountService, storageService: IStorageService);
63
- private refresh;
64
- private doRefresh;
65
- }
@@ -1,498 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
4
- import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
5
- import { Disposable, MutableDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
6
- import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
7
- import { NumberBadge, ProgressBadge } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/activity/common/activity';
8
- import { IActivityService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/activity/common/activity.service';
9
- import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
10
- import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
11
- import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
12
- import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
13
- import { StateType } from '@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update';
14
- import { IUpdateService } from '@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update.service';
15
- import { NotificationPriority } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification';
16
- import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
17
- import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
18
- import { IBrowserWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/browser/environmentService.service';
19
- import { ReleaseNotesManager } from './releaseNotesEditor.js';
20
- import { isWeb } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
21
- import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
22
- import { RawContextKey, ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
23
- import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
24
- import { MenuRegistry, MenuId, registerAction2, Action2 } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
25
- import { CommandsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands';
26
- import { IHostService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service';
27
- import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
28
- import { SyncStatus } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync';
29
- import { IUserDataSyncEnablementService, IUserDataSyncStoreManagementService, IUserDataSyncService } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service';
30
- import { IsWebContext } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkeys';
31
- import { Promises, Throttler } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
32
- import { IUserDataSyncWorkbenchService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/userDataSync/common/userDataSync.service';
33
- import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
34
- import { IDefaultAccountService } from '@codingame/monaco-vscode-api/vscode/vs/platform/defaultAccount/common/defaultAccount.service';
35
- import { getInternalOrg } from '@codingame/monaco-vscode-api/vscode/vs/platform/assignment/common/assignment';
36
- import { tryParseVersion } from '../common/updateUtils.js';
37
- import { UpdateGlobalActivityBadgeVisibleContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/update/common/update';
38
-
39
- var ProductContribution_1, DefaultAccountUpdateContribution_1;
40
- const CONTEXT_UPDATE_STATE = ( new RawContextKey("updateState", StateType.Uninitialized));
41
- const MAJOR_MINOR_UPDATE_AVAILABLE = ( new RawContextKey("majorMinorUpdateAvailable", false));
42
- let releaseNotesManager = undefined;
43
- function showReleaseNotesInEditor(instantiationService, version, useCurrentFile) {
44
- if (!releaseNotesManager) {
45
- releaseNotesManager = instantiationService.createInstance(ReleaseNotesManager);
46
- }
47
- return releaseNotesManager.show(version, useCurrentFile);
48
- }
49
- async function openLatestReleaseNotesInBrowser(accessor) {
50
- const openerService = accessor.get(IOpenerService);
51
- const productService = accessor.get(IProductService);
52
- if (productService.releaseNotesUrl) {
53
- const uri = ( URI.parse(productService.releaseNotesUrl));
54
- await openerService.open(uri);
55
- } else {
56
- throw ( new Error(( localize(
57
- 18375,
58
- "This version of {0} does not have release notes online",
59
- productService.nameLong
60
- ))));
61
- }
62
- }
63
- async function showReleaseNotes(accessor, version) {
64
- const instantiationService = accessor.get(IInstantiationService);
65
- try {
66
- await showReleaseNotesInEditor(instantiationService, version, false);
67
- } catch (err) {
68
- try {
69
- await instantiationService.invokeFunction(openLatestReleaseNotesInBrowser);
70
- } catch (err2) {
71
- throw ( new Error(`${err.message} and ${err2.message}`));
72
- }
73
- }
74
- }
75
- function appendUpdateMenuItems(menuId, group) {
76
- MenuRegistry.appendMenuItem(menuId, {
77
- group,
78
- command: {
79
- id: "update.check",
80
- title: ( localize(18376, "Check for Updates..."))
81
- },
82
- when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Idle))
83
- });
84
- MenuRegistry.appendMenuItem(menuId, {
85
- group,
86
- command: {
87
- id: "update.checking",
88
- title: ( localize(18377, "Checking for Updates...")),
89
- precondition: ( ContextKeyExpr.false())
90
- },
91
- when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.CheckingForUpdates))
92
- });
93
- MenuRegistry.appendMenuItem(menuId, {
94
- group,
95
- command: {
96
- id: "update.downloadNow",
97
- title: ( localize(18378, "Download Update (1)"))
98
- },
99
- when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.AvailableForDownload))
100
- });
101
- MenuRegistry.appendMenuItem(menuId, {
102
- group,
103
- command: {
104
- id: "update.downloading",
105
- title: ( localize(18379, "Downloading Update...")),
106
- precondition: ( ContextKeyExpr.false())
107
- },
108
- when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Downloading))
109
- });
110
- MenuRegistry.appendMenuItem(menuId, {
111
- group,
112
- command: {
113
- id: "update.install",
114
- title: ( localize(18380, "Install Update... (1)"))
115
- },
116
- when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Downloaded))
117
- });
118
- MenuRegistry.appendMenuItem(menuId, {
119
- group,
120
- command: {
121
- id: "update.updating",
122
- title: ( localize(18381, "Installing Update...")),
123
- precondition: ( ContextKeyExpr.false())
124
- },
125
- when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Updating))
126
- });
127
- MenuRegistry.appendMenuItem(menuId, {
128
- group,
129
- command: {
130
- id: "update.cancelling",
131
- title: ( localize(18382, "Cancelling Update...")),
132
- precondition: ( ContextKeyExpr.false())
133
- },
134
- when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Cancelling))
135
- });
136
- MenuRegistry.appendMenuItem(menuId, {
137
- group,
138
- order: 2,
139
- command: {
140
- id: "update.restart",
141
- title: ( localize(18383, "Restart to Update (1)"))
142
- },
143
- when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Ready))
144
- });
145
- }
146
- function isMajorMinorUpdate(before, after) {
147
- return before.major < after.major || before.minor < after.minor;
148
- }
149
- let ProductContribution = class ProductContribution {
150
- static {
151
- ProductContribution_1 = this;
152
- }
153
- static {
154
- this.KEY = "releaseNotes/lastVersion";
155
- }
156
- constructor(
157
- storageService,
158
- instantiationService,
159
- notificationService,
160
- environmentService,
161
- openerService,
162
- configurationService,
163
- hostService,
164
- productService
165
- ) {
166
- if (isWeb) {
167
- return;
168
- }
169
- hostService.hadLastFocus().then(async hadLastFocus => {
170
- if (!hadLastFocus) {
171
- return;
172
- }
173
- const lastVersion = tryParseVersion(
174
- storageService.get(ProductContribution_1.KEY, StorageScope.APPLICATION, "")
175
- );
176
- const currentVersion = tryParseVersion(productService.version);
177
- const shouldShowReleaseNotes = configurationService.getValue("update.showReleaseNotes");
178
- const shouldShowPostInstallInfo = configurationService.getValue("update.showPostInstallInfo");
179
- const releaseNotesUrl = productService.releaseNotesUrl;
180
- if (shouldShowReleaseNotes && !shouldShowPostInstallInfo && !environmentService.skipReleaseNotes && releaseNotesUrl && lastVersion && currentVersion && isMajorMinorUpdate(lastVersion, currentVersion)) {
181
- showReleaseNotesInEditor(instantiationService, productService.version, false).then(undefined, () => {
182
- notificationService.prompt(Severity.Info, ( localize(
183
- 18384,
184
- "Welcome to {0} v{1}! Would you like to read the Release Notes?",
185
- productService.nameLong,
186
- productService.version
187
- )), [{
188
- label: ( localize(18385, "Release Notes")),
189
- run: () => {
190
- const uri = ( URI.parse(releaseNotesUrl));
191
- openerService.open(uri);
192
- }
193
- }], {
194
- priority: NotificationPriority.OPTIONAL
195
- });
196
- });
197
- }
198
- storageService.store(
199
- ProductContribution_1.KEY,
200
- productService.version,
201
- StorageScope.APPLICATION,
202
- StorageTarget.MACHINE
203
- );
204
- });
205
- }
206
- };
207
- ProductContribution = ProductContribution_1 = ( __decorate([( __param(0, IStorageService)), ( __param(1, IInstantiationService)), ( __param(2, INotificationService)), ( __param(3, IBrowserWorkbenchEnvironmentService)), ( __param(4, IOpenerService)), ( __param(5, IConfigurationService)), ( __param(6, IHostService)), ( __param(7, IProductService))], ProductContribution));
208
- let UpdateContribution = class UpdateContribution extends Disposable {
209
- constructor(
210
- storageService,
211
- instantiationService,
212
- dialogService,
213
- updateService,
214
- activityService,
215
- contextKeyService,
216
- productService,
217
- hostService
218
- ) {
219
- super();
220
- this.instantiationService = instantiationService;
221
- this.dialogService = dialogService;
222
- this.updateService = updateService;
223
- this.activityService = activityService;
224
- this.contextKeyService = contextKeyService;
225
- this.productService = productService;
226
- this.hostService = hostService;
227
- this.badgeDisposable = this._register(( new MutableDisposable()));
228
- this.state = updateService.state;
229
- this.updateStateContextKey = CONTEXT_UPDATE_STATE.bindTo(contextKeyService);
230
- this.majorMinorUpdateAvailableContextKey = MAJOR_MINOR_UPDATE_AVAILABLE.bindTo(contextKeyService);
231
- this._register(updateService.onStateChange(this.onUpdateStateChange, this));
232
- const updateGlobalActivityBadgeContextKeys = ( new Set(( UpdateGlobalActivityBadgeVisibleContext.keys())));
233
- this._register(contextKeyService.onDidChangeContext(e => {
234
- if (e.affectsSome(updateGlobalActivityBadgeContextKeys)) {
235
- this.updateBadge(this.updateService.state);
236
- }
237
- }));
238
- this.onUpdateStateChange(this.updateService.state);
239
- const currentVersion = this.productService.commit;
240
- const lastKnownVersion = storageService.get("update/lastKnownVersion", StorageScope.APPLICATION);
241
- if (currentVersion !== lastKnownVersion) {
242
- storageService.remove("update/lastKnownVersion", StorageScope.APPLICATION);
243
- storageService.remove("update/updateNotificationTime", StorageScope.APPLICATION);
244
- }
245
- this.registerGlobalActivityActions();
246
- }
247
- async onUpdateStateChange(state) {
248
- this.updateStateContextKey.set(state.type);
249
- switch (state.type) {
250
- case StateType.Idle:
251
- if (state.notAvailable && !state.error && (await this.hostService.hadLastFocus())) {
252
- this.dialogService.info(( localize(18386, "There are currently no updates available.")));
253
- }
254
- break;
255
- case StateType.Ready:
256
- {
257
- const productVersion = state.update.productVersion;
258
- if (productVersion) {
259
- const currentVersion = tryParseVersion(this.productService.version);
260
- const nextVersion = tryParseVersion(productVersion);
261
- this.majorMinorUpdateAvailableContextKey.set(Boolean(
262
- currentVersion && nextVersion && isMajorMinorUpdate(currentVersion, nextVersion)
263
- ));
264
- }
265
- break;
266
- }
267
- }
268
- this.updateBadge(state);
269
- this.state = state;
270
- }
271
- updateBadge(state) {
272
- let badge;
273
- if (state.type === StateType.AvailableForDownload || state.type === StateType.Downloaded || state.type === StateType.Ready) {
274
- badge = ( new NumberBadge(1, () => ( localize(18387, "New {0} update available.", this.productService.nameShort))));
275
- } else if (state.type === StateType.CheckingForUpdates) {
276
- badge = ( new ProgressBadge(() => ( localize(18388, "Checking for {0} updates...", this.productService.nameShort))));
277
- } else if (state.type === StateType.Downloading || state.type === StateType.Overwriting) {
278
- badge = ( new ProgressBadge(() => ( localize(18389, "Downloading {0} update...", this.productService.nameShort))));
279
- } else if (state.type === StateType.Updating) {
280
- badge = ( new ProgressBadge(() => ( localize(18390, "Updating {0}...", this.productService.nameShort))));
281
- } else if (state.type === StateType.Cancelling) {
282
- badge = ( new ProgressBadge(() => ( localize(18391, "Cancelling {0} update...", this.productService.nameShort))));
283
- }
284
- this.badgeDisposable.clear();
285
- if (badge && this.contextKeyService.contextMatchesRules(UpdateGlobalActivityBadgeVisibleContext)) {
286
- this.badgeDisposable.value = this.activityService.showGlobalActivity({
287
- badge
288
- });
289
- }
290
- }
291
- registerGlobalActivityActions() {
292
- CommandsRegistry.registerCommand("update.check", () => this.updateService.checkForUpdates(true));
293
- CommandsRegistry.registerCommand("update.checking", () => {});
294
- CommandsRegistry.registerCommand("update.downloadNow", () => this.updateService.downloadUpdate(true));
295
- CommandsRegistry.registerCommand("update.downloading", () => {});
296
- CommandsRegistry.registerCommand("update.install", () => this.updateService.applyUpdate());
297
- CommandsRegistry.registerCommand("update.updating", () => {});
298
- CommandsRegistry.registerCommand("update.cancelling", () => {});
299
- CommandsRegistry.registerCommand("update.restart", () => this.updateService.quitAndInstall());
300
- CommandsRegistry.registerCommand("_update.state", () => {
301
- return this.state;
302
- });
303
- appendUpdateMenuItems(MenuId.GlobalActivity, "7_update");
304
- if (this.productService.quality === "stable") {
305
- CommandsRegistry.registerCommand("update.showUpdateReleaseNotes", () => {
306
- if (this.updateService.state.type !== StateType.Ready) {
307
- return;
308
- }
309
- const productVersion = this.updateService.state.update.productVersion;
310
- if (productVersion) {
311
- this.instantiationService.invokeFunction(accessor => showReleaseNotes(accessor, productVersion));
312
- }
313
- });
314
- MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
315
- group: "7_update",
316
- order: 1,
317
- command: {
318
- id: "update.showUpdateReleaseNotes",
319
- title: ( localize(18392, "Show Update Release Notes"))
320
- },
321
- when: ( ContextKeyExpr.and(( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Ready)), MAJOR_MINOR_UPDATE_AVAILABLE))
322
- });
323
- }
324
- }
325
- };
326
- UpdateContribution = ( __decorate([( __param(0, IStorageService)), ( __param(1, IInstantiationService)), ( __param(2, IDialogService)), ( __param(3, IUpdateService)), ( __param(4, IActivityService)), ( __param(5, IContextKeyService)), ( __param(6, IProductService)), ( __param(7, IHostService))], UpdateContribution));
327
- let SwitchProductQualityContribution = class SwitchProductQualityContribution extends Disposable {
328
- constructor(productService, environmentService) {
329
- super();
330
- this.productService = productService;
331
- this.environmentService = environmentService;
332
- this.registerGlobalActivityActions();
333
- }
334
- registerGlobalActivityActions() {
335
- const quality = this.productService.quality;
336
- const productQualityChangeHandler = this.environmentService.options?.productQualityChangeHandler;
337
- if (productQualityChangeHandler && (quality === "stable" || quality === "insider")) {
338
- const newQuality = quality === "stable" ? "insider" : "stable";
339
- const commandId = `update.switchQuality.${newQuality}`;
340
- const isSwitchingToInsiders = newQuality === "insider";
341
- this._register(registerAction2(class SwitchQuality extends Action2 {
342
- constructor() {
343
- super({
344
- id: commandId,
345
- title: isSwitchingToInsiders ? ( localize(18393, "Switch to Insiders Version...")) : ( localize(18394, "Switch to Stable Version...")),
346
- precondition: IsWebContext,
347
- menu: {
348
- id: MenuId.GlobalActivity,
349
- when: IsWebContext,
350
- group: "7_update"
351
- }
352
- });
353
- }
354
- async run(accessor) {
355
- const dialogService = accessor.get(IDialogService);
356
- const userDataSyncEnablementService = accessor.get(IUserDataSyncEnablementService);
357
- const userDataSyncStoreManagementService = accessor.get(IUserDataSyncStoreManagementService);
358
- const storageService = accessor.get(IStorageService);
359
- const userDataSyncWorkbenchService = accessor.get(IUserDataSyncWorkbenchService);
360
- const userDataSyncService = accessor.get(IUserDataSyncService);
361
- const notificationService = accessor.get(INotificationService);
362
- try {
363
- const selectSettingsSyncServiceDialogShownKey = "switchQuality.selectSettingsSyncServiceDialogShown";
364
- const userDataSyncStore = userDataSyncStoreManagementService.userDataSyncStore;
365
- let userDataSyncStoreType;
366
- if (userDataSyncStore && isSwitchingToInsiders && userDataSyncEnablementService.isEnabled() && !storageService.getBoolean(selectSettingsSyncServiceDialogShownKey, StorageScope.APPLICATION, false)) {
367
- userDataSyncStoreType = await this.selectSettingsSyncService(dialogService);
368
- if (!userDataSyncStoreType) {
369
- return;
370
- }
371
- storageService.store(
372
- selectSettingsSyncServiceDialogShownKey,
373
- true,
374
- StorageScope.APPLICATION,
375
- StorageTarget.USER
376
- );
377
- if (userDataSyncStoreType === "stable") {
378
- await userDataSyncStoreManagementService.switch(userDataSyncStoreType);
379
- }
380
- }
381
- const res = await dialogService.confirm({
382
- type: "info",
383
- message: ( localize(18395, "Changing the version requires a reload to take effect")),
384
- detail: newQuality === "insider" ? ( localize(
385
- 18396,
386
- "Press the reload button to switch to the Insiders version of VS Code."
387
- )) : ( localize(
388
- 18397,
389
- "Press the reload button to switch to the Stable version of VS Code."
390
- )),
391
- primaryButton: ( localize(18398, "&&Reload"))
392
- });
393
- if (res.confirmed) {
394
- const promises = [];
395
- if (userDataSyncService.status === SyncStatus.Syncing) {
396
- promises.push(Event.toPromise(Event.filter(
397
- userDataSyncService.onDidChangeStatus,
398
- status => status !== SyncStatus.Syncing
399
- )));
400
- }
401
- if (isSwitchingToInsiders && userDataSyncStoreType) {
402
- promises.push(userDataSyncWorkbenchService.synchroniseUserDataSyncStoreType());
403
- }
404
- await Promises.settled(promises);
405
- productQualityChangeHandler(newQuality);
406
- } else {
407
- if (userDataSyncStoreType) {
408
- storageService.remove(selectSettingsSyncServiceDialogShownKey, StorageScope.APPLICATION);
409
- }
410
- }
411
- } catch (error) {
412
- notificationService.error(error);
413
- }
414
- }
415
- async selectSettingsSyncService(dialogService) {
416
- const {
417
- result
418
- } = await dialogService.prompt({
419
- type: Severity.Info,
420
- message: ( localize(
421
- 18399,
422
- "Choose the settings sync service to use after changing the version"
423
- )),
424
- detail: ( localize(
425
- 18400,
426
- "The Insiders version of VS Code will synchronize your settings, keybindings, extensions, snippets and UI State using separate insiders settings sync service by default."
427
- )),
428
- buttons: [{
429
- label: ( localize(18401, "&&Insiders")),
430
- run: () => "insiders"
431
- }, {
432
- label: ( localize(18402, "&&Stable (current)")),
433
- run: () => "stable"
434
- }],
435
- cancelButton: true
436
- });
437
- return result;
438
- }
439
- }));
440
- }
441
- }
442
- };
443
- SwitchProductQualityContribution = ( __decorate([( __param(0, IProductService)), ( __param(1, IBrowserWorkbenchEnvironmentService))], SwitchProductQualityContribution));
444
- let DefaultAccountUpdateContribution = class DefaultAccountUpdateContribution extends Disposable {
445
- static {
446
- DefaultAccountUpdateContribution_1 = this;
447
- }
448
- static {
449
- this.STORAGE_KEY = "update/internalOrg";
450
- }
451
- #internalOrg;
452
- constructor(updateService, defaultAccountService, storageService) {
453
- super();
454
- this.updateService = updateService;
455
- this.defaultAccountService = defaultAccountService;
456
- this.storageService = storageService;
457
- this.#internalOrg = undefined;
458
- this.throttler = this._register(( new Throttler()));
459
- if (isWeb) {
460
- return;
461
- }
462
- this.#internalOrg = this.storageService.get(
463
- DefaultAccountUpdateContribution_1.STORAGE_KEY,
464
- StorageScope.APPLICATION,
465
- undefined
466
- );
467
- this.throttler.queue(() => this.updateService.setInternalOrg(this.#internalOrg));
468
- this.refresh();
469
- this._register(this.defaultAccountService.onDidChangeDefaultAccount(() => this.refresh()));
470
- }
471
- refresh() {
472
- this.throttler.queue(() => this.doRefresh());
473
- }
474
- async doRefresh() {
475
- try {
476
- const defaultAccount = await this.defaultAccountService.getDefaultAccount();
477
- const internalOrg = getInternalOrg(defaultAccount?.entitlementsData?.organization_login_list);
478
- if (internalOrg === this.#internalOrg) {
479
- return;
480
- }
481
- this.#internalOrg = internalOrg;
482
- await this.updateService.setInternalOrg(this.#internalOrg);
483
- if (this.#internalOrg) {
484
- this.storageService.store(
485
- DefaultAccountUpdateContribution_1.STORAGE_KEY,
486
- internalOrg,
487
- StorageScope.APPLICATION,
488
- StorageTarget.MACHINE
489
- );
490
- } else {
491
- this.storageService.remove(DefaultAccountUpdateContribution_1.STORAGE_KEY, StorageScope.APPLICATION);
492
- }
493
- } catch (error) {}
494
- }
495
- };
496
- DefaultAccountUpdateContribution = DefaultAccountUpdateContribution_1 = ( __decorate([( __param(0, IUpdateService)), ( __param(1, IDefaultAccountService)), ( __param(2, IStorageService))], DefaultAccountUpdateContribution));
497
-
498
- export { CONTEXT_UPDATE_STATE, DefaultAccountUpdateContribution, MAJOR_MINOR_UPDATE_AVAILABLE, ProductContribution, SwitchProductQualityContribution, UpdateContribution, appendUpdateMenuItems, showReleaseNotesInEditor };
@@ -1,64 +0,0 @@
1
- import { BaseActionViewItem, IBaseActionViewItemOptions } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionViewItems";
2
- import { IManagedHoverContent, IManagedHoverOptions } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hover";
3
- import { IAction } from "@codingame/monaco-vscode-api/vscode/vs/base/common/actions";
4
- import { AnchorAlignment } from "@codingame/monaco-vscode-api/vscode/vs/base/common/layout";
5
- import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
6
- import { IActionViewItemService } from "@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/actionViewItemService.service";
7
- import { IMenuItem, MenuId } from "@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions";
8
- import { ICommandService } from "@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service";
9
- import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
10
- import { ContextKeyExpression } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey";
11
- import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
12
- import { IHoverService } from "@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service";
13
- import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
14
- import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
15
- import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
16
- import { IUpdateService } from "@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update.service";
17
- import { IWorkbenchContribution } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions";
18
- import { IHostService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service";
19
- import { IChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service";
20
- import { UpdateTooltip } from "./updateTooltip.js";
21
- export declare function registerUpdateTitleBarMenuPlacement(menuId: MenuId, item?: Omit<IMenuItem, "command">): void;
22
- export declare function getAdditionalUpdateTitleBarMenuWhen(when?: ContextKeyExpression): ContextKeyExpression;
23
- /**
24
- * Displays update status and actions in the title bar.
25
- */
26
- export declare class UpdateTitleBarContribution extends Disposable implements IWorkbenchContribution {
27
- private readonly configurationService;
28
- private readonly hostService;
29
- private readonly storageService;
30
- private readonly context;
31
- private readonly tooltip;
32
- private state;
33
- private entry;
34
- private tooltipVisible;
35
- private tooltipFocused;
36
- constructor(actionViewItemService: IActionViewItemService, chatService: IChatService, configurationService: IConfigurationService, contextKeyService: IContextKeyService, hostService: IHostService, instantiationService: IInstantiationService, storageService: IStorageService, updateService: IUpdateService);
37
- private createEntry;
38
- private onStateChange;
39
- }
40
- /**
41
- * Custom action view item for the update indicator in the title bar.
42
- */
43
- export declare class UpdateTitleBarEntry extends BaseActionViewItem {
44
- private readonly anchorAlignment;
45
- private readonly tooltip;
46
- private readonly onDidShowTooltip;
47
- private readonly onUserDismissedTooltip;
48
- private readonly commandService;
49
- private readonly hoverService;
50
- private readonly telemetryService;
51
- private readonly updateService;
52
- private content;
53
- private tooltipFocusOnRender;
54
- private readonly visibleTooltip;
55
- constructor(action: IAction, options: IBaseActionViewItemOptions, anchorAlignment: AnchorAlignment, tooltip: UpdateTooltip, onDidShowTooltip: (focus: boolean) => void, onUserDismissedTooltip: () => void, commandService: ICommandService, hoverService: IHoverService, telemetryService: ITelemetryService, updateService: IUpdateService);
56
- render(container: HTMLElement): void;
57
- showTooltip(focus?: boolean): void;
58
- private focusTooltip;
59
- protected getHoverContents(): IManagedHoverContent;
60
- protected getHoverOptions(): IManagedHoverOptions;
61
- private runAction;
62
- private onStateChange;
63
- private renderProgressState;
64
- }