Commit f33ec28d by sikang

Merge branch 'master' of http://47.100.14.92:8929/sikang/lib_base

update string#
parents a23c570d 16e80b6a
...@@ -23,7 +23,7 @@ def rename_api(path): ...@@ -23,7 +23,7 @@ def rename_api(path):
if "//API-REPAIR*-*" in api_l: if "//API-REPAIR*-*" in api_l:
api_l = "\t"+api_l.split("*-*")[1] api_l = "\t"+api_l.split("*-*")[1]
if (api_map[1]+"/" in api_l or api_map[1]+"\"" in api_l) and ( "@GET" in api_l or "@PUT" in api_l or "@POST" in api_l): if (api_map[1]+"/{" in api_l or api_map[1]+"\"" in api_l) and ( "@GET" in api_l or "@PUT" in api_l or "@POST" in api_l):
api_l = api_l.replace(api_map[1], api_map[0]) api_l = api_l.replace(api_map[1], api_map[0])
print(api_map[1]+ " -> " + api_map[0]) print(api_map[1]+ " -> " + api_map[0])
f_w.write(api_l) f_w.write(api_l)
......
...@@ -54,7 +54,7 @@ public class BasePresenter<T> { ...@@ -54,7 +54,7 @@ public class BasePresenter<T> {
observable.subscribeOn(Schedulers.io()) observable.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.compose(view.<T>bindToLifecycle()) .compose(view.<T>bindToLifecycle())
.subscribe(new HttpObserver<T>() { .subscribe(new HttpObserver<T>(action) {
@Override @Override
public void onStart() { public void onStart() {
view.onHttpStart(action, true); view.onHttpStart(action, true);
......
...@@ -9,9 +9,11 @@ import io.reactivex.disposables.Disposable; ...@@ -9,9 +9,11 @@ import io.reactivex.disposables.Disposable;
import retrofit2.HttpException; import retrofit2.HttpException;
import tech.starwin.R; import tech.starwin.R;
import tech.starwin.LibConfig; import tech.starwin.LibConfig;
import com.common.bean.BasicAck; import com.common.bean.BasicAck;
import com.common.bean.ResponseErrorBody; import com.common.bean.ResponseErrorBody;
import com.common.bean.UpdateBean; import com.common.bean.UpdateBean;
import tech.starwin.network.Error; import tech.starwin.network.Error;
import tech.starwin.utils.LogUtils; import tech.starwin.utils.LogUtils;
import tech.starwin.utils.LoginManager; import tech.starwin.utils.LoginManager;
...@@ -21,6 +23,16 @@ import tech.starwin.utils.LoginManager; ...@@ -21,6 +23,16 @@ import tech.starwin.utils.LoginManager;
* HTTP请求回调 * HTTP请求回调
*/ */
public abstract class HttpObserver<T> implements Observer<T> { public abstract class HttpObserver<T> implements Observer<T> {
private String action;
public HttpObserver() {
}
public HttpObserver(String action) {
this.action = action;
}
private Disposable disposable; private Disposable disposable;
public abstract void onStart(); public abstract void onStart();
...@@ -48,7 +60,7 @@ public abstract class HttpObserver<T> implements Observer<T> { ...@@ -48,7 +60,7 @@ public abstract class HttpObserver<T> implements Observer<T> {
public void onError(Throwable throwable) { public void onError(Throwable throwable) {
onFinish(); onFinish();
String msg = throwable.getMessage(); String msg = throwable.getMessage();
LogUtils.d("HttpObserver", "error msg : " + msg); LogUtils.d("HttpObserver", action+" -> error msg : " + msg);
try { try {
if (throwable != null) { if (throwable != null) {
if (isNetworkError(msg)) { 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