readableReason static method

String readableReason(
  1. String line
)

A short reason out of a SpringBoard exit line (code:force-quit(0x..)), a host line or a runningboardd line.

Implementation

static String readableReason(String line) {
  final code = _exitCode.firstMatch(line)?.group(1);
  if (code != null) return _exitCodeNames[code] ?? code;
  final host = _hostReason.firstMatch(line)?.group(1)?.trim();
  if (host != null) return host;
  if (RegExp(r'Removing assertions for terminated process', caseSensitive: false).hasMatch(line)) {
    return 'the process was terminated';
  }
  return line.length > 240 ? '${line.substring(0, 239)}…' : line;
}