提交 ae9f4c8f 编写于 作者: C Christof Marti

Use window with focus

上级 bc4c0fb7
......@@ -14,6 +14,7 @@ import { INotificationService, Severity } from 'vs/platform/notification/common/
import URI from 'vs/base/common/uri';
import { localize } from 'vs/nls';
import { onUnexpectedError } from 'vs/base/common/errors';
import { IWindowService } from 'vs/platform/windows/common/windows';
export class TelemetryOptOut implements IWorkbenchContribution {
......@@ -24,17 +25,23 @@ export class TelemetryOptOut implements IWorkbenchContribution {
@IEnvironmentService environmentService: IEnvironmentService,
@IOpenerService openerService: IOpenerService,
@INotificationService notificationService: INotificationService,
@IWindowService windowService: IWindowService,
@ITelemetryService telemetryService: ITelemetryService
) {
if (!product.telemetryOptOutUrl || storageService.get(TelemetryOptOut.TELEMETRY_OPT_OUT_SHOWN)) {
return;
}
storageService.store(TelemetryOptOut.TELEMETRY_OPT_OUT_SHOWN, true);
windowService.isFocused().then(focused => {
if (!focused) {
return null;
}
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)))
const optOutUrl = product.telemetryOptOutUrl;
const privacyUrl = product.privacyStatementUrl || product.telemetryOptOutUrl;
return 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.
先完成此消息的编辑!
想要评论请 注册