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

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


package com.tencent.biz.pubaccount;

import NS_MOBILE_FEEDS.e_attribute;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.text.TextUtils;
import com.tencent.biz.PoiMapActivity;
import com.tencent.biz.coupon.CouponActivity;
import com.tencent.biz.pubaccount.util.PublicAccountUtil;
import com.tencent.biz.qrcode.activity.ScannerActivity;
import com.tencent.common.app.AppInterface;
import com.tencent.mobileqq.activity.BaseChatPie;
import com.tencent.mobileqq.activity.ChatFragment;
import com.tencent.mobileqq.activity.QQBrowserActivity;
import com.tencent.mobileqq.activity.aio.PlusPanelUtils;
import com.tencent.mobileqq.activity.aio.SessionInfo;
import com.tencent.mobileqq.activity.aio.rebuild.PublicAccountChatPie;
import com.tencent.mobileqq.app.AppConstants;
import com.tencent.mobileqq.app.BaseActivity;
import com.tencent.mobileqq.app.PublicAccountDataManager;
import com.tencent.mobileqq.app.PublicAccountHandler;
import com.tencent.mobileqq.app.QQAppInterface;
import com.tencent.mobileqq.app.ThreadManager;
import com.tencent.mobileqq.app.TroopHandler;
import com.tencent.mobileqq.app.proxy.RecentUserProxy;
import com.tencent.mobileqq.data.AccountDetail;
import com.tencent.mobileqq.data.PublicAccountInfo;
import com.tencent.mobileqq.data.PublicAccountMenuEntity;
import com.tencent.mobileqq.data.RecentUser;
import com.tencent.mobileqq.emoticon.EmojiManager;
import com.tencent.mobileqq.mp.mobileqq_mp;
import com.tencent.mobileqq.msf.core.NetConnInfoCenter;
import com.tencent.mobileqq.persistence.Entity;
import com.tencent.mobileqq.persistence.EntityManager;
import com.tencent.mobileqq.service.gamecenter.AppLaucherHelper;
import com.tencent.mobileqq.statistics.ReportController;
import com.tencent.mobileqq.structmsg.AbsStructMsgElement;
import com.tencent.mobileqq.util.CommonUtil;
import com.tencent.mobileqq.utils.AudioHelper;
import com.tencent.mobileqq.utils.DeviceInfoUtil;
import com.tencent.mobileqq.utils.DialogUtil;
import com.tencent.mobileqq.utils.FileUtils;
import com.tencent.mobileqq.utils.JumpAction;
import com.tencent.mobileqq.utils.JumpParser;
import com.tencent.mobileqq.webprocess.WebProcessManager;
import com.tencent.mobileqq.webview.swift.component.SwiftBrowserStatistics;
import com.tencent.mobileqq.widget.IndexView;
import com.tencent.open.business.base.AppUtil;
import com.tencent.qphone.base.util.QLog;
import com.tencent.tim.R;
import com.tencent.widget.ActionSheet;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import mqq.app.NewIntent;
import mqq.observer.BusinessObserver;
import mqq.os.MqqHandler;
import org.json.JSONException;
import org.json.JSONObject;
public class PublicAccountManager {
    public static final String A = "history_msg_params";
    public static final String B = "post_punchcard_info";
    public static final String E = "com.tencent.tim.biz.pubaccount.scanResultAction";
    public static final String F = "com.tencent.biz.pubaccount.scanResultData";
    public static final String G = "com.tencent.biz.pubaccount.scanResultType";
    public static final String H = "com.tencent.tim.biz.pubaccount.picResultAction";
    public static final String I = "com.tencent.biz.pubaccount.picResultData";
    public static final String J = "com.tencent.biz.pubaccount.picResult_md5s";
    public static final String K = "com.tencent.tim.biz.pubaccount.locationResultAction";
    public static final String L = "latitude";
    public static final String M = "longitude";
    public static final String N = "name";
    public static final int f82460a = 0;
    public static final long f4064a = 350749526;
    private static final PublicAccountManager f4065a = new PublicAccountManager();
    public static final String f4066a = "PublicAccountManager";
    public static final boolean f4067a = false;
    public static final int f82461b = 1;
    static final long f4068b = 21600000;
    public static final String f4069b = "menuEventSharePre";
    public static final int f82462c = 2;
    public static final String f4070c = "update_type";
    public static final int d = 0;
    public static final String f4071d = "menuCacheTime";
    public static final int e = 1;
    public static final String f4072e = "PubAccountSvc";
    public static final int f = 2;
    public static final String f4073f = "get_follow_list";
    public static final int g = 0;
    public static final String f4074g = "get_detail_info";
    public static final int h = 1;
    public static final String f4075h = "follow";
    public static final int i = 2;
    public static final String f4076i = "unfollow";
    public static final String j = "get_account_menu";
    public static final String k = "get_share_list";
    public static final String l = "set_recv_msg";
    public static final String m = "set_share_lbs";
    public static final String n = "share_to_public";
    public static final String o = "set_function_flag";
    public static final String p = "send_menu_evt";
    public static final String q = "set_refuse_follow";
    public static final String r = "send_msg_receipt";
    public static final String s = "send_pay_info";
    public static final String t = "set_message_configuration";
    public static final String u = "get_business_recommend";
    public static final String v = "secmsg.configs";
    public static final String w = "send_pre_message_status";
    public static final String x = "pull_aio_history_msg";
    public static final String y = "pull_account_detail_dynamic_list";
    public static final String z = "lola_update_req";
    private String O;
    private long f4085c;
    public WeakReference f4079a = new WeakReference(null);
    String C = null;
    public String D = null;
    public boolean f4084b = false;
    public WeakReference f4082b = new WeakReference(null);
    private WeakReference f4087c = new WeakReference(null);
    public BroadcastReceiver f4077a = null;
    public BroadcastReceiver f4081b = null;
    public int f4090j = 0;
    public BroadcastReceiver f4086c = null;
    public Map f4080a = new HashMap();
    Map f4083b = new HashMap();
    public Map f4088c = new HashMap();
    public Map f4089d = new HashMap();
    protected Runnable f4078a = new guw(this);

    public interface InitDoneObserver {
        void a();
    }

    public interface refuseAcceptDone {
        void a(boolean z);
    }

    private PublicAccountManager() {
    }

    public String m1063a() {
        return this.O;
    }

    public void a(Context context, QQAppInterface qQAppInterface, String str, String str2, InitDoneObserver initDoneObserver) {
        if (str != null && !str.equals(this.O)) {
            m1066a(str);
        }
        this.O = str;
        ThreadManager.b(new guk(this, str2, qQAppInterface, initDoneObserver, context));
    }

    public NewIntent a(Context context, QQAppInterface qQAppInterface, String str, BusinessObserver businessObserver, boolean z2) {
        NewIntent newIntent = null;
        try {
            long longValue = Long.valueOf(str).longValue();
            if (!z2 && !a("" + longValue, context)) {
                if (QLog.isColorLevel()) {
                    QLog.i(f4066a, 2, "menu setting not outdate yet--");
                }
            } else {
                int i2 = 0;
                if (this.f4083b.containsKey("" + longValue)) {
                    i2 = ((Integer) this.f4083b.get("" + longValue)).intValue();
                }
                newIntent = new NewIntent(context, PublicAccountServlet.class);
                newIntent.putExtra("cmd", j);
                mobileqq_mp.GetPublicAccountMenuRequest getPublicAccountMenuRequest = new mobileqq_mp.GetPublicAccountMenuRequest();
                getPublicAccountMenuRequest.seqno.set(i2);
                getPublicAccountMenuRequest.uin.set((int) longValue);
                newIntent.putExtra("data", getPublicAccountMenuRequest.toByteArray());
                newIntent.setObserver(new gut(this, newIntent, qQAppInterface, str, context, businessObserver));
                if (qQAppInterface != null) {
                    qQAppInterface.startServlet(newIntent);
                }
            }
        } catch (NumberFormatException e2) {
            if (QLog.isColorLevel()) {
                QLog.e(f4066a, 2, "puin is invalid format:" + str);
            }
        }
        return newIntent;
    }

    public int a(String str) {
        if (this.f4083b.containsKey(str)) {
            return ((Integer) this.f4083b.get(str)).intValue();
        }
        return 0;
    }

    public void a(String str, int i2) {
        this.f4083b.put(str, Integer.valueOf(i2));
    }

    public static PublicAccountManager a() {
        return f4065a;
    }

    public void a(Context context, QQAppInterface qQAppInterface, String str, String str2, boolean z2, double d2, double d3, BusinessObserver businessObserver) {
        a(context, qQAppInterface, str, str2, z2, d2, d3, businessObserver, 1, 0L, 0);
    }

    public void a(Context context, QQAppInterface qQAppInterface, String str, String str2, boolean z2, double d2, double d3, BusinessObserver businessObserver, int i2, long j2, int i3) {
        if (QLog.isColorLevel()) {
            QLog.d("reportsendMenuEventequest", 2, "key:" + str2 + "uin:" + str + "type:" + i2 + "msg_id:" + j2 + "s_type" + i3);
        }
        try {
            long longValue = Long.valueOf(str).longValue();
            NewIntent newIntent = new NewIntent(context, PublicAccountServlet.class);
            newIntent.putExtra("cmd", p);
            mobileqq_mp.SendMenuEventRequest sendMenuEventRequest = new mobileqq_mp.SendMenuEventRequest();
            sendMenuEventRequest.key.set(str2);
            sendMenuEventRequest.uin.set((int) longValue);
            sendMenuEventRequest.type.set(i2);
            sendMenuEventRequest.msg_id.set(j2);
            sendMenuEventRequest.s_type.set(i3);
            sendMenuEventRequest.menu_type.set(b(str));
            if (z2) {
                sendMenuEventRequest.is_need_lbs.set(true);
                sendMenuEventRequest.latitude.set(d2);
                sendMenuEventRequest.longitude.set(d3);
            }
            newIntent.putExtra("data", sendMenuEventRequest.toByteArray());
            newIntent.setObserver(new guv(this, newIntent, context, str, businessObserver, qQAppInterface));
            if (qQAppInterface != null) {
                qQAppInterface.startServlet(newIntent);
            }
        } catch (NumberFormatException e2) {
            if (QLog.isColorLevel()) {
                QLog.e(f4066a, 2, "puin is invalid format:" + str);
            }
        }
    }

    public List m1064a(QQAppInterface qQAppInterface, String str) {
        return m1067b(qQAppInterface, str);
    }

    public int b(String str) {
        if (this.f4089d.containsKey(str)) {
            return ((Integer) this.f4089d.get(str)).intValue();
        }
        return 0;
    }

    public void m1066a(String str) {
        this.f4080a.remove(str);
        this.f4083b.remove(str);
        this.f4088c.remove(str);
        this.f4089d.remove(str);
        if (QLog.isColorLevel()) {
            QLog.e(f4066a, 2, "left menu size:" + this.f4088c.size());
        }
    }

