handle static method

bool handle({
  1. required bool highlightVisible,
  2. required bool glowVisible,
  3. required bool onUserInteraction(
    1. bool agentUiVisible
    ),
  4. required VoidCallback clearHighlight,
  5. required VoidCallback dismissGlow,
})

RN handleHostTouch: interrupt the runtime, then clear the box and the glow — this also covers a box drawn with no mission running, and a glow still in its post-hold. Returns true when anything was stopped.

Implementation

static bool handle({
  required bool highlightVisible,
  required bool glowVisible,
  required bool Function(bool agentUiVisible) onUserInteraction,
  required VoidCallback clearHighlight,
  required VoidCallback dismissGlow,
}) {
  final agentUiVisible = highlightVisible || glowVisible;
  final interrupted = onUserInteraction(agentUiVisible);
  if (!interrupted && !agentUiVisible) return false;
  clearHighlight();
  dismissGlow();
  return true;
}