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

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


package com.tencent.mobileqq.loginwelcome;

import SecurityAccountServer.RecommendedContactInfo;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import android.text.TextUtils;
import com.tencent.biz.pubaccount.util.PublicAccountUtil;
import com.tencent.biz.webviewplugin.NewerGuidePlugin;
import com.tencent.mobileqq.activity.RegisterQQNumberActivity;
import com.tencent.mobileqq.activity.phone.BindNumberActivity;
import com.tencent.mobileqq.app.BaseActivity;
import com.tencent.mobileqq.app.BusinessObserver;
import com.tencent.mobileqq.app.FriendListHandler;
import com.tencent.mobileqq.app.PhoneContactManagerImp;
import com.tencent.mobileqq.app.QQAppInterface;
import com.tencent.mobileqq.app.QQHeadDownloadHandler;
import com.tencent.mobileqq.app.TroopHandler;
import com.tencent.mobileqq.app.TroopObserver;
import com.tencent.mobileqq.emosm.web.MessengerService;
import com.tencent.mobileqq.model.PhoneContactManager;
import com.tencent.mobileqq.msf.sdk.MsfSdkUtils;
import com.tencent.mobileqq.phonecontact.BindMsgConstant;
import com.tencent.mobileqq.phonecontact.ContactBindServlet;
import com.tencent.mobileqq.statistics.ReportController;
import com.tencent.qphone.base.util.QLog;
import java.util.Iterator;
import java.util.List;
import mqq.app.NewIntent;
import mqq.manager.Manager;
import mqq.util.WeakReference;
import org.json.JSONArray;
import tencent.im.oidb.cmd0x59f.oidb_0x59f;
public class LoginWelcomeManager implements BusinessObserver, PhoneContactManager.IPhoneContactListener, Runnable, Manager {
    public static final int f90097a = 1;
    static long f24646a = 0;
    public static final String f24647a = "NewerGuide";
    public static final int f90098b = 0;
    public static final String f24648b = "loginwelcome_";
    public static final int f90099c = 1;
    public static final String f24649c = "first_login";
    public static final int d = 2;
    public static final String f24650d = "http://ti.qq.com/newguide/index.html?_wv=16777217&bind=%s&appid=%d";
    public Bundle f24651a;
    public QQAppInterface f24654a;
    LoginWelcomeHandler f24656a;
    WeakReference f24657a;
    public boolean f24658a;
    Bundle f24659b;
    boolean f24660b;
    public String f24661e;
    TroopObserver f24655a = new sfr(this);
    PhoneContactManagerImp f24653a = null;
    Handler f24652a = new Handler(Looper.getMainLooper());
    int e = 0;

    public static LoginWelcomeManager a(QQAppInterface qQAppInterface) {
        return (LoginWelcomeManager) qQAppInterface.getManager(145);
    }

    public LoginWelcomeManager(QQAppInterface qQAppInterface) {
        if (QLog.isColorLevel()) {
            QLog.d(f24647a, 2, "LoginWelcomeManager newinstance");
        }
        this.f24654a = qQAppInterface;
        this.f24656a = (LoginWelcomeHandler) qQAppInterface.getBusinessHandler(84);
    }

    public void a() {
        SharedPreferences sharedPreferences = this.f24654a.getApplication().getSharedPreferences(f24648b + this.f24654a.m4704d(), 0);
        int i = sharedPreferences.getInt(f24649c, 0);
        if (i != 1) {
            this.f24654a.addObserver(this, true);
            this.f24656a.a();
            sharedPreferences.edit().putInt(f24649c, 1).commit();
        }
        if (QLog.isColorLevel()) {
            QLog.d(f24647a, 2, "requestIsFirstLogin : " + i);
        }
    }

