Add analytics for hot reload events (#5300)

This commit is contained in:
John McCutchan 2016-08-09 09:36:23 -07:00 committed by GitHub
parent 8a58410b76
commit c13a03fac2
2 changed files with 8 additions and 2 deletions

View File

@ -87,11 +87,13 @@ class RunCommand extends RunCommandBase {
String get usagePath { String get usagePath {
Device device = deviceForCommand; Device device = deviceForCommand;
String command = argResults['hot'] ? 'hotrun' : name;
if (device == null) if (device == null)
return name; return command;
// Return 'run/ios'. // Return 'run/ios'.
return '$name/${getNameForTargetPlatform(device.platform)}'; return '$command/${getNameForTargetPlatform(device.platform)}';
} }
@override @override

View File

@ -342,6 +342,7 @@ class HotRunner extends ResidentRunner {
await _launchFromDevFS(_package, _mainPath); await _launchFromDevFS(_package, _mainPath);
restartStatus.stop(showElapsedTime: true); restartStatus.stop(showElapsedTime: true);
} }
flutterUsage.sendEvent('hot', 'restart');
} }
/// Returns [true] if the reload was successful. /// Returns [true] if the reload was successful.
@ -373,7 +374,10 @@ class HotRunner extends ResidentRunner {
reloadStatus.stop(showElapsedTime: true); reloadStatus.stop(showElapsedTime: true);
if (!_printReloadReport(reloadReport)) { if (!_printReloadReport(reloadReport)) {
// Reload failed. // Reload failed.
flutterUsage.sendEvent('hot', 'reload-reject');
return false; return false;
} else {
flutterUsage.sendEvent('hot', 'reload');
} }
} catch (errorMessage) { } catch (errorMessage) {
reloadStatus.stop(showElapsedTime: true); reloadStatus.stop(showElapsedTime: true);