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

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


package com.tencent.biz.pubaccount.util;

import NS_MOBILE_FEEDS.e_attribute;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.View;
import android.widget.Toast;
import com.tencent.biz.bmqq.util.BmqqSegmentUtil;
import com.tencent.biz.coupon.CouponActivity;
import com.tencent.biz.pubaccount.AccountDetail.activity.EqqAccountDetailActivity;
import com.tencent.biz.pubaccount.AccountDetailActivity;
import com.tencent.biz.pubaccount.PublicAccountManager;
import com.tencent.biz.pubaccount.PublicAccountServlet;
import com.tencent.biz.pubaccount.readinjoy.engine.KandianMergeManager;
import com.tencent.biz.pubaccount.readinjoy.model.UserOperationModule;
import com.tencent.biz.pubaccount.readinjoy.protocol.ReadInJoyMSFService;
import com.tencent.biz.pubaccount.readinjoy.struct.ReportInfo;
import com.tencent.biz.pubaccount.util.ProfileParams;
import com.tencent.common.app.AppInterface;
import com.tencent.common.app.BaseApplicationImpl;
import com.tencent.mobileqq.activity.ChatActivity;
import com.tencent.mobileqq.activity.ChatActivityConstants;
import com.tencent.mobileqq.activity.Conversation;
import com.tencent.mobileqq.activity.ProfileActivity;
import com.tencent.mobileqq.activity.PublicAccountListActivity;
import com.tencent.mobileqq.activity.recent.MsgSummary;
import com.tencent.mobileqq.app.AppConstants;
import com.tencent.mobileqq.app.EqqDetailDataManager;
import com.tencent.mobileqq.app.PublicAccountDataManager;
import com.tencent.mobileqq.app.PublicAccountHandler;
import com.tencent.mobileqq.app.PublicAccountObserver;
import com.tencent.mobileqq.app.QQAppInterface;
import com.tencent.mobileqq.app.ThreadManager;
import com.tencent.mobileqq.app.TroopManager;
import com.tencent.mobileqq.app.message.QQMessageFacade;
import com.tencent.mobileqq.app.proxy.RecentUserProxy;
import com.tencent.mobileqq.data.AccountDetail;
import com.tencent.mobileqq.data.EqqDetail;
import com.tencent.mobileqq.data.MessageForStructing;
import com.tencent.mobileqq.data.MessageRecord;
import com.tencent.mobileqq.data.OpenID;
import com.tencent.mobileqq.data.PublicAccountInfo;
import com.tencent.mobileqq.data.RecentUser;
import com.tencent.mobileqq.data.TroopInfo;
import com.tencent.mobileqq.data.UinPair;
import com.tencent.mobileqq.mp.mobileqq_mp;
import com.tencent.mobileqq.msf.sdk.MsfConstants;
import com.tencent.mobileqq.persistence.Entity;
import com.tencent.mobileqq.persistence.EntityManager;
import com.tencent.mobileqq.service.message.MessageRecordFactory;
import com.tencent.mobileqq.structmsg.StructMsgFactory;
import com.tencent.mobileqq.utils.DialogUtil;
import com.tencent.mobileqq.utils.QQCustomDialog;
import com.tencent.mobileqq.widget.IndexView;
import com.tencent.qidian.QidianProfileCardActivity;
import com.tencent.qphone.base.util.QLog;
import com.tencent.tim.R;
import com.tencent.widget.ActionSheet;
import com.tencent.widget.ActionSheetHelper;
import cooperation.dingdong.OfficeOpenBrowserActivity;
import cooperation.qzone.QZoneShareManager;
import cooperation.readinjoy.ReadInJoyHelper;
import java.net.URLDecoder;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.TimeZone;
import mqq.app.AppRuntime;
import mqq.app.NewIntent;
import mqq.manager.TicketManager;
import mqq.os.MqqHandler;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;
public class PublicAccountUtil {
    public static final int f82817a = 1;
    private static Handler f5253a = null;
    public static QQCustomDialog f5254a = null;
    public static final String f5256a = "PublicAccountUtil";
    public static MqqHandler f5257a = null;
    public static final int f82818b = 200;
    public static final String f5258b = "ab_test_sharePre";
    public static final int f82819c = -1;
    public static final String f5259c = "ab_test_switch_";
    public static final int d = -2;
    public static final String f5260d = "ab_test_loadtime_";
    public static final int e = -3;
    public static final String f5261e = "http://c.mp.qq.com/post/pageview/report?ftype=5&ctype=1&aid=%s&vid=%s&rtype=%d";
    public static final int f = -4;
    public static final String f5262f = "VIDEO_REALTIME_REPORT_AID";
    public static final int g = -5;
    public static final String f5263g = "VIDEO_REALTIME_REPORT_VID";
    public static final int h = -6;
    public static final String f5264h = "VIDEO_REALTIME_REPORT_RTYPE";
    public static final int i = -7;
    public static final String f5265i = "VIDEO_REALTIME_REPORT_RCODE";
    public static final int j = -8;
    public static final String f5266j = "need_finish";
    public static final int k = 1;
    public static final int l = 2;
    public static final int m = 3;
    public static final int n = 4;
    private static volatile int o = -1;
    private static String f5267k = "tag_delete_oldkandian_flag";
    private static Object f5255a = new Object();

    public static byte[] m1486a(String str) {
        String[] split = str.split(",");
        ByteBuffer allocate = ByteBuffer.allocate(split.length);
        for (String str2 : split) {
            allocate.put((byte) Integer.parseInt(str2));
        }
        return allocate.array();
    }

    public static String a(byte[] bArr) {
        StringBuffer stringBuffer = new StringBuffer();
        for (byte b2 : bArr) {
            stringBuffer.append((int) b2).append(",");
        }
        return stringBuffer.toString();
    }

    public static boolean a(String str, String str2) {
        if (str2.indexOf("?") != -1) {
            return b(str, str2);
        }
        if (str2.indexOf(MsfConstants.ProcessNameAll) != -1) {
            return c(str, str2);
        }
        return false;
    }

