Proxy Master v3.4.9版本的 MD5 值为:14d0aa2468d13530c8f6e96bcc114bf5
以下内容为反编译后的 OfferRequest.java 源代码,内容仅作参考
package com.my.tracker.recsys;
import android.net.Uri;
import android.os.Handler;
import android.text.TextUtils;
import androidx.activity.k;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.my.tracker.MyTracker;
import com.my.tracker.obfuscated.g;
import com.my.tracker.obfuscated.z;
import com.my.tracker.obfuscated.z0;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONArray;
import org.json.JSONObject;
import x5.b;
public final class OfferRequest {
final OnCompleteListener f11376a;
final Handler f11377b;
public final String data;
public final List<String> placementIds;
public final Boolean reset;
public final String userId;
private final AtomicBoolean f11379d = new AtomicBoolean(false);
final String f11378c = "https://recsys.tracker.my.com/api/public/v3/rec/item";
public interface OnCompleteListener {
void onComplete(OfferRequest offerRequest, List<Offer> list, String str);
}
public class a implements z.a {
public a() {
OfferRequest.this = r1;
}
@Override
public String a() {
return "application/json";
}
@Override
public void a(OutputStream outputStream) {
if (TextUtils.isEmpty(OfferRequest.this.data)) {
return;
}
outputStream.write(OfferRequest.this.data.getBytes("UTF-8"));
}
}
public OfferRequest(String str, List<String> list, String str2, Boolean bool, OnCompleteListener onCompleteListener, Handler handler) {
this.userId = str;
this.placementIds = list;
this.data = str2;
this.reset = bool;
this.f11376a = onCompleteListener;
this.f11377b = handler;
}
public static List<Offer> a(String str) {
try {
JSONArray jSONArray = new JSONObject(str).getJSONArray("data");
ArrayList arrayList = new ArrayList();
int length = jSONArray.length();
for (int i10 = 0; i10 < length; i10++) {
JSONObject jSONObject = jSONArray.getJSONObject(i10);
String optString = jSONObject.optString("placement_id");
int optInt = jSONObject.optInt("test_id");
int optInt2 = jSONObject.optInt("split_id");
JSONObject jSONObject2 = jSONObject.getJSONObject("offer");
arrayList.add(new Offer(optString, jSONObject2.optString(FirebaseAnalytics.Param.ITEM_ID), jSONObject2.optDouble("price"), jSONObject2.optDouble("discount_price"), jSONObject2.optInt("value"), jSONObject2.optInt("discount_value"), optInt, optInt2));
}
return arrayList;
} catch (Throwable unused) {
z0.a("OfferRequest: error occurred while parsing values from json response");
return null;
}
}
public void a() {
String id2 = MyTracker.getTrackerConfig().getId();
if (TextUtils.isEmpty(id2)) {
z0.b("OfferRequest: MyTracker hasn't been initialized yet, MyTracker.initTracker() should be called first");
a(this, this.f11377b, this.f11376a, (z.b<String>) null);
return;
}
a(this, this.f11377b, this.f11376a, z.a(new a(), null, false).a(a(this.f11378c, id2)));
}
public static void a(OfferRequest offerRequest, Handler handler, OnCompleteListener onCompleteListener, z.b<String> bVar) {
List<Offer> list;
String str;
String str2;
if (bVar == null) {
str2 = "MyTracker hasn't been initialized yet";
} else if (bVar.b()) {
String a8 = bVar.a();
if (TextUtils.isEmpty(a8)) {
z0.a("OfferRequest: http response is empty ");
str2 = "Empty response";
} else {
List<Offer> a10 = a(a8);
if (a10 != null) {
list = a10;
str = null;
handler.post(new b(onCompleteListener, offerRequest, list, str, 3));
}
z0.a("OfferRequest: error while parsing offers from response");
str2 = "Offers parsing error";
}
} else {
z0.a("OfferRequest: http response is unsuccessful");
str2 = "Unsuccessful response";
}
str = str2;
list = null;
handler.post(new b(onCompleteListener, offerRequest, list, str, 3));
}
public static void c(OfferRequest offerRequest) {
offerRequest.a();
}
public String a(String str, String str2) {
Uri.Builder buildUpon = Uri.parse(str).buildUpon();
buildUpon.appendQueryParameter("custom_user_id", this.userId);
buildUpon.appendQueryParameter("sdk_key", str2);
Boolean bool = this.reset;
if (bool != null) {
buildUpon.appendQueryParameter("reset", String.valueOf(bool));
}
if (!this.placementIds.isEmpty()) {
int size = this.placementIds.size();
for (int i10 = 0; i10 < size; i10++) {
buildUpon.appendQueryParameter("placement_id", this.placementIds.get(i10));
}
}
return buildUpon.toString();
}
public void send() {
if (this.f11376a == null) {
z0.a("OfferRequest: listener is null, offers from response can not be returned");
} else if (this.f11379d.compareAndSet(false, true)) {
g.b(new k(this, 27));
} else {
z0.a("OfferRequest: send has already been called");
}
}
}