@@ -9,7 +9,6 @@ import 'package:process/process.dart';
9
9
import 'package:vm_service/vm_service.dart' as vm_service;
10
10
11
11
import '../application_package.dart' ;
12
- import '../base/common.dart' ;
13
12
import '../base/file_system.dart' ;
14
13
import '../base/io.dart' ;
15
14
import '../base/logger.dart' ;
@@ -22,7 +21,6 @@ import '../device.dart';
22
21
import '../device_port_forwarder.dart' ;
23
22
import '../globals.dart' as globals;
24
23
import '../macos/xcdevice.dart' ;
25
- import '../mdns_discovery.dart' ;
26
24
import '../project.dart' ;
27
25
import '../protocol_discovery.dart' ;
28
26
import '../vmservice.dart' ;
@@ -191,6 +189,15 @@ class IOSDevice extends Device {
191
189
return majorVersionString != null ? int .tryParse (majorVersionString) ?? 0 : 0 ;
192
190
}
193
191
192
+ @override
193
+ bool get supportsHotReload => interfaceType == IOSDeviceConnectionInterface .usb;
194
+
195
+ @override
196
+ bool get supportsHotRestart => interfaceType == IOSDeviceConnectionInterface .usb;
197
+
198
+ @override
199
+ bool get supportsFlutterExit => interfaceType == IOSDeviceConnectionInterface .usb;
200
+
194
201
@override
195
202
final String name;
196
203
@@ -311,11 +318,7 @@ class IOSDevice extends Device {
311
318
@visibleForTesting Duration ? discoveryTimeout,
312
319
}) async {
313
320
String ? packageId;
314
- if (interfaceType == IOSDeviceConnectionInterface .network &&
315
- debuggingOptions.debuggingEnabled &&
316
- debuggingOptions.disablePortPublication) {
317
- throwToolExit ('Cannot start app on wirelessly tethered iOS device. Try running again with the --publish-port flag' );
318
- }
321
+
319
322
if (! prebuiltApplication) {
320
323
_logger.printTrace ('Building ${package .name } for $id ' );
321
324
@@ -350,10 +353,8 @@ class IOSDevice extends Device {
350
353
EnvironmentType .physical,
351
354
route,
352
355
platformArgs,
353
- ipv6: ipv6,
354
- interfaceType: interfaceType,
355
356
);
356
- Status startAppStatus = _logger.startProgress (
357
+ final Status installStatus = _logger.startProgress (
357
358
'Installing and launching...' ,
358
359
);
359
360
try {
@@ -378,10 +379,9 @@ class IOSDevice extends Device {
378
379
deviceLogReader.debuggerStream = iosDeployDebugger;
379
380
}
380
381
}
381
- // Don't port foward if debugging with a network device.
382
382
observatoryDiscovery = ProtocolDiscovery .observatory (
383
383
deviceLogReader,
384
- portForwarder: interfaceType == IOSDeviceConnectionInterface .network ? null : portForwarder,
384
+ portForwarder: portForwarder,
385
385
hostPort: debuggingOptions.hostVmServicePort,
386
386
devicePort: debuggingOptions.deviceVmServicePort,
387
387
ipv6: ipv6,
@@ -412,59 +412,12 @@ class IOSDevice extends Device {
412
412
return LaunchResult .succeeded ();
413
413
}
414
414
415
- _logger.printTrace ('Application launched on the device. Waiting for Dart VM Service url.' );
416
-
417
- final int defaultTimeout = interfaceType == IOSDeviceConnectionInterface .network ? 45 : 30 ;
418
- final Timer timer = Timer (discoveryTimeout ?? Duration (seconds: defaultTimeout), () {
419
- _logger.printError ('The Dart VM Service was not discovered after $defaultTimeout seconds. This is taking much longer than expected...' );
420
-
421
- // If debugging with a wireless device and the timeout is reached, remind the
422
- // user to allow local network permissions.
423
- if (interfaceType == IOSDeviceConnectionInterface .network) {
424
- _logger.printError (
425
- '\n Click "Allow" to the prompt asking if you would like to find and connect devices on your local network. '
426
- 'This is required for wireless debugging. If you selected "Don\' t Allow", '
427
- 'you can turn it on in Settings > Your App Name > Local Network. '
428
- "If you don't see your app in the Settings, uninstall the app and rerun to see the prompt again."
429
- );
430
- } else {
431
- iosDeployDebugger? .pauseDumpBacktraceResume ();
432
- }
415
+ _logger.printTrace ('Application launched on the device. Waiting for observatory url.' );
416
+ final Timer timer = Timer (discoveryTimeout ?? const Duration (seconds: 30 ), () {
417
+ _logger.printError ('iOS Observatory not discovered after 30 seconds. This is taking much longer than expected...' );
418
+ iosDeployDebugger? .pauseDumpBacktraceResume ();
433
419
});
434
-
435
- Uri ? localUri;
436
- if (interfaceType == IOSDeviceConnectionInterface .network) {
437
- // Wait for Dart VM Service to start up.
438
- final Uri ? serviceURL = await observatoryDiscovery? .uri;
439
- if (serviceURL == null ) {
440
- await iosDeployDebugger? .stopAndDumpBacktrace ();
441
- return LaunchResult .failed ();
442
- }
443
-
444
- // If Dart VM Service URL with the device IP is not found within 5 seconds,
445
- // change the status message to prompt users to click Allow. Wait 5 seconds because it
446
- // should only show this message if they have not already approved the permissions.
447
- // MDnsVmServiceDiscovery usually takes less than 5 seconds to find it.
448
- final Timer mDNSLookupTimer = Timer (const Duration (seconds: 5 ), () {
449
- startAppStatus.stop ();
450
- startAppStatus = _logger.startProgress (
451
- 'Waiting for approval of local network permissions...' ,
452
- );
453
- });
454
-
455
- // Get Dart VM Service URL with the device IP as the host.
456
- localUri = await MDnsVmServiceDiscovery .instance! .getVMServiceUriForLaunch (
457
- packageId,
458
- this ,
459
- usesIpv6: ipv6,
460
- deviceVmservicePort: serviceURL.port,
461
- isNetworkDevice: true ,
462
- );
463
-
464
- mDNSLookupTimer.cancel ();
465
- } else {
466
- localUri = await observatoryDiscovery? .uri;
467
- }
420
+ final Uri ? localUri = await observatoryDiscovery? .uri;
468
421
timer.cancel ();
469
422
if (localUri == null ) {
470
423
await iosDeployDebugger? .stopAndDumpBacktrace ();
@@ -476,7 +429,7 @@ class IOSDevice extends Device {
476
429
_logger.printError (e.message);
477
430
return LaunchResult .failed ();
478
431
} finally {
479
- startAppStatus .stop ();
432
+ installStatus .stop ();
480
433
}
481
434
}
482
435
@@ -616,6 +569,7 @@ String decodeSyslog(String line) {
616
569
}
617
570
}
618
571
572
+ @visibleForTesting
619
573
class IOSDeviceLogReader extends DeviceLogReader {
620
574
IOSDeviceLogReader ._(
621
575
this ._iMobileDevice,
0 commit comments