    public static boolean m1485a(String str) {
        Uri parse;
        String host;
        return (TextUtils.isEmpty(str) || (parse = Uri.parse(str)) == null || (host = parse.getHost()) == null || (!AccountDetailActivity.f3790o.equalsIgnoreCase(host) && !"post.mp.qq.com".equalsIgnoreCase(host))) ? false : true;
    }

    private static boolean b(String str, String str2) {
        if (str.length() != str2.length()) {
            return false;
        }
        for (int i2 = 0; i2 < str2.length(); i2++) {
            if (str.charAt(i2) != str2.charAt(i2) && str2.charAt(i2) != '?') {
                return false;
            }
        }
        return true;
    }

    private static boolean c(String str, String str2) {
        boolean z;
        int length = str.length();
        int length2 = str2.length();
        int indexOf = str2.indexOf(MsfConstants.ProcessNameAll);
        switch (indexOf) {
            case -1:
                if (length == length2) {
                    if (length != 0) {
                        for (int i2 = 0; i2 < length2; i2++) {
                            if (str.charAt(i2) != str2.charAt(i2)) {
                                return false;
                            }
                        }
                        return true;
                    }
                    return true;
                }
                return false;
            case 0:
                if (length2 == 1) {
                    return true;
                }
                int i3 = 0;
                while (i3 < length) {
                    if (str.charAt(i3) != str2.charAt(indexOf + 1) && str2.charAt(indexOf + 1) != '*') {
                        i3++;
                    } else {
                        z = true;
                        if (z) {
                            return false;
                        }
                        if (i3 != length) {
                            return c(str.substring(i3, length), str2.substring(indexOf + 1, length2));
                        }
                        return true;
                    }
                }
                i3 = 0;
                z = false;
                if (z) {
                }
                break;
            default:
                for (int i4 = 0; i4 < indexOf; i4++) {
                    if (str.charAt(i4) != str2.charAt(i4)) {
                        return false;
                    }
                }
                return c(str.substring(indexOf, length), str2.substring(indexOf, length2));
        }
    }

    public static AccountDetail m1474a(QQAppInterface qQAppInterface, String str) {
        EntityManager createEntityManager = qQAppInterface.getEntityManagerFactory().createEntityManager();
        AccountDetail accountDetail = (AccountDetail) createEntityManager.a(AccountDetail.class, str);
        createEntityManager.m7241a();
        return accountDetail;
    }

    public static void m1478a(QQAppInterface qQAppInterface, String str) {
        UinPair uinPair = new UinPair(qQAppInterface.getCurrentAccountUin(), str);
        PublicAccountHandler publicAccountHandler = (PublicAccountHandler) qQAppInterface.getBusinessHandler(11);
        if (publicAccountHandler.f18339a == null) {
            publicAccountHandler.f18339a = new ArrayList();
        }
        publicAccountHandler.f18339a.add(uinPair);
        EntityManager createEntityManager = qQAppInterface.getEntityManagerFactory().createEntityManager();
        createEntityManager.m7242a((Entity) uinPair);
        createEntityManager.m7241a();
    }

    public static void a(QQAppInterface qQAppInterface, Context context, String str) {
        b(qQAppInterface, context, str);
    }

    static void b(QQAppInterface qQAppInterface, Context context, String str) {
        ThreadManager.a(new hjj(str, qQAppInterface, context), 5, null, true);
    }

    public static void a(Intent intent, String str) {
        a((MessageRecord) null, intent, str);
    }

    public static void a(MessageRecord messageRecord, Intent intent, String str) {
        int indexOf;
        if (messageRecord != null) {
            if (messageRecord.istroop == 1) {
                intent.putExtra("groupUin", messageRecord.frienduin);
            }
            intent.putExtra("friendUin", messageRecord.senderuin);
            intent.putExtra("uinType", messageRecord.istroop);
            intent.putExtra("fromAio", true);
        }
        ComponentName component = intent.getComponent();
        if (component != null && !TextUtils.isEmpty(str) && (indexOf = str.indexOf("?")) != -1) {
            String[] split = str.substring(indexOf + 1).split(IndexView.f95329b);
            for (int i2 = 0; i2 < split.length; i2++) {
                if (split[i2].startsWith("_webviewtype=")) {
                    String[] split2 = split[i2].split("=");
                    if (split2.length == 2 && !TextUtils.isEmpty(split2[1])) {
                        try {
                            switch (Integer.parseInt(split2[1])) {
                                case 1:
                                    intent.setComponent(new ComponentName(component.getPackageName(), CouponActivity.class.getName()));
                                    break;
                                case 2:
                                    intent.setComponent(new ComponentName(component.getPackageName(), OfficeOpenBrowserActivity.class.getName()));
                                    break;
                            }
                            return;
                        } catch (NumberFormatException e2) {
                            return;
                        }
                    }
                    return;
                } else if (split[i2].startsWith("url=")) {
                    String[] split3 = split[i2].split("=");
                    if (split3.length == 2 && !TextUtils.isEmpty(split3[1])) {
                        a(intent, URLDecoder.decode(split3[1]));
                        return;
                    }
                    return;
                }
            }
        }
    }

    public static void b(QQAppInterface qQAppInterface, String str) {
        UinPair uinPair = new UinPair(qQAppInterface.getCurrentAccountUin(), str);
        PublicAccountHandler publicAccountHandler = (PublicAccountHandler) qQAppInterface.getBusinessHandler(11);
        if (publicAccountHandler.f18339a != null && publicAccountHandler.f18339a.contains(uinPair)) {
            publicAccountHandler.f18339a.remove(uinPair);
        }
        EntityManager createEntityManager = qQAppInterface.getEntityManagerFactory().createEntityManager();
        createEntityManager.m7248b((Entity) uinPair);
        createEntityManager.m7241a();
    }

