Commit 4f55f2fe by sikang

update HttpOberver

parent 5e2e515d
......@@ -54,7 +54,7 @@ public class BasePresenter<T> {
observable.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.compose(view.<T>bindToLifecycle())
.subscribe(new HttpObserver<T>() {
.subscribe(new HttpObserver<T>(action) {
@Override
public void onStart() {
view.onHttpStart(action, true);
......
......@@ -9,9 +9,11 @@ import io.reactivex.disposables.Disposable;
import retrofit2.HttpException;
import tech.starwin.R;
import tech.starwin.LibConfig;
import com.common.bean.BasicAck;
import com.common.bean.ResponseErrorBody;
import com.common.bean.UpdateBean;
import tech.starwin.network.Error;
import tech.starwin.utils.LogUtils;
import tech.starwin.utils.LoginManager;
......@@ -21,6 +23,16 @@ import tech.starwin.utils.LoginManager;
* HTTP请求回调
*/
public abstract class HttpObserver<T> implements Observer<T> {
private String action;
public HttpObserver() {
}
public HttpObserver(String action) {
this.action = action;
}
private Disposable disposable;
public abstract void onStart();
......@@ -48,7 +60,7 @@ public abstract class HttpObserver<T> implements Observer<T> {
public void onError(Throwable throwable) {
onFinish();
String msg = throwable.getMessage();
LogUtils.d("HttpObserver", "error msg : " + msg);
LogUtils.d("HttpObserver", action+" -> error msg : " + msg);
try {
if (throwable != null) {
if (isNetworkError(msg)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment