remove duplicate request when timeline is empty (#1491)

This commit is contained in:
Konrad Pozniak 2019-09-23 17:09:13 +02:00 committed by GitHub
parent b79e86cacd
commit 0d465d3bee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 6 deletions

View File

@ -68,7 +68,6 @@ import com.keylesspalace.tusky.view.EndlessOnScrollListener;
import com.keylesspalace.tusky.viewdata.StatusViewData;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@ -286,12 +285,12 @@ public class TimelineFragment extends SFragment implements
}
private void updateCurrent() {
String topId;
if (this.statuses.isEmpty()) {
topId = null;
} else {
topId = CollectionsKt.first(this.statuses, Either::isRight).asRight().getId();
return;
}
String topId = CollectionsKt.first(this.statuses, Either::isRight).asRight().getId();
this.timelineRepo.getStatuses(topId, null, null, LOAD_AT_ONCE,
TimelineRequestMode.NETWORK)
.observeOn(AndroidSchedulers.mainThread())
@ -303,7 +302,7 @@ public class TimelineFragment extends SFragment implements
if (!statuses.isEmpty()) {
filterStatuses(statuses);
if (!this.statuses.isEmpty() && topId != null) {
if (!this.statuses.isEmpty()) {
// clear old cached statuses
Iterator<Either<Placeholder, Status>> iterator = this.statuses.iterator();
while (iterator.hasNext()) {