Skip to content

Fix feedback service #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/client/feedback/feedbackService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ export class FeedbackService implements Disposable {
constructor(persistentStateFactory: IPersistentStateFactory) {
this.showFeedbackPrompt = persistentStateFactory.createGlobalPersistentState('SHOW_FEEDBACK_PROMPT', true);
this.userResponded = persistentStateFactory.createGlobalPersistentState('RESPONDED_TO_FEEDBACK', false);
if (this.showFeedbackPrompt.value && !this.userResponded.value) {
this.initialize();
}
this.initialize();
}
public dispose() {
this.counters = undefined;
Expand All @@ -44,6 +42,9 @@ export class FeedbackService implements Disposable {
// tslint:disable-next-line:no-void-expression
let commandDisable = commands.registerCommand('python.updateFeedbackCounter', (telemetryEventName: string) => this.updateFeedbackCounter(telemetryEventName));
this.disposables.push(commandDisable);
if (!this.showFeedbackPrompt.value || this.userResponded.value) {
return;
}
// tslint:disable-next-line:no-void-expression
commandDisable = workspace.onDidChangeTextDocument(changeEvent => this.handleChangesToTextDocument(changeEvent.document), this, this.disposables);
this.disposables.push(commandDisable);
Expand All @@ -60,7 +61,8 @@ export class FeedbackService implements Disposable {
if (!this.canShowPrompt) {
return;
}
this.counters.incrementEditCounter();
// tslint:disable-next-line:no-non-null-assertion
this.counters!.incrementEditCounter();
}
private updateFeedbackCounter(telemetryEventName: string): void {
// Ignore feedback events.
Expand All @@ -70,7 +72,8 @@ export class FeedbackService implements Disposable {
if (!this.canShowPrompt) {
return;
}
this.counters.incrementFeatureUsageCounter();
// tslint:disable-next-line:no-non-null-assertion
this.counters!.incrementFeatureUsageCounter();
}
private thresholdHandler() {
if (!this.canShowPrompt) {
Expand Down