package com.tencent.mm.plugin.base.stub;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.ai.m;
import com.tencent.mm.bp.d;
import com.tencent.mm.model.aw;
import com.tencent.mm.model.v;
import com.tencent.mm.modelsimple.z;
import com.tencent.mm.opensdk.channel.MMessageActV2;
import com.tencent.mm.opensdk.channel.MMessageActV2$Args;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.modelmsg.WXAppExtendObject;
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;
import com.tencent.mm.opensdk.modelpay.JumpToOfflinePay.Resp;
import com.tencent.mm.plugin.base.stub.e.1;
import com.tencent.mm.pluginsdk.e;
import com.tencent.mm.pluginsdk.model.app.f;
import com.tencent.mm.pluginsdk.model.app.g;
import com.tencent.mm.pluginsdk.model.app.p;
import com.tencent.mm.pluginsdk.ui.AutoLoginActivity;
import com.tencent.mm.pluginsdk.ui.AutoLoginActivity.a;
import com.tencent.mm.protocal.protobuf.ciq;
import com.tencent.mm.protocal.protobuf.df;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.ah;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.ui.base.h;
import com.tencent.rtmp.TXLivePushConfig;
import com.tencent.ttpic.baseutils.ApiHelper$VERSION_CODES;
import java.util.LinkedList;

public class WXBizEntryActivity extends AutoLoginActivity {
    private int jDy;

    /* renamed from: com.tencent.mm.plugin.base.stub.WXBizEntryActivity$8 */
    static /* synthetic */ class AnonymousClass8 {
        static final /* synthetic */ int[] jDI = new int[a.values().length];

        static {
            AppMethodBeat.i(18147);
            try {
                jDI[a.vgJ.ordinal()] = 1;
            } catch (NoSuchFieldError e) {
            }
            try {
                jDI[a.vgL.ordinal()] = 2;
            } catch (NoSuchFieldError e2) {
            }
            try {
                jDI[a.vgK.ordinal()] = 3;
                AppMethodBeat.o(18147);
            } catch (NoSuchFieldError e3) {
                AppMethodBeat.o(18147);
            }
        }
    }

    public void onWindowFocusChanged(boolean z) {
        super.onWindowFocusChanged(z);
        AppMethodBeat.at(this, z);
    }

    public void onCreate(Bundle bundle) {
        AppMethodBeat.i(18148);
        super.onCreate(bundle);
        setTitleVisibility(0);
        AppMethodBeat.o(18148);
    }

    public final int getLayoutId() {
        return 2130968856;
    }

    public final boolean O(Intent intent) {
        return true;
    }

