Don't do iOS-specific setup when not supported
Summary: Now flipper will include iOS devices in the dropdown, but you'll also get a message saying they aren't yet supported. Also doesn't start up the PortForwardingMacApp instances in this case, because it's pointless. Reviewed By: priteshrnandgaonkar Differential Revision: D13319990 fbshipit-source-id: 75d72c6ed2478c7b999c5f43b764f097141b33de
This commit is contained in:
committed by
Facebook Github Bot
parent
3057c0a6e7
commit
606d689cae
@@ -4,6 +4,8 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* @format
|
||||
*/
|
||||
import {promisify} from 'util';
|
||||
const exec = promisify(require('child_process').exec);
|
||||
|
||||
const errorMessage = 'Physical iOS devices not yet supported';
|
||||
|
||||
@@ -18,7 +20,21 @@ function isAvailable(): boolean {
|
||||
}
|
||||
|
||||
function targets(): Promise<Array<DeviceTarget>> {
|
||||
return Promise.reject(errorMessage);
|
||||
return exec('instruments -s devices').then(({stdout}) =>
|
||||
stdout
|
||||
.toString()
|
||||
.split('\n')
|
||||
.map(line => line.trim())
|
||||
.map(line => /(.+) \([^(]+\) \[(.*)\]( \(Simulator\))?/.exec(line))
|
||||
.filter(Boolean)
|
||||
.filter(
|
||||
([match, name, udid, isSim]) =>
|
||||
!isSim && (name.includes('iPhone') || name.includes('iPad')),
|
||||
)
|
||||
.map(([match, name, udid]) => {
|
||||
return {udid: udid, type: 'physical', name: name};
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
function push(
|
||||
|
||||
Reference in New Issue
Block a user