    public static boolean m1483a(QQAppInterface qQAppInterface, String str) {
        UinPair uinPair = new UinPair(qQAppInterface.getCurrentAccountUin(), str);
        PublicAccountHandler publicAccountHandler = (PublicAccountHandler) qQAppInterface.getBusinessHandler(11);
        if (publicAccountHandler.f18339a == null) {
            EntityManager createEntityManager = qQAppInterface.getEntityManagerFactory().createEntityManager();
            publicAccountHandler.f18339a = createEntityManager.a(UinPair.class, false, "userUin=? ", new String[]{qQAppInterface.getCurrentAccountUin()}, null, null, null, null);
            createEntityManager.m7241a();
            if (publicAccountHandler.f18339a == null) {
                publicAccountHandler.f18339a = new ArrayList();
            }
        }
        return publicAccountHandler.f18339a.contains(uinPair);
    }

    public static void a(QQAppInterface qQAppInterface, Context context, String str, int i2, long j2, boolean z, int i3) {
        String string;
        boolean equals = AppConstants.f17383ao.equals(str);
        ActionSheet actionSheet = (ActionSheet) ActionSheetHelper.a(context, (View) null);
        if (equals) {
            string = context.getResources().getString(R.string.f60812name_res_0x7f0a0969);
        } else {
            string = context.getResources().getString(R.string.f60811name_res_0x7f0a0968);
        }
        actionSheet.m10334a((CharSequence) string);
        actionSheet.a(R.string.f63878name_res_0x7f0a1565, 3);
        if (equals) {
            actionSheet.c(R.string.f60677name_res_0x7f0a08e1);
        }
        actionSheet.d(R.string.f63203cancel);
        actionSheet.a(new hjs(qQAppInterface, str, i2, j2, z, equals, i3, context, actionSheet));
        actionSheet.show();
    }

    public static boolean a(AppInterface appInterface, String str) {
        if (appInterface == null || TextUtils.isEmpty(str)) {
            return false;
        }
        EntityManager createEntityManager = appInterface.getEntityManagerFactory(appInterface.getAccount()).createEntityManager();
        AccountDetail accountDetail = (AccountDetail) createEntityManager.a(AccountDetail.class, str);
        if (accountDetail == null) {
            PublicAccountInfo publicAccountInfo = (PublicAccountInfo) createEntityManager.a(PublicAccountInfo.class, str);
            createEntityManager.m7241a();
            return publicAccountInfo != null;
        }
        createEntityManager.m7241a();
        try {
            mobileqq_mp.GetPublicAccountDetailInfoResponse getPublicAccountDetailInfoResponse = new mobileqq_mp.GetPublicAccountDetailInfoResponse();
            getPublicAccountDetailInfoResponse.mergeFrom(accountDetail.accountData);
            return getPublicAccountDetailInfoResponse.follow_type.get() == 1;
        } catch (Exception e2) {
            return false;
        }
    }

    public static void a(AppInterface appInterface, Context context, String str, PublicAccountObserver publicAccountObserver) {
        a(appInterface, context, str, publicAccountObserver, true);
    }

    public static void a(AppInterface appInterface, Context context, String str, PublicAccountObserver publicAccountObserver, boolean z) {
        if (appInterface != null && context != null && !TextUtils.isEmpty(str)) {
            NewIntent newIntent = new NewIntent(context.getApplicationContext(), PublicAccountServlet.class);
            newIntent.putExtra("cmd", PublicAccountManager.f4075h);
            mobileqq_mp.FollowRequest followRequest = new mobileqq_mp.FollowRequest();
            try {
                followRequest.uin.set((int) Long.parseLong(str));
                newIntent.setObserver(new hjt(publicAccountObserver, str, z, context, appInterface));
                newIntent.putExtra("data", followRequest.toByteArray());
                appInterface.startServlet(newIntent);
            } catch (NumberFormatException e2) {
                if (QLog.isColorLevel()) {
                    QLog.w(f5256a, 2, "Follow Request got wrong uin:" + str);
                }
            }
        }
    }

    public static void a(QQAppInterface qQAppInterface, Context context, String str, boolean z, PublicAccountObserver publicAccountObserver) {
        EqqDetail eqqDetail;
        EqqDetailDataManager eqqDetailDataManager;
        EqqDetail eqqDetail2 = null;
        if (qQAppInterface != null && context != null && !TextUtils.isEmpty(str)) {
            NewIntent newIntent = new NewIntent(qQAppInterface.getApp().getApplicationContext(), PublicAccountServlet.class);
            newIntent.putExtra("cmd", PublicAccountManager.f4076i);
            PublicAccountDataManager publicAccountDataManager = (PublicAccountDataManager) qQAppInterface.getManager(55);
            if (publicAccountDataManager != null) {
                AccountDetail a2 = publicAccountDataManager.a(str);
                publicAccountDataManager.m4572b(str);
                if (a2 != null || (eqqDetailDataManager = (EqqDetailDataManager) qQAppInterface.getManager(68)) == null) {
                    eqqDetail = null;
                    eqqDetail2 = a2;
                } else {
                    eqqDetail = eqqDetailDataManager.a(str);
                    eqqDetail2 = a2;
                }
            } else {
                eqqDetail = null;
            }
            mobileqq_mp.UnFollowRequest unFollowRequest = new mobileqq_mp.UnFollowRequest();
            try {
                unFollowRequest.uin.set((int) Long.parseLong(str));
                hju hjuVar = new hju(publicAccountObserver, str, z, context, eqqDetail == null ? eqqDetail : eqqDetail2, qQAppInterface);
                newIntent.putExtra("data", unFollowRequest.toByteArray());
                newIntent.setObserver(hjuVar);
                qQAppInterface.startServlet(newIntent);
            } catch (NumberFormatException e2) {
                if (QLog.isColorLevel()) {
                    QLog.w(f5256a, 2, "Unfollow Request got wrong uin:" + str);
                }
            }
        }
    }

    public static void a(AppInterface appInterface, Context context, String str, PublicAccountObserver publicAccountObserver, int i2) {
        if (appInterface != null && context != null && !TextUtils.isEmpty(str)) {
            NewIntent newIntent = new NewIntent(context.getApplicationContext(), PublicAccountServlet.class);
            newIntent.putExtra("cmd", "PubAccountFollowSvc.follow");
            mobileqq_mp.FollowRequest followRequest = new mobileqq_mp.FollowRequest();
            try {
                followRequest.uin.set((int) Long.parseLong(str));
                followRequest.type.set(i2);
                newIntent.setObserver(new hjv(publicAccountObserver, str, context, appInterface));
                newIntent.putExtra("data", followRequest.toByteArray());
                appInterface.startServlet(newIntent);
            } catch (NumberFormatException e2) {
                if (QLog.isColorLevel()) {
                    QLog.w(f5256a, 2, "Follow Request got wrong uin:" + str);
                }
            }
        }
    }

