Fix error message when switching between device and simulator

Summary: Currently, you get an error when you don't have device utils installed. However, when you switch your flipper to a supported device, the error may not be cleared. This handles that case.

Reviewed By: jknoxville

Differential Revision: D15087620

fbshipit-source-id: 6060752b54161c7610656531d053ecbcdd9e978a
This commit is contained in:
Benny Wong
2019-04-26 03:37:28 -07:00
committed by Facebook Github Bot
parent 2359d22b46
commit 221bf1cc75

View File

@@ -341,14 +341,19 @@ export default (state: State = INITAL_STATE, action: Action): State => {
if (nextState.selectedDevice) {
const {selectedDevice} = nextState;
const deviceNotSupportedError = 'iOS Devices are not yet supported';
const error =
selectedDevice.os === 'iOS' &&
selectedDevice.deviceType === 'physical' &&
!iosUtil.isAvailable()
? 'iOS Devices are not yet supported'
? deviceNotSupportedError
: null;
nextState.error = error || nextState.error;
if (nextState.error === deviceNotSupportedError) {
nextState.error = error;
} else {
nextState.error = error || nextState.error;
}
}
return nextState;
};