Commit 7954c2bf by 郑鹏

增加调试

parent eb2094f5
No preview for this file type
......@@ -119,6 +119,8 @@ dependencies {
api 'com.qq.mta:mta:3.4.7-Release'
api 'com.tencent.mid:mid:4.06-Release'
api 'com.github.liys666666:DoubleClick:V2.0.4'
api 'com.readystatesoftware.chuck:library:1.1.0'
//添加
api project(':refresh-layout')
}
......@@ -3,12 +3,15 @@ package cn.dankal.basiclib.api;
import android.util.Log;
import com.facebook.stetho.okhttp3.StethoInterceptor;
import com.readystatesoftware.chuck.ChuckInterceptor;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;
import cn.dankal.basiclib.BuildConfig;
import cn.dankal.basiclib.DankalApplication;
import cn.dankal.basiclib.domain.HttpLoggingInterceptor;
import cn.dankal.basiclib.domain.TokenInterceptor;
import okhttp3.OkHttpClient;
......@@ -24,8 +27,10 @@ import static cn.dankal.basiclib.DankalApplication.isDev;
*/
public class BaseApi {
public static final String BASE_URL = isDev ? "https://api-koreadc.dankal.cn/v1/"
: "https://modoo-api.mhqglobal.com/v1/";
/*public static final String BASE_URL = isDev ? "https://api-koreadc.dankal.cn/v1/"
: "https://modoo-api.mhqglobal.com/v1/";*/
public static final String BASE_URL = "https://modoo-api.mhqglobal.com/v1/";
public static final String BASE_EXPRESS_URL = "https://info.sweettracker.co.kr/";
......@@ -76,29 +81,25 @@ public class BaseApi {
}
});
httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient
okHttpClient = new OkHttpClient.Builder().readTimeout(18000, TimeUnit.MILLISECONDS)
.connectTimeout(18000, TimeUnit.MILLISECONDS)
.addInterceptor(httpLoggingInterceptor)
.addInterceptor(new TokenInterceptor())
.addNetworkInterceptor(new StethoInterceptor())
.hostnameVerifier(new HostnameVerifier() {
/**
* Verify that the host name is an acceptable match with
* the server's authentication scheme.
*
* @param hostname the host name
* @param session SSLSession used on the connection to host
* @return true if the host name is acceptable
*/
//忽略证书
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
})
.build();
okHttpClient;
if (BuildConfig.DEBUG) {
okHttpClient = new OkHttpClient.Builder().readTimeout(18000, TimeUnit.MILLISECONDS)
.connectTimeout(18000, TimeUnit.MILLISECONDS)
.addInterceptor(httpLoggingInterceptor)
.addInterceptor(new TokenInterceptor())
.addNetworkInterceptor(new StethoInterceptor())
.addInterceptor(new ChuckInterceptor(DankalApplication.getContext()))
.build();
} else {
okHttpClient = new OkHttpClient.Builder().readTimeout(18000, TimeUnit.MILLISECONDS)
.connectTimeout(18000, TimeUnit.MILLISECONDS)
.addInterceptor(httpLoggingInterceptor)
.addInterceptor(new TokenInterceptor())
.addNetworkInterceptor(new StethoInterceptor())
.build();
}
return okHttpClient;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment