Fixes & Updates - 2026-06-01: Integrate Back-End v3 updates, fix call/connection issues across apps
This commit is contained in:
@@ -16,8 +16,9 @@ import '../../views/Rate/rate_captain.dart';
|
||||
import '../../views/home/map_page_passenger.dart';
|
||||
import '../../views/home/profile/promos_passenger_page.dart';
|
||||
import '../auth/google_sign.dart';
|
||||
import '../functions/audio_record1.dart';
|
||||
import '../home/map_passenger_controller.dart';
|
||||
import 'package:Intaleq/controller/voice_call_controller.dart';
|
||||
import '../home/map/ride_lifecycle_controller.dart';
|
||||
import '../home/map/ride_state.dart';
|
||||
import 'local_notification.dart';
|
||||
|
||||
class FirebaseMessagesController extends GetxController {
|
||||
@@ -105,8 +106,8 @@ class FirebaseMessagesController extends GetxController {
|
||||
// اقرأ "النوع" من حمولة البيانات، وليس من العنوان
|
||||
String category = message.data['category'] ?? '';
|
||||
|
||||
final mapCtrl = Get.isRegistered<MapPassengerController>()
|
||||
? Get.find<MapPassengerController>()
|
||||
final mapCtrl = Get.isRegistered<RideLifecycleController>()
|
||||
? Get.find<RideLifecycleController>()
|
||||
: null;
|
||||
// اقرأ العنوان (للعرض)
|
||||
String title = message.data['title'] ?? message.notification?.title ?? '';
|
||||
@@ -167,8 +168,8 @@ class FirebaseMessagesController extends GetxController {
|
||||
GoogleSignInHelper.signOut();
|
||||
} else if (category == 'Driver Is Going To Passenger') {
|
||||
// <-- كان 'Driver Is Going To Passenger'
|
||||
Get.find<MapPassengerController>().isDriverInPassengerWay = true;
|
||||
Get.find<MapPassengerController>().update();
|
||||
Get.find<RideLifecycleController>().isDriverInPassengerWay = true;
|
||||
Get.find<RideLifecycleController>().update();
|
||||
if (Platform.isAndroid) {
|
||||
notificationController.showNotification(title, body, 'tone1');
|
||||
}
|
||||
@@ -214,7 +215,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
}
|
||||
|
||||
if (driverList.isNotEmpty) {
|
||||
Get.find<MapPassengerController>()
|
||||
Get.find<RideLifecycleController>()
|
||||
.processRideFinished(driverList, source: "FCM");
|
||||
}
|
||||
} else if (category == 'Finish Monitor') {
|
||||
@@ -232,9 +233,9 @@ class FirebaseMessagesController extends GetxController {
|
||||
Log.print("🔔 FCM: Ride Cancelled by Driver received.");
|
||||
|
||||
// لا داعي لكتابة منطق التنظيف هنا، الكنترولر يتكفل بكل شيء
|
||||
if (Get.isRegistered<MapPassengerController>()) {
|
||||
if (Get.isRegistered<RideLifecycleController>()) {
|
||||
// استدعاء الحارس (سيتجاهل الأمر إذا كان السوكيت قد سبقه)
|
||||
Get.find<MapPassengerController>()
|
||||
Get.find<RideLifecycleController>()
|
||||
.processRideCancelledByDriver(message.data, source: "FCM");
|
||||
}
|
||||
|
||||
@@ -247,6 +248,19 @@ class FirebaseMessagesController extends GetxController {
|
||||
// ... (باقي الحالات مثل Call Income, Call End, إلخ) ...
|
||||
// ... بنفس الطريقة ...
|
||||
|
||||
else if (category == 'incoming_call') {
|
||||
final sessionId = message.data['session_id'];
|
||||
final callerName = message.data['caller_name'];
|
||||
final rideId = message.data['ride_id'];
|
||||
if (sessionId != null && callerName != null && rideId != null) {
|
||||
Get.find<VoiceCallController>().receiveCall(
|
||||
sessionIdVal: sessionId.toString(),
|
||||
remoteNameVal: callerName.toString(),
|
||||
rideIdVal: rideId.toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
else if (category == 'Order Applied') {
|
||||
if (Platform.isAndroid) {
|
||||
notificationController.showNotification(
|
||||
@@ -277,7 +291,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
// var myList = jsonDecode(driverListJson) as List<dynamic>;
|
||||
// Log.print('myList: ${myList}');
|
||||
|
||||
// final controller = Get.find<MapPassengerController>();
|
||||
// final controller = Get.find<RideLifecycleController>();
|
||||
|
||||
// // استدعاء الدالة الموحدة الجديدة التي أنشأناها
|
||||
// await controller.processRideAcceptance(
|
||||
@@ -311,8 +325,8 @@ class FirebaseMessagesController extends GetxController {
|
||||
// }
|
||||
// GoogleSignInHelper.signOut();
|
||||
// } else if (message.notification!.title! == 'Driver Is Going To Passenger') {
|
||||
// Get.find<MapPassengerController>().isDriverInPassengerWay = true;
|
||||
// Get.find<MapPassengerController>().update();
|
||||
// Get.find<RideLifecycleController>().isDriverInPassengerWay = true;
|
||||
// Get.find<RideLifecycleController>().update();
|
||||
// if (Platform.isAndroid) {
|
||||
// notificationController.showNotification('Driver is Going To You'.tr,
|
||||
// 'Please stay on the picked point.'.tr, 'tone1');
|
||||
@@ -341,13 +355,13 @@ class FirebaseMessagesController extends GetxController {
|
||||
|
||||
// // (تم حذف الإشعار المحلي من هنا، نُقل إلى الدالة الموحدة)
|
||||
|
||||
// final controller = Get.find<MapPassengerController>();
|
||||
// final controller = Get.find<RideLifecycleController>();
|
||||
|
||||
// // استدعاء حارس البوابة الجديد والآمن
|
||||
// controller.processRideBegin();
|
||||
|
||||
// // (تم حذف كل الأوامر التالية من هنا)
|
||||
// // Get.find<MapPassengerController>().getBeginRideFromDriver();
|
||||
// // Get.find<RideLifecycleController>().getBeginRideFromDriver();
|
||||
// // box.write(BoxName.passengerWalletTotal, '0');
|
||||
// // update();
|
||||
// } else if (message.notification!.title! == 'Hi ,I will go now'.tr) {
|
||||
@@ -360,7 +374,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
// update();
|
||||
// } // ... داخل معالج الإشعارات (FCM Handler) ...
|
||||
// if (message.notification!.title! == 'Hi ,I Arrive your site'.tr) {
|
||||
// final controller = Get.find<MapPassengerController>();
|
||||
// final controller = Get.find<RideLifecycleController>();
|
||||
|
||||
// // 1. التأكد أننا في الحالة الصحيحة (السائق كان في الطريق)
|
||||
// if (controller.currentRideState.value == RideState.driverApplied) {
|
||||
@@ -383,7 +397,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
// title: 'Ok'.tr,
|
||||
// onPressed: () async {
|
||||
// Get.back();
|
||||
// await Get.find<MapPassengerController>()
|
||||
// await Get.find<RideLifecycleController>()
|
||||
// .reSearchAfterCanceledFromDriver();
|
||||
// },
|
||||
// ),
|
||||
@@ -394,7 +408,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
// Get.offAll(() => const MapPagePassenger());
|
||||
// },
|
||||
// )
|
||||
// // Get.find<MapPassengerController>()
|
||||
// // Get.find<RideLifecycleController>()
|
||||
// // .searchNewDriverAfterRejectingFromDriver();
|
||||
// );
|
||||
// } else if (message.notification!.title! == 'Driver Finish Trip'.tr) {
|
||||
@@ -434,7 +448,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
// box.write(BoxName.passengerWalletTotal, 0);
|
||||
// }
|
||||
|
||||
// Get.find<MapPassengerController>().tripFinishedFromDriver();
|
||||
// Get.find<RideLifecycleController>().tripFinishedFromDriver();
|
||||
|
||||
// NotificationController().showNotification(
|
||||
// 'Don’t forget your personal belongings.'.tr,
|
||||
@@ -535,7 +549,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
// box.write(BoxName.parentTripSelected, false);
|
||||
// box.remove(BoxName.tokenParent);
|
||||
|
||||
// Get.find<MapPassengerController>().restCounter();
|
||||
// Get.find<RideLifecycleController>().restCounter();
|
||||
// Get.offAll(() => const MapPagePassenger());
|
||||
// }
|
||||
// // else if (message.notification!.title! == 'Order Applied') {
|
||||
@@ -595,8 +609,8 @@ class FirebaseMessagesController extends GetxController {
|
||||
// Get.find<FirebaseMessagesController>().sendNotificationToPassengerToken(
|
||||
// 'Hi ,I will go now'.tr,
|
||||
// 'I will go now'.tr,
|
||||
// Get.find<MapPassengerController>().driverToken, []);
|
||||
// Get.find<MapPassengerController>()
|
||||
// Get.find<RideLifecycleController>().driverToken, []);
|
||||
// Get.find<RideLifecycleController>()
|
||||
// .startTimerDriverWaitPassenger5Minute();
|
||||
|
||||
Get.back();
|
||||
@@ -639,12 +653,12 @@ class DriverTipWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<MapPassengerController>(builder: (controller) {
|
||||
return GetBuilder<RideLifecycleController>(builder: (controller) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
// Text(
|
||||
// '${'Your fee is '.tr}${Get.find<MapPassengerController>().totalPassenger.toStringAsFixed(2)}'),
|
||||
// '${'Your fee is '.tr}${Get.find<RideLifecycleController>().totalPassenger.toStringAsFixed(2)}'),
|
||||
Text(
|
||||
'Do you want to pay Tips for this Driver'.tr,
|
||||
textAlign: TextAlign.center,
|
||||
|
||||
Reference in New Issue
Block a user