    @Override
    public void a(int i, boolean z, Object obj) {
        boolean z2;
        oidb_0x59f.ContactBindInfo contactBindInfo;
        if (i == 558) {
            if (z && obj != null && (obj instanceof Object[])) {
                Object[] objArr = (Object[]) obj;
                if (objArr.length == 2) {
                    if (objArr[0] != null && (objArr[0] instanceof String)) {
                        this.f24661e = (String) objArr[0];
                    }
                    if (objArr[1] == null || !(objArr[1] instanceof oidb_0x59f.ContactBindInfo) || (contactBindInfo = (oidb_0x59f.ContactBindInfo) objArr[1]) == null || !contactBindInfo.mobile.has() || TextUtils.isEmpty(contactBindInfo.mobile.get())) {
                        z2 = false;
                    } else {
                        ReportController.b(this.f24654a, "dc01331", "", "", "0X8006E3A", "0X8006E3A", 0, 0, "", "", "", "");
                        z2 = true;
                    }
                    if (QLog.isColorLevel()) {
                        QLog.d(f24647a, 2, "onUpdate number: " + this.f24661e + " bind " + z2);
                    }
                    this.f24658a = true;
                    a(z2);
                }
            }
            this.f24654a.removeObserver(this);
        }
    }

    @Override
    public void onDestroy() {
    }

    public void a(MessengerService messengerService, Bundle bundle) {
        if (this.f24657a == null) {
            this.f24657a = new WeakReference(messengerService);
        }
        Bundle bundle2 = bundle.getBundle("request");
        String string = bundle2.getString("key_action");
        if (QLog.isColorLevel()) {
            QLog.d(f24647a, 2, "handleWebRequest " + string);
        }
        if (string.equals(NewerGuidePlugin.f6679b)) {
            this.f24659b = bundle;
            c();
        } else if (this.f24651a != null) {
            if (QLog.isColorLevel()) {
                QLog.d(f24647a, 2, "invalid");
            }
        } else {
            this.f24651a = bundle;
            if (string.equals(NewerGuidePlugin.f6683f)) {
                c(bundle2);
            } else if (string.equals(NewerGuidePlugin.f6682e)) {
                b(bundle2);
            } else if (string.equals(NewerGuidePlugin.f6684g)) {
                a(bundle2);
            }
        }
    }

    public void b() {
        MessengerService messengerService = (MessengerService) this.f24657a.get();
        if (messengerService != null) {
            messengerService.a(this.f24651a);
            this.f24651a = null;
        } else if (QLog.isColorLevel()) {
            QLog.d(f24647a, 2, "no service");
        }
    }

    public void a(Bundle bundle) {
    }

    public void b(Bundle bundle) {
        String string = bundle.getString("uin");
        TroopHandler troopHandler = (TroopHandler) this.f24654a.getBusinessHandler(20);
        if (troopHandler != null) {
            try {
                this.f24654a.addObserver(this.f24655a);
                troopHandler.a(Long.parseLong(string), 8390784);
            } catch (Exception e) {
                if (QLog.isColorLevel()) {
                    QLog.d(f24647a, 2, "joinTroop err", e);
                }
            }
        }
    }

    public void c(Bundle bundle) {
        PublicAccountUtil.a(this.f24654a, this.f24654a.getApp(), bundle.getString("uin"), new sfs(this, bundle));
    }

    public void c() {
        f24646a = SystemClock.uptimeMillis();
        if (this.f24653a == null) {
            this.f24653a = (PhoneContactManagerImp) this.f24654a.getManager(10);
        }
        this.f24653a.a(this);
        this.f24653a.i();
    }

    @Override
    public void b(int i) {
        if (QLog.isColorLevel()) {
            QLog.d(f24647a, 2, "onBindStateChanged" + i);
        }
        if (i != 5) {
            if (QLog.isColorLevel()) {
                QLog.d(f24647a, 2, "upload end");
                QLog.d(f24647a, 2, "cost " + (SystemClock.uptimeMillis() - f24646a));
            }
            if (this.f24653a != null) {
                this.f24653a.b(this);
                this.f24653a = null;
                if (i == 6) {
                    d();
                } else {
                    a((List) null);
                }
            }
        }
    }

    @Override
    public void c(int i) {
        if (this.f24653a != null && this.f24653a.f87428c >= 2) {
            if (QLog.isColorLevel()) {
                QLog.d(f24647a, 2, "onUpdateMatchProgress >4");
                QLog.d(f24647a, 2, "cost " + (SystemClock.uptimeMillis() - f24646a));
            }
            d();
            this.f24653a.b(this);
            this.f24653a = null;
        }
    }

