@@ -247,16 +247,44 @@ export async function activate(context: ExtContext): Promise<void> {
247
247
248
248
await vscode . commands . executeCommand ( 'aws.codeWhisperer.refreshRootNode' )
249
249
const t = new Date ( )
250
+ const doNotShowAgain =
251
+ context . extensionContext . globalState . get < boolean > (
252
+ CodeWhispererConstants . accessTokenMigrationDoNotShowAgainKey
253
+ ) || false
254
+ const notificationLastShown =
255
+ context . extensionContext . globalState . get < Date > (
256
+ CodeWhispererConstants . accessTokenMigrationDoNotShowAgainLastShown
257
+ ) || t
258
+
259
+ //Add 7 days to notificationLastShown to determine whether warn message should show
260
+ notificationLastShown . setDate ( notificationLastShown . getDate ( ) + 7 )
261
+ if ( doNotShowAgain || notificationLastShown <= t ) {
262
+ return
263
+ }
250
264
if ( t <= CodeWhispererConstants . accessTokenCutOffDate ) {
251
265
vscode . window
252
266
. showWarningMessage (
253
267
CodeWhispererConstants . accessTokenMigrationWarningMessage ,
254
- CodeWhispererConstants . accessTokenMigrationWarningButtonMessage
268
+ CodeWhispererConstants . accessTokenMigrationWarningButtonMessage ,
269
+ CodeWhispererConstants . accessTokenMigrationDoNotShowAgain
255
270
)
256
271
. then ( async resp => {
257
272
if ( resp === CodeWhispererConstants . accessTokenMigrationWarningButtonMessage ) {
258
273
await vscode . commands . executeCommand ( 'aws.codeWhisperer.refresh' )
259
274
await showSsoSignIn . execute ( )
275
+ } else if ( resp === CodeWhispererConstants . accessTokenMigrationDoNotShowAgain ) {
276
+ await vscode . window . showInformationMessage (
277
+ CodeWhispererConstants . accessTokenMigrationDoNotShowAgainInfo ,
278
+ 'OK'
279
+ )
280
+ await context . extensionContext . globalState . update (
281
+ CodeWhispererConstants . accessTokenMigrationDoNotShowAgainKey ,
282
+ true
283
+ )
284
+ await context . extensionContext . globalState . update (
285
+ CodeWhispererConstants . accessTokenMigrationDoNotShowAgainLastShown ,
286
+ t
287
+ )
260
288
}
261
289
} )
262
290
} else {
@@ -271,6 +299,11 @@ export async function activate(context: ExtContext): Promise<void> {
271
299
if ( resp === CodeWhispererConstants . accessTokenMigrationErrorButtonMessage ) {
272
300
await vscode . commands . executeCommand ( 'aws.codeWhisperer.refresh' )
273
301
await showSsoSignIn . execute ( )
302
+ } else if ( resp === CodeWhispererConstants . accessTokenMigrationDoNotShowAgain ) {
303
+ await context . extensionContext . globalState . update (
304
+ CodeWhispererConstants . accessTokenMigrationDoNotShowAgainKey ,
305
+ true
306
+ )
274
307
}
275
308
} )
276
309
}
0 commit comments