- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
104 lines
3.2 KiB
Java
104 lines
3.2 KiB
Java
package com.ironsource.sdk.controller;
|
|
|
|
import android.content.Context;
|
|
import com.ironsource.i9;
|
|
import com.ironsource.mediationsdk.logger.IronLog;
|
|
import com.ironsource.mj;
|
|
import com.ironsource.sdk.utils.Logger;
|
|
import com.ironsource.v3;
|
|
import com.ironsource.wp;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class q {
|
|
private static final String b = "q";
|
|
private static final String c = "getPermissions";
|
|
private static final String d = "isPermissionGranted";
|
|
private static final String e = "permissions";
|
|
private static final String f = "permission";
|
|
private static final String g = "status";
|
|
private static final String h = "functionName";
|
|
private static final String i = "functionParams";
|
|
private static final String j = "success";
|
|
private static final String k = "fail";
|
|
private static final String l = "unhandledPermission";
|
|
private Context a;
|
|
|
|
public static class b {
|
|
String a;
|
|
JSONObject b;
|
|
String c;
|
|
String d;
|
|
|
|
private b() {
|
|
}
|
|
}
|
|
|
|
public q(Context context) {
|
|
this.a = context;
|
|
}
|
|
|
|
private b a(String str) throws JSONException {
|
|
JSONObject jSONObject = new JSONObject(str);
|
|
b bVar = new b();
|
|
bVar.a = jSONObject.optString("functionName");
|
|
bVar.b = jSONObject.optJSONObject("functionParams");
|
|
bVar.c = jSONObject.optString("success");
|
|
bVar.d = jSONObject.optString("fail");
|
|
return bVar;
|
|
}
|
|
|
|
public void a(String str, mj mjVar) throws Exception {
|
|
b a2 = a(str);
|
|
if (c.equals(a2.a)) {
|
|
a(a2.b, a2, mjVar);
|
|
return;
|
|
}
|
|
if (d.equals(a2.a)) {
|
|
b(a2.b, a2, mjVar);
|
|
return;
|
|
}
|
|
Logger.i(b, "PermissionsJSAdapter unhandled API request " + str);
|
|
}
|
|
|
|
public void a(JSONObject jSONObject, b bVar, mj mjVar) {
|
|
wp wpVar = new wp();
|
|
try {
|
|
wpVar.a("permissions", v3.a(this.a, jSONObject.getJSONArray("permissions")));
|
|
mjVar.a(true, bVar.c, wpVar);
|
|
} catch (Exception e2) {
|
|
i9.d().a(e2);
|
|
IronLog.INTERNAL.error(e2.toString());
|
|
Logger.i(b, "PermissionsJSAdapter getPermissions JSON Exception when getting permissions parameter " + e2.getMessage());
|
|
wpVar.b("errMsg", e2.getMessage());
|
|
mjVar.a(false, bVar.d, wpVar);
|
|
}
|
|
}
|
|
|
|
public void b(JSONObject jSONObject, b bVar, mj mjVar) {
|
|
String str;
|
|
boolean z;
|
|
wp wpVar = new wp();
|
|
try {
|
|
String string = jSONObject.getString(f);
|
|
wpVar.b(f, string);
|
|
if (v3.d(this.a, string)) {
|
|
wpVar.b("status", String.valueOf(v3.c(this.a, string)));
|
|
str = bVar.c;
|
|
z = true;
|
|
} else {
|
|
wpVar.b("status", l);
|
|
str = bVar.d;
|
|
z = false;
|
|
}
|
|
mjVar.a(z, str, wpVar);
|
|
} catch (Exception e2) {
|
|
i9.d().a(e2);
|
|
IronLog.INTERNAL.error(e2.toString());
|
|
wpVar.b("errMsg", e2.getMessage());
|
|
mjVar.a(false, bVar.d, wpVar);
|
|
}
|
|
}
|
|
}
|