    public void a(String str, Context context, QQAppInterface qQAppInterface, String str2, int i2, BusinessObserver businessObserver, MqqHandler mqqHandler, int i3, SessionInfo sessionInfo) {
        ChatFragment chatFragment;
        mobileqq_mp.ButtonInfo a2 = a(qQAppInterface, str2, i2);
        if (a2 == null) {
            if (QLog.isColorLevel()) {
                QLog.e(f4066a, 2, "Can't find menu via menu id:" + i2 + ".");
                return;
            }
            return;
        }
        if (sessionInfo.f85624a == 1008 && ((i3 == 1 && !a2.sub_button.has()) || i3 == 2)) {
            b(qQAppInterface, str2);
        }
        int i4 = a2.type.has() ? a2.type.get() : 0;
        ReportController.b(null, "dc01332", "Pb_account_lifeservice", str2, "mp_caidan_click", "aio_caidan_click", 0, 0, String.valueOf(i3), String.valueOf(i2), a2.name.has() ? a2.name.get() : "", String.valueOf(i4));
        StringBuilder sb = new StringBuilder();
        String str3 = "";
        if (i4 == 2) {
            str3 = a2.url.has() ? AbsStructMsgElement.a(a2.url.get()) : "";
        }
        ReportController.a(null, "dc01332", "Pb_account_lifeservice", str2, "0X8005D4B", "0X8005D4B", 0, 0, sb.append("MENUID=").append(String.valueOf(i2)).append(";LEVELID=").append(String.valueOf(i3)).append(";NAME=").append(a2.name.has() ? a2.name.get() : "").append(";REFERRER=").append(str3).toString(), "", "", "");
        this.f4087c = new WeakReference(businessObserver);
        this.f4079a = new WeakReference(qQAppInterface);
        this.f4082b = new WeakReference(context);
        this.C = str2;
        this.D = a2.key.has() ? a2.key.get() : "";
        this.f4084b = a2.is_new_menu.has() ? a2.is_new_menu.get() : false;
        if ((context instanceof FragmentActivity) && (chatFragment = ((FragmentActivity) context).getChatFragment()) != null) {
            BaseChatPie m2396a = chatFragment.m2396a();
            if (m2396a instanceof PublicAccountChatPie) {
                ((PublicAccountChatPie) m2396a).eG++;
            }
        }
        switch (i4) {
            case 1:
                if (mqqHandler != null) {
                    mqqHandler.sendEmptyMessage(1001);
                }
                if (a2.is_need_lbs.has() && a2.is_need_lbs.get()) {
                    new Thread(this.f4078a).start();
                    return;
                }
                if (mqqHandler != null) {
                    mqqHandler.sendEmptyMessage(19);
                }
                a(false, 0.0d, 0.0d, null, a2.media_id.has() ? a2.media_id.get() : null, this.D, this.f4084b);
                return;
            case 2:
                if (mqqHandler != null) {
                    mqqHandler.sendEmptyMessage(1001);
                }
                if (mqqHandler != null) {
                    mqqHandler.sendEmptyMessage(1001);
                }
                String str4 = a2.actionInfo.a_actionData.get();
                String str5 = a2.actionInfo.actionData.get();
                if (!TextUtils.isEmpty(str4)) {
                    str5 = str4;
                }
                String str6 = a2.url.has() ? a2.url.get() : "";
                String str7 = a2.media_id.has() ? a2.media_id.get() : null;
                if (TextUtils.isEmpty(str5)) {
                    a(qQAppInterface, context, str2, a2);
                    a(str6, (mobileqq_mp.ActionInfo) a2.actionInfo.get(), str7);
                    return;
                }
                JumpAction a3 = JumpParser.a(qQAppInterface, context, str5);
                if (a3 == null) {
                    if (a2.actionInfo.appid.has()) {
                        a(qQAppInterface, context, str2, a2, str5);
                        return;
                    }
                    a(qQAppInterface, context, str2, a2);
                    a(str6, (mobileqq_mp.ActionInfo) a2.actionInfo.get(), str7);
                    return;
                } else if (TextUtils.isEmpty(a3.a())) {
                    a(qQAppInterface, context, str2, a2, str5);
                    return;
                } else if (!a3.m9235b()) {
                    a(qQAppInterface, context, str2, a2);
                    a(str6, (mobileqq_mp.ActionInfo) a2.actionInfo.get(), str7);
                    return;
                } else {
                    return;
                }
            case 3:
                switch (a2.event_id.has() ? a2.event_id.get() : 0) {
                    case 1:
                        a(qQAppInterface, context, str2);
                        a((String) null, 0, 1, -1, (List) null);
                        return;
                    case 11:
                        a(context, mqqHandler, false);
                        return;
                    case 12:
                        a(context, mqqHandler, true);
                        return;
                    case 13:
                        a(context, qQAppInterface, sessionInfo);
                        return;
                    case 14:
                        b(context, qQAppInterface, sessionInfo);
                        return;
                    case 15:
                        c(context, qQAppInterface, sessionInfo);
                        return;
                    case 1000001:
                        a(qQAppInterface, mqqHandler);
                        return;
                    case mobileqq_mp.y:
                        a(context, qQAppInterface);
                        return;
                    default:
                        return;
                }
            default:
                return;
        }
    }

    private static void a(QQAppInterface qQAppInterface, Context context, String str, mobileqq_mp.ButtonInfo buttonInfo) {
        if (buttonInfo.item_id.has() && buttonInfo.item_id.get() == 5) {
            Intent intent = new Intent(context, CouponActivity.class);
            intent.putExtra("url", CouponActivity.f82323b);
            intent.putExtra("source", "1");
            intent.putExtra("from", 5);
            context.startActivity(intent);
        } else if (buttonInfo.item_id.has() && buttonInfo.item_id.get() == 6) {
            Intent intent2 = new Intent(context, CouponActivity.class);
            if (buttonInfo.url.has()) {
                intent2.putExtra("url", buttonInfo.url.get());
            }
            intent2.putExtra("webStyle", "noBottomBar");
            context.startActivity(intent2);
        } else {
            a(context, qQAppInterface, str, buttonInfo);
        }
    }

