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

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


package com.tencent.mobileqq.troop.utils;

import NS_MOBILE_FEEDS.e_attribute;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.Looper;
import android.text.TextUtils;
import com.tencent.biz.pubaccount.PublicAccountBrowser;
import com.tencent.common.app.BaseApplicationImpl;
import com.tencent.mobileqq.activity.QQBrowserActivity;
import com.tencent.mobileqq.app.MessageHandlerUtils;
import com.tencent.mobileqq.app.QQAppInterface;
import com.tencent.mobileqq.app.ThreadManager;
import com.tencent.mobileqq.app.TroopHandler;
import com.tencent.mobileqq.app.TroopManager;
import com.tencent.mobileqq.app.message.BaseMessageManager;
import com.tencent.mobileqq.app.message.MsgProxyUtils;
import com.tencent.mobileqq.app.proxy.RecentUserProxy;
import com.tencent.mobileqq.data.MessageForGrayTips;
import com.tencent.mobileqq.data.MessageRecord;
import com.tencent.mobileqq.data.RecentUser;
import com.tencent.mobileqq.data.TroopMemberInfo;
import com.tencent.mobileqq.filemanager.data.FMConstants;
import com.tencent.mobileqq.filemanager.data.FMDataCache;
import com.tencent.mobileqq.filemanager.data.FileInfo;
import com.tencent.mobileqq.filemanager.data.FileManagerEntity;
import com.tencent.mobileqq.filemanager.data.ForwardFileInfo;
import com.tencent.mobileqq.filemanager.fileviewer.FileBrowserActivity;
import com.tencent.mobileqq.filemanager.util.FileManagerUtil;
import com.tencent.mobileqq.model.TroopInfoManager;
import com.tencent.mobileqq.msf.core.NetConnInfoCenter;
import com.tencent.mobileqq.service.message.MessageRecordFactory;
import com.tencent.mobileqq.troop.data.MessageInfo;
import com.tencent.mobileqq.troop.data.TroopTipsEntity;
import com.tencent.mobileqq.vaswebviewplugin.VasWebviewConstants;
import com.tencent.qphone.base.util.QLog;
import com.tencent.tim.R;
import java.io.File;
import java.util.ArrayList;
import java.util.Map;
public class HWTroopUtils {
    public static final String f94004a = "hw_troop";
    public static final String f94005b = "https://qun.qq.com/homework/features/guide.html?ishw=1&_wv=1027&_bid=2146&gid=";
    protected static final String f94006c = "http://admin.qun.qq.com/mcreatev3/joingroup.html?_bid=206&_wv=2098179&groupCode=%1$s&source=%2$s&uin=%3$s";
    public static final String d = "troopProfile";
    public static final String e = "join";
    public static final String f = "qqProfile";
    public static final String g = "dialog";
    public static final String h = "aioTip";
    public static final String i = "onHomeworkTroopIdentityChanged";
    public static final String j = "homework_troop_aio_tip_show";

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

    public static void a(QQAppInterface qQAppInterface, String str, int i2) {
        if (QLog.isColorLevel()) {
            QLog.d(f94004a, 2, "insertAddHWTroopGrayTips:" + str);
        }
        MessageForGrayTips messageForGrayTips = (MessageForGrayTips) MessageRecordFactory.a(-1013);
        messageForGrayTips.frienduin = str;
        Resources resources = BaseApplicationImpl.a().getResources();
        String string = resources.getString(R.string.f61393name_res_0x7f0a0bae);
        String string2 = resources.getString(R.string.f61394name_res_0x7f0a0baf);
        messageForGrayTips.init(qQAppInterface.getCurrentAccountUin(), str, str, string, NetConnInfoCenter.getServerTime(), -1013, 1, i2);
        Bundle bundle = new Bundle();
        bundle.putInt("key_action", 10);
        int indexOf = string.indexOf(string2);
        messageForGrayTips.addHightlightItem(indexOf, string2.length() + indexOf, bundle);
        if (!MessageHandlerUtils.a(qQAppInterface, (MessageRecord) messageForGrayTips, false)) {
            qQAppInterface.m4635a().a(messageForGrayTips, qQAppInterface.getCurrentAccountUin());
        }
    }

