热汗舞蹈 v1.24.1.0版本的 MD5 值为:f1dc6ef07903515a73f51f41f372123e

以下内容为反编译后的 h.java 源代码,内容仅作参考


package com.qiyukf.nimlib.session;

import android.os.SystemClock;
import android.util.Pair;
import com.huawei.hms.push.constant.RemoteMessageConst;
import com.qiyukf.nimlib.net.a.d.a;
import com.qiyukf.nimlib.sdk.msg.constant.SessionTypeEnum;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public final class h {
    private static final ArrayList<Pair<c, Long>> f21140a = new ArrayList<>(8);
    private static final Object f21141b = new Object();
    private static ScheduledExecutorService f21142c = null;

    public static void a() {
        if (com.qiyukf.nimlib.c.v() && f21142c == null) {
            com.qiyukf.nimlib.j.b.b.a.c("MessageReporter", "start msg report timer");
            ScheduledExecutorService newScheduledThreadPool = Executors.newScheduledThreadPool(1);
            f21142c = newScheduledThreadPool;
            newScheduledThreadPool.scheduleWithFixedDelay(new Runnable() {
                @Override
                public final void run() {
                    h.d();
                }
            }, 0L, com.heytap.mcssdk.constant.a.f17160q, TimeUnit.MILLISECONDS);
        }
    }

    public static void b() {
        ScheduledExecutorService scheduledExecutorService = f21142c;
        if (scheduledExecutorService == null) {
            return;
        }
        scheduledExecutorService.shutdown();
        f21142c = null;
    }

    private static void c() {
        String str;
        ArrayList<Pair<c, Long>> arrayList = f21140a;
        if (com.qiyukf.nimlib.q.d.a((Collection) arrayList)) {
            return;
        }
        long b10 = com.qiyukf.nimlib.q.t.b();
        if (b10 <= 0) {
            com.qiyukf.nimlib.q.t.c();
            return;
        }
        JSONArray jSONArray = new JSONArray();
        Iterator<Pair<c, Long>> it = arrayList.iterator();
        while (it.hasNext()) {
            Pair<c, Long> next = it.next();
            c cVar = (c) next.first;
            long longValue = ((Long) next.second).longValue() + b10;
            if (cVar != null && longValue > 0) {
                JSONObject jSONObject = new JSONObject();
                try {
                    jSONObject.putOpt("accid", com.qiyukf.nimlib.c.k());
                    jSONObject.putOpt("fromAccid", cVar.getFromAccount());
                    jSONObject.putOpt(RemoteMessageConst.MSGID, Long.valueOf(cVar.getServerId()));
                    jSONObject.putOpt("serverTime", Long.valueOf(cVar.getTime()));
                    jSONObject.putOpt("receiveTime", Long.valueOf(longValue));
                    jSONObject.putOpt("sessionId", cVar.getSessionId());
                } catch (JSONException e10) {
                    e10.printStackTrace();
                }
                if (!com.qiyukf.nimlib.e.e.a() && !com.qiyukf.nimlib.e.e.b()) {
                    str = "online";
                    jSONObject.putOpt("env", str);
                    jSONArray.put(jSONObject);
                }
                str = "test";
                jSONObject.putOpt("env", str);
                jSONArray.put(jSONObject);
            }
        }
        com.qiyukf.nimlib.j.b.b.a.c("MessageReporter", "report msg, len=" + jSONArray.length());
        a.C0166a<String> a10 = com.qiyukf.nimlib.net.a.d.a.a("https://statistic.live.126.net/statics/report/im/sdk/msgreceived", null, jSONArray);
        if (a10.f20298a == 200) {
            f21140a.clear();
        }
        com.qiyukf.nimlib.j.b.b.a.c("MessageReporter", "report msg result, code=" + a10.f20298a);
    }

    public static void d() {
        synchronized (f21141b) {
            if (!com.qiyukf.nimlib.q.d.a((Collection) f21140a)) {
                c();
            }
        }
    }

    public static void a(c cVar) {
        if (com.qiyukf.nimlib.c.v() && cVar.getSessionType() == SessionTypeEnum.P2P) {
            long elapsedRealtime = SystemClock.elapsedRealtime();
            synchronized (f21141b) {
                ArrayList<Pair<c, Long>> arrayList = f21140a;
                arrayList.add(new Pair<>(cVar, Long.valueOf(elapsedRealtime)));
                if (arrayList.size() >= 5) {
                    c();
                }
            }
        }
    }
}