    private static void a(QQAppInterface qQAppInterface, Context context, String str, mobileqq_mp.ButtonInfo buttonInfo, String str2) {
        boolean z2 = true;
        long j2 = buttonInfo.actionInfo.appid.get();
        Uri parse = Uri.parse(str2);
        String scheme = parse.getScheme();
        String host = parse.getHost();
        if (!TextUtils.isEmpty(scheme) && AppUtil.m10056a(scheme)) {
            AppLaucherHelper appLaucherHelper = new AppLaucherHelper();
            boolean z3 = AppLaucherHelper.a(host) != 0;
            Bundle m7708a = AppLaucherHelper.m7708a(host);
            int i2 = m7708a.getInt("a_launch_mode", e_attribute._IsFrdCommentFamousFeed);
            if (z3) {
                appLaucherHelper.a(qQAppInterface, context, String.valueOf(j2), host, scheme, i2);
            } else {
                z2 = AppUtil.a(context, scheme, m7708a, i2);
            }
            if (!z2) {
                a(qQAppInterface, context, str, buttonInfo);
                return;
            }
            return;
        }
        a(qQAppInterface, context, str, buttonInfo);
    }

    private static void a(Context context, QQAppInterface qQAppInterface, String str, mobileqq_mp.ButtonInfo buttonInfo) {
        ChatFragment chatFragment;
        if ((context instanceof FragmentActivity) && (chatFragment = ((FragmentActivity) context).getChatFragment()) != null) {
            BaseChatPie m2396a = chatFragment.m2396a();
            if (m2396a instanceof PublicAccountChatPie) {
                ((PublicAccountChatPie) m2396a).eI++;
            }
        }
        StringBuilder sb = new StringBuilder(buttonInfo.url.has() ? buttonInfo.url.get() : "");
        if (sb.indexOf("?") < 0) {
            sb.append("?");
        } else if (sb.indexOf("?") < sb.length() - 1) {
            if (sb.indexOf(IndexView.f95329b) < 0) {
                sb.append(IndexView.f95329b);
            } else if (sb.lastIndexOf(IndexView.f95329b) < sb.length() - 1) {
                sb.append(IndexView.f95329b);
            }
        }
        sb.append("uin=" + qQAppInterface.getCurrentAccountUin());
        sb.append("&puin=" + str);
        Intent intent = new Intent(context, PublicAccountBrowser.class);
        intent.putExtra("from", QQBrowserActivity.class);
        intent.putExtra("url", sb.toString());
        intent.putExtra("uin", qQAppInterface.getCurrentAccountUin());
        intent.putExtra("puin", str);
        intent.putExtra(PublicAccountBrowser.j, context.getResources().getString(R.string.f63667button_back));
        intent.putExtra(SwiftBrowserStatistics.u, true);
        if (str.equalsIgnoreCase(PublicAccountBrowser.f4000d)) {
            intent.putExtra(PublicAccountBrowser.h, true);
        }
        context.startActivity(intent);
    }

    public static void a(Context context, QQAppInterface qQAppInterface, String str, String str2, String str3) {
        Intent intent = new Intent(context, PublicAccountBrowser.class);
        intent.putExtra("from", QQBrowserActivity.class);
        intent.putExtra("url", str);
        intent.putExtra("click_from", str3);
        intent.putExtra("uin", qQAppInterface.getCurrentAccountUin());
        intent.putExtra("puin", str2);
        intent.putExtra(PublicAccountBrowser.j, context.getResources().getString(R.string.f63667button_back));
        context.startActivity(intent);
    }

    private void a(QQAppInterface qQAppInterface, Context context, String str) {
        Intent intent = new Intent();
        intent.putExtra(PublicAccountUtil.f5266j, true);
        PublicAccountUtil.a(intent, qQAppInterface, context, str, -1);
    }

    public mobileqq_mp.ButtonInfo a(QQAppInterface qQAppInterface, String str, int i2) {
        List m1067b = m1067b(qQAppInterface, str);
        if (m1067b == null || m1067b.isEmpty()) {
            return null;
        }
        for (int i3 = 0; i3 < m1067b.size(); i3++) {
            mobileqq_mp.ButtonInfo buttonInfo = (mobileqq_mp.ButtonInfo) m1067b.get(i3);
            if (!buttonInfo.id.has() || buttonInfo.id.get() != i2) {
                if (buttonInfo.sub_button.has()) {
                    List list = buttonInfo.sub_button.get();
                    if (list.size() > 0) {
                        for (int i4 = 0; i4 < list.size(); i4++) {
                            if (((mobileqq_mp.ButtonInfo) list.get(i4)).id.has() && ((mobileqq_mp.ButtonInfo) list.get(i4)).id.get() == i2) {
                                return (mobileqq_mp.ButtonInfo) list.get(i4);
                            }
                        }
                        continue;
                    } else {
                        continue;
                    }
                }
            } else {
                return buttonInfo;
            }
        }
        return null;
    }

    public List m1067b(QQAppInterface qQAppInterface, String str) {
        if (str.equals(AppConstants.f17383ao)) {
            ArrayList arrayList = new ArrayList();
            mobileqq_mp.ButtonInfo buttonInfo = new mobileqq_mp.ButtonInfo();
            buttonInfo.name.set("写邮件");
            buttonInfo.url.set("https://w.mail.qq.com/cgi-bin/login?target=MOBILEQQWRITE&fun=from3g&_wv=7");
            buttonInfo.key.set("1");
            arrayList.add(buttonInfo);
            mobileqq_mp.ButtonInfo buttonInfo2 = new mobileqq_mp.ButtonInfo();
            buttonInfo.name.set("进入邮件");
            buttonInfo.url.set("https://w.mail.qq.com/cgi-bin/login?target=MOBILEQQWRITE&fun=from3g&_wv=7");
            buttonInfo.key.set("2");
            arrayList.add(buttonInfo2);
            return arrayList;
        }
        return (List) this.f4088c.get(str);
    }

    public void a(QQAppInterface qQAppInterface, String str, mobileqq_mp.GetPublicAccountMenuResponse getPublicAccountMenuResponse) {
        if (QLog.isDevelopLevel()) {
            QLog.d(f4066a, 4, "savePublicAccountMenuSetting");
        }
        if (getPublicAccountMenuResponse != null && qQAppInterface != null) {
            a(str, getPublicAccountMenuResponse.seqno.has() ? getPublicAccountMenuResponse.seqno.get() : 0);
            long currentTimeMillis = System.currentTimeMillis();
            a(str, currentTimeMillis);
            if (getPublicAccountMenuResponse.toByteArray() != null) {
                EntityManager createEntityManager = qQAppInterface.getEntityManagerFactory().createEntityManager();
                PublicAccountMenuEntity publicAccountMenuEntity = new PublicAccountMenuEntity(str, getPublicAccountMenuResponse, currentTimeMillis);
                if (createEntityManager.a(PublicAccountMenuEntity.class, str) != null) {
                    PublicAccountMenuEntity publicAccountMenuEntity2 = (PublicAccountMenuEntity) createEntityManager.a(PublicAccountMenuEntity.class, str);
                    if (publicAccountMenuEntity2 != null) {
                        publicAccountMenuEntity2.clone(publicAccountMenuEntity);
                        createEntityManager.mo7244a((Entity) publicAccountMenuEntity2);
                    } else {
                        createEntityManager.m7242a((Entity) publicAccountMenuEntity);
                    }
                } else {
                    createEntityManager.m7242a((Entity) publicAccountMenuEntity);
                }
                createEntityManager.m7241a();
                List list = getPublicAccountMenuResponse.button_info.get();
                this.f4080a.put(str, Long.valueOf(publicAccountMenuEntity.savedDateTime));
                this.f4088c.put(str, list);
                int i2 = getPublicAccountMenuResponse.menu_type.has() ? getPublicAccountMenuResponse.menu_type.get() : 0;
                this.f4089d.put(str, Integer.valueOf(i2));
                if (i2 != 0) {
                    ReportController.a(qQAppInterface, "dc01332", "Pb_account_lifeservice", "", "0X8005EC2", "0X8005EC2", 0, 0, str, i2 == 1 ? "icon" : "text", "", "");
                    if (list.size() > 0 && list.get(0) != null && ((mobileqq_mp.ButtonInfo) list.get(0)).sub_button.has() && ((mobileqq_mp.ButtonInfo) list.get(0)).sub_button.get() != null) {
                        ReportController.a(qQAppInterface, "dc01332", "Pb_account_lifeservice", "", "0X8005EC3", "0X8005EC3", 0, 0, str, String.valueOf(((mobileqq_mp.ButtonInfo) list.get(0)).sub_button.get().size()), "", "");
                    }
                }
            }
        }
    }

    private void a(String str, long j2) {
        this.f4080a.put(str, Long.valueOf(j2));
    }

    private boolean a(String str, Context context) {
        if (this.f4080a.containsKey(str)) {
            long longValue = ((Long) this.f4080a.get(str)).longValue();
            long currentTimeMillis = System.currentTimeMillis();
            long j2 = context.getSharedPreferences(f4069b, 0).getLong(f4071d, -1L);
            if (j2 <= 0) {
                j2 = 21600000;
            }
            if (QLog.isColorLevel()) {
                QLog.d("PublicAccountManager-Menu", 2, "cacheTime(ms):" + j2);
            }
            return currentTimeMillis - longValue >= j2;
        }
        return true;
    }

    public static int a(String str, AppInterface appInterface) {
        PublicAccountInfo m4572b = ((PublicAccountDataManager) appInterface.getManager(55)).m4572b(str + "");
        return (m4572b == null || m4572b.extendType != 2) ? 2 : 1;
    }

    public NewIntent a(String str, int i2, boolean z2, Context context, AppInterface appInterface, refuseAcceptDone refuseacceptdone) {
        NewIntent newIntent = new NewIntent(context, PublicAccountServlet.class);
        newIntent.putExtra("cmd", q);
        mobileqq_mp.SetRefuseFollowRequest setRefuseFollowRequest = new mobileqq_mp.SetRefuseFollowRequest();
        setRefuseFollowRequest.luin.set(Long.parseLong(str));
        setRefuseFollowRequest.account_type.set(1);
        setRefuseFollowRequest.refuse_forever.set(z2);
        if (!z2) {
            setRefuseFollowRequest.refuse_period.set(i2);
        }
        newIntent.putExtra("data", setRefuseFollowRequest.toByteArray());
        newIntent.setObserver(new guy(this, newIntent, refuseacceptdone));
        if (appInterface != null) {
            appInterface.startServlet(newIntent);
        }
        return newIntent;
    }

    public void a(NewIntent newIntent) {
        if (newIntent != null) {
            newIntent.setObserver(null);
        }
    }

    public NewIntent a(Context context, AppInterface appInterface, long j2, long j3, long j4, long j5, int i2, List list) {
        if (QLog.isColorLevel()) {
            QLog.i(f4066a, 2, String.format("sendMsgArriveReceipt request: msgId:%d msgOp:%d pcuin:%d cuin:%d type:%d", Long.valueOf(j2), Long.valueOf(j3), Long.valueOf(j4), Long.valueOf(j5), Integer.valueOf(i2)));
        }
        NewIntent newIntent = new NewIntent(context, PublicAccountServlet.class);
        newIntent.putExtra("cmd", r);
        mobileqq_mp.SendPublicAccountMessageReceiptRequest sendPublicAccountMessageReceiptRequest = new mobileqq_mp.SendPublicAccountMessageReceiptRequest();
        if (i2 == 1) {
            sendPublicAccountMessageReceiptRequest.uint64_unique_id.set(j2);
            sendPublicAccountMessageReceiptRequest.uint32_op.set(j3);
        } else if (i2 == 2) {
            sendPublicAccountMessageReceiptRequest.unique_ids.set(list);
        }
        sendPublicAccountMessageReceiptRequest.receipt_type.set(i2);
        sendPublicAccountMessageReceiptRequest.pcuin.set(j4);
        sendPublicAccountMessageReceiptRequest.cuin.set(j5);
        newIntent.putExtra("data", sendPublicAccountMessageReceiptRequest.toByteArray());
        newIntent.setObserver(new guz(this, newIntent));
        if (appInterface != null) {
            appInterface.startServlet(newIntent);
        }
        return newIntent;
    }

