9/8/1
This commit is contained in:
@@ -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);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user