Skip to content

Commit

Permalink
fix first notifications loaded multiple times
Browse files Browse the repository at this point in the history
closes #616
  • Loading branch information
sk22 committed Jun 27, 2023
1 parent 664851c commit 277282d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ protected void doLoadData(int offset, int count){
public void onSuccess(CacheablePaginatedResponse<List<Status>> result){
if (getActivity() == null) return;
List<Status> filteredItems = filterPosts(result.items);
onDataLoaded(filteredItems, !result.items.isEmpty());
maxID=result.maxID;
onDataLoaded(filteredItems, !result.items.isEmpty());
if(result.isFromCache())
loadNewPosts();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ public void onSuccess(CacheablePaginatedResponse<List<Notification>> result){
if (getActivity() == null) return;
if(refreshing)
relationships.clear();
maxID=result.maxID;
onDataLoaded(result.items.stream().filter(n->n.type!=null).collect(Collectors.toList()), !result.items.isEmpty());
Set<String> needRelationships=result.items.stream()
.filter(ntf->ntf.status==null && !relationships.containsKey(ntf.account.id))
.map(ntf->ntf.account.id)
.collect(Collectors.toSet());
loadRelationships(needRelationships);
maxID=result.maxID;

Markers markers = AccountSessionManager.getInstance().getAccount(accountID).markers;
if(offset==0 && !result.items.isEmpty() && !result.isFromCache() && markers != null && markers.notifications != null){
Expand Down

0 comments on commit 277282d

Please sign in to comment.