package com.netease.nimlib.c; import android.content.Context; import com.netease.nimlib.c; import com.netease.nimlib.net.a.d.b; import java.util.HashMap; import java.util.Map; import org.json.JSONObject; /* compiled from: NimEventStrategyManager */ public class b { private boolean a = true; private volatile boolean b = false; /* access modifiers changed from: private */ /* compiled from: NimEventStrategyManager */ public static class a { private static final b a = new b(); } private Map<String, String> c() { String str; try { str = com.netease.nimlib.push.b.c(); } catch (Exception e) { e.printStackTrace(); str = ""; } HashMap hashMap = new HashMap(5); hashMap.put("deviceId", str); hashMap.put("sdktype", "IM"); hashMap.put("sdkVer", "8.11.5"); hashMap.put("platform", "AOS"); hashMap.put("appkey", c.h()); return hashMap; } public void b() { if (!this.b) { if (!this.a) { com.netease.nimlib.l.b.B("don't need request strategy"); return; } this.b = true; com.netease.nimlib.l.b.B("request strategy"); Context e = c.e(); if (e != null) { com.netease.nimlib.net.a.d.b.a().a(e); com.netease.nimlib.net.a.d.b.a().a("https://statistic.live.126.net/dispatcher/req", c(), new b.a() { /* class com.netease.nimlib.c.b.AnonymousClass1 */ @Override // com.netease.nimlib.net.a.d.b.a public void onResponse(String str, int i, Throwable th) { b.this.b = false; if (i != 200 || str == null) { b.this.a = true; StringBuilder sb = new StringBuilder(); sb.append("request strategy failed, code="); sb.append(i); sb.append(", e="); sb.append(th == null ? null : th.getMessage()); com.netease.nimlib.l.b.C(sb.toString()); return; } com.netease.nimlib.l.b.B("request strategy success!,response = " + str); b.this.a(str); } }); } } } public static b a() { return a.a; } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void a(String str) { try { JSONObject jSONObject = new JSONObject(str); int i = jSONObject.getInt(com.heytap.mcssdk.a.a.j); this.a = false; if (i == 200) { JSONObject jSONObject2 = jSONObject.getJSONObject("data"); com.netease.nimlib.c.b.d.b bVar = new com.netease.nimlib.c.b.d.b(); bVar.a(jSONObject2.getString("endpoint")); bVar.c(((long) jSONObject2.getInt("maxDelay")) * 1000); bVar.a(((long) jSONObject2.getInt("maxInterval")) * 1000); bVar.b(((long) jSONObject2.getInt("minInterval")) * 1000); bVar.a(jSONObject2.getInt("maxSize")); a.a(bVar); a.a(); return; } com.netease.nimlib.l.b.B("do not need report"); a.b(); } catch (Exception e) { e.printStackTrace(); } } }