Update: 2026-07-23 20:43:21
This commit is contained in:
@@ -154,15 +154,21 @@ class FirebaseMessagesController extends GetxController {
|
||||
driverToken = myList[14].toString();
|
||||
Get.put(HomeCaptainController(), permanent: true).changeRideId();
|
||||
update();
|
||||
Get.toNamed('/OrderRequestPage', arguments: {
|
||||
'myListString': myListString,
|
||||
'DriverList': myList,
|
||||
'body': body,
|
||||
'is_destination_match': message.data['is_destination_match'] ?? '0',
|
||||
// 🆕 "أرباحك أعلى" — يُرسَل فقط عند وجود فرق إيجابي حقيقي
|
||||
'driver_earnings_extra': message.data['driver_earnings_extra'],
|
||||
'driver_earnings_currency': message.data['driver_earnings_currency'],
|
||||
});
|
||||
|
||||
if (Get.currentRoute != '/OrderRequestPage') {
|
||||
Log.print("🚀 FCM: Navigating to OrderRequestPage...");
|
||||
Get.toNamed('/OrderRequestPage', arguments: {
|
||||
'myListString': myListString,
|
||||
'DriverList': myList,
|
||||
'body': body,
|
||||
'is_destination_match': message.data['is_destination_match'] ?? '0',
|
||||
// 🆕 "أرباحك أعلى" — يُرسَل فقط عند وجود فرق إيجابي حقيقي
|
||||
'driver_earnings_extra': message.data['driver_earnings_extra'],
|
||||
'driver_earnings_currency': message.data['driver_earnings_currency'],
|
||||
});
|
||||
} else {
|
||||
Log.print("⚠️ [FCM] User is already on OrderRequestPage. Skipping navigation.");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -232,13 +232,20 @@ Future<void> backgroundMessageHandler(RemoteMessage message) async {
|
||||
);
|
||||
|
||||
bool isAppInForeground = box.read(BoxName.isAppInForeground) ?? false;
|
||||
String? currentRideStatus = box.read(BoxName.rideStatus);
|
||||
bool hasActiveRide = (currentRideStatus == 'Begin' ||
|
||||
currentRideStatus == 'Apply' ||
|
||||
currentRideStatus == 'Arrived');
|
||||
|
||||
if (!isAppInForeground) {
|
||||
await TripOverlayPlugin.showOverlay(tripData, autoCloseSeconds: 15);
|
||||
if (!hasActiveRide) {
|
||||
if (!isAppInForeground) {
|
||||
await TripOverlayPlugin.showOverlay(tripData, autoCloseSeconds: 15);
|
||||
}
|
||||
// 🔴 الكتابة على القرص مباشرة بدلاً من الرام لضمان انتقالها للتطبيق 🔴
|
||||
await storage.write(key: 'pending_driver_list', value: myListString);
|
||||
} else {
|
||||
print("⛔ [Background FCM] Ignoring new order overlay - driver is in active ride ($currentRideStatus)");
|
||||
}
|
||||
|
||||
// 🔴 الكتابة على القرص مباشرة بدلاً من الرام لضمان انتقالها للتطبيق 🔴
|
||||
await storage.write(key: 'pending_driver_list', value: myListString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user