@codingame/monaco-vscode-update-service-override 25.1.1 → 26.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 +2 -2
- package/vscode/src/vs/platform/update/common/update.config.contribution.js +62 -69
- package/vscode/src/vs/workbench/contrib/markdown/browser/markdownSettingRenderer.js +68 -59
- package/vscode/src/vs/workbench/contrib/update/browser/releaseNotesEditor.js +415 -392
- package/vscode/src/vs/workbench/contrib/update/browser/update.contribution.js +62 -44
- package/vscode/src/vs/workbench/contrib/update/browser/update.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/update/browser/update.js +315 -234
- package/vscode/src/vs/workbench/services/update/browser/updateService.d.ts +1 -0
- package/vscode/src/vs/workbench/services/update/browser/updateService.js +12 -12
|
@@ -32,12 +32,13 @@ import { Promises } from '@codingame/monaco-vscode-api/vscode/vs/base/common/asy
|
|
|
32
32
|
import { IUserDataSyncWorkbenchService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/userDataSync/common/userDataSync.service';
|
|
33
33
|
import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
34
34
|
import { toAction } from '@codingame/monaco-vscode-api/vscode/vs/base/common/actions';
|
|
35
|
+
import { IDefaultAccountService } from '@codingame/monaco-vscode-api/vscode/vs/platform/defaultAccount/common/defaultAccount.service';
|
|
35
36
|
|
|
36
37
|
var ProductContribution_1;
|
|
37
|
-
const CONTEXT_UPDATE_STATE = ( new RawContextKey(
|
|
38
|
-
const MAJOR_MINOR_UPDATE_AVAILABLE = ( new RawContextKey(
|
|
39
|
-
const RELEASE_NOTES_URL = ( new RawContextKey(
|
|
40
|
-
const DOWNLOAD_URL = ( new RawContextKey(
|
|
38
|
+
const CONTEXT_UPDATE_STATE = ( new RawContextKey("updateState", StateType.Uninitialized));
|
|
39
|
+
const MAJOR_MINOR_UPDATE_AVAILABLE = ( new RawContextKey("majorMinorUpdateAvailable", false));
|
|
40
|
+
const RELEASE_NOTES_URL = ( new RawContextKey("releaseNotesUrl", ""));
|
|
41
|
+
const DOWNLOAD_URL = ( new RawContextKey("downloadUrl", ""));
|
|
41
42
|
let releaseNotesManager = undefined;
|
|
42
43
|
function showReleaseNotesInEditor(instantiationService, version, useCurrentFile) {
|
|
43
44
|
if (!releaseNotesManager) {
|
|
@@ -51,10 +52,9 @@ async function openLatestReleaseNotesInBrowser(accessor) {
|
|
|
51
52
|
if (productService.releaseNotesUrl) {
|
|
52
53
|
const uri = ( URI.parse(productService.releaseNotesUrl));
|
|
53
54
|
await openerService.open(uri);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
55
|
+
} else {
|
|
56
56
|
throw ( new Error(( localize(
|
|
57
|
-
|
|
57
|
+
13233,
|
|
58
58
|
"This version of {0} does not have release notes online",
|
|
59
59
|
productService.nameLong
|
|
60
60
|
))));
|
|
@@ -64,12 +64,10 @@ async function showReleaseNotes(accessor, version) {
|
|
|
64
64
|
const instantiationService = accessor.get(IInstantiationService);
|
|
65
65
|
try {
|
|
66
66
|
await showReleaseNotesInEditor(instantiationService, version, false);
|
|
67
|
-
}
|
|
68
|
-
catch (err) {
|
|
67
|
+
} catch (err) {
|
|
69
68
|
try {
|
|
70
69
|
await instantiationService.invokeFunction(openLatestReleaseNotesInBrowser);
|
|
71
|
-
}
|
|
72
|
-
catch (err2) {
|
|
70
|
+
} catch (err2) {
|
|
73
71
|
throw ( new Error(`${err.message} and ${err2.message}`));
|
|
74
72
|
}
|
|
75
73
|
}
|
|
@@ -89,9 +87,23 @@ function isMajorMinorUpdate(before, after) {
|
|
|
89
87
|
return before.major < after.major || before.minor < after.minor;
|
|
90
88
|
}
|
|
91
89
|
let ProductContribution = class ProductContribution {
|
|
92
|
-
static {
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
static {
|
|
91
|
+
ProductContribution_1 = this;
|
|
92
|
+
}
|
|
93
|
+
static {
|
|
94
|
+
this.KEY = "releaseNotes/lastVersion";
|
|
95
|
+
}
|
|
96
|
+
constructor(
|
|
97
|
+
storageService,
|
|
98
|
+
instantiationService,
|
|
99
|
+
notificationService,
|
|
100
|
+
environmentService,
|
|
101
|
+
openerService,
|
|
102
|
+
configurationService,
|
|
103
|
+
hostService,
|
|
104
|
+
productService,
|
|
105
|
+
contextKeyService
|
|
106
|
+
) {
|
|
95
107
|
if (productService.releaseNotesUrl) {
|
|
96
108
|
const releaseNotesUrlKey = RELEASE_NOTES_URL.bindTo(contextKeyService);
|
|
97
109
|
releaseNotesUrlKey.set(productService.releaseNotesUrl);
|
|
@@ -103,48 +115,58 @@ let ProductContribution = class ProductContribution {
|
|
|
103
115
|
if (isWeb) {
|
|
104
116
|
return;
|
|
105
117
|
}
|
|
106
|
-
hostService.hadLastFocus().then(async
|
|
118
|
+
hostService.hadLastFocus().then(async hadLastFocus => {
|
|
107
119
|
if (!hadLastFocus) {
|
|
108
120
|
return;
|
|
109
121
|
}
|
|
110
|
-
const lastVersion = parseVersion(
|
|
122
|
+
const lastVersion = parseVersion(
|
|
123
|
+
storageService.get(ProductContribution_1.KEY, StorageScope.APPLICATION, "")
|
|
124
|
+
);
|
|
111
125
|
const currentVersion = parseVersion(productService.version);
|
|
112
|
-
const shouldShowReleaseNotes = configurationService.getValue(
|
|
126
|
+
const shouldShowReleaseNotes = configurationService.getValue("update.showReleaseNotes");
|
|
113
127
|
const releaseNotesUrl = productService.releaseNotesUrl;
|
|
114
128
|
if (shouldShowReleaseNotes && !environmentService.skipReleaseNotes && releaseNotesUrl && lastVersion && currentVersion && isMajorMinorUpdate(lastVersion, currentVersion)) {
|
|
115
|
-
showReleaseNotesInEditor(instantiationService, productService.version, false)
|
|
116
|
-
.then(undefined, () => {
|
|
129
|
+
showReleaseNotesInEditor(instantiationService, productService.version, false).then(undefined, () => {
|
|
117
130
|
notificationService.prompt(Severity.Info, ( localize(
|
|
118
|
-
|
|
131
|
+
13234,
|
|
119
132
|
"Welcome to {0} v{1}! Would you like to read the Release Notes?",
|
|
120
133
|
productService.nameLong,
|
|
121
134
|
productService.version
|
|
122
135
|
)), [{
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
136
|
+
label: ( localize(13235, "Release Notes")),
|
|
137
|
+
run: () => {
|
|
138
|
+
const uri = ( URI.parse(releaseNotesUrl));
|
|
139
|
+
openerService.open(uri);
|
|
140
|
+
}
|
|
141
|
+
}], {
|
|
142
|
+
priority: NotificationPriority.OPTIONAL
|
|
143
|
+
});
|
|
129
144
|
});
|
|
130
145
|
}
|
|
131
|
-
storageService.store(
|
|
146
|
+
storageService.store(
|
|
147
|
+
ProductContribution_1.KEY,
|
|
148
|
+
productService.version,
|
|
149
|
+
StorageScope.APPLICATION,
|
|
150
|
+
StorageTarget.MACHINE
|
|
151
|
+
);
|
|
132
152
|
});
|
|
133
153
|
}
|
|
134
154
|
};
|
|
135
|
-
ProductContribution = ProductContribution_1 = ( __decorate([
|
|
136
|
-
( __param(0, IStorageService)),
|
|
137
|
-
( __param(1, IInstantiationService)),
|
|
138
|
-
( __param(2, INotificationService)),
|
|
139
|
-
( __param(3, IBrowserWorkbenchEnvironmentService)),
|
|
140
|
-
( __param(4, IOpenerService)),
|
|
141
|
-
( __param(5, IConfigurationService)),
|
|
142
|
-
( __param(6, IHostService)),
|
|
143
|
-
( __param(7, IProductService)),
|
|
144
|
-
( __param(8, IContextKeyService))
|
|
145
|
-
], ProductContribution));
|
|
155
|
+
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)), ( __param(8, IContextKeyService))], ProductContribution));
|
|
146
156
|
let UpdateContribution = class UpdateContribution extends Disposable {
|
|
147
|
-
constructor(
|
|
157
|
+
constructor(
|
|
158
|
+
storageService,
|
|
159
|
+
instantiationService,
|
|
160
|
+
notificationService,
|
|
161
|
+
dialogService,
|
|
162
|
+
updateService,
|
|
163
|
+
activityService,
|
|
164
|
+
contextKeyService,
|
|
165
|
+
productService,
|
|
166
|
+
openerService,
|
|
167
|
+
configurationService,
|
|
168
|
+
hostService
|
|
169
|
+
) {
|
|
148
170
|
super();
|
|
149
171
|
this.storageService = storageService;
|
|
150
172
|
this.instantiationService = instantiationService;
|
|
@@ -164,79 +186,83 @@ let UpdateContribution = class UpdateContribution extends Disposable {
|
|
|
164
186
|
this._register(updateService.onStateChange(this.onUpdateStateChange, this));
|
|
165
187
|
this.onUpdateStateChange(this.updateService.state);
|
|
166
188
|
const currentVersion = this.productService.commit;
|
|
167
|
-
const lastKnownVersion = this.storageService.get(
|
|
189
|
+
const lastKnownVersion = this.storageService.get("update/lastKnownVersion", StorageScope.APPLICATION);
|
|
168
190
|
if (currentVersion !== lastKnownVersion) {
|
|
169
|
-
this.storageService.remove(
|
|
170
|
-
this.storageService.remove(
|
|
191
|
+
this.storageService.remove("update/lastKnownVersion", StorageScope.APPLICATION);
|
|
192
|
+
this.storageService.remove("update/updateNotificationTime", StorageScope.APPLICATION);
|
|
171
193
|
}
|
|
172
194
|
this.registerGlobalActivityActions();
|
|
173
195
|
}
|
|
174
196
|
async onUpdateStateChange(state) {
|
|
175
197
|
this.updateStateContextKey.set(state.type);
|
|
176
198
|
switch (state.type) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
199
|
+
case StateType.Disabled:
|
|
200
|
+
if (state.reason === DisablementReason.RunningAsAdmin) {
|
|
201
|
+
this.notificationService.notify({
|
|
202
|
+
severity: Severity.Info,
|
|
203
|
+
message: ( localize(
|
|
204
|
+
13236,
|
|
205
|
+
"Updates are disabled because you are running the user-scope installation of {0} as Administrator.",
|
|
206
|
+
this.productService.nameLong
|
|
207
|
+
)),
|
|
208
|
+
actions: {
|
|
209
|
+
primary: [toAction({
|
|
210
|
+
id: "",
|
|
211
|
+
label: ( localize(13237, "Learn More")),
|
|
212
|
+
run: () => this.openerService.open("https://aka.ms/vscode-windows-setup")
|
|
213
|
+
})]
|
|
214
|
+
},
|
|
215
|
+
neverShowAgain: {
|
|
216
|
+
id: "no-updates-running-as-admin"
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
break;
|
|
221
|
+
case StateType.Idle:
|
|
222
|
+
if (state.error) {
|
|
223
|
+
this.onError(state.error);
|
|
224
|
+
} else if (this.state.type === StateType.CheckingForUpdates && this.state.explicit && (await this.hostService.hadLastFocus())) {
|
|
225
|
+
this.onUpdateNotAvailable();
|
|
226
|
+
}
|
|
227
|
+
break;
|
|
228
|
+
case StateType.AvailableForDownload:
|
|
229
|
+
this.onUpdateAvailable(state.update);
|
|
230
|
+
break;
|
|
231
|
+
case StateType.Downloaded:
|
|
232
|
+
this.onUpdateDownloaded(state.update);
|
|
233
|
+
break;
|
|
234
|
+
case StateType.Overwriting:
|
|
235
|
+
this.onUpdateOverwriting(state);
|
|
236
|
+
break;
|
|
237
|
+
case StateType.Ready:
|
|
238
|
+
{
|
|
214
239
|
const productVersion = state.update.productVersion;
|
|
215
240
|
if (productVersion) {
|
|
216
241
|
const currentVersion = parseVersion(this.productService.version);
|
|
217
242
|
const nextVersion = parseVersion(productVersion);
|
|
218
|
-
this.majorMinorUpdateAvailableContextKey.set(Boolean(
|
|
219
|
-
|
|
243
|
+
this.majorMinorUpdateAvailableContextKey.set(Boolean(
|
|
244
|
+
currentVersion && nextVersion && isMajorMinorUpdate(currentVersion, nextVersion)
|
|
245
|
+
));
|
|
220
246
|
}
|
|
247
|
+
this.onUpdateReady(state);
|
|
221
248
|
break;
|
|
222
249
|
}
|
|
223
250
|
}
|
|
224
251
|
let badge = undefined;
|
|
225
252
|
if (state.type === StateType.AvailableForDownload || state.type === StateType.Downloaded || state.type === StateType.Ready) {
|
|
226
|
-
badge = ( new NumberBadge(1, () => ( localize(
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
else if (state.type === StateType.
|
|
232
|
-
badge = ( new ProgressBadge(() => ( localize(
|
|
233
|
-
}
|
|
234
|
-
else if (state.type === StateType.Updating) {
|
|
235
|
-
badge = ( new ProgressBadge(() => ( localize(12884, "Updating {0}...", this.productService.nameShort))));
|
|
253
|
+
badge = ( new NumberBadge(1, () => ( localize(13238, "New {0} update available.", this.productService.nameShort))));
|
|
254
|
+
} else if (state.type === StateType.CheckingForUpdates) {
|
|
255
|
+
badge = ( new ProgressBadge(() => ( localize(13239, "Checking for {0} updates...", this.productService.nameShort))));
|
|
256
|
+
} else if (state.type === StateType.Downloading || state.type === StateType.Overwriting) {
|
|
257
|
+
badge = ( new ProgressBadge(() => ( localize(13240, "Downloading {0} update...", this.productService.nameShort))));
|
|
258
|
+
} else if (state.type === StateType.Updating) {
|
|
259
|
+
badge = ( new ProgressBadge(() => ( localize(13241, "Updating {0}...", this.productService.nameShort))));
|
|
236
260
|
}
|
|
237
261
|
this.badgeDisposable.clear();
|
|
238
262
|
if (badge) {
|
|
239
|
-
this.badgeDisposable.value = this.activityService.showGlobalActivity({
|
|
263
|
+
this.badgeDisposable.value = this.activityService.showGlobalActivity({
|
|
264
|
+
badge
|
|
265
|
+
});
|
|
240
266
|
}
|
|
241
267
|
this.state = state;
|
|
242
268
|
}
|
|
@@ -244,15 +270,18 @@ let UpdateContribution = class UpdateContribution extends Disposable {
|
|
|
244
270
|
if (/The request timed out|The network connection was lost/i.test(error)) {
|
|
245
271
|
return;
|
|
246
272
|
}
|
|
247
|
-
error = error.replace(
|
|
273
|
+
error = error.replace(
|
|
274
|
+
/See https:\/\/github\.com\/Squirrel\/Squirrel\.Mac\/issues\/182 for more information/,
|
|
275
|
+
"This might mean the application was put on quarantine by macOS. See [this link](https://github.com/microsoft/vscode/issues/7426#issuecomment-425093469) for more information"
|
|
276
|
+
);
|
|
248
277
|
this.notificationService.notify({
|
|
249
278
|
severity: Severity.Error,
|
|
250
279
|
message: error,
|
|
251
|
-
source: ( localize(
|
|
280
|
+
source: ( localize(13242, "Update Service"))
|
|
252
281
|
});
|
|
253
282
|
}
|
|
254
283
|
onUpdateNotAvailable() {
|
|
255
|
-
this.dialogService.info(( localize(
|
|
284
|
+
this.dialogService.info(( localize(13243, "There are currently no updates available.")));
|
|
256
285
|
}
|
|
257
286
|
onUpdateAvailable(update) {
|
|
258
287
|
if (!this.shouldShowNotification()) {
|
|
@@ -262,24 +291,26 @@ let UpdateContribution = class UpdateContribution extends Disposable {
|
|
|
262
291
|
if (!productVersion) {
|
|
263
292
|
return;
|
|
264
293
|
}
|
|
265
|
-
this.notificationService.prompt(Severity.Info, ( localize(
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
294
|
+
this.notificationService.prompt(Severity.Info, ( localize(13244, "There is an available update.")), [{
|
|
295
|
+
label: ( localize(13245, "Download Update")),
|
|
296
|
+
run: () => this.updateService.downloadUpdate()
|
|
297
|
+
}, {
|
|
298
|
+
label: ( localize(13246, "Later")),
|
|
299
|
+
run: () => {}
|
|
300
|
+
}, {
|
|
301
|
+
label: ( localize(13235, "Release Notes")),
|
|
302
|
+
run: () => {
|
|
303
|
+
this.instantiationService.invokeFunction(accessor => showReleaseNotes(accessor, productVersion));
|
|
304
|
+
}
|
|
305
|
+
}], {
|
|
306
|
+
priority: NotificationPriority.OPTIONAL
|
|
307
|
+
});
|
|
277
308
|
}
|
|
278
309
|
onUpdateDownloaded(update) {
|
|
279
310
|
if (isMacintosh) {
|
|
280
311
|
return;
|
|
281
312
|
}
|
|
282
|
-
if (this.configurationService.getValue(
|
|
313
|
+
if (this.configurationService.getValue("update.enableWindowsBackgroundUpdates") && this.productService.target === "user") {
|
|
283
314
|
return;
|
|
284
315
|
}
|
|
285
316
|
if (!this.shouldShowNotification()) {
|
|
@@ -290,124 +321,162 @@ let UpdateContribution = class UpdateContribution extends Disposable {
|
|
|
290
321
|
return;
|
|
291
322
|
}
|
|
292
323
|
this.notificationService.prompt(Severity.Info, ( localize(
|
|
293
|
-
|
|
324
|
+
13247,
|
|
294
325
|
"There's an update available: {0} {1}",
|
|
295
326
|
this.productService.nameLong,
|
|
296
327
|
productVersion
|
|
297
328
|
)), [{
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
329
|
+
label: ( localize(13248, "Install Update")),
|
|
330
|
+
run: () => this.updateService.applyUpdate()
|
|
331
|
+
}, {
|
|
332
|
+
label: ( localize(13246, "Later")),
|
|
333
|
+
run: () => {}
|
|
334
|
+
}, {
|
|
335
|
+
label: ( localize(13235, "Release Notes")),
|
|
336
|
+
run: () => {
|
|
337
|
+
this.instantiationService.invokeFunction(accessor => showReleaseNotes(accessor, productVersion));
|
|
338
|
+
}
|
|
339
|
+
}], {
|
|
340
|
+
priority: NotificationPriority.OPTIONAL
|
|
341
|
+
});
|
|
309
342
|
}
|
|
310
|
-
onUpdateReady(
|
|
311
|
-
if (
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
343
|
+
onUpdateReady(state) {
|
|
344
|
+
if (state.overwrite && this.overwriteNotificationHandle) {
|
|
345
|
+
const handle = this.overwriteNotificationHandle;
|
|
346
|
+
this.overwriteNotificationHandle = undefined;
|
|
347
|
+
handle.progress.done();
|
|
348
|
+
handle.updateMessage(( localize(13249, "The newer update is ready to install.")));
|
|
349
|
+
handle.updateActions({
|
|
350
|
+
primary: [toAction({
|
|
351
|
+
id: "update.restartToUpdate",
|
|
352
|
+
label: ( localize(13250, "Restart to Update")),
|
|
353
|
+
run: () => this.updateService.quitAndInstall()
|
|
354
|
+
})]
|
|
355
|
+
});
|
|
356
|
+
} else if ((isWindows && this.productService.target !== "user") || this.shouldShowNotification()) {
|
|
357
|
+
const actions = [{
|
|
358
|
+
label: ( localize(13251, "Update Now")),
|
|
316
359
|
run: () => this.updateService.quitAndInstall()
|
|
317
360
|
}, {
|
|
318
|
-
label: ( localize(
|
|
319
|
-
run: () => {
|
|
361
|
+
label: ( localize(13246, "Later")),
|
|
362
|
+
run: () => {}
|
|
320
363
|
}];
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
364
|
+
const productVersion = state.update.productVersion;
|
|
365
|
+
if (productVersion) {
|
|
366
|
+
actions.push({
|
|
367
|
+
label: ( localize(13235, "Release Notes")),
|
|
368
|
+
run: () => {
|
|
369
|
+
this.instantiationService.invokeFunction(accessor => showReleaseNotes(accessor, productVersion));
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
this.notificationService.prompt(Severity.Info, ( localize(
|
|
374
|
+
13252,
|
|
375
|
+
"Restart {0} to apply the latest update.",
|
|
376
|
+
this.productService.nameLong
|
|
377
|
+
)), actions, {
|
|
378
|
+
sticky: true,
|
|
379
|
+
priority: NotificationPriority.OPTIONAL
|
|
328
380
|
});
|
|
329
381
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
382
|
+
}
|
|
383
|
+
onUpdateOverwriting(state) {
|
|
384
|
+
if (!state.explicit) {
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
this.overwriteNotificationHandle = this.notificationService.notify({
|
|
388
|
+
severity: Severity.Info,
|
|
335
389
|
sticky: true,
|
|
336
|
-
|
|
390
|
+
message: ( localize(
|
|
391
|
+
13253,
|
|
392
|
+
"We found a newer update available and have started to download it. We'll let you know as soon as it's ready to install."
|
|
393
|
+
)),
|
|
394
|
+
source: ( localize(13242, "Update Service"))
|
|
337
395
|
});
|
|
396
|
+
this.overwriteNotificationHandle.progress.infinite();
|
|
338
397
|
}
|
|
339
398
|
shouldShowNotification() {
|
|
340
399
|
const currentVersion = this.productService.commit;
|
|
341
400
|
const currentMillis = ( new Date()).getTime();
|
|
342
|
-
const lastKnownVersion = this.storageService.get(
|
|
401
|
+
const lastKnownVersion = this.storageService.get("update/lastKnownVersion", StorageScope.APPLICATION);
|
|
343
402
|
if (currentVersion !== lastKnownVersion) {
|
|
344
|
-
this.storageService.store(
|
|
345
|
-
|
|
403
|
+
this.storageService.store(
|
|
404
|
+
"update/lastKnownVersion",
|
|
405
|
+
currentVersion,
|
|
406
|
+
StorageScope.APPLICATION,
|
|
407
|
+
StorageTarget.MACHINE
|
|
408
|
+
);
|
|
409
|
+
this.storageService.store(
|
|
410
|
+
"update/updateNotificationTime",
|
|
411
|
+
currentMillis,
|
|
412
|
+
StorageScope.APPLICATION,
|
|
413
|
+
StorageTarget.MACHINE
|
|
414
|
+
);
|
|
346
415
|
}
|
|
347
|
-
const updateNotificationMillis = this.storageService.getNumber(
|
|
416
|
+
const updateNotificationMillis = this.storageService.getNumber("update/updateNotificationTime", StorageScope.APPLICATION, currentMillis);
|
|
348
417
|
const diffDays = (currentMillis - updateNotificationMillis) / (1000 * 60 * 60 * 24);
|
|
349
418
|
return diffDays > 5;
|
|
350
419
|
}
|
|
351
420
|
registerGlobalActivityActions() {
|
|
352
|
-
CommandsRegistry.registerCommand(
|
|
421
|
+
CommandsRegistry.registerCommand("update.check", () => this.updateService.checkForUpdates(true));
|
|
353
422
|
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
|
354
|
-
group:
|
|
423
|
+
group: "7_update",
|
|
355
424
|
command: {
|
|
356
|
-
id:
|
|
357
|
-
title: ( localize(
|
|
425
|
+
id: "update.check",
|
|
426
|
+
title: ( localize(13254, "Check for Updates..."))
|
|
358
427
|
},
|
|
359
428
|
when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Idle))
|
|
360
429
|
});
|
|
361
|
-
CommandsRegistry.registerCommand(
|
|
430
|
+
CommandsRegistry.registerCommand("update.checking", () => {});
|
|
362
431
|
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
|
363
|
-
group:
|
|
432
|
+
group: "7_update",
|
|
364
433
|
command: {
|
|
365
|
-
id:
|
|
366
|
-
title: ( localize(
|
|
434
|
+
id: "update.checking",
|
|
435
|
+
title: ( localize(13255, "Checking for Updates...")),
|
|
367
436
|
precondition: ( ContextKeyExpr.false())
|
|
368
437
|
},
|
|
369
438
|
when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.CheckingForUpdates))
|
|
370
439
|
});
|
|
371
|
-
CommandsRegistry.registerCommand(
|
|
440
|
+
CommandsRegistry.registerCommand("update.downloadNow", () => this.updateService.downloadUpdate());
|
|
372
441
|
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
|
373
|
-
group:
|
|
442
|
+
group: "7_update",
|
|
374
443
|
command: {
|
|
375
|
-
id:
|
|
376
|
-
title: ( localize(
|
|
444
|
+
id: "update.downloadNow",
|
|
445
|
+
title: ( localize(13256, "Download Update (1)"))
|
|
377
446
|
},
|
|
378
447
|
when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.AvailableForDownload))
|
|
379
448
|
});
|
|
380
|
-
CommandsRegistry.registerCommand(
|
|
449
|
+
CommandsRegistry.registerCommand("update.downloading", () => {});
|
|
381
450
|
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
|
382
|
-
group:
|
|
451
|
+
group: "7_update",
|
|
383
452
|
command: {
|
|
384
|
-
id:
|
|
385
|
-
title: ( localize(
|
|
453
|
+
id: "update.downloading",
|
|
454
|
+
title: ( localize(13257, "Downloading Update...")),
|
|
386
455
|
precondition: ( ContextKeyExpr.false())
|
|
387
456
|
},
|
|
388
457
|
when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Downloading))
|
|
389
458
|
});
|
|
390
|
-
CommandsRegistry.registerCommand(
|
|
459
|
+
CommandsRegistry.registerCommand("update.install", () => this.updateService.applyUpdate());
|
|
391
460
|
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
|
392
|
-
group:
|
|
461
|
+
group: "7_update",
|
|
393
462
|
command: {
|
|
394
|
-
id:
|
|
395
|
-
title: ( localize(
|
|
463
|
+
id: "update.install",
|
|
464
|
+
title: ( localize(13258, "Install Update... (1)"))
|
|
396
465
|
},
|
|
397
466
|
when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Downloaded))
|
|
398
467
|
});
|
|
399
|
-
CommandsRegistry.registerCommand(
|
|
468
|
+
CommandsRegistry.registerCommand("update.updating", () => {});
|
|
400
469
|
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
|
401
|
-
group:
|
|
470
|
+
group: "7_update",
|
|
402
471
|
command: {
|
|
403
|
-
id:
|
|
404
|
-
title: ( localize(
|
|
472
|
+
id: "update.updating",
|
|
473
|
+
title: ( localize(13259, "Installing Update...")),
|
|
405
474
|
precondition: ( ContextKeyExpr.false())
|
|
406
475
|
},
|
|
407
476
|
when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Updating))
|
|
408
477
|
});
|
|
409
|
-
if (this.productService.quality ===
|
|
410
|
-
CommandsRegistry.registerCommand(
|
|
478
|
+
if (this.productService.quality === "stable") {
|
|
479
|
+
CommandsRegistry.registerCommand("update.showUpdateReleaseNotes", () => {
|
|
411
480
|
if (this.updateService.state.type !== StateType.Ready) {
|
|
412
481
|
return;
|
|
413
482
|
}
|
|
@@ -417,43 +486,31 @@ let UpdateContribution = class UpdateContribution extends Disposable {
|
|
|
417
486
|
}
|
|
418
487
|
});
|
|
419
488
|
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
|
420
|
-
group:
|
|
489
|
+
group: "7_update",
|
|
421
490
|
order: 1,
|
|
422
491
|
command: {
|
|
423
|
-
id:
|
|
424
|
-
title: ( localize(
|
|
492
|
+
id: "update.showUpdateReleaseNotes",
|
|
493
|
+
title: ( localize(13260, "Show Update Release Notes"))
|
|
425
494
|
},
|
|
426
495
|
when: ( ContextKeyExpr.and(( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Ready)), MAJOR_MINOR_UPDATE_AVAILABLE))
|
|
427
496
|
});
|
|
428
497
|
}
|
|
429
|
-
CommandsRegistry.registerCommand(
|
|
498
|
+
CommandsRegistry.registerCommand("update.restart", () => this.updateService.quitAndInstall());
|
|
430
499
|
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
|
431
|
-
group:
|
|
500
|
+
group: "7_update",
|
|
432
501
|
order: 2,
|
|
433
502
|
command: {
|
|
434
|
-
id:
|
|
435
|
-
title: ( localize(
|
|
503
|
+
id: "update.restart",
|
|
504
|
+
title: ( localize(13261, "Restart to Update (1)"))
|
|
436
505
|
},
|
|
437
506
|
when: ( CONTEXT_UPDATE_STATE.isEqualTo(StateType.Ready))
|
|
438
507
|
});
|
|
439
|
-
CommandsRegistry.registerCommand(
|
|
508
|
+
CommandsRegistry.registerCommand("_update.state", () => {
|
|
440
509
|
return this.state;
|
|
441
510
|
});
|
|
442
511
|
}
|
|
443
512
|
};
|
|
444
|
-
UpdateContribution = ( __decorate([
|
|
445
|
-
( __param(0, IStorageService)),
|
|
446
|
-
( __param(1, IInstantiationService)),
|
|
447
|
-
( __param(2, INotificationService)),
|
|
448
|
-
( __param(3, IDialogService)),
|
|
449
|
-
( __param(4, IUpdateService)),
|
|
450
|
-
( __param(5, IActivityService)),
|
|
451
|
-
( __param(6, IContextKeyService)),
|
|
452
|
-
( __param(7, IProductService)),
|
|
453
|
-
( __param(8, IOpenerService)),
|
|
454
|
-
( __param(9, IConfigurationService)),
|
|
455
|
-
( __param(10, IHostService))
|
|
456
|
-
], UpdateContribution));
|
|
513
|
+
UpdateContribution = ( __decorate([( __param(0, IStorageService)), ( __param(1, IInstantiationService)), ( __param(2, INotificationService)), ( __param(3, IDialogService)), ( __param(4, IUpdateService)), ( __param(5, IActivityService)), ( __param(6, IContextKeyService)), ( __param(7, IProductService)), ( __param(8, IOpenerService)), ( __param(9, IConfigurationService)), ( __param(10, IHostService))], UpdateContribution));
|
|
457
514
|
let SwitchProductQualityContribution = class SwitchProductQualityContribution extends Disposable {
|
|
458
515
|
constructor(productService, environmentService) {
|
|
459
516
|
super();
|
|
@@ -464,20 +521,20 @@ let SwitchProductQualityContribution = class SwitchProductQualityContribution ex
|
|
|
464
521
|
registerGlobalActivityActions() {
|
|
465
522
|
const quality = this.productService.quality;
|
|
466
523
|
const productQualityChangeHandler = this.environmentService.options?.productQualityChangeHandler;
|
|
467
|
-
if (productQualityChangeHandler && (quality ===
|
|
468
|
-
const newQuality = quality ===
|
|
524
|
+
if (productQualityChangeHandler && (quality === "stable" || quality === "insider")) {
|
|
525
|
+
const newQuality = quality === "stable" ? "insider" : "stable";
|
|
469
526
|
const commandId = `update.switchQuality.${newQuality}`;
|
|
470
|
-
const isSwitchingToInsiders = newQuality ===
|
|
527
|
+
const isSwitchingToInsiders = newQuality === "insider";
|
|
471
528
|
this._register(registerAction2(class SwitchQuality extends Action2 {
|
|
472
529
|
constructor() {
|
|
473
530
|
super({
|
|
474
531
|
id: commandId,
|
|
475
|
-
title: isSwitchingToInsiders ? ( localize(
|
|
532
|
+
title: isSwitchingToInsiders ? ( localize(13262, "Switch to Insiders Version...")) : ( localize(13263, "Switch to Stable Version...")),
|
|
476
533
|
precondition: IsWebContext,
|
|
477
534
|
menu: {
|
|
478
535
|
id: MenuId.GlobalActivity,
|
|
479
536
|
when: IsWebContext,
|
|
480
|
-
group:
|
|
537
|
+
group: "7_update"
|
|
481
538
|
}
|
|
482
539
|
});
|
|
483
540
|
}
|
|
@@ -490,76 +547,78 @@ let SwitchProductQualityContribution = class SwitchProductQualityContribution ex
|
|
|
490
547
|
const userDataSyncService = accessor.get(IUserDataSyncService);
|
|
491
548
|
const notificationService = accessor.get(INotificationService);
|
|
492
549
|
try {
|
|
493
|
-
const selectSettingsSyncServiceDialogShownKey =
|
|
550
|
+
const selectSettingsSyncServiceDialogShownKey = "switchQuality.selectSettingsSyncServiceDialogShown";
|
|
494
551
|
const userDataSyncStore = userDataSyncStoreManagementService.userDataSyncStore;
|
|
495
552
|
let userDataSyncStoreType;
|
|
496
|
-
if (userDataSyncStore && isSwitchingToInsiders && userDataSyncEnablementService.isEnabled()
|
|
497
|
-
&& !storageService.getBoolean(selectSettingsSyncServiceDialogShownKey, StorageScope.APPLICATION, false)) {
|
|
553
|
+
if (userDataSyncStore && isSwitchingToInsiders && userDataSyncEnablementService.isEnabled() && !storageService.getBoolean(selectSettingsSyncServiceDialogShownKey, StorageScope.APPLICATION, false)) {
|
|
498
554
|
userDataSyncStoreType = await this.selectSettingsSyncService(dialogService);
|
|
499
555
|
if (!userDataSyncStoreType) {
|
|
500
556
|
return;
|
|
501
557
|
}
|
|
502
|
-
storageService.store(
|
|
503
|
-
|
|
558
|
+
storageService.store(
|
|
559
|
+
selectSettingsSyncServiceDialogShownKey,
|
|
560
|
+
true,
|
|
561
|
+
StorageScope.APPLICATION,
|
|
562
|
+
StorageTarget.USER
|
|
563
|
+
);
|
|
564
|
+
if (userDataSyncStoreType === "stable") {
|
|
504
565
|
await userDataSyncStoreManagementService.switch(userDataSyncStoreType);
|
|
505
566
|
}
|
|
506
567
|
}
|
|
507
568
|
const res = await dialogService.confirm({
|
|
508
|
-
type:
|
|
509
|
-
message: ( localize(
|
|
510
|
-
detail: newQuality ===
|
|
511
|
-
|
|
512
|
-
12905,
|
|
569
|
+
type: "info",
|
|
570
|
+
message: ( localize(13264, "Changing the version requires a reload to take effect")),
|
|
571
|
+
detail: newQuality === "insider" ? ( localize(
|
|
572
|
+
13265,
|
|
513
573
|
"Press the reload button to switch to the Insiders version of VS Code."
|
|
514
|
-
)) :
|
|
515
|
-
|
|
516
|
-
12906,
|
|
574
|
+
)) : ( localize(
|
|
575
|
+
13266,
|
|
517
576
|
"Press the reload button to switch to the Stable version of VS Code."
|
|
518
577
|
)),
|
|
519
|
-
primaryButton: ( localize(
|
|
578
|
+
primaryButton: ( localize(13267, "&&Reload"))
|
|
520
579
|
});
|
|
521
580
|
if (res.confirmed) {
|
|
522
581
|
const promises = [];
|
|
523
582
|
if (userDataSyncService.status === SyncStatus.Syncing) {
|
|
524
|
-
promises.push(Event.toPromise(Event.filter(
|
|
583
|
+
promises.push(Event.toPromise(Event.filter(
|
|
584
|
+
userDataSyncService.onDidChangeStatus,
|
|
585
|
+
status => status !== SyncStatus.Syncing
|
|
586
|
+
)));
|
|
525
587
|
}
|
|
526
588
|
if (isSwitchingToInsiders && userDataSyncStoreType) {
|
|
527
589
|
promises.push(userDataSyncWorkbenchService.synchroniseUserDataSyncStoreType());
|
|
528
590
|
}
|
|
529
591
|
await Promises.settled(promises);
|
|
530
592
|
productQualityChangeHandler(newQuality);
|
|
531
|
-
}
|
|
532
|
-
else {
|
|
593
|
+
} else {
|
|
533
594
|
if (userDataSyncStoreType) {
|
|
534
595
|
storageService.remove(selectSettingsSyncServiceDialogShownKey, StorageScope.APPLICATION);
|
|
535
596
|
}
|
|
536
597
|
}
|
|
537
|
-
}
|
|
538
|
-
catch (error) {
|
|
598
|
+
} catch (error) {
|
|
539
599
|
notificationService.error(error);
|
|
540
600
|
}
|
|
541
601
|
}
|
|
542
602
|
async selectSettingsSyncService(dialogService) {
|
|
543
|
-
const {
|
|
603
|
+
const {
|
|
604
|
+
result
|
|
605
|
+
} = await dialogService.prompt({
|
|
544
606
|
type: Severity.Info,
|
|
545
607
|
message: ( localize(
|
|
546
|
-
|
|
608
|
+
13268,
|
|
547
609
|
"Choose the settings sync service to use after changing the version"
|
|
548
610
|
)),
|
|
549
611
|
detail: ( localize(
|
|
550
|
-
|
|
612
|
+
13269,
|
|
551
613
|
"The Insiders version of VS Code will synchronize your settings, keybindings, extensions, snippets and UI State using separate insiders settings sync service by default."
|
|
552
614
|
)),
|
|
553
|
-
buttons: [
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
run: () => 'stable'
|
|
561
|
-
}
|
|
562
|
-
],
|
|
615
|
+
buttons: [{
|
|
616
|
+
label: ( localize(13270, "&&Insiders")),
|
|
617
|
+
run: () => "insiders"
|
|
618
|
+
}, {
|
|
619
|
+
label: ( localize(13271, "&&Stable (current)")),
|
|
620
|
+
run: () => "stable"
|
|
621
|
+
}],
|
|
563
622
|
cancelButton: true
|
|
564
623
|
});
|
|
565
624
|
return result;
|
|
@@ -568,9 +627,31 @@ let SwitchProductQualityContribution = class SwitchProductQualityContribution ex
|
|
|
568
627
|
}
|
|
569
628
|
}
|
|
570
629
|
};
|
|
571
|
-
SwitchProductQualityContribution = ( __decorate([
|
|
572
|
-
|
|
573
|
-
(
|
|
574
|
-
|
|
630
|
+
SwitchProductQualityContribution = ( __decorate([( __param(0, IProductService)), ( __param(1, IBrowserWorkbenchEnvironmentService))], SwitchProductQualityContribution));
|
|
631
|
+
let DefaultAccountUpdateContribution = class DefaultAccountUpdateContribution extends Disposable {
|
|
632
|
+
constructor(updateService, defaultAccountService) {
|
|
633
|
+
super();
|
|
634
|
+
this.updateService = updateService;
|
|
635
|
+
this.defaultAccountService = defaultAccountService;
|
|
636
|
+
if (isWeb) {
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
this.checkDefaultAccount();
|
|
640
|
+
this._register(this.defaultAccountService.onDidChangeDefaultAccount(() => {
|
|
641
|
+
this.checkDefaultAccount();
|
|
642
|
+
}));
|
|
643
|
+
}
|
|
644
|
+
async checkDefaultAccount() {
|
|
645
|
+
try {
|
|
646
|
+
const defaultAccount = await this.defaultAccountService.getDefaultAccount();
|
|
647
|
+
const shouldDisable = defaultAccount?.entitlementsData?.organization_login_list?.some(org => org.toLowerCase() === "visual-studio-code") ?? false;
|
|
648
|
+
if (shouldDisable) {
|
|
649
|
+
await this.updateService.disableProgressiveReleases();
|
|
650
|
+
this.dispose();
|
|
651
|
+
}
|
|
652
|
+
} catch (error) {}
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
DefaultAccountUpdateContribution = ( __decorate([( __param(0, IUpdateService)), ( __param(1, IDefaultAccountService))], DefaultAccountUpdateContribution));
|
|
575
656
|
|
|
576
|
-
export { CONTEXT_UPDATE_STATE, DOWNLOAD_URL, MAJOR_MINOR_UPDATE_AVAILABLE, ProductContribution, RELEASE_NOTES_URL, SwitchProductQualityContribution, UpdateContribution, showReleaseNotesInEditor };
|
|
657
|
+
export { CONTEXT_UPDATE_STATE, DOWNLOAD_URL, DefaultAccountUpdateContribution, MAJOR_MINOR_UPDATE_AVAILABLE, ProductContribution, RELEASE_NOTES_URL, SwitchProductQualityContribution, UpdateContribution, showReleaseNotesInEditor };
|