diff --git a/android_bot/.gradle/8.13/checksums/checksums.lock b/android_bot/.gradle/8.13/checksums/checksums.lock
new file mode 100644
index 0000000..68baa12
Binary files /dev/null and b/android_bot/.gradle/8.13/checksums/checksums.lock differ
diff --git a/android_bot/.gradle/8.13/checksums/md5-checksums.bin b/android_bot/.gradle/8.13/checksums/md5-checksums.bin
new file mode 100644
index 0000000..4463403
Binary files /dev/null and b/android_bot/.gradle/8.13/checksums/md5-checksums.bin differ
diff --git a/android_bot/.gradle/8.13/checksums/sha1-checksums.bin b/android_bot/.gradle/8.13/checksums/sha1-checksums.bin
new file mode 100644
index 0000000..e86e84b
Binary files /dev/null and b/android_bot/.gradle/8.13/checksums/sha1-checksums.bin differ
diff --git a/android_bot/.gradle/8.13/executionHistory/executionHistory.bin b/android_bot/.gradle/8.13/executionHistory/executionHistory.bin
new file mode 100644
index 0000000..b0c9a42
Binary files /dev/null and b/android_bot/.gradle/8.13/executionHistory/executionHistory.bin differ
diff --git a/android_bot/.gradle/8.13/executionHistory/executionHistory.lock b/android_bot/.gradle/8.13/executionHistory/executionHistory.lock
new file mode 100644
index 0000000..12b5d0f
Binary files /dev/null and b/android_bot/.gradle/8.13/executionHistory/executionHistory.lock differ
diff --git a/android_bot/.gradle/8.13/fileChanges/last-build.bin b/android_bot/.gradle/8.13/fileChanges/last-build.bin
new file mode 100644
index 0000000..f76dd23
Binary files /dev/null and b/android_bot/.gradle/8.13/fileChanges/last-build.bin differ
diff --git a/android_bot/.gradle/8.13/fileHashes/fileHashes.bin b/android_bot/.gradle/8.13/fileHashes/fileHashes.bin
new file mode 100644
index 0000000..fa0a642
Binary files /dev/null and b/android_bot/.gradle/8.13/fileHashes/fileHashes.bin differ
diff --git a/android_bot/.gradle/8.13/fileHashes/fileHashes.lock b/android_bot/.gradle/8.13/fileHashes/fileHashes.lock
new file mode 100644
index 0000000..4aab5dd
Binary files /dev/null and b/android_bot/.gradle/8.13/fileHashes/fileHashes.lock differ
diff --git a/android_bot/.gradle/8.13/fileHashes/resourceHashesCache.bin b/android_bot/.gradle/8.13/fileHashes/resourceHashesCache.bin
new file mode 100644
index 0000000..3834050
Binary files /dev/null and b/android_bot/.gradle/8.13/fileHashes/resourceHashesCache.bin differ
diff --git a/android_bot/.gradle/8.13/gc.properties b/android_bot/.gradle/8.13/gc.properties
new file mode 100644
index 0000000..e69de29
diff --git a/android_bot/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/android_bot/.gradle/buildOutputCleanup/buildOutputCleanup.lock
new file mode 100644
index 0000000..e94472b
Binary files /dev/null and b/android_bot/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ
diff --git a/android_bot/.gradle/buildOutputCleanup/cache.properties b/android_bot/.gradle/buildOutputCleanup/cache.properties
new file mode 100644
index 0000000..759aab7
--- /dev/null
+++ b/android_bot/.gradle/buildOutputCleanup/cache.properties
@@ -0,0 +1,2 @@
+#Sun Jun 21 02:56:57 EET 2026
+gradle.version=8.13
diff --git a/android_bot/.gradle/buildOutputCleanup/outputFiles.bin b/android_bot/.gradle/buildOutputCleanup/outputFiles.bin
new file mode 100644
index 0000000..5e180fe
Binary files /dev/null and b/android_bot/.gradle/buildOutputCleanup/outputFiles.bin differ
diff --git a/android_bot/.gradle/config.properties b/android_bot/.gradle/config.properties
new file mode 100644
index 0000000..9847140
--- /dev/null
+++ b/android_bot/.gradle/config.properties
@@ -0,0 +1,2 @@
+#Sun Jun 21 02:56:49 EET 2026
+java.home=/Applications/Android Studio.app/Contents/jbr/Contents/Home
diff --git a/android_bot/.gradle/file-system.probe b/android_bot/.gradle/file-system.probe
new file mode 100644
index 0000000..71edea0
Binary files /dev/null and b/android_bot/.gradle/file-system.probe differ
diff --git a/android_bot/.gradle/vcs-1/gc.properties b/android_bot/.gradle/vcs-1/gc.properties
new file mode 100644
index 0000000..e69de29
diff --git a/android_bot/app/.gitignore b/android_bot/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/android_bot/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/android_bot/app/build.gradle.kts b/android_bot/app/build.gradle.kts
new file mode 100644
index 0000000..af210df
--- /dev/null
+++ b/android_bot/app/build.gradle.kts
@@ -0,0 +1,64 @@
+plugins {
+ alias(libs.plugins.android.application)
+ alias(libs.plugins.kotlin.android)
+ alias(libs.plugins.kotlin.compose)
+}
+
+android {
+ namespace = "com.siro.android_bot"
+ compileSdk = 36
+
+ defaultConfig {
+ applicationId = "com.siro.android_bot"
+ minSdk = 24
+ targetSdk = 36
+ versionCode = 1
+ versionName = "1.0"
+
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
+ buildConfigField("String", "BOT_SECRET_KEY", "\"SIRO_BOT_SUPER_SECRET_123\"")
+ // مضيف الباك إند في مكان واحد: تبديله عند نسخ البوت لعلامة أخرى
+ // (مثل انطلق على api.intaleqapp.com) يصير سطراً واحداً لا بحثاً في الكود.
+ buildConfigField("String", "BACKEND_HOST", "\"https://jordan-siro.intaleqapp.com\"")
+ }
+
+ buildTypes {
+ release {
+ isMinifyEnabled = false
+ proguardFiles(
+ getDefaultProguardFile("proguard-android-optimize.txt"),
+ "proguard-rules.pro"
+ )
+ }
+ }
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_11
+ targetCompatibility = JavaVersion.VERSION_11
+ }
+ kotlinOptions {
+ jvmTarget = "11"
+ }
+ buildFeatures {
+ compose = true
+ buildConfig = true
+ }
+}
+
+dependencies {
+
+ implementation(libs.androidx.core.ktx)
+ implementation(libs.androidx.lifecycle.runtime.ktx)
+ implementation(libs.androidx.activity.compose)
+ implementation(platform(libs.androidx.compose.bom))
+ implementation(libs.androidx.compose.ui)
+ implementation(libs.androidx.compose.ui.graphics)
+ implementation(libs.androidx.compose.ui.tooling.preview)
+ implementation(libs.androidx.compose.material3)
+ testImplementation(libs.junit)
+ androidTestImplementation(libs.androidx.junit)
+ androidTestImplementation(libs.androidx.espresso.core)
+ androidTestImplementation(platform(libs.androidx.compose.bom))
+ androidTestImplementation(libs.androidx.compose.ui.test.junit4)
+ debugImplementation(libs.androidx.compose.ui.tooling)
+ debugImplementation(libs.androidx.compose.ui.test.manifest)
+}
\ No newline at end of file
diff --git a/android_bot/app/proguard-rules.pro b/android_bot/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/android_bot/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/android_bot/app/src/androidTest/java/com/siro/android_bot/ExampleInstrumentedTest.kt b/android_bot/app/src/androidTest/java/com/siro/android_bot/ExampleInstrumentedTest.kt
new file mode 100644
index 0000000..200cd3d
--- /dev/null
+++ b/android_bot/app/src/androidTest/java/com/siro/android_bot/ExampleInstrumentedTest.kt
@@ -0,0 +1,24 @@
+package com.siro.android_bot
+
+import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.ext.junit.runners.AndroidJUnit4
+
+import org.junit.Test
+import org.junit.runner.RunWith
+
+import org.junit.Assert.*
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+@RunWith(AndroidJUnit4::class)
+class ExampleInstrumentedTest {
+ @Test
+ fun useAppContext() {
+ // Context of the app under test.
+ val appContext = InstrumentationRegistry.getInstrumentation().targetContext
+ assertEquals("com.siro.android_bot", appContext.packageName)
+ }
+}
\ No newline at end of file
diff --git a/android_bot/app/src/main/AndroidManifest.xml b/android_bot/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..5148acb
--- /dev/null
+++ b/android_bot/app/src/main/AndroidManifest.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android_bot/app/src/main/java/com/siro/android_bot/MainActivity.kt b/android_bot/app/src/main/java/com/siro/android_bot/MainActivity.kt
new file mode 100644
index 0000000..6a468c8
--- /dev/null
+++ b/android_bot/app/src/main/java/com/siro/android_bot/MainActivity.kt
@@ -0,0 +1,104 @@
+package com.siro.android_bot
+
+import android.content.ClipData
+import android.content.ClipboardManager
+import android.content.Context
+import android.os.Bundle
+import android.provider.Settings
+import android.widget.Toast
+import androidx.activity.ComponentActivity
+import androidx.activity.compose.setContent
+import androidx.activity.enableEdgeToEdge
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material3.Button
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Scaffold
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.tooling.preview.Preview
+import androidx.compose.ui.unit.dp
+import com.siro.android_bot.ui.theme.Android_botTheme
+
+class MainActivity : ComponentActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ val androidId = Settings.Secure.getString(contentResolver, Settings.Secure.ANDROID_ID) ?: "UNKNOWN"
+
+ enableEdgeToEdge()
+ setContent {
+ Android_botTheme {
+ Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
+ BotSetupScreen(
+ deviceId = androidId,
+ modifier = Modifier.padding(innerPadding)
+ )
+ }
+ }
+ }
+ }
+}
+
+@Composable
+fun BotSetupScreen(deviceId: String, modifier: Modifier = Modifier) {
+ val context = LocalContext.current
+
+ Column(
+ modifier = modifier.fillMaxSize(),
+ verticalArrangement = Arrangement.Center,
+ horizontalAlignment = Alignment.CenterHorizontally
+ ) {
+ Text(
+ text = "Siro Scraper Bot 🤖",
+ style = MaterialTheme.typography.headlineMedium,
+ fontWeight = FontWeight.Bold
+ )
+ Spacer(modifier = Modifier.height(32.dp))
+ Text(
+ text = "Your Device ID (Android ID):",
+ style = MaterialTheme.typography.bodyLarge
+ )
+ Spacer(modifier = Modifier.height(8.dp))
+ Text(
+ text = deviceId,
+ style = MaterialTheme.typography.headlineSmall,
+ color = MaterialTheme.colorScheme.primary,
+ fontWeight = FontWeight.Black,
+ textAlign = TextAlign.Center
+ )
+ Spacer(modifier = Modifier.height(32.dp))
+ Button(onClick = {
+ val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
+ val clip = ClipData.newPlainText("Device ID", deviceId)
+ clipboard.setPrimaryClip(clip)
+ Toast.makeText(context, "Copied to clipboard!", Toast.LENGTH_SHORT).show()
+ }) {
+ Text("Copy ID")
+ }
+ Spacer(modifier = Modifier.height(48.dp))
+ Text(
+ text = "Make sure to add this ID to your Siro Server.\nAlso, remember to enable this app in Settings > Accessibility.",
+ style = MaterialTheme.typography.bodyMedium,
+ textAlign = TextAlign.Center,
+ modifier = Modifier.padding(horizontal = 32.dp)
+ )
+ }
+}
+
+@Preview(showBackground = true)
+@Composable
+fun GreetingPreview() {
+ Android_botTheme {
+ BotSetupScreen("a1b2c3d4e5f6g7h8")
+ }
+}
\ No newline at end of file
diff --git a/android_bot/app/src/main/java/com/siro/android_bot/network/WorkerClient.kt b/android_bot/app/src/main/java/com/siro/android_bot/network/WorkerClient.kt
new file mode 100644
index 0000000..35a83af
--- /dev/null
+++ b/android_bot/app/src/main/java/com/siro/android_bot/network/WorkerClient.kt
@@ -0,0 +1,129 @@
+package com.siro.android_bot.network
+
+import com.siro.android_bot.BuildConfig
+import android.content.Context
+import android.provider.Settings
+import android.util.Log
+import org.json.JSONObject
+import java.io.BufferedReader
+import java.io.InputStreamReader
+import java.io.OutputStreamWriter
+import java.net.HttpURLConnection
+import java.net.URL
+import javax.crypto.Mac
+import javax.crypto.spec.SecretKeySpec
+
+class WorkerClient(private val context: Context) {
+
+ private val TAG = "WorkerClient"
+ // TODO: Fetch this from server during first handshake instead of hardcoding
+ // For now, must match the BOT_SECRET_KEY env var on the server
+ private val SECRET_KEY = BuildConfig.BOT_SECRET_KEY
+
+ // Read the real hardware Android ID
+ val deviceId: String by lazy {
+ Settings.Secure.getString(context.contentResolver, Settings.Secure.ANDROID_ID) ?: "UNKNOWN_DEVICE"
+ }
+
+ // المضيف من BuildConfig.BACKEND_HOST (app/build.gradle.kts) — لا يُشفَّر هنا،
+ // حتى يكون تبديله عند نسخ البوت لعلامة أخرى سطراً واحداً في gradle.
+ // للتجريب المحلي: اضبط BACKEND_HOST على "http://10.0.2.2:8000" مع تقديم
+ // نفس المسار /backend/bot/ من جذر السيرفر المحلي.
+ // worker.php هو المسار الإنتاجي (Redis + MySQL). لا تُعِده إلى
+ // standalone_worker.php: تلك نسخة اختبار محلي تخزّن في ملفات JSON
+ // ولا تصل نتائجها إلى جدول scraped_competitor_prices ولا إلى محرّك التسعير.
+ private val BASE_URL = "${BuildConfig.BACKEND_HOST}/backend/bot/worker.php"
+
+ private fun generateSignature(deviceId: String, ts: Long): String {
+ val message = "$deviceId$ts"
+ val algorithm = "HmacSHA256"
+ val mac = Mac.getInstance(algorithm)
+ val secretKeySpec = SecretKeySpec(SECRET_KEY.toByteArray(), algorithm)
+ mac.init(secretKeySpec)
+ val hashBytes = mac.doFinal(message.toByteArray())
+ return hashBytes.joinToString("") { "%02x".format(it) }
+ }
+
+ fun fetchTask(): JSONObject? {
+ try {
+ val ts = System.currentTimeMillis() / 1000
+ val sig = generateSignature(deviceId, ts)
+
+ val urlString = "$BASE_URL?device_id=$deviceId&ts=$ts&sig=$sig"
+ val url = URL(urlString)
+
+ Log.d(TAG, "Fetching task from: $urlString")
+ val connection = url.openConnection() as HttpURLConnection
+ connection.requestMethod = "GET"
+ connection.connectTimeout = 10000
+ connection.readTimeout = 10000
+
+ val responseCode = connection.responseCode
+ if (responseCode == HttpURLConnection.HTTP_OK) {
+ val reader = BufferedReader(InputStreamReader(connection.inputStream))
+ val response = reader.readText()
+ reader.close()
+ return JSONObject(response)
+ } else {
+ Log.e(TAG, "Fetch Error: HTTP $responseCode")
+ }
+ } catch (e: Exception) {
+ Log.e(TAG, "Exception during fetchTask: ${e.message}")
+ }
+ return null
+ }
+
+ fun submitPrice(taskId: String, appName: String, startLat: Double, startLng: Double, endLat: Double, endLng: Double, distanceKm: Double, price: Double): Boolean {
+ try {
+ val ts = System.currentTimeMillis() / 1000
+ val sig = generateSignature(deviceId, ts)
+
+ val payload = JSONObject().apply {
+ put("device_id", deviceId)
+ put("ts", ts)
+ put("sig", sig)
+ put("task_id", taskId)
+ put("type", "price_check")
+ put("status", "success")
+
+ val resultData = JSONObject().apply {
+ put("app", appName)
+ put("distance_km", distanceKm)
+ put("price", price)
+ put("start_lat", startLat)
+ put("start_lng", startLng)
+ put("end_lat", endLat)
+ put("end_lng", endLng)
+ }
+ put("result_data", resultData)
+ }
+
+ val url = URL(BASE_URL)
+ val connection = url.openConnection() as HttpURLConnection
+ connection.requestMethod = "POST"
+ connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8")
+ connection.doOutput = true
+ connection.connectTimeout = 10000
+ connection.readTimeout = 10000
+
+ val writer = OutputStreamWriter(connection.outputStream)
+ writer.write(payload.toString())
+ writer.flush()
+ writer.close()
+
+ val responseCode = connection.responseCode
+ return if (responseCode == HttpURLConnection.HTTP_OK) {
+ val reader = BufferedReader(InputStreamReader(connection.inputStream))
+ Log.d(TAG, "Submit Success: ${reader.readText()}")
+ reader.close()
+ true
+ } else {
+ Log.e(TAG, "Submit Error: HTTP $responseCode")
+ false
+ }
+ } catch (e: Exception) {
+ Log.e(TAG, "Exception during submitPrice: ${e.message}")
+ return false
+ }
+ }
+}
diff --git a/android_bot/app/src/main/java/com/siro/android_bot/service/AppLauncher.kt b/android_bot/app/src/main/java/com/siro/android_bot/service/AppLauncher.kt
new file mode 100644
index 0000000..99d0faa
--- /dev/null
+++ b/android_bot/app/src/main/java/com/siro/android_bot/service/AppLauncher.kt
@@ -0,0 +1,47 @@
+package com.siro.android_bot.service
+
+import android.content.Context
+import android.content.Intent
+import android.util.Log
+
+object AppLauncher {
+ private const val TAG = "AppLauncher"
+
+ // Maps the server app name to the actual Android package name
+ // Important: We will verify these exact package names tomorrow once you install them.
+ private val APP_PACKAGES = mapOf(
+ "yallago" to "ae.com.yalla.go.dubai.client",
+ "ae.com.yalla.go.dubai.client" to "ae.com.yalla.go.dubai.client",
+ "zaken" to "com.zakinn.app",
+ "com.zakinn.app" to "com.zakinn.app",
+ "tufaddal" 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 {
+ val packageName = APP_PACKAGES[appName.lowercase()]
+ if (packageName == null) {
+ Log.e(TAG, "Unknown app name from server: $appName")
+ return false
+ }
+
+ val launchIntent = context.packageManager.getLaunchIntentForPackage(packageName)
+ if (launchIntent != null) {
+ launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK)
+ context.startActivity(launchIntent)
+ Log.i(TAG, "Successfully launched $appName ($packageName)")
+ return true
+ } else {
+ Log.e(TAG, "App $appName ($packageName) is not installed on this device!")
+ return false
+ }
+ }
+}
diff --git a/android_bot/app/src/main/java/com/siro/android_bot/service/ScraperAccessibilityService.kt b/android_bot/app/src/main/java/com/siro/android_bot/service/ScraperAccessibilityService.kt
new file mode 100644
index 0000000..2175a2f
--- /dev/null
+++ b/android_bot/app/src/main/java/com/siro/android_bot/service/ScraperAccessibilityService.kt
@@ -0,0 +1,1099 @@
+package com.siro.android_bot.service
+
+import android.accessibilityservice.AccessibilityService
+import android.util.Log
+import android.view.accessibility.AccessibilityEvent
+import com.siro.android_bot.network.WorkerClient
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.Job
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.isActive
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.withContext
+import org.json.JSONObject
+
+enum class BotState {
+ IDLE,
+ LAUNCHING_APP,
+ NAVIGATING_HOME,
+ SEARCHING_START,
+ SEARCHING_END,
+ READING_PRICE,
+ SUBMITTING
+}
+
+class ScraperAccessibilityService : AccessibilityService() {
+
+ private val TAG = "ScraperService"
+ private var pollingJob: Job? = null
+ private val serviceScope = CoroutineScope(Dispatchers.IO)
+
+ private lateinit var workerClient: WorkerClient
+
+ // State Machine Memory
+ private var currentState = BotState.IDLE
+ private var currentTask: JSONObject? = null
+ private var currentAppName: String = ""
+ private var appLaunchTime = 0L
+ private var taxiFHomeClickTime = 0L
+ private var taxiFLocationClickTime = 0L
+ private var taxiFSuggestionClickTime = 0L
+ private var taxiFSearchTypingTime = 0L
+ private var taxiFPickupDone = false
+ private var taxiFDestinationDone = false
+ private val taxiFCollectedPrices = mutableListOf>()
+ private var taxiFPriceScrollAttempts = 0
+ private var taxiFReadingPriceStartTime = 0L
+
+ // Jeeny State Memory
+ private var jeenyDestinationDone = false
+ private var jeenyPickupDone = false
+ private var jeenySearchTypingTime = 0L
+ private var jeenyPickupWaitStartTime = 0L
+ companion object {
+ private val TAXIF_EXCLUDED_TEXTS = setOf(
+ "JOD", "ECO", "TaxiF", "SUV", "EV", "Mini", "Female", "Van",
+ "Airport", "Courier", "~", "تحديد نقطة الانطلاق", "الآن", "نقدًا",
+ "سيارة خاصة", "تاكسي", "جيب", "صغيرة", "كهرباء", "سائقة",
+ "عائلية", "توصيل", "خدمة", "✈︎", "📦", "🇯🇴"
+ )
+ }
+
+ override fun onServiceConnected() {
+ super.onServiceConnected()
+ Log.i(TAG, "Accessibility Service Connected!")
+
+ workerClient = WorkerClient(this)
+ Log.i(TAG, "Device Android ID: ${workerClient.deviceId}")
+
+ startPolling()
+ }
+
+ private fun startPolling() {
+ pollingJob = serviceScope.launch {
+ while (isActive) {
+ if (currentState == BotState.IDLE) {
+ Log.d(TAG, "Polling for tasks as ${workerClient.deviceId}...")
+ val result = workerClient.fetchTask()
+
+ if (result != null && result.optBoolean("has_task", false)) {
+ val task = result.getJSONObject("task")
+ handleTask(task)
+ } else {
+ Log.d(TAG, "No tasks available.")
+ }
+ // Poll every 5 seconds
+ delay(5000)
+ } else {
+ // We have an active task. Just to be safe, process screen periodically
+ // in case accessibility events are missed (e.g. app launched but screen static)
+ withContext(Dispatchers.Main) {
+ val rootNode = rootInActiveWindow
+ if (rootNode != null) {
+ val pkg = rootNode.packageName?.toString() ?: currentAppName
+ dispatchAutomation(pkg, rootNode)
+ }
+ }
+ delay(1000) // Poll UI state every 1s when active
+ }
+ }
+ }
+ }
+
+ private fun handleTask(task: JSONObject) {
+ currentTask = task
+ currentAppName = task.optString("app")
+ val taskId = task.optString("task_id")
+
+ Log.i(TAG, "Received Task: $taskId for App: $currentAppName")
+
+ taxiFPickupDone = false
+ taxiFDestinationDone = false
+ taxiFSearchTypingTime = 0L
+ currentState = BotState.LAUNCHING_APP
+
+ // Launch the App
+ val success = AppLauncher.launchApp(this, currentAppName)
+ if (success) {
+ appLaunchTime = System.currentTimeMillis()
+ currentState = if (currentAppName == "taxif" || currentAppName == "com.taxif.passenger") BotState.NAVIGATING_HOME else BotState.SEARCHING_START
+ Log.i(TAG, "State -> ${currentState}")
+ } else {
+ // Failed to launch (app not installed)
+ Log.e(TAG, "Failed to launch app. Returning to IDLE.")
+ currentState = BotState.IDLE
+ currentTask = null
+ }
+ }
+
+ override fun onAccessibilityEvent(event: AccessibilityEvent?) {
+ if (event == null) return
+
+ val packageName = event.packageName?.toString() ?: return
+ val rootNode = rootInActiveWindow ?: return
+
+ // Log layout hierarchy when a Jordanian app is open to inspect UI structure
+ if (packageName == "com.careem.acma" || packageName == "com.ubercab" ||
+ packageName == "com.taxif.passenger" || packageName == "me.com.easytaxi") {
+ Log.d("HierarchyDump", "--- START SCREEN HIERARCHY DUMP FOR $packageName ---")
+ dumpNodeHierarchy(rootNode, 0)
+ Log.d("HierarchyDump", "--- END SCREEN HIERARCHY DUMP FOR $packageName ---")
+ }
+
+ dispatchAutomation(packageName, rootNode)
+ }
+
+ private fun dispatchAutomation(packageName: String, rootNode: android.view.accessibility.AccessibilityNodeInfo) {
+ when {
+ packageName.contains("yalla") -> handleYallaGoAutomation(rootNode)
+ packageName.contains("zakinn") -> handleZakinnAutomation(rootNode)
+ packageName.contains("bis.taxi") -> handleTfadalAutomation(rootNode)
+ packageName.contains("careem") -> handleCareemAutomation(rootNode)
+ packageName.contains("ubercab") -> handleUberAutomation(rootNode)
+ packageName.contains("taxif") -> handleTaxiFAutomation(rootNode)
+ packageName.contains("easytaxi") -> handleJeenyAutomation(rootNode)
+ }
+ }
+
+ private fun handleYallaGoAutomation(rootNode: android.view.accessibility.AccessibilityNodeInfo) {
+ val task = currentTask ?: return
+
+ when (currentState) {
+ BotState.SEARCHING_START -> {
+ // If on main screen, find the "Where to" or dropoff TextView by text to tap
+ val dropoffNode = findNodeByText(rootNode, "Where to") ?: findNodeByText(rootNode, "أين تريد الذهاب")
+ if (dropoffNode != null) {
+ dropoffNode.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK)
+ Log.i(TAG, "YallaGo: Clicked dropoff entry node.")
+ currentState = BotState.SEARCHING_END
+ return
+ }
+
+ // If already on the search screen, type pickup location
+ val startLoc = task.optString("start_location", "Main Square")
+ val pickupEdit = findEditableNode(rootNode)
+ if (pickupEdit != null) {
+ 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, "YallaGo: Set pickup to: $startLoc")
+ currentState = BotState.SEARCHING_END
+ }
+ }
+ BotState.SEARCHING_END -> {
+ // Find destination field on search screen or select-on-map screen
+ val endLoc = task.optString("end_location", "Airport")
+ val destEdit = findEditableNode(rootNode)
+ if (destEdit != null) {
+ 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, "YallaGo: Set destination to: $endLoc")
+
+ // Look for the primary action button to confirm (e.g., "Confirm", "Book", "Done")
+ val confirmBtn = findNodeByText(rootNode, "Confirm") ?: findNodeByText(rootNode, "تأكيد")
+ if (confirmBtn != null) {
+ confirmBtn.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK)
+ Log.i(TAG, "YallaGo: Clicked confirm button.")
+ currentState = BotState.READING_PRICE
+ }
+ }
+ }
+ BotState.READING_PRICE -> {
+ // Search the screen for currency value
+ searchPriceByCurrency(rootNode)
+ }
+ else -> {}
+ }
+ }
+
+ private fun handleZakinnAutomation(rootNode: android.view.accessibility.AccessibilityNodeInfo) {
+ val task = currentTask ?: return
+
+ when (currentState) {
+ BotState.SEARCHING_START -> {
+ val inputNodes = rootNode.findAccessibilityNodeInfosByViewId("com.zakinn.app:id/ui-input-taxi-startText")
+ if (inputNodes.isNotEmpty()) {
+ val startLoc = task.optString("start_location", "Main Square")
+ val arguments = android.os.Bundle().apply {
+ putCharSequence(android.view.accessibility.AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, startLoc)
+ }
+ inputNodes[0].performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_SET_TEXT, arguments)
+ Log.i(TAG, "Zakinn: Entered start location: $startLoc")
+ currentState = BotState.SEARCHING_END
+ } else {
+ traverseAndType(rootNode, "locTypeStart", task.optString("start_location"))
+ }
+ }
+ BotState.SEARCHING_END -> {
+ val confirmButton = rootNode.findAccessibilityNodeInfosByViewId("com.zakinn.app:id/ui-btn-checkout-order-confirm")
+ if (confirmButton.isNotEmpty()) {
+ confirmButton[0].performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK)
+ Log.i(TAG, "Zakinn: Confirmed checkout.")
+ currentState = BotState.READING_PRICE
+ } else {
+ val fallbackConfirm = findNodeByText(rootNode, "Confirm") ?: findNodeByText(rootNode, "تأكيد")
+ if (fallbackConfirm != null) {
+ fallbackConfirm.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK)
+ Log.i(TAG, "Zakinn: Confirmed checkout via fallback text.")
+ currentState = BotState.READING_PRICE
+ }
+ }
+ }
+ BotState.READING_PRICE -> {
+ val priceValueNodes = rootNode.findAccessibilityNodeInfosByViewId("com.zakinn.app:id/service-price-value")
+ if (priceValueNodes.isNotEmpty()) {
+ val price = priceValueNodes[0].text?.toString() ?: ""
+ Log.i(TAG, "Zakinn: Read price: $price")
+ submitPriceToServer(price)
+ } else {
+ searchPriceByCurrency(rootNode)
+ }
+ }
+ else -> {}
+ }
+ }
+
+ private fun handleTfadalAutomation(rootNode: android.view.accessibility.AccessibilityNodeInfo) {
+ val task = currentTask ?: return
+
+ when (currentState) {
+ BotState.SEARCHING_START -> {
+ // In Flutter, look for inputs matching localized source strings
+ val sourceNode = findNodeByText(rootNode, "Find Your Source")
+ ?: findNodeByText(rootNode, "Source")
+ ?: findNodeByText(rootNode, "نقطة الانطلاق")
+ ?: findNodeByText(rootNode, "الانطلاق")
+ ?: findNodeByText(rootNode, "ابحث عن مصدرك")
+ ?: findNodeByText(rootNode, "Kalkış")
+ ?: findNodeByText(rootNode, "Kaynağınızı bulun")
+
+ if (sourceNode != null) {
+ val startLoc = task.optString("start_location", "Main Square")
+ val arguments = android.os.Bundle().apply {
+ putCharSequence(android.view.accessibility.AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, startLoc)
+ }
+ sourceNode.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_SET_TEXT, arguments)
+ Log.i(TAG, "Tfadal: Set source location: $startLoc")
+ currentState = BotState.SEARCHING_END
+ }
+ }
+ BotState.SEARCHING_END -> {
+ val destNode = findNodeByText(rootNode, "Find Your Destination")
+ ?: findNodeByText(rootNode, "Destination")
+ ?: findNodeByText(rootNode, "الوجهة")
+ ?: findNodeByText(rootNode, "ابحث عن وجهتك")
+ ?: findNodeByText(rootNode, "Varış")
+ ?: findNodeByText(rootNode, "Varış noktanızı bulun")
+
+ if (destNode != 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)
+ }
+ destNode.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_SET_TEXT, arguments)
+ Log.i(TAG, "Tfadal: Set destination location: $endLoc")
+
+ val requestButton = findNodeByText(rootNode, "Add a trip")
+ ?: findNodeByText(rootNode, "Normal Trip")
+ ?: findNodeByText(rootNode, "طلب الرحلة")
+ ?: findNodeByText(rootNode, "اطلب رحلة")
+ ?: findNodeByText(rootNode, "Normal Yolculuk")
+ ?: findNodeByText(rootNode, "Yolculuk ekle")
+ ?: findNodeByText(rootNode, "Continue")
+ ?: findNodeByText(rootNode, "متابعة")
+ ?: findNodeByText(rootNode, "Devam")
+
+ if (requestButton != null) {
+ requestButton.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK)
+ Log.i(TAG, "Tfadal: Clicked request trip button.")
+ currentState = BotState.READING_PRICE
+ }
+ }
+ }
+ BotState.READING_PRICE -> {
+ // Read expected price using localized strings
+ val priceNode = findNodeByText(rootNode, "Expected Price")
+ ?: findNodeByText(rootNode, "Total Price")
+ ?: findNodeByText(rootNode, "السعر المتوقع")
+ ?: findNodeByText(rootNode, "السعر الإجمالي")
+
+ if (priceNode != null) {
+ val priceText = priceNode.text?.toString() ?: ""
+ Log.i(TAG, "Tfadal: Found price header node: $priceText")
+ searchPriceByCurrency(rootNode)
+ } else {
+ searchPriceByCurrency(rootNode)
+ }
+ }
+ else -> {}
+ }
+ }
+
+ private fun findNodeByText(node: android.view.accessibility.AccessibilityNodeInfo?, query: String): android.view.accessibility.AccessibilityNodeInfo? {
+ if (node == null) return null
+ val text = node.text?.toString() ?: ""
+ val desc = node.contentDescription?.toString() ?: ""
+ if (text.contains(query, ignoreCase = true) || desc.contains(query, ignoreCase = true)) {
+ return node
+ }
+ for (i in 0 until node.childCount) {
+ val res = findNodeByText(node.getChild(i), query)
+ if (res != null) return res
+ }
+ return null
+ }
+
+ private fun findEditableNode(node: android.view.accessibility.AccessibilityNodeInfo?): android.view.accessibility.AccessibilityNodeInfo? {
+ if (node == null) return null
+ if (node.className == "android.widget.EditText" || node.isEditable) {
+ return node
+ }
+ for (i in 0 until node.childCount) {
+ val res = findEditableNode(node.getChild(i))
+ if (res != null) return res
+ }
+ return null
+ }
+
+ private fun traverseAndType(node: android.view.accessibility.AccessibilityNodeInfo?, hintText: String, value: String) {
+ if (node == null) return
+ if (node.className == "android.widget.EditText" || node.isEditable) {
+ val arguments = android.os.Bundle().apply {
+ putCharSequence(android.view.accessibility.AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, value)
+ }
+ node.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_SET_TEXT, arguments)
+ Log.i(TAG, "Typed '$value' into editable node.")
+ return
+ }
+ for (i in 0 until node.childCount) {
+ traverseAndType(node.getChild(i), hintText, value)
+ }
+ }
+
+ 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.") || text.contains("JOD") || text.contains("د.أ") || text.contains("JD")) {
+ Log.i(TAG, "Found price pattern dynamically: $text")
+ submitPriceToServer(text)
+ return
+ }
+ for (i in 0 until node.childCount) {
+ searchPriceByCurrency(node.getChild(i))
+ }
+ }
+
+ private fun submitPriceToServer(rawPrice: String) {
+ val task = currentTask ?: return
+ val taskId = task.optString("task_id")
+
+ // Extract nested payload object where coordinates reside
+ val payload = task.optJSONObject("payload")
+ val startLat = payload?.optDouble("start_lat", 0.0) ?: 0.0
+ val startLng = payload?.optDouble("start_lng", 0.0) ?: 0.0
+ val endLat = payload?.optDouble("end_lat", 0.0) ?: 0.0
+ val endLng = payload?.optDouble("end_lng", 0.0) ?: 0.0
+
+ // Calculate distance
+ val distanceKm = calculateDistanceInKm(startLat, startLng, endLat, endLng)
+
+ // Extract numeric digits from price
+ val numericPrice = rawPrice.replace(Regex("[^0-9.]"), "").toDoubleOrNull() ?: 0.0
+
+ serviceScope.launch {
+ Log.i(TAG, "Submitting price $numericPrice for task $taskId...")
+ val success = workerClient.submitPrice(
+ taskId = taskId,
+ appName = currentAppName,
+ startLat = startLat,
+ startLng = startLng,
+ endLat = endLat,
+ endLng = endLng,
+ distanceKm = distanceKm,
+ price = numericPrice
+ )
+
+ if (success) {
+ Log.i(TAG, "Successfully submitted price to server.")
+ } else {
+ Log.e(TAG, "Failed to submit price.")
+ }
+
+ // Wait 3 seconds for price to settle, then fetch next task directly
+ delay(3000)
+
+ val nextResult = workerClient.fetchTask()
+ if (nextResult != null && nextResult.optBoolean("has_task", false)) {
+ val nextTask = nextResult.getJSONObject("task")
+ currentState = BotState.IDLE
+ withContext(Dispatchers.Main) {
+ handleTask(nextTask)
+ }
+ Log.i(TAG, "Multi-trip: Immediately started next task ${nextTask.optString("task_id")}")
+ } else {
+ Log.i(TAG, "No more tasks, returning to IDLE.")
+ currentState = BotState.IDLE
+ currentTask = null
+ }
+ }
+ }
+
+ private fun calculateDistanceInKm(lat1: Double, lon1: Double, lat2: Double, lon2: Double): Double {
+ val r = 6371.0 // Earth radius in km
+ val dLat = Math.toRadians(lat2 - lat1)
+ val dLon = Math.toRadians(lon2 - lon1)
+ val a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
+ Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) *
+ Math.sin(dLon / 2) * Math.sin(dLon / 2)
+ val c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
+ 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.NAVIGATING_HOME -> {
+ if (System.currentTimeMillis() - appLaunchTime < 2000) return
+ if (hasJustClickedHome()) return
+ val rihlaNode = findNodeByText(rootNode, "رحلة") ?: findNodeByText(rootNode, "طلب")
+ if (rihlaNode != null) {
+ var clickable: android.view.accessibility.AccessibilityNodeInfo? = rihlaNode
+ while (clickable != null && !clickable.isClickable) {
+ clickable = clickable.parent
+ }
+ if (clickable != null) {
+ clickable.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK)
+ Log.i(TAG, "TaxiF: Clicked 'رحلة' or 'طلب' tab, entering trip flow")
+ } else {
+ rihlaNode.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK)
+ Log.i(TAG, "TaxiF: Clicked 'رحلة' or 'طلب' node directly")
+ }
+ taxiFHomeClickTime = System.currentTimeMillis()
+ currentState = BotState.SEARCHING_START
+ return
+ }
+ currentState = BotState.SEARCHING_START
+ Log.i(TAG, "TaxiF: Home screen navigated, state -> SEARCHING_START")
+ }
+ BotState.SEARCHING_START -> {
+ if (detectTaxiFPriceScreen(rootNode)) {
+ if (hasJustClickedLocation() || hasJustClickedSuggestion()) return
+ if (!taxiFPickupDone && shouldEditLocation(rootNode, task, isPickup = true)) {
+ clickLocationRow(rootNode, isPickup = true)
+ taxiFLocationClickTime = System.currentTimeMillis()
+ return
+ }
+ taxiFPickupDone = true
+ currentState = BotState.SEARCHING_END
+ return
+ }
+ if (!taxiFPickupDone && handleTaxiFSearchScreen(rootNode, task.optString("start_location", "Amman"))) {
+ taxiFPickupDone = true
+ Log.i(TAG, "TaxiF: Handled pickup search, waiting for price screen")
+ }
+ }
+ BotState.SEARCHING_END -> {
+ if (detectTaxiFPriceScreen(rootNode)) {
+ if (hasJustClickedLocation() || hasJustClickedSuggestion()) return
+ if (!taxiFDestinationDone && shouldEditLocation(rootNode, task, isPickup = false)) {
+ clickLocationRow(rootNode, isPickup = false)
+ taxiFLocationClickTime = System.currentTimeMillis()
+ return
+ }
+ taxiFDestinationDone = true
+ currentState = BotState.READING_PRICE
+ taxiFReadingPriceStartTime = System.currentTimeMillis()
+ taxiFCollectedPrices.clear()
+ taxiFPriceScrollAttempts = 0
+ return
+ }
+ if (!taxiFDestinationDone && handleTaxiFSearchScreen(rootNode, task.optString("end_location", "Airport"))) {
+ taxiFDestinationDone = true
+ Log.i(TAG, "TaxiF: Handled dest search, waiting for price screen")
+ }
+ }
+ BotState.READING_PRICE -> {
+ if (hasJustClickedSuggestion()) return
+ if (System.currentTimeMillis() - taxiFReadingPriceStartTime < 2000) return
+
+ val ecoPrice = getEcoPrice(rootNode)
+ if (ecoPrice != null && ecoPrice > 0) {
+ Log.i(TAG, "TaxiF: Found ECO price: $ecoPrice JOD")
+ submitPriceToServer("$ecoPrice JOD")
+ currentState = BotState.IDLE
+ } else if (System.currentTimeMillis() - taxiFReadingPriceStartTime > 15000) {
+ Log.w(TAG, "TaxiF: ECO price not found within 15s timeout, falling back to collectAndScrollPrices")
+ collectAndScrollPrices(rootNode)
+ }
+ }
+ else -> {}
+ }
+ }
+
+ private fun hasJustClickedHome(): Boolean {
+ return (System.currentTimeMillis() - taxiFHomeClickTime) < 500
+ }
+
+ private fun hasJustClickedLocation(): Boolean {
+ return (System.currentTimeMillis() - taxiFLocationClickTime) < 500
+ }
+
+ private fun hasJustClickedSuggestion(): Boolean {
+ return (System.currentTimeMillis() - taxiFSuggestionClickTime) < 500
+ }
+
+ private fun shouldEditLocation(rootNode: android.view.accessibility.AccessibilityNodeInfo, task: JSONObject, isPickup: Boolean): Boolean {
+ val locationNodes = getLocationTextNodes(rootNode)
+ val taskLoc = if (isPickup) task.optString("start_location", "") else task.optString("end_location", "")
+ if (taskLoc.isEmpty()) return false
+
+ val rowNode = if (isPickup) {
+ locationNodes.firstOrNull()
+ } else {
+ val destIdx = locationNodes.indexOfFirst { it.text?.toString() == "عنوان الإنزال" }
+ if (destIdx >= 0) locationNodes[destIdx] else locationNodes.getOrNull(1)
+ }
+
+ val rowText = rowNode?.text?.toString()?.trim() ?: ""
+ val matchFound = rowText.contains(taskLoc, ignoreCase = true) || taskLoc.contains(rowText, ignoreCase = true)
+
+ Log.d(TAG, "TaxiF: shouldEditLocation(isPickup=$isPickup): rowText='$rowText', taskLoc='$taskLoc', matchFound=$matchFound, locationNodes=[${locationNodes.joinToString { it.text?.toString() ?: "" }}]")
+
+ return !matchFound
+ }
+
+ private fun clickLocationRow(rootNode: android.view.accessibility.AccessibilityNodeInfo?, isPickup: Boolean) {
+ if (rootNode == null) return
+ val locationNodes = getLocationTextNodes(rootNode)
+ val targetIndex: Int
+ if (isPickup) {
+ targetIndex = 0
+ } else {
+ val destIdx = locationNodes.indexOfFirst { it.text?.toString() == "عنوان الإنزال" }
+ targetIndex = if (destIdx >= 0) destIdx else minOf(1, locationNodes.size - 1)
+ }
+ if (targetIndex < locationNodes.size) {
+ val locNode = locationNodes[targetIndex]
+ var clickable: android.view.accessibility.AccessibilityNodeInfo? = locNode
+ while (clickable != null && !clickable.isClickable) {
+ clickable = clickable.parent
+ }
+ if (clickable != null) {
+ clickable.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK)
+ Log.i(TAG, "TaxiF: Clicked ${if (isPickup) "pickup" else "destination"} row: '${locNode.text}'")
+ } else {
+ locNode.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK)
+ Log.i(TAG, "TaxiF: Clicked ${if (isPickup) "pickup" else "destination"} node directly: '${locNode.text}'")
+ }
+ }
+ }
+
+ private fun getLocationTextNodes(node: android.view.accessibility.AccessibilityNodeInfo?, results: MutableList = mutableListOf()): List {
+ if (node == null) return results
+ val text = node.text?.toString()?.trim() ?: ""
+ val className = node.className?.toString() ?: ""
+ val isEditText = className == "android.widget.EditText" || node.isEditable
+ if (text.isNotBlank() && text.length > 2 && !isEditText && TAXIF_EXCLUDED_TEXTS.none { text.contains(it) }) {
+ results.add(node)
+ }
+ for (i in 0 until node.childCount) {
+ getLocationTextNodes(node.getChild(i), results)
+ }
+ return results
+ }
+
+ private fun handleTaxiFSearchScreen(rootNode: android.view.accessibility.AccessibilityNodeInfo, location: String): Boolean {
+ val editTexts = findAllEditTexts(rootNode)
+ if (editTexts.isEmpty()) return false
+ val editField = editTexts[0]
+ val currentText = editField.text?.toString() ?: ""
+ val normalizedCurrent = currentText.replace("-", " ").replace("\\s+".toRegex(), " ").trim()
+ val normalizedLocation = location.replace("-", " ").replace("\\s+".toRegex(), " ").trim()
+ if (!normalizedCurrent.contains(normalizedLocation, ignoreCase = true)) {
+ val arguments = android.os.Bundle().apply {
+ putCharSequence(android.view.accessibility.AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, location)
+ }
+ editField.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_SET_TEXT, arguments)
+ Log.i(TAG, "TaxiF: Typed '$location' in search field")
+ taxiFSearchTypingTime = System.currentTimeMillis()
+ } else {
+ if (taxiFSearchTypingTime == 0L) {
+ taxiFSearchTypingTime = System.currentTimeMillis()
+ }
+ }
+
+ if (hasJustClickedSuggestion()) return false
+
+ val firstWord = location.split(" ").firstOrNull() ?: location
+ if (clickFirstSuggestion(rootNode, firstWord)) {
+ taxiFSuggestionClickTime = System.currentTimeMillis()
+ Log.i(TAG, "TaxiF: Clicked suggestion matching '$firstWord'")
+ taxiFSearchTypingTime = 0L
+ return true
+ } else {
+ if (System.currentTimeMillis() - taxiFSearchTypingTime > 3000) {
+ if (clickFirstGenericSuggestion(rootNode)) {
+ taxiFSuggestionClickTime = System.currentTimeMillis()
+ Log.i(TAG, "TaxiF: Clicked first generic suggestion as fallback")
+ taxiFSearchTypingTime = 0L
+ return true
+ }
+ }
+ }
+ return false
+ }
+
+ private fun clickFirstGenericSuggestion(rootNode: android.view.accessibility.AccessibilityNodeInfo?): Boolean {
+ if (rootNode == null) return false
+ val recycler = findRecyclerView(rootNode) ?: return false
+ for (i in 0 until recycler.childCount) {
+ val child = recycler.getChild(i) ?: continue
+ if (child.isClickable) {
+ child.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK)
+ return true
+ }
+ }
+ for (i in 0 until recycler.childCount) {
+ val child = recycler.getChild(i) ?: continue
+ val clickableDescendant = findClickableDescendant(child)
+ if (clickableDescendant != null) {
+ clickableDescendant.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK)
+ return true
+ }
+ }
+ return false
+ }
+
+ private fun findClickableDescendant(node: android.view.accessibility.AccessibilityNodeInfo?): android.view.accessibility.AccessibilityNodeInfo? {
+ if (node == null) return null
+ if (node.isClickable) return node
+ for (i in 0 until node.childCount) {
+ val res = findClickableDescendant(node.getChild(i))
+ if (res != null) return res
+ }
+ return null
+ }
+
+ private fun clickFirstSuggestion(rootNode: android.view.accessibility.AccessibilityNodeInfo?, target: String): Boolean {
+ if (rootNode == null) return false
+ val recycler = findRecyclerView(rootNode) ?: return false
+ for (i in 0 until recycler.childCount) {
+ val child = recycler.getChild(i) ?: continue
+ if (child.isClickable && suggestionContainsText(child, target)) {
+ child.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK)
+ return true
+ }
+ }
+ return false
+ }
+
+ private fun suggestionContainsText(node: android.view.accessibility.AccessibilityNodeInfo?, target: String): Boolean {
+ if (node == null) return false
+ val text = node.text?.toString() ?: ""
+ val normalizedText = text.replace("-", " ").replace("\\s+".toRegex(), " ").trim()
+ val normalizedTarget = target.replace("-", " ").replace("\\s+".toRegex(), " ").trim()
+ if (normalizedText.contains(normalizedTarget, ignoreCase = true)) return true
+ for (i in 0 until node.childCount) {
+ if (suggestionContainsText(node.getChild(i), target)) return true
+ }
+ return false
+ }
+
+ private fun findRecyclerView(node: android.view.accessibility.AccessibilityNodeInfo?): android.view.accessibility.AccessibilityNodeInfo? {
+ if (node == null) return null
+ val className = node.className?.toString() ?: ""
+ if (className.contains("RecyclerView") || className.contains("ListView") || className.contains("Recycler")) {
+ return node
+ }
+ for (i in 0 until node.childCount) {
+ val result = findRecyclerView(node.getChild(i))
+ if (result != null) return result
+ }
+ return null
+ }
+
+ private fun detectTaxiFPriceScreen(node: android.view.accessibility.AccessibilityNodeInfo?): Boolean {
+ val hasConfirmBtn = findNodeByText(node, "تحديد نقطة الانطلاق") != null
+ if (hasConfirmBtn) return true
+ val hasJOD = findNodeByText(node, "JOD") != null
+ val hasRideOption = findNodeByText(node, "ECO") != null ||
+ findNodeByText(node, "TaxiF") != null ||
+ findNodeByText(node, "سيارة خاصة") != null ||
+ findNodeByText(node, "Airport") != null ||
+ findNodeByText(node, "توصيل المطار") != null
+ return hasJOD && hasRideOption
+ }
+
+ private fun collectAndScrollPrices(rootNode: android.view.accessibility.AccessibilityNodeInfo) {
+ findAllJODPrices(rootNode, taxiFCollectedPrices)
+ if (taxiFPriceScrollAttempts < 3) {
+ val recycler = findHorizontalRecyclerView(rootNode)
+ if (recycler != null) {
+ recycler.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_SCROLL_FORWARD)
+ taxiFPriceScrollAttempts++
+ Log.i(TAG, "TaxiF: Scrolled price list, attempt $taxiFPriceScrollAttempts")
+ }
+ return
+ }
+ val prices = taxiFCollectedPrices.distinct()
+ taxiFCollectedPrices.clear()
+ taxiFPriceScrollAttempts = 0
+ if (prices.isNotEmpty()) {
+ prices.forEach { (price, label) ->
+ Log.i(TAG, "TaxiF: Found price option: ${label.take(50)} = $price JOD")
+ }
+ val cheapest = prices.minByOrNull { it.first } ?: prices.first()
+ Log.i(TAG, "TaxiF: Submitting cheapest price: ${cheapest.second.take(50)} = ${cheapest.first} JOD")
+ submitPriceToServer("${cheapest.first} JOD")
+ } else {
+ Log.w(TAG, "TaxiF: No JOD prices found, falling back to generic search")
+ searchPriceByCurrency(rootNode)
+ }
+ currentState = BotState.IDLE
+ }
+
+ private fun findHorizontalRecyclerView(node: android.view.accessibility.AccessibilityNodeInfo?): android.view.accessibility.AccessibilityNodeInfo? {
+ if (node == null) return null
+ val className = node.className?.toString() ?: ""
+ if (className.contains("RecyclerView") || className.contains("HorizontalScrollView")) {
+ return node
+ }
+ for (i in 0 until node.childCount) {
+ val result = findHorizontalRecyclerView(node.getChild(i))
+ if (result != null) return result
+ }
+ return null
+ }
+
+ private fun findAllJODPrices(node: android.view.accessibility.AccessibilityNodeInfo?, prices: MutableList>) {
+ if (node == null) return
+ val text = node.text?.toString() ?: ""
+ if (text.contains("JOD")) {
+ val converted = arabicToWestern(text)
+ val match = Regex("""(\d+\.?\d*)""").find(converted)
+ if (match != null) {
+ val price = match.value.toDoubleOrNull()
+ if (price != null && price > 0) {
+ prices.add(price to text.trim())
+ }
+ }
+ }
+ for (i in 0 until node.childCount) {
+ findAllJODPrices(node.getChild(i), prices)
+ }
+ }
+
+ private fun getEcoPrice(rootNode: android.view.accessibility.AccessibilityNodeInfo?): Double? {
+ if (rootNode == null) return null
+ val recycler = findHorizontalRecyclerView(rootNode) ?: return null
+ for (i in 0 until recycler.childCount) {
+ val card = recycler.getChild(i) ?: continue
+ if (findNodeByText(card, "ECO") != null) {
+ val jodNode = findNodeByText(card, "JOD") ?: continue
+ val text = jodNode.text?.toString() ?: continue
+ val converted = arabicToWestern(text)
+ val match = Regex("""(\d+\.?\d*)""").find(converted)
+ if (match != null) {
+ val price = match.value.toDoubleOrNull()
+ if (price != null && price > 0) return price
+ }
+ }
+ }
+ return null
+ }
+
+ private fun getJeenyEcoLitePrice(rootNode: android.view.accessibility.AccessibilityNodeInfo?): Double? {
+ if (rootNode == null) return null
+ val ecoNode = findNodeByText(rootNode, "Eco lite")
+ ?: findNodeByText(rootNode, "EcoLite")
+ ?: findNodeByText(rootNode, "ايكو لايت")
+ ?: findNodeByText(rootNode, "إيكو لايت")
+
+ if (ecoNode != null) {
+ var parent = ecoNode.parent
+ for (i in 0..2) { // search up to 3 levels up
+ if (parent == null) break
+ val prices = mutableListOf>()
+ findAllJODPrices(parent, prices)
+ if (prices.isNotEmpty()) {
+ return prices.first().first
+ }
+ parent = parent.parent
+ }
+ }
+ return null
+ }
+
+ 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 -> {
+ // Look for the "Where to" button/view on the main screen
+ val whereToNode = findNodeByText(rootNode, "موقع الوصول")
+ ?: findNodeByText(rootNode, "إلى اين تريد الذهاب")
+ ?: findNodeByText(rootNode, "Where to")
+ ?: findNodeByText(rootNode, "إلى أين")
+
+ if (whereToNode != null) {
+ // Click the parent clickable view if the TextView itself is not clickable
+ var clickableParent = whereToNode
+ while (clickableParent != null && !clickableParent.isClickable) {
+ clickableParent = clickableParent.parent
+ }
+ if (clickableParent != null) {
+ clickableParent.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK)
+ Log.i(TAG, "Jeeny: Clicked where to button/view.")
+ jeenyDestinationDone = false
+ jeenyPickupDone = false
+ jeenySearchTypingTime = 0L
+ jeenyPickupWaitStartTime = 0L
+ currentState = BotState.SEARCHING_END
+ } else {
+ whereToNode.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK)
+ Log.i(TAG, "Jeeny: Clicked where to button/view (direct).")
+ jeenyDestinationDone = false
+ jeenyPickupDone = false
+ jeenySearchTypingTime = 0L
+ jeenyPickupWaitStartTime = 0L
+ currentState = BotState.SEARCHING_END
+ }
+ } else {
+ // If we are already on the search screen (we don't see "Where to" main button, but we see EditTexts)
+ val editTexts = findAllEditTexts(rootNode)
+ if (editTexts.isNotEmpty()) {
+ Log.i(TAG, "Jeeny: Already on search screen with ${editTexts.size} input fields.")
+ currentState = BotState.SEARCHING_END
+ }
+ }
+ }
+ BotState.SEARCHING_END -> {
+ if (!jeenyDestinationDone) {
+ val endLoc = task.optString("end_location", "Airport")
+
+ val editTexts = findAllEditTexts(rootNode)
+ if (editTexts.isNotEmpty()) {
+ val destField = editTexts.last() // Destination is usually the last one
+ if (destField.text?.toString() != endLoc && !destField.text.toString().contains(endLoc)) {
+ val destArgs = android.os.Bundle().apply {
+ putCharSequence(android.view.accessibility.AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, endLoc)
+ }
+ destField.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_SET_TEXT, destArgs)
+ Log.i(TAG, "Jeeny: Set destination -> $endLoc")
+ jeenySearchTypingTime = System.currentTimeMillis()
+ return
+ }
+ }
+
+ if (jeenySearchTypingTime > 0 && System.currentTimeMillis() - jeenySearchTypingTime > 1500) {
+ val firstWord = endLoc.split(" ").firstOrNull() ?: endLoc
+ if (clickFirstSuggestion(rootNode, firstWord) || clickFirstGenericSuggestion(rootNode)) {
+ Log.i(TAG, "Jeeny: Clicked destination suggestion")
+ jeenyDestinationDone = true
+ jeenyPickupWaitStartTime = System.currentTimeMillis()
+ jeenySearchTypingTime = 0L
+ return
+ }
+ }
+ } else if (!jeenyPickupDone) {
+ // Wait 2 seconds for pickup widget to appear
+ if (jeenyPickupWaitStartTime > 0 && System.currentTimeMillis() - jeenyPickupWaitStartTime < 2000) {
+ return
+ }
+
+ val startLoc = task.optString("start_location", "Amman")
+
+ // The pickup search box might just be an EditText or we might need to click "موقع الانطلاق" first
+ val pickupTextNode = findNodeByText(rootNode, "موقع الانطلاق")
+ if (pickupTextNode != null) {
+ var clickableParent = pickupTextNode
+ while (clickableParent != null && !clickableParent.isClickable) {
+ clickableParent = clickableParent.parent
+ }
+ if (clickableParent != null) {
+ clickableParent.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK)
+ Log.i(TAG, "Jeeny: Clicked pickup location widget")
+ jeenyPickupWaitStartTime = 0L // prevent re-clicking immediately
+ return
+ }
+ }
+
+ val editTexts = findAllEditTexts(rootNode)
+ if (editTexts.isNotEmpty()) {
+ val pickupField = editTexts.first() // Pickup is usually the first one when both are visible
+ if (pickupField.text?.toString() != startLoc && !pickupField.text.toString().contains(startLoc)) {
+ val pickupArgs = android.os.Bundle().apply {
+ putCharSequence(android.view.accessibility.AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, startLoc)
+ }
+ pickupField.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_SET_TEXT, pickupArgs)
+ Log.i(TAG, "Jeeny: Set pickup -> $startLoc")
+ jeenySearchTypingTime = System.currentTimeMillis()
+ return
+ }
+ }
+
+ if (jeenySearchTypingTime > 0 && System.currentTimeMillis() - jeenySearchTypingTime > 1500) {
+ val firstWord = startLoc.split(" ").firstOrNull() ?: startLoc
+ if (clickFirstSuggestion(rootNode, firstWord) || clickFirstGenericSuggestion(rootNode)) {
+ Log.i(TAG, "Jeeny: Clicked pickup suggestion")
+ jeenyPickupDone = true
+ currentState = BotState.READING_PRICE
+ return
+ }
+ }
+ }
+ }
+ BotState.READING_PRICE -> {
+ // Check if we are on the Confirm Pickup map screen
+ val confirmPickupBtn = findNodeByText(rootNode, "تاكيد وجهة الانطلاق")
+ ?: findNodeByText(rootNode, "تأكيد وجهة الانطلاق")
+ ?: findNodeByText(rootNode, "Confirm pickup")
+ ?: findNodeByText(rootNode, "Confirm start")
+
+ if (confirmPickupBtn != null) {
+ var clickableParent = confirmPickupBtn
+ while (clickableParent != null && !clickableParent.isClickable) {
+ clickableParent = clickableParent.parent
+ }
+ if (clickableParent != null) {
+ clickableParent.performAction(android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK)
+ Log.i(TAG, "Jeeny: Clicked confirm pickup button.")
+ return
+ }
+ }
+
+ // If not on pickup confirmation screen, read the price
+ val ecoLitePrice = getJeenyEcoLitePrice(rootNode)
+ if (ecoLitePrice != null && ecoLitePrice > 0) {
+ Log.i(TAG, "Jeeny: Found Eco lite price: $ecoLitePrice JOD")
+ submitPriceToServer("$ecoLitePrice JOD")
+ currentState = BotState.IDLE
+ } else {
+ // Fallback to searching any price if eco lite isn't strictly matched
+ searchPriceByCurrency(rootNode)
+ }
+ }
+ else -> {}
+ }
+ }
+
+ private fun dumpNodeHierarchy(node: android.view.accessibility.AccessibilityNodeInfo?, depth: Int) {
+ if (node == null) return
+ val indent = " ".repeat(depth)
+ val className = node.className ?: "unknown"
+ val text = node.text ?: ""
+ val resourceId = node.viewIdResourceName ?: "no-id"
+ val isClickable = node.isClickable
+ val isEditable = node.isEditable
+ Log.d("HierarchyDump", "$indent[$className] ID: $resourceId | Text: \"$text\" | Clickable: $isClickable | Editable: $isEditable")
+ for (i in 0 until node.childCount) {
+ dumpNodeHierarchy(node.getChild(i), depth + 1)
+ }
+ }
+
+ private fun findAllEditTexts(node: android.view.accessibility.AccessibilityNodeInfo?, list: MutableList = mutableListOf()): List {
+ if (node == null) return list
+ if (node.className == "android.widget.EditText" || node.isEditable) {
+ list.add(node)
+ }
+ for (i in 0 until node.childCount) {
+ findAllEditTexts(node.getChild(i), list)
+ }
+ return list
+ }
+
+ private fun arabicToWestern(text: String): String {
+ val mapping = mapOf(
+ '٠' to '0', '١' to '1', '٢' to '2', '٣' to '3', '٤' to '4',
+ '٥' to '5', '٦' to '6', '٧' to '7', '٨' to '8', '٩' to '9',
+ '٫' to '.'
+ )
+ return text.map { mapping[it] ?: it }.joinToString("")
+ }
+
+ override fun onInterrupt() {
+ Log.w(TAG, "Accessibility Service Interrupted")
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ pollingJob?.cancel()
+ Log.i(TAG, "Accessibility Service Destroyed")
+ }
+}
diff --git a/android_bot/app/src/main/java/com/siro/android_bot/ui/theme/Color.kt b/android_bot/app/src/main/java/com/siro/android_bot/ui/theme/Color.kt
new file mode 100644
index 0000000..d108ae3
--- /dev/null
+++ b/android_bot/app/src/main/java/com/siro/android_bot/ui/theme/Color.kt
@@ -0,0 +1,11 @@
+package com.siro.android_bot.ui.theme
+
+import androidx.compose.ui.graphics.Color
+
+val Purple80 = Color(0xFFD0BCFF)
+val PurpleGrey80 = Color(0xFFCCC2DC)
+val Pink80 = Color(0xFFEFB8C8)
+
+val Purple40 = Color(0xFF6650a4)
+val PurpleGrey40 = Color(0xFF625b71)
+val Pink40 = Color(0xFF7D5260)
\ No newline at end of file
diff --git a/android_bot/app/src/main/java/com/siro/android_bot/ui/theme/Theme.kt b/android_bot/app/src/main/java/com/siro/android_bot/ui/theme/Theme.kt
new file mode 100644
index 0000000..e703c13
--- /dev/null
+++ b/android_bot/app/src/main/java/com/siro/android_bot/ui/theme/Theme.kt
@@ -0,0 +1,58 @@
+package com.siro.android_bot.ui.theme
+
+import android.app.Activity
+import android.os.Build
+import androidx.compose.foundation.isSystemInDarkTheme
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.darkColorScheme
+import androidx.compose.material3.dynamicDarkColorScheme
+import androidx.compose.material3.dynamicLightColorScheme
+import androidx.compose.material3.lightColorScheme
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.platform.LocalContext
+
+private val DarkColorScheme = darkColorScheme(
+ primary = Purple80,
+ secondary = PurpleGrey80,
+ tertiary = Pink80
+)
+
+private val LightColorScheme = lightColorScheme(
+ primary = Purple40,
+ secondary = PurpleGrey40,
+ tertiary = Pink40
+
+ /* Other default colors to override
+ background = Color(0xFFFFFBFE),
+ surface = Color(0xFFFFFBFE),
+ onPrimary = Color.White,
+ onSecondary = Color.White,
+ onTertiary = Color.White,
+ onBackground = Color(0xFF1C1B1F),
+ onSurface = Color(0xFF1C1B1F),
+ */
+)
+
+@Composable
+fun Android_botTheme(
+ darkTheme: Boolean = isSystemInDarkTheme(),
+ // Dynamic color is available on Android 12+
+ dynamicColor: Boolean = true,
+ content: @Composable () -> Unit
+) {
+ val colorScheme = when {
+ dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
+ val context = LocalContext.current
+ if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
+ }
+
+ darkTheme -> DarkColorScheme
+ else -> LightColorScheme
+ }
+
+ MaterialTheme(
+ colorScheme = colorScheme,
+ typography = Typography,
+ content = content
+ )
+}
\ No newline at end of file
diff --git a/android_bot/app/src/main/java/com/siro/android_bot/ui/theme/Type.kt b/android_bot/app/src/main/java/com/siro/android_bot/ui/theme/Type.kt
new file mode 100644
index 0000000..6855eeb
--- /dev/null
+++ b/android_bot/app/src/main/java/com/siro/android_bot/ui/theme/Type.kt
@@ -0,0 +1,34 @@
+package com.siro.android_bot.ui.theme
+
+import androidx.compose.material3.Typography
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.font.FontFamily
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.unit.sp
+
+// Set of Material typography styles to start with
+val Typography = Typography(
+ bodyLarge = TextStyle(
+ fontFamily = FontFamily.Default,
+ fontWeight = FontWeight.Normal,
+ fontSize = 16.sp,
+ lineHeight = 24.sp,
+ letterSpacing = 0.5.sp
+ )
+ /* Other default text styles to override
+ titleLarge = TextStyle(
+ fontFamily = FontFamily.Default,
+ fontWeight = FontWeight.Normal,
+ fontSize = 22.sp,
+ lineHeight = 28.sp,
+ letterSpacing = 0.sp
+ ),
+ labelSmall = TextStyle(
+ fontFamily = FontFamily.Default,
+ fontWeight = FontWeight.Medium,
+ fontSize = 11.sp,
+ lineHeight = 16.sp,
+ letterSpacing = 0.5.sp
+ )
+ */
+)
\ No newline at end of file
diff --git a/android_bot/app/src/main/res/drawable/ic_launcher_background.xml b/android_bot/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..07d5da9
--- /dev/null
+++ b/android_bot/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android_bot/app/src/main/res/drawable/ic_launcher_foreground.xml b/android_bot/app/src/main/res/drawable/ic_launcher_foreground.xml
new file mode 100644
index 0000000..2b068d1
--- /dev/null
+++ b/android_bot/app/src/main/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android_bot/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android_bot/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..6f3b755
--- /dev/null
+++ b/android_bot/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android_bot/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/android_bot/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000..6f3b755
--- /dev/null
+++ b/android_bot/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android_bot/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/android_bot/app/src/main/res/mipmap-hdpi/ic_launcher.webp
new file mode 100644
index 0000000..c209e78
Binary files /dev/null and b/android_bot/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ
diff --git a/android_bot/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/android_bot/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..b2dfe3d
Binary files /dev/null and b/android_bot/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ
diff --git a/android_bot/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/android_bot/app/src/main/res/mipmap-mdpi/ic_launcher.webp
new file mode 100644
index 0000000..4f0f1d6
Binary files /dev/null and b/android_bot/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ
diff --git a/android_bot/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/android_bot/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..62b611d
Binary files /dev/null and b/android_bot/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ
diff --git a/android_bot/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/android_bot/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
new file mode 100644
index 0000000..948a307
Binary files /dev/null and b/android_bot/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ
diff --git a/android_bot/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/android_bot/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..1b9a695
Binary files /dev/null and b/android_bot/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ
diff --git a/android_bot/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/android_bot/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
new file mode 100644
index 0000000..28d4b77
Binary files /dev/null and b/android_bot/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ
diff --git a/android_bot/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/android_bot/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..9287f50
Binary files /dev/null and b/android_bot/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ
diff --git a/android_bot/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/android_bot/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
new file mode 100644
index 0000000..aa7d642
Binary files /dev/null and b/android_bot/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ
diff --git a/android_bot/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/android_bot/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..9126ae3
Binary files /dev/null and b/android_bot/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ
diff --git a/android_bot/app/src/main/res/values/colors.xml b/android_bot/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..f8c6127
--- /dev/null
+++ b/android_bot/app/src/main/res/values/colors.xml
@@ -0,0 +1,10 @@
+
+
+ #FFBB86FC
+ #FF6200EE
+ #FF3700B3
+ #FF03DAC5
+ #FF018786
+ #FF000000
+ #FFFFFFFF
+
\ No newline at end of file
diff --git a/android_bot/app/src/main/res/values/strings.xml b/android_bot/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..bc4152e
--- /dev/null
+++ b/android_bot/app/src/main/res/values/strings.xml
@@ -0,0 +1,4 @@
+
+ android_bot
+ Siro Scraper Accessibility Service helps automate competitor price checks.
+
\ No newline at end of file
diff --git a/android_bot/app/src/main/res/values/themes.xml b/android_bot/app/src/main/res/values/themes.xml
new file mode 100644
index 0000000..08c717f
--- /dev/null
+++ b/android_bot/app/src/main/res/values/themes.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/android_bot/app/src/main/res/xml/accessibility_service_config.xml b/android_bot/app/src/main/res/xml/accessibility_service_config.xml
new file mode 100644
index 0000000..cf6c11d
--- /dev/null
+++ b/android_bot/app/src/main/res/xml/accessibility_service_config.xml
@@ -0,0 +1,9 @@
+
+
diff --git a/android_bot/app/src/main/res/xml/backup_rules.xml b/android_bot/app/src/main/res/xml/backup_rules.xml
new file mode 100644
index 0000000..4df9255
--- /dev/null
+++ b/android_bot/app/src/main/res/xml/backup_rules.xml
@@ -0,0 +1,13 @@
+
+
+
+
\ No newline at end of file
diff --git a/android_bot/app/src/main/res/xml/data_extraction_rules.xml b/android_bot/app/src/main/res/xml/data_extraction_rules.xml
new file mode 100644
index 0000000..9ee9997
--- /dev/null
+++ b/android_bot/app/src/main/res/xml/data_extraction_rules.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android_bot/app/src/main/res/xml/network_security_config.xml b/android_bot/app/src/main/res/xml/network_security_config.xml
new file mode 100644
index 0000000..97de033
--- /dev/null
+++ b/android_bot/app/src/main/res/xml/network_security_config.xml
@@ -0,0 +1,8 @@
+
+
+
+ location.intaleq.xyz
+ intaleq.xyz
+ siromove.com
+
+
diff --git a/android_bot/app/src/test/java/com/siro/android_bot/ExampleUnitTest.kt b/android_bot/app/src/test/java/com/siro/android_bot/ExampleUnitTest.kt
new file mode 100644
index 0000000..974b805
--- /dev/null
+++ b/android_bot/app/src/test/java/com/siro/android_bot/ExampleUnitTest.kt
@@ -0,0 +1,17 @@
+package com.siro.android_bot
+
+import org.junit.Test
+
+import org.junit.Assert.*
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+class ExampleUnitTest {
+ @Test
+ fun addition_isCorrect() {
+ assertEquals(4, 2 + 2)
+ }
+}
\ No newline at end of file
diff --git a/android_bot/build.gradle.kts b/android_bot/build.gradle.kts
new file mode 100644
index 0000000..952b930
--- /dev/null
+++ b/android_bot/build.gradle.kts
@@ -0,0 +1,6 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+plugins {
+ alias(libs.plugins.android.application) apply false
+ alias(libs.plugins.kotlin.android) apply false
+ alias(libs.plugins.kotlin.compose) apply false
+}
\ No newline at end of file
diff --git a/android_bot/gradle.properties b/android_bot/gradle.properties
new file mode 100644
index 0000000..20e2a01
--- /dev/null
+++ b/android_bot/gradle.properties
@@ -0,0 +1,23 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. For more details, visit
+# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app's APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Kotlin code style for this project: "official" or "obsolete":
+kotlin.code.style=official
+# Enables namespacing of each library's R class so that its R class includes only the
+# resources declared in the library itself and none from the library's dependencies,
+# thereby reducing the size of the R class for that library
+android.nonTransitiveRClass=true
\ No newline at end of file
diff --git a/android_bot/gradle/libs.versions.toml b/android_bot/gradle/libs.versions.toml
new file mode 100644
index 0000000..fa3a5b3
--- /dev/null
+++ b/android_bot/gradle/libs.versions.toml
@@ -0,0 +1,32 @@
+[versions]
+agp = "8.13.2"
+kotlin = "2.0.21"
+coreKtx = "1.18.0"
+junit = "4.13.2"
+junitVersion = "1.3.0"
+espressoCore = "3.7.0"
+lifecycleRuntimeKtx = "2.10.0"
+activityCompose = "1.8.0"
+composeBom = "2024.09.00"
+
+[libraries]
+androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
+junit = { group = "junit", name = "junit", version.ref = "junit" }
+androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
+androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
+androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
+androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
+androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
+androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" }
+androidx-compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
+androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
+androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
+androidx-compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
+androidx-compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
+androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" }
+
+[plugins]
+android-application = { id = "com.android.application", version.ref = "agp" }
+kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
+kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
+
diff --git a/android_bot/gradle/wrapper/gradle-wrapper.jar b/android_bot/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..e708b1c
Binary files /dev/null and b/android_bot/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/android_bot/gradle/wrapper/gradle-wrapper.properties b/android_bot/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..07f8634
--- /dev/null
+++ b/android_bot/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Sun Jun 21 02:56:41 EET 2026
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/android_bot/gradlew b/android_bot/gradlew
new file mode 100755
index 0000000..4f906e0
--- /dev/null
+++ b/android_bot/gradlew
@@ -0,0 +1,185 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=`expr $i + 1`
+ done
+ case $i in
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+exec "$JAVACMD" "$@"
diff --git a/android_bot/gradlew.bat b/android_bot/gradlew.bat
new file mode 100644
index 0000000..ac1b06f
--- /dev/null
+++ b/android_bot/gradlew.bat
@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/android_bot/local.properties b/android_bot/local.properties
new file mode 100644
index 0000000..90a1645
--- /dev/null
+++ b/android_bot/local.properties
@@ -0,0 +1,10 @@
+## This file is automatically generated by Android Studio.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file should *NOT* be checked into Version Control Systems,
+# as it contains information specific to your local configuration.
+#
+# Location of the SDK. This is only used by Gradle.
+# For customization when using a Version Control System, please read the
+# header note.
+sdk.dir=/Users/hamzaaleghwairyeen/Library/Android/sdk
\ No newline at end of file
diff --git a/android_bot/settings.gradle.kts b/android_bot/settings.gradle.kts
new file mode 100644
index 0000000..b06b036
--- /dev/null
+++ b/android_bot/settings.gradle.kts
@@ -0,0 +1,23 @@
+pluginManagement {
+ repositories {
+ google {
+ content {
+ includeGroupByRegex("com\\.android.*")
+ includeGroupByRegex("com\\.google.*")
+ includeGroupByRegex("androidx.*")
+ }
+ }
+ mavenCentral()
+ gradlePluginPortal()
+ }
+}
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+
+rootProject.name = "android_bot"
+include(":app")
diff --git a/apps/driver/assets/images/logo.gif b/apps/driver/assets/images/logo.gif
index 7c8ef84..f505c82 100644
Binary files a/apps/driver/assets/images/logo.gif and b/apps/driver/assets/images/logo.gif differ
diff --git a/apps/driver/assets/images/logo.png b/apps/driver/assets/images/logo.png
index 7c8ef84..9852116 100644
Binary files a/apps/driver/assets/images/logo.png and b/apps/driver/assets/images/logo.png differ
diff --git a/apps/driver/assets/images/logo1.png b/apps/driver/assets/images/logo1.png
index 7c8ef84..eb862d0 100644
Binary files a/apps/driver/assets/images/logo1.png and b/apps/driver/assets/images/logo1.png differ
diff --git a/apps/driver/lib/constant/box_name.dart b/apps/driver/lib/constant/box_name.dart
index 6a6d25c..6e999dc 100755
--- a/apps/driver/lib/constant/box_name.dart
+++ b/apps/driver/lib/constant/box_name.dart
@@ -129,4 +129,18 @@ class BoxName {
static const String isBusMode = 'isBusMode';
static const String busModeTripId = 'busModeTripId';
static const String busModeRouteId = 'busModeRouteId';
+
+ // توفّر Google Play Services — يحدّد شراسة ملف تتبّع الموقع
+ // (بلا GMS يسقط الباكيج إلى LocationManager الخام: بطارية أعلى، دقة أقل)
+ static const String isGmsAvailable = 'isGmsAvailable';
+
+ // وضع التوصيل مفعّل — تقرأه العزلة الخلفية لتقرر فتح سوكيت الطعام
+ static const String foodDeliveryModeEnabled = 'foodDeliveryModeEnabled';
+
+ // معرّفات مهام التوصيل النشطة — يقرأها بثّ الموقع في LocationController
+ // فيستمر البثّ بعد إغلاق شاشة التوصيل
+ static const String foodActiveOrders = 'foodActiveOrders';
+
+ // بيانات اعتماد TURN المؤقتة (مكالمات الصوت) — مخزّنة حتى قرب انتهائها
+ static const String turnIceCache = 'turnIceCache';
}
diff --git a/apps/driver/lib/constant/country_polygons.dart b/apps/driver/lib/constant/country_polygons.dart
index d3e39eb..ab69315 100644
--- a/apps/driver/lib/constant/country_polygons.dart
+++ b/apps/driver/lib/constant/country_polygons.dart
@@ -69,14 +69,14 @@ class CountryPolygons {
static String getRoutingApiUrl(String countryName) {
switch (countryName) {
case 'Jordan':
- return 'https://routec.tripz.xyz/route-jo';
+ return 'https://routec.intaleq.xyz/route-jo';
case 'Syria':
- return 'https://routec.tripz.xyz/route';
+ return 'https://routec.intaleq.xyz/route';
case 'Egypt':
- return 'https://routec.tripz.xyz/route-eg';
+ return 'https://routec.intaleq.xyz/route-eg';
default:
// الافتراضي في حالة لم يقع الموقع ضمن أي من المضلعات
- return 'https://routec.tripz.xyz/route';
+ return 'https://routec.intaleq.xyz/route';
}
}
@@ -88,7 +88,7 @@ class CountryPolygons {
if (_isPointInPolygon(point, syriaBoundary)) return "Syria";
if (_isPointInPolygon(point, egyptBoundary)) return "Egypt";
- return "unsupported";
+ return "unsupported";
}
/// خوارزمية Ray Casting للتحقق من وقوع نقطة داخل مضلع
diff --git a/apps/driver/lib/constant/currency.dart b/apps/driver/lib/constant/currency.dart
index 1a56530..f6a2b75 100644
--- a/apps/driver/lib/constant/currency.dart
+++ b/apps/driver/lib/constant/currency.dart
@@ -1,5 +1,5 @@
-import 'package:tripz_driver/main.dart';
-import 'package:tripz_driver/constant/box_name.dart';
+import 'package:siro_driver/main.dart';
+import 'package:siro_driver/constant/box_name.dart';
import 'package:get/get.dart';
class CurrencyHelper {
diff --git a/apps/driver/lib/constant/finance_design_system.dart b/apps/driver/lib/constant/finance_design_system.dart
index 57f56af..8eea82b 100644
--- a/apps/driver/lib/constant/finance_design_system.dart
+++ b/apps/driver/lib/constant/finance_design_system.dart
@@ -1,44 +1,59 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
+import 'colors.dart';
+/// كان هذا نظام ألوان **ثانياً منافساً** لـ [AppColor]: نيفي `#0A0E21` وأزرق
+/// `#3D5AFE` بدل نيفي العلامة `#1A2340` والـ Periwinkle `#8C9CF8`. النتيجة أن
+/// صفحات المحفظة والأرباح والتحديات كانت تبدو من تطبيق آخر.
+///
+/// أُبقي الصنف باسمه حتى لا تتكسّر عشرات مواضع الاستدعاء، لكنه صار **واجهة
+/// رقيقة فوق ألوان العلامة**. الجديد يُكتب بـ `SiroUi` / `Theme.of(context)`.
class FinanceDesignSystem {
// --- Colors ---
- static Color get primaryDark => Get.isDarkMode ? const Color(0xFFE0E0E0) : const Color(0xFF0A0E21);
- static Color get accentBlue => const Color(0xFF3D5AFE);
- static Color get successGreen => const Color(0xFF00C853);
- static Color get dangerRed => const Color(0xFFD50000);
- static Color get backgroundColor => Get.isDarkMode ? const Color(0xFF0A0E21) : const Color(0xFFF6F8FA);
- static Color get cardColor => Get.isDarkMode ? const Color(0xFF1E1E2E) : const Color(0xFFFFFFFF);
- static Color get textSecondary => Get.isDarkMode ? Colors.white70 : const Color(0xFF757575);
- static Color get textMuted => Get.isDarkMode ? Colors.white38 : const Color(0xFFBDBDBD);
- static Color get borderColor => Get.isDarkMode ? Colors.white10 : Colors.grey.withOpacity(0.1);
+ static Color get primaryDark =>
+ Get.isDarkMode ? const Color(0xFFF1F5F9) : AppColor.primaryColor;
+ static Color get accentBlue =>
+ Get.isDarkMode ? AppColor.secondaryColorStatic : AppColor.primaryColor;
+ static Color get successGreen => AppColor.greenColor;
+ static Color get dangerRed => AppColor.redColor;
+ static Color get backgroundColor =>
+ Get.isDarkMode ? const Color(0xFF0F1424) : const Color(0xFFF6F8FA);
+ static Color get cardColor =>
+ Get.isDarkMode ? const Color(0xFF171D33) : const Color(0xFFFFFFFF);
+ static Color get textSecondary =>
+ Get.isDarkMode ? const Color(0xFF94A3B8) : const Color(0xFF64748B);
+ static Color get textMuted =>
+ Get.isDarkMode ? const Color(0xFF64748B) : const Color(0xFF94A3B8);
+ static Color get borderColor =>
+ Get.isDarkMode ? const Color(0xFF262E4A) : const Color(0xFFE6EAF0);
// --- Shadows ---
static BoxShadow get softShadow => BoxShadow(
- color: Colors.black.withOpacity(Get.isDarkMode ? 0.3 : 0.05),
- blurRadius: 10,
- offset: const Offset(0, 4),
- );
+ color: Colors.black.withValues(alpha: Get.isDarkMode ? 0.35 : 0.05),
+ blurRadius: 18,
+ offset: const Offset(0, 6),
+ );
// --- Gradients ---
+ /// تدرّج العلامة: نيفي ← Periwinkle. يُستعمل في بطاقات الرصيد والرؤوس.
static LinearGradient get balanceGradient => LinearGradient(
- colors: Get.isDarkMode
- ? [const Color(0xFF1E1E2E), const Color(0xFF2A2A3E)]
- : [const Color(0xFF0A0E21), const Color(0xFF1A237E)],
- begin: Alignment.topLeft,
- end: Alignment.bottomRight,
- );
+ colors: Get.isDarkMode
+ ? [const Color(0xFF1E2745), const Color(0xFF2E3A63)]
+ : [AppColor.primaryColor, const Color(0xFF3A4674)],
+ begin: Alignment.topLeft,
+ end: Alignment.bottomRight,
+ );
static const LinearGradient dangerGradient = LinearGradient(
- colors: [Color(0xFFD50000), Color(0xFFFF5252)],
+ colors: [AppColor.redColor, Color(0xFFF87171)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
);
// --- Radius ---
static const double mainRadius = 16.0;
- static const double cardRadius = 20.0;
- static const double buttonRadius = 12.0;
+ static const double cardRadius = 18.0;
+ static const double buttonRadius = 14.0;
// --- Spacing ---
static const double horizontalPadding = 16.0;
@@ -46,19 +61,19 @@ class FinanceDesignSystem {
// --- Text Styles ---
static TextStyle get balanceStyle => const TextStyle(
- fontSize: 32,
- fontWeight: FontWeight.bold,
- color: Colors.white,
- );
+ fontSize: 32,
+ fontWeight: FontWeight.bold,
+ color: Colors.white,
+ );
static TextStyle get headingStyle => TextStyle(
- fontSize: 18,
- fontWeight: FontWeight.bold,
- color: primaryDark,
- );
+ fontSize: 17,
+ fontWeight: FontWeight.bold,
+ color: primaryDark,
+ );
static TextStyle get subHeadingStyle => TextStyle(
- fontSize: 14,
- color: textSecondary,
- );
+ fontSize: 13,
+ color: textSecondary,
+ );
}
diff --git a/apps/driver/lib/constant/info.dart b/apps/driver/lib/constant/info.dart
index 4347478..2b8d5fc 100755
--- a/apps/driver/lib/constant/info.dart
+++ b/apps/driver/lib/constant/info.dart
@@ -1,12 +1,12 @@
class AppInformation {
- static const String companyName = 'Tripz';
- static const String appName = 'Tripz DRIVER';
- static const String appVersion = 'Tripz DRIVER';
+ static const String companyName = 'Siro';
+ static const String appName = 'Siro DRIVER';
+ static const String appVersion = 'Siro DRIVER';
static const String phoneNumber = '';
static const String linkedInProfile =
'https://www.linkedin.com/in/hamza-ayed/';
- static const String website = 'https://tripzapp.com';
- static const String email = 'support@tripzapp.com';
+ static const String website = 'https://siromove.com';
+ static const String email = 'support@siromove.com';
static const String complaintPrompt =
'for this data for complaint from driver or passenger i collect all data i want you analyze this complaint and show what is reason and what is solution .this data collected from many table to find solution if payment in visa not complete and if ride status is finished it will be paymnet in payment table if ride status is not finished there is no need to pay and payment table is null for this ride and if paymentFromPaymentTable not null and visa type not cash the payment sucssessed . if ratingpassenger is low or passengr rating drivers low grade then dont mine of this passenger ,look at driver too like passengerratingdriver with rating or ratingtopassenger .in json add status of complaint and message to passenger and message to driver and message to call center write in arabic in json output with key in english .for output please just json i want';
static const String addd = 'BlBlNl';
@@ -16,7 +16,7 @@ class AppInformation {
- Tripz - Privacy Policy & Terms of Use
+ Siro - Privacy Policy & Terms of Use