Aqara Home v2.4.1版本的 MD5 值为:529779ac2bc0131db52a1fc3098d2b35

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


package a0.k;

import android.content.Context;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.umeng.commonsdk.framework.UMModuleRegister;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import k.t.c.j.j;
import k.t.c.j.t;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import p.a.x0.r;
import s.b3.v.l;
import s.b3.w.k0;
import s.h0;
import s.i3.b0;
import s.i3.c0;
import s.i3.e0;
import s.j2;
import s.r2.f0;
import s.y2.z;
@h0(bv = {1, 0, 3}, d1 = {"\u0000F\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0017\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\b\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u000e\u001ak\u0010\u0018\u001a\u00020\u00192\u0006\u0010\u001a\u001a\u00020\u00012\u0006\u0010\u001b\u001a\u00020\u00012\u0006\u0010\u001c\u001a\u00020\u00012\u0006\u0010\u001d\u001a\u00020\u00012\b\b\u0002\u0010\u001e\u001a\u00020\u001f2%\b\u0002\u0010 \u001a\u001f\u0012\u0013\u0012\u00110\"¢\u0006\f\b#\u0012\b\b$\u0012\u0004\b\b(%\u0012\u0004\u0012\u00020&\u0018\u00010!2\u0012\u0010'\u001a\u000e\u0012\u0004\u0012\u00020(\u0012\u0004\u0012\u00020&0!\u001a\u0016\u0010)\u001a\u00020\u00012\u0006\u0010*\u001a\u00020+2\u0006\u0010,\u001a\u00020\u0001\u001a\u0016\u0010-\u001a\u00020\u00012\u0006\u0010*\u001a\u00020+2\u0006\u0010,\u001a\u00020\u0001\u001a\u0006\u0010.\u001a\u00020/\u001a\u001a\u00100\u001a\u00020\u00012\b\b\u0002\u00101\u001a\u00020+2\b\b\u0002\u0010,\u001a\u00020\u0001\u001a\u001a\u00102\u001a\u00020\u00012\b\b\u0002\u00101\u001a\u00020+2\b\b\u0002\u0010,\u001a\u00020\u0001\u001a\u0010\u00103\u001a\u00020\u00012\u0006\u00104\u001a\u00020\u0001H\u0002\u001a\u0016\u00105\u001a\u00020\u001f2\u0006\u00106\u001a\u00020\u00012\u0006\u00107\u001a\u00020\u0001\u001a\u0016\u00108\u001a\u00020\u001f2\u0006\u00106\u001a\u00020\u00012\u0006\u00107\u001a\u00020\u0001\u001a\u000e\u00109\u001a\u00020&2\u0006\u0010:\u001a\u00020/\u001a\u000e\u0010;\u001a\u00020\u001f2\u0006\u0010<\u001a\u00020\u0001\"\u0014\u0010\u0000\u001a\u00020\u0001X\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\u0002\u0010\u0003\"\u0014\u0010\u0004\u001a\u00020\u0001X\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0003\"\u0014\u0010\u0006\u001a\u00020\u0001X\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\u0003\"\u0014\u0010\b\u001a\u00020\u0001X\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\t\u0010\u0003\"\u0014\u0010\n\u001a\u00020\u0001X\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\u0003\"\u0014\u0010\f\u001a\u00020\u0001X\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\r\u0010\u0003\"\u0014\u0010\u000e\u001a\u00020\u0001X\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\u000f\u0010\u0003\"\u0014\u0010\u0010\u001a\u00020\u0001X\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\u0011\u0010\u0003\"\u0014\u0010\u0012\u001a\u00020\u0001X\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\u0013\u0010\u0003\"\u000e\u0010\u0014\u001a\u00020\u0001X\u0086T¢\u0006\u0002\n\u0000\"\u000e\u0010\u0015\u001a\u00020\u0001X\u0086T¢\u0006\u0002\n\u0000\"\u0014\u0010\u0016\u001a\u00020\u0001X\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\u0017\u0010\u0003¨\u0006="}, d2 = {"BUNDLE_NAME_IN_ASSETS", "", "getBUNDLE_NAME_IN_ASSETS", "()Ljava/lang/String;", "BundleConfigFile", "getBundleConfigFile", "CACHE_ASSETS_DIR", "getCACHE_ASSETS_DIR", "DEFAULT_PROJECT_NAME", "getDEFAULT_PROJECT_NAME", "Key_CURRENT_DOWNLOAD_URL", "getKey_CURRENT_DOWNLOAD_URL", "Key_CURRENT_MODEL", "getKey_CURRENT_MODEL", "Key_CURRENT_PROJECT_NAME", "getKey_CURRENT_PROJECT_NAME", "Key_LOAD_TYPE", "getKey_LOAD_TYPE", "TAG", "getTAG", "TYPE_ASSETS_BASE", "TYPE_ASSETS_BUSINESS", "baseUrl", "getBaseUrl", "downLoadFromNet", "Lio/reactivex/disposables/Disposable;", "url", "desFilePath", k.u.c.g0.c.j.d.k.i.C, "desFolderName", "isUpzip", "", "processListener", "Lkotlin/Function1;", "", "Lkotlin/ParameterName;", "name", UMModuleRegister.PROCESS, "", "zipFinishAction", "Lreactnative/bean/CheckProcessResult;", "getAssetsBundleVersion", "assertsType", "Lreactnative/utils/AssertsType;", "model", "getBundleNameFromAsserts", "getCurrentLoadModal", "Lreactnative/bean/LoadType;", "getRNBundleVersion", "type", "getRNCacheBundleVersion", "getVerisonFromPath", "path", "isNeedUpdate", "oldVersion", "newVersion", "isNeedUpdateLocal", "setCurrentLoadModal", "loadType", "upgradeBundleFile", "filePath", "app_homekitRelease"}, k = 2, mv = {1, 1, 15})
public final class e {
    @NotNull
    public static final String a = "bundleConfigs";
    @NotNull
    public static final String b = "key_current_model";
    @NotNull
    public static final String c = "key_current_project_name";
    @NotNull
    public static final String d = "key_load_type";
    @NotNull
    public static final String f1112e = "key_download_path";
    @NotNull
    public static final String f1113f = "rn_demo_0614";
    @NotNull
    public static final String f1114g = "base";
    @NotNull
    public static final String f1115h = "business";
    @NotNull
    public static final String f1116i = "192.168.1.113:10086";
    @NotNull
    public static final String f1117j = "ReactNative";
    @NotNull
    public static final String f1118k = "bundle";
    @NotNull
    public static final String f1119l = "assets";

