mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-30 11:02:31 -06:00
31 lines
947 B
Java
31 lines
947 B
Java
|
package tech.rabbit.r1launcher.utils;
|
||
|
|
||
|
import java.io.IOException;
|
||
|
import okhttp3.Interceptor;
|
||
|
import okhttp3.OkHttpClient;
|
||
|
import okhttp3.Response;
|
||
|
|
||
|
/* loaded from: classes3.dex */
|
||
|
public class OkHttpUtil {
|
||
|
private static String deviceId;
|
||
|
|
||
|
public static void setDeviceId(String str) {
|
||
|
deviceId = str;
|
||
|
}
|
||
|
|
||
|
public static OkHttpClient.Builder builder() {
|
||
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||
|
builder.addInterceptor(new Interceptor() { // from class: tech.rabbit.r1launcher.utils.OkHttpUtil.1
|
||
|
@Override // okhttp3.Interceptor
|
||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||
|
return chain.proceed(chain.request().newBuilder().header("deviceId", OkHttpUtil.deviceId).build());
|
||
|
}
|
||
|
});
|
||
|
return builder;
|
||
|
}
|
||
|
|
||
|
public static OkHttpClient client() {
|
||
|
return new OkHttpClient(builder());
|
||
|
}
|
||
|
}
|