GoooBet v1.0版本的 MD5 值为:ff9748f16167bfd7735b669c0a9931c5
以下内容为反编译后的 AppsgeyserServerClient.java 源代码,内容仅作参考
package com.appsgeyser.sdk.server.implementation;
import android.content.Context;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.appsgeyser.sdk.InternalEntryPoint;
import com.appsgeyser.sdk.PausedContentInfoActivity;
import com.appsgeyser.sdk.R;
import com.appsgeyser.sdk.ads.fastTrack.FastTrackAdsController;
import com.appsgeyser.sdk.configuration.Configuration;
import com.appsgeyser.sdk.configuration.PreferencesCoder;
import com.appsgeyser.sdk.configuration.models.ConfigPhp;
import com.appsgeyser.sdk.datasdk.DataSdkController;
import com.appsgeyser.sdk.deviceidparser.DeviceIdParameters;
import com.appsgeyser.sdk.deviceidparser.DeviceIdParser;
import com.appsgeyser.sdk.hasher.Hasher;
import com.appsgeyser.sdk.push.OneSignalCreator;
import com.appsgeyser.sdk.server.StatController;
import com.appsgeyser.sdk.server.network.NetworkManager;
import com.appsgeyser.sdk.utils.DeviceInfoGetter;
import com.appsgeyser.sdk.utils.ReminderAlarmManager;
import com.appsgeyser.sdk.utils.VersionManager;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSyntaxException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
public class AppsgeyserServerClient {
private ConfigPhp configPhpModel;
List<ConfigPhpRequestListener> listenerList;
private final NetworkManager networkManager;
public interface ConfigPhpRequestListener {
void receivedConfigPhp(ConfigPhp configPhp);
}
public static class SingletonHolder {
static final AppsgeyserServerClient HOLDER_INSTANCE = new AppsgeyserServerClient();
}
private AppsgeyserServerClient() {
this.listenerList = new ArrayList();
this.networkManager = NetworkManager.getInstance();
}
public static AppsgeyserServerClient getInstance() {
return SingletonHolder.HOLDER_INSTANCE;
}
private String getInstallerMarket(Context context) {
try {
String installerPackageName = context.getPackageManager().getInstallerPackageName(context.getPackageName());
return installerPackageName == null ? "" : installerPackageName;
} catch (Exception e) {
if (TextUtils.isEmpty(e.getMessage())) {
return "ERROR";
}
return "ERROR:" + e.getMessage();
}
}
public void sendAfterInstallInfo(Context context) {
sendRequestWithAllArgs("install", NetworkManager.RequestType.AFTERINSTALL.ordinal(), context);
}
public void sendUsageInfo(Context context) {
sendRequestWithAllArgs("usage", NetworkManager.RequestType.USAGE.ordinal(), context);
}
public void sendAboutDialogVisitSite(Context context) {
sendRequestSdkStatisticsWithArgs("about_dialog_visit_site", -980696864, context);
}
public void sendUpdateInfo(Context context) {
int currentVersion = VersionManager.getCurrentVersion(context);
int previousVersion = VersionManager.getPreviousVersion(context);
if (previousVersion == -1) {
VersionManager.updateVersion(context, currentVersion);
} else if (currentVersion > previousVersion) {
VersionManager.updateVersion(context, currentVersion);
sendRequestWithAllArgs("update", NetworkManager.RequestType.UPDATE.ordinal(), context);
}
}
public void getConfigPhp(final Context context, DeviceIdParameters deviceIdParameters, ConfigPhpRequestListener configPhpRequestListener) {
ConfigPhp configPhp = this.configPhpModel;
if (configPhp != null) {
configPhpRequestListener.receivedConfigPhp(configPhp);
return;
}
if (this.listenerList.size() > 0) {
this.listenerList.add(configPhpRequestListener);
return;
}
Configuration configuration = Configuration.getInstance(context);
this.listenerList.add(configPhpRequestListener);
String str = "";
String advId = deviceIdParameters != null ? deviceIdParameters.getAdvId() : "";
if (!TextUtils.isEmpty(advId)) {
str = "&advid=" + advId;
}
configuration.loadConfiguration();
String str2 = getBaseConfigUrl(context) + "?widgetId=" + configuration.getApplicationId() + "&guid=" + configuration.getAppGuid() + "&v=2.25.s&market=" + getInstallerMarket(context) + str;
final PreferencesCoder preferencesCoder = new PreferencesCoder(context);
preferencesCoder.savePrefString("ConfigPhpURLWithParams", str2);
this.networkManager.sendRequestAsync(str2, Integer.valueOf(NetworkManager.RequestType.CONFIG_PHP.ordinal()), context, new OnRequestDoneListener() {
@Override
public void onRequestDone(String str3, int i, String str4) {
preferencesCoder.savePrefString("ServerResponse", str4);
try {
AppsgeyserServerClient.this.configPhpModel = ConfigPhp.parseFromJson(str4);
if (AppsgeyserServerClient.this.configPhpModel.getStatUrls() != null) {
StatController.getInstance().init(new HashMap<>(AppsgeyserServerClient.this.configPhpModel.getStatUrls()));
}
} catch (JsonSyntaxException unused) {
Iterator<ConfigPhpRequestListener> it = AppsgeyserServerClient.this.listenerList.iterator();
while (it.hasNext()) {
AppsgeyserServerClient.this.onGetConfigErrorResponse(context, it.next(), preferencesCoder);
}
}
if (!AppsgeyserServerClient.this.configPhpModel.isAppBanActive()) {
DataSdkController.startDataSdkController(context, AppsgeyserServerClient.this.configPhpModel);
if (!FastTrackAdsController.getInstance().isActive()) {
FastTrackAdsController.getInstance().requestInit(AppsgeyserServerClient.this.configPhpModel, context);
}
Iterator<ConfigPhpRequestListener> it2 = AppsgeyserServerClient.this.listenerList.iterator();
while (it2.hasNext()) {
it2.next().receivedConfigPhp(AppsgeyserServerClient.this.configPhpModel);
}
if (AppsgeyserServerClient.this.configPhpModel.isPushNotificationsActive()) {
AppsgeyserServerClient.this.initPush(context);
}
if (AppsgeyserServerClient.this.configPhpModel.getAdditionalJsCode() != null) {
InternalEntryPoint.getInstance().setAdditionalJsCode(AppsgeyserServerClient.this.configPhpModel.getAdditionalJsCode());
}
if (AppsgeyserServerClient.this.configPhpModel.isInactivityReminderEnabled()) {
ReminderAlarmManager.startReminderAlarm(context, AppsgeyserServerClient.this.configPhpModel.getInactivityDaysPeriod(), true);
}
AppsgeyserServerClient.this.listenerList.clear();
return;
}
PausedContentInfoActivity.startPausedContentInfoActivity(context, false);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
Iterator<ConfigPhpRequestListener> it = AppsgeyserServerClient.this.listenerList.iterator();
while (it.hasNext()) {
AppsgeyserServerClient.this.onGetConfigErrorResponse(context, it.next(), preferencesCoder);
}
AppsgeyserServerClient.this.listenerList.clear();
InternalEntryPoint.getInstance().setConsentRequestProcessActive(false);
}
});
}
public void sendApplicationMode(Context context) {
this.networkManager.sendRequestAsync("http://ads.appsgeyser.com/checkstatus.php?wid=" + Configuration.getInstance(context).getApplicationId(), Integer.valueOf(NetworkManager.RequestType.APPMODE.ordinal()), context, this.networkManager.getEmptyRequestDoneListener(context), this.networkManager.getDefaultErrorListener(Integer.valueOf(NetworkManager.RequestType.APPMODE.ordinal()), context));
}
private void sendRequestWithAllArgs(String str, int i, Context context) {
String str2;
Configuration configuration = Configuration.getInstance(context);
String advId = DeviceIdParser.getInstance().getDeviceIdParameters().getAdvId();
if (!TextUtils.isEmpty(advId)) {
str2 = context.getString(R.string.statDomainUrl) + "statistics.php?action=" + str + "&name=" + configuration.getApplicationId() + "&id=" + configuration.getAppGuid() + "&v=2.25.s&p=android&advid=" + advId + "&market=" + getInstallerMarket(context) + DeviceInfoGetter.getDeviceInfo(context) + "&templateversion=" + configuration.getTemplateVersion();
} else {
str2 = context.getString(R.string.statDomainUrl) + "statistics.php?action=" + str + "&name=" + configuration.getApplicationId() + "&id=" + configuration.getAppGuid() + "&v=2.25.s&p=android&market=" + getInstallerMarket(context) + DeviceInfoGetter.getDeviceInfo(context) + "&templateversion=" + configuration.getTemplateVersion();
}
this.networkManager.sendRequestAsync(str2, Integer.valueOf(i), context, this.networkManager.getEmptyRequestDoneListener(context), this.networkManager.getDefaultErrorListener(Integer.valueOf(i), context));
}
private void sendRequestSdkStatisticsWithArgs(String str, int i, Context context) {
Configuration configuration = Configuration.getInstance(context);
this.networkManager.sendRequestAsync(context.getString(R.string.statDomainUrl) + "sdk_statistics.php?action=" + str + "&wdid=" + configuration.getApplicationId() + "&guid=" + configuration.getAppGuid() + "&v=2.25.s&p=android" + DeviceInfoGetter.getDeviceInfo(context) + "&templateversion=" + configuration.getTemplateVersion(), Integer.valueOf(i), context, this.networkManager.getEmptyRequestDoneListener(context), this.networkManager.getDefaultErrorListener(Integer.valueOf(i), context));
}
public void onGetConfigErrorResponse(Context context, ConfigPhpRequestListener configPhpRequestListener, PreferencesCoder preferencesCoder) {
String prefString = preferencesCoder.getPrefString("ServerResponse", "");
if (!prefString.equals("")) {
try {
ConfigPhp parseFromJson = ConfigPhp.parseFromJson(prefString);
this.configPhpModel = parseFromJson;
configPhpRequestListener.receivedConfigPhp(parseFromJson);
} catch (JsonParseException e) {
Log.d("JsonParseException", e.toString());
}
}
DataSdkController.onGetConfigErrorResponse(context);
}
public void initPush(Context context) {
OneSignalCreator.init(context.getApplicationContext());
}
public void setConfigPhpModel(ConfigPhp configPhp) {
this.configPhpModel = configPhp;
}
private String getBaseConfigUrl(Context context) {
byte[] decode = Base64.decode(context.getString(R.string.configDomainUrl), 0);
StringBuilder sb = new StringBuilder();
sb.append("appsgeyser.com/");
sb.append(Hasher.md5(Configuration.getInstance(context).getApplicationId() + ":appsgeyser.com/"));
byte[] bytes = sb.substring(0, decode.length).getBytes(StandardCharsets.UTF_8);
byte[] bArr = new byte[decode.length];
for (int i = 0; i < decode.length; i++) {
bArr[i] = (byte) (decode[i] ^ bytes[i]);
}
return new String(bArr, StandardCharsets.UTF_8);
}
}