MCPcopy
hub / github.com/zai-org/Open-AutoGLM / _handle_tap

Method _handle_tap

phone_agent/actions/handler.py:130–149  ·  view source on GitHub ↗

Handle tap action.

(self, action: dict, width: int, height: int)

Source from the content-addressed store, hash-verified

128 return ActionResult(False, False, f"App not found: {app_name}")
129
130 def _handle_tap(self, action: dict, width: int, height: int) -> ActionResult:
131 """Handle tap action."""
132 element = action.get("element")
133 if not element:
134 return ActionResult(False, False, "No element coordinates")
135
136 x, y = self._convert_relative_to_absolute(element, width, height)
137
138 # Check for sensitive operation
139 if "message" in action:
140 if not self.confirmation_callback(action["message"]):
141 return ActionResult(
142 success=False,
143 should_finish=True,
144 message="User cancelled sensitive operation",
145 )
146
147 device_factory = get_device_factory()
148 device_factory.tap(x, y, self.device_id)
149 return ActionResult(True, False)
150
151 def _handle_type(self, action: dict, width: int, height: int) -> ActionResult:
152 """Handle text input action."""

Callers

nothing calls this directly

Calls 4

get_device_factoryFunction · 0.90
tapMethod · 0.80
ActionResultClass · 0.70

Tested by

no test coverage detected