    public static void b(AppInterface appInterface, Context context, String str) {
        if (QLog.isColorLevel()) {
            QLog.d(f5256a, 2, "sendDetailInfoRequest");
        }
        NewIntent newIntent = new NewIntent(context, PublicAccountServlet.class);
        newIntent.putExtra("cmd", PublicAccountManager.f4074g);
        mobileqq_mp.GetPublicAccountDetailInfoRequest getPublicAccountDetailInfoRequest = new mobileqq_mp.GetPublicAccountDetailInfoRequest();
        getPublicAccountDetailInfoRequest.versionInfo.set("6.5.5,3,1834");
        getPublicAccountDetailInfoRequest.seqno.set(0);
        getPublicAccountDetailInfoRequest.version.set(1);
        try {
            getPublicAccountDetailInfoRequest.uin.set((int) Long.parseLong(str));
        } catch (Exception e2) {
        }
        newIntent.putExtra("data", getPublicAccountDetailInfoRequest.toByteArray());
        newIntent.setObserver(new hjw(context, appInterface));
        appInterface.startServlet(newIntent);
        if (QLog.isColorLevel()) {
            QLog.d(f5256a, 2, "sendDetailInfoRequest exit");
        }
    }

    public static void a(Context context, int i2) {
        Toast.makeText(context, i2, 0).show();
    }

    public static void a(Handler handler) {
        synchronized (PublicAccountUtil.class) {
            f5253a = handler;
        }
    }

    public static NewIntent a(QQAppInterface qQAppInterface, Context context, MqqHandler mqqHandler, String str) {
        if (QLog.isColorLevel()) {
            QLog.d(f5256a, 2, "getPublicAccountDetailRequest");
        }
        synchronized (PublicAccountUtil.class) {
            if (mqqHandler != null) {
                f5257a = mqqHandler;
            }
        }
        NewIntent newIntent = new NewIntent(context, PublicAccountServlet.class);
        newIntent.putExtra("cmd", PublicAccountManager.f4074g);
        mobileqq_mp.GetPublicAccountDetailInfoRequest getPublicAccountDetailInfoRequest = new mobileqq_mp.GetPublicAccountDetailInfoRequest();
        getPublicAccountDetailInfoRequest.seqno.set(0);
        getPublicAccountDetailInfoRequest.version.set(1);
        getPublicAccountDetailInfoRequest.versionInfo.set("6.5.5,3,1834");
        try {
            getPublicAccountDetailInfoRequest.uin.set((int) Long.parseLong(str));
        } catch (Exception e2) {
        }
        newIntent.putExtra("data", getPublicAccountDetailInfoRequest.toByteArray());
        newIntent.setObserver(new hjy(qQAppInterface));
        qQAppInterface.startServlet(newIntent);
        if (QLog.isColorLevel()) {
            QLog.d(f5256a, 2, "sendDetailInfoRequest exit");
        }
        return newIntent;
    }

    public static void m1477a() {
        synchronized (PublicAccountUtil.class) {
            f5257a = null;
        }
    }

    public static boolean a(int i2, long j2) {
        int a2 = a(i2);
        return a2 == -2 || a2 == -3 || a2 == -4 || a(j2) == -8;
    }

    public static int a(int i2) {
        if (i2 >= 0) {
            if ((2097152 & i2) != 0) {
                return -2;
            }
            if ((67108864 & i2) != 0) {
                return -3;
            }
            if ((33554432 & i2) != 0) {
                return -4;
            }
            if ((8388608 & i2) != 0) {
                return -5;
            }
            if ((134217728 & i2) == 0) {
                return -1;
            }
            return -6;
        }
        return i2;
    }

    public static long a(long j2) {
        if ((512 & j2) == 0) {
            return -1L;
        }
        return -8L;
    }

    public static int a(QQAppInterface qQAppInterface, String str) {
        PublicAccountDataManager publicAccountDataManager;
        int i2 = -1;
        if (qQAppInterface == null || TextUtils.isEmpty(str) || (publicAccountDataManager = (PublicAccountDataManager) qQAppInterface.getManager(55)) == null) {
            return -1;
        }
        PublicAccountInfo m4572b = publicAccountDataManager.m4572b(str);
        if (m4572b != null) {
            if (m4572b.extendType == 2) {
                return -7;
            }
            return a(m4572b.accountFlag);
        }
        TroopInfo m4837a = ((TroopManager) qQAppInterface.getManager(51)).m4837a(str);
        if (m4837a != null && m4837a.associatePubAccount != 0) {
            i2 = -4;
        }
        EqqDetailDataManager eqqDetailDataManager = (EqqDetailDataManager) qQAppInterface.getManager(68);
        if (eqqDetailDataManager == null || eqqDetailDataManager.a(str) == null) {
            return i2;
        }
        return -7;
    }

    private static int a(QQAppInterface qQAppInterface, String str, int i2) {
        int a2 = a(qQAppInterface, str);
        if (a2 == -1) {
            return a(i2);
        }
        return a2;
    }

    public static void a(Intent intent, QQAppInterface qQAppInterface, Context context, String str, int i2) {
        if (QLog.isColorLevel()) {
            QLog.d(f5256a, 2, "gotoProfile app: " + qQAppInterface + " | context: " + context + " | uin: " + str + " | accountFlag: " + i2);
        }
        if (qQAppInterface != null && context != null && !TextUtils.isEmpty(str)) {
            int a2 = a(qQAppInterface, str, i2);
            if (a2 == -2 || a2 == -3 || a2 == -4) {
                if (intent == null) {
                    intent = new Intent();
                    intent.putExtra("source", 105);
                }
            } else if (a2 == -1 && intent == null) {
                intent = new Intent();
                intent.putExtra("source", 104);
            }
            switch (a2) {
                case -7:
                    a(intent, context, str);
                    return;
                case -6:
                    if (BmqqSegmentUtil.a(context, str)) {
                        c(intent, context, str);
                        return;
                    }
                    return;
                default:
                    b(intent, context, str);
                    return;
            }
        }
    }

