File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
dotcom-rendering/src/components Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -375,16 +375,23 @@ const decideShowDefaultGate = (): ShowGateValues => {
375
375
} ;
376
376
377
377
const getGateDisplayCount = ( ) : number => {
378
- // TODO: retrieve the number of time the page has been displayed
379
- const count = storage . local . get ( 'gate_display_count' ) as number ;
378
+ const rawValue = storage . local . getRaw ( 'gate_display_count' ) ;
379
+ const count = parseInt ( rawValue ?? '0' , 10 ) ;
380
380
return count ;
381
381
} ;
382
382
383
383
const incrementGateDisplayCount = ( ) => {
384
384
const count = getGateDisplayCount ( ) ;
385
385
const now = new Date ( ) ;
386
386
const oneYearFromNow = new Date ( now . getTime ( ) + 365 * 86400 ) ;
387
- storage . local . set ( 'gate_display_count' , count + 1 , oneYearFromNow ) ;
387
+ const newCount = count + 1 ;
388
+ // Using `storage.local.set`, instead of `storage.local.setRaw`
389
+ // because `setRaw` doesn't allow for specifying the duration.
390
+ storage . local . set (
391
+ 'gate_display_count' ,
392
+ newCount . toString ( ) ,
393
+ oneYearFromNow ,
394
+ ) ;
388
395
} ;
389
396
390
397
const buildAuxiaGateDisplayData = async (
You can’t perform that action at this time.
0 commit comments