    public final void a(a aVar, Intent intent) {
        Uri uri = null;
        AppMethodBeat.i(18149);
        ab.i("MicroMsg.WXBizEntryActivity", "postLogin, loginResult = ".concat(String.valueOf(aVar)));
        if (getIntent() != null) {
            this.jDy = getIntent().getIntExtra("key_command_id", 0);
        }
        switch (AnonymousClass8.jDI[aVar.ordinal()]) {
            case 1:
                ab.i("MicroMsg.WXBizEntryActivity", "req type = %d", new Object[]{Integer.valueOf(this.jDy)});
                Intent intent2;
                Uri data;
                switch (this.jDy) {
                    case 7:
                    case 8:
                        intent2 = getIntent();
                        intent2.setClassName(this, "com.tencent.mm.ui.CheckCanSubscribeBizUI");
                        startActivity(intent2);
                        finish();
                        AppMethodBeat.o(18149);
                        return;
                    case 9:
                        d.c(this, "card", ".ui.CardAddEntranceUI", getIntent());
                        finish();
                        AppMethodBeat.o(18149);
                        return;
                    case 11:
                        intent2 = getIntent();
                        intent2.putExtra("device_type", 1);
                        d.c(this, "exdevice", ".ui.ExdeviceRankInfoUI", intent2);
                        finish();
                        AppMethodBeat.o(18149);
                        return;
                    case ApiHelper$VERSION_CODES.HONEYCOMB_MR1 /*12*/:
                        try {
                            uri = getIntent().getData();
                        } catch (Exception e) {
                            ab.e("MicroMsg.WXBizEntryActivity", "post login get url from intent failed : %s", new Object[]{e.getMessage()});
                        }
                        if (uri != null && e.ain(uri.toString())) {
                            v.Zp().nV("key_data_center_session_id");
                            e.a((Context) this, uri.toString(), getIntent().getIntExtra("translate_link_scene", 1), new 3(this), getIntent().getStringExtra("key_package_name"), getIntent().getStringExtra("key_package_signature"));
                            AppMethodBeat.o(18149);
                            return;
                        }
                    case ApiHelper$VERSION_CODES.HONEYCOMB_MR2 /*13*/:
                        intent2 = getIntent();
                        intent2.putExtra("key_static_from_scene", 100001);
                        d.c(this, "luckymoney", ".ui.LuckyMoneyBusiReceiveUI", intent2);
                        finish();
                        AppMethodBeat.o(18149);
                        return;
                    case ApiHelper$VERSION_CODES.ICE_CREAM_SANDWICH /*14*/:
                    case ApiHelper$VERSION_CODES.ICE_CREAM_SANDWICH_MR1 /*15*/:
                        new a(this, getIntent().getStringExtra("key_app_id"), getIntent().getStringExtra("open_id"), new 1(this)).aVi();
                        AppMethodBeat.o(18149);
                        return;
                    case ApiHelper$VERSION_CODES.JELLY_BEAN /*16*/:
                        d.c(this, "card", ".ui.CardListSelectedUI", getIntent());
                        finish();
                        AppMethodBeat.o(18149);
                        return;
                    case ApiHelper$VERSION_CODES.JELLY_BEAN_MR1 /*17*/:
                        try {
                            data = getIntent().getData();
                            2 2 = new 2(this);
                            String stringExtra = getIntent().getStringExtra("key_package_name");
                            String stringExtra2 = getIntent().getStringExtra("key_package_signature");
                            int intExtra = getIntent().getIntExtra("translate_link_scene", 1);
                            ab.d("MicroMsg.WXBizLogic", "dealWithHandleScanResult: callPackage=%s, packageSignature=%s", new Object[]{stringExtra, stringExtra2});
                            if (bo.isNullOrNil(stringExtra) || bo.isNullOrNil(stringExtra2)) {
                                ab.e("MicroMsg.WXBizLogic", "dealWithHandleScanResult:packageName or signature null");
                                AppMethodBeat.o(18149);
                                return;
                            }
                            LinkedList linkedList = new LinkedList();
                            df dfVar = new df();
                            ab.i("MicroMsg.WXBizLogic", "dealWithHandleScanResult package name = %s", new Object[]{stringExtra});
                            dfVar.kKO = stringExtra;
                            dfVar.signature = stringExtra2;
                            linkedList.add(dfVar);
                            z zVar = new z(data.toString(), intExtra, linkedList);
                            aw.Rg().a(TXLivePushConfig.DEFAULT_MAX_VIDEO_BITRATE, new 1(this, 2));
                            aw.Rg().a(zVar, 0);
                            AppMethodBeat.o(18149);
                            return;
                        } catch (Exception e2) {
                            ab.e("MicroMsg.WXBizEntryActivity", "get url from intent failed : %s", new Object[]{e2.getMessage()});
                            AppMethodBeat.o(18149);
                            return;
                        }
                    case ApiHelper$VERSION_CODES.KITKAT /*19*/:
                        try {
                            uri = getIntent().getData();
                        } catch (Exception e22) {
                            ab.e("MicroMsg.WXBizEntryActivity", "get data from intent for launch wxminiprogram failed : %s", new Object[]{e22.getMessage()});
                        }
                        if (uri != null) {
                            final String queryParameter = uri.getQueryParameter("invokeData");
                            e.a((Context) this, uri.toString(), getIntent().getIntExtra("translate_link_scene", 1), new e.a() {
                                public final void a(int i, int i2, String str, m mVar, boolean z) {
                                    AppMethodBeat.i(18142);
                                    ab.i("MicroMsg.WXBizEntryActivity", "launchWXMiniprogram, DeepLinkHelper.DeepLinkCallback, %d, %d, %s, %b", new Object[]{Integer.valueOf(i), Integer.valueOf(i2), str, Boolean.valueOf(z)});
                                    if (mVar == null || i == 0 || i2 == 0 || !(mVar instanceof z)) {
                                        WXBizEntryActivity.this.finish();
                                        AppMethodBeat.o(18142);
                                        return;
                                    }
                                    ciq ajE = ((z) mVar).ajE();
                                    if (ajE == null || WXBizEntryActivity.this.isFinishing()) {
                                        WXBizEntryActivity.this.finish();
                                        AppMethodBeat.o(18142);
                                        return;
                                    }
                                    h.a(WXBizEntryActivity.this, bo.nullAsNil(ajE.xhy), WXBizEntryActivity.this.getString(2131297061), WXBizEntryActivity.this.getString(2131296994), false, new 1(this, ajE));
                                    AppMethodBeat.o(18142);
                                }
                            }, getIntent().getStringExtra("key_package_name"), getIntent().getStringExtra("key_package_signature"));
                            AppMethodBeat.o(18149);
                            return;
                        }
                        break;
                    case ApiHelper$VERSION_CODES.NOUGAT /*24*/:
                        try {
                            data = getIntent().getData();
                        } catch (Exception e222) {
                            ab.e("MicroMsg.WXBizEntryActivity", "get data from intent for offline pay failed : %s", new Object[]{e222.getMessage()});
                            data = uri;
                        }
                        if (data != null) {
                            e.a((Context) this, data.toString(), getIntent().getIntExtra("translate_link_scene", 1), new 7(this), getIntent().getStringExtra("key_package_name"), getIntent().getStringExtra("key_package_signature"));
                            AppMethodBeat.o(18149);
                            return;
                        }
                        break;
                    case 25:
                        try {
                            uri = getIntent().getData();
                        } catch (Exception e2222) {
                            ab.e("MicroMsg.WXBizEntryActivity", "post login get url from intent failed : %s", new Object[]{e2222.getMessage()});
                        }
                        if (uri != null && e.aio(uri.toString())) {
                            v.Zp().nV("key_data_center_session_id");
                            e.a((Context) this, uri.toString(), getIntent().getIntExtra("translate_link_scene", 1), new 4(this), getIntent().getStringExtra("key_package_name"), getIntent().getStringExtra("key_package_signature"));
                            AppMethodBeat.o(18149);
                            return;
                        }
                    case ApiHelper$VERSION_CODES.O /*26*/:
                        try {
                            uri = getIntent().getData();
                        } catch (Exception e22222) {
                            ab.e("MicroMsg.WXBizEntryActivity", "get data from intent for launch fake native miniprogram failed : %s", new Object[]{e22222.getMessage()});
                        }
                        if (uri != null) {
                            e.a((Context) this, uri.toString(), getIntent().getIntExtra("translate_link_scene", 1), new 6(this), getIntent().getStringExtra("key_package_name"), getIntent().getStringExtra("key_package_signature"));
                            AppMethodBeat.o(18149);
                            return;
                        }
                        break;
                    default:
                        finish();
                        break;
                }
                AppMethodBeat.o(18149);
                return;
            case 2:
            case 3:
                ab.e("MicroMsg.WXBizEntryActivity", "postLogin fail, loginResult = ".concat(String.valueOf(aVar)));
                break;
            default:
                ab.e("MicroMsg.WXBizEntryActivity", "postLogin, unknown login result = ".concat(String.valueOf(aVar)));
                break;
        }
        finish();
        AppMethodBeat.o(18149);
    }

