乐健体育 v3.9.1版本的 MD5 值为:87ae8a64955cdd0e43f3559ee8984d75

以下内容为反编译后的 PlusUriAdapter.java 源代码,内容仅作参考


package io.dcloud.feature.weex.adapter;

import android.net.Uri;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.taobao.weex.WXSDKInstance;
import com.taobao.weex.adapter.URIAdapter;
import com.taobao.weex.el.parse.Operators;
import io.dcloud.common.DHInterface.IWebview;
import io.dcloud.common.adapter.util.DeviceInfo;
import io.dcloud.common.util.PdrUtil;
import io.dcloud.feature.uniapp.adapter.AbsURIAdapter;
import io.dcloud.feature.weex.WeexInstanceMgr;
import org.apache.commons.io.IOUtils;
public class PlusUriAdapter implements URIAdapter {
    private String standardizedURL(String str, String str2) {
        if (str2.startsWith("./")) {
            str2 = str2.substring(2);
            int lastIndexOf = str.lastIndexOf(47);
            if (lastIndexOf >= 0) {
                return str.substring(0, lastIndexOf + 1) + str2;
            }
        }
        int indexOf = str2.indexOf("../");
        int lastIndexOf2 = str.lastIndexOf(47);
        if (lastIndexOf2 > -1) {
            String substring = str.substring(0, lastIndexOf2);
            while (indexOf > -1) {
                str2 = str2.substring(3);
                substring = substring.substring(0, substring.lastIndexOf(47));
                indexOf = str2.indexOf("../");
            }
            return substring + IOUtils.DIR_SEPARATOR_UNIX + str2;
        }
        return str2;
    }

    @Override
    @NonNull
    public Uri rewrite(WXSDKInstance wXSDKInstance, String str, Uri uri) {
        String standardizedURL;
        if (!TextUtils.isEmpty(wXSDKInstance.getBundleUrl()) && !PdrUtil.isEmpty(uri)) {
            String bundleUrl = wXSDKInstance.getBundleUrl();
            String uri2 = uri.toString();
            if (uri.isRelative()) {
                if (uri.getEncodedPath().length() == 0) {
                    return Uri.parse(bundleUrl);
                }
                IWebview findWebview = WeexInstanceMgr.self().findWebview(wXSDKInstance);
                if (findWebview != null) {
                    byte obtainRunningAppMode = findWebview.obtainApp().obtainRunningAppMode();
                    if (!uri2.startsWith("/storage") && obtainRunningAppMode == 1) {
                        String convert2AbsFullPath = findWebview.obtainApp().convert2AbsFullPath(bundleUrl, uri2);
                        if ("web".equals(str)) {
                            convert2AbsFullPath = findWebview.obtainApp().convert2WebviewFullPath(bundleUrl, uri2);
                        }
                        if (convert2AbsFullPath.startsWith("/storage/")) {
                            standardizedURL = findWebview.obtainApp().convert2WebviewFullPath(bundleUrl, uri2);
                        } else {
                            if (convert2AbsFullPath.startsWith(Operators.DIV)) {
                                convert2AbsFullPath = convert2AbsFullPath.substring(1, convert2AbsFullPath.length());
                            }
                            if (str.equals(AbsURIAdapter.FONT)) {
                                standardizedURL = "local:///" + convert2AbsFullPath;
                            } else {
                                standardizedURL = "asset:///" + convert2AbsFullPath;
                            }
                        }
                    } else {
                        standardizedURL = findWebview.obtainApp().convert2WebviewFullPath(bundleUrl, uri2);
                    }
                } else {
                    standardizedURL = standardizedURL(bundleUrl, uri2);
                }
                if (bundleUrl.startsWith("/storage")) {
                    standardizedURL = DeviceInfo.FILE_PROTOCOL + standardizedURL;
                } else if (bundleUrl.startsWith("storage")) {
                    standardizedURL = "file:///" + standardizedURL;
                }
                return Uri.parse(standardizedURL);
            }
        }
        return uri;
    }

    @Override
    @NonNull
    public Uri rewrite(String str, String str2, Uri uri) {
        String uri2 = uri.toString();
        if (uri.isRelative()) {
            if (uri.getEncodedPath().length() == 0) {
                return Uri.parse(str);
            }
            return Uri.parse(standardizedURL(str, uri2));
        }
        return uri;
    }
}