iOS device availability

Summary: Apple seems to have changed the key for device availablility. We check for both now.

Reviewed By: jknoxville

Differential Revision: D10401073

fbshipit-source-id: 284a168a701eb2d5d9b3cbcac2aa6276ee1a2211
This commit is contained in:
Daniel Büchele
2018-10-16 06:34:22 -07:00
committed by Facebook Github Bot
parent 12a2c0ee70
commit fede0b854e

View File

@@ -15,7 +15,8 @@ import IOSDevice from '../devices/IOSDevice';
type iOSSimulatorDevice = {|
state: 'Booted' | 'Shutdown' | 'Shutting Down',
availability: string,
availability?: string,
isAvailable?: 'YES' | 'NO',
name: string,
udid: string,
|};
@@ -45,7 +46,10 @@ function querySimulatorDevices(store: Store): Promise<IOSDeviceMap> {
simulators.forEach((simulator: iOSSimulatorDevice) => {
const isRunning =
simulator.state === 'Booted' &&
simulator.availability === '(available)';
// For some users "availability" is set, for others it's "isAvailable"
// It's not clear which key is set, so we are checking both.
(simulator.availability === '(available)' ||
simulator.isAvailable === 'YES');
if (isRunning && !currentDeviceIDs.has(simulator.udid)) {
// create device