File tree Expand file tree Collapse file tree 3 files changed +24
-11
lines changed
Expand file tree Collapse file tree 3 files changed +24
-11
lines changed Original file line number Diff line number Diff line change 77 backgroundLocationTrackingAtom ,
88 locationAtom ,
99} from '~/store/atoms/location' ;
10+ import { isLEDThemeAtom } from '~/store/atoms/theme' ;
1011import DevOverlay from './DevOverlay' ;
1112
1213jest . mock ( 'jotai' , ( ) => {
@@ -91,7 +92,10 @@ describe('DevOverlay', () => {
9192 if ( atom === backgroundLocationTrackingAtom ) {
9293 return backgroundLocationTracking as never ;
9394 }
94- return undefined as never ;
95+ if ( atom === isLEDThemeAtom ) {
96+ return false as never ;
97+ }
98+ throw new Error ( `Unexpected atom mock: ${ String ( atom ) } ` ) ;
9599 } ) ;
96100 } ;
97101
Original file line number Diff line number Diff line change @@ -520,9 +520,7 @@ const DevOverlay: React.FC = () => {
520520 < Typography style = { styles . chartLabel } >
521521 ACCURACY HISTORY
522522 </ Typography >
523- < Typography style = { [ styles . chartValue , chartValueStyle ] } >
524- { accuracyChartBlocks . length === 0 ? '---' : null }
525- </ Typography >
523+ < Typography style = { [ styles . chartValue , chartValueStyle ] } />
526524 < Typography
527525 style = { [ styles . chartValue , chartValueStyle ] }
528526 testID = "dev-overlay-accuracy-history"
@@ -592,9 +590,7 @@ const DevOverlay: React.FC = () => {
592590 < Typography style = { styles . chartLabel } >
593591 ACCURACY HISTORY
594592 </ Typography >
595- < Typography style = { [ styles . chartValue , chartValueStyle ] } >
596- { accuracyChartBlocks . length === 0 ? '---' : null }
597- </ Typography >
593+ < Typography style = { [ styles . chartValue , chartValueStyle ] } />
598594 < Typography
599595 style = { [ styles . chartValue , chartValueStyle ] }
600596 testID = "dev-overlay-accuracy-history"
Original file line number Diff line number Diff line change @@ -239,15 +239,28 @@ const PermittedLayout: React.FC<Props> = ({ children }: Props) => {
239239 devOverlayEnabled ? 'hideDevOverlay' : 'showDevOverlay'
240240 ) ,
241241 handler : async ( ) => {
242+ const prevValue = devOverlayEnabled ;
242243 const nextValue = ! devOverlayEnabled ;
243244 setTuning ( ( prev ) => ( {
244245 ...prev ,
245246 devOverlayEnabled : nextValue ,
246247 } ) ) ;
247- await AsyncStorage . setItem (
248- ASYNC_STORAGE_KEYS . DEV_OVERLAY_ENABLED ,
249- String ( nextValue )
250- ) ;
248+ try {
249+ await AsyncStorage . setItem (
250+ ASYNC_STORAGE_KEYS . DEV_OVERLAY_ENABLED ,
251+ String ( nextValue )
252+ ) ;
253+ } catch ( error ) {
254+ console . error ( error ) ;
255+ setTuning ( ( prev ) => ( {
256+ ...prev ,
257+ devOverlayEnabled : prevValue ,
258+ } ) ) ;
259+ Alert . alert (
260+ translate ( 'errorTitle' ) ,
261+ translate ( 'failedToSavePreference' )
262+ ) ;
263+ }
251264 } ,
252265 } ) ;
253266 }
You can’t perform that action at this time.
0 commit comments