jimu-decompiled/sources/com/facebook/internal/FacebookRequestErrorClassification.java
2025-05-13 19:24:51 +02:00

174 lines
6.7 KiB
Java

package com.facebook.internal;
import com.facebook.FacebookRequestError;
import com.ubt.jimu.base.entities.Course;
import com.unity3d.ads.metadata.MediationMetaData;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes.dex */
public final class FacebookRequestErrorClassification {
private static FacebookRequestErrorClassification g;
private final Map<Integer, Set<Integer>> a;
private final Map<Integer, Set<Integer>> b;
private final Map<Integer, Set<Integer>> c;
private final String d;
private final String e;
private final String f;
/* renamed from: com.facebook.internal.FacebookRequestErrorClassification$3, reason: invalid class name */
static /* synthetic */ class AnonymousClass3 {
static final /* synthetic */ int[] a = new int[FacebookRequestError.Category.values().length];
static {
try {
a[FacebookRequestError.Category.OTHER.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[FacebookRequestError.Category.LOGIN_RECOVERABLE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
a[FacebookRequestError.Category.TRANSIENT.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
}
}
FacebookRequestErrorClassification(Map<Integer, Set<Integer>> map, Map<Integer, Set<Integer>> map2, Map<Integer, Set<Integer>> map3, String str, String str2, String str3) {
this.a = map;
this.b = map2;
this.c = map3;
this.d = str;
this.e = str2;
this.f = str3;
}
private static FacebookRequestErrorClassification b() {
return new FacebookRequestErrorClassification(null, new HashMap<Integer, Set<Integer>>() { // from class: com.facebook.internal.FacebookRequestErrorClassification.1
{
put(2, null);
put(4, null);
put(9, null);
put(17, null);
put(341, null);
}
}, new HashMap<Integer, Set<Integer>>() { // from class: com.facebook.internal.FacebookRequestErrorClassification.2
{
put(102, null);
put(190, null);
}
}, null, null, null);
}
public String a(FacebookRequestError.Category category) {
int i = AnonymousClass3.a[category.ordinal()];
if (i == 1) {
return this.d;
}
if (i == 2) {
return this.f;
}
if (i != 3) {
return null;
}
return this.e;
}
public FacebookRequestError.Category a(int i, int i2, boolean z) {
Set<Integer> set;
Set<Integer> set2;
Set<Integer> set3;
if (z) {
return FacebookRequestError.Category.TRANSIENT;
}
Map<Integer, Set<Integer>> map = this.a;
if (map != null && map.containsKey(Integer.valueOf(i)) && ((set3 = this.a.get(Integer.valueOf(i))) == null || set3.contains(Integer.valueOf(i2)))) {
return FacebookRequestError.Category.OTHER;
}
Map<Integer, Set<Integer>> map2 = this.c;
if (map2 != null && map2.containsKey(Integer.valueOf(i)) && ((set2 = this.c.get(Integer.valueOf(i))) == null || set2.contains(Integer.valueOf(i2)))) {
return FacebookRequestError.Category.LOGIN_RECOVERABLE;
}
Map<Integer, Set<Integer>> map3 = this.b;
if (map3 != null && map3.containsKey(Integer.valueOf(i)) && ((set = this.b.get(Integer.valueOf(i))) == null || set.contains(Integer.valueOf(i2)))) {
return FacebookRequestError.Category.TRANSIENT;
}
return FacebookRequestError.Category.OTHER;
}
public static synchronized FacebookRequestErrorClassification a() {
FacebookRequestErrorClassification facebookRequestErrorClassification;
synchronized (FacebookRequestErrorClassification.class) {
if (g == null) {
g = b();
}
facebookRequestErrorClassification = g;
}
return facebookRequestErrorClassification;
}
private static Map<Integer, Set<Integer>> a(JSONObject jSONObject) {
int optInt;
HashSet hashSet;
JSONArray optJSONArray = jSONObject.optJSONArray("items");
if (optJSONArray.length() == 0) {
return null;
}
HashMap hashMap = new HashMap();
for (int i = 0; i < optJSONArray.length(); i++) {
JSONObject optJSONObject = optJSONArray.optJSONObject(i);
if (optJSONObject != null && (optInt = optJSONObject.optInt(Course.TYPE_BLOCKLY)) != 0) {
JSONArray optJSONArray2 = optJSONObject.optJSONArray("subcodes");
if (optJSONArray2 == null || optJSONArray2.length() <= 0) {
hashSet = null;
} else {
hashSet = new HashSet();
for (int i2 = 0; i2 < optJSONArray2.length(); i2++) {
int optInt2 = optJSONArray2.optInt(i2);
if (optInt2 != 0) {
hashSet.add(Integer.valueOf(optInt2));
}
}
}
hashMap.put(Integer.valueOf(optInt), hashSet);
}
}
return hashMap;
}
public static FacebookRequestErrorClassification a(JSONArray jSONArray) {
String optString;
if (jSONArray == null) {
return null;
}
Map<Integer, Set<Integer>> map = null;
Map<Integer, Set<Integer>> map2 = null;
Map<Integer, Set<Integer>> map3 = null;
String str = null;
String str2 = null;
String str3 = null;
for (int i = 0; i < jSONArray.length(); i++) {
JSONObject optJSONObject = jSONArray.optJSONObject(i);
if (optJSONObject != null && (optString = optJSONObject.optString(MediationMetaData.KEY_NAME)) != null) {
if (optString.equalsIgnoreCase("other")) {
str = optJSONObject.optString("recovery_message", null);
map = a(optJSONObject);
} else if (optString.equalsIgnoreCase("transient")) {
str2 = optJSONObject.optString("recovery_message", null);
map2 = a(optJSONObject);
} else if (optString.equalsIgnoreCase("login_recoverable")) {
str3 = optJSONObject.optString("recovery_message", null);
map3 = a(optJSONObject);
}
}
}
return new FacebookRequestErrorClassification(map, map2, map3, str, str2, str3);
}
}