    public static void a(Intent intent, QQAppInterface qQAppInterface, Activity activity, String str, int i2, int i3, int i4) {
        if (QLog.isColorLevel()) {
            QLog.d(f5256a, 2, "gotoProfileForResult app: " + qQAppInterface + " | activity: " + activity + " | uin: " + str + " | accountFlag: " + i2 + " | requestCode: " + i3 + " | source: " + i4);
        }
        if (qQAppInterface != null && activity != null && !TextUtils.isEmpty(str)) {
            switch (a(qQAppInterface, str, i2)) {
                case -7:
                    b(intent, qQAppInterface, activity, str, i3, i4);
                    return;
                case -6:
                    if (BmqqSegmentUtil.a(activity, str)) {
                        a(intent, activity, str, i3, i4);
                        return;
                    }
                    return;
                default:
                    a(intent, qQAppInterface, activity, str, i3, i4);
                    return;
            }
        }
    }

    private static void a(Intent intent, Activity activity, String str, int i2, int i3) {
        if (intent == null) {
            intent = new Intent(activity, QidianProfileCardActivity.class);
        } else {
            intent.setClassName(activity, QidianProfileCardActivity.class.getName());
        }
        intent.putExtra(ProfileActivity.f10494t, new ProfileActivity.AllInOne(str, 78));
        intent.putExtra("uin", str);
        activity.startActivityForResult(intent, i2);
    }

    private static void a(Intent intent, QQAppInterface qQAppInterface, Activity activity, String str, int i2, int i3) {
        if (intent == null) {
            intent = new Intent(activity, AccountDetailActivity.class);
        } else {
            intent.setClassName(activity, AccountDetailActivity.class.getName());
        }
        intent.putExtra("uin", str);
        intent.putExtra("source", 5);
        intent.addFlags(67108864);
        activity.startActivityForResult(intent, i2);
        switch (i3) {
            case 1:
                PublicAccountHandler.a(qQAppInterface, str, "Pb_account_lifeservice", "mp_msg_sys_2", "detail");
                return;
            default:
                return;
        }
    }

    private static void b(Intent intent, QQAppInterface qQAppInterface, Activity activity, String str, int i2, int i3) {
        if (intent == null) {
            intent = new Intent(activity, EqqAccountDetailActivity.class);
        } else {
            intent.setClassName(activity, EqqAccountDetailActivity.class.getName());
        }
        intent.putExtra("uin", str);
        intent.putExtra("source", 5);
        intent.addFlags(67108864);
        activity.startActivityForResult(intent, i2);
        switch (i3) {
            case 1:
                PublicAccountHandler.a(qQAppInterface, str, "Pb_account_lifeservice", "mp_msg_sys_2", "detail");
                return;
            default:
                return;
        }
    }

    private static void c(Intent intent, Context context, String str) {
        if (intent == null) {
            intent = new Intent(context, QidianProfileCardActivity.class);
        } else {
            intent.setClassName(context, QidianProfileCardActivity.class.getName());
        }
        intent.putExtra(ProfileActivity.f10494t, new ProfileActivity.AllInOne(str, 78));
        intent.putExtra("uin", str);
        context.startActivity(intent);
    }

    public static void a(Intent intent, Context context, String str) {
        if (intent == null) {
            intent = new Intent(context, EqqAccountDetailActivity.class);
        } else {
            intent.setClassName(context, EqqAccountDetailActivity.class.getName());
        }
        intent.putExtra("uin", str);
        intent.addFlags(67108864);
        context.startActivity(intent);
        if (context instanceof Activity) {
            ((Activity) context).overridePendingTransition(R.anim.f37547activity_new, R.anim.f37548activity_out);
        }
    }

    public static void b(Intent intent, Context context, String str) {
        if (intent == null) {
            intent = new Intent(context, AccountDetailActivity.class);
        } else {
            intent.setClassName(context, AccountDetailActivity.class.getName());
        }
        intent.putExtra("uin", str);
        intent.addFlags(67108864);
        context.startActivity(intent);
        if (context instanceof Activity) {
            ((Activity) context).overridePendingTransition(R.anim.f37547activity_new, R.anim.f37548activity_out);
        }
    }

    public static String m1476a(QQAppInterface qQAppInterface, String str) {
        PublicAccountDataManager publicAccountDataManager;
        PublicAccountInfo m4577c;
        if (!TextUtils.isEmpty(str) && (publicAccountDataManager = (PublicAccountDataManager) qQAppInterface.getManager(55)) != null && (m4577c = publicAccountDataManager.m4577c(str)) != null) {
            return m4577c.name;
        }
        return str;
    }

    public static int a(QQAppInterface qQAppInterface) {
        int i2;
        PublicAccountDataManager publicAccountDataManager;
        if (qQAppInterface == null || (publicAccountDataManager = (PublicAccountDataManager) qQAppInterface.getManager(55)) == null) {
            i2 = 0;
        } else {
            i2 = publicAccountDataManager.c().size();
        }
        if (QLog.isColorLevel()) {
            QLog.d(f5256a, 2, "getSubscriptCount count: " + i2);
        }
        return i2;
    }

