Skip to content

Commit bedc2bf

Browse files
committed
sync telemetry opt out key
1 parent 10c7db8 commit bedc2bf

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/vs/workbench/contrib/welcome/telemetryOptOut/browser/telemetryOptOut.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
1919
import { IHostService } from 'vs/workbench/services/host/browser/host';
2020
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
2121
import { IJSONEditingService } from 'vs/workbench/services/configuration/common/jsonEditing';
22+
import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys';
2223

2324
export abstract class AbstractTelemetryOptOut implements IWorkbenchContribution {
2425

@@ -27,6 +28,7 @@ export abstract class AbstractTelemetryOptOut implements IWorkbenchContribution
2728

2829
constructor(
2930
@IStorageService private readonly storageService: IStorageService,
31+
@IStorageKeysSyncRegistryService storageKeysSyncRegistryService: IStorageKeysSyncRegistryService,
3032
@IOpenerService private readonly openerService: IOpenerService,
3133
@INotificationService private readonly notificationService: INotificationService,
3234
@IHostService private readonly hostService: IHostService,
@@ -37,7 +39,9 @@ export abstract class AbstractTelemetryOptOut implements IWorkbenchContribution
3739
@IProductService private readonly productService: IProductService,
3840
@IEnvironmentService private readonly environmentService: IEnvironmentService,
3941
@IJSONEditingService private readonly jsonEditingService: IJSONEditingService
40-
) { }
42+
) {
43+
storageKeysSyncRegistryService.registerStorageKey({ key: AbstractTelemetryOptOut.TELEMETRY_OPT_OUT_SHOWN, version: 1 });
44+
}
4145

4246
protected async handleTelemetryOptOut(): Promise<void> {
4347
if (this.productService.telemetryOptOutUrl && !this.storageService.get(AbstractTelemetryOptOut.TELEMETRY_OPT_OUT_SHOWN, StorageScope.GLOBAL)) {
@@ -161,6 +165,7 @@ export class BrowserTelemetryOptOut extends AbstractTelemetryOptOut {
161165

162166
constructor(
163167
@IStorageService storageService: IStorageService,
168+
@IStorageKeysSyncRegistryService storageKeysSyncRegistryService: IStorageKeysSyncRegistryService,
164169
@IOpenerService openerService: IOpenerService,
165170
@INotificationService notificationService: INotificationService,
166171
@IHostService hostService: IHostService,
@@ -172,7 +177,7 @@ export class BrowserTelemetryOptOut extends AbstractTelemetryOptOut {
172177
@IEnvironmentService environmentService: IEnvironmentService,
173178
@IJSONEditingService jsonEditingService: IJSONEditingService
174179
) {
175-
super(storageService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService, environmentService, jsonEditingService);
180+
super(storageService, storageKeysSyncRegistryService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService, environmentService, jsonEditingService);
176181

177182
this.handleTelemetryOptOut();
178183
}

src/vs/workbench/contrib/welcome/telemetryOptOut/electron-sandbox/telemetryOptOut.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ import { AbstractTelemetryOptOut } from 'vs/workbench/contrib/welcome/telemetryO
1616
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
1717
import { IJSONEditingService } from 'vs/workbench/services/configuration/common/jsonEditing';
1818
import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron';
19+
import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys';
1920

2021
export class NativeTelemetryOptOut extends AbstractTelemetryOptOut {
2122

2223
constructor(
2324
@IStorageService storageService: IStorageService,
25+
@IStorageKeysSyncRegistryService storageKeysSyncRegistryService: IStorageKeysSyncRegistryService,
2426
@IOpenerService openerService: IOpenerService,
2527
@INotificationService notificationService: INotificationService,
2628
@IHostService hostService: IHostService,
@@ -33,7 +35,7 @@ export class NativeTelemetryOptOut extends AbstractTelemetryOptOut {
3335
@IJSONEditingService jsonEditingService: IJSONEditingService,
3436
@IElectronService private readonly electronService: IElectronService
3537
) {
36-
super(storageService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService, environmentService, jsonEditingService);
38+
super(storageService, storageKeysSyncRegistryService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService, environmentService, jsonEditingService);
3739

3840
this.handleTelemetryOptOut();
3941
}

0 commit comments

Comments
 (0)