probeFailureResponse function

StructuredResponse probeFailureResponse({
  1. required String? lifecycle,
  2. required Object? lastError,
  3. required int timeoutMs,
})

The reply when the viewport never probed: a native layer over the app when it is not resumed, else the geometry reason.

Implementation

StructuredResponse probeFailureResponse({
  required String? lifecycle,
  required Object? lastError,
  required int timeoutMs,
}) {
  if (lifecycle != null && lifecycle != 'resumed') {
    return StructuredResponse.error(
      summary: 'attached to the VM, but the app is $lifecycle: a native layer '
          '(permission alert, sheet, or the lock screen) is over it, so no '
          'frame could be probed',
      errorKind: GlintErrorKind.appNotResumed,
      detail: 'lifecycle is $lifecycle after ${timeoutMs}ms'
          '${lastError != null ? "; last probe error: $lastError" : ""}',
      nextSteps: const [
        'device op:screenshot udid:<udid> shows what is on top',
        'attach mode:"device", tap x,y (screenshot pixels) to dismiss it, '
            'then attach again',
        'if it is the lock screen, hardware_button unlock first',
      ],
    );
  }
  return StructuredResponse.error(
    summary: 'attached to the VM but could not probe the iOS viewport',
    errorKind: GlintErrorKind.geometryResolveError,
    detail: 'no viewport probe succeeded within ${timeoutMs}ms'
        '${lastError != null ? " — last probe error: $lastError" : " — no frame rendered yet"}',
    nextSteps: const [
      'wait for the first screen to render, then call attach again',
      'if a native dialog (permission, sheet) is up, dismiss it: '
          'device op:screenshot to see it, then attach mode:"device" and tap it',
      'raise the ceiling for slow launches: config set attachProbeTimeoutMs <ms>',
    ],
  );
}