Show Mac Designed For iPad in 'flutter devices' (#141718)
Addresses https://github.com/flutter/flutter/issues/141290 by allow Mac Designed For IPad Devices to appear with 'flutter devices'. <img width="573" alt="Screenshot 2024-01-29 at 12 23 24â¯AM" src="https://github.com/flutter/flutter/assets/36148254/35709a93-56fc-44c9-98d5-cf45afce967d"> <img width="725" alt="Screenshot 2024-01-29 at 12 26 01â¯AM" src="https://github.com/flutter/flutter/assets/36148254/b6cbcfce-44db-42c6-ac01-0ab716d30373">
This commit is contained in:
@@ -213,9 +213,6 @@ known, it can be explicitly provided to attach via the command-line, e.g.
|
||||
|
||||
@override
|
||||
Future<void> validateCommand() async {
|
||||
// ARM macOS as an iOS target is hidden, except for attach.
|
||||
MacOSDesignedForIPadDevices.allowDiscovery = true;
|
||||
|
||||
await super.validateCommand();
|
||||
|
||||
final Device? targetDevice = await findTargetDevice();
|
||||
|
||||
@@ -25,6 +25,7 @@ import '../drive/drive_service.dart';
|
||||
import '../drive/web_driver_service.dart' show Browser;
|
||||
import '../globals.dart' as globals;
|
||||
import '../ios/devices.dart';
|
||||
import '../macos/macos_ipad_device.dart';
|
||||
import '../resident_runner.dart';
|
||||
import '../runner/flutter_command.dart' show FlutterCommandCategory, FlutterCommandResult, FlutterOptions;
|
||||
import '../web/web_device.dart';
|
||||
@@ -222,6 +223,9 @@ class DriveCommand extends RunCommandBase {
|
||||
if (device is! AndroidDevice) {
|
||||
throwToolExit('--${FlutterOptions.kDeviceUser} is only supported for Android');
|
||||
}
|
||||
if (device is MacOSDesignedForIPadDevice) {
|
||||
throwToolExit('Mac Designed for iPad is currently not supported for flutter drive.');
|
||||
}
|
||||
}
|
||||
return super.validateCommand();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import '../device.dart';
|
||||
import '../features.dart';
|
||||
import '../globals.dart' as globals;
|
||||
import '../ios/devices.dart';
|
||||
import '../macos/macos_ipad_device.dart';
|
||||
import '../project.dart';
|
||||
import '../reporting/reporting.dart';
|
||||
import '../resident_runner.dart';
|
||||
@@ -591,6 +592,15 @@ class RunCommand extends RunCommandBase {
|
||||
if (devices == null) {
|
||||
throwToolExit(null);
|
||||
}
|
||||
|
||||
if (devices!.length == 1 && devices!.first is MacOSDesignedForIPadDevice) {
|
||||
throwToolExit('Mac Designed for iPad is currently not supported for flutter run -d.');
|
||||
}
|
||||
|
||||
if (globals.deviceManager!.hasSpecifiedAllDevices) {
|
||||
devices?.removeWhere((Device device) => device is MacOSDesignedForIPadDevice);
|
||||
}
|
||||
|
||||
if (globals.deviceManager!.hasSpecifiedAllDevices && runningWithPrebuiltApplication) {
|
||||
throwToolExit('Using "-d all" with "--${FlutterOptions.kUseApplicationBinary}" is not supported');
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class MacOSDesignedForIPadDevice extends DesktopDevice {
|
||||
required OperatingSystemUtils operatingSystemUtils,
|
||||
}) : _operatingSystemUtils = operatingSystemUtils,
|
||||
super(
|
||||
'designed-for-ipad',
|
||||
'mac-designed-for-ipad',
|
||||
platformType: PlatformType.macos,
|
||||
ephemeral: false,
|
||||
processManager: processManager,
|
||||
@@ -120,10 +120,7 @@ class MacOSDesignedForIPadDevices extends PollingDeviceDiscovery {
|
||||
/// and discovery is allowed for this command.
|
||||
@override
|
||||
bool get canListAnything =>
|
||||
_iosWorkflow.canListDevices && _operatingSystemUtils.hostPlatform == HostPlatform.darwin_arm64 && allowDiscovery;
|
||||
|
||||
/// Set to show ARM macOS as an iOS device target.
|
||||
static bool allowDiscovery = false;
|
||||
_iosWorkflow.canListDevices && _operatingSystemUtils.hostPlatform == HostPlatform.darwin_arm64;
|
||||
|
||||
@override
|
||||
Future<List<Device>> pollingGetDevices({Duration? timeout}) async {
|
||||
@@ -144,5 +141,5 @@ class MacOSDesignedForIPadDevices extends PollingDeviceDiscovery {
|
||||
Future<List<String>> getDiagnostics() async => const <String>[];
|
||||
|
||||
@override
|
||||
List<String> get wellKnownIds => const <String>['designed-for-ipad'];
|
||||
List<String> get wellKnownIds => const <String>['mac-designed-for-ipad'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user