TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c

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


package com.tencent.mobileqq.vipgift;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.text.TextUtils;
import com.tencent.biz.common.offline.HtmlOffline;
import com.tencent.biz.common.util.OfflineSecurity;
import com.tencent.common.app.BaseApplicationImpl;
import com.tencent.mobileqq.activity.QQTranslucentBrowserActivity;
import com.tencent.mobileqq.app.BaseActivity;
import com.tencent.mobileqq.app.QQAppInterface;
import com.tencent.mobileqq.data.MessageForStructing;
import com.tencent.mobileqq.msf.core.NetConnInfoCenter;
import com.tencent.mobileqq.servlet.VipGifServlet;
import com.tencent.mobileqq.utils.NetworkUtil;
import com.tencent.mobileqq.utils.VipUtils;
import com.tencent.qphone.base.util.BaseApplication;
import com.tencent.qphone.base.util.QLog;
import java.io.File;
import mqq.app.NewIntent;
import mqq.manager.Manager;
public class VipGiftManager implements Manager {
    public static final long f94935a = 0;
    public static final String f34447a = "VipGiftManager.Gif";
    public static final long f94936b = 1;
    public static final String f34448b = "Gif_Download_info_key";
    public static final long f94937c = 2;
    public static final String f34449c = "Gif_msg_uniseq_key";
    public static final long d = 3;
    public static final String f34450d = "280";
    public static final long e = 4;
    public static final String f34451e = "http://imgcache.qq.com/club/client/gift/resource/0/index.html?_wv=524289&_bid=280";
    public static final long f = 5;
    public static final String f34452f = "0X8004B41";
    public static final long g = 6;
    public static final String f34453g = "0X8004B41";
    public static final String h = "0X8004B41";
    private QQAppInterface f34454a;
    private final String i = "VipGiftManager";
    private VipGiftDownloadInfo f34455a = new VipGiftDownloadInfo();
    public long f34456h = 10000;
    private String j = m9563a();

    public VipGiftManager(QQAppInterface qQAppInterface) {
        this.f34454a = qQAppInterface;
        m9564a();
    }

    public final String m9563a() {
        String str = Build.MODEL;
        return "{\"model\":\"" + str + "\",\"systemName\":\"android\",\"systemVersion\":\"" + Build.VERSION.RELEASE + "\"}";
    }

    public void a(String str, String str2, String str3, String str4) {
        if (str4 == null) {
            str4 = this.f34455a.f34445c;
        }
        VipUtils.a(this.f34454a, "Vip_Gift", str, str, 0, 0, str2, str3, str4, this.j);
    }

    public boolean a(MessageForStructing messageForStructing) {
        long j;
        if (messageForStructing != null && messageForStructing.structingMsg != null) {
            a("0X8004B41", "1", "0", messageForStructing.structingMsg.mResid);
            if (this.f34455a == null) {
                this.f34455a = new VipGiftDownloadInfo();
            }
            try {
                Uri parse = Uri.parse(messageForStructing.structingMsg.mResid);
                if (parse == null || !parse.isHierarchical()) {
                    return false;
                }
                if (TextUtils.isEmpty(parse.getQueryParameter("_bid"))) {
                    return false;
                }
                try {
                    String queryParameter = parse.getQueryParameter("_gv");
                    j = TextUtils.isEmpty(queryParameter) ? 0L : Long.parseLong(queryParameter);
                } catch (Exception e2) {
                    j = 0;
                }
                if (this.f34455a.f > j) {
                    a("0X8004B41", "2", "3", messageForStructing.structingMsg.mResid);
                    return false;
                }
                if (this.f34455a != null && messageForStructing != null && messageForStructing.structingMsg != null) {
                    if ((this.f34455a.d == 0 && messageForStructing.time < this.f34455a.f94933b) || this.f34455a.d == 4 || this.f34455a.d == 999 || this.f34455a.d == 5 || this.f34455a.d == 6 || m9565a()) {
                        this.f34455a.f34443a = messageForStructing.selfuin;
                        this.f34455a.f34444b = messageForStructing.senderuin;
                        this.f34455a.f94933b = messageForStructing.time;
                        this.f34455a.f94934c = 0L;
                        this.f34455a.d = 0L;
                        this.f34455a.f94932a = messageForStructing.uniseq;
                        this.f34455a.f34446d = messageForStructing.structingMsg.mResid;
                        this.f34455a.f34445c = messageForStructing.structingMsg.mResid;
                        this.f34455a.e = 0L;
                        try {
                            long parseLong = Long.parseLong(parse.getQueryParameter("_to").trim());
                            if (parseLong > 0) {
                                this.f34456h = parseLong;
                            }
                        } catch (Exception e3) {
                        }
                        return m9568b();
                    }
                    a("0X8004B41", "2", "2", messageForStructing.structingMsg.mResid);
                }
                return false;
            } catch (Exception e4) {
                return false;
            }
        }
        return false;
    }

