This commit is contained in:
Hamza-Ayed
2024-09-11 10:10:18 +03:00
parent 8a9d270672
commit 98ee34490c
13 changed files with 373 additions and 202 deletions

View File

@@ -18,6 +18,7 @@ import '../../views/auth/captin/criminal_documents_page.dart';
import '../../views/home/Captin/home_captain/home_captin.dart';
import '../../views/home/Captin/orderCaptin/order_speed_request.dart';
import '../../views/home/Captin/orderCaptin/order_request_page.dart';
import '../../views/home/Captin/orderCaptin/vip_order_page.dart';
import '../auth/google_sign.dart';
import '../functions/face_detect.dart';
import 'access_token.dart';
@@ -80,28 +81,28 @@ class FirebaseMessagesController extends GetxController {
}
});
FirebaseMessaging.onBackgroundMessage((RemoteMessage message) async {
if (message.notification!.title! == 'Order'.tr) {
if (Platform.isAndroid) {
NotificationController()
.showNotification('Order'.tr, '', 'order', 'order_page_payload');
}
// await FirebaseMessagesController().showOverlayNotification(message);
var myListString = message.data['DriverList'];
// var points = message.data['PolylineJson'];
// if (message.notification!.title! == 'Order'.tr) {
// if (Platform.isAndroid) {
// NotificationController()
// .showNotification('Order'.tr, '', 'order', 'order_page_payload');
// }
// // await FirebaseMessagesController().showOverlayNotification(message);
// var myListString = message.data['DriverList'];
// // var points = message.data['PolylineJson'];
var myList = jsonDecode(myListString) as List<dynamic>;
// var myPoints = jsonDecode(points) as List<dynamic>;
driverToken = myList[14].toString();
// This is for location using and uploading status
Get.put(HomeCaptainController()).changeRideId();
update();
Get.to(() => OrderRequestPage(), arguments: {
'myListString': myListString,
'DriverList': myList,
// 'PolylineJson': myPoints,
'body': message.notification!.body
});
}
// var myList = jsonDecode(myListString) as List<dynamic>;
// // var myPoints = jsonDecode(points) as List<dynamic>;
// driverToken = myList[14].toString();
// // This is for location using and uploading status
// Get.put(HomeCaptainController()).changeRideId();
// update();
// Get.to(() => OrderRequestPage(), arguments: {
// 'myListString': myListString,
// 'DriverList': myList,
// // 'PolylineJson': myPoints,
// 'body': message.notification!.body
// });
// }
});
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
@@ -138,6 +139,23 @@ class FirebaseMessagesController extends GetxController {
// 'Cancel Trip'.tr, 'Passenger Cancel Trip'.tr, 'cancel', '');
// }
cancelTripDialog();
} else if (message.notification!.title == 'VIP Order') {
var myListString = message.data['DriverList'];
var driverList = jsonDecode(myListString) as List<dynamic>;
if (Platform.isAndroid) {
NotificationController()
.showNotification('VIP Order'.tr, '', 'order', '');
}
MyDialog().getDialog('VIP Order'.tr, 'midTitle', () {
sendNotificationToPassengerToken(
'VIP Order Accepted'.tr,
'The driver accepted your trip'.tr,
driverList[0],
[driverList[1]],
'order');
});
// Get.to(const VipOrderPage());
} else if (message.notification!.title == 'Cancel') {
cancelTripDialog1();
} else if (message.notification!.title! == 'token change') {