@@ -86,7 +86,7 @@ interface AppContextValue
86
86
// settings
87
87
updateGeoPermission : (
88
88
geoPermission : AppState [ "geoPermission" ] ,
89
- deniedCallback ?: ( ) => void ,
89
+ deniedCallback ?: ( ) => void
90
90
) => void ;
91
91
toggleRouteFilter : ( ) => void ;
92
92
toggleBusSortOrder : ( ) => void ;
@@ -170,13 +170,13 @@ export const AppContextProvider = ({
170
170
const searchRoute = "" ;
171
171
const geoPermission : unknown = localStorage . getItem ( "geoPermission" ) ;
172
172
const geoLocation : unknown = JSON . parse (
173
- localStorage . getItem ( "geolocation" ) ,
173
+ localStorage . getItem ( "geolocation" )
174
174
) ;
175
175
const busSortOrder : unknown = localStorage . getItem ( "busSortOrder" ) ;
176
176
const numPadOrder : unknown = localStorage . getItem ( "numPadOrder" ) ;
177
177
const etaFormat : unknown = localStorage . getItem ( "etaFormat" ) ;
178
178
const routeSearchHistory : unknown = JSON . parse (
179
- localStorage . getItem ( "routeSearchHistory" ) ,
179
+ localStorage . getItem ( "routeSearchHistory" )
180
180
) ;
181
181
const hotRoute : unknown = JSON . parse ( localStorage . getItem ( "hotRoute" ) ) ;
182
182
@@ -228,7 +228,7 @@ export const AppContextProvider = ({
228
228
state . searchRoute = searchRoute ;
229
229
} ) ;
230
230
} ,
231
- [ setState ] ,
231
+ [ setState ]
232
232
) ;
233
233
234
234
useEffect ( ( ) => {
@@ -237,7 +237,7 @@ export const AppContextProvider = ({
237
237
const _geoWatcherId = navigator . geolocation . watchPosition (
238
238
( { coords : { latitude, longitude } } ) => {
239
239
updateGeolocation ( { lat : latitude , lng : longitude } ) ;
240
- } ,
240
+ }
241
241
) ;
242
242
geoWatcherId . current = _geoWatcherId ;
243
243
} catch ( e ) {
@@ -248,7 +248,7 @@ export const AppContextProvider = ({
248
248
setStateRaw (
249
249
produce ( ( state : State ) => {
250
250
state . isVisible = ! document . hidden ;
251
- } ) ,
251
+ } )
252
252
) ;
253
253
} ;
254
254
window . addEventListener ( "visibilitychange" , onVisibilityChange ) ;
@@ -266,7 +266,7 @@ export const AppContextProvider = ({
266
266
produce ( ( state : State ) => {
267
267
state . geolocation = geolocation ;
268
268
localStorage . setItem ( "geolocation" , JSON . stringify ( geolocation ) ) ;
269
- } ) ,
269
+ } )
270
270
) ;
271
271
} , [ ] ) ;
272
272
@@ -276,7 +276,7 @@ export const AppContextProvider = ({
276
276
state . geoPermission = geoPermission ;
277
277
} ) ;
278
278
} ,
279
- [ setState ] ,
279
+ [ setState ]
280
280
) ;
281
281
const geoWatcherId = useRef ( null ) ;
282
282
@@ -294,7 +294,7 @@ export const AppContextProvider = ({
294
294
setGeoPermission ( "denied" ) ;
295
295
localStorage . setItem ( "geoPermission" , "denied" ) ;
296
296
if ( deniedCallback ) deniedCallback ( ) ;
297
- } ,
297
+ }
298
298
) ;
299
299
geoWatcherId . current = _geoWatcherId ;
300
300
} else if ( geoWatcherId . current ) {
@@ -304,7 +304,7 @@ export const AppContextProvider = ({
304
304
localStorage . setItem ( "geoPermission" , geoPermission ) ;
305
305
}
306
306
} ,
307
- [ setGeoPermission , updateGeolocation ] ,
307
+ [ setGeoPermission , updateGeolocation ]
308
308
) ;
309
309
310
310
const toggleRouteFilter = useCallback ( ( ) => {
@@ -314,7 +314,7 @@ export const AppContextProvider = ({
314
314
const isRouteFilter = prev ? false : true ;
315
315
localStorage . setItem ( "isRouteFilter" , JSON . stringify ( isRouteFilter ) ) ;
316
316
state . isRouteFilter = isRouteFilter ;
317
- } ) ,
317
+ } )
318
318
) ;
319
319
} , [ ] ) ;
320
320
@@ -326,7 +326,7 @@ export const AppContextProvider = ({
326
326
prevOrder === "KMB first" ? "CTB-NWFB first" : "KMB first" ;
327
327
localStorage . setItem ( "busSortOrder" , busSortOrder ) ;
328
328
state . busSortOrder = busSortOrder ;
329
- } ) ,
329
+ } )
330
330
) ;
331
331
} , [ ] ) ;
332
332
@@ -338,7 +338,7 @@ export const AppContextProvider = ({
338
338
prevOrder === "123456789c0b" ? "789456123c0b" : "123456789c0b" ;
339
339
localStorage . setItem ( "numPadOrder" , numPadOrder ) ;
340
340
state . numPadOrder = numPadOrder ;
341
- } ) ,
341
+ } )
342
342
) ;
343
343
} , [ ] ) ;
344
344
@@ -349,7 +349,7 @@ export const AppContextProvider = ({
349
349
const etaFormat = ETA_FORMAT_NEXT_TYPES [ prev ] ;
350
350
localStorage . setItem ( "etaFormat" , etaFormat ) ;
351
351
state . etaFormat = etaFormat ;
352
- } ) ,
352
+ } )
353
353
) ;
354
354
} , [ ] ) ;
355
355
@@ -360,7 +360,7 @@ export const AppContextProvider = ({
360
360
const colorMode = prevColorMode === "dark" ? "light" : "dark" ;
361
361
localStorage . setItem ( "colorMode" , colorMode ) ;
362
362
state . colorMode = colorMode ;
363
- } ) ,
363
+ } )
364
364
) ;
365
365
} , [ ] ) ;
366
366
@@ -371,7 +371,7 @@ export const AppContextProvider = ({
371
371
const energyMode = ! prevEnergyMode ;
372
372
localStorage . setItem ( "energyMode" , JSON . stringify ( energyMode ) ) ;
373
373
state . energyMode = energyMode ;
374
- } ) ,
374
+ } )
375
375
) ;
376
376
} , [ ] ) ;
377
377
@@ -382,7 +382,7 @@ export const AppContextProvider = ({
382
382
const analytics = ! prev ;
383
383
localStorage . setItem ( "analytics" , JSON . stringify ( analytics ) ) ;
384
384
state . analytics = analytics ;
385
- } ) ,
385
+ } )
386
386
) ;
387
387
} , [ ] ) ;
388
388
@@ -391,10 +391,10 @@ export const AppContextProvider = ({
391
391
produce ( ( state : State ) => {
392
392
localStorage . setItem (
393
393
"refreshInterval" ,
394
- JSON . stringify ( refreshInterval ) ,
394
+ JSON . stringify ( refreshInterval )
395
395
) ;
396
396
state . refreshInterval = refreshInterval ;
397
- } ) ,
397
+ } )
398
398
) ;
399
399
} , [ ] ) ;
400
400
@@ -405,10 +405,10 @@ export const AppContextProvider = ({
405
405
const vibrateDuration = prevVibrateDuration ? 0 : 1 ;
406
406
localStorage . setItem (
407
407
"vibrateDuration" ,
408
- JSON . stringify ( vibrateDuration ) ,
408
+ JSON . stringify ( vibrateDuration )
409
409
) ;
410
410
state . vibrateDuration = vibrateDuration ;
411
- } ) ,
411
+ } )
412
412
) ;
413
413
} , [ ] ) ;
414
414
@@ -431,11 +431,11 @@ export const AppContextProvider = ({
431
431
ret = prevSearchRoute + buttonValue ;
432
432
}
433
433
state . searchRoute = ret ;
434
- } ) ,
434
+ } )
435
435
) ;
436
436
} , 0 ) ;
437
437
} ,
438
- [ state . vibrateDuration ] ,
438
+ [ state . vibrateDuration ]
439
439
) ;
440
440
441
441
const updateSelectedRoute = useCallback ( ( route : string , seq : string = "" ) => {
@@ -451,10 +451,10 @@ export const AppContextProvider = ({
451
451
}
452
452
localStorage . setItem (
453
453
"hotRoute" ,
454
- JSON . stringify ( current ( state . hotRoute ) ) ,
454
+ JSON . stringify ( current ( state . hotRoute ) )
455
455
) ;
456
456
}
457
- } ) ,
457
+ } )
458
458
) ;
459
459
} , [ ] ) ;
460
460
@@ -466,25 +466,25 @@ export const AppContextProvider = ({
466
466
. slice ( 0 , 20 ) ;
467
467
localStorage . setItem (
468
468
"routeSearchHistory" ,
469
- JSON . stringify ( newSearchHistory ) ,
469
+ JSON . stringify ( newSearchHistory )
470
470
) ;
471
471
state . routeSearchHistory = newSearchHistory ;
472
- } ) ,
472
+ } )
473
473
) ;
474
474
} , [ ] ) ;
475
475
476
476
const removeSearchHistoryByRouteId = useCallback ( ( routeId ) => {
477
477
setStateRaw (
478
478
produce ( ( state : State ) => {
479
479
const newSearchHistory = state . routeSearchHistory . filter (
480
- ( item ) => item !== routeId ,
480
+ ( item ) => item !== routeId
481
481
) ;
482
482
localStorage . setItem (
483
483
"routeSearchHistory" ,
484
- JSON . stringify ( newSearchHistory ) ,
484
+ JSON . stringify ( newSearchHistory )
485
485
) ;
486
486
state . routeSearchHistory = newSearchHistory ;
487
- } ) ,
487
+ } )
488
488
) ;
489
489
} , [ ] ) ;
490
490
@@ -494,7 +494,7 @@ export const AppContextProvider = ({
494
494
produce ( ( state : State ) => {
495
495
state . hotRoute = { } ;
496
496
state . geolocation = defaultGeolocation ;
497
- } ) ,
497
+ } )
498
498
) ;
499
499
} , [ ] ) ;
500
500
@@ -503,7 +503,7 @@ export const AppContextProvider = ({
503
503
i18n . changeLanguage ( lang ) ;
504
504
localStorage . setItem ( "lang" , lang ) ;
505
505
} ,
506
- [ i18n ] ,
506
+ [ i18n ]
507
507
) ;
508
508
509
509
const contextValue = useMemo ( ( ) => {
0 commit comments