phoneTransport function

Future<String?> phoneTransport(
  1. String udid
)

How the iPhone reaches this Mac (wired or localNetwork), from devicectl; null when it does not answer.

Implementation

Future<String?> phoneTransport(String udid) async {
  final tmp = await Directory.systemTemp.createTemp('glint-phone-');
  try {
    final details = '${tmp.path}/details.json';
    await runBounded(
      'xcrun',
      ['devicectl', 'device', 'info', 'details', '--device', udid, '--json-output', details, '-q'],
      timeout: const Duration(seconds: 30),
      phase: 'devicectl device details',
    );
    final d = (jsonDecode(File(details).readAsStringSync()) as Map)['result'] as Map?;
    return (d?['connectionProperties'] as Map?)?['transportType'] as String?;
  } on Object {
    return null;
  } finally {
    await tmp.delete(recursive: true);
  }
}