Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
package com.ubt.jimu.base.http.converter;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Converter;
import retrofit2.Retrofit;
/* loaded from: classes.dex */
public final class GsonConverterFactory extends Converter.Factory {
private final Gson gson;
private GsonConverterFactory(Gson gson) {
if (gson == null) {
throw new NullPointerException("gson==null");
}
this.gson = gson;
}
public static GsonConverterFactory create() {
return create(new Gson());
}
@Override // retrofit2.Converter.Factory
public Converter<?, RequestBody> requestBodyConverter(Type type, Annotation[] annotationArr, Annotation[] annotationArr2, Retrofit retrofit) {
return new GsonRequestBodyConverter(this.gson, this.gson.getAdapter(TypeToken.get(type)));
}
@Override // retrofit2.Converter.Factory
public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotationArr, Retrofit retrofit) {
return new GsonResponseBodyConverter(this.gson, this.gson.getAdapter(TypeToken.get(type)));
}
public static GsonConverterFactory create(Gson gson) {
return new GsonConverterFactory(gson);
}
}

View File

@@ -0,0 +1,112 @@
package com.ubt.jimu.base.http.converter;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import java.io.IOException;
import java.nio.charset.Charset;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import retrofit2.Converter;
/* loaded from: classes.dex */
public class GsonRequestBodyConverter<T> implements Converter<T, RequestBody> {
private static final MediaType MEDIA_TYPE = MediaType.parse("application/json; charset=UTF-8");
private static final Charset UTF_8 = Charset.forName("UTF-8");
private final TypeAdapter<T> adapter;
private final Gson gson;
GsonRequestBodyConverter(Gson gson, TypeAdapter<T> typeAdapter) {
this.gson = gson;
this.adapter = typeAdapter;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // retrofit2.Converter
public /* bridge */ /* synthetic */ RequestBody convert(Object obj) throws IOException {
return convert((GsonRequestBodyConverter<T>) obj);
}
/* JADX WARN: Removed duplicated region for block: B:33:0x0060 A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:40:? A[SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:41:0x0056 A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:46:0x0045 -> B:8:0x0048). Please report as a decompilation issue!!! */
@Override // retrofit2.Converter
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public okhttp3.RequestBody convert(T r6) {
/*
r5 = this;
okio.Buffer r0 = new okio.Buffer
r0.<init>()
r1 = 0
java.io.OutputStreamWriter r2 = new java.io.OutputStreamWriter // Catch: java.lang.Throwable -> L2c java.io.IOException -> L2f
java.io.OutputStream r3 = r0.outputStream() // Catch: java.lang.Throwable -> L2c java.io.IOException -> L2f
java.nio.charset.Charset r4 = com.ubt.jimu.base.http.converter.GsonRequestBodyConverter.UTF_8 // Catch: java.lang.Throwable -> L2c java.io.IOException -> L2f
r2.<init>(r3, r4) // Catch: java.lang.Throwable -> L2c java.io.IOException -> L2f
com.google.gson.Gson r3 = r5.gson // Catch: java.io.IOException -> L2a java.lang.Throwable -> L53
com.google.gson.stream.JsonWriter r1 = r3.newJsonWriter(r2) // Catch: java.io.IOException -> L2a java.lang.Throwable -> L53
com.google.gson.TypeAdapter<T> r3 = r5.adapter // Catch: java.io.IOException -> L2a java.lang.Throwable -> L53
r3.write(r1, r6) // Catch: java.io.IOException -> L2a java.lang.Throwable -> L53
if (r1 == 0) goto L26
r1.close() // Catch: java.lang.Exception -> L22
goto L26
L22:
r6 = move-exception
r6.printStackTrace()
L26:
r2.close() // Catch: java.lang.Exception -> L44
goto L48
L2a:
r6 = move-exception
goto L31
L2c:
r6 = move-exception
r2 = r1
goto L54
L2f:
r6 = move-exception
r2 = r1
L31:
r6.printStackTrace() // Catch: java.lang.Throwable -> L53
if (r1 == 0) goto L3e
r1.close() // Catch: java.lang.Exception -> L3a
goto L3e
L3a:
r6 = move-exception
r6.printStackTrace()
L3e:
if (r2 == 0) goto L48
r2.close() // Catch: java.lang.Exception -> L44
goto L48
L44:
r6 = move-exception
r6.printStackTrace()
L48:
okhttp3.MediaType r6 = com.ubt.jimu.base.http.converter.GsonRequestBodyConverter.MEDIA_TYPE
okio.ByteString r0 = r0.readByteString()
okhttp3.RequestBody r6 = okhttp3.RequestBody.create(r6, r0)
return r6
L53:
r6 = move-exception
L54:
if (r1 == 0) goto L5e
r1.close() // Catch: java.lang.Exception -> L5a
goto L5e
L5a:
r0 = move-exception
r0.printStackTrace()
L5e:
if (r2 == 0) goto L68
r2.close() // Catch: java.lang.Exception -> L64
goto L68
L64:
r0 = move-exception
r0.printStackTrace()
L68:
throw r6
*/
throw new UnsupportedOperationException("Method not decompiled: com.ubt.jimu.base.http.converter.GsonRequestBodyConverter.convert(java.lang.Object):okhttp3.RequestBody");
}
}

View File

@@ -0,0 +1,41 @@
package com.ubt.jimu.base.http.converter;
import android.text.TextUtils;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.ubtech.utils.StringUtils;
import java.io.IOException;
import okhttp3.ResponseBody;
import retrofit2.Converter;
/* loaded from: classes.dex */
public class GsonResponseBodyConverter<T> implements Converter<ResponseBody, T> {
private final TypeAdapter<T> adapter;
private final Gson gson;
private final String JSON_KEY_MODELS = "models";
private final String JSON_KEY_LIST = "list_models";
GsonResponseBodyConverter(Gson gson, TypeAdapter<T> typeAdapter) {
this.gson = gson;
this.adapter = typeAdapter;
}
@Override // retrofit2.Converter
public T convert(ResponseBody responseBody) throws IOException {
try {
try {
String string = responseBody.string();
if ((!TextUtils.isEmpty(string) && string.contains("accessKeyId") && string.contains("securityToken") && string.contains("accessKeySecret")) || string.contains("token")) {
return this.adapter.fromJson(string);
}
return this.adapter.fromJson(StringUtils.a(string));
} catch (Exception e) {
e.printStackTrace();
responseBody.close();
return null;
}
} finally {
responseBody.close();
}
}
}