Update: 2026-06-29 23:45:06

This commit is contained in:
Hamza-Ayed
2026-06-29 23:45:06 +03:00
parent 3506b07bc7
commit 299132b505
13 changed files with 278 additions and 53 deletions

View File

@@ -15,7 +15,15 @@ object AppLauncher {
"zaken" to "com.zakinn.app",
"com.zakinn.app" to "com.zakinn.app",
"tufaddal" to "com.bis.taxi",
"com.bis.taxi" to "com.bis.taxi"
"com.bis.taxi" to "com.bis.taxi",
"careem" to "com.careem.acma",
"com.careem.acma" to "com.careem.acma",
"uber" to "com.ubercab",
"com.ubercab" to "com.ubercab",
"taxif" to "com.taxif.passenger",
"com.taxif.passenger" to "com.taxif.passenger",
"jeeny" to "me.com.easytaxi",
"me.com.easytaxi" to "me.com.easytaxi"
)
fun launchApp(context: Context, appName: String): Boolean {

View File

@@ -98,6 +98,10 @@ class ScraperAccessibilityService : AccessibilityService() {
"ae.com.yalla.go.dubai.client" -> handleYallaGoAutomation(rootNode)
"com.zakinn.app" -> handleZakinnAutomation(rootNode)
"com.bis.taxi" -> handleTfadalAutomation(rootNode)
"com.careem.acma" -> handleCareemAutomation(rootNode)
"com.ubercab" -> handleUberAutomation(rootNode)
"com.taxif.passenger" -> handleTaxiFAutomation(rootNode)
"me.com.easytaxi" -> handleJeenyAutomation(rootNode)
}
}
@@ -322,7 +326,7 @@ class ScraperAccessibilityService : AccessibilityService() {
private fun searchPriceByCurrency(node: android.view.accessibility.AccessibilityNodeInfo?) {
if (node == null) return
val text = node.text?.toString() ?: ""
if (text.contains("ل.س") || text.contains("SYP") || text.contains("AED") || text.contains("SP") || text.contains("SP.")) {
if (text.contains("ل.س") || text.contains("SYP") || text.contains("AED") || text.contains("SP") || text.contains("SP.") || text.contains("JOD") || text.contains("د.أ") || text.contains("JD")) {
Log.i(TAG, "Found price pattern dynamically: $text")
submitPriceToServer(text)
return
@@ -385,6 +389,146 @@ class ScraperAccessibilityService : AccessibilityService() {
return r * c
}
private fun handleCareemAutomation(rootNode: android.view.accessibility.AccessibilityNodeInfo) {
val task = currentTask ?: return
Log.d(TAG, "Careem Automation event. State: $currentState")
when (currentState) {
BotState.SEARCHING_START -> {
val pickupEdit = findEditableNode(rootNode)
if (pickupEdit != null) {
val startLoc = task.optString("start_location", "Amman")
val arguments = android.os.Bundle().apply {
putCharSequence(android.view.accessibility.AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, startLoc)
}
pickupEdit.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_SET_TEXT, arguments)
Log.i(TAG, "Careem: Entered start: $startLoc")
currentState = BotState.SEARCHING_END
}
}
BotState.SEARCHING_END -> {
val destEdit = findEditableNode(rootNode)
if (destEdit != null) {
val endLoc = task.optString("end_location", "Airport")
val arguments = android.os.Bundle().apply {
putCharSequence(android.view.accessibility.AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, endLoc)
}
destEdit.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_SET_TEXT, arguments)
Log.i(TAG, "Careem: Entered end: $endLoc")
currentState = BotState.READING_PRICE
}
}
BotState.READING_PRICE -> {
searchPriceByCurrency(rootNode)
}
else -> {}
}
}
private fun handleUberAutomation(rootNode: android.view.accessibility.AccessibilityNodeInfo) {
val task = currentTask ?: return
Log.d(TAG, "Uber Automation event. State: $currentState")
when (currentState) {
BotState.SEARCHING_START -> {
val pickupEdit = findEditableNode(rootNode)
if (pickupEdit != null) {
val startLoc = task.optString("start_location", "Amman")
val arguments = android.os.Bundle().apply {
putCharSequence(android.view.accessibility.AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, startLoc)
}
pickupEdit.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_SET_TEXT, arguments)
Log.i(TAG, "Uber: Entered start: $startLoc")
currentState = BotState.SEARCHING_END
}
}
BotState.SEARCHING_END -> {
val destEdit = findEditableNode(rootNode)
if (destEdit != null) {
val endLoc = task.optString("end_location", "Airport")
val arguments = android.os.Bundle().apply {
putCharSequence(android.view.accessibility.AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, endLoc)
}
destEdit.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_SET_TEXT, arguments)
Log.i(TAG, "Uber: Entered end: $endLoc")
currentState = BotState.READING_PRICE
}
}
BotState.READING_PRICE -> {
searchPriceByCurrency(rootNode)
}
else -> {}
}
}
private fun handleTaxiFAutomation(rootNode: android.view.accessibility.AccessibilityNodeInfo) {
val task = currentTask ?: return
Log.d(TAG, "TaxiF Automation event. State: $currentState")
when (currentState) {
BotState.SEARCHING_START -> {
val pickupEdit = findEditableNode(rootNode)
if (pickupEdit != null) {
val startLoc = task.optString("start_location", "Amman")
val arguments = android.os.Bundle().apply {
putCharSequence(android.view.accessibility.AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, startLoc)
}
pickupEdit.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_SET_TEXT, arguments)
Log.i(TAG, "TaxiF: Entered start: $startLoc")
currentState = BotState.SEARCHING_END
}
}
BotState.SEARCHING_END -> {
val destEdit = findEditableNode(rootNode)
if (destEdit != null) {
val endLoc = task.optString("end_location", "Airport")
val arguments = android.os.Bundle().apply {
putCharSequence(android.view.accessibility.AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, endLoc)
}
destEdit.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_SET_TEXT, arguments)
Log.i(TAG, "TaxiF: Entered end: $endLoc")
currentState = BotState.READING_PRICE
}
}
BotState.READING_PRICE -> {
searchPriceByCurrency(rootNode)
}
else -> {}
}
}
private fun handleJeenyAutomation(rootNode: android.view.accessibility.AccessibilityNodeInfo) {
val task = currentTask ?: return
Log.d(TAG, "Jeeny Automation event. State: $currentState")
when (currentState) {
BotState.SEARCHING_START -> {
val pickupEdit = findEditableNode(rootNode)
if (pickupEdit != null) {
val startLoc = task.optString("start_location", "Amman")
val arguments = android.os.Bundle().apply {
putCharSequence(android.view.accessibility.AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, startLoc)
}
pickupEdit.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_SET_TEXT, arguments)
Log.i(TAG, "Jeeny: Entered start: $startLoc")
currentState = BotState.SEARCHING_END
}
}
BotState.SEARCHING_END -> {
val destEdit = findEditableNode(rootNode)
if (destEdit != null) {
val endLoc = task.optString("end_location", "Airport")
val arguments = android.os.Bundle().apply {
putCharSequence(android.view.accessibility.AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, endLoc)
}
destEdit.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_SET_TEXT, arguments)
Log.i(TAG, "Jeeny: Entered end: $endLoc")
currentState = BotState.READING_PRICE
}
}
BotState.READING_PRICE -> {
searchPriceByCurrency(rootNode)
}
else -> {}
}
}
override fun onInterrupt() {
Log.w(TAG, "Accessibility Service Interrupted")
}