package com.mobile.auth.c; import android.content.Context; import android.text.TextUtils; import com.mobile.auth.b.f; import com.mobile.auth.d.b; import com.mobile.auth.d.i; import com.mobile.auth.gatewayauth.a; import com.umeng.analytics.pro.bz; import java.net.URLEncoder; import java.util.List; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; import org.json.JSONArray; import org.json.JSONObject; public class d { /* renamed from: a reason: collision with root package name */ private static final String f20561a = "d"; /* renamed from: b reason: collision with root package name */ private static final byte[] f20562b = {bz.m, 31, 94, 10, 90, bz.m, 91, 24, 10, 30, 88, 7, 89, 10, 95, 30}; public static /* synthetic */ String a(Context context, Queue queue) { try { return b(context, queue); } catch (Throwable th) { a.a(th); return null; } } public static /* synthetic */ Queue a(Context context, List list, int i) { try { return c(context, list, i); } catch (Throwable th) { a.a(th); return null; } } public static /* synthetic */ void a(Context context) { try { c(context); } catch (Throwable th) { a.a(th); } } private static void a(Context context, int i) { try { b.a(context, "key_c_l_l_v", i); } catch (Exception e) { try { e.printStackTrace(); } catch (Throwable th) { a.a(th); } } } /* JADX WARNING: Removed duplicated region for block: B:19:0x0039 A[Catch:{ all -> 0x0045, all -> 0x004a }] */ public static void a(Context context, String str) { char c; try { int hashCode = str.hashCode(); int i = -1; if (hashCode != 64897) { if (hashCode != 78159) { if (hashCode == 66247144) { if (str.equals("ERROR")) { c = 1; if (c != 0) { if (c != 1) { if (c == 2) { i = -2; } } a(context, i); } i = 0; a(context, i); } } } else if (str.equals("OFF")) { c = 2; if (c != 0) { } i = 0; a(context, i); } } else if (str.equals("ALL")) { c = 0; if (c != 0) { } i = 0; a(context, i); } c = 65535; if (c != 0) { } i = 0; a(context, i); } catch (Throwable th) { a.a(th); } } public static void a(Context context, List<String> list) { try { int b2 = b(context); if (b2 != -2) { b(context, list, b2); } } catch (Throwable th) { a.a(th); } } public static /* synthetic */ void a(Context context, Queue queue, int i) { try { b(context, queue, i); } catch (Throwable th) { a.a(th); } } private static int b(Context context) { try { return b.b(context, "key_c_l_l_v", 0); } catch (Throwable th) { try { a.a(th); return -1; } catch (Throwable th2) { a.a(th2); return -1; } } } private static String b(Context context, String str) { try { return a.a(context, "https://api-e189.21cn.com/gw/client/accountMsg.do", str); } catch (Throwable th) { a.a(th); return null; } } private static String b(Context context, Queue<String> queue) { try { JSONArray jSONArray = new JSONArray(); String jSONArray2 = jSONArray.toString(); if (!queue.isEmpty()) { for (String str : queue) { try { jSONArray.put(new JSONObject(str)); } catch (Exception e) { e.printStackTrace(); } } } if (jSONArray.length() <= 0) { return ""; } String jSONArray3 = jSONArray.toString(); if (!TextUtils.isEmpty(jSONArray3)) { try { jSONArray2 = URLEncoder.encode(com.mobile.auth.b.b.a(com.mobile.auth.b.a.b(jSONArray3, f.a(f20562b))), "UTF-8"); } catch (Exception e2) { e2.printStackTrace(); } } return b(context, jSONArray2); } catch (Throwable th) { a.a(th); return null; } } private static void b(final Context context, final List<String> list, final int i) { try { i.a().a(new Runnable() { /* class com.mobile.auth.c.d.AnonymousClass1 */ /* JADX WARNING: Removed duplicated region for block: B:18:0x0035 A[ADDED_TO_REGION] */ public void run() { Exception e; try { Queue a2 = d.a(context, list, i); if (!a2.isEmpty()) { String a3 = d.a(context, a2); JSONObject jSONObject = null; int i = -1; try { if (!TextUtils.isEmpty(a3)) { JSONObject jSONObject2 = new JSONObject(a3); try { i = jSONObject2.getInt("code"); jSONObject = jSONObject2; } catch (Exception e2) { e = e2; jSONObject = jSONObject2; e.printStackTrace(); if (jSONObject == null) { } d.a(context, a2, i); } } } catch (Exception e3) { e = e3; e.printStackTrace(); if (jSONObject == null) { } d.a(context, a2, i); } if (jSONObject == null && i == 0) { d.a(context); a2.clear(); return; } d.a(context, a2, i); } } catch (Throwable th) { try { a.a(th); } catch (Throwable th2) { a.a(th2); } } } }); } catch (Throwable th) { a.a(th); } } private static void b(Context context, Queue<String> queue, int i) { String str = ""; try { JSONArray jSONArray = new JSONArray(); if (queue != null && !queue.isEmpty()) { int i2 = 0; for (String str2 : queue) { try { JSONObject jSONObject = new JSONObject(str2); if (i != -1 || jSONObject.getInt("rt") != 0) { jSONArray.put(jSONObject); i2++; if (i2 > 10) { break; } } } catch (Exception e) { e.printStackTrace(); } } } if (jSONArray.length() > 0) { try { str = com.mobile.auth.b.a.a(jSONArray.toString(), f.a(f20562b)); } catch (Exception e2) { str = null; e2.printStackTrace(); } } if (!TextUtils.isEmpty(str)) { c.a(context, str); } } catch (Throwable th) { a.a(th); } } private static synchronized Queue<String> c(Context context, List<String> list, int i) { ConcurrentLinkedQueue concurrentLinkedQueue; synchronized (d.class) { try { concurrentLinkedQueue = new ConcurrentLinkedQueue(); String a2 = c.a(context); if (!TextUtils.isEmpty(a2)) { try { JSONArray jSONArray = new JSONArray(com.mobile.auth.b.a.c(a2, f.a(f20562b))); int i2 = 0; int length = jSONArray.length(); while (i2 < length && i2 <= 10) { JSONObject jSONObject = jSONArray.getJSONObject(i2); if (jSONObject != null) { concurrentLinkedQueue.add(jSONObject.toString()); } i2++; } c.a(context, ""); } catch (Exception e) { e.printStackTrace(); } } if (i == -1) { for (String str : list) { try { if (new JSONObject(str).getInt("rt") != 0) { concurrentLinkedQueue.add(str); } } catch (Exception e2) { e2.printStackTrace(); } } } else if (i == 0) { concurrentLinkedQueue.addAll(list); } while (concurrentLinkedQueue.size() > 10) { concurrentLinkedQueue.poll(); } } catch (Throwable th) { a.a(th); return null; } } return concurrentLinkedQueue; } private static void c(Context context) { try { c.a(context, ""); } catch (Throwable th) { a.a(th); } } }