    public boolean m9566a(long j) {
        if (this.f34455a != null) {
            this.f34455a.f = j;
            return m9568b();
        }
        return false;
    }

    public boolean m9565a() {
        if (this.f34455a == null) {
            this.f34455a = new VipGiftDownloadInfo();
        }
        if (this.f34455a != null && this.f34455a.d == 1) {
            long serverTimeMillis = NetConnInfoCenter.getServerTimeMillis() - this.f34455a.e;
            if (serverTimeMillis > this.f34456h || serverTimeMillis <= 0) {
                return true;
            }
        }
        return false;
    }

    public boolean m9568b() {
        SharedPreferences.Editor edit = this.f34454a.getPreferences().edit();
        edit.putString("Gif_Download_info_key_" + this.f34454a.getCurrentAccountUin(), b());
        if (QLog.isColorLevel()) {
            QLog.d("VipGiftManager", 2, "writeToSp:" + b());
        }
        return edit.commit();
    }

    public void m9564a() {
        String[] split;
        String string = this.f34454a.getPreferences().getString("Gif_Download_info_key_" + this.f34454a.getCurrentAccountUin(), null);
        if (string != null && this.f34455a != null && (split = string.split("\\|")) != null && split.length == 10 && this.f34455a != null) {
            this.f34455a.f34443a = split[0];
            this.f34455a.f34444b = split[1];
            this.f34455a.f94933b = Long.parseLong(split[2]);
            this.f34455a.f94934c = Long.parseLong(split[3]);
            this.f34455a.d = Long.parseLong(split[4]);
            this.f34455a.f94932a = Long.parseLong(split[5]);
            this.f34455a.f34445c = split[6];
            this.f34455a.f34446d = split[7];
            this.f34455a.e = Long.parseLong(split[8]);
            this.f34455a.f = Long.parseLong(split[9]);
        }
    }

    private String b() {
        if (this.f34455a != null) {
            return this.f34455a.f34443a + "|" + this.f34455a.f34444b + "|" + this.f34455a.f94933b + "|" + this.f34455a.f94934c + "|" + this.f34455a.d + "|" + this.f34455a.f94932a + "|" + this.f34455a.f34445c + "|" + this.f34455a.f34446d + "|" + this.f34455a.e + "|" + this.f34455a.f;
        }
        return null;
    }

    public VipGiftDownloadInfo a() {
        return this.f34455a;
    }

    public synchronized boolean a(long j, long j2) {
        boolean z = false;
        synchronized (this) {
            if (j2 == this.f34455a.f94932a && (j != 2 || this.f34455a.d != 6)) {
                this.f34455a.d = j;
                z = m9568b();
            }
        }
        return z;
    }

    public void a(String str) {
        this.f34455a.f34445c = str;
        m9568b();
    }

    public boolean b(long j) {
        return (this.f34455a == null || this.f34455a.d == 999 || this.f34455a.d == 5 || this.f34455a.d >= 2 || j < this.f34455a.f94933b) ? false : true;
    }

    public boolean m9567a(String str) {
        if (TextUtils.isEmpty(str) || HtmlOffline.d(str) == null) {
            return false;
        }
        return OfflineSecurity.m941a((Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator) + HtmlOffline.f3534j + str, str);
    }

