diff --git a/app/src/main/java/fr/free/nrw/commons/notification/Notification.java b/app/src/main/java/fr/free/nrw/commons/notification/Notification.java index e6d759f66..0116d024c 100644 --- a/app/src/main/java/fr/free/nrw/commons/notification/Notification.java +++ b/app/src/main/java/fr/free/nrw/commons/notification/Notification.java @@ -11,13 +11,15 @@ public class Notification { public String description; public String link; public String iconUrl; + public String dateWithYear; - public Notification(NotificationType notificationType, String notificationText, String date, String description, String link, String iconUrl) { + public Notification(NotificationType notificationType, String notificationText, String date, String description, String link, String iconUrl, String dateWithYear) { this.notificationType = notificationType; this.notificationText = notificationText; this.date = date; this.description = description; this.link = link; this.iconUrl = iconUrl; + this.dateWithYear = dateWithYear; } } diff --git a/app/src/main/java/fr/free/nrw/commons/notification/NotificationUtils.java b/app/src/main/java/fr/free/nrw/commons/notification/NotificationUtils.java index e7c87d3f4..24fda5596 100644 --- a/app/src/main/java/fr/free/nrw/commons/notification/NotificationUtils.java +++ b/app/src/main/java/fr/free/nrw/commons/notification/NotificationUtils.java @@ -144,7 +144,7 @@ public class NotificationUtils { notificationText = getWelcomeMessage(context, document); break; } - return new Notification(type, notificationText, getTimestamp(document), description, link, iconUrl); + return new Notification(type, notificationText, getTimestamp(document), description, link, iconUrl, getTimestampWithYear(document)); } private static String getNotificationText(Node document) { @@ -247,6 +247,14 @@ public class NotificationUtils { return ""; } + private static String getTimestampWithYear(Node document) { + Element timestampElement = (Element) getNode(document, "timestamp"); + if (timestampElement != null) { + return timestampElement.getAttribute("utcunix"); + } + return ""; + } + private static String getNotificationDescription(Node document) { Element titleElement = (Element) getNode(document, "title"); if (titleElement != null) {