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