fix first notifications loaded multiple times
closes sk22#616
This commit is contained in:
@@ -66,8 +66,8 @@ public class HomeTimelineFragment extends StatusListFragment {
|
|||||||
public void onSuccess(CacheablePaginatedResponse<List<Status>> result){
|
public void onSuccess(CacheablePaginatedResponse<List<Status>> result){
|
||||||
if (getActivity() == null) return;
|
if (getActivity() == null) return;
|
||||||
List<Status> filteredItems = filterPosts(result.items);
|
List<Status> filteredItems = filterPosts(result.items);
|
||||||
onDataLoaded(filteredItems, !result.items.isEmpty());
|
|
||||||
maxID=result.maxID;
|
maxID=result.maxID;
|
||||||
|
onDataLoaded(filteredItems, !result.items.isEmpty());
|
||||||
if(result.isFromCache())
|
if(result.isFromCache())
|
||||||
loadNewPosts();
|
loadNewPosts();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,13 +150,13 @@ public class NotificationsListFragment extends BaseStatusListFragment<Notificati
|
|||||||
if (getActivity() == null) return;
|
if (getActivity() == null) return;
|
||||||
if(refreshing)
|
if(refreshing)
|
||||||
relationships.clear();
|
relationships.clear();
|
||||||
|
maxID=result.maxID;
|
||||||
onDataLoaded(result.items.stream().filter(n->n.type!=null).collect(Collectors.toList()), !result.items.isEmpty());
|
onDataLoaded(result.items.stream().filter(n->n.type!=null).collect(Collectors.toList()), !result.items.isEmpty());
|
||||||
Set<String> needRelationships=result.items.stream()
|
Set<String> needRelationships=result.items.stream()
|
||||||
.filter(ntf->ntf.status==null && !relationships.containsKey(ntf.account.id))
|
.filter(ntf->ntf.status==null && !relationships.containsKey(ntf.account.id))
|
||||||
.map(ntf->ntf.account.id)
|
.map(ntf->ntf.account.id)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
loadRelationships(needRelationships);
|
loadRelationships(needRelationships);
|
||||||
maxID=result.maxID;
|
|
||||||
|
|
||||||
Markers markers = AccountSessionManager.getInstance().getAccount(accountID).markers;
|
Markers markers = AccountSessionManager.getInstance().getAccount(accountID).markers;
|
||||||
if(offset==0 && !result.items.isEmpty() && !result.isFromCache() && markers != null && markers.notifications != null){
|
if(offset==0 && !result.items.isEmpty() && !result.isFromCache() && markers != null && markers.notifications != null){
|
||||||
|
|||||||
Reference in New Issue
Block a user