- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
83 lines
2.2 KiB
Java
83 lines
2.2 KiB
Java
package com.ironsource;
|
|
|
|
import com.ironsource.sdk.utils.IronSourceStorageUtils;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class hl {
|
|
private String a;
|
|
|
|
public hl(String str) {
|
|
this.a = str;
|
|
}
|
|
|
|
private zf a() throws Exception {
|
|
zf zfVar = new zf(this.a, "metadata.json");
|
|
if (!zfVar.exists()) {
|
|
a(zfVar);
|
|
}
|
|
return zfVar;
|
|
}
|
|
|
|
private void a(zf zfVar) throws Exception {
|
|
IronSourceStorageUtils.saveFile(new JSONObject().toString().getBytes(), zfVar.getPath());
|
|
}
|
|
|
|
private boolean a(JSONObject jSONObject) throws Exception {
|
|
return IronSourceStorageUtils.saveFile(jSONObject.toString().getBytes(), a().getPath()) != 0;
|
|
}
|
|
|
|
public synchronized boolean a(String str) throws Exception {
|
|
JSONObject b = b();
|
|
if (!b.has(str)) {
|
|
return true;
|
|
}
|
|
b.remove(str);
|
|
return a(b);
|
|
}
|
|
|
|
public synchronized boolean a(String str, JSONObject jSONObject) throws Exception {
|
|
JSONObject b;
|
|
b = b();
|
|
b.put(str, jSONObject);
|
|
return a(b);
|
|
}
|
|
|
|
public boolean a(ArrayList<zf> arrayList) throws Exception {
|
|
Iterator<zf> it = arrayList.iterator();
|
|
boolean z = true;
|
|
while (it.hasNext()) {
|
|
if (!a(it.next().getName())) {
|
|
z = false;
|
|
}
|
|
}
|
|
return z;
|
|
}
|
|
|
|
public synchronized JSONObject b() throws Exception {
|
|
return new JSONObject(IronSourceStorageUtils.readFile(a()));
|
|
}
|
|
|
|
public synchronized boolean b(String str, JSONObject jSONObject) throws Exception {
|
|
JSONObject b;
|
|
try {
|
|
b = b();
|
|
JSONObject optJSONObject = b.optJSONObject(str);
|
|
if (optJSONObject != null) {
|
|
Iterator<String> keys = jSONObject.keys();
|
|
while (keys.hasNext()) {
|
|
String next = keys.next();
|
|
optJSONObject.putOpt(next, jSONObject.opt(next));
|
|
}
|
|
} else {
|
|
b.putOpt(str, jSONObject);
|
|
}
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
return a(b);
|
|
}
|
|
}
|