Your phone, on your command. Gotcha is world's first fully on-device AI copilot for Android that turns natural language into real device actions — safely.
fix: invert swipe directions to align physical gestures with intuitive scrolling logic and update documentation
Rishabh Bajpai01adc9148b7a
diff --git a/app/src/main/java/com/gotcha/tools/AccessibilityTool.kt b/app/src/main/java/com/gotcha/tools/AccessibilityTool.ktindex ebb0c37..4313570 100644--- a/app/src/main/java/com/gotcha/tools/AccessibilityTool.kt+++ b/app/src/main/java/com/gotcha/tools/AccessibilityTool.kt@@ -68,10 +68,10 @@ class AccessibilityTool(private val context: Context) {val h = bottom - topval w = right - leftval (sx, sy, ex, ey) = when (direction?.lowercase()?.trim()) {- "up" -> listOf(cx, top + h * 0.8f, cx, top + h * 0.2f)- "down" -> listOf(cx, top + h * 0.2f, cx, top + h * 0.8f)- "left" -> listOf(left + w * 0.8f, (top + bottom) / 2f, left + w * 0.2f, (top + bottom) / 2f)- "right" -> listOf(left + w * 0.2f, (top + bottom) / 2f, left + w * 0.8f, (top + bottom) / 2f)+ "up" -> listOf(cx, top + h * 0.2f, cx, top + h * 0.8f) // Scroll Up (physical swipe down)+ "down" -> listOf(cx, top + h * 0.8f, cx, top + h * 0.2f) // Scroll Down (physical swipe up)+ "left" -> listOf(left + w * 0.2f, (top + bottom) / 2f, left + w * 0.8f, (top + bottom) / 2f) // Scroll Left (physical swipe right)+ "right" -> listOf(left + w * 0.8f, (top + bottom) / 2f, left + w * 0.2f, (top + bottom) / 2f) // Scroll Right (physical swipe left)else -> return ToolResult.error("Provide a direction (up/down/left/right) when using index.")}return if (service.swipe(sx, sy, ex, ey, 500)) ToolResult.ok("Swiped $direction on element $index.")@@ -96,10 +96,10 @@ class AccessibilityTool(private val context: Context) {val h = metrics.heightPixels.toFloat()val scrollPx = distance?.toFloat()?.takeIf { it > 0f } ?: (h * 0.6f)val (sx, sy, ex, ey) = when (direction?.lowercase()?.trim()) {- "up" -> listOf(w / 2, h * 0.8f, w / 2, h * 0.8f - scrollPx)- "down" -> listOf(w / 2, h * 0.2f, w / 2, h * 0.2f + scrollPx)- "left" -> listOf(w * 0.8f, h / 2, w * 0.8f - scrollPx, h / 2)- "right" -> listOf(w * 0.2f, h / 2, w * 0.2f + scrollPx, h / 2)+ "up" -> listOf(w / 2, h * 0.2f, w / 2, h * 0.2f + scrollPx) // Scroll Up (physical swipe down)+ "down" -> listOf(w / 2, h * 0.8f, w / 2, h * 0.8f - scrollPx) // Scroll Down (physical swipe up)+ "left" -> listOf(w * 0.2f, h / 2, w * 0.2f + scrollPx, h / 2) // Scroll Left (physical swipe right)+ "right" -> listOf(w * 0.8f, h / 2, w * 0.8f - scrollPx, h / 2) // Scroll Right (physical swipe left)else -> return ToolResult.error("Provide a direction (up/down/left/right) or explicit x1,y1,x2,y2 coordinates.")diff --git a/app/src/main/java/com/gotcha/tools/ToolDefinitions.kt b/app/src/main/java/com/gotcha/tools/ToolDefinitions.ktindex 913da1a..80bc307 100644--- a/app/src/main/java/com/gotcha/tools/ToolDefinitions.kt+++ b/app/src/main/java/com/gotcha/tools/ToolDefinitions.kt@@ -1269,9 +1269,8 @@ object ToolDefinitions {val swipe = tool("swipe",- "Swipe the screen via the accessibility service — a named direction (up/down/left/right), " +- "explicit start/end coordinates, or by UI element index. Use for scrolling and navigation. " +- "If using a direction, 'down' means scroll the content down to see lower items (which performs an upward swipe). " ++ "Swipe/scroll the screen or a specific element. " ++ "If using a direction, 'down' means scroll the content down to see lower items. 'up' means scroll the content up to see higher items. " +"Needs the accessibility service enabled.",schema {putJsonObject("properties") {