diff --git a/package.json b/package.json index ea46101d5c7778ebbff3278ea6f825d7ead88f54..1935328a5d86041640440bb4e0f7d346f64cbd99 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.22.0", - "distro": "c2f5517441bb68c5be671fd2e5f71193e7b2682f", + "distro": "6e8c6e1a8dc5df53e357062bee4f14a1843c2249", "author": { "name": "Microsoft Corporation" }, diff --git a/src/vs/platform/node/product.ts b/src/vs/platform/node/product.ts index 0e902be82db231e6f04e82c7b03cf6e16caac0cf..f85d99660c562b835102665e09a5df9680aaa906 100644 --- a/src/vs/platform/node/product.ts +++ b/src/vs/platform/node/product.ts @@ -60,6 +60,7 @@ export interface IProductConfiguration { reportIssueUrl: string; licenseUrl: string; privacyStatementUrl: string; + telemetryOptOutUrl: string; npsSurveyUrl: string; surveys: ISurveyData[]; checksums: { [path: string]: string; }; diff --git a/src/vs/workbench/parts/welcome/gettingStarted/electron-browser/gettingStarted.contribution.ts b/src/vs/workbench/parts/welcome/gettingStarted/electron-browser/gettingStarted.contribution.ts index b088515c70494afb3453d6e2df7d49106a38ce21..2c9deba24a64cb737eb373468cdf6920992e27c5 100644 --- a/src/vs/workbench/parts/welcome/gettingStarted/electron-browser/gettingStarted.contribution.ts +++ b/src/vs/workbench/parts/welcome/gettingStarted/electron-browser/gettingStarted.contribution.ts @@ -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(WorkbenchExtensions.Workbench) - .registerWorkbenchContribution(GettingStarted, LifecyclePhase.Running); \ No newline at end of file + .registerWorkbenchContribution(GettingStarted, LifecyclePhase.Running); + +Registry + .as(WorkbenchExtensions.Workbench) + .registerWorkbenchContribution(TelemetryOptOut, LifecyclePhase.Eventually); \ No newline at end of file diff --git a/src/vs/workbench/parts/welcome/gettingStarted/electron-browser/telemetryOptOut.ts b/src/vs/workbench/parts/welcome/gettingStarted/electron-browser/telemetryOptOut.ts new file mode 100644 index 0000000000000000000000000000000000000000..06717ff21876a27687b7f40ffbfc4bde83f37570 --- /dev/null +++ b/src/vs/workbench/parts/welcome/gettingStarted/electron-browser/telemetryOptOut.ts @@ -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); + } +}