Initial commit
This commit is contained in:
61
sources/com/ubt/jimu/base/http/ApiClient.java
Normal file
61
sources/com/ubt/jimu/base/http/ApiClient.java
Normal file
@@ -0,0 +1,61 @@
|
||||
package com.ubt.jimu.base.http;
|
||||
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.analytics.AppDelayInit;
|
||||
import com.ubt.jimu.base.http.converter.GsonConverterFactory;
|
||||
import com.ubt.jimu.base.http.interceptor.CommonParamsInterceptor;
|
||||
import com.ubt.jimu.base.http.interceptor.ResponseBodyInterceptor;
|
||||
import com.ubtech.utils.XLog;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.SSLSession;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.logging.HttpLoggingInterceptor;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ApiClient {
|
||||
public static Retrofit retrofit;
|
||||
|
||||
public static <T> T getService(Class<T> cls) {
|
||||
if (retrofit == null) {
|
||||
AppDelayInit.a(JimuApplication.l());
|
||||
}
|
||||
return (T) retrofit.create(cls);
|
||||
}
|
||||
|
||||
public static <T> T initApiClient(ApiConfiguration apiConfiguration, Class<T> cls) {
|
||||
return (T) new Retrofit.Builder().addCallAdapterFactory(RxJava2CallAdapterFactory.create()).client(new OkHttpClient().newBuilder().build()).build().create(cls);
|
||||
}
|
||||
|
||||
public static synchronized void initApiClient(ApiConfiguration apiConfiguration) {
|
||||
synchronized (ApiClient.class) {
|
||||
if (retrofit == null) {
|
||||
OkHttpClient.Builder newBuilder = new OkHttpClient().newBuilder();
|
||||
newBuilder.readTimeout(10L, TimeUnit.SECONDS);
|
||||
newBuilder.connectTimeout(10L, TimeUnit.SECONDS);
|
||||
newBuilder.hostnameVerifier(new HostnameVerifier() { // from class: com.ubt.jimu.base.http.ApiClient.2
|
||||
@Override // javax.net.ssl.HostnameVerifier
|
||||
public boolean verify(String str, SSLSession sSLSession) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
newBuilder.addNetworkInterceptor(new CommonParamsInterceptor.Builder().addPostParams(apiConfiguration.basicParams).addHeaders(apiConfiguration.headersParams).build());
|
||||
newBuilder.addNetworkInterceptor(new NetInterceptor());
|
||||
newBuilder.addNetworkInterceptor(new ResponseBodyInterceptor());
|
||||
if (apiConfiguration.debug) {
|
||||
HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() { // from class: com.ubt.jimu.base.http.ApiClient.3
|
||||
@Override // okhttp3.logging.HttpLoggingInterceptor.Logger
|
||||
public void log(String str) {
|
||||
XLog.c("okhttp3:", str);
|
||||
}
|
||||
});
|
||||
httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
|
||||
newBuilder.addInterceptor(httpLoggingInterceptor);
|
||||
}
|
||||
retrofit = new Retrofit.Builder().baseUrl(apiConfiguration.baseUrl).addConverterFactory(GsonConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).client(newBuilder.build()).build();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
60
sources/com/ubt/jimu/base/http/ApiConfiguration.java
Normal file
60
sources/com/ubt/jimu/base/http/ApiConfiguration.java
Normal file
@@ -0,0 +1,60 @@
|
||||
package com.ubt.jimu.base.http;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ApiConfiguration {
|
||||
String baseUrl;
|
||||
Map<String, String> basicParams;
|
||||
long connectTimeout;
|
||||
boolean debug;
|
||||
Map<String, String> headersParams;
|
||||
long readTimeout;
|
||||
List<String> verifiedHostNames;
|
||||
|
||||
public static class Builder {
|
||||
private String baseUrl;
|
||||
private boolean debug;
|
||||
Map<String, String> headerMap;
|
||||
private Map<String, String> params;
|
||||
List<String> verifiedHostNames;
|
||||
|
||||
public Builder baseParams(Map<String, String> map) {
|
||||
this.params = map;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder baseUrl(String str) {
|
||||
this.baseUrl = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ApiConfiguration build() {
|
||||
return new ApiConfiguration(this);
|
||||
}
|
||||
|
||||
public Builder debug(boolean z) {
|
||||
this.debug = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder headers(Map<String, String> map) {
|
||||
this.headerMap = map;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder verifiedHostNames(List<String> list) {
|
||||
this.verifiedHostNames = list;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private ApiConfiguration(Builder builder) {
|
||||
this.baseUrl = builder.baseUrl;
|
||||
this.debug = builder.debug;
|
||||
this.basicParams = builder.params;
|
||||
this.verifiedHostNames = builder.verifiedHostNames;
|
||||
this.headersParams = builder.headerMap;
|
||||
}
|
||||
}
|
103
sources/com/ubt/jimu/base/http/ApiConstants.java
Normal file
103
sources/com/ubt/jimu/base/http/ApiConstants.java
Normal file
@@ -0,0 +1,103 @@
|
||||
package com.ubt.jimu.base.http;
|
||||
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.utils.EncryptUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ApiConstants {
|
||||
public static final String APP_ID = "400010011";
|
||||
static final String APP_SOURCE = "appSource";
|
||||
static final String APP_TYPE = "app_type";
|
||||
public static final String AREA = "area";
|
||||
public static final String AUTHORIZATION = "authorization";
|
||||
public static final String ENCODE_KEY = "UBTech832%1293*6";
|
||||
public static final int GDPR_NO_RESULT = -1;
|
||||
private static String HOST_URL = "https://jimu.ubtrobot.com";
|
||||
public static final String KEY_APP_ID = "X-UBT-AppId";
|
||||
static final String KEY_APP_TYPE = "appType";
|
||||
public static final String KEY_DEVICE_ID = "X-UBT-DeviceId";
|
||||
static final String KEY_REQUEST_KEY = "requestKey";
|
||||
static final String KEY_REQUEST_TIME = "requestTime";
|
||||
static final String KEY_SERVICE_VERSION = "serviceVersion";
|
||||
public static final String KEY_SIGN = "X-UBT-Sign";
|
||||
public static final String LANGUAGE = "language";
|
||||
public static final String PRODECT_ID = "20001";
|
||||
static final String SOURCE = "app_source";
|
||||
static final String SYSTEM_AREA = "systemArea";
|
||||
static final String SYSTEM_LANGUAGE = "systemLanguage";
|
||||
public static final int USER_PRIVACY = 2;
|
||||
static final String VERSION = "version";
|
||||
|
||||
public static String getAppVersion() {
|
||||
return "3.9.6";
|
||||
}
|
||||
|
||||
public static Map<String, Object> getBaseParams() {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put(KEY_APP_TYPE, "2");
|
||||
hashMap.put(KEY_SERVICE_VERSION, getAppVersion());
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
hashMap.put(KEY_REQUEST_TIME, String.valueOf(currentTimeMillis));
|
||||
hashMap.put(KEY_REQUEST_KEY, EncryptUtils.a(currentTimeMillis + ENCODE_KEY, 32));
|
||||
hashMap.put(SYSTEM_LANGUAGE, JimuApplication.l().g());
|
||||
hashMap.put(SYSTEM_AREA, JimuApplication.l().c());
|
||||
hashMap.put(APP_SOURCE, "Jimu");
|
||||
hashMap.put("language", JimuApplication.l().g());
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
public static Map<String, String> getBasicParams() {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put(KEY_APP_TYPE, "2");
|
||||
hashMap.put(KEY_SERVICE_VERSION, getAppVersion());
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
hashMap.put(KEY_REQUEST_TIME, String.valueOf(currentTimeMillis));
|
||||
hashMap.put(KEY_REQUEST_KEY, EncryptUtils.a(currentTimeMillis + ENCODE_KEY, 32));
|
||||
hashMap.put(SYSTEM_LANGUAGE, JimuApplication.l().g());
|
||||
hashMap.put(SYSTEM_AREA, JimuApplication.l().c());
|
||||
hashMap.put(APP_SOURCE, "Jimu");
|
||||
hashMap.put("language", JimuApplication.l().g());
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
public static Map<String, String> getHeaderParams() {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("product", PRODECT_ID);
|
||||
hashMap.put("version", getAppVersion());
|
||||
hashMap.put(APP_TYPE, "2");
|
||||
hashMap.put(SOURCE, "Jimu");
|
||||
hashMap.put(KEY_APP_ID, APP_ID);
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
public static String getHostUrl() {
|
||||
return HOST_URL;
|
||||
}
|
||||
|
||||
public static List<String> getVerifiedHostNames() {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
arrayList.add("jimu.ubtrobot.com:543");
|
||||
arrayList.add("jimu.ubtrobot.com");
|
||||
arrayList.add("service.ubtrobot.com");
|
||||
arrayList.add("www.qq.com");
|
||||
arrayList.add("graph.qq.com");
|
||||
arrayList.add("api.weixin.qq.com");
|
||||
arrayList.add("api.twitter.com");
|
||||
arrayList.add("www.facebook.com");
|
||||
arrayList.add("graph.facebook.com");
|
||||
arrayList.add("twitter.com");
|
||||
arrayList.add("test79.ubtrobot.com");
|
||||
arrayList.add("e.crashlytics.com");
|
||||
arrayList.add("reports.crashlytics.com");
|
||||
arrayList.add("video.ubtrobot.com");
|
||||
arrayList.add("apis.ubtrobot.com");
|
||||
arrayList.add("account.ubtrobot.com");
|
||||
arrayList.add("imu.ubtrobot.com");
|
||||
arrayList.add("prerelease.ubtrobot.com");
|
||||
return arrayList;
|
||||
}
|
||||
}
|
17
sources/com/ubt/jimu/base/http/ApiException.java
Normal file
17
sources/com/ubt/jimu/base/http/ApiException.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.ubt.jimu.base.http;
|
||||
|
||||
import retrofit2.HttpException;
|
||||
import retrofit2.Response;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ApiException extends HttpException {
|
||||
private int code;
|
||||
|
||||
public ApiException(Response<?> response) {
|
||||
super(response);
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return this.code;
|
||||
}
|
||||
}
|
124
sources/com/ubt/jimu/base/http/ApiObserver.java
Normal file
124
sources/com/ubt/jimu/base/http/ApiObserver.java
Normal file
@@ -0,0 +1,124 @@
|
||||
package com.ubt.jimu.base.http;
|
||||
|
||||
import android.accounts.NetworkErrorException;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.widgets.LoadingView;
|
||||
import com.ubtrobot.log.ALog;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class ApiObserver<T> implements Observer<T> {
|
||||
public static final int SHOW_LOADING = 1;
|
||||
public static final int SHOW_NO_LOADING = 0;
|
||||
private String TAG;
|
||||
private ApiErrorListener apiErrorListener;
|
||||
private boolean isRefrshing;
|
||||
private RequestComplete mComplete;
|
||||
private NetErrorListener mErrorListener;
|
||||
private int mLoading;
|
||||
private LoadingView mLoadingView;
|
||||
|
||||
public interface ApiErrorListener {
|
||||
void onError(ApiResultException apiResultException);
|
||||
}
|
||||
|
||||
public interface NetErrorListener {
|
||||
void onError(Throwable th);
|
||||
}
|
||||
|
||||
public interface RequestComplete {
|
||||
void onComplete();
|
||||
}
|
||||
|
||||
public ApiObserver(LoadingView loadingView) {
|
||||
this(loadingView, 0);
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
ALog.a(this.TAG).d("ApiObserver onComplete");
|
||||
LoadingView loadingView = this.mLoadingView;
|
||||
if (loadingView != null) {
|
||||
loadingView.b();
|
||||
}
|
||||
RequestComplete requestComplete = this.mComplete;
|
||||
if (requestComplete != null) {
|
||||
requestComplete.onComplete();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
try {
|
||||
ALog.a(this.TAG).d("t====" + th.getMessage());
|
||||
if (this.mLoadingView != null) {
|
||||
this.mLoadingView.f();
|
||||
}
|
||||
if (th instanceof NetworkErrorException) {
|
||||
if (this.mLoadingView != null) {
|
||||
this.mLoadingView.setServiceLoadingError(R.drawable.ic_network_error);
|
||||
this.mLoadingView.setServiceTextError(R.string.loading_error);
|
||||
}
|
||||
} else if (th instanceof NullPointerException) {
|
||||
if (this.mLoadingView != null) {
|
||||
this.mLoadingView.setServiceLoadingError(R.drawable.ic_network_error);
|
||||
this.mLoadingView.setServiceTextError(R.string.loading_error);
|
||||
}
|
||||
} else if (th instanceof ApiResultException) {
|
||||
ApiResultException apiResultException = (ApiResultException) th;
|
||||
if (this.apiErrorListener != null) {
|
||||
this.apiErrorListener.onError(apiResultException);
|
||||
}
|
||||
} else if (this.mLoadingView != null) {
|
||||
this.mLoadingView.setServiceLoadingError(R.drawable.ic_try_reload);
|
||||
this.mLoadingView.setServiceTextError(R.string.loading_service_error);
|
||||
}
|
||||
if (this.mErrorListener != null) {
|
||||
this.mErrorListener.onError(th);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onNext(T t) {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
LoadingView loadingView = this.mLoadingView;
|
||||
if (loadingView != null && !this.isRefrshing) {
|
||||
loadingView.g();
|
||||
}
|
||||
ALog.a(this.TAG).d(disposable.toString());
|
||||
}
|
||||
|
||||
public ApiObserver<T> refreshOrLoad(boolean z) {
|
||||
this.isRefrshing = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ApiObserver<T> setApiErrorListener(ApiErrorListener apiErrorListener) {
|
||||
this.apiErrorListener = apiErrorListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ApiObserver<T> setNetErrorListener(NetErrorListener netErrorListener) {
|
||||
this.mErrorListener = netErrorListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ApiObserver<T> setRequestComplete(RequestComplete requestComplete) {
|
||||
this.mComplete = requestComplete;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ApiObserver(LoadingView loadingView, int i) {
|
||||
this.TAG = "ApiObserver";
|
||||
this.mLoading = 0;
|
||||
this.mLoading = i;
|
||||
this.mLoadingView = loadingView;
|
||||
}
|
||||
}
|
20
sources/com/ubt/jimu/base/http/ApiResponse.java
Normal file
20
sources/com/ubt/jimu/base/http/ApiResponse.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.ubt.jimu.base.http;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ApiResponse<T> {
|
||||
private String info;
|
||||
private T models;
|
||||
private boolean status;
|
||||
|
||||
public String getInfo() {
|
||||
return this.info;
|
||||
}
|
||||
|
||||
public T getModels() {
|
||||
return this.models;
|
||||
}
|
||||
|
||||
public boolean isStatus() {
|
||||
return this.status;
|
||||
}
|
||||
}
|
63
sources/com/ubt/jimu/base/http/ApiResultException.java
Normal file
63
sources/com/ubt/jimu/base/http/ApiResultException.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.ubt.jimu.base.http;
|
||||
|
||||
import android.content.Context;
|
||||
import com.ubt.jimu.R;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ApiResultException extends RuntimeException {
|
||||
public static final int CODE_NET_WORK_ERROR = -1;
|
||||
public static final int CODE_SYS_ERROR = -2;
|
||||
private int code;
|
||||
private String message;
|
||||
|
||||
public ApiResultException(int i, String str) {
|
||||
this.code = i;
|
||||
this.message = str;
|
||||
}
|
||||
|
||||
public static String codeToMessage(Context context, int i) {
|
||||
if (i == -1) {
|
||||
return context.getString(R.string.network_error);
|
||||
}
|
||||
if (i == 2011) {
|
||||
return context.getString(R.string.error_phone_format);
|
||||
}
|
||||
if (i == 2018) {
|
||||
return context.getString(R.string.error_user_exist);
|
||||
}
|
||||
if (i == 2019) {
|
||||
return context.getString(R.string.error_get_captcha);
|
||||
}
|
||||
switch (i) {
|
||||
case 2002:
|
||||
return context.getString(R.string.error_username_password);
|
||||
case 2003:
|
||||
return context.getString(R.string.error_user_exist);
|
||||
case 2004:
|
||||
return context.getString(R.string.error_user_not_found);
|
||||
case 2005:
|
||||
return context.getString(R.string.error_captcha);
|
||||
case 2006:
|
||||
return context.getString(R.string.error_account_captcha);
|
||||
default:
|
||||
return context.getString(R.string.error_system_later_try) + " (code: " + i + ")";
|
||||
}
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
@Override // java.lang.Throwable
|
||||
public String getMessage() {
|
||||
return this.message;
|
||||
}
|
||||
|
||||
public void setCode(int i) {
|
||||
this.code = i;
|
||||
}
|
||||
|
||||
public void setMessage(String str) {
|
||||
this.message = str;
|
||||
}
|
||||
}
|
118
sources/com/ubt/jimu/base/http/IApiObserver.java
Normal file
118
sources/com/ubt/jimu/base/http/IApiObserver.java
Normal file
@@ -0,0 +1,118 @@
|
||||
package com.ubt.jimu.base.http;
|
||||
|
||||
import android.accounts.NetworkErrorException;
|
||||
import android.content.Context;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import com.ubt.jimu.utils.NetWorkUtil;
|
||||
import com.ubt.jimu.widgets.LoadingView;
|
||||
import com.ubtrobot.log.ALog;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class IApiObserver<T> implements Observer<T> {
|
||||
public static final int SHOW_LOADING = 1;
|
||||
public static final int SHOW_NO_LOADING = 0;
|
||||
private boolean isRefrshing;
|
||||
private RequestComplete mComplete;
|
||||
private Context mContext;
|
||||
private LoadingView mLoadingView;
|
||||
private String TAG = "ApiObserver";
|
||||
private int mLoading = 0;
|
||||
|
||||
public interface ApiErrorListener {
|
||||
void onError(ApiResultException apiResultException);
|
||||
}
|
||||
|
||||
public interface NetErrorListener {
|
||||
void onError(Throwable th);
|
||||
}
|
||||
|
||||
public interface RequestComplete {
|
||||
void onComplete();
|
||||
}
|
||||
|
||||
public IApiObserver(Context context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
protected abstract void onApiError(ApiResultException apiResultException);
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
ALog.a(this.TAG).d("ApiObserver onComplete");
|
||||
LoadingView loadingView = this.mLoadingView;
|
||||
if (loadingView != null) {
|
||||
loadingView.b();
|
||||
}
|
||||
RequestComplete requestComplete = this.mComplete;
|
||||
if (requestComplete != null) {
|
||||
requestComplete.onComplete();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
ApiResultException apiResultException;
|
||||
ALog.a(this.TAG).d("t====" + th.getMessage());
|
||||
LoadingView loadingView = this.mLoadingView;
|
||||
if (loadingView != null) {
|
||||
loadingView.f();
|
||||
}
|
||||
if (th instanceof NetworkErrorException) {
|
||||
LoadingView loadingView2 = this.mLoadingView;
|
||||
if (loadingView2 != null) {
|
||||
loadingView2.setServiceLoadingError(R.drawable.ic_network_error);
|
||||
this.mLoadingView.setServiceTextError(R.string.loading_error);
|
||||
}
|
||||
apiResultException = new ApiResultException(-1, this.mContext.getString(R.string.network_error));
|
||||
LogUtils.c("------" + apiResultException.getMessage() + "------");
|
||||
} else if (th instanceof ApiResultException) {
|
||||
apiResultException = (ApiResultException) th;
|
||||
LogUtils.c("------" + apiResultException.getMessage() + "------");
|
||||
apiResultException.setMessage(ApiResultException.codeToMessage(this.mContext, apiResultException.getCode()));
|
||||
} else {
|
||||
LoadingView loadingView3 = this.mLoadingView;
|
||||
if (loadingView3 != null) {
|
||||
loadingView3.setServiceLoadingError(R.drawable.ic_try_reload);
|
||||
this.mLoadingView.setServiceTextError(R.string.loading_service_error);
|
||||
}
|
||||
apiResultException = new ApiResultException(-2, ApiResultException.codeToMessage(this.mContext, -2));
|
||||
}
|
||||
onApiError(apiResultException);
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onNext(T t) {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
ALog.a(this.TAG).d(disposable.toString());
|
||||
if (NetWorkUtil.b(this.mContext)) {
|
||||
return;
|
||||
}
|
||||
onApiError(new ApiResultException(-1, this.mContext.getString(R.string.network_error)));
|
||||
LoadingView loadingView = this.mLoadingView;
|
||||
if (loadingView != null) {
|
||||
loadingView.d();
|
||||
}
|
||||
disposable.dispose();
|
||||
}
|
||||
|
||||
public IApiObserver<T> refreshOrLoad(boolean z) {
|
||||
this.isRefrshing = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IApiObserver<T> setRequestComplete(RequestComplete requestComplete) {
|
||||
this.mComplete = requestComplete;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IApiObserver(Context context, LoadingView loadingView) {
|
||||
this.mContext = context;
|
||||
this.mLoadingView = loadingView;
|
||||
}
|
||||
}
|
28
sources/com/ubt/jimu/base/http/NetInterceptor.java
Normal file
28
sources/com/ubt/jimu/base/http/NetInterceptor.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package com.ubt.jimu.base.http;
|
||||
|
||||
import java.io.IOException;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class NetInterceptor implements Interceptor {
|
||||
private OkHttpClient builder;
|
||||
|
||||
public NetInterceptor() {
|
||||
}
|
||||
|
||||
@Override // okhttp3.Interceptor
|
||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||
Response proceed = chain.proceed(chain.request().newBuilder().removeHeader("User-Agent").removeHeader("Accept-Encoding").build());
|
||||
if (proceed.body() == null || proceed.body().contentType() == null) {
|
||||
return proceed;
|
||||
}
|
||||
return proceed.newBuilder().body(ResponseBody.create(proceed.body().contentType(), proceed.body().string())).build();
|
||||
}
|
||||
|
||||
public NetInterceptor(OkHttpClient okHttpClient) {
|
||||
this.builder = okHttpClient;
|
||||
}
|
||||
}
|
17
sources/com/ubt/jimu/base/http/cache/CacheKey.java
vendored
Normal file
17
sources/com/ubt/jimu/base/http/cache/CacheKey.java
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.ubt.jimu.base.http.cache;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.METHOD})
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
/* loaded from: classes.dex */
|
||||
public @interface CacheKey {
|
||||
String Key() default "";
|
||||
|
||||
long Time() default 0;
|
||||
}
|
293
sources/com/ubt/jimu/base/http/cache/CacheManager.java
vendored
Normal file
293
sources/com/ubt/jimu/base/http/cache/CacheManager.java
vendored
Normal file
@@ -0,0 +1,293 @@
|
||||
package com.ubt.jimu.base.http.cache;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Environment;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.StreamCorruptedException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import okhttp3.internal.cache.DiskLruCache;
|
||||
import okhttp3.internal.io.FileSystem;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class CacheManager<T> {
|
||||
private static final String CACHE_DIR = "jimuCacheDir";
|
||||
private static final int DISK_CACHE_INDEX = 0;
|
||||
private static final long DISK_CACHE_SIZE = 10485760;
|
||||
public static final String TAG = "CacheManager";
|
||||
private static CacheManager mCacheManager;
|
||||
private Context context;
|
||||
private DiskLruCache mDiskLruCache;
|
||||
|
||||
public CacheManager() {
|
||||
File diskCacheDir = getDiskCacheDir(JimuApplication.l(), CACHE_DIR);
|
||||
if (!diskCacheDir.exists()) {
|
||||
diskCacheDir.mkdirs();
|
||||
}
|
||||
if (diskCacheDir.getUsableSpace() > DISK_CACHE_SIZE) {
|
||||
try {
|
||||
this.mDiskLruCache = DiskLruCache.create(FileSystem.SYSTEM, diskCacheDir, 3960075, 10, DISK_CACHE_SIZE);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String encryptMD5(String str) {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
byte[] digest = MessageDigest.getInstance("MD5").digest(str.getBytes("UTF-8"));
|
||||
StringBuilder sb = new StringBuilder(digest.length * 2);
|
||||
for (byte b : digest) {
|
||||
int i = b & 255;
|
||||
if (i < 16) {
|
||||
sb.append("0");
|
||||
}
|
||||
sb.append(Integer.toHexString(i));
|
||||
}
|
||||
return sb.toString();
|
||||
} catch (UnsupportedEncodingException | NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
private int getAppVersion(Context context) {
|
||||
try {
|
||||
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
|
||||
if (packageInfo == null) {
|
||||
return 0;
|
||||
}
|
||||
return packageInfo.versionCode;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private Bitmap getBitmapCache(String str) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private File getDiskCacheDir(Context context, String str) {
|
||||
String absolutePath;
|
||||
if ("mounted".equals(Environment.getExternalStorageState()) || !Environment.isExternalStorageRemovable()) {
|
||||
File externalCacheDir = context.getExternalCacheDir();
|
||||
absolutePath = externalCacheDir != null ? externalCacheDir.getAbsolutePath() : context.getCacheDir().getPath();
|
||||
} else {
|
||||
absolutePath = context.getCacheDir().getPath();
|
||||
}
|
||||
return new File(absolutePath + File.separator + str);
|
||||
}
|
||||
|
||||
public static synchronized CacheManager getInstance(Context context) {
|
||||
CacheManager cacheManager;
|
||||
synchronized (CacheManager.class) {
|
||||
if (mCacheManager == null) {
|
||||
mCacheManager = new CacheManager();
|
||||
}
|
||||
cacheManager = mCacheManager;
|
||||
}
|
||||
return cacheManager;
|
||||
}
|
||||
|
||||
private void putBitmapCache(Bitmap bitmap) {
|
||||
}
|
||||
|
||||
public void closeDiskLruCache() {
|
||||
DiskLruCache diskLruCache = this.mDiskLruCache;
|
||||
if (diskLruCache == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
diskLruCache.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public T getObjectCache(String str, long j) {
|
||||
String stringCache = getStringCache(str);
|
||||
if (TextUtils.isEmpty(stringCache)) {
|
||||
return null;
|
||||
}
|
||||
String[] split = stringCache.split("@");
|
||||
if (System.currentTimeMillis() - Long.parseLong(split[0]) > j) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(Base64.decode(split[1].getBytes(), 0));
|
||||
try {
|
||||
ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
|
||||
try {
|
||||
try {
|
||||
T t = (T) objectInputStream.readObject();
|
||||
objectInputStream.close();
|
||||
byteArrayInputStream.close();
|
||||
return t;
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
objectInputStream.close();
|
||||
byteArrayInputStream.close();
|
||||
return null;
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
} catch (StreamCorruptedException e2) {
|
||||
e2.printStackTrace();
|
||||
return null;
|
||||
} catch (IOException e3) {
|
||||
e3.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getStringCache(String str) {
|
||||
if (this.mDiskLruCache == null) {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:38:0x0079 A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:45:? A[SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:46:0x006f A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||||
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:55:0x0067 -> B:12:0x006a). Please report as a decompilation issue!!! */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public void putObjectCache(java.lang.String r6, java.lang.Object r7) {
|
||||
/*
|
||||
r5 = this;
|
||||
r0 = 0
|
||||
java.io.ByteArrayOutputStream r1 = new java.io.ByteArrayOutputStream // Catch: java.lang.Throwable -> L4d java.io.IOException -> L51
|
||||
r1.<init>() // Catch: java.lang.Throwable -> L4d java.io.IOException -> L51
|
||||
java.io.ObjectOutputStream r2 = new java.io.ObjectOutputStream // Catch: java.lang.Throwable -> L46 java.io.IOException -> L49
|
||||
r2.<init>(r1) // Catch: java.lang.Throwable -> L46 java.io.IOException -> L49
|
||||
r2.writeObject(r7) // Catch: java.lang.Throwable -> L42 java.io.IOException -> L44
|
||||
byte[] r7 = r1.toByteArray() // Catch: java.lang.Throwable -> L42 java.io.IOException -> L44
|
||||
r0 = 0
|
||||
java.lang.String r7 = android.util.Base64.encodeToString(r7, r0) // Catch: java.lang.Throwable -> L42 java.io.IOException -> L44
|
||||
long r3 = java.lang.System.currentTimeMillis() // Catch: java.lang.Throwable -> L42 java.io.IOException -> L44
|
||||
java.lang.Long r0 = java.lang.Long.valueOf(r3) // Catch: java.lang.Throwable -> L42 java.io.IOException -> L44
|
||||
java.lang.StringBuilder r3 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L42 java.io.IOException -> L44
|
||||
r3.<init>() // Catch: java.lang.Throwable -> L42 java.io.IOException -> L44
|
||||
r3.append(r0) // Catch: java.lang.Throwable -> L42 java.io.IOException -> L44
|
||||
java.lang.String r0 = "@"
|
||||
r3.append(r0) // Catch: java.lang.Throwable -> L42 java.io.IOException -> L44
|
||||
r3.append(r7) // Catch: java.lang.Throwable -> L42 java.io.IOException -> L44
|
||||
java.lang.String r7 = r3.toString() // Catch: java.lang.Throwable -> L42 java.io.IOException -> L44
|
||||
r5.putStringCache(r6, r7) // Catch: java.lang.Throwable -> L42 java.io.IOException -> L44
|
||||
r1.close() // Catch: java.io.IOException -> L3a
|
||||
goto L3e
|
||||
L3a:
|
||||
r6 = move-exception
|
||||
r6.printStackTrace()
|
||||
L3e:
|
||||
r2.close() // Catch: java.io.IOException -> L66
|
||||
goto L6a
|
||||
L42:
|
||||
r6 = move-exception
|
||||
goto L6d
|
||||
L44:
|
||||
r6 = move-exception
|
||||
goto L4b
|
||||
L46:
|
||||
r6 = move-exception
|
||||
r2 = r0
|
||||
goto L6d
|
||||
L49:
|
||||
r6 = move-exception
|
||||
r2 = r0
|
||||
L4b:
|
||||
r0 = r1
|
||||
goto L53
|
||||
L4d:
|
||||
r6 = move-exception
|
||||
r1 = r0
|
||||
r2 = r1
|
||||
goto L6d
|
||||
L51:
|
||||
r6 = move-exception
|
||||
r2 = r0
|
||||
L53:
|
||||
r6.printStackTrace() // Catch: java.lang.Throwable -> L6b
|
||||
if (r0 == 0) goto L60
|
||||
r0.close() // Catch: java.io.IOException -> L5c
|
||||
goto L60
|
||||
L5c:
|
||||
r6 = move-exception
|
||||
r6.printStackTrace()
|
||||
L60:
|
||||
if (r2 == 0) goto L6a
|
||||
r2.close() // Catch: java.io.IOException -> L66
|
||||
goto L6a
|
||||
L66:
|
||||
r6 = move-exception
|
||||
r6.printStackTrace()
|
||||
L6a:
|
||||
return
|
||||
L6b:
|
||||
r6 = move-exception
|
||||
r1 = r0
|
||||
L6d:
|
||||
if (r1 == 0) goto L77
|
||||
r1.close() // Catch: java.io.IOException -> L73
|
||||
goto L77
|
||||
L73:
|
||||
r7 = move-exception
|
||||
r7.printStackTrace()
|
||||
L77:
|
||||
if (r2 == 0) goto L81
|
||||
r2.close() // Catch: java.io.IOException -> L7d
|
||||
goto L81
|
||||
L7d:
|
||||
r7 = move-exception
|
||||
r7.printStackTrace()
|
||||
L81:
|
||||
throw r6
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.ubt.jimu.base.http.cache.CacheManager.putObjectCache(java.lang.String, java.lang.Object):void");
|
||||
}
|
||||
|
||||
public void putStringCache(String str, String str2) {
|
||||
if (this.mDiskLruCache == null) {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean removeCache(String str) {
|
||||
DiskLruCache diskLruCache = this.mDiskLruCache;
|
||||
if (diskLruCache == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return diskLruCache.remove(encryptMD5(str));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setCache(final String str, final String str2) {
|
||||
new Thread() { // from class: com.ubt.jimu.base.http.cache.CacheManager.1
|
||||
@Override // java.lang.Thread, java.lang.Runnable
|
||||
public void run() {
|
||||
CacheManager.this.putStringCache(str, str2);
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
}
|
93
sources/com/ubt/jimu/base/http/cache/CacheSubscriber.java
vendored
Normal file
93
sources/com/ubt/jimu/base/http/cache/CacheSubscriber.java
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
package com.ubt.jimu.base.http.cache;
|
||||
|
||||
import android.support.v4.media.MediaDescriptionCompat;
|
||||
import android.text.TextUtils;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class CacheSubscriber<T> implements Observer<T> {
|
||||
private String key;
|
||||
private final CacheManager<T> mCacheManager = new CacheManager<>();
|
||||
|
||||
private void getCacheConfiguration() {
|
||||
CacheKey cacheKey;
|
||||
if (!TextUtils.isEmpty(setCacheKey())) {
|
||||
T objectCache = this.mCacheManager.getObjectCache(this.key, 3600000L);
|
||||
if (objectCache != null) {
|
||||
LogUtils.c("调用缓存显示方法");
|
||||
showCacheData(objectCache);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (Method method : getClass().getDeclaredMethods()) {
|
||||
if (method.getName().equals("showCacheData") && (cacheKey = (CacheKey) method.getAnnotation(CacheKey.class)) != null) {
|
||||
String Key = cacheKey.Key();
|
||||
LogUtils.c("缓存Key:" + Key);
|
||||
long Time = cacheKey.Time();
|
||||
if (!TextUtils.isEmpty(Key)) {
|
||||
this.key = Key;
|
||||
T objectCache2 = this.mCacheManager.getObjectCache(Key, Time);
|
||||
LogUtils.c("缓存中的T:" + objectCache2);
|
||||
if (objectCache2 != null) {
|
||||
LogUtils.c("调用缓存显示方法");
|
||||
showCacheData(objectCache2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void complete() {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
complete();
|
||||
CacheManager<T> cacheManager = this.mCacheManager;
|
||||
if (cacheManager != null) {
|
||||
cacheManager.closeDiskLruCache();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
CacheManager<T> cacheManager = this.mCacheManager;
|
||||
if (cacheManager != null) {
|
||||
cacheManager.closeDiskLruCache();
|
||||
}
|
||||
onFailure(th);
|
||||
}
|
||||
|
||||
public abstract void onFailure(Throwable th);
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onNext(T t) {
|
||||
this.mCacheManager.putObjectCache(this.key, t);
|
||||
onSucceed(t);
|
||||
CacheManager<T> cacheManager = this.mCacheManager;
|
||||
if (cacheManager != null) {
|
||||
cacheManager.closeDiskLruCache();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void onStart(Disposable disposable);
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
getCacheConfiguration();
|
||||
onStart(disposable);
|
||||
}
|
||||
|
||||
public abstract void onSucceed(T t);
|
||||
|
||||
public String setCacheKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@CacheKey(Key = "KEY", Time = MediaDescriptionCompat.BT_FOLDER_TYPE_MIXED)
|
||||
public abstract void showCacheData(T t);
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
package com.ubt.jimu.base.http.converter;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Type;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Converter;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class GsonConverterFactory extends Converter.Factory {
|
||||
private final Gson gson;
|
||||
|
||||
private GsonConverterFactory(Gson gson) {
|
||||
if (gson == null) {
|
||||
throw new NullPointerException("gson==null");
|
||||
}
|
||||
this.gson = gson;
|
||||
}
|
||||
|
||||
public static GsonConverterFactory create() {
|
||||
return create(new Gson());
|
||||
}
|
||||
|
||||
@Override // retrofit2.Converter.Factory
|
||||
public Converter<?, RequestBody> requestBodyConverter(Type type, Annotation[] annotationArr, Annotation[] annotationArr2, Retrofit retrofit) {
|
||||
return new GsonRequestBodyConverter(this.gson, this.gson.getAdapter(TypeToken.get(type)));
|
||||
}
|
||||
|
||||
@Override // retrofit2.Converter.Factory
|
||||
public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotationArr, Retrofit retrofit) {
|
||||
return new GsonResponseBodyConverter(this.gson, this.gson.getAdapter(TypeToken.get(type)));
|
||||
}
|
||||
|
||||
public static GsonConverterFactory create(Gson gson) {
|
||||
return new GsonConverterFactory(gson);
|
||||
}
|
||||
}
|
@@ -0,0 +1,112 @@
|
||||
package com.ubt.jimu.base.http.converter;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.Converter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GsonRequestBodyConverter<T> implements Converter<T, RequestBody> {
|
||||
private static final MediaType MEDIA_TYPE = MediaType.parse("application/json; charset=UTF-8");
|
||||
private static final Charset UTF_8 = Charset.forName("UTF-8");
|
||||
private final TypeAdapter<T> adapter;
|
||||
private final Gson gson;
|
||||
|
||||
GsonRequestBodyConverter(Gson gson, TypeAdapter<T> typeAdapter) {
|
||||
this.gson = gson;
|
||||
this.adapter = typeAdapter;
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
@Override // retrofit2.Converter
|
||||
public /* bridge */ /* synthetic */ RequestBody convert(Object obj) throws IOException {
|
||||
return convert((GsonRequestBodyConverter<T>) obj);
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:33:0x0060 A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:40:? A[SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:41:0x0056 A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||||
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:46:0x0045 -> B:8:0x0048). Please report as a decompilation issue!!! */
|
||||
@Override // retrofit2.Converter
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public okhttp3.RequestBody convert(T r6) {
|
||||
/*
|
||||
r5 = this;
|
||||
okio.Buffer r0 = new okio.Buffer
|
||||
r0.<init>()
|
||||
r1 = 0
|
||||
java.io.OutputStreamWriter r2 = new java.io.OutputStreamWriter // Catch: java.lang.Throwable -> L2c java.io.IOException -> L2f
|
||||
java.io.OutputStream r3 = r0.outputStream() // Catch: java.lang.Throwable -> L2c java.io.IOException -> L2f
|
||||
java.nio.charset.Charset r4 = com.ubt.jimu.base.http.converter.GsonRequestBodyConverter.UTF_8 // Catch: java.lang.Throwable -> L2c java.io.IOException -> L2f
|
||||
r2.<init>(r3, r4) // Catch: java.lang.Throwable -> L2c java.io.IOException -> L2f
|
||||
com.google.gson.Gson r3 = r5.gson // Catch: java.io.IOException -> L2a java.lang.Throwable -> L53
|
||||
com.google.gson.stream.JsonWriter r1 = r3.newJsonWriter(r2) // Catch: java.io.IOException -> L2a java.lang.Throwable -> L53
|
||||
com.google.gson.TypeAdapter<T> r3 = r5.adapter // Catch: java.io.IOException -> L2a java.lang.Throwable -> L53
|
||||
r3.write(r1, r6) // Catch: java.io.IOException -> L2a java.lang.Throwable -> L53
|
||||
if (r1 == 0) goto L26
|
||||
r1.close() // Catch: java.lang.Exception -> L22
|
||||
goto L26
|
||||
L22:
|
||||
r6 = move-exception
|
||||
r6.printStackTrace()
|
||||
L26:
|
||||
r2.close() // Catch: java.lang.Exception -> L44
|
||||
goto L48
|
||||
L2a:
|
||||
r6 = move-exception
|
||||
goto L31
|
||||
L2c:
|
||||
r6 = move-exception
|
||||
r2 = r1
|
||||
goto L54
|
||||
L2f:
|
||||
r6 = move-exception
|
||||
r2 = r1
|
||||
L31:
|
||||
r6.printStackTrace() // Catch: java.lang.Throwable -> L53
|
||||
if (r1 == 0) goto L3e
|
||||
r1.close() // Catch: java.lang.Exception -> L3a
|
||||
goto L3e
|
||||
L3a:
|
||||
r6 = move-exception
|
||||
r6.printStackTrace()
|
||||
L3e:
|
||||
if (r2 == 0) goto L48
|
||||
r2.close() // Catch: java.lang.Exception -> L44
|
||||
goto L48
|
||||
L44:
|
||||
r6 = move-exception
|
||||
r6.printStackTrace()
|
||||
L48:
|
||||
okhttp3.MediaType r6 = com.ubt.jimu.base.http.converter.GsonRequestBodyConverter.MEDIA_TYPE
|
||||
okio.ByteString r0 = r0.readByteString()
|
||||
okhttp3.RequestBody r6 = okhttp3.RequestBody.create(r6, r0)
|
||||
return r6
|
||||
L53:
|
||||
r6 = move-exception
|
||||
L54:
|
||||
if (r1 == 0) goto L5e
|
||||
r1.close() // Catch: java.lang.Exception -> L5a
|
||||
goto L5e
|
||||
L5a:
|
||||
r0 = move-exception
|
||||
r0.printStackTrace()
|
||||
L5e:
|
||||
if (r2 == 0) goto L68
|
||||
r2.close() // Catch: java.lang.Exception -> L64
|
||||
goto L68
|
||||
L64:
|
||||
r0 = move-exception
|
||||
r0.printStackTrace()
|
||||
L68:
|
||||
throw r6
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.ubt.jimu.base.http.converter.GsonRequestBodyConverter.convert(java.lang.Object):okhttp3.RequestBody");
|
||||
}
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
package com.ubt.jimu.base.http.converter;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.ubtech.utils.StringUtils;
|
||||
import java.io.IOException;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Converter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GsonResponseBodyConverter<T> implements Converter<ResponseBody, T> {
|
||||
private final TypeAdapter<T> adapter;
|
||||
private final Gson gson;
|
||||
private final String JSON_KEY_MODELS = "models";
|
||||
private final String JSON_KEY_LIST = "list_models";
|
||||
|
||||
GsonResponseBodyConverter(Gson gson, TypeAdapter<T> typeAdapter) {
|
||||
this.gson = gson;
|
||||
this.adapter = typeAdapter;
|
||||
}
|
||||
|
||||
@Override // retrofit2.Converter
|
||||
public T convert(ResponseBody responseBody) throws IOException {
|
||||
try {
|
||||
try {
|
||||
String string = responseBody.string();
|
||||
if ((!TextUtils.isEmpty(string) && string.contains("accessKeyId") && string.contains("securityToken") && string.contains("accessKeySecret")) || string.contains("token")) {
|
||||
return this.adapter.fromJson(string);
|
||||
}
|
||||
return this.adapter.fromJson(StringUtils.a(string));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
responseBody.close();
|
||||
return null;
|
||||
}
|
||||
} finally {
|
||||
responseBody.close();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,180 @@
|
||||
package com.ubt.jimu.base.http.interceptor;
|
||||
|
||||
import android.os.SystemClock;
|
||||
import com.google.gson.Gson;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.http.ApiConstants;
|
||||
import com.ubt.jimu.user.model.SpUserHolder;
|
||||
import com.ubt.jimu.utils.DeviceUtils;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import com.ubt.jimu.utils.Md5Utils;
|
||||
import com.ubtech.utils.XLog;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import okhttp3.FormBody;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
import okio.Buffer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CommonParamsInterceptor implements Interceptor {
|
||||
private static final String APP_KEY = "a0a1dfa9a7d74d999f28b6b8ceaa0de3";
|
||||
public static final String CHARACTER = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
private static final String SIGN_PART_SEPARATOR = " ";
|
||||
private static final String TAG = "okhttp-intercept";
|
||||
private static Random sRandom = new Random();
|
||||
Map<String, String> headersMap;
|
||||
Map<String, String> postMap;
|
||||
Map<String, String> queryMap;
|
||||
|
||||
public static class Builder {
|
||||
CommonParamsInterceptor interceptor = new CommonParamsInterceptor();
|
||||
|
||||
public Builder addHeaders(Map<String, String> map) {
|
||||
this.interceptor.headersMap.putAll(map);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addPostParams(String str, String str2) {
|
||||
this.interceptor.postMap.put(str, str2);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addQueryParams(String str, String str2) {
|
||||
this.interceptor.queryMap.put(str, str2);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommonParamsInterceptor build() {
|
||||
return this.interceptor;
|
||||
}
|
||||
|
||||
public Builder addPostParams(Map<String, String> map) {
|
||||
if (map != null && map.size() > 0) {
|
||||
this.interceptor.postMap.putAll(map);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addQueryParams(Map<String, String> map) {
|
||||
this.interceptor.queryMap.putAll(map);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private Request addQueryParams2Url(HttpUrl.Builder builder, Request.Builder builder2, Map<String, String> map) {
|
||||
if (map.size() <= 0) {
|
||||
return builder2.build();
|
||||
}
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
builder.addQueryParameter(entry.getKey(), entry.getValue());
|
||||
}
|
||||
builder2.url(builder.build());
|
||||
return builder2.build();
|
||||
}
|
||||
|
||||
private String bodyToString(RequestBody requestBody) {
|
||||
try {
|
||||
Buffer buffer = new Buffer();
|
||||
if (requestBody == null) {
|
||||
return "";
|
||||
}
|
||||
requestBody.writeTo(buffer);
|
||||
return buffer.readUtf8();
|
||||
} catch (IOException unused) {
|
||||
return "did not work";
|
||||
}
|
||||
}
|
||||
|
||||
private static long getServerTimestamp() {
|
||||
long j = Cache.getInstance().differ;
|
||||
return j <= 0 ? System.currentTimeMillis() : j + SystemClock.elapsedRealtime();
|
||||
}
|
||||
|
||||
private static String randomAlphanumeric(int i) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (int i2 = 0; i2 < i; i2++) {
|
||||
stringBuffer.append(CHARACTER.charAt(sRandom.nextInt(62)));
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private static String sign() {
|
||||
long currentTimeMillis = System.currentTimeMillis() / 1000;
|
||||
return Md5Utils.a(currentTimeMillis + APP_KEY) + SIGN_PART_SEPARATOR + currentTimeMillis;
|
||||
}
|
||||
|
||||
public static String sign2() {
|
||||
long serverTimestamp = getServerTimestamp() / 1000;
|
||||
String randomAlphanumeric = randomAlphanumeric(10);
|
||||
return Md5Utils.a(serverTimestamp + APP_KEY + randomAlphanumeric + DeviceUtils.a(JimuApplication.l())) + SIGN_PART_SEPARATOR + serverTimestamp + SIGN_PART_SEPARATOR + randomAlphanumeric + SIGN_PART_SEPARATOR + "v2";
|
||||
}
|
||||
|
||||
@Override // okhttp3.Interceptor
|
||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||
Request request = chain.request();
|
||||
Request.Builder newBuilder = request.newBuilder();
|
||||
if (this.headersMap.size() > 0) {
|
||||
for (Map.Entry<String, String> entry : this.headersMap.entrySet()) {
|
||||
newBuilder.addHeader(entry.getKey(), entry.getValue());
|
||||
XLog.a(TAG, "intercept Header:%s, %s", entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
newBuilder.addHeader("language", JimuApplication.l().g());
|
||||
LogUtils.b("header:language " + JimuApplication.l().g());
|
||||
newBuilder.addHeader(ApiConstants.AREA, JimuApplication.l().c());
|
||||
LogUtils.b("header:area " + JimuApplication.l().c());
|
||||
newBuilder.addHeader(ApiConstants.AUTHORIZATION, SpUserHolder.b() > 0 ? SpUserHolder.c() : Cache.getInstance().getUserToken());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("header=authorization :");
|
||||
sb.append(SpUserHolder.b() > 0 ? SpUserHolder.c() : Cache.getInstance().getUserToken());
|
||||
sb.append(" 本地token:");
|
||||
sb.append(Cache.getInstance().getUserToken());
|
||||
LogUtils.c(sb.toString());
|
||||
newBuilder.addHeader(ApiConstants.KEY_SIGN, sign2());
|
||||
LogUtils.c("header=X-UBT-Sign :" + sign2());
|
||||
newBuilder.addHeader(ApiConstants.KEY_DEVICE_ID, DeviceUtils.a(JimuApplication.l()));
|
||||
LogUtils.c("header=X-UBT-DeviceId :" + DeviceUtils.a(JimuApplication.l()));
|
||||
Request addQueryParams2Url = addQueryParams2Url(request.url().newBuilder(), newBuilder, this.queryMap);
|
||||
if (addQueryParams2Url.method().equals("POST") || addQueryParams2Url.method().equals("PUT")) {
|
||||
HashMap hashMap = new HashMap();
|
||||
if (addQueryParams2Url.body() instanceof FormBody) {
|
||||
FormBody formBody = (FormBody) addQueryParams2Url.body();
|
||||
if (formBody.size() > 0) {
|
||||
int size = formBody.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
hashMap.put(formBody.name(i), formBody.value(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
hashMap.putAll(ApiConstants.getBasicParams());
|
||||
if (this.postMap.size() > 0) {
|
||||
hashMap.putAll(this.postMap);
|
||||
}
|
||||
String json = new Gson().toJson(hashMap);
|
||||
MediaType parse = MediaType.parse("application/json; charset=utf-8");
|
||||
if (addQueryParams2Url.method().equals("PUT")) {
|
||||
newBuilder.put(RequestBody.create(parse, json));
|
||||
} else {
|
||||
newBuilder.post(RequestBody.create(MediaType.parse("application/json;charset=UTF-8"), bodyToString(addQueryParams2Url.body()))).build();
|
||||
}
|
||||
} else if (addQueryParams2Url.method().equals("GET")) {
|
||||
addQueryParams2Url = newBuilder.url(addQueryParams2Url.url().newBuilder().addQueryParameter("language", JimuApplication.l().g()).build()).build();
|
||||
}
|
||||
return chain.proceed(addQueryParams2Url);
|
||||
}
|
||||
|
||||
private CommonParamsInterceptor() {
|
||||
this.queryMap = new HashMap();
|
||||
this.postMap = new HashMap();
|
||||
this.headersMap = new HashMap();
|
||||
}
|
||||
}
|
@@ -0,0 +1,151 @@
|
||||
package com.ubt.jimu.base.http.interceptor;
|
||||
|
||||
import android.os.SystemClock;
|
||||
import android.text.TextUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.db.user.UserDbHandler;
|
||||
import com.ubt.jimu.base.entities.User;
|
||||
import com.ubt.jimu.base.event.MessageEvent;
|
||||
import com.ubt.jimu.base.http.ApiClient;
|
||||
import com.ubt.jimu.base.http.ApiConstants;
|
||||
import com.ubt.jimu.base.http.ApiResultException;
|
||||
import com.ubt.jimu.base.http.response.Timestamp;
|
||||
import com.ubt.jimu.base.http.service.UserService;
|
||||
import com.ubt.jimu.user.repository.UserRepository;
|
||||
import com.ubt.jimu.utils.JsonHelper;
|
||||
import com.ubt.jimu.utils.ShortcutHelper;
|
||||
import com.ubtech.utils.StringUtils;
|
||||
import com.ubtech.utils.XLog;
|
||||
import com.ubtrobot.log.ALog;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
import okio.Buffer;
|
||||
import okio.BufferedSource;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ResponseBodyInterceptor implements Interceptor {
|
||||
private static final Charset UTF8 = Charset.forName("UTF-8");
|
||||
private final int SIGNATURE_FAILED = 1003;
|
||||
private volatile boolean requesting = false;
|
||||
private AtomicInteger retryNum = new AtomicInteger(0);
|
||||
private long future = 0;
|
||||
|
||||
private void getServerTimestamp() {
|
||||
((UserService) ApiClient.getService(UserService.class)).getServerTimestamp().observeOn(Schedulers.b()).observeOn(Schedulers.b()).subscribe(new Observer<Timestamp>() { // from class: com.ubt.jimu.base.http.interceptor.ResponseBodyInterceptor.1
|
||||
private void setLocalTime() {
|
||||
long elapsedRealtime = SystemClock.elapsedRealtime();
|
||||
Cache.getInstance().differ = System.currentTimeMillis() - elapsedRealtime;
|
||||
if (ResponseBodyInterceptor.this.retryNum.get() < 10) {
|
||||
ResponseBodyInterceptor.this.retryNum.incrementAndGet();
|
||||
}
|
||||
ResponseBodyInterceptor responseBodyInterceptor = ResponseBodyInterceptor.this;
|
||||
responseBodyInterceptor.future = (elapsedRealtime + 1000) << responseBodyInterceptor.retryNum.get();
|
||||
ResponseBodyInterceptor.this.requesting = false;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
setLocalTime();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onNext(Timestamp timestamp) {
|
||||
if (timestamp == null || timestamp.getTimestamp() == 0) {
|
||||
setLocalTime();
|
||||
return;
|
||||
}
|
||||
Cache.getInstance().differ = (timestamp.getTimestamp() * 1000) - SystemClock.elapsedRealtime();
|
||||
ResponseBodyInterceptor.this.retryNum.set(0);
|
||||
ResponseBodyInterceptor.this.future = 0L;
|
||||
ResponseBodyInterceptor.this.requesting = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void logout() {
|
||||
try {
|
||||
Cache.getInstance().clearCacheUser();
|
||||
UserDbHandler.clearUser();
|
||||
ShortcutHelper.a(JimuApplication.l());
|
||||
EventBus.b().b(new MessageEvent(1));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private Response tryAgain(Response response) {
|
||||
if (!this.requesting) {
|
||||
if (this.future > SystemClock.elapsedRealtime()) {
|
||||
return response;
|
||||
}
|
||||
getServerTimestamp();
|
||||
this.requesting = true;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override // okhttp3.Interceptor
|
||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||
ApiResultException apiResultException;
|
||||
Request request = chain.request();
|
||||
try {
|
||||
Response proceed = chain.proceed(request);
|
||||
ResponseBody body = proceed.body();
|
||||
BufferedSource source = body.source();
|
||||
source.request(Long.MAX_VALUE);
|
||||
Buffer buffer = source.buffer();
|
||||
Charset charset = UTF8;
|
||||
MediaType contentType = body.contentType();
|
||||
if (contentType != null) {
|
||||
charset = contentType.charset(UTF8);
|
||||
}
|
||||
String readString = buffer.clone().readString(charset);
|
||||
ALog.a("ResponseBodyInterceptor").d(StringUtils.a(readString));
|
||||
if (proceed.code() != 401) {
|
||||
if (proceed.code() != 200 && (apiResultException = (ApiResultException) JsonHelper.b(readString, ApiResultException.class)) != null && apiResultException.getCode() == 1003) {
|
||||
return tryAgain(proceed);
|
||||
}
|
||||
if (proceed.code() == 200) {
|
||||
return proceed;
|
||||
}
|
||||
throw ((ApiResultException) new Gson().fromJson(readString, ApiResultException.class));
|
||||
}
|
||||
if (!UserRepository.e()) {
|
||||
User user = UserDbHandler.getUser();
|
||||
XLog.a("ResponseBodyInterceptor", "user %s", user);
|
||||
String token = user != null ? user.getToken() : null;
|
||||
if (!TextUtils.isEmpty(token)) {
|
||||
String header = request.headers() != null ? request.header(ApiConstants.AUTHORIZATION) : null;
|
||||
XLog.a("ResponseBodyInterceptor", "[request]header %s \n[response]header %s", request.headers(), proceed.headers());
|
||||
XLog.a("ResponseBodyInterceptor", "last Token %s, cur token %s", header, token);
|
||||
if (token != null && token.equals(header)) {
|
||||
logout();
|
||||
}
|
||||
}
|
||||
}
|
||||
throw ((ApiResultException) new Gson().fromJson(readString, ApiResultException.class));
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
146
sources/com/ubt/jimu/base/http/manager/CommunityManager.java
Normal file
146
sources/com/ubt/jimu/base/http/manager/CommunityManager.java
Normal file
@@ -0,0 +1,146 @@
|
||||
package com.ubt.jimu.base.http.manager;
|
||||
|
||||
import com.ubt.jimu.Channel;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.entities.CollectionEntities;
|
||||
import com.ubt.jimu.base.entities.CommentBean;
|
||||
import com.ubt.jimu.base.entities.CommentEntities;
|
||||
import com.ubt.jimu.base.entities.DeletePostEntities;
|
||||
import com.ubt.jimu.base.entities.FavouriteBean;
|
||||
import com.ubt.jimu.base.entities.FollowEntities;
|
||||
import com.ubt.jimu.base.entities.GuessEnjoyEntities;
|
||||
import com.ubt.jimu.base.entities.IssueDetailBean;
|
||||
import com.ubt.jimu.base.entities.MyPostListEntities;
|
||||
import com.ubt.jimu.base.entities.ReportBean;
|
||||
import com.ubt.jimu.base.entities.UpdateApkEntities;
|
||||
import com.ubt.jimu.base.http.ApiClient;
|
||||
import com.ubt.jimu.base.http.ApiConstants;
|
||||
import com.ubt.jimu.base.http.ApiObserver;
|
||||
import com.ubt.jimu.base.http.service.CommunityService;
|
||||
import com.ubt.jimu.base.http.service.CourseService;
|
||||
import com.ubt.jimu.utils.PackageHelper;
|
||||
import com.ubt.jimu.utils.TextUtils;
|
||||
import java.util.HashMap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CommunityManager extends Manager {
|
||||
private static CommunityManager mHttpManager;
|
||||
|
||||
private CommunityManager() {
|
||||
}
|
||||
|
||||
private int channel() {
|
||||
for (Channel channel : Channel.values()) {
|
||||
if (channel.getChannelName().equals(PackageHelper.a("CHANNEL_ID"))) {
|
||||
return channel.getChannelId();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static synchronized CommunityManager create() {
|
||||
CommunityManager communityManager;
|
||||
synchronized (CommunityManager.class) {
|
||||
if (mHttpManager == null) {
|
||||
mHttpManager = new CommunityManager();
|
||||
}
|
||||
communityManager = mHttpManager;
|
||||
}
|
||||
return communityManager;
|
||||
}
|
||||
|
||||
public void addComment(String str, int i, int i2, int i3, ApiObserver<CommentEntities> apiObserver) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("content", String.valueOf(str));
|
||||
hashMap.put("postId", String.valueOf(i));
|
||||
hashMap.put("replyTo", String.valueOf(i2));
|
||||
hashMap.put("type", String.valueOf(i3));
|
||||
toSubscribe(((CommunityService) ApiClient.getService(CommunityService.class)).addComment(hashMap), apiObserver);
|
||||
}
|
||||
|
||||
public void collectionList(String str, int i, ApiObserver<CollectionEntities> apiObserver) {
|
||||
toSubscribe(((CommunityService) ApiClient.getService(CommunityService.class)).collectionList(TextUtils.f(str), i, 12), apiObserver);
|
||||
}
|
||||
|
||||
public void collectionPost(int i, ApiObserver<FollowEntities> apiObserver) {
|
||||
noAddSubscribe(((CommunityService) ApiClient.getService(CommunityService.class)).collecttion(i), apiObserver);
|
||||
}
|
||||
|
||||
public void commentList(int i, int i2, int i3, ApiObserver<CommentBean> apiObserver) {
|
||||
toSubscribe(((CommunityService) ApiClient.getService(CommunityService.class)).commentList(i, i2, i3), apiObserver);
|
||||
}
|
||||
|
||||
public void delCollectionPost(String str, ApiObserver<Boolean> apiObserver) {
|
||||
noAddSubscribe(((CommunityService) ApiClient.getService(CommunityService.class)).delCollectionList(str), apiObserver);
|
||||
}
|
||||
|
||||
public void deletePost(int i, ApiObserver<DeletePostEntities> apiObserver) {
|
||||
noAddSubscribe(((CommunityService) ApiClient.getService(CommunityService.class)).deletePost(i), apiObserver);
|
||||
}
|
||||
|
||||
public void guessLove(ApiObserver<GuessEnjoyEntities> apiObserver) {
|
||||
toSubscribe(((CommunityService) ApiClient.getService(CommunityService.class)).guessLove(TextUtils.f(Cache.getInstance().getUserId()), 1), apiObserver);
|
||||
}
|
||||
|
||||
public void guessReload(int i, ApiObserver<GuessEnjoyEntities> apiObserver) {
|
||||
toSubscribe(((CommunityService) ApiClient.getService(CommunityService.class)).guessReload(TextUtils.f(Cache.getInstance().getUserId()), i), apiObserver);
|
||||
}
|
||||
|
||||
public void hot(int i, ApiObserver<FavouriteBean> apiObserver) {
|
||||
toSubscribe(((CommunityService) ApiClient.getService(CommunityService.class)).hot(i, 20), apiObserver);
|
||||
}
|
||||
|
||||
public void lastest(int i, ApiObserver<FavouriteBean> apiObserver) {
|
||||
toSubscribe(((CommunityService) ApiClient.getService(CommunityService.class)).lastest(i, 12), apiObserver);
|
||||
}
|
||||
|
||||
public void likeList(String str, int i, int i2, ApiObserver<FavouriteBean> apiObserver) {
|
||||
toSubscribe(((CommunityService) ApiClient.getService(CommunityService.class)).likeList(TextUtils.f(str), i, i2), apiObserver);
|
||||
}
|
||||
|
||||
public void loadIssueDetail(int i, String str, ApiObserver<IssueDetailBean> apiObserver) {
|
||||
toSubscribe(((CommunityService) ApiClient.getService(CommunityService.class)).loadIssueDetail(i, TextUtils.f(str)), apiObserver);
|
||||
}
|
||||
|
||||
public void myReportList(String str, int i, int i2, ApiObserver<MyPostListEntities> apiObserver) {
|
||||
toSubscribe(((CommunityService) ApiClient.getService(CommunityService.class)).myReportList(TextUtils.f(str), i, i2), apiObserver);
|
||||
}
|
||||
|
||||
public void praise(int i, ApiObserver<FollowEntities> apiObserver) {
|
||||
noAddSubscribe(((CommunityService) ApiClient.getService(CommunityService.class)).praise(i), apiObserver);
|
||||
}
|
||||
|
||||
public void presentSearchResult(ApiObserver<String> apiObserver) {
|
||||
toSubscribe(((CommunityService) ApiClient.getService(CommunityService.class)).presetSearchResult(JimuApplication.l().g()), apiObserver);
|
||||
}
|
||||
|
||||
public void reportProblem(int i, int i2, String str, ApiObserver<ReportBean> apiObserver) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("postId", i + "");
|
||||
hashMap.put("type", i2 + "");
|
||||
hashMap.put("content", str);
|
||||
noAddSubscribe(((CommunityService) ApiClient.getService(CommunityService.class)).reportProblem(hashMap), apiObserver);
|
||||
}
|
||||
|
||||
public void subscriptionAdd(int i, ApiObserver<FollowEntities> apiObserver) {
|
||||
toSubscribe(((CommunityService) ApiClient.getService(CommunityService.class)).subscriptionAdd(i), apiObserver);
|
||||
}
|
||||
|
||||
public void updateApp(ApiObserver<UpdateApkEntities> apiObserver) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("currentVersion", ApiConstants.getAppVersion());
|
||||
hashMap.put("channel", channel() + "");
|
||||
hashMap.putAll(ApiConstants.getBasicParams());
|
||||
toSubscribe(((CourseService) ApiClient.getService(CourseService.class)).updateApp(hashMap), apiObserver);
|
||||
}
|
||||
|
||||
public void userSearchResult(String str, String str2, String str3, int i, int i2, ApiObserver apiObserver) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("keyword", str);
|
||||
hashMap.put("language", JimuApplication.l().g());
|
||||
hashMap.put("type", str2);
|
||||
hashMap.put("userId", TextUtils.f(str3) + "");
|
||||
toSubscribe("post".equals(str2) ? ((CommunityService) ApiClient.getService(CommunityService.class)).userSearchContentResult(hashMap, i, i2) : "question".equals(str2) ? ((CommunityService) ApiClient.getService(CommunityService.class)).userSearchQuizResult(hashMap, i, i2) : ((CommunityService) ApiClient.getService(CommunityService.class)).userSearchUserResult(hashMap, i, i2), apiObserver);
|
||||
}
|
||||
}
|
158
sources/com/ubt/jimu/base/http/manager/DiyManager.java
Normal file
158
sources/com/ubt/jimu/base/http/manager/DiyManager.java
Normal file
@@ -0,0 +1,158 @@
|
||||
package com.ubt.jimu.base.http.manager;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.db.diy.DiyProgramFileDbHandler;
|
||||
import com.ubt.jimu.base.entities.ApiRecord;
|
||||
import com.ubt.jimu.base.entities.PartEntities;
|
||||
import com.ubt.jimu.base.http.ApiClient;
|
||||
import com.ubt.jimu.base.http.ApiObserver;
|
||||
import com.ubt.jimu.base.http.service.DiyService;
|
||||
import com.ubt.jimu.diy.DiyRobotFile;
|
||||
import com.ubt.jimu.diy.model.BuildCompletedImage;
|
||||
import com.ubt.jimu.diy.model.DiyActionFile;
|
||||
import com.ubt.jimu.diy.model.DiyCommentModel;
|
||||
import com.ubt.jimu.diy.model.DiyDetailsModel;
|
||||
import com.ubt.jimu.diy.model.DiyModel;
|
||||
import com.ubt.jimu.diy.model.DiyModelFile;
|
||||
import com.ubt.jimu.diy.model.DiyProgramFile;
|
||||
import com.ubt.jimu.diy.model.PraiseModel;
|
||||
import com.ubt.jimu.transport.model.TransportFile;
|
||||
import com.ubt.jimu.utils.LocaleUtils;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.functions.Function3;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyManager extends Manager {
|
||||
public static final int DIY_TYPE_OFFICIAL = 1;
|
||||
public static final int DIY_TYPE_USER = 0;
|
||||
|
||||
private static class DiyManagerHelper {
|
||||
private static final DiyManager INSTANCE = new DiyManager();
|
||||
|
||||
private DiyManagerHelper() {
|
||||
}
|
||||
}
|
||||
|
||||
public static DiyManager getInstance() {
|
||||
return DiyManagerHelper.INSTANCE;
|
||||
}
|
||||
|
||||
public void actionFile(DiyDetailsModel diyDetailsModel, ApiObserver<ApiRecord<DiyActionFile>> apiObserver) {
|
||||
noAddSubscribe(((DiyService) ApiClient.getService(DiyService.class)).actionFiles(1, 100, diyDetailsModel.getId().longValue()), apiObserver);
|
||||
}
|
||||
|
||||
public void addComment(String str, int i, int i2, int i3, int i4, int i5, int i6, long j, ApiObserver<PraiseModel> apiObserver) {
|
||||
HashMap hashMap = new HashMap();
|
||||
if (!TextUtils.isEmpty(str)) {
|
||||
hashMap.put("content", str);
|
||||
}
|
||||
hashMap.put("praise", Integer.valueOf(i));
|
||||
hashMap.put("creative", Integer.valueOf(i2));
|
||||
hashMap.put("funny", Integer.valueOf(i3));
|
||||
hashMap.put("build", Integer.valueOf(i4));
|
||||
hashMap.put(TransportFile.TYPE_PROGRAM, Integer.valueOf(i5));
|
||||
hashMap.put("design", Integer.valueOf(i6));
|
||||
hashMap.put("modelId", Long.valueOf(j));
|
||||
toSubscribe(((DiyService) ApiClient.getService(DiyService.class)).addPraise(hashMap), apiObserver);
|
||||
}
|
||||
|
||||
public void buildCompleted(long j, ApiObserver<List<BuildCompletedImage>> apiObserver) {
|
||||
toSubscribe(((DiyService) ApiClient.getService(DiyService.class)).buildCompleted(j), apiObserver);
|
||||
}
|
||||
|
||||
public void diyComments(int i, int i2, long j, ApiObserver<ApiRecord<DiyCommentModel>> apiObserver) {
|
||||
toSubscribe(((DiyService) ApiClient.getService(DiyService.class)).diyComentList(i, i2, j), apiObserver);
|
||||
}
|
||||
|
||||
public void diyDetails(int i, long j, ApiObserver<DiyDetailsModel> apiObserver) {
|
||||
toSubscribe(((DiyService) ApiClient.getService(DiyService.class)).diyDetails(i, j), apiObserver);
|
||||
}
|
||||
|
||||
public void diyFiles(final DiyDetailsModel diyDetailsModel, ApiObserver<List<DiyRobotFile>> apiObserver) {
|
||||
if (diyDetailsModel == null) {
|
||||
return;
|
||||
}
|
||||
noAddSubscribe(Observable.zip(((DiyService) ApiClient.getService(DiyService.class)).modelFiles(diyDetailsModel.getId().longValue()), ((DiyService) ApiClient.getService(DiyService.class)).actionFiles(1, 1000, diyDetailsModel.getId().longValue()), ((DiyService) ApiClient.getService(DiyService.class)).programFiles(1, 1000, diyDetailsModel.getId().longValue()), new Function3<List<DiyModelFile>, ApiRecord<DiyActionFile>, ApiRecord<DiyProgramFile>, List<DiyRobotFile>>() { // from class: com.ubt.jimu.base.http.manager.DiyManager.1
|
||||
@Override // io.reactivex.functions.Function3
|
||||
public List<DiyRobotFile> apply(List<DiyModelFile> list, ApiRecord<DiyActionFile> apiRecord, ApiRecord<DiyProgramFile> apiRecord2) throws Exception {
|
||||
List<DiyProgramFile> records;
|
||||
List<DiyActionFile> records2;
|
||||
ArrayList arrayList = new ArrayList();
|
||||
List<DiyRobotFile> modelFiles = DiyModelFile.getModelFiles(diyDetailsModel.getCustomModelId(), list);
|
||||
if (modelFiles != null && modelFiles.size() > 0) {
|
||||
arrayList.addAll(modelFiles);
|
||||
}
|
||||
if (apiRecord != null && (records2 = apiRecord.getRecords()) != null && records2.size() > 0) {
|
||||
Iterator<DiyActionFile> it = records2.iterator();
|
||||
while (it.hasNext()) {
|
||||
DiyRobotFile modelFile = DiyActionFile.getModelFile(diyDetailsModel.getCustomModelId(), it.next());
|
||||
if (modelFile != null) {
|
||||
arrayList.add(modelFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (apiRecord2 != null && (records = apiRecord2.getRecords()) != null && records.size() > 0) {
|
||||
DiyProgramFileDbHandler diyProgramFileDbHandler = new DiyProgramFileDbHandler(DatabaseUtils.getDaoSession(true).g());
|
||||
String b = LocaleUtils.b();
|
||||
for (DiyProgramFile diyProgramFile : records) {
|
||||
if (b.equals(diyProgramFile.getLanguage())) {
|
||||
diyProgramFile.setCustomModelId(diyDetailsModel.getCustomModelId());
|
||||
if (TextUtils.isEmpty(diyProgramFile.getType())) {
|
||||
diyProgramFile.setType("newBlockly");
|
||||
}
|
||||
diyProgramFileDbHandler.insertOrUpdate(diyProgramFile);
|
||||
DiyRobotFile modelFile2 = DiyProgramFile.getModelFile(diyDetailsModel.getCustomModelId(), diyProgramFile);
|
||||
if (modelFile2 != null) {
|
||||
arrayList.add(modelFile2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
}), apiObserver);
|
||||
}
|
||||
|
||||
public void diyList(int i, int i2, int i3, ApiObserver<ApiRecord<DiyModel>> apiObserver) {
|
||||
toSubscribe(((DiyService) ApiClient.getService(DiyService.class)).diyList(i, i2, i3), apiObserver);
|
||||
}
|
||||
|
||||
public void diyModelId(int i, int i2, int i3, ApiObserver<String> apiObserver) {
|
||||
toSubscribe(((DiyService) ApiClient.getService(DiyService.class)).diyModeId(i, i2, 12), apiObserver);
|
||||
}
|
||||
|
||||
public void diyPartList(ApiObserver<PartEntities> apiObserver) {
|
||||
toSubscribe(((DiyService) ApiClient.getService(DiyService.class)).diyPartList("", 100000, 0), apiObserver);
|
||||
}
|
||||
|
||||
public void diyParts(long j, ApiObserver<ApiRecord<PartEntities.RecordsBean>> apiObserver) {
|
||||
toSubscribe(((DiyService) ApiClient.getService(DiyService.class)).diyParts("", 1, 100000, j), apiObserver);
|
||||
}
|
||||
|
||||
public void modelFiles(DiyDetailsModel diyDetailsModel, ApiObserver<List<DiyModelFile>> apiObserver) {
|
||||
noAddSubscribe(((DiyService) ApiClient.getService(DiyService.class)).modelFiles(diyDetailsModel.getId().longValue()), apiObserver);
|
||||
}
|
||||
|
||||
public void programFiles(DiyDetailsModel diyDetailsModel, ApiObserver<ApiRecord<DiyProgramFile>> apiObserver) {
|
||||
noAddSubscribe(((DiyService) ApiClient.getService(DiyService.class)).programFiles(1, 100, diyDetailsModel.getId().longValue()), apiObserver);
|
||||
}
|
||||
|
||||
public void addComment(String str, String str2, ApiObserver<Object> apiObserver) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("content", str);
|
||||
hashMap.put("praise", "0");
|
||||
hashMap.put("creative", "0");
|
||||
hashMap.put("funny", "0");
|
||||
hashMap.put("build", "0");
|
||||
hashMap.put(TransportFile.TYPE_PROGRAM, "0");
|
||||
hashMap.put("design", "0");
|
||||
hashMap.put("star", "0");
|
||||
hashMap.put("modelId", str2);
|
||||
noAddSubscribe(((DiyService) ApiClient.getService(DiyService.class)).addComment(hashMap), apiObserver);
|
||||
}
|
||||
}
|
50
sources/com/ubt/jimu/base/http/manager/Manager.java
Normal file
50
sources/com/ubt/jimu/base/http/manager/Manager.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package com.ubt.jimu.base.http.manager;
|
||||
|
||||
import com.ubt.jimu.base.http.ApiObserver;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.Function;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Manager {
|
||||
public static final List<SubscriberModel> mList = new ArrayList();
|
||||
protected String url;
|
||||
|
||||
private boolean isRepeat(Observer observer) {
|
||||
if (mList.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
Iterator<SubscriberModel> it = mList.iterator();
|
||||
while (it.hasNext()) {
|
||||
if (observer.toString().equals(it.next().getSubscriber().toString())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public <T> void noAddSubscribe(Observable<T> observable, ApiObserver<T> apiObserver) {
|
||||
observable.subscribeOn(Schedulers.b()).unsubscribeOn(Schedulers.b()).observeOn(AndroidSchedulers.a()).subscribe(apiObserver);
|
||||
}
|
||||
|
||||
public <T> void toSubscribe(final Observable<T> observable, ApiObserver<T> apiObserver) {
|
||||
if (!isRepeat(apiObserver)) {
|
||||
SubscriberModel subscriberModel = new SubscriberModel();
|
||||
subscriberModel.setObservable(observable);
|
||||
subscriberModel.setSubscriber(apiObserver);
|
||||
mList.add(subscriberModel);
|
||||
}
|
||||
observable.subscribeOn(Schedulers.b()).onErrorReturn(new Function<Throwable, T>() { // from class: com.ubt.jimu.base.http.manager.Manager.1
|
||||
@Override // io.reactivex.functions.Function
|
||||
public T apply(Throwable th) {
|
||||
observable.unsubscribeOn(Schedulers.b());
|
||||
return null;
|
||||
}
|
||||
}).unsubscribeOn(Schedulers.b()).observeOn(AndroidSchedulers.a()).subscribe(apiObserver);
|
||||
}
|
||||
}
|
44
sources/com/ubt/jimu/base/http/manager/MsgCenterManager.java
Normal file
44
sources/com/ubt/jimu/base/http/manager/MsgCenterManager.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.ubt.jimu.base.http.manager;
|
||||
|
||||
import com.ubt.jimu.base.entities.ApiRecord;
|
||||
import com.ubt.jimu.base.http.ApiClient;
|
||||
import com.ubt.jimu.base.http.ApiObserver;
|
||||
import com.ubt.jimu.base.http.service.MessageCenterService;
|
||||
import com.ubt.jimu.message.JimuMessage;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class MsgCenterManager extends Manager {
|
||||
|
||||
private static class MsgManagerHelper {
|
||||
private static final MsgCenterManager INSTANCE = new MsgCenterManager();
|
||||
|
||||
private MsgManagerHelper() {
|
||||
}
|
||||
}
|
||||
|
||||
public static MsgCenterManager getInstance() {
|
||||
return MsgManagerHelper.INSTANCE;
|
||||
}
|
||||
|
||||
public void getUnreadMsgCount(ApiObserver<HashMap<String, Integer>> apiObserver) {
|
||||
noAddSubscribe(((MessageCenterService) ApiClient.getService(MessageCenterService.class)).unread(), apiObserver);
|
||||
}
|
||||
|
||||
public void list(int i, int i2, String str, ApiObserver<ApiRecord<JimuMessage>> apiObserver) {
|
||||
noAddSubscribe(((MessageCenterService) ApiClient.getService(MessageCenterService.class)).list(String.valueOf(i), String.valueOf(i2), str), apiObserver);
|
||||
}
|
||||
|
||||
public void news(int i, int i2, String str, ApiObserver<ApiRecord<JimuMessage>> apiObserver) {
|
||||
noAddSubscribe(((MessageCenterService) ApiClient.getService(MessageCenterService.class)).news(i, i2), apiObserver);
|
||||
}
|
||||
|
||||
public void setAllMsgState(ApiObserver<Object> apiObserver) {
|
||||
noAddSubscribe(((MessageCenterService) ApiClient.getService(MessageCenterService.class)).readAll(), apiObserver);
|
||||
}
|
||||
|
||||
public void setMsgState(long j, ApiObserver<Map<String, Boolean>> apiObserver) {
|
||||
noAddSubscribe(((MessageCenterService) ApiClient.getService(MessageCenterService.class)).read(String.valueOf(j)), apiObserver);
|
||||
}
|
||||
}
|
35
sources/com/ubt/jimu/base/http/manager/SubscriberModel.java
Normal file
35
sources/com/ubt/jimu/base/http/manager/SubscriberModel.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package com.ubt.jimu.base.http.manager;
|
||||
|
||||
import com.ubt.jimu.base.http.ApiObserver;
|
||||
import io.reactivex.Observable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SubscriberModel {
|
||||
private String TAG;
|
||||
private Observable observable;
|
||||
private ApiObserver subscriber;
|
||||
|
||||
public Observable getObservable() {
|
||||
return this.observable;
|
||||
}
|
||||
|
||||
public ApiObserver getSubscriber() {
|
||||
return this.subscriber;
|
||||
}
|
||||
|
||||
public String getTAG() {
|
||||
return this.TAG;
|
||||
}
|
||||
|
||||
public void setObservable(Observable observable) {
|
||||
this.observable = observable;
|
||||
}
|
||||
|
||||
public void setSubscriber(ApiObserver apiObserver) {
|
||||
this.subscriber = apiObserver;
|
||||
}
|
||||
|
||||
public void setTAG(String str) {
|
||||
this.TAG = str;
|
||||
}
|
||||
}
|
10
sources/com/ubt/jimu/base/http/response/Timestamp.java
Normal file
10
sources/com/ubt/jimu/base/http/response/Timestamp.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.ubt.jimu.base.http.response;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Timestamp {
|
||||
private long timestamp;
|
||||
|
||||
public long getTimestamp() {
|
||||
return this.timestamp;
|
||||
}
|
||||
}
|
166
sources/com/ubt/jimu/base/http/service/CommunityService.java
Normal file
166
sources/com/ubt/jimu/base/http/service/CommunityService.java
Normal file
@@ -0,0 +1,166 @@
|
||||
package com.ubt.jimu.base.http.service;
|
||||
|
||||
import com.ubt.jimu.base.entities.Act;
|
||||
import com.ubt.jimu.base.entities.ApiRecord;
|
||||
import com.ubt.jimu.base.entities.Award;
|
||||
import com.ubt.jimu.base.entities.AwardItem;
|
||||
import com.ubt.jimu.base.entities.CollectionEntities;
|
||||
import com.ubt.jimu.base.entities.CommentBean;
|
||||
import com.ubt.jimu.base.entities.CommentEntities;
|
||||
import com.ubt.jimu.base.entities.CommunityReturnBean;
|
||||
import com.ubt.jimu.base.entities.CreativeListResultBean;
|
||||
import com.ubt.jimu.base.entities.CreativeResultBean;
|
||||
import com.ubt.jimu.base.entities.DeletePostEntities;
|
||||
import com.ubt.jimu.base.entities.FavouriteBean;
|
||||
import com.ubt.jimu.base.entities.FollowEntities;
|
||||
import com.ubt.jimu.base.entities.GuessEnjoyEntities;
|
||||
import com.ubt.jimu.base.entities.InfoStatus;
|
||||
import com.ubt.jimu.base.entities.IssueDetailBean;
|
||||
import com.ubt.jimu.base.entities.JoinArticle;
|
||||
import com.ubt.jimu.base.entities.MyPostListEntities;
|
||||
import com.ubt.jimu.base.entities.PublishLabelBean;
|
||||
import com.ubt.jimu.base.entities.PublishReturnBean;
|
||||
import com.ubt.jimu.base.entities.Push;
|
||||
import com.ubt.jimu.base.entities.QuestionBean;
|
||||
import com.ubt.jimu.base.entities.RecommendBean;
|
||||
import com.ubt.jimu.base.entities.ReportBean;
|
||||
import com.ubt.jimu.base.entities.SearchContentBean;
|
||||
import com.ubt.jimu.base.entities.SearchQuizBean;
|
||||
import com.ubt.jimu.base.entities.SearchUserBean;
|
||||
import com.ubt.jimu.base.entities.UComment;
|
||||
import com.ubt.jimu.base.entities.UploadParameterBean;
|
||||
import io.reactivex.Observable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.DELETE;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Header;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Path;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface CommunityService {
|
||||
public static final String BASE_URL = "https://jimu.ubtrobot.com";
|
||||
public static final String HOST_URL_ACTIVITY = "https://jimu.ubtrobot.com";
|
||||
public static final String HOST_URL_COMMUNITY = "https://apis.ubtrobot.com";
|
||||
public static final String addUrl = "https://apis.ubtrobot.com/v2/community/app/subscription/add";
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/operation-rest/comment/add")
|
||||
Observable<UComment> addActivityComment(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://apis.ubtrobot.com/v2/community/app/comment/add")
|
||||
Observable<CommentEntities> addComment(@Body Map<String, String> map);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/userCenter/collectList")
|
||||
Observable<CollectionEntities> collectionList(@Query("userId") int i, @Query("_index") int i2, @Query("_size") int i3);
|
||||
|
||||
@POST("https://apis.ubtrobot.com/v2/community/app/collect/add")
|
||||
Observable<FollowEntities> collecttion(@Query("postId") int i);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/comment/list")
|
||||
Observable<CommentBean> commentList(@Query("postId") int i, @Query("_index") int i2, @Query("_size") int i3);
|
||||
|
||||
@DELETE("https://apis.ubtrobot.com/v2/community/app/collect/del/batch")
|
||||
Observable<Boolean> delCollectionList(@Query("delIds") String str);
|
||||
|
||||
@DELETE("https://apis.ubtrobot.com/v2/community/app/postInfo/delete")
|
||||
Observable<DeletePostEntities> deletePost(@Query("postId") int i);
|
||||
|
||||
@GET("https://jimu.ubtrobot.com/operation-rest/activity/{activityId}")
|
||||
Observable<Act> getActivityById(@Path("activityId") long j);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/operation-rest/push/list")
|
||||
Observable<List<Push>> getActivityByType(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/operation-rest/comment/list")
|
||||
Observable<List<UComment>> getActivityCommentList(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/operation-rest/activity/list/app")
|
||||
Observable<List<Act>> getActivityList(@Body Map<String, String> map);
|
||||
|
||||
@GET("https://jimu.ubtrobot.com/operation-rest/awards/list/{activityId}")
|
||||
Observable<List<AwardItem>> getAwardList(@Path("activityId") long j);
|
||||
|
||||
@GET("https://jimu.ubtrobot.com/operation-rest/rewards/list/{activityId}")
|
||||
Observable<List<Award>> getAwardSettingList(@Path("activityId") long j);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/Works/list")
|
||||
Observable<ApiRecord<JoinArticle>> getJoinActivityArticleList(@Query("activityId") long j, @Query("_index") int i, @Query("_size") int i2, @Query("status") int i3);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/tag/list")
|
||||
Observable<List<PublishLabelBean>> getPublishLabel();
|
||||
|
||||
@POST("/jimu/community/findSections")
|
||||
Observable<String> getSections();
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/operation-rest/push/list")
|
||||
Observable<List<Push>> getUserAwardInfo(@Body Map<String, String> map);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/postInfo/guess")
|
||||
Observable<GuessEnjoyEntities> guessLove(@Query("userId") int i, @Query("_index") int i2);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/postInfo/guess/reload")
|
||||
Observable<GuessEnjoyEntities> guessReload(@Query("userId") int i, @Query("_index") int i2);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/postInfo/hot")
|
||||
Observable<FavouriteBean> hot(@Query("_index") int i, @Query("_size") int i2);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/postInfo/latest")
|
||||
Observable<FavouriteBean> lastest(@Query("_index") int i, @Query("_size") int i2);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/postInfo/favarator")
|
||||
Observable<FavouriteBean> likeList(@Query("userId") int i, @Query("_index") int i2, @Query("_size") int i3);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/index/detail")
|
||||
Observable<CommunityReturnBean> loadCommunityHomePageData(@Query("imageHeight") int i, @Query("imageWidth") int i2, @Query("systemLanguage") String str, @Query("type") String str2);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/postInfo/creative")
|
||||
Observable<CreativeResultBean> loadCreativeData(@Query("_index") String str, @Query("_size") String str2, @Query("language") String str3);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/creative/list")
|
||||
Observable<CreativeListResultBean> loadCreativeList(@Query("_index") String str, @Query("_size") String str2);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/postInfo/detail")
|
||||
Observable<IssueDetailBean> loadIssueDetail(@Query("id") int i, @Query("userId") int i2);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/question/list")
|
||||
Observable<QuestionBean> loadQuestionData(@Header("token") String str, @Query("_index") String str2, @Query("_size") String str3);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/postInfo/getByUserId")
|
||||
Observable<MyPostListEntities> myReportList(@Query("userId") int i, @Query("_index") int i2, @Query("_size") int i3);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/operation-rest/comment/praise/add")
|
||||
Observable<String> postLike(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/operation-rest/comment/add")
|
||||
Observable<UComment> postReply(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://apis.ubtrobot.com/v2/community/app/praise/add")
|
||||
Observable<FollowEntities> praise(@Query("postId") int i);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/search/keywords/default")
|
||||
Observable<RecommendBean> presetSearchResult(@Query("language") String str);
|
||||
|
||||
@POST("https://apis.ubtrobot.com/v2/community/app/postInfo/upload?")
|
||||
Observable<PublishReturnBean> publishArticle(@Body UploadParameterBean uploadParameterBean);
|
||||
|
||||
@POST("https://apis.ubtrobot.com/v2/community/app/complain/add")
|
||||
Observable<ReportBean> reportProblem(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://apis.ubtrobot.com/v2/community/app/Works/awards/receive")
|
||||
Observable<InfoStatus> setUserRewards(@Query("rewardsId") int i);
|
||||
|
||||
@POST(addUrl)
|
||||
Observable<FollowEntities> subscriptionAdd(@Query("followUserId") int i);
|
||||
|
||||
@POST("https://apis.ubtrobot.com/v2/community/app/search/list")
|
||||
Observable<SearchContentBean> userSearchContentResult(@Body Map<String, String> map, @Query("_index") int i, @Query("_size") int i2);
|
||||
|
||||
@POST("https://apis.ubtrobot.com/v2/community/app/search/list")
|
||||
Observable<SearchQuizBean> userSearchQuizResult(@Body Map<String, String> map, @Query("_index") int i, @Query("_size") int i2);
|
||||
|
||||
@POST("https://apis.ubtrobot.com/v2/community/app/search/list")
|
||||
Observable<SearchUserBean> userSearchUserResult(@Body Map<String, String> map, @Query("_index") int i, @Query("_size") int i2);
|
||||
}
|
53
sources/com/ubt/jimu/base/http/service/CourseService.java
Normal file
53
sources/com/ubt/jimu/base/http/service/CourseService.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.ubt.jimu.base.http.service;
|
||||
|
||||
import com.ubt.jimu.base.entities.ActionResult;
|
||||
import com.ubt.jimu.base.entities.ApiResult;
|
||||
import com.ubt.jimu.base.entities.Course;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.base.entities.Story;
|
||||
import com.ubt.jimu.base.entities.UpdateApkEntities;
|
||||
import com.ubt.jimu.base.http.ApiResponse;
|
||||
import com.ubt.jimu.course.repository.JimuCourse;
|
||||
import com.ubt.jimu.course.repository.JimuCourseMission;
|
||||
import com.ubt.jimu.course.repository.JimuCourseTask;
|
||||
import com.ubt.jimu.course.repository.UpdateMission;
|
||||
import io.reactivex.Observable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface CourseService {
|
||||
public static final String HOST_URL = "https://jimu.ubtrobot.com";
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/jimu/mission/findMissions")
|
||||
Observable<ApiResponse<List<JimuCourse>>> getCourses(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/jimu/mission/findMissions")
|
||||
Observable<ApiResponse<List<JimuCourseTask>>> getMissions(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/jimu/course/findStories")
|
||||
Observable<ApiResponse<List<Story>>> getStoryList(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/jimu/course/findUserCourses")
|
||||
Observable<ApiResponse<List<Course>>> getUserCourseList(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/jimu/model/findModel")
|
||||
Observable<ApiResponse<List<Robot>>> loadRobotInfoById(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/jimu/mission/models")
|
||||
Observable<ApiResult<Robot>> missionModelsList(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/jimu/mission/skipMission")
|
||||
Observable<ApiResponse<List<JimuCourseMission>>> skipMission(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/jimu/system/nextVersion")
|
||||
Observable<UpdateApkEntities> updateApp(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/jimu/course/updateCourse")
|
||||
Observable<ApiResponse<ActionResult>> updateCourseStatus(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/jimu/mission/updateMission")
|
||||
Observable<ApiResponse<UpdateMission>> updateMission(@Body Map<String, String> map);
|
||||
}
|
65
sources/com/ubt/jimu/base/http/service/DiyService.java
Normal file
65
sources/com/ubt/jimu/base/http/service/DiyService.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package com.ubt.jimu.base.http.service;
|
||||
|
||||
import com.ubt.jimu.base.entities.ApiRecord;
|
||||
import com.ubt.jimu.base.entities.PartEntities;
|
||||
import com.ubt.jimu.diy.model.BuildCompletedImage;
|
||||
import com.ubt.jimu.diy.model.DiyActionFile;
|
||||
import com.ubt.jimu.diy.model.DiyCommentModel;
|
||||
import com.ubt.jimu.diy.model.DiyDetailsModel;
|
||||
import com.ubt.jimu.diy.model.DiyModel;
|
||||
import com.ubt.jimu.diy.model.DiyModelFile;
|
||||
import com.ubt.jimu.diy.model.DiyProgramFile;
|
||||
import com.ubt.jimu.diy.model.PraiseModel;
|
||||
import io.reactivex.Observable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface DiyService {
|
||||
public static final String BASE_URL = "https://jimu.ubtrobot.com";
|
||||
public static final String HOST_URL_ACTIVITY = "https://jimu.ubtrobot.com";
|
||||
public static final String HOST_URL_COMMUNITY = "https://apis.ubtrobot.com";
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/diy/action/list/model")
|
||||
Observable<ApiRecord<DiyActionFile>> actionFiles(@Query("_index") int i, @Query("_size") int i2, @Query("modelId") long j);
|
||||
|
||||
@POST("https://apis.ubtrobot.com/v2/community/app/diy/comment/add/model")
|
||||
Observable<Object> addComment(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://apis.ubtrobot.com/v2/community/app/diy/model/oplogs/add")
|
||||
Observable<PraiseModel> addPraise(@Body Map<String, Object> map);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/diy/sample/model")
|
||||
Observable<List<BuildCompletedImage>> buildCompleted(@Query("modelId") long j);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/diy/comment/list/page")
|
||||
Observable<ApiRecord<DiyCommentModel>> diyComentList(@Query("_index") int i, @Query("_size") int i2, @Query("modelId") long j);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/diy/index/model")
|
||||
Observable<DiyDetailsModel> diyDetails(@Query("userId") int i, @Query("modelId") long j);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/diy/list/page")
|
||||
Observable<ApiRecord<DiyModel>> diyList(@Query("_index") int i, @Query("_size") int i2, @Query("type") int i3);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/diy/components")
|
||||
Observable<String> diyModeId(@Query("modelId") int i, @Query("_index") int i2, @Query("_size") int i3);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/diy/components/page")
|
||||
Observable<PartEntities> diyPartList(@Query("type") String str, @Query("_size") int i, @Query("_index") int i2);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/diy/components/model")
|
||||
Observable<ApiRecord<PartEntities.RecordsBean>> diyParts(@Query("type") String str, @Query("_index") int i, @Query("_size") int i2, @Query("modelId") long j);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/diy/step/model")
|
||||
Observable<Object> diySteps(@Query("modelId") long j, @Query("stepIndex") long j2);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/diy/files/model")
|
||||
Observable<List<DiyModelFile>> modelFiles(@Query("modelId") long j);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/diy/program/list/model")
|
||||
Observable<ApiRecord<DiyProgramFile>> programFiles(@Query("_index") int i, @Query("_size") int i2, @Query("modelId") long j);
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package com.ubt.jimu.base.http.service;
|
||||
|
||||
import com.ubt.jimu.base.entities.ApiRecord;
|
||||
import com.ubt.jimu.message.JimuMessage;
|
||||
import io.reactivex.Observable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.PATCH;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface MessageCenterService {
|
||||
public static final String HOST_URL = "https://apis.ubtrobot.com";
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/userMessage/list")
|
||||
Observable<ApiRecord<JimuMessage>> list(@Query("_index") String str, @Query("_size") String str2, @Query("categoryId") String str3);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/userMessage/news")
|
||||
Observable<ApiRecord<JimuMessage>> news(@Query("_index") int i, @Query("_size") int i2);
|
||||
|
||||
@PATCH("https://apis.ubtrobot.com/v2/community/app/userMessage/read")
|
||||
Observable<Map<String, Boolean>> read(@Query("messageId") String str);
|
||||
|
||||
@PATCH("https://apis.ubtrobot.com/v2/community/app/userMessage/readAll")
|
||||
Observable<Object> readAll();
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/userMessage/message/unread")
|
||||
Observable<HashMap<String, Integer>> unread();
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
package com.ubt.jimu.base.http.service;
|
||||
|
||||
import com.ubt.jimu.base.entities.ActiveStat;
|
||||
import com.ubt.jimu.base.entities.ApiResult;
|
||||
import com.ubt.jimu.base.entities.FirmwareVersion;
|
||||
import com.ubt.jimu.base.entities.Package;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.base.http.ApiResponse;
|
||||
import io.reactivex.Observable;
|
||||
import java.util.Map;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface PackageRobotService {
|
||||
public static final String BASE_URL = "https://jimu.ubtrobot.com";
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/jimu/equipment/active")
|
||||
Observable<ApiResult<ActiveStat>> activeRobot(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/jimu/version/check")
|
||||
Observable<ApiResult<FirmwareVersion>> appUpdate(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/jimu/package/code")
|
||||
Observable<ApiResponse<Package>> findPackage(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/jimu/package/find?")
|
||||
Observable<ApiResult<Package>> getPackage(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/jimu/package/findPackageModel?")
|
||||
Observable<ApiResult<Robot>> getRobotByPackage(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/jimu/version/queryList")
|
||||
Observable<ApiResult<FirmwareVersion>> hardwareUpdate(@Body Map<String, String> map);
|
||||
}
|
15
sources/com/ubt/jimu/base/http/service/ShopHttpService.java
Normal file
15
sources/com/ubt/jimu/base/http/service/ShopHttpService.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.ubt.jimu.base.http.service;
|
||||
|
||||
import com.ubt.jimu.base.entities.ShopBean;
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ShopHttpService {
|
||||
public static final String BASE_URL = "https://jimu.ubtrobot.com";
|
||||
public static final String HOST_URL_ACTIVITY = "https://jimu.ubtrobot.com";
|
||||
public static final String HOST_URL_COMMUNITY = "https://apis.ubtrobot.com";
|
||||
|
||||
@GET("https://jimu.ubtrobot.com/jimu/common/queryPurchaseChannels/zh-hans")
|
||||
Observable<ShopBean> getCourses();
|
||||
}
|
152
sources/com/ubt/jimu/base/http/service/UserService.java
Normal file
152
sources/com/ubt/jimu/base/http/service/UserService.java
Normal file
@@ -0,0 +1,152 @@
|
||||
package com.ubt.jimu.base.http.service;
|
||||
|
||||
import com.ubt.jimu.base.entities.AddressInfo;
|
||||
import com.ubt.jimu.base.entities.ApiRecord;
|
||||
import com.ubt.jimu.base.entities.ApiStatus;
|
||||
import com.ubt.jimu.base.entities.ArticleBean;
|
||||
import com.ubt.jimu.base.entities.Fans;
|
||||
import com.ubt.jimu.base.entities.FeedbackEntities;
|
||||
import com.ubt.jimu.base.entities.FollowEntities;
|
||||
import com.ubt.jimu.base.entities.Interest;
|
||||
import com.ubt.jimu.base.entities.MyPostListEntities;
|
||||
import com.ubt.jimu.base.entities.PraiseBean;
|
||||
import com.ubt.jimu.base.entities.QuestionBean;
|
||||
import com.ubt.jimu.base.entities.Rank;
|
||||
import com.ubt.jimu.base.entities.RegisterBean;
|
||||
import com.ubt.jimu.base.entities.ReqSaveUserPactInfo;
|
||||
import com.ubt.jimu.base.entities.TTSAccessToken;
|
||||
import com.ubt.jimu.base.entities.TokenBean;
|
||||
import com.ubt.jimu.base.entities.UserDetailInfo;
|
||||
import com.ubt.jimu.base.entities.UserExtraInfo;
|
||||
import com.ubt.jimu.base.entities.UserPactInfo;
|
||||
import com.ubt.jimu.base.http.response.Timestamp;
|
||||
import com.ubt.jimu.user.feedback.FeedbackPostBean;
|
||||
import com.ubt.jimu.user.model.EmailCheckMsg;
|
||||
import io.reactivex.Observable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.DELETE;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Header;
|
||||
import retrofit2.http.PATCH;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.PUT;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface UserService {
|
||||
public static final String HOST_URL_COMMUNITY = "https://apis.ubtrobot.com";
|
||||
public static final String HOST_URL_REGISTER = "https://apis.ubtrobot.com/user-service-rest/v2";
|
||||
|
||||
@POST("https://apis.ubtrobot.com/v2/community/app/praise/add")
|
||||
Observable<FollowEntities> addPraise(@Query("postId") int i);
|
||||
|
||||
@PATCH("https://apis.ubtrobot.com/user-service-rest/v2/user/account/bind")
|
||||
Observable<UserDetailInfo> bindAccount(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://apis.ubtrobot.com/user-service-rest/v2/verify/newUserForProduct")
|
||||
Observable<ApiStatus> checkHadLogin(@Body Map<String, Object> map);
|
||||
|
||||
@DELETE("https://apis.ubtrobot.com/user-service-rest/v2/user")
|
||||
Observable<ApiStatus> deleteUserInfo(@Query("isThird") int i, @Query("pwd") String str);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/user-service-rest/v2/user/captcha")
|
||||
Observable<ApiStatus> getCaptcha(@Query("account") String str, @Query("accountType") int i, @Query("purpose") int i2);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/user-service-rest/v2/user/captcha")
|
||||
Observable<ApiStatus> getCaptcha(@Query("account") String str, @Query("accountType") String str2, @Query("purpose") String str3, @Query("zhFlag") String str4, @Query("appId") String str5);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/user-service-rest/v2/device/imei")
|
||||
Observable<ApiStatus> getImei(@Query("account") String str);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/user-service-rest/v2/gdpr/pactInfo")
|
||||
Observable<UserPactInfo> getPactInfo(@Query("productId") String str, @Query("type") int i, @Query("lan") String str2);
|
||||
|
||||
@GET("https://jimu.ubtrobot.com/jimu/user/getParentSure")
|
||||
Observable<EmailCheckMsg> getParentEmailCheckState(@Query("email") String str, @Query("deviceId") String str2);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/userCenter/users/ranking")
|
||||
Observable<List<Rank>> getRankList(@Query("userId") long j);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v1/client-auth-service/api/timestamp")
|
||||
Observable<Timestamp> getServerTimestamp();
|
||||
|
||||
@GET("https://apis.ubtrobot.com/user-service-rest/v2/tts/access-token")
|
||||
Observable<TTSAccessToken> getTTSToken();
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/userCenter/address")
|
||||
Observable<AddressInfo> getUserAddress(@Query("userId") long j);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/userCenter/collectList")
|
||||
Observable<List<ArticleBean.Article>> getUserCollectList(@Query("userId") long j);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/user-service-rest/v2/user/info")
|
||||
Observable<UserDetailInfo> getUserDetailInfo();
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/userCenter/fansList")
|
||||
Observable<ApiRecord<Fans>> getUserFansList(@Query("userId") long j, @Query("viewUserId") long j2, @Query("_index") int i, @Query("_size") int i2);
|
||||
|
||||
@POST("https://apis.ubtrobot.com/v2/community/app/userCenter/detail")
|
||||
Observable<UserExtraInfo> getUserInfo(@Body Map<String, String> map);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/userCenter/subList")
|
||||
Observable<ApiRecord<Interest>> getUserInterestList(@Query("userId") long j, @Query("viewUserId") long j2, @Query("_index") int i, @Query("_size") int i2);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/user-service-rest/v2/gdpr/userPactInfo")
|
||||
Observable<UserPactInfo> getUserPactInfo(@Query("productId") String str, @Query("userId") long j, @Query("lan") String str2);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/postInfo/getByUserId")
|
||||
Observable<MyPostListEntities> getUserPostList(@Query("userId") long j);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/praise/list")
|
||||
Observable<PraiseBean> getUserPraiseList(@Query("userId") long j, @Query("_index") int i, @Query("_size") int i2);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/v2/community/app/question/getByUserId")
|
||||
Observable<QuestionBean> getUserQuestionList(@Query("userId") long j, @Query("_index") int i, @Query("_size") int i2);
|
||||
|
||||
@PUT("https://apis.ubtrobot.com/user-service-rest/v2/user/login")
|
||||
Observable<RegisterBean> login(@Body Map<String, String> map);
|
||||
|
||||
@DELETE("https://apis.ubtrobot.com/user-service-rest/v2/user/logout")
|
||||
Observable<ApiStatus> logout(@Header("token") String str);
|
||||
|
||||
@PUT("https://apis.ubtrobot.com/user-service-rest/v2/user/token/refresh")
|
||||
Observable<TokenBean> refreshToken();
|
||||
|
||||
@POST("https://apis.ubtrobot.com/user-service-rest/v2/user/register")
|
||||
Observable<RegisterBean> register(@Body Map<String, String> map);
|
||||
|
||||
@PATCH("https://apis.ubtrobot.com/user-service-rest/v2/user/password/reset")
|
||||
Observable<ApiStatus> resetPassword(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://apis.ubtrobot.com/user-service-rest/v2/gdpr/saveUserPact")
|
||||
Observable<ApiStatus> saveUserPact(@Body List<ReqSaveUserPactInfo> list);
|
||||
|
||||
@POST("https://jimu.ubtrobot.com/jimu/feedback/add")
|
||||
Observable<FeedbackEntities> sendFeedback(@Body FeedbackPostBean feedbackPostBean);
|
||||
|
||||
@POST("https://apis.ubtrobot.com/user-service-rest/v2/htmlEmail/jimu")
|
||||
Observable<ApiStatus> sendGuardianEmail(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://apis.ubtrobot.com/user-service-rest/v2/user/register/emailverify")
|
||||
Observable<RegisterBean> setPasswordAndLogin(@Body Map<String, String> map);
|
||||
|
||||
@PUT("https://apis.ubtrobot.com/user-service-rest/v2/user/login/third")
|
||||
Observable<RegisterBean> thirdLogin(@Body Map<String, String> map);
|
||||
|
||||
@POST("https://apis.ubtrobot.com/user-service-rest/v2/device/imei")
|
||||
Observable<ApiStatus> updateImei(@Header("appId") String str, @Query("imei") String str2);
|
||||
|
||||
@PATCH("https://apis.ubtrobot.com/v2/community/app/userCenter/address/update")
|
||||
Observable<String> updateUserAddress(@Body Map<String, String> map);
|
||||
|
||||
@PATCH("https://apis.ubtrobot.com/user-service-rest/v2/user")
|
||||
Observable<UserDetailInfo> updateUserDetailInfo(@Body Map<String, String> map);
|
||||
|
||||
@GET("https://apis.ubtrobot.com/user-service-rest/v2/user/captcha/verify-result")
|
||||
Observable<TokenBean> verifyCaptcha(@Query("account") String str, @Query("captcha") String str2, @Query("accountType") int i);
|
||||
|
||||
@POST("https://apis.ubtrobot.com/user-service-rest/v2/device/imei/check")
|
||||
Observable<ApiStatus> verifyImei(@Header("appId") String str, @Body Map<String, String> map);
|
||||
}
|
Reference in New Issue
Block a user