This commit is contained in:
Hamza-Ayed
2024-02-07 21:45:20 +03:00
parent 57d0560a8c
commit d4d4592944

View File

@@ -102,47 +102,45 @@ class FirebaseMessagesController extends GetxController {
});
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
if (message.data.isNotEmpty) {
if (message.notification != null && message.data.isNotEmpty) {
fireBaseTitles(message);
}
// If the app is in the background or terminated, show a system tray message
RemoteNotification? notification = message.notification;
AndroidNotification? android = notification?.android;
// if (notification != null && android != null) {
if (notification != null && android != null) {
// print('onMessageOpenedApp: ${notification.title} ${notification.body}');
if (message.data.isNotEmpty) {
fireBaseTitles(message);
}
if (message.data.isNotEmpty) {
fireBaseTitles(message);
}
});
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
// print(
// 'onMessageOpenedApp: ${message.notification!.title} ${message.notification!.body}');
RemoteNotification? notification = message.notification;
fireBaseTitles(message);
});
// FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
// // print(
// // 'onMessageOpenedApp: ${message.notification!.title} ${message.notification!.body}');
// RemoteNotification? notification = message.notification;
// fireBaseTitles(message);
// });
}
void fireBaseTitles(RemoteMessage message) {
if (message.notification!.title!.contains('Order')) {
if (message.notification!.title! == 'Order') {
var myListString = message.data['DriverList'];
print(myListString);
print('9999999999999myListString999999999999999');
// print(myListString);
// print('9999999999999myListString999999999999999');
var myList = jsonDecode(myListString) as List<dynamic>;
driverToken = myList[14].toString();
update();
print('driverToken==============$driverToken');
// print('driverToken==============$driverToken');
Get.to(() => OrderRequestPage(), arguments: {
'myListString': myListString,
'DriverList': myList,
'body': message.notification!.body
});
} else if (message.notification!.title!.contains('Apply Ride')) {
} else if (message.notification!.title! == 'Apply Ride') {
var passengerList = message.data['passengerList'];
print(passengerList);
print('9999999999999my Apply Ride 999999999999999');
// print(passengerList);
// print('9999999999999my Apply Ride 999999999999999');
var myList = jsonDecode(passengerList) as List<dynamic>;
driverID = myList[2].toString();
@@ -165,7 +163,7 @@ class FirebaseMessagesController extends GetxController {
margin: const EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
);
} else if (message.notification!.title!.contains('Promo')) {
} else if (message.notification!.title! == 'Promo') {
Get.to(const PromosPassengerPage());
} else if (message.notification!.title == 'Cancel Trip') {
Get.defaultDialog(
@@ -176,24 +174,17 @@ class FirebaseMessagesController extends GetxController {
onPressed: () {
Get.offAll(HomeCaptain());
}));
} else if (message.notification!.title!
.contains('DriverIsGoingToPassenger')) {
} else if (message.notification!.title! == 'DriverIsGoingToPassenger') {
Get.snackbar('Driver is Going To Passenger', '',
backgroundColor: AppColor.greenColor);
} else if (message.notification!.title!.contains('RideIsBegin')) {
// MapPassengerController mapController = Get.put(MapPassengerController());
} else if (message.notification!.title! == 'RideIsBegin') {
Get.snackbar('RideIsBegin', '', backgroundColor: AppColor.greenColor);
// mapController.driverArrivePassenger();
update();
} else if (message.notification!.title!.contains('Hi ,I will go now')) {
// MapPassengerController mapController = Get.put(MapPassengerController());
} else if (message.notification!.title! == 'Hi ,I will go now') {
Get.snackbar('Hi ,I will go now', '',
backgroundColor: AppColor.greenColor);
// mapController.driverArrivePassenger();
update();
} else if (message.notification!.title!
.contains('Hi ,I Arrive your site')) {
// MapPassengerController mapController = Get.put(MapPassengerController());
} else if (message.notification!.title! == 'Hi ,I Arrive your site') {
Get.defaultDialog(
barrierDismissible: false,
title: 'Hi ,I Arrive your site'.tr,