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 => {
375375} ;
376376
377377const 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 ) ;
380380 return count ;
381381} ;
382382
383383const incrementGateDisplayCount = ( ) => {
384384 const count = getGateDisplayCount ( ) ;
385385 const now = new Date ( ) ;
386386 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+ ) ;
388395} ;
389396
390397const buildAuxiaGateDisplayData = async (
You can’t perform that action at this time.
0 commit comments