This commit is contained in:
Hamza-Ayed
2024-06-30 13:27:23 +03:00
parent 08d31bc4d1
commit 176f5105b1
25 changed files with 465 additions and 154 deletions

View File

@@ -159,6 +159,12 @@ class FirebaseMessagesController extends GetxController {
.showNotification('message From passenger'.tr, ''.tr, 'tone2');
passengerDialog(message.notification!.body!);
update();
} else if (message.notification!.title! == 'message From Driver'.tr) {
NotificationController()
.showNotification('message From passenger'.tr, ''.tr, 'tone2');
passengerDialog(message.notification!.body!);
update();
} else if (message.notification!.title! == 'RideIsBegin') {
Get.find<MapPassengerController>().getBeginRideFromDriver();
@@ -332,7 +338,9 @@ class FirebaseMessagesController extends GetxController {
FirebaseMessagesController().sendNotificationToPassengerToken(
'Hi ,I will go now'.tr,
'I will go now'.tr,
Get.find<MapPassengerController>().driverToken, []);
Get.find<MapPassengerController>().driverToken,
[],
'ding.wav');
Get.find<MapPassengerController>()
.startTimerDriverWaitPassenger5Minute();
@@ -412,7 +420,7 @@ class FirebaseMessagesController extends GetxController {
'notification': <String, dynamic>{
'title': title,
'body': body,
'sound': 'start.wav'
'sound': 'ding.wav'
},
'priority': 'high',
'data': <String, dynamic>{
@@ -455,7 +463,7 @@ class FirebaseMessagesController extends GetxController {
// }
void sendNotificationToPassengerToken(
String title, body, token, List<String> map) async {
String title, body, token, List<String> map, String tone) async {
try {
final response = await http.post(
Uri.parse('https://fcm.googleapis.com/fcm/send'),
@@ -467,7 +475,7 @@ class FirebaseMessagesController extends GetxController {
'notification': <String, dynamic>{
'title': title,
'body': body,
'sound': 'tone2.wav'
'sound': tone
},
'data': {
'passengerList': map,
@@ -489,7 +497,7 @@ class FirebaseMessagesController extends GetxController {
}
void sendNotificationToAnyWithoutData(
String title, String body, String token) async {
String title, String body, String token, String tone) async {
try {
final response = await http.post(
Uri.parse('https://fcm.googleapis.com/fcm/send'),
@@ -501,7 +509,7 @@ class FirebaseMessagesController extends GetxController {
'notification': <String, dynamic>{
'title': title,
'body': body,
'sound': 'promo.wav'
'sound': tone
},
'data': <String, dynamic>{
'click_action': 'FLUTTER_NOTIFICATION_CLICK',
@@ -524,8 +532,8 @@ class FirebaseMessagesController extends GetxController {
}
}
void sendNotificationToDriverMAP(
String title, String body, String token, List<String> data) async {
void sendNotificationToDriverMAP(String title, String body, String token,
List<String> data, String tone) async {
try {
final response = await http.post(
Uri.parse('https://fcm.googleapis.com/fcm/send'),
@@ -538,7 +546,7 @@ class FirebaseMessagesController extends GetxController {
'title': title,
'body': body,
// 'sound': 'tone2.wav',
'sound': 'order.wav'
'sound': tone
},
'data': {
'DriverList': data,