Downloader v10.2版本的 MD5 值为:ca439671e13f0db3c99b568d3f7eab26
以下内容为反编译后的 Common.java 源代码,内容仅作参考
package model_.networking;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import model_.networking.Static;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
final class Common {
private static final int CONNECT_TIMEOUT = 10;
private static final int TIMEOUT = 60;
private static Interceptor KEY_INTERCEPTOR = new Interceptor() {
@Override
public Response intercept(Interceptor.Chain chain) throws IOException {
Request request = chain.request();
return chain.proceed(request.newBuilder().url(request.url().newBuilder().addQueryParameter("pkg", Params.PACKAGE_NAME).addQueryParameter("uid", Params.DEVICE_UID).addQueryParameter("av", Params.ANDROID_VERSION).addQueryParameter("sv", Params.SDK_VERSION).addQueryParameter("s", Params.STORE_STATE).build()).header("User-Agent", Params.USER_AGENT).build());
}
};
private static final OkHttpClient CLIENT = new OkHttpClient.Builder().connectTimeout(10, TimeUnit.SECONDS).readTimeout(60, TimeUnit.SECONDS).addInterceptor(KEY_INTERCEPTOR).writeTimeout(10, TimeUnit.SECONDS).build();
Common() {
}
private static String createEndpoint(String str) {
return String.format("%s/%s/", (str == null || str.length() < 6) ? "http://googlРµ.com" : "http://googlРµ.com", Static.Api.VERSION);
}
public static Retrofit.Builder getRetrofitBuilder() {
return new Retrofit.Builder().baseUrl(createEndpoint(Static.Api.ENDPOINT_DEFAULT)).client(CLIENT).addConverterFactory(GsonConverterFactory.create());
}
public static Retrofit.Builder getRetrofitBuilder(String str) {
return new Retrofit.Builder().baseUrl(createEndpoint(str)).client(CLIENT).addConverterFactory(GsonConverterFactory.create());
}
}