This commit is contained in:
Hamza Aleghwairyeen
2024-04-10 02:42:17 +03:00
parent 8ca9e65f4c
commit 88b671c112
23 changed files with 564 additions and 241 deletions

View File

@@ -147,38 +147,44 @@ class FirebaseMessagesController extends GetxController {
driverID = myList[2].toString();
NotificationController().showNotification(
'Apply Order'.tr, 'Driver Applied the Ride for You'.tr, 'order');
'Apply Order'.tr, 'Driver Applied the Ride for You'.tr, 'order1');
// driverAppliedTripSnakBar();
} else if (message.notification!.title! == 'Promo') {
NotificationController()
.showNotification('Promo', 'Show latest promo'.tr, 'order');
.showNotification('Promo', 'Show latest promo'.tr, 'promo');
Get.to(const PromosPassengerPage());
} else if (message.notification!.title == 'Cancel Trip') {
NotificationController().showNotification(
'Cancel Trip'.tr, 'Passenger Cancel Trip'.tr, 'order');
'Cancel Trip'.tr, 'Passenger Cancel Trip'.tr, 'cancel');
cancelTripDialog();
} else if (message.notification!.title! == 'DriverIsGoingToPassenger') {
Get.find<MapPassengerController>().isDriverInPassengerWay = true;
Get.find<MapPassengerController>().update();
NotificationController().showNotification('Driver is Going To You'.tr,
'Please stay on the picked point.'.tr, 'order');
'Please stay on the picked point.'.tr, 'tone1');
// Get.snackbar('Driver is Going To Passenger', '',
// backgroundColor: AppColor.greenColor);
} else if (message.notification!.title! == 'message From passenger') {
NotificationController()
.showNotification('message From passenger'.tr, ''.tr, 'tone2');
passengerDialog(message.notification!.body!);
update();
} else if (message.notification!.title! == 'RideIsBegin') {
Get.find<MapPassengerController>().getBeginRideFromDriver();
// Get.snackbar('RideIsBegin', '', backgroundColor: AppColor.greenColor);
NotificationController()
.showNotification('Trip is Begin'.tr, ''.tr, 'order');
.showNotification('Trip is Begin'.tr, ''.tr, 'start');
update();
} else if (message.notification!.title! == 'Hi ,I will go now') {
// Get.snackbar('Hi ,I will go now', '',
// backgroundColor: AppColor.greenColor);
NotificationController().showNotification(
'Passenger come to you'.tr, 'Hi ,I will go now'.tr, 'order');
'Passenger come to you'.tr, 'Hi ,I will go now'.tr, 'tone2');
update();
} else if (message.notification!.title! == 'Hi ,I Arrive your site') {
NotificationController()
.showNotification('Hi ,I Arrive your site'.tr, ''.tr, 'order');
.showNotification('Hi ,I Arrive your site'.tr, ''.tr, 'tone2');
driverArrivePassengerDialoge();
update();
@@ -188,7 +194,7 @@ class FirebaseMessagesController extends GetxController {
NotificationController().showNotification(
'Driver Finish Trip'.tr,
'you will pay to Driver'.tr + ' ${driverList[3].toString()} \$'.tr,
'order');
'tone1');
Get.find<MapPassengerController>().tripFinishedFromDriver();
if (Get.find<PaymentController>().isCashChecked == false &&
Get.find<PaymentController>().isWalletChecked == true) {
@@ -204,13 +210,13 @@ class FirebaseMessagesController extends GetxController {
try {
var myListString = message.data['passengerList'];
var driverList = jsonDecode(myListString) as List<dynamic>;
if (Platform.isAndroid) {
NotificationController().showNotification(
'Call Income'.tr,
message.notification!.body!,
'order',
);
}
// if (Platform.isAndroid) {
NotificationController().showNotification(
'Call Income'.tr,
message.notification!.body!,
'iphone_ringtone',
);
// }
// Assuming GetMaterialApp is initialized and context is valid for navigation
Get.to(() => PassengerCallPage(
channelName: driverList[1].toString(),
@@ -228,7 +234,7 @@ class FirebaseMessagesController extends GetxController {
NotificationController().showNotification(
'Call End'.tr,
message.notification!.body!,
'order',
'tone2',
);
}
// Assuming GetMaterialApp is initialized and context is valid for navigation
@@ -242,11 +248,14 @@ class FirebaseMessagesController extends GetxController {
// .tr,
// 'message',
// backgroundColor: AppColor.redColor);
NotificationController().showNotification(
'Driver Cancel Your Trip'.tr,
'you will pay to Driver you will be pay the cost of driver time look to your SEFER Wallet'
.tr,
'order');
if (Platform.isAndroid) {
NotificationController().showNotification(
'Driver Cancel Your Trip'.tr,
'you will pay to Driver you will be pay the cost of driver time look to your SEFER Wallet'
.tr,
'order');
}
Get.find<MapPassengerController>().restCounter();
Get.offAll(const MapPagePassenger());
} else if (message.notification!.title! == 'Order Applied') {
@@ -335,6 +344,25 @@ class FirebaseMessagesController extends GetxController {
}));
}
Future<dynamic> passengerDialog(String message) {
return Get.defaultDialog(
barrierDismissible: false,
title: 'message From passenger'.tr,
middleText: message.tr,
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
// FirebaseMessagesController().sendNotificationToPassengerToken(
// 'Hi ,I will go now'.tr,
// 'I will go now'.tr,
// Get.find<MapPassengerController>().driverToken, []);
// Get.find<MapPassengerController>()
// .startTimerDriverWaitPassenger5Minute();
Get.back();
}));
}
Future<dynamic> driverFinishTripDialoge(List<dynamic> driverList) {
return Get.defaultDialog(
title: 'Driver Finish Trip'.tr,
@@ -412,7 +440,7 @@ class FirebaseMessagesController extends GetxController {
'notification': <String, dynamic>{
'title': title,
'body': body,
'sound': 'tone2.wav'
'sound': 'start.wav'
},
'priority': 'high',
'data': <String, dynamic>{
@@ -507,7 +535,7 @@ class FirebaseMessagesController extends GetxController {
'notification': <String, dynamic>{
'title': title,
'body': body,
'sound': 'tone2.wav'
'sound': 'promo.wav'
},
'data': <String, dynamic>{
'click_action': 'FLUTTER_NOTIFICATION_CLICK',