    public static void a(QQAppInterface qQAppInterface, Context context, String str, int i2) {
        String str2;
        PublicAccountInfo m4577c;
        if (QLog.isColorLevel()) {
            QLog.d(f5256a, 2, "gotoAIO app: " + qQAppInterface + " | context: " + context + " | uin: " + str + " | accountFlag: " + i2);
        }
        if (qQAppInterface != null && context != null && !TextUtils.isEmpty(str)) {
            PublicAccountDataManager publicAccountDataManager = (PublicAccountDataManager) qQAppInterface.getManager(55);
            if (publicAccountDataManager == null || (m4577c = publicAccountDataManager.m4577c(str)) == null) {
                str2 = "";
            } else {
                str2 = m4577c.name;
            }
            if (TextUtils.isEmpty(str2)) {
                str2 = str;
            }
            int a2 = a(qQAppInterface, str, i2);
            Intent intent = new Intent(context, ChatActivity.class);
            int i3 = 1008;
            if (a2 == -7) {
                intent.putExtra(ChatActivityConstants.f8568ad, 1);
                i3 = 0;
            }
            intent.putExtra("uin", str);
            intent.putExtra("uintype", i3);
            intent.putExtra(AppConstants.Key.h, str2);
            intent.putExtra(AppConstants.leftViewText.f87222a, context.getString(R.string.f63667button_back));
            context.startActivity(intent);
        }
    }

    public static void a(Activity activity, QQAppInterface qQAppInterface, ProfileParams profileParams) {
        ProfileParams.CurLoginUsr curLoginUsr = profileParams.f5169a;
        if (TextUtils.isEmpty(curLoginUsr.f82795a) && TextUtils.isEmpty(curLoginUsr.f82796b)) {
            b(activity, qQAppInterface, profileParams);
        } else if (!TextUtils.isEmpty(curLoginUsr.f82796b)) {
            if (!curLoginUsr.f82796b.equals(qQAppInterface.getCurrentAccountUin())) {
                c(activity, qQAppInterface, profileParams);
            } else {
                b(activity, qQAppInterface, profileParams);
            }
        } else {
            OpenID a2 = QZoneShareManager.a(qQAppInterface, profileParams.b(), new hka(activity, qQAppInterface, profileParams));
            if (a2 != null) {
                if (!a(activity, a2, qQAppInterface, profileParams)) {
                    b(activity, qQAppInterface, profileParams);
                }
            }
        }
    }

    public static void b(Activity activity, QQAppInterface qQAppInterface, ProfileParams profileParams) {
        d(activity, qQAppInterface, profileParams);
        activity.finish();
    }

    protected static final void c(Activity activity, QQAppInterface qQAppInterface, ProfileParams profileParams) {
        if (f5254a != null) {
            f5254a.dismiss();
            f5254a = null;
        }
        hkc hkcVar = new hkc(activity, profileParams, qQAppInterface);
        hjl hjlVar = new hjl(activity, profileParams);
        f5254a = DialogUtil.m9154a((Context) activity, 230);
        f5254a.setMessage(R.string.f60663name_res_0x7f0a08d3);
        f5254a.setTitle(R.string.f60789name_res_0x7f0a0952);
        f5254a.setNegativeButton(R.string.f63203cancel, hkcVar);
        f5254a.setPositiveButton(R.string.f60664name_res_0x7f0a08d4, hkcVar);
        f5254a.setOnCancelListener(hjlVar);
        if (activity != null && !activity.isFinishing()) {
            try {
                f5254a.show();
                return;
            } catch (Exception e2) {
                return;
            }
        }
        f5254a.dismiss();
        f5254a = null;
    }

    public static boolean a(Activity activity, OpenID openID, QQAppInterface qQAppInterface, ProfileParams profileParams) {
        if (openID != null && !TextUtils.isEmpty(openID.openID)) {
            if (!openID.openID.equals(profileParams.m1445a().f82795a)) {
                c(activity, qQAppInterface, profileParams);
                return true;
            }
        }
        return false;
    }

    public static void d(Activity activity, QQAppInterface qQAppInterface, ProfileParams profileParams) {
        if (!a(activity, profileParams)) {
            Intent intent = new Intent(activity, AccountDetailActivity.class);
            intent.addFlags(e_attribute._IsFrdCommentFamousFeed);
            Bundle bundle = new Bundle();
            bundle.putParcelable(ProfileParams.f82791a, profileParams);
            bundle.putString(AppConstants.Key.aS, activity.getIntent().getStringExtra(AppConstants.Key.aS));
            intent.putExtras(bundle);
            a(activity, qQAppInterface, profileParams.c(), profileParams.a(), intent);
        }
    }

    private static boolean a(Context context, ProfileParams profileParams) {
        return context == null || profileParams == null || profileParams.f5169a == null || TextUtils.isEmpty(profileParams.b());
    }

    private static void a(Context context, QQAppInterface qQAppInterface, String str, int i2, Intent intent) {
        switch (a(qQAppInterface, str, i2)) {
            case -7:
                a(intent, context, str);
                return;
            case -6:
                return;
            default:
                b(intent, context, str);
                return;
        }
    }

    public static String m1475a() {
        return "6.5.5,3,1834";
    }

    public static boolean m1487b(QQAppInterface qQAppInterface, String str) {
        int a2 = a(qQAppInterface, str);
        if (a2 != -3 && a2 != -4) {
            return false;
        }
        return true;
    }

    public static boolean c(QQAppInterface qQAppInterface, String str) {
        int a2 = a(qQAppInterface, str);
        return a2 == -3 || a2 == -4 || a2 == -2;
    }

    public static boolean d(QQAppInterface qQAppInterface, String str) {
        return a(qQAppInterface, str) == -2;
    }

    public static boolean m1484a(QQAppInterface qQAppInterface, String str, int i2) {
        return ReadInJoyHelper.g(qQAppInterface) ? i2 == -2000 || i2 == -1000 : d(qQAppInterface, str) || i2 == -2000 || i2 == -1000;
    }

    public static boolean m1481a(int i2) {
        int a2 = a(i2);
        if (a2 != -3 && a2 != -4) {
            return false;
        }
        return true;
    }

    public static boolean b(String str) {
        return AppConstants.f17387as.equals(str);
    }

    public static boolean m1480a() {
        return false;
    }

    public static boolean a(String str, int i2, String str2) {
        Uri parse;
        if (i2 == 0 || (parse = Uri.parse(str)) == null || TextUtils.isEmpty(parse.getHost())) {
            return false;
        }
        if (AccountDetailActivity.f3790o.equalsIgnoreCase(parse.getHost()) || "post.mp.qq.com".equalsIgnoreCase(parse.getHost())) {
            ThreadManager.a(new hjm(parse, i2, str2), 5, null, false);
            return true;
        }
        return false;
    }

