Commit 692277e4 authored by Varun Patil's avatar Varun Patil

Mark notifications as read on click

parent f05bad14
......@@ -68,6 +68,9 @@ public interface RetrofitInterface {
@GET("notifications")
Call<List<Notification>> getNotifications(@Header("Cookie") String sessionID);
@GET("notifications/read/{notificationID}")
Call<Void> markNotificationRead(@Header("Cookie") String sessionID, @Path("notificationID") Integer notificationID);
@GET("logout")
Call<Void> logout(@Header("Cookie") String sessionID);
......
......@@ -70,9 +70,7 @@ public class NotificationsFragment extends BaseFragment {
}
@Override
public void onFailure(Call<List<Notification>> call, Throwable t) {
}
public void onFailure(Call<List<Notification>> call, Throwable t) { }
});
}
......@@ -83,6 +81,16 @@ public class NotificationsFragment extends BaseFragment {
/* Get the notification */
Notification notification = notifications.get(position);
/* Mark notification read */
RetrofitInterface retrofitInterface = ServiceGenerator.createService(RetrofitInterface.class);
String sessId = ((MainActivity)getActivity()).getSessionIDHeader();
retrofitInterface.markNotificationRead(sessId, notification.getNotificationId()).enqueue(new Callback<Void>() {
@Override
public void onResponse(Call<Void> call, Response<Void> response) { }
@Override
public void onFailure(Call<Void> call, Throwable t) { }
});
/* Open event */
if (notification.getNotificationActorType().contains("event")) {
String eventJson = new Gson().toJson(notification.getNotificationActor());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment