Github user therajanmaurya commented on a diff in the pull request:

    
https://github.com/apache/incubator-taverna-mobile/pull/56#discussion_r169137816
  
    --- Diff: 
app/src/main/java/org/apache/taverna/mobile/ui/workflowrun/WorkflowRunPresenter.java
 ---
    @@ -31,50 +31,48 @@
     import java.io.IOException;
     import java.io.InputStreamReader;
     
    +import io.reactivex.Observable;
    +import io.reactivex.ObservableSource;
    +import io.reactivex.android.schedulers.AndroidSchedulers;
    +import io.reactivex.disposables.CompositeDisposable;
    +import io.reactivex.functions.Function;
    +import io.reactivex.observers.DisposableObserver;
    +import io.reactivex.schedulers.Schedulers;
     import okhttp3.MediaType;
     import okhttp3.RequestBody;
     import okhttp3.ResponseBody;
    -import rx.Observable;
    -import rx.Observer;
    -import rx.Subscription;
    -import rx.android.schedulers.AndroidSchedulers;
    -import rx.functions.Func1;
    -import rx.schedulers.Schedulers;
     
     public class WorkflowRunPresenter extends 
BasePresenter<WorkflowRunMvpView> {
     
         private static final String TAG = 
WorkflowRunPresenter.class.getSimpleName();
    -    private final DataManager mDataManager;
    -    private Subscription mSubscriptions;
     
    +    private final DataManager mDataManager;
    +    private CompositeDisposable compositeDisposable;
     
         public WorkflowRunPresenter(DataManager dataManager) {
             mDataManager = dataManager;
    -
    +        compositeDisposable = new CompositeDisposable();
         }
     
         @Override
         public void attachView(WorkflowRunMvpView mvpView) {
    -
             super.attachView(mvpView);
    -
         }
     
         @Override
         public void detachView() {
             super.detachView();
    -        if (mSubscriptions != null) mSubscriptions.unsubscribe();
    +        compositeDisposable.clear();
         }
     
    -
         public void runWorkflow(String contentURL) {
    -        if (mSubscriptions != null) mSubscriptions.unsubscribe();
    +        compositeDisposable.clear();
    --- End diff --
    
    don't need to clear the Disposable, as we are using `CompositeDisposable` 
It manages every subscription we don't have to worry about, any subscription 
will drop or mix. clear only in detachView.


---

Reply via email to