Have vscode.env.telemetryEnabled respect product config

This commit is contained in:
Logan Ramos 2021-08-23 13:46:21 -04:00
parent 1c324f820b
commit ad42148eeb
No known key found for this signature in database
GPG key ID: D9CCFF14F0B18183

View file

@ -10,6 +10,7 @@ import { ClassifiedEvent, StrictPropertyCheck, GDPRClassification } from 'vs/pla
import { Disposable } from 'vs/base/common/lifecycle';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IProductService } from 'vs/platform/product/common/productService';
@extHostNamedCustomer(MainContext.MainThreadTelemetry)
export class MainThreadTelemetry extends Disposable implements MainThreadTelemetryShape {
@ -22,12 +23,13 @@ export class MainThreadTelemetry extends Disposable implements MainThreadTelemet
@ITelemetryService private readonly _telemetryService: ITelemetryService,
@IConfigurationService private readonly _configurationService: IConfigurationService,
@IEnvironmentService private readonly _environmenService: IEnvironmentService,
@IProductService private readonly _productService: IProductService
) {
super();
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostTelemetry);
if (!this._environmenService.disableTelemetry) {
if (!this._environmenService.disableTelemetry && this._productService.enableTelemetry) {
this._register(this._configurationService.onDidChangeConfiguration(e => {
if (e.affectedKeys.includes('telemetry.enableTelemetry')) {
this._proxy.$onDidChangeTelemetryEnabled(this.telemetryEnabled);
@ -39,7 +41,7 @@ export class MainThreadTelemetry extends Disposable implements MainThreadTelemet
}
private get telemetryEnabled(): boolean {
if (this._environmenService.disableTelemetry) {
if (this._environmenService.disableTelemetry || !this._productService.enableTelemetry) {
return false;
}