This commit is contained in:
Hamza-Ayed
2024-11-12 00:45:23 +02:00
parent 213c2724aa
commit bf8a29b814
8 changed files with 156 additions and 81 deletions

View File

@@ -67,7 +67,7 @@ class FirebaseMessagesController extends GetxController {
}
NotificationController notificationController =
Get.find<NotificationController>();
Get.put(NotificationController());
Future getTokens() async {
String? basicAuthCredentials =
@@ -126,7 +126,11 @@ class FirebaseMessagesController extends GetxController {
notificationController.showNotification(
'Order', message.notification!.body!, 'Order');
}
} else if (message.notification!.title! == 'Apply Ride'.tr) {
} else if (message.notification!.title! == 'Accepted Ride') {
if (Platform.isAndroid) {
notificationController.showNotification(
'Apply Order'.tr, 'Driver Applied the Ride for You'.tr, 'ding');
}
var passengerList = message.data['passengerList'];
var myList = jsonDecode(passengerList) as List<dynamic>;
@@ -135,12 +139,7 @@ class FirebaseMessagesController extends GetxController {
Get.find<MapPassengerController>().statusRide == 'Apply';
Get.find<MapPassengerController>().isSearchingWindow == false;
Get.find<MapPassengerController>().update();
if (Platform.isAndroid) {
notificationController.showNotification(
'Apply Order'.tr, 'Driver Applied the Ride for You'.tr, 'order1');
//notificationController.showNotification(
// 'Apply Order'.tr, 'Driver Applied the Ride for You'.tr, 'order1');
}
// driverAppliedTripSnakBar();
} else if (message.notification!.title! == 'Promo'.tr) {
if (Platform.isAndroid) {
@@ -177,7 +176,7 @@ class FirebaseMessagesController extends GetxController {
} else if (message.notification!.title! == 'message From passenger') {
if (Platform.isAndroid) {
notificationController.showNotification(
'message From passenger'.tr, ''.tr, 'tone2');
'message From passenger'.tr, ''.tr, 'ding');
}
passengerDialog(message.notification!.body!);
@@ -185,7 +184,7 @@ class FirebaseMessagesController extends GetxController {
} else if (message.notification!.title! == 'message From Driver') {
if (Platform.isAndroid) {
notificationController.showNotification(
'message From passenger'.tr, ''.tr, 'tone2');
'message From Driver'.tr, ''.tr, 'ding');
}
passengerDialog(message.notification!.body!);
@@ -204,19 +203,23 @@ class FirebaseMessagesController extends GetxController {
// backgroundColor: AppColor.greenColor);
if (Platform.isAndroid) {
notificationController.showNotification(
'Passenger come to you'.tr, 'Hi ,I will go now'.tr, 'tone2');
'Passenger come to you'.tr, 'Hi ,I will go now'.tr, 'ding');
}
update();
} else if (message.notification!.title! == 'Hi ,I Arrive your site'.tr) {
driverArrivePassengerDialoge();
} else if (message.notification!.title! == 'Hi ,I Arrive your site') {
if (Platform.isAndroid) {
notificationController.showNotification(
'Hi ,I Arrive your site'.tr, ''.tr, 'tone2');
'Hi ,I Arrive your site'.tr, ''.tr, 'ding');
}
driverArrivePassengerDialoge();
update();
} else if (message.notification!.title! == "Cancel Trip from driver".tr) {
Get.back();
if (Platform.isAndroid) {
notificationController.showNotification("Cancel Trip from driver".tr,
"We will look for a new driver.\nPlease wait.".tr, 'cancel');
}
Get.defaultDialog(
title: "The driver canceled your ride.".tr,
middleText: "We will look for a new driver.\nPlease wait.".tr,
@@ -321,13 +324,13 @@ class FirebaseMessagesController extends GetxController {
notificationController.showNotification(
'Call End'.tr,
message.notification!.body!,
'tone2',
'ding',
);
}
// Assuming GetMaterialApp is initialized and context is valid for navigation
// Get.off(const CallPage());
} catch (e) {}
} else if (message.notification!.title! == 'Driver Cancel Your Trip'.tr) {
} else if (message.notification!.title! == 'Driver Cancelled Your Trip') {
// Get.snackbar(
// 'You will be pay the cost to driver or we will get it from you on next trip'
// .tr,
@@ -335,7 +338,7 @@ class FirebaseMessagesController extends GetxController {
// backgroundColor: AppColor.redColor);
if (Platform.isAndroid) {
notificationController.showNotification(
'Driver Cancel Your Trip'.tr,
'Driver Cancelled Your Trip'.tr,
'you will pay to Driver you will be pay the cost of driver time look to your SEFER Wallet'
.tr,
'cancel');
@@ -344,7 +347,7 @@ class FirebaseMessagesController extends GetxController {
box.remove(BoxName.tokenParent);
Get.find<MapPassengerController>().restCounter();
Get.offAll(const MapPagePassenger());
Get.offAll(() => const MapPagePassenger());
}
// else if (message.notification!.title! == 'Order Applied') {
// Get.snackbar(
@@ -401,7 +404,7 @@ class FirebaseMessagesController extends GetxController {
title: 'Ok I will go now.'.tr,
onPressed: () {
FirebaseMessagesController().sendNotificationToPassengerToken(
'Hi ,I will go now'.tr,
'Hi ,I will go now',
'I will go now'.tr,
Get.find<MapPassengerController>().driverToken,
[],
@@ -418,7 +421,7 @@ class FirebaseMessagesController extends GetxController {
Future<dynamic> passengerDialog(String message) {
return Get.defaultDialog(
barrierDismissible: false,
title: 'message From passenger'.tr,
title: 'message From Driver'.tr,
titleStyle: AppStyle.title,
middleTextStyle: AppStyle.title,
middleText: message.tr,