what-the-bank/sources/o/C0970Soj.java

143 lines
4.8 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package o;
import android.text.TextUtils;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import o.DiG;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
/* renamed from: o.Soj, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C0970Soj implements Interceptor {
private KTN a;
private final InterfaceC13393fZL c;
@InterfaceC13391fZD
public C0970Soj(KTN ktn) {
C14957gcv.e(ktn, "");
this.a = ktn;
Sts sts = Sts.a;
C14957gcv.e(sts, "");
this.c = new fZZ(sts);
}
@Override // okhttp3.Interceptor
public final Response intercept(Interceptor.Chain chain) throws IOException {
tBi tbi;
yzb status;
yzb status2;
String str;
C14957gcv.e(chain, "");
Request request = chain.request();
Response proceed = chain.proceed(request);
ArrayList arrayList = null;
String header$default = Response.header$default(proceed, "Api-Auth", null, 2, null);
String header$default2 = Response.header$default(proceed, "Api-Refresh", null, 2, null);
String str2 = header$default;
if (!(str2 == null || gdZ.d((CharSequence) str2))) {
KTN ktn = this.a;
if (!TextUtils.isEmpty(header$default)) {
ktn.c = header$default;
}
}
String str3 = header$default2;
if (!(str3 == null || gdZ.d((CharSequence) str3))) {
this.a.g.edit().putString("com.scb.phone.pref.key.API_REFRESH", header$default2).commit();
}
if (!proceed.isSuccessful() && !proceed.isRedirect()) {
return proceed;
}
try {
tbi = (tBi) ((Gson) this.c.e()).fromJson(proceed.peekBody(Long.MAX_VALUE).charStream(), tBi.class);
} catch (Exception e) {
guQ.a(e);
tbi = null;
}
if (tbi != null) {
String obj = request.url().toString();
if ((tbi != null ? tbi.getError() : null) != null) {
status = tbi.getError();
} else {
status = ((tbi == null || (status2 = tbi.getStatus()) == null) ? null : status2.e) != null ? tbi.getStatus() : null;
}
if (status != null) {
String str4 = status.e;
String str5 = status.b;
String str6 = status.h;
if (status.g != null) {
str = status.g;
} else {
str = status.c;
}
if (C14957gcv.b((Object) "1002", (Object) str4)) {
C15296gmk.b().e(new C14809gE(str6, str));
} else if (!C14957gcv.b((Object) "111", (Object) str5)) {
if (C14957gcv.b((Object) "426", (Object) str4)) {
C15296gmk.b().e(new C15597gw(str6, str, d(tbi)));
}
} else {
List<SWg> list = status.d;
if (list != null) {
List<SWg> list2 = list;
C14957gcv.e(list2, "");
ArrayList arrayList2 = new ArrayList(list2 instanceof Collection ? list2.size() : 10);
for (SWg sWg : list2) {
arrayList2.add(sWg != null ? new mNf(sWg.c, sWg.e, sWg.b) : null);
}
arrayList = arrayList2;
}
C15296gmk.b().e(new C15599gx(status.b, status.e, obj, status.i, status.h, status.c, arrayList == null ? C14851gaI.c : arrayList, status.f, status.a));
}
}
DiG.Sts sts = DiG.a;
DiG.Sts.d(tbi);
}
return proceed;
}
private final String d(tBi tbi) {
try {
return ((RKq) ((Gson) this.c.e()).fromJson(((Gson) this.c.e()).toJson(tbi != null ? tbi.b : null), RKq.class)).b;
} catch (Exception e) {
guQ.a(e);
return null;
}
}
/* renamed from: o.Soj$IeS */
/* loaded from: classes.dex */
public static final class IeS {
private IeS() {
}
public /* synthetic */ IeS(byte b) {
this();
}
}
/* renamed from: o.Soj$Sts */
/* loaded from: classes.dex */
static final class Sts extends AbstractC14961gcz implements InterfaceC14890gbN<Gson> {
public static final Sts a = new Sts();
@Override // o.InterfaceC14890gbN
public final /* synthetic */ Gson invoke() {
return new GsonBuilder().setLenient().serializeNulls().create();
}
Sts() {
super(0);
}
}
static {
new IeS((byte) 0);
}
}