导航菜单

页面标题

页面副标题

CityMall v1.42.1 - a.java 源代码

正在查看: CityMall v1.42.1 应用的 a.java JAVA 源代码文件

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


package com.microsoft.codepush.react;

import android.content.Context;
import android.content.pm.PackageManager;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.devsupport.interfaces.DevSupportManager;
import com.facebook.react.modules.debug.interfaces.DeveloperSettings;
import com.simpl.android.fingerprint.BuildConfig;
import java.io.File;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONException;
import org.json.JSONObject;

public class a implements ReactPackage {
    private static boolean i = false;
    private static boolean j = false;
    private static boolean k = false;
    private static String l = null;
    private static String m = "https://codepush.appcenter.ms/";
    private static String n;
    private static ReactInstanceHolder o;
    private static a p;
    private boolean a = false;
    private String b;
    private h c;
    private f d;
    private n e;
    private String f;
    private Context g;
    private final boolean h;

    public a(String str, Context context, boolean z) {
        this.g = context.getApplicationContext();
        this.c = new h(context.getFilesDir().getAbsolutePath());
        this.d = new f(this.g);
        this.f = str;
        this.h = z;
        this.e = new n(this.g);
        if (l == null) {
            try {
                l = this.g.getPackageManager().getPackageInfo(this.g.getPackageName(), 0).versionName;
            } catch (PackageManager.NameNotFoundException e) {
                throw new g("Unable to get package info for " + this.g.getPackageName(), e);
            }
        }
        p = this;
        String h = h("PublicKey");
        if (h != null) {
            n = h;
        }
        String h2 = h("ServerUrl");
        if (h2 != null) {
            m = h2;
        }
        a(null);
        q();
    }

    private String h(String str) {
        String packageName = this.g.getPackageName();
        int identifier = this.g.getResources().getIdentifier("CodePush" + str, "string", packageName);
        if (identifier == 0) {
            return null;
        }
        String string = this.g.getString(identifier);
        if (!string.isEmpty()) {
            return string;
        }
        k.h("Specified " + str + " is empty");
        return null;
    }

    public static String j() {
        return k("index.android.bundle");
    }

    public static String k(String str) {
        a aVar = p;
        if (aVar != null) {
            return aVar.l(str);
        }
        throw new e("A CodePush instance has not been created yet. Have you added it to your app's list of ReactPackages?");
    }

    static ReactInstanceManager n() {
        ReactInstanceHolder reactInstanceHolder = o;
        if (reactInstanceHolder == null) {
            return null;
        }
        return reactInstanceHolder.a();
    }

    private boolean p(JSONObject jSONObject) {
        return !l.equals(jSONObject.optString("appVersion", null));
    }

    private boolean t(ReactInstanceManager reactInstanceManager) {
        DevSupportManager E;
        if (reactInstanceManager != null && (E = reactInstanceManager.E()) != null) {
            DeveloperSettings A = E.A();
            for (Method method : A.getClass().getMethods()) {
                if (method.getName().equals("isReloadOnJSChangeEnabled")) {
                    try {
                        return ((Boolean) method.invoke(A, null)).booleanValue();
                    } catch (Exception unused) {
                        return false;
                    }
                }
            }
        }
        return false;
    }

    private boolean u(JSONObject jSONObject) {
        try {
            String optString = jSONObject.optString("binaryModifiedTime", null);
            Long valueOf = optString != null ? Long.valueOf(Long.parseLong(optString)) : null;
            String optString2 = jSONObject.optString("appVersion", null);
            long f = f();
            if (valueOf != null && valueOf.longValue() == f) {
                if (!w()) {
                    if (l.equals(optString2)) {
                    }
                }
                return true;
            }
            return false;
        } catch (NumberFormatException e) {
            throw new g("Error in reading binary modified date from package metadata", e);
        }
    }

    public static boolean w() {
        return k;
    }

    private void y() {
        this.e.h(this.c.e());
        this.c.r();
        this.e.g();
    }

    public void a(ReactInstanceManager reactInstanceManager) {
        if (this.h && this.e.e(null) && !t(reactInstanceManager)) {
            File file = new File(this.g.getFilesDir(), "ReactNativeDevBundle.js");
            if (file.exists()) {
                file.delete();
            }
        }
    }

    public void b() {
        this.c.a();
        this.e.g();
        this.e.f();
    }

    public boolean c() {
        return this.a;
    }

    public List createNativeModules(ReactApplicationContext reactApplicationContext) {
        CodePushNativeModule codePushNativeModule = new CodePushNativeModule(reactApplicationContext, this, this.c, this.d, this.e);
        CodePushDialog codePushDialog = new CodePushDialog(reactApplicationContext);
        ArrayList arrayList = new ArrayList();
        arrayList.add(codePushNativeModule);
        arrayList.add(codePushDialog);
        return arrayList;
    }

    public List createViewManagers(ReactApplicationContext reactApplicationContext) {
        return new ArrayList();
    }

    public String d() {
        return l;
    }

    public String e() {
        return this.b;
    }

    long f() {
        try {
            return Long.parseLong(this.g.getResources().getString(this.g.getResources().getIdentifier("CODE_PUSH_APK_BUILD_TIME", "string", this.g.getPackageName())).replaceAll("\"", BuildConfig.FLAVOR));
        } catch (Exception e) {
            throw new g("Error in getting binary resources modified time", e);
        }
    }

    public Context g() {
        return this.g;
    }

    public String i() {
        return this.f;
    }

    public String l(String str) {
        String str2;
        this.b = str;
        String str3 = "assets://" + str;
        try {
            str2 = this.c.f(this.b);
        } catch (d e) {
            k.h(e.getMessage());
            b();
            str2 = null;
        }
        if (str2 == null) {
            k.j(str3);
            i = true;
            return str3;
        }
        JSONObject e2 = this.c.e();
        if (u(e2)) {
            k.j(str2);
            i = false;
            return str2;
        }
        this.a = false;
        if (!this.h || p(e2)) {
            b();
        }
        k.j(str3);
        i = true;
        return str3;
    }

    public String m() {
        return n;
    }

    public String o() {
        return m;
    }

    void q() {
        this.a = false;
        JSONObject c = this.e.c();
        if (c != null) {
            try {
                JSONObject e = this.c.e();
                if (e == null || (!u(e) && p(e))) {
                    k.h("Skipping initializeUpdateAfterRestart(), binary version is newer");
                    return;
                }
                try {
                    if (c.getBoolean("isLoading")) {
                        k.h("Update did not finish loading the last time, rolling back to a previous version.");
                        j = true;
                        y();
                    } else {
                        this.a = true;
                        this.e.i(c.getString("hash"), true);
                    }
                } catch (JSONException e2) {
                    throw new g("Unable to read pending update metadata stored in SharedPreferences", e2);
                }
            } catch (d e3) {
                k.i(e3);
                b();
            }
        }
    }

    void r() {
        p = null;
    }

    boolean s() {
        return this.h;
    }

    boolean v() {
        return i;
    }

    boolean x() {
        return j;
    }

    public void z(boolean z) {
        j = z;
    }
}