package com.tencent.mm.plugin.webview.ui.tools.jsapi;

import android.content.Intent;
import android.widget.Toast;
import com.google.android.gms.common.util.CrashUtils.ErrorDialogData;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.ah.b;
import com.tencent.mm.ah.o;
import com.tencent.mm.kernel.g;
import com.tencent.mm.model.ao$b.a;
import com.tencent.mm.plugin.messenger.foundation.a.j;
import com.tencent.mm.plugin.report.service.h;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.ah;
import com.tencent.mm.storage.ad;

class g$92 implements a {
    final /* synthetic */ g uHd;
    final /* synthetic */ Intent val$intent;

    g$92(g gVar, Intent intent) {
        this.uHd = gVar;
        this.val$intent = intent;
    }

    public final void o(String str, boolean z) {
        AppMethodBeat.i(9158);
        g.l(this.uHd);
        if (g.i(this.uHd) == null) {
            ab.w("MicroMsg.MsgHandler", "getNow callback, msghandler has already been detached!");
            g.a(this.uHd, g.j(this.uHd), "profile:fail", null);
            AppMethodBeat.o(9158);
            return;
        }
        com.tencent.mm.n.a aoK;
        if (g.m(this.uHd) != null) {
            g.m(this.uHd).dismiss();
        }
        ad aoO = ((j) g.K(j.class)).XM().aoO(str);
        if (aoO == null || ((int) aoO.ewQ) <= 0) {
            aoK = ((j) g.K(j.class)).XM().aoK(str);
        } else {
            aoK = aoO;
        }
        if (aoK == null || ((int) aoK.ewQ) <= 0) {
            z = false;
        } else {
            str = aoK.field_username;
        }
        if (z) {
            b.U(str, 3);
            o.acv().pZ(str);
            this.val$intent.addFlags(ErrorDialogData.BINDER_CRASH);
            this.val$intent.putExtra("Contact_User", str);
            if (aoK.dsf()) {
                int i;
                if (g.n(this.uHd) == null) {
                    i = 42;
                } else {
                    i = g.n(this.uHd).getInt("Contact_Scene", 42);
                }
                h.pYm.X(10298, aoK.field_username + "," + i);
                this.val$intent.putExtra("Contact_Scene", i);
            }
            g.a(this.uHd, this.val$intent);
            g.a(this.uHd, g.j(this.uHd), "profile:ok", null);
            AppMethodBeat.o(9158);
            return;
        }
        Toast.makeText(ah.getContext(), g.i(this.uHd).getString(2131299997, new Object[]{Integer.valueOf(3), Integer.valueOf(-1)}), 0).show();
        g.a(this.uHd, g.j(this.uHd), "profile:fail", null);
        AppMethodBeat.o(9158);
    }
}
