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