    public static final class a<T> implements r<LinkedHashMap<Long, File>> {
        public final l a;

        public a(l lVar) {
            this.a = lVar;
        }

        @Override
        public final boolean test(@NotNull LinkedHashMap<Long, File> linkedHashMap) {
            k0.f(linkedHashMap, "longFileLinkedHashMap");
            if (linkedHashMap.isEmpty()) {
                this.a.invoke(a0.h.a.NET_ERROR);
            }
            return !linkedHashMap.isEmpty();
        }
    }

    public static final class b<T> implements p.a.x0.g<LinkedHashMap<Long, File>> {
        public final l a;
        public final boolean b;
        public final String c;
        public final String d;
        public final String f1120e;
        public final l f1121f;

        public b(l lVar, boolean z2, String str, String str2, String str3, l lVar2) {
            this.a = lVar;
            this.b = z2;
            this.c = str;
            this.d = str2;
            this.f1120e = str3;
            this.f1121f = lVar2;
        }

        @Override
        public final void accept(LinkedHashMap<Long, File> linkedHashMap) {
            for (Long l2 : linkedHashMap.keySet()) {
                l lVar = this.a;
                if (lVar != null) {
                    j2 j2Var = (j2) lVar.invoke(Integer.valueOf((int) l2.longValue()));
                }
                if (((int) l2.longValue()) == 100) {
                    if (this.b) {
                        boolean a = i.a(this.c + File.separator + this.d, this.c);
                        Log.d(this.f1120e, "解压成功!");
                        if (a) {
                            j.b(this.c + File.separator + this.d, false);
                        }
                    }
                    this.f1121f.invoke(a0.h.a.SUCCESS);
                }
            }
        }
    }

