Skip to content

Commit

Permalink
document the purpose of the service
Browse files Browse the repository at this point in the history
  • Loading branch information
francescospissu committed Jun 16, 2022
1 parent 4a0e0cf commit 226f0b8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions arduino-ide-extension/src/node/survey-service-impl.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import { injectable } from '@theia/core/shared/inversify';
import { SurveyNotificationService } from '../common/protocol/survey-service';

/**
* Service for checking if it is the first instance of the IDE, in this case it sets a flag to true.
* This flag is used to prevent the survey notification from being visible in every open window. It must only be shown on one window.
*/
@injectable()
export class SurveyNotificationServiceImpl
implements SurveyNotificationService
{
private isSurveyShown = false;
private surveyDidShow = false;
async isFirstInstance(): Promise<boolean> {
if (this.isSurveyShown) {
if (this.surveyDidShow) {
return false;
}
return (this.isSurveyShown = true);
this.surveyDidShow = true;
return this.surveyDidShow;
}
}

0 comments on commit 226f0b8

Please sign in to comment.