InAppCockpitCommandExecutor constructor
InAppCockpitCommandExecutor({
- required CockpitTargetRegistry registry,
- CockpitCaptureHandler? captureHandler,
- CockpitSnapshotProvider? snapshotProvider,
- CockpitPostActionSettler? postActionSettler,
- CockpitScrollStepHandler? scrollStepHandler,
- CockpitEnsureVisibleHandler? ensureVisibleHandler,
- CockpitGestureHandler? gestureHandler,
- CockpitNetworkActivityClearer? clearNetworkActivityHandler,
- CockpitNetworkIdleWaiter? waitForNetworkIdleHandler,
- CockpitWaitTickHandler? waitTickHandler,
- CockpitKeyEventHandler? keyEventHandler,
- CockpitInteractionPolicy interactionPolicy = const CockpitInteractionPolicy(),
- CockpitRecordingActivityProbe? isRecordingActive,
- String platform = 'flutter',
- String transportType = 'inApp',
Implementation
InAppCockpitCommandExecutor({
required CockpitTargetRegistry registry,
CockpitCaptureHandler? captureHandler,
CockpitSnapshotProvider? snapshotProvider,
CockpitPostActionSettler? postActionSettler,
CockpitScrollStepHandler? scrollStepHandler,
CockpitEnsureVisibleHandler? ensureVisibleHandler,
CockpitGestureHandler? gestureHandler,
CockpitNetworkActivityClearer? clearNetworkActivityHandler,
CockpitNetworkIdleWaiter? waitForNetworkIdleHandler,
CockpitBackNavigationHandler? backNavigationHandler,
CockpitWaitTickHandler? waitTickHandler,
CockpitKeyEventHandler? keyEventHandler,
CockpitInteractionPolicy interactionPolicy =
const CockpitInteractionPolicy(),
CockpitRecordingActivityProbe? isRecordingActive,
String platform = 'flutter',
String transportType = 'inApp',
}) : _context = CockpitInAppCommandContext(
registry: registry,
captureHandler: captureHandler,
snapshotProvider:
snapshotProvider ?? _defaultSnapshotProvider(registry),
postActionSettler: postActionSettler ?? _defaultPostActionSettler,
scrollStepHandler: scrollStepHandler,
ensureVisibleHandler: ensureVisibleHandler,
gestureHandler: gestureHandler,
clearNetworkActivityHandler: clearNetworkActivityHandler,
waitForNetworkIdleHandler: waitForNetworkIdleHandler,
backNavigationHandler: backNavigationHandler,
hasCustomWaitTickHandler: waitTickHandler != null,
waitTickHandler: waitTickHandler ?? _defaultWaitTickHandler,
keyEventHandler: keyEventHandler ?? _defaultKeyEventHandler,
interactionPolicy: interactionPolicy,
isRecordingActive: isRecordingActive ?? _defaultRecordingActivityProbe,
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,
);
_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,
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());
}