千寻位置 v2.8.9版本的 MD5 值为:c028423c956e81d2a162977350c0ec2e
以下内容为反编译后的 HttpInitKt.java 源代码,内容仅作参考
package com.qx.wz.qxwz.biz.init;
import android.content.Context;
import android.text.TextUtils;
import com.alipay.sdk.m.p0.b;
import com.facebook.stetho.okhttp3.StethoInterceptor;
import com.qx.wz.inteceptor.MockInterceptor;
import com.qx.wz.logger.Logger;
import com.qx.wz.net.HttpRequest;
import com.qx.wz.net.Options;
import com.qx.wz.net.internal.Params;
import com.qx.wz.net.internal.RealHttpRequest;
import com.qx.wz.qxwz.BuildConfig;
import com.qx.wz.qxwz.QxwzApp;
import com.qx.wz.qxwz.biz.common.net.QxInterceptor;
import com.qx.wz.qxwz.biz.common.net.RnConfig;
import com.qx.wz.qxwz.config.Constant;
import com.qx.wz.utils.ObjectUtil;
import com.qx.wz.utils.SharedUtil;
import com.qx.wz.utils.Static;
import com.qx.wz.utils.StringUtil;
import com.qx.wz.utils.appconfig.HelperConfigKt;
import com.qx.wz.utils.appconfig.UrlPolicyRpc;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.logging.HttpLoggingInterceptor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u001e\n\u0000\n\u0002\u0010\u000e\n\u0002\b\b\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\u001a\u001e\u0010\u0006\u001a\u0004\u0018\u00010\u00012\b\u0010\u0007\u001a\u0004\u0018\u00010\u00012\b\u0010\b\u001a\u0004\u0018\u00010\u0001H\u0002\u001a\u0010\u0010\t\u001a\u00020\n2\b\u0010\u000b\u001a\u0004\u0018\u00010\f\u001a \u0010\r\u001a\u00020\n2\b\u0010\u000b\u001a\u0004\u0018\u00010\f2\u0006\u0010\u000e\u001a\u00020\u00012\u0006\u0010\u000f\u001a\u00020\u0010\"\u0014\u0010\u0000\u001a\u00020\u0001X\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\u0002\u0010\u0003\"\u0014\u0010\u0004\u001a\u00020\u0001X\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0003¨\u0006\u0011"}, d2 = {"AIR", "", "getAIR", "()Ljava/lang/String;", "AIR_DAILY", "getAIR_DAILY", "getParam", b.d, "def", "initEnv", "", "urlPolicyRpc", "Lcom/qx/wz/utils/appconfig/UrlPolicyRpc;", "initHttpRequest", "channel", "context", "Landroid/content/Context;", "app_qxwzRelease"}, k = 2, mv = {1, 1, 13})
public final class HttpInitKt {
@NotNull
private static final String AIR = "https://restapp.qxwz.com/";
@NotNull
private static final String AIR_DAILY = "http://restapp.qxwz-daily.web.wz-inc.com/";
@NotNull
public static final String getAIR() {
return AIR;
}
@NotNull
public static final String getAIR_DAILY() {
return AIR_DAILY;
}
public static final void initEnv(@Nullable UrlPolicyRpc urlPolicyRpc) {
String str;
if (urlPolicyRpc == null || (str = urlPolicyRpc.getPolicyName()) == null) {
str = "pro";
}
SharedUtil.setPreferStr("envs", str);
QxwzApp.instance.env = str;
}
public static final void initHttpRequest(@Nullable final UrlPolicyRpc urlPolicyRpc, @NotNull final String channel, @NotNull final Context context) {
Intrinsics.checkParameterIsNotNull(channel, "channel");
Intrinsics.checkParameterIsNotNull(context, "context");
HttpRequest.setRealHttpRequest(new RealHttpRequest() {
@Override
public void init() {
String baseUrl;
String param;
String param2;
String param3;
String param4;
String param5;
String param6;
String baseUrl2;
String consoleUrl;
String h5Url;
String policyName;
if (ObjectUtil.isNull(UrlPolicyRpc.this)) {
baseUrl = BuildConfig.BASE_SERVER_URL;
} else {
UrlPolicyRpc urlPolicyRpc2 = UrlPolicyRpc.this;
if (urlPolicyRpc2 == null) {
Intrinsics.throwNpe();
}
baseUrl = urlPolicyRpc2.getBaseUrl();
}
String[] deploymentConfig = RnConfig.getDeploymentConfig(baseUrl);
RetrofitUrlManager.getInstance().setDebug(Static.DEBUG);
Params.Builder bodyParam = new Params.Builder().bodyParam(Constant.Param.Key.APP_NAME, "qxwz").bodyParam(Constant.Param.Key.APP_VERSION, "2.8.9").bodyParam("channel", channel);
param = HttpInitKt.getParam(Constant.Param.Value.DEVICE_TYPE, "0");
Params.Builder bodyParam2 = bodyParam.bodyParam("device_type", param);
param2 = HttpInitKt.getParam(Constant.Param.Value.OS_VERSION, "0");
Params.Builder bodyParam3 = bodyParam2.bodyParam("os_version", param2).bodyParam("platform", "android");
param3 = HttpInitKt.getParam(Constant.Param.Value.SCREENSIZE, "0*0");
Params.Builder queryParam = bodyParam3.bodyParam("screensize", param3).queryParam(Constant.Param.Key.APP_NAME, "qxwz").queryParam(Constant.Param.Key.APP_VERSION, "2.8.9").queryParam("channel", channel);
param4 = HttpInitKt.getParam(Constant.Param.Value.DEVICE_TYPE, "0");
Params.Builder queryParam2 = queryParam.queryParam("device_type", param4);
param5 = HttpInitKt.getParam(Constant.Param.Value.OS_VERSION, "0");
Params.Builder queryParam3 = queryParam2.queryParam("os_version", param5).queryParam("platform", "android");
param6 = HttpInitKt.getParam(Constant.Param.Value.SCREENSIZE, "0*0");
Params build = queryParam3.queryParam("screensize", param6).build();
Options.Builder context2 = new Options.Builder().context(context);
if (ObjectUtil.isNull(UrlPolicyRpc.this)) {
baseUrl2 = BuildConfig.BASE_SERVER_URL;
} else {
UrlPolicyRpc urlPolicyRpc3 = UrlPolicyRpc.this;
if (urlPolicyRpc3 == null) {
Intrinsics.throwNpe();
}
baseUrl2 = urlPolicyRpc3.getBaseUrl();
}
Options.Builder baseUrl3 = context2.baseUrl(baseUrl2);
if (ObjectUtil.isNull(UrlPolicyRpc.this)) {
consoleUrl = BuildConfig.BASE_CONSOLE_URL;
} else {
UrlPolicyRpc urlPolicyRpc4 = UrlPolicyRpc.this;
if (urlPolicyRpc4 == null) {
Intrinsics.throwNpe();
}
consoleUrl = urlPolicyRpc4.getConsoleUrl();
}
Options.Builder consoleUrl2 = baseUrl3.consoleUrl(consoleUrl);
if (ObjectUtil.isNull(UrlPolicyRpc.this)) {
h5Url = "qxwz.com";
} else {
UrlPolicyRpc urlPolicyRpc5 = UrlPolicyRpc.this;
if (urlPolicyRpc5 == null) {
Intrinsics.throwNpe();
}
h5Url = urlPolicyRpc5.getH5Url();
}
Options.Builder rnDeploymentInfo = consoleUrl2.h5Url(h5Url).rnDeploymentInfo(deploymentConfig);
if (ObjectUtil.isNull(UrlPolicyRpc.this)) {
policyName = "release";
} else {
UrlPolicyRpc urlPolicyRpc6 = UrlPolicyRpc.this;
if (urlPolicyRpc6 == null) {
Intrinsics.throwNpe();
}
policyName = urlPolicyRpc6.getPolicyName();
}
Options build2 = rnDeploymentInfo.policyName(policyName).interceptor(new QxInterceptor()).interceptor(new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
@Override
public final void log(String message) {
if (TextUtils.isEmpty(message)) {
return;
}
Intrinsics.checkExpressionValueIsNotNull(message, "message");
if (StringsKt.startsWith$default(message, "{", false, 2, (Object) null) || StringsKt.startsWith$default(message, "[", false, 2, (Object) null)) {
Logger.json(message);
} else {
Logger.d(message, new Object[0]);
}
}
}).setLevel(HttpLoggingInterceptor.Level.BODY)).networkInterceptor(new StethoInterceptor()).networkInterceptor(new MockInterceptor()).params(build).build();
initOptions(build2);
if (!HelperConfigKt.getHelperConfig().isDailyAir()) {
RetrofitUrlManager.getInstance().putDomain("air", HttpInitKt.getAIR());
} else {
RetrofitUrlManager.getInstance().putDomain("air", HttpInitKt.getAIR_DAILY());
}
RetrofitUrlManager.getInstance().setGlobalDomain(build2.getBaseUrl());
}
});
}
public static final String getParam(String str, String str2) {
return StringUtil.isNotBlank(str) ? str : str2;
}
}