package com.tencent.mm.plugin.offline.ui;

import android.app.Activity;
import android.os.Vibrator;
import android.text.TextUtils;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.ai.m;
import com.tencent.mm.plugin.offline.a.e;
import com.tencent.mm.plugin.offline.a.s.b;
import com.tencent.mm.plugin.offline.c.a;
import com.tencent.mm.plugin.offline.k;
import com.tencent.mm.plugin.report.service.h;
import com.tencent.mm.plugin.wallet_core.model.r;
import com.tencent.mm.plugin.wallet_core.ui.q;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.wallet_core.ui.WalletBaseUI;
import com.tencent.ytcommon.BuildConfig;
import org.xwalk.core.XWalkFeature;

public final class c {
    Vibrator kgA;
    Activity mActivity;
    a oZn;
    q oZo;
    float oZp = 0.0f;
    int oZq = 20000;

    public c(Activity activity, a aVar) {
        this.mActivity = activity;
        this.oZn = aVar;
    }

    public final void init() {
        AppMethodBeat.i(43488);
        this.kgA = (Vibrator) this.mActivity.getSystemService("vibrator");
        AppMethodBeat.o(43488);
    }

    public final void a(m mVar, int i, String str) {
        AppMethodBeat.i(43489);
        a(mVar, i, str, null);
        AppMethodBeat.o(43489);
    }

    public final void a(m mVar, int i, String str, String str2) {
        AppMethodBeat.i(43490);
        ab.i("MicroMsg.OfflineLogicMgr", "handleErrorEvent errCode :" + i + " msg:" + str);
        bXv();
        if (i == 409) {
            Ub(str);
            AppMethodBeat.o(43490);
        } else if (i == 410) {
            Ua(str);
            AppMethodBeat.o(43490);
        } else if (i == 413) {
            Uc(str);
            AppMethodBeat.o(43490);
        } else if (i == 411) {
            if (r.cPI().cQi() || r.cPI().cQh()) {
                ab.i("MicroMsg.OfflineLogicMgr", "is unreg or simplereg");
                AppMethodBeat.o(43490);
                return;
            }
            if (k.oXK && (this.mActivity instanceof WalletOfflineCoinPurseUI)) {
                ((WalletOfflineCoinPurseUI) this.mActivity).bXT();
            } else {
                a.c(this.mActivity, str);
            }
            h.pYm.a(135, 1, 1, true);
            AppMethodBeat.o(43490);
        } else if (this.mActivity instanceof WalletBaseUI) {
            if (!com.tencent.mm.wallet_core.d.h.a((WalletBaseUI) this.mActivity, mVar, XWalkFeature.INTERFACE_GEO_LOCATION_PERMISSION, i, str)) {
                b.c(this.mActivity, str, str2);
            }
            AppMethodBeat.o(43490);
        } else {
            b.b(this.mActivity, str);
            AppMethodBeat.o(43490);
        }
    }

    public final boolean c(int i, int i2, String str, m mVar) {
        boolean z = false;
        AppMethodBeat.i(43491);
        ab.i("MicroMsg.OfflineLogicMgr", "errType:" + i + "  errCode" + i2 + " errMsg:" + str + " cgi type:" + mVar.getType());
        e eVar;
        if (i == 0 && i2 == 0) {
            if (mVar instanceof e) {
                eVar = (e) mVar;
                String str2 = eVar.oXY;
                bXv();
                if (eVar.oXZ != 0 || TextUtils.isEmpty(str2)) {
                    if (!(eVar.oXZ == 0 || eVar.kCl == 0 || eVar.oYb != 1)) {
                        ab.i("MicroMsg.OfflineLogicMgr", "input pwd, but respon exist error!");
                        a(eVar, eVar.oXZ, eVar.oYa);
                    }
                    z = true;
                } else {
                    a.a(this.mActivity, str2, mVar);
                    this.mActivity.setResult(-1);
                    this.mActivity.finish();
                    z = true;
                }
            }
        } else if (mVar instanceof e) {
            eVar = (e) mVar;
            bXv();
            if (eVar.oYb == 1) {
                ab.i("MicroMsg.OfflineLogicMgr", "input pwd, but respon exist error!");
                a(mVar, i2, str);
            }
            z = true;
        }
        AppMethodBeat.o(43491);
        return z;
    }

    public final void bXv() {
        AppMethodBeat.i(43492);
        if (this.oZo != null) {
            this.oZo.dismiss();
            this.oZo = null;
        }
        AppMethodBeat.o(43492);
    }

    private void Ua(String str) {
        AppMethodBeat.i(43493);
        ab.i("MicroMsg.OfflineLogicMgr", "showBindNewBankcardDialog msg:".concat(String.valueOf(str)));
        com.tencent.mm.ui.base.h.d(this.mActivity, str, BuildConfig.FLAVOR, getString(2131305157), getString(2131296868), new 16(this), new 17(this));
        AppMethodBeat.o(43493);
    }

    private void Ub(String str) {
        AppMethodBeat.i(43494);
        ab.i("MicroMsg.OfflineLogicMgr", "goLimitChangeUI msg:".concat(String.valueOf(str)));
        com.tencent.mm.ui.base.h.d(this.mActivity, str, BuildConfig.FLAVOR, getString(2131305459), getString(2131296868), new 18(this), new 2(this));
        AppMethodBeat.o(43494);
    }

    private void Uc(String str) {
        AppMethodBeat.i(43495);
        ab.i("MicroMsg.OfflineLogicMgr", "goChangeBankcard msg:".concat(String.valueOf(str)));
        com.tencent.mm.ui.base.h.d(this.mActivity, str, BuildConfig.FLAVOR, getString(2131305435), getString(2131296868), new 3(this), new 4(this));
        AppMethodBeat.o(43495);
    }

    public final void a(b bVar) {
        AppMethodBeat.i(43496);
        if (bVar == null) {
            AppMethodBeat.o(43496);
            return;
        }
        ab.i("MicroMsg.OfflineLogicMgr", "showFreeMsg");
        if ("1".equals(bVar.oYP)) {
            com.tencent.mm.ui.base.h.a(this.mActivity, false, bVar.oYR, BuildConfig.FLAVOR, getString(2131305449), getString(2131296868), new 5(this), new 6(this));
        }
        AppMethodBeat.o(43496);
    }

    public static boolean bXw() {
        AppMethodBeat.i(43497);
        k.bXg();
        if (k.bXh().oYL != null) {
            AppMethodBeat.o(43497);
            return true;
        }
        AppMethodBeat.o(43497);
        return false;
    }

    /* Access modifiers changed, original: final */
    public final String getString(int i) {
        AppMethodBeat.i(43498);
        String string = this.mActivity.getString(i);
        AppMethodBeat.o(43498);
        return string;
    }
}
