正在查看: Clash Legends v0.0.1 应用的 ApiClient.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Clash Legends v0.0.1 应用的 ApiClient.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package co.paystack.android.api;
import android.os.Build;
import co.paystack.android.BuildConfig;
import co.paystack.android.api.service.ApiService;
import co.paystack.android.api.utils.TLSSocketFactory;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.util.concurrent.TimeUnit;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class ApiClient {
private ApiService apiService;
private static final String BASE_URL = "https://standard.paystack.co/";
public static String API_URL = BASE_URL;
public ApiClient() throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException {
Gson gson = new GsonBuilder().setDateFormat("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'SSS'Z'").create();
TLSSocketFactory tlsV1point2factory = new TLSSocketFactory();
OkHttpClient okHttpClient = new OkHttpClient.Builder().addInterceptor(new Interceptor() {
public Response intercept(Interceptor.Chain chain) throws IOException {
Request original = chain.request();
Request.Builder builder = original.newBuilder().header("User-Agent", "Android_" + Build.VERSION.SDK_INT + "_Paystack_" + BuildConfig.VERSION_NAME).header("X-Paystack-Build", String.valueOf(-1)).header("Accept", "application/json").method(original.method(), original.body());
Request request = builder.build();
return chain.proceed(request);
}
}).sslSocketFactory(tlsV1point2factory, tlsV1point2factory.getX509TrustManager()).connectTimeout(5L, TimeUnit.MINUTES).readTimeout(5L, TimeUnit.MINUTES).writeTimeout(5L, TimeUnit.MINUTES).build();
Retrofit retrofit = new Retrofit.Builder().baseUrl(API_URL).client(okHttpClient).addConverterFactory(GsonConverterFactory.create(gson)).build();
this.apiService = (ApiService) retrofit.create(ApiService.class);
}
public ApiService getApiService() {
return this.apiService;
}
}