Skip to content

Commit ebaa253

Browse files
authored
Merge pull request microsoft#153239 from microsoft/joao/crowded-wildebeest
refactor: 🩺 use StorageScope.Application for update feature
2 parents 4d427d6 + 4959d43 commit ebaa253

File tree

1 file changed

+12
-12
lines changed
  • src/vs/workbench/contrib/update/browser

1 file changed

+12
-12
lines changed

src/vs/workbench/contrib/update/browser/update.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export class ProductContribution implements IWorkbenchContribution {
163163
return;
164164
}
165165

166-
const lastVersion = parseVersion(storageService.get(ProductContribution.KEY, StorageScope.PROFILE, ''));
166+
const lastVersion = parseVersion(storageService.get(ProductContribution.KEY, StorageScope.APPLICATION, ''));
167167
const currentVersion = parseVersion(productService.version);
168168
const shouldShowReleaseNotes = configurationService.getValue<boolean>('update.showReleaseNotes');
169169
const releaseNotesUrl = productService.releaseNotesUrl;
@@ -186,7 +186,7 @@ export class ProductContribution implements IWorkbenchContribution {
186186
});
187187
}
188188

189-
storageService.store(ProductContribution.KEY, productService.version, StorageScope.PROFILE, StorageTarget.MACHINE);
189+
storageService.store(ProductContribution.KEY, productService.version, StorageScope.APPLICATION, StorageTarget.MACHINE);
190190
});
191191
}
192192
}
@@ -224,12 +224,12 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
224224
*/
225225

226226
const currentVersion = this.productService.commit;
227-
const lastKnownVersion = this.storageService.get('update/lastKnownVersion', StorageScope.PROFILE);
227+
const lastKnownVersion = this.storageService.get('update/lastKnownVersion', StorageScope.APPLICATION);
228228

229229
// if current version != stored version, clear both fields
230230
if (currentVersion !== lastKnownVersion) {
231-
this.storageService.remove('update/lastKnownVersion', StorageScope.PROFILE);
232-
this.storageService.remove('update/updateNotificationTime', StorageScope.PROFILE);
231+
this.storageService.remove('update/lastKnownVersion', StorageScope.APPLICATION);
232+
this.storageService.remove('update/updateNotificationTime', StorageScope.APPLICATION);
233233
}
234234

235235
this.registerGlobalActivityActions();
@@ -400,15 +400,15 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
400400
private shouldShowNotification(): boolean {
401401
const currentVersion = this.productService.commit;
402402
const currentMillis = new Date().getTime();
403-
const lastKnownVersion = this.storageService.get('update/lastKnownVersion', StorageScope.PROFILE);
403+
const lastKnownVersion = this.storageService.get('update/lastKnownVersion', StorageScope.APPLICATION);
404404

405405
// if version != stored version, save version and date
406406
if (currentVersion !== lastKnownVersion) {
407-
this.storageService.store('update/lastKnownVersion', currentVersion!, StorageScope.PROFILE, StorageTarget.MACHINE);
408-
this.storageService.store('update/updateNotificationTime', currentMillis, StorageScope.PROFILE, StorageTarget.MACHINE);
407+
this.storageService.store('update/lastKnownVersion', currentVersion!, StorageScope.APPLICATION, StorageTarget.MACHINE);
408+
this.storageService.store('update/updateNotificationTime', currentMillis, StorageScope.APPLICATION, StorageTarget.MACHINE);
409409
}
410410

411-
const updateNotificationMillis = this.storageService.getNumber('update/updateNotificationTime', StorageScope.PROFILE, currentMillis);
411+
const updateNotificationMillis = this.storageService.getNumber('update/updateNotificationTime', StorageScope.APPLICATION, currentMillis);
412412
const diffDays = (currentMillis - updateNotificationMillis) / (1000 * 60 * 60 * 24);
413413

414414
return diffDays > 5;
@@ -536,12 +536,12 @@ export class SwitchProductQualityContribution extends Disposable implements IWor
536536
const userDataSyncStore = userDataSyncStoreManagementService.userDataSyncStore;
537537
let userDataSyncStoreType: UserDataSyncStoreType | undefined;
538538
if (userDataSyncStore && isSwitchingToInsiders && userDataSyncEnablementService.isEnabled()
539-
&& !storageService.getBoolean(selectSettingsSyncServiceDialogShownKey, StorageScope.PROFILE, false)) {
539+
&& !storageService.getBoolean(selectSettingsSyncServiceDialogShownKey, StorageScope.APPLICATION, false)) {
540540
userDataSyncStoreType = await this.selectSettingsSyncService(dialogService);
541541
if (!userDataSyncStoreType) {
542542
return;
543543
}
544-
storageService.store(selectSettingsSyncServiceDialogShownKey, true, StorageScope.PROFILE, StorageTarget.USER);
544+
storageService.store(selectSettingsSyncServiceDialogShownKey, true, StorageScope.APPLICATION, StorageTarget.USER);
545545
if (userDataSyncStoreType === 'stable') {
546546
// Update the stable service type in the current window, so that it uses stable service after switched to insiders version (after reload).
547547
await userDataSyncStoreManagementService.switch(userDataSyncStoreType);
@@ -576,7 +576,7 @@ export class SwitchProductQualityContribution extends Disposable implements IWor
576576
} else {
577577
// Reset
578578
if (userDataSyncStoreType) {
579-
storageService.remove(selectSettingsSyncServiceDialogShownKey, StorageScope.PROFILE);
579+
storageService.remove(selectSettingsSyncServiceDialogShownKey, StorageScope.APPLICATION);
580580
}
581581
}
582582
} catch (error) {

0 commit comments

Comments
 (0)