    private static void a(Bundle bundle, BaseResp baseResp, f fVar) {
        AppMethodBeat.i(18150);
        baseResp.toBundle(bundle);
        MMessageActV2$Args mMessageActV2$Args = new MMessageActV2$Args();
        mMessageActV2$Args.targetPkgName = fVar.field_packageName;
        mMessageActV2$Args.bundle = bundle;
        p.at(bundle);
        p.au(bundle);
        MMessageActV2.send(ah.getContext(), mMessageActV2$Args);
        AppMethodBeat.o(18150);
    }

    private static void dc(String str, String str2) {
        AppMethodBeat.i(18151);
        f bT = g.bT(str, true);
        if (bT == null) {
            AppMethodBeat.o(18151);
            return;
        }
        WXAppExtendObject wXAppExtendObject = new WXAppExtendObject();
        wXAppExtendObject.extInfo = str2;
        WXMediaMessage wXMediaMessage = new WXMediaMessage(wXAppExtendObject);
        wXMediaMessage.sdkVer = 620954368;
        wXMediaMessage.messageExt = str2;
        g.a(ah.getContext(), bT.field_appId, wXMediaMessage, 2, null, null);
        AppMethodBeat.o(18151);
    }

    static /* synthetic */ void a(WXBizEntryActivity wXBizEntryActivity) {
        AppMethodBeat.i(18152);
        try {
            Uri data = wXBizEntryActivity.getIntent().getData();
            int i = bo.getInt(data.getQueryParameter("type"), 0);
            dc(bo.nullAsNil(data.getQueryParameter("appid")), String.format("%s://opentypewebview?wx_internal_resptype=%d&ret=%d", new Object[]{bo.nullAsNil(data.getQueryParameter("appid")), Integer.valueOf(i), Integer.valueOf(-3)}));
            AppMethodBeat.o(18152);
        } catch (Exception e) {
            ab.e("MicroMsg.WXBizEntryActivity", "launchOpenTypeWebView get url from intent failed : %s", new Object[]{e.getMessage()});
            AppMethodBeat.o(18152);
        }
    }

