提交 722149a2 编写于 作者: C Christof Marti

Telemetry opt-out notice

上级 67efbbf5
{
"name": "code-oss-dev",
"version": "1.22.0",
"distro": "c2f5517441bb68c5be671fd2e5f71193e7b2682f",
"distro": "6e8c6e1a8dc5df53e357062bee4f14a1843c2249",
"author": {
"name": "Microsoft Corporation"
},
......
......@@ -60,6 +60,7 @@ export interface IProductConfiguration {
reportIssueUrl: string;
licenseUrl: string;
privacyStatementUrl: string;
telemetryOptOutUrl: string;
npsSurveyUrl: string;
surveys: ISurveyData[];
checksums: { [path: string]: string; };
......
......@@ -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);
\ No newline at end of file
.registerWorkbenchContribution(GettingStarted, LifecyclePhase.Running);
Registry
.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
.registerWorkbenchContribution(TelemetryOptOut, LifecyclePhase.Eventually);
\ No newline at end of file
/*---------------------------------------------------------------------------------------------
* 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);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册