Telemetry opt-out notice

This commit is contained in:
Christof Marti 2018-03-16 16:27:27 +01:00
parent 67efbbf5ca
commit 722149a26b
4 changed files with 48 additions and 2 deletions

View file

@ -1,7 +1,7 @@
{
"name": "code-oss-dev",
"version": "1.22.0",
"distro": "c2f5517441bb68c5be671fd2e5f71193e7b2682f",
"distro": "6e8c6e1a8dc5df53e357062bee4f14a1843c2249",
"author": {
"name": "Microsoft Corporation"
},

View file

@ -60,6 +60,7 @@ export interface IProductConfiguration {
reportIssueUrl: string;
licenseUrl: string;
privacyStatementUrl: string;
telemetryOptOutUrl: string;
npsSurveyUrl: string;
surveys: ISurveyData[];
checksums: { [path: string]: string; };

View file

@ -6,9 +6,14 @@
import { Registry } from 'vs/platform/registry/common/platform';
import { GettingStarted } from './gettingStarted';
import { TelemetryOptOut } from './telemetryOptOut';
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
Registry
.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
.registerWorkbenchContribution(GettingStarted, LifecyclePhase.Running);
.registerWorkbenchContribution(GettingStarted, LifecyclePhase.Running);
Registry
.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
.registerWorkbenchContribution(TelemetryOptOut, LifecyclePhase.Eventually);

View file

@ -0,0 +1,40 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import product from 'vs/platform/node/product';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import URI from 'vs/base/common/uri';
import { localize } from 'vs/nls';
import { onUnexpectedError } from 'vs/base/common/errors';
export class TelemetryOptOut implements IWorkbenchContribution {
private static TELEMETRY_OPT_OUT_SHOWN = 'workbench.telemetryOptOutShown';
constructor(
@IStorageService storageService: IStorageService,
@IEnvironmentService environmentService: IEnvironmentService,
@IOpenerService openerService: IOpenerService,
@INotificationService notificationService: INotificationService,
@ITelemetryService telemetryService: ITelemetryService
) {
if (!product.telemetryOptOutUrl || storageService.get(TelemetryOptOut.TELEMETRY_OPT_OUT_SHOWN)) {
return;
}
storageService.store(TelemetryOptOut.TELEMETRY_OPT_OUT_SHOWN, true);
const optOutUrl = product.telemetryOptOutUrl;
const privacyUrl = product.privacyStatementUrl || product.telemetryOptOutUrl;
notificationService.prompt(Severity.Info, localize('telemetryOptOut.notice', "Help improve VS Code by allowing Microsoft to collect usage data. Read our [privacy statement]({0}) and learn how to [opt out]({1}).", privacyUrl, optOutUrl), [localize('telemetryOptOut.readMore', "Read More")])
.then(() => openerService.open(URI.parse(optOutUrl)))
.then(null, onUnexpectedError);
}
}