    static /* synthetic */ void b(WXBizEntryActivity wXBizEntryActivity) {
        AppMethodBeat.i(18153);
        try {
            Uri data = wXBizEntryActivity.getIntent().getData();
            int i = bo.getInt(data.getQueryParameter("type"), 0);
            dc(bo.nullAsNil(data.getQueryParameter("appid")), String.format("%s://openbusinesswebview?type=%d&ret=%d", new Object[]{bo.nullAsNil(data.getQueryParameter("appid")), Integer.valueOf(i), Integer.valueOf(-3)}));
            AppMethodBeat.o(18153);
        } catch (Exception e) {
            ab.e("MicroMsg.WXBizEntryActivity", "launchOpenTypeWebView get url from intent failed : %s", new Object[]{e.getMessage()});
            AppMethodBeat.o(18153);
        }
    }

    static /* synthetic */ void c(WXBizEntryActivity wXBizEntryActivity) {
        AppMethodBeat.i(18156);
        ab.i("MicroMsg.WXBizEntryActivity", "offlinePayBackToApp: %s", new Object[]{wXBizEntryActivity.getIntent().getStringExtra("key_app_id")});
        f bT = g.bT(r0, true);
        if (bT == null) {
            ab.w("MicroMsg.WXBizEntryActivity", "can not find app info");
            AppMethodBeat.o(18156);
            return;
        }
        Bundle bundle = new Bundle();
        BaseResp resp = new Resp();
        resp.errCode = -3;
        a(bundle, resp, bT);
        AppMethodBeat.o(18156);
    }
}