    public void a(long j) {
        this.f34455a.e = NetConnInfoCenter.getServerTimeMillis();
        a(1L, j);
        String str = null;
        try {
            Uri parse = Uri.parse(this.f34455a.f34446d);
            if (parse != null && parse.isHierarchical()) {
                str = parse.getQueryParameter("_bid");
            }
            if (str == null || str.length() == 0) {
                a(5L, j);
                return;
            }
            int a2 = NetworkUtil.a((Context) BaseApplicationImpl.getContext());
            long currentTimeMillis = System.currentTimeMillis();
            boolean m9567a = m9567a(str);
            if (QLog.isColorLevel()) {
                QLog.d("VipGiftManager", 2, "OfflineSecurity.verify bid:" + str + ",cost:" + (System.currentTimeMillis() - currentTimeMillis) + ",bigFlag:" + m9567a);
            }
            long currentTimeMillis2 = System.currentTimeMillis();
            boolean m9567a2 = m9567a(f34450d);
            if (QLog.isColorLevel()) {
                QLog.d("VipGiftManager", 2, "OfflineSecurity.verify smalbid:280,cost:" + (System.currentTimeMillis() - currentTimeMillis2) + ",smallFlag:" + m9567a2);
            }
            if (a2 == 0) {
                if (m9567a) {
                    if (a(2L, j)) {
                        a(str, j);
                    }
                } else if (m9567a2 && a(2L, j)) {
                    a(f34451e);
                    a(f34450d, j);
                }
            } else if (a(a2, m9567a2, m9567a)) {
                if (m9567a2) {
                    if (a(2L, j)) {
                        a(f34451e);
                        a(f34450d, j);
                    }
                    HtmlOffline.b(f34450d, this.f34454a, true, new vtg(this));
                    return;
                }
                a(f34450d, (String) null, j);
            } else if (m9567a) {
                if (a(2L, j)) {
                    a(str, j);
                }
                HtmlOffline.b(str, this.f34454a, true, new vth(this));
            } else {
                a(str, f34450d, j);
            }
        } catch (Exception e2) {
            a(5L, j);
        }
    }

    public boolean a(int i, boolean z, boolean z2) {
        if (Build.VERSION.SDK_INT < 11) {
            return true;
        }
        return !z2 && i == 2;
    }

    public void a(String str, String str2, long j) {
        HtmlOffline.b(str, this.f34454a, true, new vti(this, System.currentTimeMillis(), str, j, str2));
    }

    public void a(String str, long j) {
        NewIntent newIntent = new NewIntent(this.f34454a.getApplication(), VipGifServlet.class);
        newIntent.setAction(VipGifServlet.f92405a);
        newIntent.putExtra(VipGifServlet.f92406b, Integer.parseInt(str));
        newIntent.putExtra(VipGifServlet.f92407c, j);
        this.f34454a.startServlet(newIntent);
    }

    @Override
    public void onDestroy() {
    }

    public void a(VipGiftDownloadInfo vipGiftDownloadInfo, BaseActivity baseActivity) {
        a(3L, vipGiftDownloadInfo.f94932a);
        String str = null;
        try {
            Uri parse = Uri.parse(vipGiftDownloadInfo.f34445c);
            if (parse != null && parse.isHierarchical()) {
                str = parse.getQueryParameter("_bid");
                if (TextUtils.isEmpty(str)) {
                    if (QLog.isColorLevel()) {
                        QLog.d("VipGiftManager", 2, "TextUtils.isEmpty(bid) false");
                    }
                    a(5L, vipGiftDownloadInfo.f94932a);
                    return;
                }
            }
            if (m9567a(str)) {
                if (QLog.isColorLevel()) {
                    QLog.d("VipGiftManager", 2, "showGifAnnimate.veryfyBid(" + str + ") true,url:" + vipGiftDownloadInfo.f34445c);
                }
                if (str.equalsIgnoreCase(f34450d)) {
                    a(f34451e);
                }
                a("0X8004B41", "2", "1", vipGiftDownloadInfo.f34445c);
                Intent intent = new Intent(BaseApplication.getContext(), QQTranslucentBrowserActivity.class);
                intent.putExtra("url", vipGiftDownloadInfo.f34445c);
                intent.putExtra(f34449c, vipGiftDownloadInfo.f94932a);
                baseActivity.startActivity(intent);
            } else if (m9567a(f34450d)) {
                if (QLog.isColorLevel()) {
                    QLog.d("VipGiftManager", 2, "showGifAnnimate.veryfyBid(" + str + ") false,url:" + vipGiftDownloadInfo.f34445c);
                }
                a(f34451e);
                a("0X8004B41", "2", "1", vipGiftDownloadInfo.f34445c);
                Intent intent2 = new Intent(BaseApplication.getContext(), QQTranslucentBrowserActivity.class);
                intent2.putExtra("url", vipGiftDownloadInfo.f34445c);
                intent2.putExtra(f34449c, vipGiftDownloadInfo.f94932a);
                baseActivity.startActivity(intent2);
            } else {
                a(5L, vipGiftDownloadInfo.f94932a);
            }
        } catch (Exception e2) {
            if (QLog.isColorLevel()) {
                QLog.d("VipGiftManager", 2, "exception bid");
            }
            a(5L, vipGiftDownloadInfo.f94932a);
        }
    }
}