    public static void a(QQAppInterface qQAppInterface, String str) {
        if (QLog.isColorLevel()) {
            QLog.d(f94004a, 2, "insertCreateHWTroopGrayTips:" + str);
        }
        MessageForGrayTips messageForGrayTips = (MessageForGrayTips) MessageRecordFactory.a(-1013);
        messageForGrayTips.frienduin = str;
        Resources resources = BaseApplicationImpl.a().getResources();
        String string = resources.getString(R.string.f61393name_res_0x7f0a0bae);
        String string2 = resources.getString(R.string.f61394name_res_0x7f0a0baf);
        messageForGrayTips.init(qQAppInterface.getCurrentAccountUin(), str, str, string, NetConnInfoCenter.getServerTime(), -1013, 1, 0L);
        Bundle bundle = new Bundle();
        bundle.putInt("key_action", 10);
        int indexOf = string.indexOf(string2);
        messageForGrayTips.addHightlightItem(indexOf, string2.length() + indexOf, bundle);
        if (!MessageHandlerUtils.a(qQAppInterface, (MessageRecord) messageForGrayTips, false)) {
            qQAppInterface.m4635a().a(messageForGrayTips, qQAppInterface.getCurrentAccountUin());
        }
    }

    public static void b(QQAppInterface qQAppInterface, String str) {
        if (QLog.isColorLevel()) {
            QLog.d(f94004a, 2, "insertHWInfoUpdateGrayTips:" + str);
        }
        MessageForGrayTips messageForGrayTips = (MessageForGrayTips) MessageRecordFactory.a(-1013);
        messageForGrayTips.init(qQAppInterface.getCurrentAccountUin(), str, str, qQAppInterface.getApp().getString(R.string.f61392name_res_0x7f0a0bad), NetConnInfoCenter.getServerTime(), -1013, 1, 0L);
        if (!MessageHandlerUtils.a(qQAppInterface, (MessageRecord) messageForGrayTips, false)) {
            qQAppInterface.m4635a().a(messageForGrayTips, qQAppInterface.getCurrentAccountUin());
        }
    }

    public static void a(QQAppInterface qQAppInterface) {
        TroopTipsEntity troopTipsEntity = new TroopTipsEntity();
        troopTipsEntity.actiontType = 0;
        troopTipsEntity.currentUin = qQAppInterface.getCurrentAccountUin();
        troopTipsEntity.optContent = "ssssssssssstestC";
        troopTipsEntity.highlightItems = "[{\"data\":\"http://qun.qq.com/homework/features/model/result.html?_wv=1027&_bid=2146#gid=140290661&hw_id=1601209066131000&src=9\",\"cmd\":1,\"text\":\"testC\",\"endIndex\":16,\"startIndex\":11}]";
        troopTipsEntity.highlightNum = 1;
        troopTipsEntity.msgSeq = -9262L;
        troopTipsEntity.time = NetConnInfoCenter.getServerTime();
        troopTipsEntity.tipsPromptType = 1;
        troopTipsEntity.troopUin = "183876887";
        a(qQAppInterface, troopTipsEntity);
    }

