Perfume Of Love v2.14.9版本的 MD5 值为:16011aefc5a55805771706ce3b259b4e
以下内容为反编译后的 SupersonicAdsAdapter.java 源代码,内容仅作参考
package com.ironsource.adapters.supersonicads;
import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;
import com.ironsource.environment.ContextProvider;
import com.ironsource.mediationsdk.AbstractAdapter;
import com.ironsource.mediationsdk.IntegrationData;
import com.ironsource.mediationsdk.logger.IronLog;
import com.ironsource.mediationsdk.metadata.MetaDataUtils;
import com.ironsource.mediationsdk.sdk.g;
import com.ironsource.mediationsdk.utils.ErrorBuilder;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
import com.ironsource.mediationsdk.utils.IronSourceUtils;
import com.ironsource.mediationsdk.y;
import com.ironsource.sdk.IronSourceNetwork;
import com.ironsource.sdk.SSAFactory;
import com.ironsource.sdk.f;
import com.ironsource.sdk.j.e;
import com.ironsource.sdk.utils.SDKUtils;
import com.vungle.warren.model.ReportDBAdapter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONException;
import org.json.JSONObject;
class SupersonicAdsAdapter extends AbstractAdapter implements ContextProvider.a, g, e {
private static final String VERSION = "7.3.0.1";
private final String APPLICATION_PRIVATE_KEY;
private final String CAMPAIGN_ID;
private final String CLIENT_SIDE_CALLBACKS;
private final String DYNAMIC_CONTROLLER_CONFIG;
private final String DYNAMIC_CONTROLLER_DEBUG_MODE;
private final String DYNAMIC_CONTROLLER_URL;
private final String ITEM_COUNT;
private final String ITEM_NAME;
private final String ITEM_SIGNATURE;
private final String LANGUAGE;
private final String MAX_VIDEO_LENGTH;
private final String OW_PLACEMENT_ID;
private final String SDK_PLUGIN_TYPE;
private final String SESSION_ID;
private final String TIMESTAMP;
private boolean mConsent;
private boolean mDidSetConsent;
private com.ironsource.mediationsdk.sdk.e mOfferwallListener;
private f mSSAPublisher;
private static AtomicBoolean mDidSetInitParams = new AtomicBoolean(false);
private static AtomicBoolean mDidInitSdk = new AtomicBoolean(false);
private SupersonicAdsAdapter(String str) {
super(str);
this.TIMESTAMP = "timestamp";
this.ITEM_SIGNATURE = "itemSignature";
this.SDK_PLUGIN_TYPE = "SDKPluginType";
this.OW_PLACEMENT_ID = ReportDBAdapter.ReportColumns.COLUMN_PLACEMENT_ID;
this.SESSION_ID = "sessionid";
this.DYNAMIC_CONTROLLER_URL = "controllerUrl";
this.DYNAMIC_CONTROLLER_DEBUG_MODE = "debugMode";
this.DYNAMIC_CONTROLLER_CONFIG = "controllerConfig";
this.LANGUAGE = "language";
this.MAX_VIDEO_LENGTH = "maxVideoLength";
this.CAMPAIGN_ID = "campaignId";
this.ITEM_NAME = "itemName";
this.ITEM_COUNT = "itemCount";
this.APPLICATION_PRIVATE_KEY = "privateKey";
this.CLIENT_SIDE_CALLBACKS = "useClientSideCallbacks";
IronLog.INTERNAL.verbose("");
ContextProvider.getInstance().registerLifeCycleListener(this);
}
private void addItemNameCountSignature(HashMap<String, String> hashMap, JSONObject jSONObject) {
try {
String optString = jSONObject.optString("itemName");
int optInt = jSONObject.optInt("itemCount", -1);
String optString2 = jSONObject.optString("privateKey");
boolean z = true;
boolean z2 = false;
if (TextUtils.isEmpty(optString)) {
z = false;
} else {
hashMap.put("itemName", optString);
}
if (TextUtils.isEmpty(optString2)) {
z = false;
}
if (optInt != -1) {
hashMap.put("itemCount", String.valueOf(optInt));
z2 = z;
}
if (z2) {
int currentTimestamp = IronSourceUtils.getCurrentTimestamp();
hashMap.put("timestamp", String.valueOf(currentTimestamp));
hashMap.put("itemSignature", createItemSig(currentTimestamp, optString, optInt, optString2));
}
} catch (Exception e) {
IronLog ironLog = IronLog.ADAPTER_API;
ironLog.error(" addItemNameCountSignature" + e);
}
}
public void applyConsent(boolean z) {
if (this.mSSAPublisher == null) {
return;
}
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("gdprConsentStatus", String.valueOf(z));
jSONObject.put("demandSourceName", getProviderName());
} catch (JSONException e) {
e.printStackTrace();
}
this.mSSAPublisher.a(jSONObject);
}
private String createItemSig(int i, String str, int i2, String str2) {
return IronSourceUtils.getMD5(i + str + i2 + str2);
}
public static String getAdapterSDKVersion() {
return SDKUtils.getSDKVersion();
}
private HashMap<String, String> getGenenralExtraParams() {
HashMap<String, String> hashMap = new HashMap<>();
String pluginType = getPluginType();
if (!TextUtils.isEmpty(pluginType)) {
hashMap.put("SDKPluginType", pluginType);
}
return hashMap;
}
private HashMap<String, String> getInitParams() {
HashMap<String, String> hashMap = new HashMap<>();
String pluginType = getPluginType();
if (!TextUtils.isEmpty(pluginType)) {
hashMap.put("SDKPluginType", pluginType);
}
if (!TextUtils.isEmpty(y.a().m)) {
hashMap.put("sessionid", y.a().m);
}
return hashMap;
}
public static IntegrationData getIntegrationData(Context context) {
return new IntegrationData(IronSourceConstants.SUPERSONIC_CONFIG_NAME, "7.3.0.1");
}
public HashMap<String, String> getOfferwallExtraParams(JSONObject jSONObject) {
HashMap<String, String> genenralExtraParams = getGenenralExtraParams();
String optString = jSONObject.optString("language");
if (!TextUtils.isEmpty(optString)) {
genenralExtraParams.put("language", optString);
}
genenralExtraParams.put("useClientSideCallbacks", String.valueOf(SupersonicConfig.getConfigObj().getClientSideCallbacks()));
Map<String, String> offerwallCustomParams = SupersonicConfig.getConfigObj().getOfferwallCustomParams();
if (offerwallCustomParams != null && !offerwallCustomParams.isEmpty()) {
genenralExtraParams.putAll(offerwallCustomParams);
}
addItemNameCountSignature(genenralExtraParams, jSONObject);
return genenralExtraParams;
}
private void setParamsBeforeInit(JSONObject jSONObject) {
if (mDidSetInitParams.compareAndSet(false, true)) {
SDKUtils.setControllerUrl(jSONObject.optString("controllerUrl"));
int optInt = jSONObject.optInt("debugMode", 0);
if (isAdaptersDebugEnabled()) {
optInt = 3;
}
SDKUtils.setDebugMode(optInt);
JSONObject optJSONObject = jSONObject.optJSONObject("controllerConfig");
String jSONObject2 = optJSONObject != null ? optJSONObject.toString() : "";
SDKUtils.setControllerConfig(jSONObject2);
IronLog ironLog = IronLog.ADAPTER_API;
ironLog.verbose(getProviderName() + "setting controller url to " + jSONObject.optString("controllerUrl"));
IronLog ironLog2 = IronLog.ADAPTER_API;
ironLog2.verbose(getProviderName() + "setting controller config to " + jSONObject2);
IronLog ironLog3 = IronLog.ADAPTER_API;
ironLog3.verbose(getProviderName() + "setting debug mode to " + optInt);
}
}
public static SupersonicAdsAdapter startAdapter(String str) {
return new SupersonicAdsAdapter(str);
}
@Override
public void earlyInit(String str, String str2, JSONObject jSONObject) {
IronSourceUtils.sendAutomationLog(getProviderName() + ": earlyInit");
if (mDidInitSdk.compareAndSet(false, true)) {
SDKUtils.setDebugMode(isAdaptersDebugEnabled() ? 3 : jSONObject.optInt("debugMode", 0));
SDKUtils.setControllerUrl(jSONObject.optString("controllerUrl"));
IronLog ironLog = IronLog.ADAPTER_API;
ironLog.verbose(getProviderName() + " IronSourceNetwork setting controller url to " + jSONObject.optString("controllerUrl"));
SDKUtils.setControllerConfig(jSONObject.optString("controllerConfig", ""));
IronLog ironLog2 = IronLog.ADAPTER_API;
ironLog2.verbose(getProviderName() + " IronSourceNetwork setting controller config to " + jSONObject.optString("controllerConfig"));
HashMap<String, String> initParams = getInitParams();
IronSourceNetwork.initSDK(ContextProvider.getInstance().getApplicationContext(), y.a().g, str2, initParams);
IronLog ironLog3 = IronLog.ADAPTER_API;
ironLog3.verbose("initSDK with appKey=" + y.a().g + " userId=" + str2 + " parameters " + initParams);
}
}
@Override
public String getCoreSDKVersion() {
return SDKUtils.getSDKVersion();
}
@Override
public void getOfferwallCredits() {
if (this.mSSAPublisher == null) {
IronLog.INTERNAL.error("Please call init before calling getOfferwallCredits");
return;
}
y.a();
String str = y.a().h;
IronLog ironLog = IronLog.ADAPTER_API;
ironLog.verbose(getProviderName() + " mSSAPublisher.getOfferWallCredits userId=" + str);
this.mSSAPublisher.a(y.a().g, str, this);
}
@Override
public String getVersion() {
return "7.3.0.1";
}
@Override
public void initOfferwall(String str, final String str2, final JSONObject jSONObject) {
IronLog ironLog = IronLog.ADAPTER_API;
ironLog.verbose(getProviderName() + " userId=" + str2);
setParamsBeforeInit(jSONObject);
postOnUIThread(new Runnable() {
@Override
public void run() {
try {
HashMap offerwallExtraParams = SupersonicAdsAdapter.this.getOfferwallExtraParams(jSONObject);
SupersonicAdsAdapter.this.mSSAPublisher = SSAFactory.getPublisherInstance(ContextProvider.getInstance().getCurrentActiveActivity());
if (SupersonicAdsAdapter.this.mDidSetConsent) {
SupersonicAdsAdapter supersonicAdsAdapter = SupersonicAdsAdapter.this;
supersonicAdsAdapter.applyConsent(supersonicAdsAdapter.mConsent);
}
IronLog ironLog2 = IronLog.ADAPTER_API;
ironLog2.verbose(SupersonicAdsAdapter.this.getProviderName() + " mSSAPublisher.initOfferWall");
SupersonicAdsAdapter.this.mSSAPublisher.a(y.a().g, str2, offerwallExtraParams, SupersonicAdsAdapter.this);
SupersonicAdsAdapter.mDidInitSdk.set(true);
} catch (Exception e) {
e.printStackTrace();
IronLog ironLog3 = IronLog.ADAPTER_API;
ironLog3.error(SupersonicAdsAdapter.this.getProviderName() + ":initOfferwall(userId:" + str2 + ")" + e);
com.ironsource.mediationsdk.sdk.e eVar = SupersonicAdsAdapter.this.mOfferwallListener;
StringBuilder sb = new StringBuilder("Adapter initialization failure - ");
sb.append(SupersonicAdsAdapter.this.getProviderName());
sb.append(" - ");
sb.append(e.getMessage());
eVar.a(false, ErrorBuilder.buildInitFailedError(sb.toString(), IronSourceConstants.OFFERWALL_AD_UNIT));
}
}
});
}
public boolean isOfferwallAvailable() {
return true;
}
@Override
public void onGetOWCreditsFailed(String str) {
IronLog.ADAPTER_CALLBACK.verbose(getProviderName());
if (this.mOfferwallListener != null) {
this.mOfferwallListener.onGetOfferwallCreditsFailed(ErrorBuilder.buildGenericError(str));
}
}
@Override
public void onOWAdClosed() {
IronLog.ADAPTER_CALLBACK.verbose(getProviderName());
com.ironsource.mediationsdk.sdk.e eVar = this.mOfferwallListener;
if (eVar != null) {
eVar.onOfferwallClosed();
}
}
@Override
public boolean onOWAdCredited(int i, int i2, boolean z) {
IronLog.ADAPTER_CALLBACK.verbose(getProviderName());
com.ironsource.mediationsdk.sdk.e eVar = this.mOfferwallListener;
return eVar != null && eVar.onOfferwallAdCredited(i, i2, z);
}
@Override
public void onOWShowFail(String str) {
IronLog.ADAPTER_CALLBACK.verbose(getProviderName());
if (this.mOfferwallListener != null) {
this.mOfferwallListener.onOfferwallShowFailed(ErrorBuilder.buildGenericError(str));
}
}
@Override
public void onOWShowSuccess(String str) {
if (TextUtils.isEmpty(str)) {
IronLog.ADAPTER_CALLBACK.verbose(getProviderName());
} else {
IronLog ironLog = IronLog.ADAPTER_CALLBACK;
ironLog.verbose(getProviderName() + ":onOWShowSuccess(placementId:" + str + ")");
}
com.ironsource.mediationsdk.sdk.e eVar = this.mOfferwallListener;
if (eVar != null) {
eVar.onOfferwallOpened();
}
}
@Override
public void onOfferwallEventNotificationReceived(String str, JSONObject jSONObject) {
if (jSONObject != null) {
IronLog.ADAPTER_CALLBACK.verbose(getProviderName());
}
}
@Override
public void onOfferwallInitFail(String str) {
IronLog.ADAPTER_CALLBACK.verbose(getProviderName());
if (this.mOfferwallListener != null) {
this.mOfferwallListener.a(false, ErrorBuilder.buildGenericError(str));
}
}
@Override
public void onOfferwallInitSuccess() {
IronLog.ADAPTER_CALLBACK.verbose(getProviderName());
com.ironsource.mediationsdk.sdk.e eVar = this.mOfferwallListener;
if (eVar != null) {
eVar.onOfferwallAvailable(true);
}
}
@Override
public void onPause(Activity activity) {
if (this.mSSAPublisher != null) {
IronLog ironLog = IronLog.ADAPTER_API;
ironLog.verbose(getProviderName() + " mSSAPublisher.onPause");
this.mSSAPublisher.b(activity);
}
}
@Override
public void onResume(Activity activity) {
if (this.mSSAPublisher != null) {
IronLog ironLog = IronLog.ADAPTER_API;
ironLog.verbose(getProviderName() + " mSSAPublisher.onResume");
this.mSSAPublisher.c(activity);
}
}
@Override
public void setConsent(boolean z) {
IronLog ironLog = IronLog.ADAPTER_API;
StringBuilder sb = new StringBuilder();
sb.append(getProviderName());
sb.append(": setConsent (");
sb.append(z ? "true" : "false");
sb.append(")");
ironLog.verbose(sb.toString());
this.mDidSetConsent = true;
this.mConsent = z;
applyConsent(z);
}
@Override
public void setInternalOfferwallListener(com.ironsource.mediationsdk.sdk.e eVar) {
this.mOfferwallListener = eVar;
}
@Override
public void setMetaData(String str, List<String> list) {
if (list.isEmpty()) {
return;
}
String str2 = list.get(0);
if (mDidInitSdk.get()) {
return;
}
IronLog ironLog = IronLog.ADAPTER_API;
ironLog.verbose("key=" + str + ", value=" + str2);
if (!MetaDataUtils.isValidCCPAMetaData(str, str2)) {
IronLog.ADAPTER_API.verbose("not valid");
return;
}
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put(str, str2);
IronSourceNetwork.updateMetadata(jSONObject);
} catch (JSONException e) {
IronLog ironLog2 = IronLog.ADAPTER_API;
ironLog2.error("error - " + e);
e.printStackTrace();
}
}
@Override
public void showOfferwall(String str, JSONObject jSONObject) {
HashMap<String, String> offerwallExtraParams = getOfferwallExtraParams(jSONObject);
if (offerwallExtraParams != null) {
offerwallExtraParams.put(ReportDBAdapter.ReportColumns.COLUMN_PLACEMENT_ID, str);
}
if (this.mSSAPublisher == null) {
IronLog.INTERNAL.error("Please call init before calling showOfferwall");
return;
}
IronLog ironLog = IronLog.ADAPTER_API;
ironLog.verbose(getProviderName() + " mSSAPublisher.showOfferWall");
this.mSSAPublisher.a(ContextProvider.getInstance().getCurrentActiveActivity(), offerwallExtraParams);
}
}