    public static final class c<T> implements p.a.x0.g<Throwable> {
        public final l a;

        public c(l lVar) {
            this.a = lVar;
        }

        @Override
        public final void accept(Throwable th) {
            th.printStackTrace();
            this.a.invoke(a0.h.a.NET_ERROR);
        }
    }

    @NotNull
    public static final String a() {
        return f1118k;
    }

    @NotNull
    public static final String b() {
        return f1116i;
    }

    @NotNull
    public static final String c() {
        return a;
    }

    @NotNull
    public static final String d() {
        return f1119l;
    }

    @NotNull
    public static final a0.h.b e() {
        Object a2 = h.a(a0.k.a.a(), d, Integer.valueOf(a0.h.b.HOTLOAD.ordinal()), a);
        if (k0.a(a2, Integer.valueOf(a0.h.b.ASSETS.ordinal()))) {
            return a0.h.b.ASSETS;
        }
        if (k0.a(a2, Integer.valueOf(a0.h.b.HOTLOAD.ordinal()))) {
            return a0.h.b.HOTLOAD;
        }
        if (k0.a(a2, Integer.valueOf(a0.h.b.DEVELOPMENT.ordinal()))) {
            return a0.h.b.DEVELOPMENT;
        }
        if (k0.a(a2, Integer.valueOf(a0.h.b.NATIVE.ordinal()))) {
            return a0.h.b.NATIVE;
        }
        return a0.h.b.HOTLOAD;
    }

    @NotNull
    public static final String f() {
        return f1113f;
    }

    @NotNull
    public static final String g() {
        return f1112e;
    }

    @NotNull
    public static final String h() {
        return b;
    }

    @NotNull
    public static final String i() {
        return c;
    }

    @NotNull
    public static final String j() {
        return d;
    }

    @NotNull
    public static final String k() {
        return f1117j;
    }

    @NotNull
    public static final String a(@NotNull a0.k.b bVar, @NotNull String str) {
        ArrayList arrayList;
        int b2;
        k0.f(bVar, "assertsType");
        k0.f(str, "model");
        try {
            String str2 = bVar == a0.k.b.ASSERTS_BASE ? f1114g : str;
            Context a2 = a0.k.a.a();
            k0.a((Object) a2, "AppContext.get()");
            String[] list = a2.getAssets().list(f1118k);
            if (list != null) {
                ArrayList arrayList2 = new ArrayList(list.length);
                for (String str3 : list) {
                    k0.a((Object) str3, "it");
                    arrayList2.add(b0.a(str3, ".zip", "", false, 4, (Object) null));
                }
                arrayList = new ArrayList();
                for (Object obj : arrayList2) {
                    if (c0.c((CharSequence) ((String) obj), (CharSequence) str2, false, 2, (Object) null)) {
                        arrayList.add(obj);
                    }
                }
            } else {
                arrayList = null;
            }
            if (arrayList == null || !(!arrayList.isEmpty())) {
                return "";
            }
            String str4 = (String) arrayList.get(0);
            if (!c0.c((CharSequence) str4, (CharSequence) str, false, 2, (Object) null) || (b2 = c0.b((CharSequence) str4, "-", 0, false, 6, (Object) null)) == -1) {
                return "";
            }
            int i2 = b2 + 1;
            return str4.length() - i2 >= 0 ? e0.r(str4, str4.length() - i2) : "";
        } catch (Exception e2) {
            e2.printStackTrace();
            return "";
        }
    }

