Add check for disable telemetry when showing opt out (#11796)

* add check for disable telemtry when showing output

* remove previous fixes for smoke tests

* fix compile

* continue on error for smoke tests
This commit is contained in:
Anthony Dresser
2020-08-13 16:57:05 -07:00
committed by GitHub
parent f3a48da3fa
commit a69b4bf662
4 changed files with 12 additions and 5 deletions

View File

@@ -17,6 +17,7 @@ import { IExtensionGalleryService } from 'vs/platform/extensionManagement/common
import { CancellationToken } from 'vs/base/common/cancellation';
import { IProductService } from 'vs/platform/product/common/productService';
import { IHostService } from 'vs/workbench/services/host/browser/host';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
export abstract class AbstractTelemetryOptOut implements IWorkbenchContribution {
@@ -33,10 +34,11 @@ export abstract class AbstractTelemetryOptOut implements IWorkbenchContribution
@IConfigurationService private readonly configurationService: IConfigurationService,
@IExtensionGalleryService private readonly galleryService: IExtensionGalleryService,
@IProductService private readonly productService: IProductService,
@IEnvironmentService private readonly environmentService: IEnvironmentService
) { }
protected async handleTelemetryOptOut(): Promise<void> {
if (this.productService.telemetryOptOutUrl && !this.storageService.get(AbstractTelemetryOptOut.TELEMETRY_OPT_OUT_SHOWN, StorageScope.GLOBAL)) {
if (this.productService.telemetryOptOutUrl && !this.storageService.get(AbstractTelemetryOptOut.TELEMETRY_OPT_OUT_SHOWN, StorageScope.GLOBAL) && !this.environmentService.disableTelemetry) { // {{SQL CARBON EDIT}} add check for disable telemetry
const experimentId = 'telemetryOptOut';
const [count, experimentState] = await Promise.all([this.getWindowCount(), this.experimentService.getExperimentById(experimentId)]);
@@ -164,9 +166,10 @@ export class BrowserTelemetryOptOut extends AbstractTelemetryOptOut {
@IExperimentService experimentService: IExperimentService,
@IConfigurationService configurationService: IConfigurationService,
@IExtensionGalleryService galleryService: IExtensionGalleryService,
@IProductService productService: IProductService
@IProductService productService: IProductService,
@IEnvironmentService environmentService: IEnvironmentService
) {
super(storageService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService);
super(storageService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService, environmentService);
this.handleTelemetryOptOut();
}

View File

@@ -14,6 +14,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
import { IHostService } from 'vs/workbench/services/host/browser/host';
import { AbstractTelemetryOptOut } from 'vs/workbench/contrib/welcome/telemetryOptOut/browser/telemetryOptOut';
import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
export class NativeTelemetryOptOut extends AbstractTelemetryOptOut {
@@ -27,9 +28,10 @@ export class NativeTelemetryOptOut extends AbstractTelemetryOptOut {
@IConfigurationService configurationService: IConfigurationService,
@IExtensionGalleryService galleryService: IExtensionGalleryService,
@IProductService productService: IProductService,
@IEnvironmentService environmentService: IEnvironmentService,
@IElectronService private readonly electronService: IElectronService
) {
super(storageService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService);
super(storageService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService, environmentService);
this.handleTelemetryOptOut();
}