This commit is contained in:
Hamza-Ayed
2024-10-26 16:31:17 +03:00
parent d6200e28e0
commit 229646d664
24 changed files with 1098 additions and 879 deletions

View File

@@ -113,9 +113,13 @@ class FirebaseMessagesController extends GetxController {
}
Future<void> fireBaseTitles(RemoteMessage message) async {
if (message.notification!.title! == 'Order'.tr) {
if (message.notification!.title! == 'OrderSpeed'.tr) {
if (Platform.isAndroid) {
NotificationController().showNotification('Order'.tr, '', 'order', '');
NotificationController().showNotification(
message.notification!.title.toString(),
message.notification!.body.toString(),
'order',
'');
}
// await FirebaseMessagesController().showOverlayNotification(message);
var myListString = message.data['DriverList'];
@@ -157,17 +161,34 @@ class FirebaseMessagesController extends GetxController {
// Get.to(const VipOrderPage());
} else if (message.notification!.title! == 'message From passenger'.tr) {
passengerDialog(message.notification!.body!);
// passengerDialog(message.notification!.body!);
if (Platform.isAndroid) {
NotificationController()
.showNotification('message From passenger'.tr, ''.tr, 'ding', '');
}
MyDialog().getDialog(
'message From passenger'.tr, message.notification!.body!, () {
// FirebaseMessagesController().sendNotificationToPassengerToken(
// 'Hi ,I will go now'.tr,
// 'I will go now'.tr,
// Get.find<MapPassengerController>().driverToken, []);
// Get.find<MapPassengerController>()
// .startTimerDriverWaitPassenger5Minute();
Get.back();
});
} else if (message.notification!.title == 'Cancel') {
cancelTripDialog1();
if (Platform.isAndroid) {
NotificationController()
.showNotification('Cancel'.tr, ''.tr, 'cancel', '');
}
MyDialog().getDialog(
'Passenger Cancel Trip'.tr,
'Trip Cancelled. The cost of the trip will be added to your wallet.'
.tr, () {
box.write(BoxName.rideStatus, 'Cancel');
Get.offAll(HomeCaptain());
});
// cancelTripDialog1();
} else if (message.notification!.title! == 'token change') {
// NotificationController1()
// .showNotification('token change'.tr, 'token change', 'cancel');
@@ -181,24 +202,16 @@ class FirebaseMessagesController extends GetxController {
String result0 = await faceDetector();
// Handle the result here, e.g., show a dialog or update the UI
var result = jsonDecode(result0);
Get.defaultDialog(
barrierDismissible: false,
title: 'Face Detection Result'.tr,
titleStyle: AppStyle.title,
content: Text(
MyDialogContent().getDialog(
'Face Detection Result'.tr,
Text(
result['similar'].toString() == 'true'
? 'similar'.tr
: 'not similar'.tr,
style: AppStyle.title,
),
backgroundColor: result['similar'].toString() == 'true'
? AppColor.greenColor
: AppColor.redColor,
confirm: MyElevatedButton(
title: 'OK'.tr,
onPressed: () {
Get.back();
}));
), () {
Get.back();
});
update();
} else if (message.notification!.title! == 'Hi ,I will go now') {
@@ -279,13 +292,21 @@ class FirebaseMessagesController extends GetxController {
backgroundColor: AppColor.yellowColor,
snackPosition: SnackPosition.BOTTOM,
);
} else if (message.notification!.title! == 'OrderSpeed') {
} else if (message.notification!.title! == 'Order') {
if (Platform.isAndroid) {
NotificationController().showNotification(
message.notification!.title.toString(),
message.notification!.body.toString(),
'order',
'');
}
var myListString = message.data['DriverList'];
// var points = message.data['PolylineJson'];
var myList = jsonDecode(myListString) as List<dynamic>;
// var myPoints = jsonDecode(points) as List<dynamic>;
driverToken = myList[14].toString();
Get.put(HomeCaptainController()).changeRideId();
update();
Get.to(() => OrderSpeedRequest(), arguments: {
'myListString': myListString,