    @Override
    public void d(int i) {
    }

    @Override
    public void a(boolean z, int i) {
    }

    @Override
    public void a(long j) {
    }

    public void d() {
        Bundle bundle = this.f24659b.getBundle("request");
        NewIntent newIntent = new NewIntent(this.f24654a.getApplication(), ContactBindServlet.class);
        newIntent.putExtra("req_type", 36);
        newIntent.putExtra(BindMsgConstant.f25990j, ((PhoneContactManagerImp) this.f24654a.getManager(10)).m4525a());
        int i = bundle.getInt(NewerGuidePlugin.t);
        if (i <= 0) {
            i = 21;
        }
        newIntent.putExtra(NewerGuidePlugin.t, i);
        this.f24654a.startServlet(newIntent);
        if (QLog.isColorLevel()) {
            QLog.d(f24647a, 2, "realGetRecommendedList " + i);
        }
    }

    public void a(List list) {
        Bundle bundle = this.f24659b.getBundle("request");
        if (list == null) {
            bundle.putString(NewerGuidePlugin.p, "");
        } else {
            QQHeadDownloadHandler a2 = ((FriendListHandler) this.f24654a.getBusinessHandler(1)).a();
            JSONArray jSONArray = new JSONArray();
            Iterator it = list.iterator();
            while (it.hasNext()) {
                RecommendedContactInfo recommendedContactInfo = (RecommendedContactInfo) it.next();
                recommendedContactInfo.url = MsfSdkUtils.insertMtype("QQHeadIcon", recommendedContactInfo.faceUrl + a2.a((byte) recommendedContactInfo.faceFlag)) + "&t=" + System.currentTimeMillis();
                jSONArray.put(recommendedContactInfo.toJson());
            }
            bundle.putString(NewerGuidePlugin.p, jSONArray.toString());
        }
        if (QLog.isColorLevel()) {
            QLog.d(f24647a, 2, "resp Recommended " + (list == null ? 0 : list.size()));
        }
        MessengerService messengerService = (MessengerService) this.f24657a.get();
        if (messengerService != null) {
            messengerService.a(this.f24659b);
        } else if (QLog.isColorLevel()) {
            QLog.d(f24647a, 2, "no service");
        }
    }

    private void a(boolean z) {
        this.f24660b = z;
        run();
    }

    @Override
    public void run() {
        boolean z;
        try {
            int i = this.e + 1;
            this.e = i;
            if (i > 10) {
                QLog.d(f24647a, 1, "retry max");
                return;
            }
            BaseActivity baseActivity = BaseActivity.sTopActivity;
            if (baseActivity != null) {
                if (baseActivity instanceof RegisterQQNumberActivity) {
                    this.f24652a.postDelayed(this, 200L);
                    return;
                }
                if (QLog.isColorLevel()) {
                    QLog.d(f24647a, 2, "real start guide " + this.f24660b);
                }
                this.f24653a = (PhoneContactManagerImp) this.f24654a.getManager(10);
                if (!this.f24653a.m4548d()) {
                    if (QLog.isColorLevel()) {
                        QLog.d(f24647a, 2, "no permission");
                    }
                    z = false;
                } else if (this.f24660b) {
                    z = true;
                } else {
                    Intent intent = new Intent(baseActivity, BindNumberActivity.class);
                    intent.putExtra(BindMsgConstant.W, 10);
                    baseActivity.startActivity(intent);
                    ReportController.b(this.f24654a, "dc01331", "", "", "0X8006E3B", "0X8006E3B", 0, 0, "", "", "", "");
                    z = true;
                }
                String str = z ? "0X8006E38" : "0X8006E39";
                ReportController.b(this.f24654a, "dc01331", "", "", str, str, 0, 0, "", "", "", "");
            }
        } catch (Exception e) {
            if (QLog.isColorLevel()) {
                QLog.d(f24647a, 2, e, new Object[0]);
            }
        }
    }
}