mirror of
https://github.com/gitnex-org/gitnex.git
synced 2026-07-15 21:08:03 -05:00
Fix mark all notifications as read
This commit is contained in:
@@ -32,12 +32,12 @@ import org.mian.gitnex.helpers.contexts.IssueContext;
|
||||
import org.mian.gitnex.helpers.contexts.RepositoryContext;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Author opyale
|
||||
* Modified M M Arif
|
||||
* @author opyale
|
||||
* @author M M Arif
|
||||
*/
|
||||
|
||||
public class NotificationsFragment extends Fragment implements NotificationsAdapter.OnNotificationClickedListener, NotificationsAdapter.OnMoreClickedListener {
|
||||
@@ -111,7 +111,7 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
|
||||
|
||||
viewBinding.markAllAsRead.setOnClickListener(v1 ->
|
||||
RetrofitClient.getApiInterface(context)
|
||||
.notifyReadList(new Date(), "true", Arrays.asList("unread", "pinned"), "read")
|
||||
.notifyReadList(null, "false", Arrays.asList("unread", "pinned"), "read")
|
||||
.enqueue((SimpleCallback<List<NotificationThread>>) (call, voidResponse) -> {
|
||||
|
||||
if(voidResponse.isPresent() && voidResponse.get().isSuccessful()) {
|
||||
@@ -151,15 +151,15 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
|
||||
notificationThreads.clear();
|
||||
}
|
||||
|
||||
if(listResponse.get().body().size() > 0) {
|
||||
notificationThreads.addAll(listResponse.get().body());
|
||||
if(Objects.requireNonNull(listResponse.get().body()).size() > 0) {
|
||||
notificationThreads.addAll(Objects.requireNonNull(listResponse.get().body()));
|
||||
}
|
||||
else {
|
||||
notificationsAdapter.setMoreDataAvailable(false);
|
||||
}
|
||||
|
||||
if(!append || listResponse.get().body().size() > 0) {
|
||||
notificationsAdapter.notifyDataSetChanged();
|
||||
if(!append || Objects.requireNonNull(listResponse.get().body()).size() > 0) {
|
||||
notificationsAdapter.notifyDataChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user