@@ -4,6 +4,7 @@ import { inject, injectable } from '@theia/core/shared/inversify';
4
4
import { LocalStorageService } from '@theia/core/lib/browser' ;
5
5
import { nls } from '@theia/core/lib/common' ;
6
6
import { WindowService } from '@theia/core/lib/browser/window/window-service' ;
7
+ import { ArduinoPreferences } from '../arduino-preferences' ;
7
8
8
9
export type Survey = {
9
10
url : URL ;
@@ -37,32 +38,37 @@ export class SurveyNotification implements FrontendApplicationContribution {
37
38
@inject ( WindowService )
38
39
protected readonly windowService : WindowService ;
39
40
41
+ @inject ( ArduinoPreferences )
42
+ protected readonly arduinoPreferences : ArduinoPreferences ;
43
+
40
44
async onStart ( ) : Promise < void > {
41
- this . localStorageService
42
- . getData ( this . surveyKey ( surveyId ) , undefined )
43
- . then ( ( surveyAnswered ) => {
44
- if ( surveyAnswered !== undefined ) {
45
- return ;
46
- }
47
- return this . messageService . info (
48
- SURVEY_MESSAGE ,
49
- DO_NOT_SHOW_AGAIN ,
50
- GO_TO_SURVEY
51
- ) ;
52
- } )
53
- . then ( ( answer ) => {
54
- switch ( answer ) {
55
- case GO_TO_SURVEY :
56
- this . windowService . openNewWindow ( SURVEY_BASE_URL + surveyId , {
57
- external : true ,
58
- } ) ;
59
- this . localStorageService . setData ( this . surveyKey ( surveyId ) , true ) ;
60
- break ;
61
- case DO_NOT_SHOW_AGAIN :
62
- this . localStorageService . setData ( this . surveyKey ( surveyId ) , false ) ;
63
- break ;
64
- }
65
- } ) ;
45
+ if ( this . arduinoPreferences . get ( 'arduino.survey.notification' ) ) {
46
+ this . localStorageService
47
+ . getData ( this . surveyKey ( surveyId ) , undefined )
48
+ . then ( ( surveyAnswered ) => {
49
+ if ( surveyAnswered !== undefined ) {
50
+ return ;
51
+ }
52
+ return this . messageService . info (
53
+ SURVEY_MESSAGE ,
54
+ DO_NOT_SHOW_AGAIN ,
55
+ GO_TO_SURVEY
56
+ ) ;
57
+ } )
58
+ . then ( ( answer ) => {
59
+ switch ( answer ) {
60
+ case GO_TO_SURVEY :
61
+ this . windowService . openNewWindow ( SURVEY_BASE_URL + surveyId , {
62
+ external : true ,
63
+ } ) ;
64
+ this . localStorageService . setData ( this . surveyKey ( surveyId ) , true ) ;
65
+ break ;
66
+ case DO_NOT_SHOW_AGAIN :
67
+ this . localStorageService . setData ( this . surveyKey ( surveyId ) , false ) ;
68
+ break ;
69
+ }
70
+ } ) ;
71
+ }
66
72
}
67
73
68
74
private surveyKey ( id : string ) : string {
0 commit comments