This commit is contained in:
Hamza-Ayed
2024-09-08 10:31:59 +03:00
parent 2098aeda23
commit a40c6851ee
16 changed files with 812 additions and 187 deletions

View File

@@ -330,6 +330,33 @@ class FirebaseMessagesController extends GetxController {
'We regret to inform you that another driver has accepted this order.'
.tr,
'order');
} else if (message.notification!.title! == 'VIP Order Accepted'.tr) {
var myListString = message.data['passengerList'];
var driverList = jsonDecode(myListString) as List<dynamic>;
// Assuming driverList[1] contains a valid date string
DateTime scheduledTime;
try {
scheduledTime = DateTime.parse(driverList[1]);
} catch (e) {
// Handle the error if the date format is incorrect
Log.print('Error parsing date: $e');
scheduledTime = DateTime.now()
.add(const Duration(hours: 1)); // Fallback to 1 hour from now
}
NotificationController()
.showNotification('The driver accepted your trip'.tr, '', 'order');
MyDialog().getDialog(
'VIP Order Accepted'.tr,
'The driver accepted your trip'.tr,
() {
// Schedule a notification for the parsed date or fallback date
NotificationController().scheduleNotification('VIP Order'.tr,
'This is a scheduled notification.'.tr, scheduledTime);
},
);
}
}