    private void a(Context context, MqqHandler mqqHandler, boolean z2) {
        Intent intent = new Intent(context, ScannerActivity.class);
        intent.putExtra("from", PublicAccountManager.class.getName());
        intent.putExtra(ScannerActivity.f6326l, true);
        intent.putExtra("scanForResult", z2);
        if (this.f4077a != null) {
            try {
                context.unregisterReceiver(this.f4077a);
            } catch (Exception e2) {
            }
            this.f4077a = null;
        }
        this.f4077a = new gva(this, z2, mqqHandler);
        context.registerReceiver(this.f4077a, new IntentFilter(E), "com.tencent.tim.msg.permission.pushnotify", null);
        context.startActivity(intent);
    }

    private void a(Context context, QQAppInterface qQAppInterface, SessionInfo sessionInfo) {
        if (AudioHelper.b(0)) {
            DialogUtil.a(context, 230, context.getString(R.string.f63485name_res_0x7f0a13dc), context.getString(R.string.f63486name_res_0x7f0a13dd), new gvb(this), (DialogInterface.OnClickListener) null).show();
        } else if (AudioHelper.m9094a(0)) {
            DialogUtil.a(context, 230, context.getString(R.string.f63485name_res_0x7f0a13dc), context.getString(R.string.f63487name_res_0x7f0a13de), new gvc(this), (DialogInterface.OnClickListener) null).show();
        } else {
            qQAppInterface.getTransFileController().c();
            PlusPanelUtils.a(qQAppInterface, (BaseActivity) context, 1, sessionInfo);
            ((BaseActivity) context).setCanLock(false);
            if (this.f4081b != null) {
                try {
                    context.unregisterReceiver(this.f4081b);
                } catch (Exception e2) {
                }
                this.f4081b = null;
            }
            this.f4081b = new gum(this);
            context.registerReceiver(this.f4081b, new IntentFilter(H), "com.tencent.tim.msg.permission.pushnotify", null);
            this.f4090j = 1;
        }
    }

    private void b(Context context, QQAppInterface qQAppInterface, SessionInfo sessionInfo) {
        qQAppInterface.getTransFileController().c();
        Uri a2 = CommonUtil.a();
        if (a2 != null) {
            ActionSheet a3 = ActionSheet.a((BaseActivity) context);
            for (String str : context.getResources().getStringArray(R.array.f37770name_res_0x7f080001)) {
                a3.c(str);
            }
            a3.d(R.string.f63203cancel);
            a3.a(new gun(this, qQAppInterface, context, a2, sessionInfo, a3));
            a3.show();
        } else {
            PlusPanelUtils.a(qQAppInterface, (Activity) context, sessionInfo, (ArrayList) null, (Intent) null);
            TroopHandler troopHandler = (TroopHandler) qQAppInterface.getBusinessHandler(20);
            if (!TextUtils.isEmpty(sessionInfo.f12447a) && sessionInfo.f85624a == 1) {
                troopHandler.e(sessionInfo.f12447a, true);
            }
            ((BaseActivity) context).setCanLock(false);
        }
        if (this.f4081b != null) {
            try {
                context.unregisterReceiver(this.f4081b);
            } catch (Exception e2) {
            }
            this.f4081b = null;
        }
        this.f4081b = new guo(this);
        context.registerReceiver(this.f4081b, new IntentFilter(H), "com.tencent.tim.msg.permission.pushnotify", null);
        this.f4090j = 2;
    }

    private void c(Context context, QQAppInterface qQAppInterface, SessionInfo sessionInfo) {
        String str = this.D;
        boolean z2 = this.f4084b;
        try {
            ((FragmentActivity) context).getChatFragment().m2396a().au();
            Intent intent = new Intent(context, PoiMapActivity.class);
            intent.putExtra("uintype", sessionInfo.f85624a);
            ((FragmentActivity) context).startActivityForResult(intent, 18);
        } catch (Exception e2) {
            e2.printStackTrace();
        }
        ((BaseActivity) context).setCanLock(false);
        if (this.f4086c != null) {
            try {
                context.unregisterReceiver(this.f4086c);
            } catch (Exception e3) {
            }
            this.f4086c = null;
        }
        this.f4086c = new gup(this, str, z2);
        context.registerReceiver(this.f4086c, new IntentFilter(K), "com.tencent.tim.msg.permission.pushnotify", null);
    }

    private void a(Context context, QQAppInterface qQAppInterface) {
        Intent intent = new Intent(context, QQBrowserActivity.class);
        intent.putExtra("url", "http://imgcache.qq.com/zzapp/widget/city_selector/city.html?_wv=5127&redirect_url=http%3A%2F%2Fweather.mp.qq.com%2F&from=aio");
        intent.putExtra("fromAio", true);
        context.startActivity(intent);
        ReportController.b(qQAppInterface, "dc01332", "weather_public_account", "", "weather_public_account", "weather_othercity_click", 0, 0, "", "", "", "");
    }

    private void a(QQAppInterface qQAppInterface, MqqHandler mqqHandler) {
        if (mqqHandler != null) {
            mqqHandler.sendEmptyMessage(19);
        }
        ((PublicAccountHandler) qQAppInterface.getBusinessHandler(11)).a(0, 0, 0, 0);
        ReportController.b(qQAppInterface, "dc01332", "weather_public_account", "", "weather_public_account", "weather_newcity_click", 0, 0, "", "", "", "");
    }