    @NotNull
    public static final String b(@NotNull a0.k.b bVar, @NotNull String str) {
        k0.f(bVar, "assertsType");
        k0.f(str, "model");
        try {
            Context a2 = a0.k.a.a();
            k0.a((Object) a2, "AppContext.get()");
            String[] list = a2.getAssets().list(f1118k);
            if (bVar == a0.k.b.ASSERTS_BASE) {
                str = f1114g;
            }
            if (list != null) {
                ArrayList arrayList = new ArrayList();
                for (String str2 : list) {
                    k0.a((Object) str2, "it");
                    if (c0.c((CharSequence) str2, (CharSequence) str, false, 2, (Object) null)) {
                        arrayList.add(str2);
                    }
                }
                String str3 = (String) arrayList.get(0);
                return str3 != null ? str3 : "";
            }
            return "";
        } catch (Exception e2) {
            e2.printStackTrace();
            return "";
        }
    }

    @NotNull
    public static final String c(@NotNull a0.k.b bVar, @NotNull String str) {
        k0.f(bVar, "type");
        k0.f(str, "model");
        StringBuilder sb = new StringBuilder();
        Context a2 = a0.k.a.a();
        k0.a((Object) a2, "AppContext.get()");
        File filesDir = a2.getFilesDir();
        k0.a((Object) filesDir, "AppContext.get().filesDir");
        sb.append(filesDir.getAbsolutePath());
        sb.append(File.separator);
        sb.append(f1119l);
        sb.append(File.separator);
        sb.append(bVar == a0.k.b.ASSERTS_BASE ? t.f19068i.a().c() : str);
        sb.append(File.separator);
        sb.append(t.f19068i.a().g());
        String sb2 = sb.toString();
        if (new File(sb2).exists() && new File(sb2).isFile()) {
            return a(sb2);
        }
        return a(bVar, str);
    }

    @NotNull
    public static final String d(@NotNull a0.k.b bVar, @NotNull String str) {
        k0.f(bVar, "type");
        k0.f(str, "model");
        StringBuilder sb = new StringBuilder();
        Context a2 = a0.k.a.a();
        k0.a((Object) a2, "AppContext.get()");
        File filesDir = a2.getFilesDir();
        k0.a((Object) filesDir, "AppContext.get().filesDir");
        sb.append(filesDir.getAbsolutePath());
        sb.append(File.separator);
        sb.append(f1119l);
        sb.append(File.separator);
        if (bVar == a0.k.b.ASSERTS_BASE) {
            str = t.f19068i.a().c();
        }
        sb.append(str);
        sb.append(File.separator);
        sb.append(t.f19068i.a().g());
        String sb2 = sb.toString();
        return (new File(sb2).exists() && new File(sb2).isFile()) ? a(sb2) : "";
    }

    public static String b(a0.k.b bVar, String str, int i2, Object obj) {
        if ((i2 & 1) != 0) {
            bVar = a0.k.b.ASSERTS_BASE;
        }
        if ((i2 & 2) != 0) {
            str = "";
        }
        return d(bVar, str);
    }

    public static final boolean b(@NotNull String str, @NotNull String str2) {
        k0.f(str, "oldVersion");
        k0.f(str2, "newVersion");
        if (str.length() == 0) {
            return true;
        }
        if (str2.length() == 0) {
            return false;
        }
        List a2 = c0.a((CharSequence) str, new char[]{'.'}, false, 0, 6, (Object) null);
        List a3 = c0.a((CharSequence) str2, new char[]{'.'}, false, 0, 6, (Object) null);
        if (a3 != null && a2 != null) {
            int size = a3.size();
            for (int i2 = 0; i2 < size; i2++) {
                if (i2 < a2.size() && Integer.parseInt((String) a3.get(i2)) > Integer.parseInt((String) a2.get(i2))) {
                    return true;
                }
            }
        }
        return false;
    }

