diff --git a/app/src/main/java/com/jordanbot/autoride/engine/RideDataMerger.kt b/app/src/main/java/com/jordanbot/autoride/engine/RideDataMerger.kt index de47d10..42c7a6f 100644 --- a/app/src/main/java/com/jordanbot/autoride/engine/RideDataMerger.kt +++ b/app/src/main/java/com/jordanbot/autoride/engine/RideDataMerger.kt @@ -33,11 +33,8 @@ object RideDataMerger { lastRequest = newPart lastTimestamp = now - // Wait a bit to see if more data comes from the other source before emitting - scope.launch { - delay(1500) // Wait 1.5s for the other source - emitIfReady() - } + // Speed optimization: If the very first source has the price, emit INSTANTLY. No delays. + emitIfReady() } else { // Merge into current lastRequest = current.copy( @@ -59,7 +56,7 @@ object RideDataMerger { // Criteria for "Ready": We have at least a price if (ride.priceJod != null) { - Log.d("JordanBot", "🔀 MERGED RIDE READY: $ride") + Log.d("JordanBot", "⚡ FLASH ACCEPT: RIDE READY IN MILLISECONDS: $ride") onRideReady?.invoke(ride) lastRequest = null // Clear to avoid double emission } diff --git a/app/src/main/java/com/jordanbot/autoride/parser/PetraRideParser.kt b/app/src/main/java/com/jordanbot/autoride/parser/PetraRideParser.kt index c6e2d75..255cd3f 100644 --- a/app/src/main/java/com/jordanbot/autoride/parser/PetraRideParser.kt +++ b/app/src/main/java/com/jordanbot/autoride/parser/PetraRideParser.kt @@ -3,8 +3,8 @@ package com.jordanbot.autoride.parser import com.jordanbot.autoride.model.RideRequest class PetraRideParser : NotificationParser { - // Note: Package name might vary (e.g. com.PetraRide_Captain), updating to generic if needed - override val packageName = "com.petraride.captain" + // Note: Official package name from Google Play Store + override val packageName = "com.PetraRide_Captain" override fun parse(title: String, text: String): RideRequest? { var price: Double? = null diff --git a/app/src/main/java/com/jordanbot/autoride/service/RideAccessibilityService.kt b/app/src/main/java/com/jordanbot/autoride/service/RideAccessibilityService.kt index 94e69d8..ec56562 100644 --- a/app/src/main/java/com/jordanbot/autoride/service/RideAccessibilityService.kt +++ b/app/src/main/java/com/jordanbot/autoride/service/RideAccessibilityService.kt @@ -35,7 +35,11 @@ class RideAccessibilityService : AccessibilityService() { } private fun isSupportedApp(pkg: String): Boolean { - return pkg == "com.ubercab.driver" || pkg == "com.careem.adma" || pkg == "me.jeeny.driver" + return pkg == "com.ubercab.driver" || + pkg == "com.careem.adma" || + pkg == "me.com.easytaxista" || // Jeeny + pkg == "com.PetraRide_Captain" || // Petra Ride + pkg == "com.taxif.driver" // TaxiF } private fun scrapeScreen(root: AccessibilityNodeInfo, pkg: String): RideRequest? { diff --git a/backend/api/rides.php b/backend/api/rides.php index b4147b7..a3cb46c 100644 --- a/backend/api/rides.php +++ b/backend/api/rides.php @@ -29,8 +29,8 @@ $platformInput = $input['platform'] ?? 'Unknown'; $platformMap = [ 'com.ubercab.driver' => 'Uber', 'com.careem.adma' => 'Careem', - 'me.jeeny.driver' => 'Jeeny', - 'com.petraride.driver' => 'Petra Ride', + 'me.com.easytaxista' => 'Jeeny', + 'com.PetraRide_Captain' => 'Petra Ride', 'com.taxif.driver' => 'TaxiF' ]; diff --git a/test_notifications.sh b/test_notifications.sh index 557ac91..2250930 100755 --- a/test_notifications.sh +++ b/test_notifications.sh @@ -3,20 +3,25 @@ # Make sure device is connected adb devices -echo "إرسال إشعار أوبر تجريبي..." +echo "إرسال إشعارات تجريبية..." + # Uber mock notification -adb shell cmd notification post -t "Uber" -S "bigtext" "1.50 JOD" "Pick up: Abdoun, 2 min, 0.5 km. Drop-off: 7th Circle. 1.50 JOD. Cash" com.ubercab.driver - +adb shell cmd notification post -t "Uber" -S "bigtext" "New Ride" "السعر: 2.50 JOD. الوقت: 5 min." com.ubercab.driver sleep 2 -echo "إرسال إشعار كريم تجريبي..." # Careem mock notification -adb shell cmd notification post -t "Careem" -S "bigtext" "New Ride" "Pickup in 3 mins. Expected fare JOD 2.00" com.careem.adma - +adb shell cmd notification post -t "Careem" -S "bigtext" "طلب جديد" "سعر الرحلة 3.0 دينار أردني. يبعد 8 دقائق." com.careem.adma sleep 2 -echo "إرسال إشعار جيني تجريبي..." # Jeeny mock notification -adb shell cmd notification post -t "Jeeny" -S "bigtext" "طلب جديد" "السعر: 1.20 دينار. المسافة: 1 كم" me.jeeny.driver +adb shell cmd notification post -t "Jeeny" -S "bigtext" "طلب جديد" "السعر: 1.20 دينار. المسافة: 1 كم" me.com.easytaxista +sleep 2 + +# Petra Ride mock notification +adb shell cmd notification post -t "Petra Ride" -S "bigtext" "تنبيه" "1.00 JOD" com.PetraRide_Captain +sleep 2 + +# TaxiF mock notification +adb shell cmd notification post -t "TaxiF" -S "bigtext" "رحلة جديدة" "السعر: 2 JOD" com.taxif.driver echo "تم إرسال الإشعارات التجريبية."