    public static void m1479a(String str) {
        Uri parse;
        if (!TextUtils.isEmpty(str) && (parse = Uri.parse(str)) != null) {
            String host = parse.getHost();
            if (!TextUtils.isEmpty(host)) {
                if (AccountDetailActivity.f3790o.equalsIgnoreCase(host) || "post.mp.qq.com".equalsIgnoreCase(host)) {
                    ThreadManager.a(new hjn(parse, str), 5, null, false);
                }
            }
        }
    }

    public static void a(int i2, String str, int i3) {
        Uri parse;
        if (!TextUtils.isEmpty(str) && (parse = Uri.parse(str)) != null) {
            String host = parse.getHost();
            if (!TextUtils.isEmpty(host)) {
                if (AccountDetailActivity.f3790o.equalsIgnoreCase(host) || "post.mp.qq.com".equalsIgnoreCase(host)) {
                    ThreadManager.a(new hjo(parse, i3, i2, str), 5, null, false);
                }
            }
        }
    }

    public static boolean a(MessageRecord messageRecord) {
        if (messageRecord == null) {
            return false;
        }
        int i2 = messageRecord.msgtype;
        if (i2 == -1000 || i2 == -1037) {
            String extInfoFromExtStr = messageRecord.getExtInfoFromExtStr("welcome_msg");
            return !TextUtils.isEmpty(extInfoFromExtStr) && extInfoFromExtStr.equals("true");
        }
        return false;
    }

    public static boolean m1482a(QQAppInterface qQAppInterface) {
        return false;
    }

    public static boolean b(QQAppInterface qQAppInterface) {
        boolean z;
        SharedPreferences sharedPreferences = qQAppInterface.getApplication().getSharedPreferences(AppConstants.f17367Y, 0);
        synchronized (f5255a) {
            if (o == -1) {
                o = sharedPreferences.getInt(f5267k + qQAppInterface.getCurrentAccountUin(), 0);
            }
            z = o != 0;
        }
        return z;
    }

    public static void a(QQAppInterface qQAppInterface, boolean z) {
        boolean z2;
        RecentUser b2;
        SharedPreferences sharedPreferences = qQAppInterface.getApplication().getSharedPreferences(AppConstants.f17367Y, 0);
        synchronized (f5255a) {
            if (o == -1) {
                o = sharedPreferences.getInt(f5267k + qQAppInterface.getCurrentAccountUin(), 0);
            }
            z2 = o == 0;
            o = z ? 1 : 0;
            sharedPreferences.edit().putInt(f5267k + qQAppInterface.getCurrentAccountUin(), o).commit();
        }
        if (z2 && z) {
            RecentUserProxy m5113a = qQAppInterface.m4638a().m5113a();
            if (m5113a != null && (b2 = m5113a.b(AppConstants.aw, 1008)) != null) {
                m5113a.b(b2);
                MqqHandler handler = qQAppInterface.getHandler(Conversation.class);
                if (handler != null) {
                    handler.sendEmptyMessage(1009);
                }
            }
            PublicAccountDataManager publicAccountDataManager = (PublicAccountDataManager) qQAppInterface.getManager(55);
            if (publicAccountDataManager != null) {
                publicAccountDataManager.m4579c(AppConstants.aw);
                MqqHandler handler2 = qQAppInterface.getHandler(PublicAccountListActivity.class);
                if (handler2 != null) {
                    handler2.sendEmptyMessage(0);
                }
            }
        }
        if (QLog.isColorLevel()) {
            QLog.i(f5256a, 2, "updateDeleteOldKandian notDeleteState = " + z2 + ", isDelete = " + z);
        }
    }

    public static void b() {
        synchronized (f5255a) {
            o = -1;
        }
    }

    public static MessageForStructing b(MessageForStructing messageForStructing, String str, String str2, String str3, String str4) {
        MessageForStructing messageForStructing2 = null;
        if (messageForStructing != null && (messageForStructing instanceof MessageForStructing) && messageForStructing.isread) {
            messageForStructing2 = (MessageForStructing) MessageRecordFactory.a(messageForStructing.msgtype);
            messageForStructing2.copyStructingMsg(messageForStructing);
            messageForStructing2.issend = 1;
            messageForStructing2.isread = true;
            if (!TextUtils.isEmpty(str)) {
                messageForStructing2.structingMsg.mMsgBrief = str;
                messageForStructing2.doPrewrite();
            }
            if (!TextUtils.isEmpty(str2)) {
                messageForStructing2.structingMsg.mArticleIds = str2;
            }
            if (!TextUtils.isEmpty(str3)) {
                messageForStructing2.structingMsg.mOrangeWord = str3;
            }
            if (!TextUtils.isEmpty(str4)) {
                try {
                    messageForStructing2.time = Long.parseLong(str4);
                } catch (Exception e2) {
                    e2.printStackTrace();
                }
            }
            messageForStructing2.extInt = 0;
            messageForStructing2.extLong = 0;
        }
        return messageForStructing2;
    }

