forked from eatvio/eatvio_app
added date parsing for reminder
This commit is contained in:
@@ -21,7 +21,8 @@ class NotificationsCubit extends Cubit<NotificationsState> {
|
||||
Future<void> connectToWebSocket() async {
|
||||
await _newNotificationsSubscription?.cancel();
|
||||
_newNotificationsSubscription = wsManager.newNotificationsStream?.listen((event) {
|
||||
_handleNotification(event.data);
|
||||
|
||||
_handleNotification(event.data, event.rootObject['created_at']);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -49,8 +50,9 @@ class NotificationsCubit extends Cubit<NotificationsState> {
|
||||
}
|
||||
}
|
||||
|
||||
void _handleNotification(String notificationData) {
|
||||
void _handleNotification(String notificationData, String createdAt) {
|
||||
final json = jsonDecode(notificationData) as Map<String, dynamic>;
|
||||
json.addAll({'date': createdAt});
|
||||
final stringifiedType = json['notification_class_name'];
|
||||
final type = NotificationType.getTypeFromString(stringifiedType);
|
||||
final notification = _parseNotification(json, type);
|
||||
|
||||
Reference in New Issue
Block a user