导航菜单

页面标题

页面副标题

Minits v4.9.3.32 - h.java 源代码

正在查看: Minits v4.9.3.32 应用的 h.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package M8;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import android.webkit.ClientCertRequest;
import android.webkit.HttpAuthHandler;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import androidx.fragment.app.j;
import com.xone.android.framework.AbstractC0568j;
import com.xone.android.framework.activities.XoneBaseActivity;
import com.xone.android.framework.views.XOneWebView;
import com.xone.android.framework.webview.ScriptClientCertRequest;
import com.xone.android.framework.xoneApp;
import com.xone.android.javascript.XOneJavascript;
import com.xone.android.script.events.EventCallbackTask;
import com.xone.android.script.events.EventOnPageError;
import com.xone.android.script.events.EventOnPageLoadFinished;
import com.xone.android.utils.Utils;
import com.xone.interfaces.IXoneObject;
import g8.m;
import ja.C0789a;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.util.List;
import org.mozilla.javascript.Function;
import org.mozilla.javascript.Q0;
import org.mozilla.javascript.Scriptable;
import ua.InterfaceC1036l0;
import ua.InterfaceC1038m0;
import y8.RunnableC1097a;

public final class h extends WebViewClient {
    public final XOneWebView a;
    public IXoneObject b;
    public Function c;

    public h(XOneWebView xOneWebView) {
        this.a = xOneWebView;
    }

    public static String h(WebView webView) {
        String T = ((InterfaceC1038m0) webView.getContext().getApplicationContext()).T();
        return T == null ? "" : T;
    }

    public static List j(IXoneObject iXoneObject, String str, String str2) {
        if (iXoneObject == null) {
            return null;
        }
        return iXoneObject.getEventCallback(str2, str);
    }

    public final WebResourceResponse b(WebView webView, WebResourceRequest webResourceRequest) {
        Uri url;
        String uri;
        if (webResourceRequest == null || (url = webResourceRequest.getUrl()) == null || (uri = url.toString()) == null) {
            return null;
        }
        return c(webView, uri);
    }

    public final WebResourceResponse c(WebView webView, String str) {
        File i;
        if (TextUtils.isEmpty(str) || (i = i(webView, str)) == null) {
            return null;
        }
        return new WebResourceResponse("", "UTF-8", new ByteArrayInputStream(Utils.B3(i)));
    }

    public final void d(String str) {
        RunnableC1097a.h((XoneBaseActivity) this.a.getContext(), this.a.getDataObject(), this.a.getUiHandler(), this.a.getLinkHandlerCallbackNode(), 0, false, new Object[]{str}, null).start();
    }

    public final void e(WebView webView, String str) {
        final ProgressBar progressBar = this.a.getProgressBar();
        if (progressBar != null) {
            this.a.post(new Runnable() {
                @Override
                public final void run() {
                    progressBar.setVisibility(0);
                }
            });
        }
        webView.loadUrl(str);
    }