    public static final boolean b(@NotNull String str) {
        k0.f(str, "filePath");
        try {
            String b2 = b(a0.k.b.ASSERTS_BASE, "");
            String str2 = str + File.separator + t.f19068i.a().c();
            if (b(b(null, null, 3, null), a(a0.k.b.ASSERTS_BASE, "")) || !new File(str2).exists()) {
                if (j.a(f1118k + File.separator + b2, str, b2)) {
                    boolean a2 = i.a(str + File.separator + b2, str);
                    if (a2) {
                        j.b(str + File.separator + b2, false);
                    }
                    return a2;
                }
                return false;
            }
            return true;
        } catch (Exception e2) {
            e2.printStackTrace();
            return true;
        }
    }

    public static final void a(@NotNull a0.h.b bVar) {
        k0.f(bVar, "loadType");
        h.b(a0.k.a.a(), d, Integer.valueOf(bVar.ordinal()), a);
    }

    public static String a(a0.k.b bVar, String str, int i2, Object obj) {
        if ((i2 & 1) != 0) {
            bVar = a0.k.b.ASSERTS_BASE;
        }
        if ((i2 & 2) != 0) {
            str = "";
        }
        return c(bVar, str);
    }

    public static final boolean a(@NotNull String str, @NotNull String str2) {
        k0.f(str, "oldVersion");
        k0.f(str2, "newVersion");
        if (str.length() == 0) {
            return true;
        }
        if (str2.length() == 0) {
            return false;
        }
        return !k0.a((Object) str, (Object) str2);
    }

    public static final String a(String str) {
        String str2 = "";
        try {
            if (new File(str).exists() && new File(str).isFile()) {
                List<String> a2 = z.a(new FileReader(str));
                if (!a2.isEmpty()) {
                    JsonElement jsonElement = ((JsonObject) new Gson().fromJson((String) f0.u((List<? extends Object>) a2), (Class<Object>) JsonObject.class)).get("version");
                    k0.a((Object) jsonElement, "jsonObject.get(\"version\")");
                    String asString = jsonElement.getAsString();
                    k0.a((Object) asString, "jsonObject.get(\"version\").asString");
                    try {
                        Log.d("ReactBundleUtils", "path = " + str + "  currentVersion = " + asString);
                        return asString;
                    } catch (Exception e2) {
                        e = e2;
                        str2 = asString;
                        e.printStackTrace();
                        return str2;
                    }
                }
                return "";
            }
            return "";
        } catch (Exception e3) {
            e = e3;
        }
    }

    public static p.a.u0.c a(String str, String str2, String str3, String str4, boolean z2, l lVar, l lVar2, int i2, Object obj) {
        boolean z3 = (i2 & 16) != 0 ? true : z2;
        if ((i2 & 32) != 0) {
            lVar = null;
        }
        return a(str, str2, str3, str4, z3, lVar, lVar2);
    }

    @NotNull
    public static final p.a.u0.c a(@NotNull String str, @NotNull String str2, @NotNull String str3, @NotNull String str4, boolean z2, @Nullable l<? super Integer, j2> lVar, @NotNull l<? super a0.h.a, j2> lVar2) {
        k0.f(str, "url");
        k0.f(str2, "desFilePath");
        k0.f(str3, k.u.c.g0.c.j.d.k.i.C);
        k0.f(str4, "desFolderName");
        k0.f(lVar2, "zipFinishAction");
        Log.w("Download", "下载地址:" + str);
        if (new File(str2 + File.separator + str4).exists()) {
            Log.w("Download", "目标目录存在,进行删除!:" + str4);
            j.b(str2 + File.separator + str4, false);
        }
        File file = new File(str2);
        if (!file.exists()) {
            file.mkdir();
        }
        p.a.u0.c subscribe = j.b(str, str2, str3).c(new a(lVar2)).subscribe(new b(lVar, z2, str2, str3, "Download", lVar2), new c(lVar2));
        k0.a((Object) subscribe, "FileUtil.downLoadFile(ur…sResult.NET_ERROR)\n    })");
        return subscribe;
    }
}