Apk Done v1.0版本的 MD5 值为:44cfb8e1ce639995aa7f0de6a3a6388b
以下内容为反编译后的 PangleAdapter.java 源代码,内容仅作参考
package io.bidmachine.ads.networks.pangle;
import android.content.Context;
import android.text.TextUtils;
import com.bytedance.sdk.openadsdk.TTAdConfig;
import com.bytedance.sdk.openadsdk.TTAdSdk;
import com.google.android.gms.measurement.api.AppMeasurementSdk;
import io.bidmachine.AdsType;
import io.bidmachine.BidMachine;
import io.bidmachine.ContextProvider;
import io.bidmachine.HeaderBiddingAdRequestParams;
import io.bidmachine.HeaderBiddingAdapter;
import io.bidmachine.HeaderBiddingCollectParamsCallback;
import io.bidmachine.InitializationParams;
import io.bidmachine.NetworkConfigParams;
import io.bidmachine.core.AdapterLogger;
import io.bidmachine.core.Utils;
import io.bidmachine.models.DataRestrictions;
import io.bidmachine.unified.UnifiedAdRequestParams;
import io.bidmachine.unified.UnifiedBannerAd;
import io.bidmachine.unified.UnifiedFullscreenAd;
import io.bidmachine.utils.BMError;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
class PangleAdapter extends HeaderBiddingAdapter {
static final boolean $assertionsDisabled = false;
public PangleAdapter() {
super("pangle_sdk", "4.2.5.2", BuildConfig.ADAPTER_VERSION_NAME, 16, new AdsType[]{AdsType.Banner, AdsType.Interstitial, AdsType.Rewarded});
}
@Override
public UnifiedBannerAd createBanner() {
return new PangleBannerAd();
}
@Override
public UnifiedFullscreenAd createInterstitial() {
return new PangleInterstitialAd();
}
@Override
public UnifiedFullscreenAd createRewarded() {
return new PangleRewardedAd();
}
@Override
public boolean onInitialize(ContextProvider contextProvider, InitializationParams initializationParams, NetworkConfigParams networkConfigParams) throws Throwable {
super.onInitialize(contextProvider, initializationParams, networkConfigParams);
Map<String, String> obtainNetworkParams = networkConfigParams.obtainNetworkParams();
if (obtainNetworkParams == null) {
logError("Initialize failed: network parameters not found");
return false;
}
String str = obtainNetworkParams.get("app_id");
if (TextUtils.isEmpty(str)) {
logError(String.format("Initialize failed: %s not provided", "app_id"));
return false;
}
DataRestrictions dataRestrictions = initializationParams.getDataRestrictions();
final Context applicationContext = contextProvider.getApplicationContext();
final TTAdConfig build = new TTAdConfig.Builder().appId(str).debug(initializationParams.isTestMode()).coppa(toPangleCoppa(dataRestrictions)).setGDPR(toPangleGDPR(dataRestrictions)).data(createPangleData()).build();
Utils.onUiThread(new Runnable() {
@Override
public void run() {
try {
TTAdSdk.init(applicationContext, build, null);
} catch (Throwable th) {
AdapterLogger.logThrowable(th);
}
}
});
return true;
}
@Override
protected boolean isNetworkInitialized(Context context) throws Throwable {
return TTAdSdk.isInitSuccess();
}
@Override
protected void onCollectHeaderBiddingParams(ContextProvider contextProvider, UnifiedAdRequestParams unifiedAdRequestParams, HeaderBiddingAdRequestParams headerBiddingAdRequestParams, HeaderBiddingCollectParamsCallback headerBiddingCollectParamsCallback, Map<String, String> map) throws Exception {
String str = map.get("app_id");
if (TextUtils.isEmpty(str)) {
headerBiddingCollectParamsCallback.onCollectFail(BMError.adapterGetsParameter("app_id"));
return;
}
String str2 = map.get("slot_id");
if (TextUtils.isEmpty(str2)) {
headerBiddingCollectParamsCallback.onCollectFail(BMError.adapterGetsParameter("slot_id"));
return;
}
configure(unifiedAdRequestParams.getDataRestrictions());
String biddingToken = TTAdSdk.getAdManager().getBiddingToken();
if (TextUtils.isEmpty(biddingToken)) {
headerBiddingCollectParamsCallback.onCollectFail(BMError.adapterGetsParameter("network_bid_token"));
return;
}
HashMap hashMap = new HashMap();
hashMap.put("app_id", str);
hashMap.put("slot_id", str2);
hashMap.put("network_bid_token", biddingToken);
headerBiddingCollectParamsCallback.onCollectFinished(hashMap);
}
private void configure(DataRestrictions dataRestrictions) {
TTAdSdk.setCoppa(toPangleCoppa(dataRestrictions));
TTAdSdk.setGdpr(toPangleGDPR(dataRestrictions));
}
private int toPangleCoppa(DataRestrictions dataRestrictions) {
return dataRestrictions.isUserAgeRestricted() ? 1 : 0;
}
private int toPangleGDPR(DataRestrictions dataRestrictions) {
return dataRestrictions.isUserGdprProtected() ? 1 : 0;
}
private String createPangleData() {
try {
return new JSONArray().put(new JSONObject().put(AppMeasurementSdk.ConditionalUserProperty.NAME, "mediation").put(AppMeasurementSdk.ConditionalUserProperty.VALUE, BidMachine.NAME)).put(new JSONObject().put(AppMeasurementSdk.ConditionalUserProperty.NAME, "adapter_version").put(AppMeasurementSdk.ConditionalUserProperty.VALUE, "1.9.3")).toString();
} catch (Throwable unused) {
return null;
}
}
}