    public void a(Context context) {
        if (this.f4077a != null) {
            try {
                context.unregisterReceiver(this.f4077a);
            } catch (Exception e2) {
            }
            this.f4077a = null;
        }
        if (this.f4081b != null) {
            try {
                context.unregisterReceiver(this.f4081b);
            } catch (Exception e3) {
            }
            this.f4081b = null;
        }
        if (this.f4086c != null) {
            try {
                context.unregisterReceiver(this.f4086c);
            } catch (Exception e4) {
            }
            this.f4086c = null;
        }
    }

    private mobileqq_mp.SendMenuEventRequest a(int i2, String str, boolean z2) {
        String str2 = this.C;
        try {
            long longValue = Long.valueOf(str2).longValue();
            mobileqq_mp.SendMenuEventRequest sendMenuEventRequest = new mobileqq_mp.SendMenuEventRequest();
            sendMenuEventRequest.uin.set((int) longValue);
            sendMenuEventRequest.type.set(i2);
            sendMenuEventRequest.key.set(str);
            sendMenuEventRequest.msg_id.set(0L);
            sendMenuEventRequest.s_type.set(1);
            sendMenuEventRequest.versionInfo.set("6.5.5,3,1834");
            sendMenuEventRequest.menu_type.set(b(str2));
            if (z2) {
                sendMenuEventRequest.is_new_menu.set(z2);
            }
            if (QLog.isColorLevel()) {
                QLog.d("PublicAccountManager-init:", 2, "type:" + sendMenuEventRequest.type.get() + " uin:" + sendMenuEventRequest.uin.get() + " key:" + sendMenuEventRequest.key.get() + " msg_id:" + sendMenuEventRequest.msg_id.get() + " s_type:" + sendMenuEventRequest.s_type.get() + " versionInfo:" + sendMenuEventRequest.versionInfo.get() + " is_new_menu:" + sendMenuEventRequest.is_new_menu.get());
                return sendMenuEventRequest;
            }
            return sendMenuEventRequest;
        } catch (NumberFormatException e2) {
            if (QLog.isColorLevel()) {
                QLog.e(f4066a, 2, "puin is invalid format:" + str2);
            }
            return null;
        }
    }

