package com.tencent.mm.plugin.appbrand.compat;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import com.google.android.gms.common.util.CrashUtils.ErrorDialogData;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.af.j;
import com.tencent.mm.ai.w;
import com.tencent.mm.kernel.g;
import com.tencent.mm.modelappbrand.b;
import com.tencent.mm.plugin.appbrand.compat.a.a$a;
import com.tencent.mm.plugin.appbrand.r.r;
import com.tencent.mm.plugin.appbrand.ui.AppBrandNearbyWebViewUI;
import com.tencent.mm.plugin.appbrand.ui.AppBrandSearchUI;
import com.tencent.mm.pluginsdk.model.app.l;
import com.tencent.mm.protocal.GeneralControlWrapper;
import com.tencent.mm.protocal.JsapiPermissionWrapper;
import com.tencent.mm.protocal.protobuf.aqt;
import com.tencent.mm.protocal.protobuf.aqu;
import com.tencent.ytcommon.BuildConfig;
import java.util.Map;

final class a implements com.tencent.mm.plugin.appbrand.compat.a.a {
    a() {
    }

    public final void T(Context context, String str) {
        AppMethodBeat.i(17016);
        Intent putExtra = new Intent(context, AppBrandNearbyWebViewUI.class).putExtra("rawUrl", str);
        putExtra.putExtra("title", context.getString(2131296727));
        if (!(context instanceof Activity)) {
            putExtra.addFlags(ErrorDialogData.BINDER_CRASH);
        }
        if (context instanceof Activity) {
            ((Activity) context).startActivityForResult(putExtra, 3);
            AppMethodBeat.o(17016);
            return;
        }
        context.startActivity(putExtra);
        AppMethodBeat.o(17016);
    }

    public final void U(Context context, String str) {
        AppMethodBeat.i(17017);
        Intent putExtra = new Intent(context, AppBrandNearbyWebViewUI.class).putExtra("rawUrl", str);
        putExtra.putExtra("title", context.getString(2131296697));
        if (!(context instanceof Activity)) {
            putExtra.addFlags(ErrorDialogData.BINDER_CRASH);
        }
        if (context instanceof Activity) {
            ((Activity) context).startActivityForResult(putExtra, 4);
            AppMethodBeat.o(17017);
            return;
        }
        context.startActivity(putExtra);
        AppMethodBeat.o(17017);
    }

    public final Intent D(Context context, int i) {
        String str;
        AppMethodBeat.i(17018);
        Intent intent = new Intent();
        intent.putExtra("hardcode_jspermission", JsapiPermissionWrapper.vxI);
        intent.putExtra("hardcode_general_ctrl", GeneralControlWrapper.vxE);
        intent.putExtra("neverGetA8Key", true);
        intent.setClass(context, AppBrandSearchUI.class);
        intent.putExtra("key_trust_url", true);
        intent.putExtra("title", context.getString(2131296635));
        intent.putExtra("searchbar_tips", context.getString(2131296635));
        intent.putExtra("KRightBtn", true);
        intent.putExtra("ftsneedkeyboard", true);
        intent.putExtra("ftsType", 64);
        intent.putExtra("ftsbizscene", i);
        Map d = r.d(i, true, 64);
        String abv = b.abv();
        d.put("WASessionId", abv);
        d.put("sessionId", abv);
        d.put("subSessionId", abv);
        intent.putExtra("rawUrl", r.E(d));
        intent.putExtra("key_load_js_without_delay", true);
        intent.addFlags(67108864);
        intent.putExtra("key_session_id", abv);
        intent.putExtra("sessionId", abv);
        intent.putExtra("subSessionId", abv);
        abv = "key_search_input_hint";
        Object obj = g.RP().Ry().get(com.tencent.mm.storage.ac.a.xQg, null);
        if (obj == null || !(obj instanceof String)) {
            str = BuildConfig.FLAVOR;
        } else {
            str = (String) obj;
        }
        intent.putExtra(abv, str);
        intent.putExtra("key_alpha_in", !(context instanceof Activity));
        intent.putExtra("key_preload_biz", 5);
        AppMethodBeat.o(17018);
        return intent;
    }

    public final void a(j.b bVar, String str, String str2, String str3, byte[] bArr) {
        AppMethodBeat.i(17019);
        l.a(bVar, str, str2, str3, null, bArr);
        AppMethodBeat.o(17019);
    }

    public final void a(a$a a_a) {
        AppMethodBeat.i(17020);
        com.tencent.mm.ai.b.a aVar = new com.tencent.mm.ai.b.a();
        aVar.fsJ = new aqt();
        aVar.fsK = new aqu();
        aVar.uri = "/cgi-bin/mmoc-bin/hardware/getwerunuserstate";
        aVar.fsI = 1926;
        aVar.fsL = 0;
        aVar.fsM = 0;
        w.a(aVar.acD(), new 1(this, a_a), true);
        AppMethodBeat.o(17020);
    }
}