    public final void f(String str) {
        if (str == null) {
            Utils.l("XOneAndroidFramework", "doOpenUrl(): Empty url argument");
            return;
        }
        j g = xoneApp.Z0().g();
        if (g != null) {
            Intent intent = new Intent();
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.parse(str));
            g.startActivity(intent);
            return;
        }
        Utils.l("XOneAndroidFramework", "doOpenUrl(): Cannot open url " + str + ", activity is null");
    }

    public final InterfaceC1036l0 g() {
        return (InterfaceC1036l0) this.a.getContext();
    }

    public final File i(WebView webView, String str) {
        File file;
        int indexOf = str.indexOf("##APP_PATH##/");
        if (indexOf >= 0) {
            file = new File(h(webView), str.substring(indexOf + 13));
        } else {
            int indexOf2 = str.indexOf("##FILES_PATH##/");
            if (indexOf2 >= 0) {
                String substring = str.substring(indexOf2 + 15);
                file = new File(h(webView), "files/" + substring);
            } else {
                file = null;
            }
        }
        if (file != null && file.exists() && file.isFile() && file.canRead()) {
            return file;
        }
        return null;
    }

    public final void k(Throwable th) {
        if (th == null) {
            return;
        }
        InterfaceC1036l0 g = g();
        if (g != null) {
            g.b(th);
        } else {
            th.printStackTrace();
        }
    }

    public final void l(Object obj, Object... objArr) {
        if (obj == null) {
            return;
        }
        Scriptable parentScope = obj instanceof Function ? ((Function) obj).getParentScope() : null;
        if (parentScope == null) {
            XOneJavascript.x(obj, objArr);
            return;
        }
        Object property = Q0.getProperty(parentScope, "self");
        Q0.putProperty(parentScope, "self", this.b);
        try {
            XOneJavascript.x(obj, objArr);
        } finally {
            Q0.putProperty(parentScope, "self", property);
        }
    }

    public final boolean m(String str) {
        String[] handleLinkExtensions;
        if (TextUtils.isEmpty(str) || (handleLinkExtensions = this.a.getHandleLinkExtensions()) == null) {
            return false;
        }
        for (String str2 : handleLinkExtensions) {
            if (str.endsWith(str2)) {
                return true;
            }
        }
        return false;
    }

    public void n(IXoneObject iXoneObject, Function function) {
        this.b = iXoneObject;
        this.c = function;
    }

    @Override
    public void onPageFinished(WebView webView, String str) {
        XOneWebView xOneWebView = this.a;
        if (xOneWebView == null) {
            return;
        }
        if (xOneWebView.J()) {
            this.a.C("function sendMessage(sData) { xone.sendMessage(sData); }");
        }
        try {
            IXoneObject dataObject = this.a.getDataObject();
            List j = j(dataObject, this.a.getPropName(), "onpageloaded");
            if (j != null) {
                InterfaceC1036l0 g = g();
                new EventCallbackTask.b().b(g).e(dataObject).h(g.getHandler()).g(j).c(new Object[]{new C0789a("e", new EventOnPageLoadFinished(dataObject.getOwnerApp(), dataObject, this.a.getPropName(), str))}).a().runSeriallyAsyncTask();
            }
        } catch (Exception e) {
            k(e);
        }
    }

    @Override
    public void onReceivedClientCertRequest(WebView webView, ClientCertRequest clientCertRequest) {
        Function function = this.c;
        if (function == null) {
            super.onReceivedClientCertRequest(webView, clientCertRequest);
            return;
        }
        try {
            l(function, new ScriptClientCertRequest(clientCertRequest));
        } catch (Exception e) {
            k(e);
        }
    }

    @Override
    public void onReceivedError(WebView webView, int i, String str, String str2) {
        try {
            if (!TextUtils.isEmpty(this.a.getErrorImage())) {
                webView.setVisibility(8);
                webView.loadData("", "text/html", "utf-8");
            }
            IXoneObject dataObject = this.a.getDataObject();
            List j = j(dataObject, this.a.getPropName(), "onpageerror");
            if (j != null) {
                InterfaceC1036l0 g = g();
                new EventCallbackTask.b().b(g).e(dataObject).h(g.getHandler()).g(j).c(new Object[]{new C0789a("e", new EventOnPageError(dataObject.getOwnerApp(), dataObject, this.a.getPropName(), i, str, str2))}).a().runSeriallyAsyncTask();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onReceivedHttpAuthRequest(WebView webView, HttpAuthHandler httpAuthHandler, String str, String str2) {
        String userName = this.a.getUserName();
        String password = this.a.getPassword();
        if (!TextUtils.isEmpty(userName) || !TextUtils.isEmpty(password)) {
            httpAuthHandler.proceed(userName, password);
            this.a.setUserName(null);
            this.a.setPassword(null);
        } else {
            Context context = this.a.getContext();
            String webViewAuthDialogTitle = this.a.getWebViewAuthDialogTitle();
            if (TextUtils.isEmpty(webViewAuthDialogTitle)) {
                webViewAuthDialogTitle = context.getResources().getString(AbstractC0568j.z0, str, str2);
            }
            new m(context, webViewAuthDialogTitle, httpAuthHandler).show();
        }
    }

    @Override
    public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
        try {
            WebResourceResponse b = b(webView, webResourceRequest);
            return b != null ? b : super.shouldInterceptRequest(webView, webResourceRequest);
        } catch (Exception e) {
            e.printStackTrace();
            return super.shouldInterceptRequest(webView, webResourceRequest);
        }
    }

    @Override
    public boolean shouldOverrideUrlLoading(WebView webView, String str) {
        try {
            if (!TextUtils.isEmpty(this.a.getLinkHandlerCallbackNode())) {
                d(str);
                return true;
            }
            if (this.a.getHandleLinks()) {
                e(webView, str);
                return true;
            }
            if (this.a.getHandleLinkExtensions() == null) {
                f(str);
            }
            if (m(str)) {
                f(str);
            } else {
                e(webView, str);
            }
            return true;
        } catch (Exception e) {
            k(e);
            return false;
        }
    }

    @Override
    public WebResourceResponse shouldInterceptRequest(WebView webView, String str) {
        try {
            WebResourceResponse c = c(webView, str);
            return c != null ? c : super.shouldInterceptRequest(webView, str);
        } catch (Exception e) {
            e.printStackTrace();
            return super.shouldInterceptRequest(webView, str);
        }
    }
}