    public static void a(QQAppInterface qQAppInterface, TroopTipsEntity troopTipsEntity) {
        if (QLog.isColorLevel()) {
            QLog.d(f94004a, 2, "insertTroopHomeworkPriseGrayTips:" + troopTipsEntity.troopUin + ", optContent:" + troopTipsEntity.optContent + ", , remindFlag:" + troopTipsEntity.grayTipsRemindFlag + ", serviceType:3, msgSeq:" + troopTipsEntity.msgSeq + ", time:" + troopTipsEntity.time + ", expireTime:" + troopTipsEntity.expireTime + ", isOfflineMsg:" + troopTipsEntity.isOfflineMsg + ", optShowLatest:" + troopTipsEntity.optShowLatest + ", highLightItems:" + troopTipsEntity.highlightItems + ", highLightNum:" + troopTipsEntity.highlightNum);
        }
        MessageForGrayTips messageForGrayTips = (MessageForGrayTips) MessageRecordFactory.a((int) MessageRecord.MSG_TYPE_HOMEWORK_PRAISE);
        messageForGrayTips.frienduin = troopTipsEntity.troopUin;
        messageForGrayTips.init(qQAppInterface.getCurrentAccountUin(), troopTipsEntity.troopUin, troopTipsEntity.troopUin, troopTipsEntity.optContent, troopTipsEntity.time, MessageRecord.MSG_TYPE_HOMEWORK_PRAISE, 1, troopTipsEntity.msgSeq);
        if (troopTipsEntity.highlightNum != 0) {
            TroopTipsMsgMgr.a(messageForGrayTips, troopTipsEntity.highlightItems);
        }
        if (troopTipsEntity.optShowLatest == 1) {
            messageForGrayTips.shmsgseq = 0L;
        }
        if (!MessageHandlerUtils.a(qQAppInterface, (MessageRecord) messageForGrayTips, false)) {
            if (QLog.isColorLevel()) {
                QLog.d(f94004a, 2, "insertTroopHomeworkPriseGrayTips, after msgFilter:" + troopTipsEntity.troopUin);
            }
            qQAppInterface.m4635a().a(messageForGrayTips, qQAppInterface.getCurrentAccountUin());
            if (!((TroopBindPublicAccountMgr) qQAppInterface.getManager(131)).m8783b(troopTipsEntity.troopUin)) {
                MessageInfo messageInfo = new MessageInfo();
                MessageInfo messageInfo2 = new MessageInfo();
                messageInfo2.m.a(messageForGrayTips.shmsgseq, messageForGrayTips.uniseq);
                messageInfo.a(messageInfo2);
                messageForGrayTips.mMessageInfo = messageInfo2;
                ((TroopInfoManager) qQAppInterface.getManager(36)).a(troopTipsEntity.troopUin, messageInfo);
                BaseMessageManager.AddMessageContext addMessageContext = new BaseMessageManager.AddMessageContext(qQAppInterface);
                RecentUserProxy recentUserProxy = addMessageContext.f18952a;
                Map map = addMessageContext.f18954a;
                RecentUser a2 = recentUserProxy.a(troopTipsEntity.troopUin, 1);
                int a3 = messageInfo.a(qQAppInterface, true, troopTipsEntity.troopUin);
                if (a3 >= a2.msgType) {
                    a2.msgType = a3;
                    a2.f88926msg = MessageInfo.a(qQAppInterface, troopTipsEntity.troopUin, messageInfo, a2.f88926msg, messageForGrayTips, true);
                    map.put(MsgProxyUtils.a(troopTipsEntity.troopUin, 1), a2);
                }
                ((TroopHandler) qQAppInterface.getBusinessHandler(20)).a(79, true, (Object) null);
            }
        }
    }

    public static void a(Context context, String str) {
        Intent intent = new Intent(context, QQBrowserActivity.class);
        intent.putExtra("url", f94005b + str);
        intent.putExtra("webStyle", "noBottomBar");
        intent.putExtra("hide_more_button", true);
        intent.putExtra(PublicAccountBrowser.h, true);
        intent.putExtra(QQBrowserActivity.W, false);
        context.startActivity(intent);
    }

