Money Lover v8.14.0.6版本的 MD5 值为:48b9d922212c7ccfd438cdcc183ff396

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


package wj;

import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import com.zoostudio.moneylover.db.sync.item.g;
import com.zoostudio.moneylover.exception.MoneyError;
import com.zoostudio.moneylover.utils.b1;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class r {

    public class a implements c {

        final c f37530a;

        final String f37531b;

        a(c cVar, String str) {
            this.f37530a = cVar;
            this.f37531b = str;
        }

        @Override
        public void a(MoneyError moneyError) {
            r.c(this.f37531b, this.f37530a);
        }

        @Override
        public void b(ArrayList<n9.h> arrayList, ArrayList<v7.e> arrayList2) {
            this.f37530a.b(arrayList, arrayList2);
        }
    }

    public class b implements g.e {

        final c f37532a;

        final String f37533b;

        b(c cVar, String str) {
            this.f37532a = cVar;
            this.f37533b = str;
        }

        @Override
        public void onFail(MoneyError moneyError) {
            if (moneyError.a() != 404) {
                if (this.f37533b.isEmpty()) {
                    this.f37532a.a(moneyError);
                    return;
                } else {
                    r.c("", this.f37532a);
                    return;
                }
            }
            this.f37532a.a(moneyError);
        }

        @Override
        public void onSuccess(JSONObject jSONObject) {
            try {
                jSONObject.toString();
                ArrayList<n9.h> b10 = r.b(jSONObject.getJSONArray("data"));
                ArrayList<v7.e> arrayList = null;
                if (jSONObject.has("categories")) {
                    arrayList = r.a(jSONObject.getJSONArray("categories"));
                }
                com.zoostudio.moneylover.utils.p.s("provider_list.json", "/provider", jSONObject.toString(), true);
                this.f37532a.b(b10, arrayList);
            } catch (IOException | JSONException e10) {
                e10.printStackTrace();
                new MoneyError(e10).e(1);
                this.f37532a.a(new MoneyError(e10));
            }
        }
    }

    public interface c {
        void a(MoneyError moneyError);

        void b(ArrayList<n9.h> arrayList, ArrayList<v7.e> arrayList2);
    }

    public static ArrayList<v7.e> a(JSONArray jSONArray) throws JSONException {
        ArrayList<v7.e> arrayList = new ArrayList<>(jSONArray.length());
        for (int i10 = 0; i10 < jSONArray.length(); i10++) {
            arrayList.add((v7.e) n9.k.a().fromJson(jSONArray.getString(i10), v7.e.class));
        }
        return arrayList;
    }

    public static ArrayList<n9.h> b(JSONArray jSONArray) throws JSONException {
        ArrayList<n9.h> arrayList = new ArrayList<>(jSONArray.length());
        for (int i10 = 0; i10 < jSONArray.length(); i10++) {
            arrayList.add((n9.h) n9.k.a().fromJson(jSONArray.getString(i10), n9.h.class));
        }
        Collections.sort(arrayList, new n9.i());
        return arrayList;
    }

    public static void c(String str, c cVar) {
        String str2;
        if (m7.a.f27647b) {
            str2 = "https://statictest.moneylover.me/data/rw-provider/provider_cache_dev";
        } else {
            str2 = "https://static.moneylover.me/data/rw-provider/provider_cache_production";
        }
        f(str2 + str + ".json", new b(cVar, str));
    }

    private static void d(String str, c cVar) {
        e(new a(cVar, str));
    }

    private static void e(c cVar) {
        try {
            String q10 = com.zoostudio.moneylover.utils.p.q("provider_list.json", "/provider");
            if (b1.g(q10)) {
                cVar.a(new MoneyError("ko có file"));
                return;
            }
            JSONObject jSONObject = new JSONObject(q10);
            if (System.currentTimeMillis() - jSONObject.getLong("last_update") > FirebaseRemoteConfig.getInstance().getLong("lw_duration_need_refresh_provider") * 24 * 60 * 60 * 1000) {
                cVar.a(new MoneyError("quá hạn"));
            } else {
                cVar.b(b(jSONObject.getJSONArray("data")), a(jSONObject.getJSONArray("categories")));
            }
        } catch (IOException | JSONException e10) {
            e10.printStackTrace();
            cVar.a(new MoneyError(e10));
        }
    }

    private static void f(String str, g.e eVar) {
        com.zoostudio.moneylover.db.sync.item.g.request(new com.zoostudio.moneylover.db.sync.item.h(2, str, null), eVar);
    }

    public static void g(String str, c cVar) {
        c(str, cVar);
    }

    public static void h(String str, c cVar) {
        d(str, cVar);
    }
}