@@ -66,7 +66,7 @@ class IOSCoreDeviceLauncher {
6666 }
6767
6868 // Launch app to device
69- final IOSCoreDeviceLaunchResult ? launchResult = await _coreDeviceControl.launchAppInternal (
69+ final IOSCoreDeviceLaunchResult ? launchResult = await _coreDeviceControl.launchApp (
7070 deviceId: deviceId,
7171 bundleId: bundleId,
7272 launchArguments: launchArguments,
@@ -99,7 +99,7 @@ class IOSCoreDeviceLauncher {
9999 }
100100
101101 // Launch app on device, but start it stopped so it will wait until the debugger is attached before starting.
102- final IOSCoreDeviceLaunchResult ? launchResult = await _coreDeviceControl.launchAppInternal (
102+ final IOSCoreDeviceLaunchResult ? launchResult = await _coreDeviceControl.launchApp (
103103 deviceId: deviceId,
104104 bundleId: bundleId,
105105 launchArguments: launchArguments,
@@ -532,66 +532,11 @@ class IOSCoreDeviceControl {
532532 }
533533 }
534534
535- Future <bool > launchApp ({
536- required String deviceId,
537- required String bundleId,
538- List <String > launchArguments = const < String > [],
539- }) async {
540- if (! _xcode.isDevicectlInstalled) {
541- _logger.printError ('devicectl is not installed.' );
542- return false ;
543- }
544-
545- final Directory tempDirectory = _fileSystem.systemTempDirectory.createTempSync ('core_devices.' );
546- final File output = tempDirectory.childFile ('launch_results.json' );
547- output.createSync ();
548-
549- final command = < String > [
550- ..._xcode.xcrunCommand (),
551- 'devicectl' ,
552- 'device' ,
553- 'process' ,
554- 'launch' ,
555- '--device' ,
556- deviceId,
557- bundleId,
558- if (launchArguments.isNotEmpty) ...launchArguments,
559- '--json-output' ,
560- output.path,
561- ];
562-
563- try {
564- await _processUtils.run (command, throwOnError: true );
565- final String stringOutput = output.readAsStringSync ();
566-
567- try {
568- final Object ? decodeResult = (json.decode (stringOutput) as Map <String , Object ?>)['info' ];
569- if (decodeResult is Map <String , Object ?> && decodeResult['outcome' ] == 'success' ) {
570- return true ;
571- }
572- _logger.printError ('devicectl returned unexpected JSON response: $stringOutput ' );
573- return false ;
574- } on FormatException {
575- // We failed to parse the devicectl output, or it returned junk.
576- _logger.printError ('devicectl returned non-JSON response: $stringOutput ' );
577- return false ;
578- }
579- } on ProcessException catch (err) {
580- _logger.printError ('Error executing devicectl: $err ' );
581- return false ;
582- } finally {
583- tempDirectory.deleteSync (recursive: true );
584- }
585- }
586-
587535 /// Launches the app on the device.
588536 ///
589537 /// If [startStopped] is true, the app will be launched and paused, waiting
590538 /// for a debugger to attach.
591- // TODO(vashworth): Rename this method to launchApp and replace old version.
592- // See https://github.com/flutter/flutter/issues/173416.
593- @visibleForTesting
594- Future <IOSCoreDeviceLaunchResult ?> launchAppInternal ({
539+ Future <IOSCoreDeviceLaunchResult ?> launchApp ({
595540 required String deviceId,
596541 required String bundleId,
597542 List <String > launchArguments = const < String > [],
0 commit comments