花瓣 v4.6.12版本的 MD5 值为:6a3515d4d16d98931f1b3d25a91b257e
以下内容为反编译后的 ParadigmServiceGenerator.java 源代码,内容仅作参考
package com.huaban.android.services;
import android.content.Context;
import android.provider.Settings;
import com.facebook.stetho.okhttp3.StethoInterceptor;
import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.huaban.android.vendors.g;
import com.umeng.socialize.net.utils.SocializeProtocolConstants;
import h.c.a.d;
import java.util.concurrent.TimeUnit;
import kotlin.f0;
import kotlin.x2.w.k0;
import kotlin.x2.w.w;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import rx.schedulers.Schedulers;
@f0(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0002\u0018\u0002\n\u0002\b\u0004\u0018\u0000 \u0003:\u0001\u0003B\u0007¢\u0006\u0004\b\u0001\u0010\u0002¨\u0006\u0004"}, d2 = {"Lcom/huaban/android/services/ParadigmServiceGenerator;", "<init>", "()V", "Companion", "container.HuabanApp_release"}, k = 1, mv = {1, 1, 15}, pn = "", xi = 0, xs = "")
public final class ParadigmServiceGenerator {
@d
public static final Companion Companion = new Companion(null);
@f0(bv = {1, 0, 3}, d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\b\u0086\u0003\u0018\u0000B\t\b\u0002¢\u0006\u0004\b\u0013\u0010\u0014J\u0017\u0010\u0004\u001a\u00020\u00032\b\b\u0002\u0010\u0002\u001a\u00020\u0001¢\u0006\u0004\b\u0004\u0010\u0005J\u000f\u0010\u0007\u001a\u00020\u0006H\u0002¢\u0006\u0004\b\u0007\u0010\bJ\u0015\u0010\u000b\u001a\u00020\u00062\u0006\u0010\n\u001a\u00020\t¢\u0006\u0004\b\u000b\u0010\fJ\u0019\u0010\u000e\u001a\u0004\u0018\u00010\r2\u0006\u0010\u0002\u001a\u00020\u0001H\u0002¢\u0006\u0004\b\u000e\u0010\u000fJ\u0011\u0010\u0011\u001a\u0004\u0018\u00010\u0010H\u0002¢\u0006\u0004\b\u0011\u0010\u0012¨\u0006\u0015"}, d2 = {"Lcom/huaban/android/services/ParadigmServiceGenerator$Companion;", "", "convertCharCase", "Lcom/huaban/android/services/ParadigmService;", "createService", "(Z)Lcom/huaban/android/services/ParadigmService;", "", "getBaseUrl", "()Ljava/lang/String;", "Landroid/content/Context;", "context", "getDeviceId", "(Landroid/content/Context;)Ljava/lang/String;", "Lcom/google/gson/Gson;", "getGson", "(Z)Lcom/google/gson/Gson;", "Lokhttp3/OkHttpClient;", "getHttpClient", "()Lokhttp3/OkHttpClient;", "<init>", "()V", "container.HuabanApp_release"}, k = 1, mv = {1, 1, 15}, pn = "", xi = 0, xs = "")
public static final class Companion {
private Companion() {
}
public static ParadigmService createService$default(Companion companion, boolean z, int i2, Object obj) {
if ((i2 & 1) != 0) {
z = true;
}
return companion.createService(z);
}
private final String getBaseUrl() {
return "https://nbrecsys.4paradigm.com";
}
private final Gson getGson(boolean z) {
GsonBuilder gsonBuilder = new GsonBuilder();
if (z) {
gsonBuilder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
}
return gsonBuilder.create();
}
private final OkHttpClient getHttpClient() {
OkHttpClient.Builder connectTimeout = new OkHttpClient.Builder().dns(new g()).addNetworkInterceptor(new StethoInterceptor()).connectTimeout(5L, TimeUnit.SECONDS);
connectTimeout.addInterceptor(new Interceptor() {
@Override
@d
public final Response intercept(@d Interceptor.Chain chain) {
k0.p(chain, "chain");
Request request = chain.request();
return chain.proceed(request.newBuilder().header("User-Agent", "huaban_android_1.0").method(request.method(), request.body()).build());
}
});
return connectTimeout.build();
}
@d
public final ParadigmService createService(boolean z) {
Object create = new Retrofit.Builder().baseUrl(getBaseUrl()).addConverterFactory(GsonConverterFactory.create(getGson(z))).addCallAdapterFactory(RxJavaCallAdapterFactory.createWithScheduler(Schedulers.io())).client(getHttpClient()).build().create(ParadigmService.class);
k0.o(create, "retrofit.create(ParadigmService::class.java)");
return (ParadigmService) create;
}
@d
public final String getDeviceId(@d Context context) {
k0.p(context, "context");
try {
String string = Settings.Secure.getString(context.getContentResolver(), SocializeProtocolConstants.PROTOCOL_KEY_ANDROID_ID);
k0.o(string, "Settings.Secure.getStrin…ttings.Secure.ANDROID_ID)");
return string;
} catch (Exception unused) {
return "get device id failed";
}
}
public Companion(w wVar) {
this();
}
}
}