電視直播.apk(点击下载) / a.java


package com.opos.mobad.c;

import android.content.Context;
import android.os.SystemClock;
import android.text.TextUtils;
import com.opos.cmn.an.c.d;
import com.opos.cmn.f.c;
import com.opos.mobad.r.a.h;
import com.opos.mobad.r.a.i;
import com.opos.mobad.r.a.j;
import com.opos.mobad.r.a.u;
import com.opos.mobad.r.a.v;
import com.opos.mobad.r.a.w;
import com.opos.mobad.r.a.x;
import com.opos.mobad.service.d.a;
import com.opos.mobad.service.e.b;
import com.opos.mobad.service.g.b;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.FutureTask;
import okio.BufferedSource;

public class a {
    private AbstractC0290a a;
    private String b;
    private int c = 0;
    private Map<Integer, Long> d = new ConcurrentHashMap();

    /* renamed from: e  reason: collision with root package name */
    private d f13939e;

    /* renamed from: com.opos.mobad.c.a$a  reason: collision with other inner class name */
    public interface AbstractC0290a {
        void a(int i2);
    }

    public a(d dVar) {
        this.f13939e = dVar;
    }

    private static final i a(Context context) {
        h.a g2 = new h.a().b(b.k().f()).c(c.b()).d(com.opos.mobad.service.d.a.a().f()).e(com.opos.mobad.service.d.a.a().g()).f(com.opos.mobad.service.d.a.a().h()).a(Boolean.valueOf(com.opos.mobad.service.d.a.a().j())).b(Boolean.valueOf(com.opos.mobad.service.d.a.a().d())).g(com.opos.mobad.service.d.a.a().l());
        a.C0324a k = com.opos.mobad.service.d.a.a().k();
        if (k != null) {
            h.a a2 = g2.a(k.a);
            k.getClass();
            a2.a((Integer) 1);
        } else {
            g2.a("");
        }
        h b2 = g2.b();
        return new i.a().a(b2).a(new j.a().c(com.opos.cmn.an.c.c.c()).a(d.b()).b(d.a()).b()).b(com.opos.cmn.an.c.a.a(context)).a(com.opos.cmn.an.c.c.a()).b();
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    /* JADX WARNING: Removed duplicated region for block: B:10:0x0061  */
    /* JADX WARNING: Removed duplicated region for block: B:11:0x0066  */
    private b.C0327b<w> b(Context context, String str) {
        x xVar;
        u.a a2 = new u.a().a(this.b);
        int i2 = this.c;
        if (i2 != -1) {
            if (i2 == 0) {
                xVar = x.NORMAL;
            } else if (i2 == 1) {
                xVar = x.VIP;
            }
            a2.a(xVar);
            b.C0327b<w> a3 = com.opos.mobad.service.g.b.a(context, "https://uapi.ads.heytapmobi.com/union/instant/vip/right", new v.a().a(a2.b()).a(a(context)).a(str).b(context.getPackageName()).b().b(), new b.a<w>() {
                /* class com.opos.mobad.c.a.AnonymousClass2 */

                /* renamed from: a */
                public w b(BufferedSource bufferedSource) throws IOException {
                    if (bufferedSource == null) {
                        return null;
                    }
                    return w.c.a(bufferedSource);
                }
            });
            StringBuilder sb = new StringBuilder();
            sb.append("check result:");
            sb.append((Object) (a3 == null ? a3.c : null));
            com.opos.cmn.an.f.a.b("am", sb.toString());
            return a3;
        }
        xVar = x.UNKNOWN_STATUS;
        a2.a(xVar);
        b.C0327b<w> a32 = com.opos.mobad.service.g.b.a(context, "https://uapi.ads.heytapmobi.com/union/instant/vip/right", new v.a().a(a2.b()).a(a(context)).a(str).b(context.getPackageName()).b().b(), new b.a<w>() {
            /* class com.opos.mobad.c.a.AnonymousClass2 */

            /* renamed from: a */
            public w b(BufferedSource bufferedSource) throws IOException {
                if (bufferedSource == null) {
                    return null;
                }
                return w.c.a(bufferedSource);
            }
        });
        StringBuilder sb2 = new StringBuilder();
        sb2.append("check result:");
        sb2.append((Object) (a32 == null ? a32.c : null));
        com.opos.cmn.an.f.a.b("am", sb2.toString());
        return a32;
    }

    private FutureTask<Integer> b(final Context context, final String str, final int i2) {
        if (TextUtils.isEmpty(this.b) || this.c == 0) {
            return null;
        }
        FutureTask<Integer> futureTask = new FutureTask<>(new Callable<Integer>() {
            /* class com.opos.mobad.c.a.AnonymousClass1 */

            /* renamed from: a */
            public Integer call() throws Exception {
                int a2;
                T t;
                b.C0327b b2 = a.this.b(context, str);
                if (b2 == null || b2.a != 200 || (t = b2.c) == null) {
                    a2 = a.this.a(i2);
                } else if (t.f14528i.booleanValue()) {
                    a.this.d.put(Integer.valueOf(i2), Long.valueOf(SystemClock.elapsedRealtime()));
                    a2 = 0;
                } else {
                    a2 = 1;
                }
                return Integer.valueOf(a2);
            }
        });
        com.opos.cmn.an.j.b.c(futureTask);
        return futureTask;
    }

    private boolean b(int i2) {
        StringBuilder sb;
        String str;
        Long l = this.d.get(Integer.valueOf(i2));
        if (l == null) {
            sb = new StringBuilder();
            str = "not available last right:";
        } else if (SystemClock.elapsedRealtime() <= l.longValue() + 60000) {
            return true;
        } else {
            sb = new StringBuilder();
            str = "over limit time last right:";
        }
        sb.append(str);
        sb.append(i2);
        com.opos.cmn.an.f.a.b("am", sb.toString());
        return false;
    }

    public int a(int i2) {
        return !b(i2);
    }

    public FutureTask<Integer> a(Context context, String str) {
        return b(context, str, 5);
    }

    public FutureTask<Integer> a(Context context, String str, int i2) {
        return b(context, str, i2);
    }

    public void a() {
        this.b = null;
        this.c = 0;
        this.a = null;
        this.d = new ConcurrentHashMap();
    }

    public void a(String str, int i2, String str2, String str3, String str4, String str5, String str6) {
        AbstractC0290a aVar;
        com.opos.cmn.an.f.a.b("am", "do exercise");
        this.f13939e.d().a(str, str2, str3, str4, str5, str6, this.b);
        if (!TextUtils.isEmpty(this.b) && (aVar = this.a) != null) {
            try {
                aVar.a(i2);
            } catch (Throwable th) {
                com.opos.cmn.an.f.a.b("am", "on exercise fail", th);
            }
        }
    }

    public String b() {
        return this.b;
    }

    public int c() {
        return this.c;
    }

    public int d() {
        return a(5);
    }
}