Skip to content

Commit 4d0db8d

Browse files
committed
Remove unnecessary disposable container.
1 parent 8cd87ad commit 4d0db8d

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

app/src/main/java/fr/free/nrw/commons/contributions/ContributionsFragment.java

+2-8
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
import io.reactivex.Observable;
6363
import io.reactivex.android.schedulers.AndroidSchedulers;
6464
import io.reactivex.disposables.CompositeDisposable;
65-
import io.reactivex.disposables.Disposable;
6665
import io.reactivex.schedulers.Schedulers;
6766
import timber.log.Timber;
6867

@@ -101,7 +100,6 @@ public class ContributionsFragment
101100
@BindView(R.id.card_view_nearby) public NearbyNotificationCardView nearbyNotificationCardView;
102101
@BindView(R.id.campaigns_view) CampaignView campaignView;
103102

104-
private Disposable placesDisposable;
105103
private LatLng curLatLng;
106104

107105
private boolean firstLocationUpdate = true;
@@ -603,15 +601,15 @@ private void displayYouWontSeeNearbyMessage() {
603601
private void updateClosestNearbyCardViewInfo() {
604602
curLatLng = locationManager.getLastLocation();
605603

606-
placesDisposable = Observable.fromCallable(() -> nearbyController
604+
compositeDisposable.add(Observable.fromCallable(() -> nearbyController
607605
.loadAttractionsFromLocation(curLatLng, curLatLng, true, false)) // thanks to boolean, it will only return closest result
608606
.subscribeOn(Schedulers.io())
609607
.observeOn(AndroidSchedulers.mainThread())
610608
.subscribe(this::updateNearbyNotification,
611609
throwable -> {
612610
Timber.d(throwable);
613611
updateNearbyNotification(null);
614-
});
612+
}));
615613
}
616614

617615
private void updateNearbyNotification(@Nullable NearbyController.NearbyPlacesInfo nearbyPlacesInfo) {
@@ -648,10 +646,6 @@ public void onDestroy() {
648646
isUploadServiceConnected = false;
649647
}
650648
}
651-
652-
if (placesDisposable != null) {
653-
placesDisposable.dispose();
654-
}
655649
}
656650

657651
@Override

0 commit comments

Comments
 (0)