Apk Done v1.0版本的 MD5 值为:44cfb8e1ce639995aa7f0de6a3a6388b
以下内容为反编译后的 SettingsManager.java 源代码,内容仅作参考
package com.appnext.core;
import android.content.Context;
import android.os.AsyncTask;
import android.text.TextUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import org.json.JSONException;
import org.json.JSONObject;
public abstract class SettingsManager {
private ArrayList<ConfigCallback> dt;
protected HashMap<String, Object> ds = null;
protected HashMap<String, String> w = null;
private int m = 0;
public interface ConfigCallback {
void error(String str);
void loaded(HashMap<String, Object> hashMap);
}
protected abstract String j();
protected abstract HashMap<String, String> k();
protected abstract HashMap<String, String> l();
protected abstract String m();
public final synchronized void a(Context context, String str, ConfigCallback configCallback) {
try {
} catch (Throwable unused) {
this.m = 0;
v("Internal Error");
}
if (!g.g(context)) {
this.m = 0;
if (configCallback != null) {
configCallback.error(AppnextError.CONNECTION_ERROR);
}
return;
}
if (this.dt == null) {
this.dt = new ArrayList<>();
}
if (this.m != 2) {
if (this.m == 0) {
this.m = 1;
String str2 = j() + "?packageId=" + context.getPackageName() + "&id=" + str;
if (context != null) {
g("pck", context.getPackageName());
}
g("vid", g.W());
new StringBuilder("start loading config from ").append(str2);
new a().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, context, str2, k(), m());
}
if (configCallback != null) {
this.dt.add(configCallback);
}
} else if (configCallback != null) {
configCallback.loaded(this.ds);
}
}
public final void g(String str, String str2) {
if (this.w == null) {
this.w = new HashMap<>();
}
this.w.put(str, str2);
}
public final void h(String str, String str2) {
if (this.w == null) {
this.w = new HashMap<>();
}
if (this.w.containsKey(str)) {
return;
}
this.w.put(str, str2);
}
public final void i(String str, String str2) {
if (this.ds == null) {
this.ds = new HashMap<>();
}
this.ds.put(str, str2);
}
private class a extends AsyncTask<Object, Void, String> {
private a() {
}
@Override
protected final String doInBackground(Object[] objArr) {
return a(objArr);
}
@Override
protected final void onPostExecute(String str) {
String str2 = str;
super.onPostExecute(str2);
if (str2 == null) {
SettingsManager.this.m = 0;
SettingsManager.this.v("unknown error");
} else if (str2.startsWith("error:")) {
SettingsManager.this.m = 0;
SettingsManager.this.v(str2.substring(7));
} else {
try {
HashMap<String, Object> u = SettingsManager.u(str2);
if (SettingsManager.this.ds == null) {
SettingsManager.this.ds = u;
} else {
SettingsManager.this.ds.putAll(u);
}
SettingsManager.this.m = 2;
SettingsManager.this.a(SettingsManager.this.ds);
} catch (Throwable th) {
com.appnext.base.a.a("SettingsManager$onPostExecute", th);
SettingsManager.this.m = 0;
SettingsManager.this.v("parsing error");
}
}
}
protected static String a(Object... objArr) {
if (objArr == null) {
return "error: Internal error";
}
try {
int length = objArr.length;
Context context = length >= 0 ? (Context) objArr[0] : null;
if (context == null) {
return "error: Internal error";
}
String str = length > 0 ? (String) objArr[1] : null;
if (TextUtils.isEmpty(str)) {
return "error: Internal error";
}
HashMap hashMap = length >= 2 ? (HashMap) objArr[2] : null;
String str2 = length >= 3 ? (String) objArr[3] : null;
m.Z();
return m.a(context, str, hashMap, str2);
} catch (Throwable unused) {
return "error: Internal error";
}
}
}
protected static HashMap<String, Object> u(String str) throws JSONException {
HashMap<String, Object> hashMap = new HashMap<>();
JSONObject jSONObject = new JSONObject(str);
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
String string = jSONObject.getString(next);
try {
JSONObject jSONObject2 = new JSONObject(string);
Iterator<String> keys2 = jSONObject2.keys();
while (keys2.hasNext()) {
String next2 = keys2.next();
String string2 = jSONObject2.getString(next2);
hashMap.put(next + "_" + next2, string2);
}
} catch (Throwable unused) {
hashMap.put(next, string);
}
}
return hashMap;
}
public void v(String str) {
synchronized ("https://cdn.appnext.com/tools/sdk/confign") {
Iterator it = new ArrayList(this.dt).iterator();
while (it.hasNext()) {
ConfigCallback configCallback = (ConfigCallback) it.next();
if (configCallback != null) {
configCallback.error(str);
}
}
this.dt.clear();
}
}
public void a(HashMap<String, Object> hashMap) {
synchronized ("https://cdn.appnext.com/tools/sdk/confign") {
Iterator it = new ArrayList(this.dt).iterator();
while (it.hasNext()) {
((ConfigCallback) it.next()).loaded(hashMap);
}
this.dt.clear();
}
}
public final String t(String str) {
HashMap<String, Object> hashMap = this.ds;
String str2 = (hashMap == null || !hashMap.containsKey(str)) ? null : (String) this.ds.get(str);
if (str2 != null) {
return str2;
}
if (l().containsKey(str)) {
return l().get(str);
}
return null;
}
}