Skip to content

Commit 7eb31cd

Browse files
code clean up and i18n update
1 parent ed83aca commit 7eb31cd

File tree

2 files changed

+24
-33
lines changed

2 files changed

+24
-33
lines changed

Diff for: arduino-ide-extension/src/browser/contributions/survey-notification.ts

+23-32
Original file line numberDiff line numberDiff line change
@@ -37,39 +37,30 @@ export class SurveyNotification implements FrontendApplicationContribution {
3737
private readonly arduinoPreferences: ArduinoPreferences;
3838

3939
onStart(): void {
40-
this.arduinoPreferences.ready.then(() => {
40+
this.arduinoPreferences.ready.then(async () => {
4141
if (this.arduinoPreferences.get('arduino.survey.notification')) {
42-
this.localStorageService
43-
.getData(this.surveyKey(surveyId))
44-
.then((surveyAnswered) => {
45-
if (surveyAnswered !== undefined) {
46-
return;
47-
}
48-
return this.messageService.info(
49-
SURVEY_MESSAGE,
50-
DO_NOT_SHOW_AGAIN,
51-
GO_TO_SURVEY
52-
);
53-
})
54-
.then((answer) => {
55-
switch (answer) {
56-
case GO_TO_SURVEY:
57-
this.windowService.openNewWindow(SURVEY_BASE_URL + surveyId, {
58-
external: true,
59-
});
60-
this.localStorageService.setData(
61-
this.surveyKey(surveyId),
62-
true
63-
);
64-
break;
65-
case DO_NOT_SHOW_AGAIN:
66-
this.localStorageService.setData(
67-
this.surveyKey(surveyId),
68-
false
69-
);
70-
break;
71-
}
72-
});
42+
const surveyAnswered = await this.localStorageService.getData(
43+
this.surveyKey(surveyId)
44+
);
45+
if (surveyAnswered !== undefined) {
46+
return;
47+
}
48+
const answer = await this.messageService.info(
49+
SURVEY_MESSAGE,
50+
DO_NOT_SHOW_AGAIN,
51+
GO_TO_SURVEY
52+
);
53+
switch (answer) {
54+
case GO_TO_SURVEY:
55+
this.windowService.openNewWindow(SURVEY_BASE_URL + surveyId, {
56+
external: true,
57+
});
58+
this.localStorageService.setData(this.surveyKey(surveyId), true);
59+
break;
60+
case DO_NOT_SHOW_AGAIN:
61+
this.localStorageService.setData(this.surveyKey(surveyId), false);
62+
break;
63+
}
7364
}
7465
});
7566
}

Diff for: i18n/en.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@
308308
},
309309
"survey": {
310310
"answerSurvey": "ANSWER SURVEY",
311-
"dismissSurvey": "DONT SHOW ANYMORE",
311+
"dismissSurvey": "DON'T SHOW ANYMORE",
312312
"surveyMessage": "Please help us improve by answering this super short survey. We value our community and would like to get to know our supporters a little better."
313313
},
314314
"upload": {

0 commit comments

Comments
 (0)