InAppCockpitCommandExecutor constructor

InAppCockpitCommandExecutor({
  1. required CockpitTargetRegistry registry,
  2. CockpitCaptureHandler? captureHandler,
  3. CockpitSnapshotProvider? snapshotProvider,
  4. CockpitLocatorProbe? locatorProbe,
  5. CockpitPostActionSettler? postActionSettler,
  6. CockpitScrollStepHandler? scrollStepHandler,
  7. bool scrollStepProbesTarget = false,
  8. CockpitEnsureVisibleHandler? ensureVisibleHandler,
  9. CockpitGestureHandler? gestureHandler,
  10. CockpitNetworkActivityClearer? clearNetworkActivityHandler,
  11. CockpitNetworkIdleWaiter? waitForNetworkIdleHandler,
  12. CockpitBackNavigationHandler? backNavigationHandler,
  13. CockpitWaitTickHandler? waitTickHandler,
  14. CockpitKeyEventHandler? keyEventHandler,
  15. CockpitScreenshotInspector? screenshotInspector,
  16. CockpitInteractionPolicy interactionPolicy = const CockpitInteractionPolicy(),
  17. CockpitRecordingActivityProbe? isRecordingActive,
  18. CockpitRouteNameSynchronizer? routeNameSynchronizer,
  19. String platform = 'flutter',
  20. String transportType = 'inApp',
})

Implementation

InAppCockpitCommandExecutor({
  required CockpitTargetRegistry registry,
  CockpitCaptureHandler? captureHandler,
  CockpitSnapshotProvider? snapshotProvider,
  CockpitLocatorProbe? locatorProbe,
  CockpitPostActionSettler? postActionSettler,
  CockpitScrollStepHandler? scrollStepHandler,
  bool scrollStepProbesTarget = false,
  CockpitEnsureVisibleHandler? ensureVisibleHandler,
  CockpitGestureHandler? gestureHandler,
  CockpitNetworkActivityClearer? clearNetworkActivityHandler,
  CockpitNetworkIdleWaiter? waitForNetworkIdleHandler,
  CockpitBackNavigationHandler? backNavigationHandler,
  CockpitWaitTickHandler? waitTickHandler,
  CockpitKeyEventHandler? keyEventHandler,
  CockpitScreenshotInspector? screenshotInspector,
  CockpitInteractionPolicy interactionPolicy =
      const CockpitInteractionPolicy(),
  CockpitRecordingActivityProbe? isRecordingActive,
  CockpitRouteNameSynchronizer? routeNameSynchronizer,
  String platform = 'flutter',
  String transportType = 'inApp',
}) : _context = CockpitInAppCommandContext(
       registry: registry,
       captureHandler: captureHandler,
       snapshotProvider:
           snapshotProvider ?? _defaultSnapshotProvider(registry),
       locatorProbe: locatorProbe,
       postActionSettler: postActionSettler ?? _defaultPostActionSettler,
       scrollStepHandler: scrollStepHandler,
       scrollStepProbesTarget: scrollStepProbesTarget,
       ensureVisibleHandler: ensureVisibleHandler,
       gestureHandler: gestureHandler,
       clearNetworkActivityHandler: clearNetworkActivityHandler,
       waitForNetworkIdleHandler: waitForNetworkIdleHandler,
       backNavigationHandler: backNavigationHandler,
       hasCustomWaitTickHandler: waitTickHandler != null,
       waitTickHandler: waitTickHandler ?? _defaultWaitTickHandler,
       keyEventHandler: keyEventHandler ?? _defaultKeyEventHandler,
       interactionPolicy: interactionPolicy,
       isRecordingActive: isRecordingActive ?? _defaultRecordingActivityProbe,
       routeNameSynchronizer: routeNameSynchronizer,
       platform: platform,
       transportType: transportType,
     ) {
  _settleCoordinator = CockpitPostActionSettleCoordinator(context: _context);
  _captureOrchestrator = CockpitCaptureOrchestrator(
    captureHandler: _context.captureHandler,
    postActionSettler: _context.postActionSettler,
    settleBeforeObservation: _settleCoordinator.settleBeforeObservation,
    bestEffortWaitForUiIdle: ({required includeNetworkIdleValue}) {
      return _settleCoordinator.bestEffortWaitForUiIdle(
        includeNetworkIdle: includeNetworkIdleValue,
      );
    },
    defaultSnapshotOptionsForReason: _defaultSnapshotOptionsForReason,
    screenshotInspector: screenshotInspector,
  );
  _semanticCommandExecutor = CockpitSemanticCommandExecutor(
    tap: _executeTap,
    longPress: _executeLongPress,
    doubleTap: _executeDoubleTap,
    showOnScreen: (command, stopwatch) {
      return _executeSemanticAction(
        command,
        stopwatch,
        requiredCommand: CockpitCommandType.showOnScreen,
        semanticAction: (target) => target.onSemanticShowOnScreen,
      );
    },
    increase: (command, stopwatch) {
      return _executeSemanticAction(
        command,
        stopwatch,
        requiredCommand: CockpitCommandType.increase,
        semanticAction: (target) => target.onSemanticIncrease,
      );
    },
    decrease: (command, stopwatch) {
      return _executeSemanticAction(
        command,
        stopwatch,
        requiredCommand: CockpitCommandType.decrease,
        semanticAction: (target) => target.onSemanticDecrease,
      );
    },
    dismiss: (command, stopwatch) {
      return _executeSemanticAction(
        command,
        stopwatch,
        requiredCommand: CockpitCommandType.dismiss,
        semanticAction: (target) => target.onSemanticDismiss,
      );
    },
  );
  _textInputCommandExecutor = CockpitTextInputCommandExecutor(
    enterText: _executeEnterText,
    eraseText: _executeEraseText,
    copyText: _executeCopyText,
    pasteText: _executePasteText,
    focusTextInput: _executeFocusTextInput,
    setTextEditingValue: _executeSetTextEditingValue,
    sendTextInputAction: _executeSendTextInputAction,
    sendKeyEvent: _executeKeyEvent,
    sendKeyDownEvent: _executeKeyEvent,
    sendKeyUpEvent: _executeKeyEvent,
  );
  _gestureCommandExecutor = CockpitGestureCommandExecutor(
    drag: _executeDrag,
    fling: _executeFling,
    swipe: _executeSwipe,
    pinchZoom: _executePinchZoom,
    rotate: _executeRotate,
    panZoom: _executePanZoom,
    multiTouch: _executeMultiTouch,
  );
  _waitAndAssertExecutor = CockpitWaitAndAssertExecutor(
    scrollUntilVisible: _executeScrollUntilVisible,
    waitForNetworkIdle: _executeWaitForNetworkIdle,
    waitForUiIdle: _executeWaitForUiIdle,
    assertVisible: _executeAssertVisible,
    assertText: _executeAssertText,
    waitFor: _executeWaitFor,
  );
  _commandRouter = CockpitCommandRouter(handlers: _buildCommandHandlers());
}