    public static boolean a(Context context, String str, String str2) {
        File file;
        try {
            file = new File(str);
        } catch (Exception e2) {
            if (QLog.isColorLevel()) {
                QLog.e(f94004a, 2, "openLocalFilePreview:", e2);
            }
        }
        if (!file.exists() || file.isDirectory()) {
            return false;
        }
        FileInfo fileInfo = new FileInfo();
        fileInfo.d(str2);
        fileInfo.a(false);
        fileInfo.e(file.getPath());
        fileInfo.a(file.length());
        fileInfo.b(file.lastModified());
        FileManagerEntity a2 = FileManagerUtil.a(fileInfo);
        ForwardFileInfo forwardFileInfo = new ForwardFileInfo();
        forwardFileInfo.b(a2.nSessionId);
        forwardFileInfo.d(3);
        forwardFileInfo.b(10000);
        forwardFileInfo.a(fileInfo.d());
        forwardFileInfo.d(fileInfo.e());
        forwardFileInfo.d(fileInfo.m6343a());
        Intent intent = new Intent(context, FileBrowserActivity.class);
        intent.putExtra(FMConstants.f23516k, forwardFileInfo);
        if (a2.nFileType == 0 || a2.nFileType == 1) {
            ArrayList arrayList = new ArrayList();
            arrayList.add(fileInfo);
            FMDataCache.a(arrayList);
            intent.putExtra(FMConstants.f23527v, fileInfo.hashCode());
        }
        intent.putExtra(FMConstants.f23334L, false);
        intent.putExtra(FMConstants.f23335M, false);
        intent.putExtra("peerType", 0);
        intent.putExtra("busiType", 0);
        intent.putExtra(FMConstants.f23342T, 0);
        intent.putExtra(FMConstants.f23340R, -100);
        intent.putExtra(FMConstants.f23344V, false);
        intent.putExtra(FMConstants.f23345W, false);
        intent.putExtra(FMConstants.f23324B, 0);
        intent.putExtra(FMConstants.f23323A, 20);
        intent.putExtra("rootEntrace", false);
        intent.setFlags(e_attribute._IsFrdCommentFamousFeed);
        context.startActivity(intent);
        if (QLog.isColorLevel()) {
            QLog.d(f94004a, 2, "openLocalFilePreview:" + str + "," + str2);
        }
        return true;
    }

    public static String a(String str) {
        try {
            int lastIndexOf = str.lastIndexOf(".");
            if (lastIndexOf == -1) {
                return "";
            }
            return str.substring(lastIndexOf, str.length());
        } catch (Exception e2) {
            if (!QLog.isColorLevel()) {
                return "";
            }
            QLog.e(f94004a, 2, "getFileSuffix:", e2);
            return "";
        }
    }

    public static boolean a(TroopMemberInfo troopMemberInfo) {
        return troopMemberInfo != null && a(troopMemberInfo.level);
    }

    public static boolean a(int i2) {
        return i2 == 332 || i2 == 333 || i2 == 334 || i2 == 335;
    }

    public static void a(QQAppInterface qQAppInterface, String str, String str2, OnHomeworkTroopIdentityCheckListener onHomeworkTroopIdentityCheckListener, boolean z) {
        if (qQAppInterface == null || TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
            if (QLog.isColorLevel()) {
                StringBuilder append = new StringBuilder().append("checkIdentity error. app null: ").append(String.valueOf(qQAppInterface == null)).append(", troopUin: ");
                if (TextUtils.isEmpty(str)) {
                    str = "";
                }
                StringBuilder append2 = append.append(str).append(", memberUin: ");
                if (TextUtils.isEmpty(str2)) {
                    str2 = "";
                }
                QLog.i(f94004a, 2, append2.append(str2).toString());
                return;
            }
            return;
        }
        ((TroopManager) qQAppInterface.getManager(51)).a(str, str2, new vbh(str, str2, z, qQAppInterface, onHomeworkTroopIdentityCheckListener));
    }

    public static void b(OnHomeworkTroopIdentityCheckListener onHomeworkTroopIdentityCheckListener, boolean z) {
        if (onHomeworkTroopIdentityCheckListener != null) {
            if (Looper.myLooper() == Looper.getMainLooper()) {
                onHomeworkTroopIdentityCheckListener.a(z);
            } else {
                ThreadManager.m4817c().post(new vbi(onHomeworkTroopIdentityCheckListener, z));
            }
        }
    }

    public static final void a(Context context, String str, String str2, String str3) {
        Intent intent = new Intent(context, QQBrowserActivity.class);
        intent.putExtra(VasWebviewConstants.KEY_OPEN_PAGE_TIME, System.currentTimeMillis());
        intent.putExtra("url", String.format(f94006c, str2, str3, str));
        context.startActivity(intent);
    }
}