导航菜单

页面标题

页面副标题

万能钥匙 v1.1.23 - AbsAppletDirProvider.java 源代码

正在查看: 万能钥匙 v1.1.23 应用的 AbsAppletDirProvider.java JAVA 源代码文件

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


package com.finogeeks.lib.applet.appletdir;

import android.content.Context;
import com.finogeeks.lib.applet.client.FinAppClient;
import com.finogeeks.lib.applet.client.FinAppConfig;
import com.finogeeks.lib.applet.config.AppConfig;
import com.finogeeks.lib.applet.main.FinAppEnv;
import com.finogeeks.lib.applet.utils.FinFileResourceUtil;
import com.finogeeks.lib.applet.utils.a0;
import com.finogeeks.lib.applet.utils.o0;
import hh0.l;
import java.io.File;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.g0;
import kotlin.jvm.internal.n;
import kotlin.jvm.internal.p;
import kotlin.jvm.internal.w;
import lg0.h;
import lg0.i;
import tj0.t;
import tj0.u;

@Metadata(bv = {1, 0, 3}, d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\n\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\b\u0006\b&\u0018\u0000 \u00172\u00020\u0001:\u0001\u0017B%\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0005\u0012\u0006\u0010\u0007\u001a\u00020\u0005¢\u0006\u0002\u0010\bJ\b\u0010\u000f\u001a\u00020\u0010H&J\u000e\u0010\u0011\u001a\b\u0012\u0004\u0012\u00020\u00100\u0012H$J\u0010\u0010\u0013\u001a\u0004\u0018\u00010\u00102\u0006\u0010\u0014\u001a\u00020\u0005J\u000e\u0010\u0015\u001a\u00020\u00102\u0006\u0010\u0014\u001a\u00020\u0005J\b\u0010\u0016\u001a\u00020\u0005H\u0004R\u0011\u0010\u0007\u001a\u00020\u0005¢\u0006\b\n\u0000\u001a\u0004\b\t\u0010\nR\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\fR\u0011\u0010\u0004\u001a\u00020\u0005¢\u0006\b\n\u0000\u001a\u0004\b\r\u0010\nR\u0011\u0010\u0006\u001a\u00020\u0005¢\u0006\b\n\u0000\u001a\u0004\b\u000e\u0010\n¨\u0006\u0018"}, d2 = {"Lcom/finogeeks/lib/applet/appletdir/AbsAppletDirProvider;", "", "context", "Landroid/content/Context;", "finAppletStoreName", "", "frameworkVersion", "appId", "(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", "getAppId", "()Ljava/lang/String;", "getContext", "()Landroid/content/Context;", "getFinAppletStoreName", "getFrameworkVersion", "getDirForWrite", "Ljava/io/File;", "getDirsForRead", "", "getExistsFileCompat", "fileName", "getFileCompat", "getUserDir", "Companion", "finapplet_release"}, k = 1, mv = {1, 1, 16})
public abstract class AbsAppletDirProvider {

    public static final Companion INSTANCE = new Companion(null);
    private final String appId;
    private final Context context;
    private final String finAppletStoreName;
    private final String frameworkVersion;

    @Metadata(bv = {1, 0, 3}, d1 = {"\u00008\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J \u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\u0004H\u0007J,\u0010\u0003\u001a\u0004\u0018\u00010\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\u00042\b\b\u0002\u0010\n\u001a\u00020\u000bH\u0007J<\u0010\u0003\u001a\u0004\u0018\u00010\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\f\u001a\u00020\u00042\u0006\u0010\r\u001a\u00020\u00042\u0006\u0010\u000e\u001a\u00020\u00042\u0006\u0010\t\u001a\u00020\u00042\b\b\u0002\u0010\n\u001a\u00020\u000bH\u0007J\u0012\u0010\u000f\u001a\u0004\u0018\u00010\u00042\u0006\u0010\u0010\u001a\u00020\u0004H\u0002¨\u0006\u0011²\u0006\n\u0010\u0012\u001a\u00020\u0013X\u008a\u0084\u0002²\u0006\n\u0010\u0014\u001a\u00020\u0015X\u008a\u0084\u0002²\u0006\n\u0010\u0016\u001a\u00020\u0017X\u008a\u0084\u0002"}, d2 = {"Lcom/finogeeks/lib/applet/appletdir/AbsAppletDirProvider$Companion;", "", "()V", "convertFinFilePath", "", "context", "Landroid/content/Context;", "appConfig", "Lcom/finogeeks/lib/applet/config/AppConfig;", "finFilePath", "strict", "", "finAppletStoreName", "frameworkVersion", "appId", "extractFinFileRelativePath", "input", "finapplet_release", "usrDirProvider", "Lcom/finogeeks/lib/applet/appletdir/AppletUsrDirProvider;", "tempDirProvider", "Lcom/finogeeks/lib/applet/appletdir/AppletTempDirProvider;", "storeDirProvider", "Lcom/finogeeks/lib/applet/appletdir/AppletStoreDirProvider;"}, k = 1, mv = {1, 1, 16})
    public static final class Companion {
        static final l[] $$delegatedProperties = {g0.i(new w(g0.b(Companion.class), "usrDirProvider", "<v#0>")), g0.i(new w(g0.b(Companion.class), "tempDirProvider", "<v#1>")), g0.i(new w(g0.b(Companion.class), "storeDirProvider", "<v#2>"))};

        public static final class a extends p implements ah0.a<AppletStoreDirProvider> {
            final Context a;
            final String b;
            final String c;
            final String d;

            public a(Context context, String str, String str2, String str3) {
                super(0);
                this.a = context;
                this.b = str;
                this.c = str2;
                this.d = str3;
            }

            public final AppletStoreDirProvider m168invoke() {
                return new AppletStoreDirProvider(this.a, this.b, this.c, this.d);
            }
        }

        public static final class b extends p implements ah0.a<AppletTempDirProvider> {
            final Context a;
            final String b;
            final String c;
            final String d;

            public b(Context context, String str, String str2, String str3) {
                super(0);
                this.a = context;
                this.b = str;
                this.c = str2;
                this.d = str3;
            }

            public final AppletTempDirProvider m169invoke() {
                return new AppletTempDirProvider(this.a, this.b, this.c, this.d);
            }
        }

        public static final class c extends p implements ah0.a<AppletUsrDirProvider> {
            final Context a;
            final String b;
            final String c;
            final String d;

            public c(Context context, String str, String str2, String str3) {
                super(0);
                this.a = context;
                this.b = str;
                this.c = str2;
                this.d = str3;
            }

            public final AppletUsrDirProvider m170invoke() {
                return new AppletUsrDirProvider(this.a, this.b, this.c, this.d);
            }
        }

        private Companion() {
        }

        public Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        public static String convertFinFilePath$default(Companion companion, Context context, AppConfig appConfig, String str, boolean z10, int i, Object obj) {
            if ((i & 8) != 0) {
                z10 = false;
            }
            return companion.convertFinFilePath(context, appConfig, str, z10);
        }

        private final String extractFinFileRelativePath(String input) {
            List m = mg0.p.m(new String[]{"usr/", "temp/", "store/"});
            String N0 = u.N0(input, FinFileResourceUtil.SCHEME, "");
            Iterator it = m.iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                String str = (String) it.next();
                if (t.L(N0, str, false, 2, (Object) null)) {
                    N0 = u.P0(N0, str, (String) null, 2, (Object) null);
                    break;
                }
            }
            if (N0.length() == 0) {
                return null;
            }
            return N0;
        }

        public final String convertFinFilePath(Context context, AppConfig appConfig, String finFilePath) {
            n.j(context, "context");
            n.j(appConfig, "appConfig");
            n.j(finFilePath, "finFilePath");
            String finAppletStoreName = appConfig.getFinAppletStoreName();
            n.e(finAppletStoreName, "appConfig.finAppletStoreName");
            String frameworkVersion = appConfig.getFrameworkVersion();
            n.e(frameworkVersion, "appConfig.frameworkVersion");
            String appId = appConfig.getAppId();
            n.e(appId, "appConfig.appId");
            String convertFinFilePath = convertFinFilePath(context, finAppletStoreName, frameworkVersion, appId, finFilePath, false);
            if (convertFinFilePath == null) {
                n.t();
            }
            return convertFinFilePath;
        }

        public final String convertFinFilePath(Context context, AppConfig appConfig, String finFilePath, boolean strict) {
            n.j(context, "context");
            n.j(appConfig, "appConfig");
            n.j(finFilePath, "finFilePath");
            String finAppletStoreName = appConfig.getFinAppletStoreName();
            n.e(finAppletStoreName, "appConfig.finAppletStoreName");
            String frameworkVersion = appConfig.getFrameworkVersion();
            n.e(frameworkVersion, "appConfig.frameworkVersion");
            String appId = appConfig.getAppId();
            n.e(appId, "appConfig.appId");
            return convertFinFilePath(context, finAppletStoreName, frameworkVersion, appId, finFilePath, strict);
        }

        public final String convertFinFilePath(Context context, String finAppletStoreName, String frameworkVersion, String appId, String finFilePath, boolean strict) {
            n.j(context, "context");
            n.j(finAppletStoreName, "finAppletStoreName");
            n.j(frameworkVersion, "frameworkVersion");
            n.j(appId, "appId");
            n.j(finFilePath, "finFilePath");
            h a2 = i.a(new c(context, finAppletStoreName, frameworkVersion, appId));
            l[] lVarArr = $$delegatedProperties;
            l lVar = lVarArr[0];
            h a3 = i.a(new b(context, finAppletStoreName, frameworkVersion, appId));
            l lVar2 = lVarArr[1];
            h a4 = i.a(new a(context, finAppletStoreName, frameworkVersion, appId));
            l lVar3 = lVarArr[2];
            if (t.L(finFilePath, FinFileResourceUtil.SCHEME, false, 2, (Object) null)) {
                if (n.d(finFilePath, "finfile://usr/") || n.d(finFilePath, "finfile://usr")) {
                    return ((AppletUsrDirProvider) a2.getValue()).getDirForWrite().getAbsolutePath();
                }
                if (n.d(finFilePath, "finfile://temp/") || n.d(finFilePath, "finfile://temp")) {
                    return ((AppletTempDirProvider) a3.getValue()).getDirForWrite().getAbsolutePath();
                }
                if (n.d(finFilePath, "finfile://store/") || n.d(finFilePath, "finfile://store")) {
                    return ((AppletStoreDirProvider) a4.getValue()).getDirForWrite().getAbsolutePath();
                }
                String extractFinFileRelativePath = extractFinFileRelativePath(finFilePath);
                if (extractFinFileRelativePath != null) {
                    if (t.L(finFilePath, "finfile://usr/", false, 2, (Object) null)) {
                        if (!strict) {
                            return ((AppletUsrDirProvider) a2.getValue()).getFileCompat(extractFinFileRelativePath).getAbsolutePath();
                        }
                        File existsFileCompat = ((AppletUsrDirProvider) a2.getValue()).getExistsFileCompat(extractFinFileRelativePath);
                        if (existsFileCompat != null) {
                            return existsFileCompat.getAbsolutePath();
                        }
                        return null;
                    }
                    if (t.L(finFilePath, "finfile://temp/", false, 2, (Object) null) || t.L(extractFinFileRelativePath, "tmp_", false, 2, (Object) null)) {
                        if (!strict) {
                            return ((AppletTempDirProvider) a3.getValue()).getFileCompat(extractFinFileRelativePath).getAbsolutePath();
                        }
                        File existsFileCompat2 = ((AppletTempDirProvider) a3.getValue()).getExistsFileCompat(extractFinFileRelativePath);
                        if (existsFileCompat2 != null) {
                            return existsFileCompat2.getAbsolutePath();
                        }
                        return null;
                    }
                    if (t.L(finFilePath, "finfile://store/", false, 2, (Object) null) || t.L(extractFinFileRelativePath, "store_", false, 2, (Object) null)) {
                        if (!strict) {
                            return ((AppletStoreDirProvider) a4.getValue()).getFileCompat(extractFinFileRelativePath).getAbsolutePath();
                        }
                        File existsFileCompat3 = ((AppletStoreDirProvider) a4.getValue()).getExistsFileCompat(extractFinFileRelativePath);
                        if (existsFileCompat3 != null) {
                            return existsFileCompat3.getAbsolutePath();
                        }
                        return null;
                    }
                }
            } else if (strict) {
                return null;
            }
            return finFilePath;
        }
    }

    public AbsAppletDirProvider(Context context, String str, String str2, String str3) {
        n.j(context, "context");
        n.j(str, "finAppletStoreName");
        n.j(str2, "frameworkVersion");
        n.j(str3, "appId");
        this.context = context;
        this.finAppletStoreName = str;
        this.frameworkVersion = str2;
        this.appId = str3;
    }

    public static final String convertFinFilePath(Context context, AppConfig appConfig, String str) {
        return INSTANCE.convertFinFilePath(context, appConfig, str);
    }

    public static final String convertFinFilePath(Context context, AppConfig appConfig, String str, boolean z10) {
        return INSTANCE.convertFinFilePath(context, appConfig, str, z10);
    }

    public static final String convertFinFilePath(Context context, String str, String str2, String str3, String str4, boolean z10) {
        return INSTANCE.convertFinFilePath(context, str, str2, str3, str4, z10);
    }

    public final String getAppId() {
        return this.appId;
    }

    public final Context getContext() {
        return this.context;
    }

    public abstract File getDirForWrite();

    public abstract List<File> getDirsForRead();

    public final File getExistsFileCompat(String fileName) {
        n.j(fileName, "fileName");
        Iterator<File> it = getDirsForRead().iterator();
        while (it.hasNext()) {
            File file = new File(it.next(), fileName);
            if (file.exists()) {
                return file;
            }
        }
        return null;
    }

    public final File getFileCompat(String fileName) {
        n.j(fileName, "fileName");
        File existsFileCompat = getExistsFileCompat(fileName);
        return existsFileCompat != null ? existsFileCompat : new File(getDirForWrite(), fileName);
    }

    public final String getFinAppletStoreName() {
        return this.finAppletStoreName;
    }

    public final String getFrameworkVersion() {
        return this.frameworkVersion;
    }

    public final String getUserDir() {
        String userId;
        String productIdentification;
        if (o0.e(this.context)) {
            FinAppConfig finAppConfig = FinAppClient.INSTANCE.getFinAppConfig();
            if (finAppConfig != null) {
                userId = finAppConfig.getUserId();
                productIdentification = finAppConfig.getProductIdentification();
            } else {
                userId = null;
                productIdentification = null;
            }
        } else {
            FinAppEnv finAppEnv = FinAppEnv.INSTANCE;
            userId = finAppEnv.getFinAppConfig().getUserId();
            productIdentification = finAppEnv.getFinAppConfig().getProductIdentification();
        }
        if (userId == null || userId.length() == 0) {
            return (productIdentification == null || productIdentification.length() == 0) ? "finapplet" : productIdentification;
        }
        String a = a0.a(userId);
        n.e(a, "MD5Utils.getMD5String(userId)");
        return a;
    }
}