米多多 v3.0.1版本的 MD5 值为:f69e79dbe1787218a397ad907fb8f3ab
以下内容为反编译后的 a.java 源代码,内容仅作参考
package c.j.c.d.a;
import c.a.a.q.i;
import c.g.b.f;
import com.alibaba.fastjson.support.spring.FastJsonJsonView;
import com.alibaba.sdk.android.oss.common.utils.HttpHeaders;
import com.alipay.alipaysecuritysdk.common.config.Constant;
import com.base.commonlibrary.netstate.ComNetWorkUtil;
import java.io.File;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import okhttp3.Cache;
import okhttp3.CacheControl;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
public class a {
public static a f5684e;
public Retrofit f5685a;
public c f5686b;
public final Interceptor f5687c = new C0137a(this);
public final Interceptor f5688d = new b(this);
public class C0137a implements Interceptor {
public C0137a(a aVar) {
}
@Override
public Response intercept(Interceptor.Chain chain) {
Request request = chain.request();
if (!ComNetWorkUtil.b(c.a.a.a.a())) {
request = request.newBuilder().cacheControl(CacheControl.FORCE_CACHE).build();
}
Response proceed = chain.proceed(request);
if (ComNetWorkUtil.b(c.a.a.a.a())) {
return proceed.newBuilder().header(HttpHeaders.CACHE_CONTROL, request.cacheControl().toString()).removeHeader("Pragma").build();
}
return proceed.newBuilder().header(HttpHeaders.CACHE_CONTROL, "public, only-if-cached, max-stale=172800").removeHeader("Pragma").build();
}
}
public class b implements Interceptor {
public b(a aVar) {
}
@Override
public Response intercept(Interceptor.Chain chain) {
return chain.proceed(chain.request().newBuilder().addHeader(HttpHeaders.CONTENT_TYPE, FastJsonJsonView.DEFAULT_CONTENT_TYPE).addHeader("token", (String) i.b("APP_TOKEN", "")).addHeader("ClientType", Constant.SDK_OS).addHeader("ClientVersion", c.a.a.q.b.a(c.a.a.a.a())).removeHeader(HttpHeaders.USER_AGENT).addHeader(HttpHeaders.USER_AGENT, a.c()).build());
}
}
public a() {
if (!c.j.c.d.d.a.f5740a.b() && !c.j.c.d.d.a.f5740a.c()) {
OkHttpClient b2 = b();
f fVar = new f();
fVar.d("yyyy-MM-dd'T'HH:mm:ssZ");
fVar.c();
Retrofit build = new Retrofit.Builder().addConverterFactory(GsonConverterFactory.create(fVar.b())).addCallAdapterFactory(RxJavaCallAdapterFactory.create()).client(b2).baseUrl(d.f5699e).build();
this.f5685a = build;
this.f5686b = (c) build.create(c.class);
return;
}
OkHttpClient b3 = b();
f fVar2 = new f();
fVar2.d("yyyy-MM-dd'T'HH:mm:ssZ");
fVar2.c();
Retrofit build2 = new Retrofit.Builder().addConverterFactory(GsonConverterFactory.create(fVar2.b())).addCallAdapterFactory(RxJavaCallAdapterFactory.create()).client(b3).baseUrl("http://www.beizhuabao.com").build();
this.f5685a = build2;
this.f5686b = (c) build2.create(c.class);
}
public static c a() {
a aVar = new a();
f5684e = aVar;
return aVar.f5686b;
}
public static String c() {
try {
StringBuffer stringBuffer = new StringBuffer();
String property = System.getProperty("http.agent");
int length = property.length();
for (int i2 = 0; i2 < length; i2++) {
char charAt = property.charAt(i2);
if (charAt > 31 && charAt < 127) {
stringBuffer.append(charAt);
}
stringBuffer.append(String.format("\\u%04x", Integer.valueOf(charAt)));
}
return UUID.randomUUID() + "/" + c.a.a.q.b.a(c.a.a.a.a()) + " " + stringBuffer.toString();
} catch (Exception e2) {
e2.printStackTrace();
return "";
}
}
public final OkHttpClient b() {
new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY);
return new OkHttpClient.Builder().readTimeout(30000L, TimeUnit.MILLISECONDS).connectTimeout(30000L, TimeUnit.MILLISECONDS).addInterceptor(this.f5687c).addNetworkInterceptor(this.f5687c).addInterceptor(this.f5688d).cache(new Cache(new File(c.a.a.a.a().getCacheDir(), "cache"), 104857600L)).build();
}
}