Rename IOSDeviceInterface to IOSDeviceConnectionInterface (#88144)

This commit is contained in:
Jenn Magder
2021-08-16 10:27:03 -07:00
committed by GitHub
parent 31d0787d20
commit 57efbd5310
12 changed files with 54 additions and 50 deletions

View File

@@ -138,12 +138,6 @@ class IOSDevices extends PollingDeviceDiscovery {
List<String> get wellKnownIds => const <String>[];
}
enum IOSDeviceInterface {
none,
usb,
network,
}
class IOSDevice extends Device {
IOSDevice(String id, {
@required FileSystem fileSystem,
@@ -191,13 +185,13 @@ class IOSDevice extends Device {
}
@override
bool get supportsHotReload => interfaceType == IOSDeviceInterface.usb;
bool get supportsHotReload => interfaceType == IOSDeviceConnectionInterface.usb;
@override
bool get supportsHotRestart => interfaceType == IOSDeviceInterface.usb;
bool get supportsHotRestart => interfaceType == IOSDeviceConnectionInterface.usb;
@override
bool get supportsFlutterExit => interfaceType == IOSDeviceInterface.usb;
bool get supportsFlutterExit => interfaceType == IOSDeviceConnectionInterface.usb;
@override
final String name;
@@ -207,7 +201,7 @@ class IOSDevice extends Device {
final DarwinArch cpuArchitecture;
final IOSDeviceInterface interfaceType;
final IOSDeviceConnectionInterface interfaceType;
Map<IOSApp, DeviceLogReader> _logReaders;

View File

@@ -19,7 +19,7 @@ import '../base/process.dart';
import '../cache.dart';
import '../convert.dart';
import 'code_signing.dart';
import 'devices.dart';
import 'iproxy.dart';
// Error message patterns from ios-deploy output
const String noProvisioningProfileErrorOne = 'Error 0xe8008015';
@@ -91,7 +91,7 @@ class IOSDeploy {
@required String bundlePath,
@required Directory appDeltaDirectory,
@required List<String>launchArguments,
@required IOSDeviceInterface interfaceType,
@required IOSDeviceConnectionInterface interfaceType,
}) async {
appDeltaDirectory?.createSync(recursive: true);
final List<String> launchCommand = <String>[
@@ -104,7 +104,7 @@ class IOSDeploy {
'--app_deltas',
appDeltaDirectory.path,
],
if (interfaceType != IOSDeviceInterface.network)
if (interfaceType != IOSDeviceConnectionInterface.network)
'--no-wifi',
if (launchArguments.isNotEmpty) ...<String>[
'--args',
@@ -129,7 +129,7 @@ class IOSDeploy {
@required String bundlePath,
@required Directory appDeltaDirectory,
@required List<String> launchArguments,
@required IOSDeviceInterface interfaceType,
@required IOSDeviceConnectionInterface interfaceType,
}) {
appDeltaDirectory?.createSync(recursive: true);
// Interactive debug session to support sending the lldb detach command.
@@ -148,7 +148,7 @@ class IOSDeploy {
appDeltaDirectory.path,
],
'--debug',
if (interfaceType != IOSDeviceInterface.network)
if (interfaceType != IOSDeviceConnectionInterface.network)
'--no-wifi',
if (launchArguments.isNotEmpty) ...<String>[
'--args',
@@ -171,7 +171,7 @@ class IOSDeploy {
@required String bundlePath,
@required Directory appDeltaDirectory,
@required List<String> launchArguments,
@required IOSDeviceInterface interfaceType,
@required IOSDeviceConnectionInterface interfaceType,
}) async {
appDeltaDirectory?.createSync(recursive: true);
final List<String> launchCommand = <String>[
@@ -184,7 +184,7 @@ class IOSDeploy {
'--app_deltas',
appDeltaDirectory.path,
],
if (interfaceType != IOSDeviceInterface.network)
if (interfaceType != IOSDeviceConnectionInterface.network)
'--no-wifi',
'--justlaunch',
if (launchArguments.isNotEmpty) ...<String>[

View File

@@ -8,6 +8,12 @@ import '../base/io.dart';
import '../base/logger.dart';
import '../base/process.dart';
enum IOSDeviceConnectionInterface {
none,
usb,
network,
}
/// Wraps iproxy command line tool port forwarding.
///
/// See https://github.com/libimobiledevice/libusbmuxd.
@@ -19,6 +25,7 @@ class IProxy {
required MapEntry<String, String> dyLdLibEntry,
}) : _dyLdLibEntry = dyLdLibEntry,
_processUtils = ProcessUtils(processManager: processManager, logger: logger),
_logger = logger,
_iproxyPath = iproxyPath;
/// Create a [IProxy] for testing.
@@ -41,6 +48,7 @@ class IProxy {
final String _iproxyPath;
final ProcessUtils _processUtils;
final Logger _logger;
final MapEntry<String, String> _dyLdLibEntry;
Future<Process> forward(int devicePort, int hostPort, String deviceId) {
@@ -51,6 +59,8 @@ class IProxy {
'$hostPort:$devicePort',
'--udid',
deviceId,
if (_logger.isVerbose)
'--debug',
],
environment: Map<String, String>.fromEntries(
<MapEntry<String, String>>[_dyLdLibEntry],

View File

@@ -25,7 +25,7 @@ import '../project.dart';
import '../reporting/reporting.dart';
import 'application_package.dart';
import 'code_signing.dart';
import 'devices.dart';
import 'iproxy.dart';
import 'migrations/deployment_target_migration.dart';
import 'migrations/project_base_configuration_migration.dart';
import 'migrations/project_build_location_migration.dart';
@@ -73,7 +73,7 @@ class IMobileDevice {
Future<void> takeScreenshot(
File outputFile,
String deviceID,
IOSDeviceInterface interfaceType,
IOSDeviceConnectionInterface interfaceType,
) {
return _processUtils.run(
<String>[
@@ -81,7 +81,7 @@ class IMobileDevice {
outputFile.path,
'--udid',
deviceID,
if (interfaceType == IOSDeviceInterface.network)
if (interfaceType == IOSDeviceConnectionInterface.network)
'--network',
],
throwOnError: true,

View File

@@ -293,11 +293,11 @@ class XCDevice {
}
}
final IOSDeviceInterface interface = _interfaceType(device);
final IOSDeviceConnectionInterface interface = _interfaceType(device);
// Only support USB devices, skip "network" interface (Xcode > Window > Devices and Simulators > Connect via network).
// TODO(jmagman): Remove this check once wirelessly detected devices can be observed and attached, https://github.com/flutter/flutter/issues/15072.
if (interface != IOSDeviceInterface.usb) {
if (interface != IOSDeviceConnectionInterface.usb) {
continue;
}
@@ -353,18 +353,18 @@ class XCDevice {
return null;
}
static IOSDeviceInterface _interfaceType(Map<String, dynamic> deviceProperties) {
static IOSDeviceConnectionInterface _interfaceType(Map<String, dynamic> deviceProperties) {
// Interface can be "usb", "network", or "none" for simulators
// and unknown future interfaces.
if (deviceProperties.containsKey('interface')) {
if ((deviceProperties['interface'] as String).toLowerCase() == 'network') {
return IOSDeviceInterface.network;
return IOSDeviceConnectionInterface.network;
} else {
return IOSDeviceInterface.usb;
return IOSDeviceConnectionInterface.usb;
}
}
return IOSDeviceInterface.none;
return IOSDeviceConnectionInterface.none;
}
static String _sdkVersion(Map<String, dynamic> deviceProperties) {