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

import android.content.Intent;
import android.webkit.ConsoleMessage;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.kernel.g;
import com.tencent.mm.plugin.messenger.foundation.a.j;
import com.tencent.mm.pluginsdk.ui.tools.u;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.storage.bi;
import com.tencent.xweb.l;
import com.tencent.ytcommon.BuildConfig;
import java.net.URLDecoder;

class ComposeUI$a extends l {
    final /* synthetic */ ComposeUI pwY;

    private ComposeUI$a(ComposeUI composeUI) {
        this.pwY = composeUI;
    }

    /* synthetic */ ComposeUI$a(ComposeUI composeUI, byte b) {
        this(composeUI);
    }

    @Deprecated
    public final boolean onConsoleMessage(ConsoleMessage consoleMessage) {
        AppMethodBeat.i(68207);
        ab.i("MicroMsg.ComposeUI", "console, consoleMessage: %s", new Object[]{consoleMessage});
        String akn = u.akn(consoleMessage != null ? consoleMessage.message() : null);
        String[] split;
        if (akn.startsWith(ComposeUI.m(this.pwY))) {
            this.pwY.aqX();
            try {
                String[] split2 = URLDecoder.decode(akn.substring(ComposeUI.m(this.pwY).length()), "utf-8").split("@@")[0].split(":");
                String str = split2[0];
                String str2 = split2[1];
                ab.i("MicroMsg.ComposeUI", "img onclick, src: %s, msgLocalId: %s, msgSvrId: %s", new Object[]{split[1], str, str2});
                bi jf = ((j) g.K(j.class)).bOr().jf((long) Integer.valueOf(str).intValue());
                Intent intent = new Intent(this.pwY, MailImageDownloadUI.class);
                intent.putExtra("img_msg_id", jf.field_msgId);
                intent.putExtra("img_server_id", jf.field_msgSvrId);
                intent.putExtra("img_download_compress_type", 0);
                intent.putExtra("img_download_username", jf.field_talker);
                this.pwY.startActivity(intent);
                AppMethodBeat.o(68207);
                return true;
            } catch (Exception e) {
                ab.w("MicroMsg.ComposeUI", "consoleMessage IMG_ONCLICK, ex = %s", new Object[]{e.getMessage()});
            }
        } else if (akn.startsWith(ComposeUI.n(this.pwY))) {
            try {
                ComposeUI.a(this.pwY, URLDecoder.decode(akn.substring(ComposeUI.n(this.pwY).length()), "utf-8"));
            } catch (Exception e2) {
                ab.w("MicroMsg.ComposeUI", "consoleMessage GET_MAIL_CONTENT, ex = %s", new Object[]{e2.getMessage()});
            }
            if (ComposeUI.o(this.pwY)) {
                if (ComposeUI.p(this.pwY).indexOf("<img") == -1) {
                    ComposeUI.q(this.pwY).clear();
                    ComposeUI.r(this.pwY);
                    AppMethodBeat.o(68207);
                    return true;
                }
                u.a(ComposeUI.s(this.pwY), ComposeUI.t(this.pwY), ComposeUI.u(this.pwY));
            }
            AppMethodBeat.o(68207);
            return true;
        } else {
            if (akn.startsWith(ComposeUI.t(this.pwY))) {
                ComposeUI.q(this.pwY).clear();
                try {
                    String[] split3 = URLDecoder.decode(akn.substring(ComposeUI.t(this.pwY).length()), "utf-8").split("&&");
                    for (String akn2 : split3) {
                        split = akn2.split("@@");
                        Object obj = split[0].split(":")[1];
                        Object obj2 = split[1];
                        if (obj2.startsWith("file://")) {
                            obj2 = obj2.replaceFirst("file://", BuildConfig.FLAVOR);
                        }
                        ab.i("MicroMsg.ComposeUI", "put msgImgInfoMap, msgSvrId: %s, path: %s", new Object[]{obj, obj2});
                        ComposeUI.q(this.pwY).put(obj, obj2);
                    }
                    if (ComposeUI.o(this.pwY)) {
                        ComposeUI.r(this.pwY);
                    }
                    AppMethodBeat.o(68207);
                    return true;
                } catch (Exception e22) {
                    ab.w("MicroMsg.ComposeUI", "consoleMessage GET_IMG_INFO, ex = %s", new Object[]{e22.getMessage()});
                    AppMethodBeat.o(68207);
                    return true;
                }
            }
            boolean onConsoleMessage = super.onConsoleMessage(consoleMessage);
            AppMethodBeat.o(68207);
            return onConsoleMessage;
        }
    }
}
