Commit 0364590b authored by Devon Carew's avatar Devon Carew

delay looking for android devices

parent ad155b23
......@@ -14,15 +14,17 @@ import 'device.dart';
class InstallCommand extends Command {
final name = 'install';
final description = 'Install your Flutter app on attached devices.';
AndroidDevice android = null;
InstallCommand([this.android]) {
InstallCommand([this.android]);
@override
Future<int> run() async {
if (android == null) {
android = new AndroidDevice();
}
}
@override
Future<int> run() async {
if (install()) {
return 0;
} else {
......
......@@ -34,14 +34,14 @@ class ListenCommand extends Command {
defaultsTo: '.',
abbr: 't',
help: 'Target app path or filename to start.');
}
@override
Future<int> run() async {
if (android == null) {
android = new AndroidDevice();
}
}
@override
Future<int> run() async {
if (argResults.rest.length > 0) {
watchCommand = _initWatchCommand(argResults.rest);
} else {
......
......@@ -21,13 +21,14 @@ class LogsCommand extends Command {
argParser.addFlag('clear',
negatable: false,
help: 'Clear log history before reading from logs (Android only).');
if (android == null) {
android = new AndroidDevice();
}
}
@override
Future<int> run() async {
if (android == null) {
android = new AndroidDevice();
}
Future<int> androidLogProcess = null;
if (android.isConnected()) {
androidLogProcess = android.logs(clear: argResults['clear']);
......
......@@ -33,13 +33,14 @@ class StartCommand extends Command {
defaultsTo: '.',
abbr: 't',
help: 'Target app path or filename to start.');
if (android == null) {
android = new AndroidDevice();
}
}
@override
Future<int> run() async {
if (android == null) {
android = new AndroidDevice();
}
bool startedSomewhere = false;
bool poke = argResults['poke'];
if (!poke) {
......
......@@ -18,14 +18,14 @@ class StopCommand extends Command {
final description = 'Stop your Flutter app on all attached devices.';
AndroidDevice android = null;
StopCommand([this.android]) {
StopCommand([this.android]);
@override
Future<int> run() async {
if (android == null) {
android = new AndroidDevice();
}
}
@override
Future<int> run() async {
if (stop()) {
return 0;
} else {
......
......@@ -27,13 +27,14 @@ class TraceCommand extends Command {
argParser.addFlag('stop', negatable: false, help: 'Stop tracing.');
argParser.addOption('duration',
defaultsTo: '10', abbr: 'd', help: 'Duration in seconds to trace.');
if (android == null) {
android = new AndroidDevice();
}
}
@override
Future<int> run() async {
if (android == null) {
android = new AndroidDevice();
}
if (!android.isConnected()) {
_logging.warning('No device connected, so no trace was completed.');
return 1;
......
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