Commit 6ab25977 authored by Chinmay Garde's avatar Chinmay Garde

Merge pull request #2080 from chinmaygarde/master

Update status messages when unsupported devices are detected by the tools
parents ad8385e8 f7d94fef
...@@ -30,10 +30,8 @@ class DevicesCommand extends FlutterCommand { ...@@ -30,10 +30,8 @@ class DevicesCommand extends FlutterCommand {
printStatus('${devices.length} connected ${pluralize('device', devices.length)}:'); printStatus('${devices.length} connected ${pluralize('device', devices.length)}:');
for (Device device in devices) { for (Device device in devices) {
printStatus('\t${_supportIndicator(device)}: ${device.name} (${device.id})'); String supportIndicator = device.isSupported() ? '' : '- unsupported';
if (!device.isSupported()) { printStatus('${device.name} (${device.id}) ${supportIndicator}');
printStatus("\t\t${device.supportMessage()}");
}
} }
} }
...@@ -41,6 +39,4 @@ class DevicesCommand extends FlutterCommand { ...@@ -41,6 +39,4 @@ class DevicesCommand extends FlutterCommand {
} }
} }
String _supportIndicator(Device device) => device.isSupported() ? "[✔] Supported" : "[✘] Unsupported";
String pluralize(String word, int count) => count == 1 ? word : word + 's'; String pluralize(String word, int count) => count == 1 ? word : word + 's';
...@@ -17,6 +17,7 @@ import '../globals.dart'; ...@@ -17,6 +17,7 @@ import '../globals.dart';
import '../runner/flutter_command.dart'; import '../runner/flutter_command.dart';
import '../toolchain.dart'; import '../toolchain.dart';
import 'apk.dart'; import 'apk.dart';
import 'devices.dart';
import 'install.dart'; import 'install.dart';
import 'stop.dart'; import 'stop.dart';
...@@ -173,6 +174,7 @@ Future<int> startApp( ...@@ -173,6 +174,7 @@ Future<int> startApp(
} }
bool startedSomething = false; bool startedSomething = false;
int unsupportedCount = 0;
for (Device device in devices.all) { for (Device device in devices.all) {
ApplicationPackage package = applicationPackages.getPackageForPlatform(device.platform); ApplicationPackage package = applicationPackages.getPackageForPlatform(device.platform);
...@@ -180,7 +182,8 @@ Future<int> startApp( ...@@ -180,7 +182,8 @@ Future<int> startApp(
continue; continue;
if (!device.isSupported()) { if (!device.isSupported()) {
printStatus("Skipping unsupported device: ${device.name}"); printStatus("Skipping unsupported device '${device.name}'. ${device.supportMessage()}");
unsupportedCount++;
continue; continue;
} }
...@@ -220,7 +223,14 @@ Future<int> startApp( ...@@ -220,7 +223,14 @@ Future<int> startApp(
} }
if (!startedSomething) { if (!startedSomething) {
printError('Unable to run application. Please ensure that a supported device/simulator is connected.'); int connected = devices.all.where((device) => device.isConnected()).length;
String message = 'Unable to run application';
if (connected == 0) {
message += ' - no connected devices.';
} else if (unsupportedCount != 0) {
message += ' - $unsupportedCount unsupported ${pluralize('device', unsupportedCount)} connected';
}
printError(message);
} }
return startedSomething ? 0 : 2; return startedSomething ? 0 : 2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment