Unverified Commit 23d38901 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Pass method used to start flutter application (#27812)

parent b47da6c2
...@@ -109,7 +109,7 @@ The `stop()` command takes one parameter, `appId`. It returns a `bool` to indica ...@@ -109,7 +109,7 @@ The `stop()` command takes one parameter, `appId`. It returns a `bool` to indica
#### app.start #### app.start
This is sent when an app is starting. The `params` field will be a map with the fields `appId`, `directory`, and `deviceId`. This is sent when an app is starting. The `params` field will be a map with the fields `appId`, `directory`, `deviceId`, and `launchMode`.
#### app.debugPort #### app.debugPort
......
...@@ -221,6 +221,7 @@ class AttachCommand extends FlutterCommand { ...@@ -221,6 +221,7 @@ class AttachCommand extends FlutterCommand {
null, null,
true, true,
fs.currentDirectory, fs.currentDirectory,
LaunchMode.attach,
); );
} catch (error) { } catch (error) {
throwToolExit(error.toString()); throwToolExit(error.toString());
......
...@@ -400,6 +400,7 @@ class AppDomain extends Domain { ...@@ -400,6 +400,7 @@ class AppDomain extends Domain {
projectDirectory, projectDirectory,
enableHotReload, enableHotReload,
cwd, cwd,
LaunchMode.run,
); );
} }
...@@ -409,7 +410,8 @@ class AppDomain extends Domain { ...@@ -409,7 +410,8 @@ class AppDomain extends Domain {
Device device, Device device,
String projectDirectory, String projectDirectory,
bool enableHotReload, bool enableHotReload,
Directory cwd) async { Directory cwd,
LaunchMode launchMode) async {
final AppInstance app = AppInstance(_getNewAppId(), final AppInstance app = AppInstance(_getNewAppId(),
runner: runner, logToStdout: daemon.logToStdout); runner: runner, logToStdout: daemon.logToStdout);
_apps.add(app); _apps.add(app);
...@@ -417,6 +419,7 @@ class AppDomain extends Domain { ...@@ -417,6 +419,7 @@ class AppDomain extends Domain {
'deviceId': device.id, 'deviceId': device.id,
'directory': projectDirectory, 'directory': projectDirectory,
'supportsRestart': isRestartSupported(enableHotReload, device), 'supportsRestart': isRestartSupported(enableHotReload, device),
'launchMode': launchMode.toString(),
}); });
Completer<DebugConnectionInfo> connectionInfoCompleter; Completer<DebugConnectionInfo> connectionInfoCompleter;
...@@ -1021,3 +1024,19 @@ class LogMessage { ...@@ -1021,3 +1024,19 @@ class LogMessage {
final String message; final String message;
final StackTrace stackTrace; final StackTrace stackTrace;
} }
/// The method by which the flutter app was launched.
class LaunchMode {
const LaunchMode._(this._value);
/// The app was launched via `flutter run`.
static const LaunchMode run = LaunchMode._('run');
/// The app was launched via `flutter attach`.
static const LaunchMode attach = LaunchMode._('attach');
final String _value;
@override
String toString() => _value;
}
...@@ -42,7 +42,8 @@ Future<void> main() async { ...@@ -42,7 +42,8 @@ Future<void> main() async {
'method': 'app.start', 'method': 'app.start',
'params': <String, dynamic> { 'params': <String, dynamic> {
'deviceId': words[1], 'deviceId': words[1],
'projectDirectory': words[2] 'projectDirectory': words[2],
'launchMode': words[3],
} }
}); });
} else if (words.first == 'stop') { } else if (words.first == 'stop') {
......
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