    public static MessageForStructing b(QQAppInterface qQAppInterface, String str, String str2, String str3, String str4) {
        MessageForStructing messageForStructing = (MessageForStructing) MessageRecordFactory.a((int) MessageRecord.MSG_TYPE_STRUCT_MSG);
        messageForStructing.structingMsg = StructMsgFactory.m8168a();
        messageForStructing.structingMsg.mMsgServiceID = 500;
        messageForStructing.selfuin = qQAppInterface.m4704d();
        messageForStructing.frienduin = AppConstants.ax;
        messageForStructing.senderuin = AppConstants.ax;
        messageForStructing.istroop = 1008;
        messageForStructing.issend = 1;
        messageForStructing.isread = true;
        if (!TextUtils.isEmpty(str)) {
            messageForStructing.structingMsg.mMsgBrief = str;
            messageForStructing.doPrewrite();
        }
        if (!TextUtils.isEmpty(str2)) {
            messageForStructing.structingMsg.mArticleIds = str2;
        }
        if (!TextUtils.isEmpty(str3)) {
            messageForStructing.structingMsg.mOrangeWord = str3;
        }
        if (!TextUtils.isEmpty(str4)) {
            try {
                messageForStructing.time = Long.parseLong(str4);
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
        messageForStructing.extInt = 0;
        messageForStructing.extLong = 0;
        return messageForStructing;
    }

    public static void a(QQAppInterface qQAppInterface, String str, String str2, String str3, boolean z) {
        a(qQAppInterface, str, str2, str3, 0, z);
    }

    public static void a(QQAppInterface qQAppInterface, String str, String str2, String str3, int i2, boolean z) {
        if (ReadInJoyHelper.m11170a(qQAppInterface)) {
            KandianMergeManager kandianMergeManager = (KandianMergeManager) qQAppInterface.getManager(161);
            if (!TextUtils.isEmpty(str3)) {
                str = str3 + MsgSummary.f15235c + str;
            }
            kandianMergeManager.a(str, str2, i2, z);
            return;
        }
        QQMessageFacade m4635a = qQAppInterface.m4635a();
        if (m4635a != null) {
            ThreadManager.a(new hjp(m4635a, str3, str, str2, qQAppInterface), 10, null, false);
        }
    }

    public static void a(QQAppInterface qQAppInterface, MessageForStructing messageForStructing, int i2) {
        long j2;
        JSONObject a2;
        if (messageForStructing != null) {
            ArrayList arrayList = new ArrayList();
            if (!TextUtils.isEmpty(messageForStructing.structingMsg.mAlgorithmIds)) {
                for (String str : messageForStructing.structingMsg.mAlgorithmIds.split("\\|")) {
                    try {
                        arrayList.add(Integer.valueOf(Integer.parseInt(str)));
                    } catch (Exception e2) {
                        e2.printStackTrace();
                    }
                }
            }
            ArrayList arrayList2 = new ArrayList();
            if (!TextUtils.isEmpty(messageForStructing.structingMsg.mStrategyIds)) {
                for (String str2 : messageForStructing.structingMsg.mStrategyIds.split("\\|")) {
                    try {
                        arrayList2.add(Integer.valueOf(Integer.parseInt(str2)));
                    } catch (Exception e3) {
                        e3.printStackTrace();
                    }
                }
            }
            if (!TextUtils.isEmpty(messageForStructing.structingMsg.mMsgActionData) && (a2 = a(messageForStructing.structingMsg.mMsgActionData)) != null) {
                try {
                    j2 = Long.parseLong(a2.getString("id"));
                } catch (Exception e4) {
                    e4.printStackTrace();
                }
                if (j2 == -1 && arrayList.size() > 0 && arrayList2.size() > 0) {
                    a(qQAppInterface, j2, ((Integer) arrayList.get(0)).intValue(), ((Integer) arrayList2.get(0)).intValue(), i2);
                    return;
                }
                return;
            }
            j2 = -1;
            if (j2 == -1) {
            }
        }
    }

    private static void a(QQAppInterface qQAppInterface, long j2, int i2, int i3, int i4) {
        ArrayList arrayList = new ArrayList();
        ReportInfo reportInfo = new ReportInfo();
        reportInfo.mUin = qQAppInterface.getLongAccountUin();
        reportInfo.mSource = 0;
        reportInfo.mSourceArticleId = j2;
        reportInfo.mAlgorithmId = i2;
        reportInfo.mOperation = i4;
        reportInfo.mOpSource = 3;
        reportInfo.mStrategyId = i3;
        arrayList.add(reportInfo);
        new UserOperationModule(qQAppInterface, null, null, ReadInJoyMSFService.a(), null).m1253a((List) arrayList);
    }

    public static JSONObject a(String str) {
        try {
            return (JSONObject) new JSONTokener(str).nextValue();
        } catch (NullPointerException e2) {
            return null;
        } catch (JSONException e3) {
            return null;
        } catch (Exception e4) {
            return null;
        }
    }

    public static void a(String str, String str2, int i2, int i3) {
        if (QLog.isColorLevel()) {
            QLog.i(f5256a, 2, "videoPlayRealtimeReport aid=" + str + ", vid=" + str2 + ", rtype=" + i2 + ", rcode=" + i3);
        }
        if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str)) {
            AppRuntime m1871a = BaseApplicationImpl.a().m1871a();
            if (m1871a != null && (m1871a instanceof QQAppInterface)) {
                b(str, str2, i2, i3);
            } else if (m1871a != null && "ReadInJoyAppInterface".equals(m1871a.getClass().getSimpleName())) {
                Intent intent = new Intent(ReadInJoyHelper.ad);
                intent.putExtra(f5262f, str);
                intent.putExtra(f5263g, str2);
                intent.putExtra(f5264h, i2);
                intent.putExtra(f5265i, i3);
                BaseApplicationImpl.a().sendBroadcast(intent);
            }
        }
    }

    public static void b(String str, String str2, int i2, int i3) {
        TicketManager ticketManager;
        if (QLog.isColorLevel()) {
            QLog.i(f5256a, 2, "doVideoPlayRealtimeReport aid=" + str + ", vid=" + str2 + ", rtype=" + i2 + ", rcode=" + i3);
        }
        if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str)) {
            AppRuntime m1871a = BaseApplicationImpl.a().m1871a();
            QQAppInterface qQAppInterface = (m1871a == null || !(m1871a instanceof QQAppInterface)) ? null : (QQAppInterface) m1871a;
            if (qQAppInterface != null) {
                String currentAccountUin = qQAppInterface.getCurrentAccountUin();
                if (!TextUtils.isEmpty(currentAccountUin) && (ticketManager = (TicketManager) qQAppInterface.getManager(2)) != null) {
                    String skey = ticketManager.getSkey(currentAccountUin);
                    if (!TextUtils.isEmpty(skey)) {
                        ThreadManager.a(new hjq(str, str2, i2, currentAccountUin, skey, i3), 5, null, true);
                    }
                }
            }
        }
    }

    public static long b(long j2) {
        return TimeZone.getDefault().getRawOffset() + j2;
    }
}