    public void a(BaseActivity baseActivity, String str, String str2, String str3, String str4, BusinessObserver businessObserver) {
        boolean z2;
        this.C = str;
        this.f4082b = new WeakReference(baseActivity);
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("app", "QD");
            if (str2 != null) {
                jSONObject.put("assignType", Long.parseLong(str2));
            }
            if (str3 != null) {
                jSONObject.put("assignKey", Long.parseLong(str3));
            }
            if (str4 != null) {
                jSONObject.put("ext", str4);
            }
            z2 = false;
        } catch (Exception e2) {
            z2 = true;
        }
        mobileqq_mp.SendMenuEventRequest a2 = a(1, z2 ? "QD" : jSONObject.toString(), false);
        if (a2 != null) {
            a2.menu_type.set(1001);
            QQAppInterface qQAppInterface = (QQAppInterface) this.f4079a.get();
            String str5 = this.C;
            NewIntent newIntent = new NewIntent(baseActivity, PublicAccountServlet.class);
            newIntent.putExtra("cmd", p);
            newIntent.putExtra("data", a2.toByteArray());
            newIntent.setObserver(businessObserver);
            if (baseActivity.app != null) {
                baseActivity.app.startServlet(newIntent);
            }
        }
    }

    private void a(mobileqq_mp.SendMenuEventRequest sendMenuEventRequest) {
        Context context = (Context) this.f4082b.get();
        QQAppInterface qQAppInterface = (QQAppInterface) this.f4079a.get();
        String str = this.C;
        NewIntent newIntent = new NewIntent(context, PublicAccountServlet.class);
        newIntent.putExtra("cmd", p);
        newIntent.putExtra("data", sendMenuEventRequest.toByteArray());
        newIntent.setObserver(new guq(this, newIntent, context, str, (BusinessObserver) this.f4087c.get(), qQAppInterface));
        if (qQAppInterface != null) {
            qQAppInterface.startServlet(newIntent);
        }
    }

    public void a(boolean z2, double d2, double d3, String str, String str2, String str3, boolean z3) {
        mobileqq_mp.SendMenuEventRequest a2 = a(1, str3, z3);
        if (a2 != null) {
            if (z2) {
                a2.is_need_lbs.set(true);
                a2.latitude.set(d2);
                a2.longitude.set(d3);
            }
            if (str != null) {
                a2.lbsAddressLabel.set(str);
            }
            if (str2 != null) {
                a2.media_id.set(str2);
            }
            if (QLog.isColorLevel()) {
                QLog.d("PublicAccountManager-Click:", 2, "is_need_lbs:" + a2.is_need_lbs.get() + " latitude:" + a2.latitude.get() + " longitude:" + a2.longitude.get() + " lbsAddressLabel:" + a2.lbsAddressLabel.get() + " media_id:" + a2.media_id.get());
            }
            a(a2);
        }
    }

    public void a(String str, mobileqq_mp.ActionInfo actionInfo, String str2) {
        mobileqq_mp.SendMenuEventRequest a2 = a(2, this.D, this.f4084b);
        if (a2 != null) {
            a2.url.set(str);
            a2.actionInfo.set(actionInfo);
            if (str2 != null) {
                a2.media_id.set(str2);
            }
            if (QLog.isColorLevel()) {
                QLog.d("PublicAccountManager-Url:", 2, "url:" + a2.url.get() + " actionInfo:" + a2.actionInfo.get() + " media_id:" + a2.media_id.get());
            }
            a(a2);
        }
    }

    public void a(String str, int i2, int i3, int i4, List list) {
        mobileqq_mp.SendMenuEventRequest a2 = a(3, this.D, this.f4084b);
        if (a2 != null) {
            a2.event_id.set(i3);
            if (str != null) {
                a2.scan_result.set(str);
                a2.scanType.set(i2);
            }
            if (i4 >= 0) {
                a2.pictureCount.set(i4);
            }
            if (list != null) {
                a2.picture_Md5s.set(list);
            }
            if (QLog.isColorLevel()) {
                QLog.d("PublicAccountManager-Event:", 2, "event_id:" + a2.event_id.get() + " scan_result:" + a2.scan_result.get() + " pictureCount:" + a2.pictureCount.get());
            }
            a(a2);
        }
    }

    public void a(double d2, double d3, String str, String str2, boolean z2) {
        mobileqq_mp.SendMenuEventRequest a2 = a(3, str2, z2);
        if (a2 != null) {
            a2.is_need_lbs.set(true);
            a2.latitude.set(d2);
            a2.longitude.set(d3);
            a2.event_id.set(15);
            if (str != null) {
                a2.lbsAddressLabel.set(str);
            }
            if (QLog.isColorLevel()) {
                QLog.d("PublicAccountManager-Location:", 2, "event_id:" + a2.event_id.get() + " is_need_lbs:" + a2.is_need_lbs.get() + " latitude:" + a2.latitude.get() + " longitude:" + a2.longitude.get() + " lbsAddressLabel:" + a2.lbsAddressLabel.get());
            }
            a(a2);
        }
    }

    public void a(QQAppInterface qQAppInterface, String str, long j2) {
        qQAppInterface.getApp().getSharedPreferences("history_msg_params_" + qQAppInterface.getAccount(), 0).edit().putLong(str + "_msgid", j2).commit();
    }

    public long m1062a(QQAppInterface qQAppInterface, String str) {
        return qQAppInterface.getApp().getSharedPreferences("history_msg_params_" + qQAppInterface.getAccount(), 0).getLong(str + "_msgid", 0L);
    }

    public void m1065a(QQAppInterface qQAppInterface, String str) {
        qQAppInterface.getApp().getSharedPreferences("history_msg_params_" + qQAppInterface.getAccount(), 0).edit().remove(str + "_msgid").commit();
    }

    public static void b(QQAppInterface qQAppInterface, String str) {
        if (qQAppInterface != null && a(qQAppInterface, str)) {
            long serverTime = NetConnInfoCenter.getServerTime();
            RecentUserProxy m5113a = qQAppInterface.m4638a().m5113a();
            RecentUser a2 = m5113a.a(str, 1008);
            if (a2.lastmsgtime < serverTime) {
                a2.lastmsgtime = serverTime;
                if (QLog.isColorLevel()) {
                    QLog.d(f4066a, 2, "addPublicAccountToRu->pUin:" + str + ", currentTime:" + serverTime);
                }
            }
            m5113a.a(a2);
            ThreadManager.b(new gur(qQAppInterface, str));
        }
    }

    public static boolean a(QQAppInterface qQAppInterface, String str) {
        PublicAccountDataManager publicAccountDataManager = (PublicAccountDataManager) qQAppInterface.getManager(55);
        PublicAccountInfo m4572b = publicAccountDataManager.m4572b(str.toString());
        if (m4572b == null) {
            AccountDetail a2 = publicAccountDataManager.a(str);
            if (a2 == null) {
                return false;
            }
            return (a2.accountFlag & (-1902116864)) == 0;
        }
        return (m4572b.accountFlag & (-1902116864)) == 0;
    }

    public static void a(Context context, QQAppInterface qQAppInterface, String str) {
        if (qQAppInterface != null && context != null && str != null) {
            NewIntent newIntent = new NewIntent(context, PublicAccountServlet.class);
            newIntent.putExtra("cmd", s);
            mobileqq_mp.SendOrderPayEventRequest sendOrderPayEventRequest = new mobileqq_mp.SendOrderPayEventRequest();
            sendOrderPayEventRequest.versionInfo.set("6.5.5,3,1834");
            sendOrderPayEventRequest.cmd.set(1);
            sendOrderPayEventRequest.body.set(str);
            newIntent.putExtra("data", sendOrderPayEventRequest.toByteArray());
            newIntent.setObserver(new gus(newIntent));
            qQAppInterface.startServlet(newIntent);
        }
    }

    public static String a(long j2, long j3, String str, int i2, String str2, int i3, int i4, String str3, String str4) {
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("luin", j2);
            jSONObject.put("msg_id", j3);
            if (str == null) {
                str = "";
            }
            jSONObject.put("order_id", str);
            jSONObject.put("ret_code", i2);
            if (str2 == null) {
                str2 = "";
            }
            jSONObject.put("ret_str", str2);
            jSONObject.put("msg_type", i3);
            jSONObject.put("pay_time", i4);
            if (str3 == null) {
                str3 = "";
            }
            jSONObject.put("reserve_1", str3);
            if (str4 == null) {
                str4 = "";
            }
            jSONObject.put("reserve_2", str4);
        } catch (JSONException e2) {
        }
        return jSONObject.toString();
    }

    public boolean a(QQAppInterface qQAppInterface) {
        if (NetConnInfoCenter.getServerTimeMillis() < this.f4085c + EmojiManager.f22045b) {
            return false;
        }
        this.f4085c = NetConnInfoCenter.getServerTimeMillis();
        if (DeviceInfoUtil.m9147e() || FileUtils.a() <= 1.048576E8f) {
            return false;
        }
        WebProcessManager webProcessManager = (WebProcessManager) qQAppInterface.getManager(12);
        if (webProcessManager != null) {
            webProcessManager.m9581f();
        }
        if (QLog.isColorLevel()) {
            QLog.d(f4066a, 2, "startWebProcess  startWebProcess by userlist ad");
        }
        return true;
    }
}