@@ -25,6 +25,7 @@ const SESSION_COUNT_KEY = "nps/sessionCount";
25
25
const LAST_SESSION_DATE_KEY = "nps/lastSessionDate" ;
26
26
const SKIP_VERSION_KEY = "nps/skipVersion" ;
27
27
const IS_CANDIDATE_KEY = "nps/isCandidate" ;
28
+ const NEVER_KEY = "nps/never" ;
28
29
29
30
export class UserSurvey {
30
31
private static _instance : UserSurvey ;
@@ -39,8 +40,19 @@ export class UserSurvey {
39
40
40
41
public async promptUserForNPSFeedback ( ) : Promise < void > {
41
42
const globalState = this . _context . globalState ;
43
+
44
+ // If the user has opted out of the survey, don't prompt for feedback
45
+ const isNeverUser = globalState . get ( NEVER_KEY , false ) ;
46
+ if ( isNeverUser ) {
47
+ return ;
48
+ }
49
+
50
+ // If the user has already been prompted for feedback in this version, don't prompt again
51
+ const extensionVersion =
52
+ vscode . extensions . getExtension ( constants . extensionId ) . packageJSON
53
+ . version || "unknown" ;
42
54
const skipVersion = globalState . get ( SKIP_VERSION_KEY , "" ) ;
43
- if ( skipVersion ) {
55
+ if ( skipVersion === extensionVersion ) {
44
56
return ;
45
57
}
46
58
@@ -69,9 +81,6 @@ export class UserSurvey {
69
81
70
82
await globalState . update ( IS_CANDIDATE_KEY , isCandidate ) ;
71
83
72
- const extensionVersion =
73
- vscode . extensions . getExtension ( constants . extensionId ) . packageJSON
74
- . version || "unknown" ;
75
84
if ( ! isCandidate ) {
76
85
await globalState . update ( SKIP_VERSION_KEY , extensionVersion ) ;
77
86
return ;
@@ -118,8 +127,7 @@ export class UserSurvey {
118
127
title : locConstants . UserSurvey . dontShowAgain ,
119
128
isSecondary : true ,
120
129
run : async ( ) => {
121
- await globalState . update ( IS_CANDIDATE_KEY , false ) ;
122
- await globalState . update ( SKIP_VERSION_KEY , extensionVersion ) ;
130
+ await globalState . update ( NEVER_KEY , true ) ;
123
131
} ,
124
132
} ;
125
133
0 commit comments