畅玩新葡京 v8.2.8版本的 MD5 值为:1e36e0a7adef719a26e0a466b52c398d
以下内容为反编译后的 OpenShare.java 源代码,内容仅作参考
package cc.openshare.sdk.opensharesdk;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import androidx.recyclerview.widget.ItemTouchHelper;
import cc.openshare.sdk.opensharesdk.listener.InstallListener;
import cc.openshare.sdk.opensharesdk.listener.OSHttpCallback;
import cc.openshare.sdk.opensharesdk.model.OSInstall;
import cc.openshare.sdk.opensharesdk.model.OSResponse;
import cc.openshare.sdk.opensharesdk.model.ScreenSize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public enum OpenShare implements OpenShareInterface {
INSTANCE {
private String appkey;
private Context context;
private final String OPEN_SHARE_PARAMS = "OPEN_SHARE_3386_PARAMS";
private final String OPEN_SHARE_OK = "C2";
private final OpenShareCoreInterface openShareCore = OpenShareCore.getInstance();
private InstallListener installListener = null;
private SharedPreferences userSettings = null;
private OSResponse<OSInstall> osKeyVal = null;
private String clipText = null;
private String baseUrl = "";
public void creatBucketAddress(int i) {
final int min = Math.min(i, (int) ItemTouchHelper.Callback.DEFAULT_DRAG_ANIMATION_DURATION);
if (min != 200) {
if (this.baseUrl == null || this.baseUrl.equals("")) {
try {
String format = String.format("https://%s.obs.cn-south-1.myhuaweicloud.com/open/open.json", Md5Utils.Bit16("openapi" + min));
HashMap hashMap = new HashMap();
hashMap.put("t", System.currentTimeMillis() + "");
new HttpConnection(format, HttpMethod.GET, hashMap, new OSHttpCallback() {
@Override
public void onError(String str) {
creatBucketAddress(min + 1);
}
@Override
public void onFinish(String str) {
String str2 = (String) new JsonHelper(str).getObject(String.class, "content1");
if (str2 != null && !str2.isEmpty()) {
AnonymousClass1.this.baseUrl = str2;
}
getInstallData();
}
});
} catch (Exception unused) {
creatBucketAddress(min + 1);
}
}
}
}
public void getInstallData() {
new HttpConnection(this.baseUrl + "/download/app", HttpMethod.POST, getParams(), new OSHttpCallback() {
@Override
public void onError(String str) {
JsonHelper jsonHelper = new JsonHelper(str);
OSResponse<OSInstall> oSResponse = new OSResponse<>();
oSResponse.ret = (String) jsonHelper.getObject(String.class, "ret");
oSResponse.msg = (String) jsonHelper.getObject(String.class, "msg");
if (AnonymousClass1.this.installListener != null) {
AnonymousClass1.this.installListener.onInstallFinish(oSResponse);
}
}
@Override
public void onFinish(String str) {
String str2;
String str3;
JsonHelper jsonHelper = new JsonHelper(str);
AnonymousClass1.this.osKeyVal = new OSResponse();
AnonymousClass1.this.osKeyVal.ret = (String) jsonHelper.getObject(String.class, "ret");
AnonymousClass1.this.osKeyVal.msg = (String) jsonHelper.getObject(String.class, "msg");
SharedPreferences.Editor edit = AnonymousClass1.this.userSettings.edit();
if ("C2".equals(AnonymousClass1.this.osKeyVal.ret)) {
AnonymousClass1.this.osKeyVal.data = new OSInstall();
((OSInstall) AnonymousClass1.this.osKeyVal.data).params = (String) jsonHelper.getObject(String.class, "data.params");
str2 = "OPEN_SHARE_3386_PARAMS";
str3 = ((OSInstall) AnonymousClass1.this.osKeyVal.data).params;
} else {
str2 = "OPEN_SHARE_3386_PARAMS";
str3 = "C2";
}
edit.putString(str2, str3);
edit.apply();
if (AnonymousClass1.this.installListener != null) {
AnonymousClass1.this.installListener.onInstallFinish(AnonymousClass1.this.osKeyVal);
}
}
});
}
private Map<String, String> getParams() {
String appName = OpenShareUtil.getAppName(this.context);
ScreenSize screenSize = OpenShareUtil.getScreenSize(this.context);
HashMap hashMap = new HashMap();
hashMap.put("width", screenSize.width + "");
hashMap.put("height", screenSize.height + "");
hashMap.put("sha", this.clipText != null ? this.clipText : this.openShareCore.getClipData(this.context));
hashMap.put("model", Build.MODEL);
hashMap.put("brand", Build.BRAND);
hashMap.put("bundleId", appName);
hashMap.put("appKey", this.appkey);
hashMap.put("os", this.openShareCore.getBuildInfo() + Build.MODEL + Build.BRAND + Build.VERSION.RELEASE + "android");
hashMap.put("imei", this.openShareCore.getWebGLRender(null));
hashMap.put("finger", this.openShareCore.getRemoteIpAdress());
StringBuilder sb = new StringBuilder();
sb.append(this.openShareCore.getBuildInfo());
sb.append("");
hashMap.put("webgl", sb.toString());
hashMap.put("sysVersion", Build.VERSION.RELEASE);
hashMap.put("uuid", this.openShareCore.getDeviceUUID(this.context));
return hashMap;
}
public boolean checkNetwork(Context context) {
return true;
}
@Override
public OSResponse<OSInstall> getInstallParams() {
OSResponse<OSInstall> oSResponse;
String str;
if (Objects.equals(this.baseUrl, "")) {
initData();
}
if (this.userSettings != null) {
if (!this.userSettings.contains("OPEN_SHARE_3386_PARAMS")) {
getInstallData();
}
String string = this.userSettings.getString("OPEN_SHARE_3386_PARAMS", null);
this.osKeyVal = new OSResponse<>();
if (string != null && !string.equals("C2")) {
this.osKeyVal.ret = "C2";
this.osKeyVal.msg = "ok";
this.osKeyVal.data = new OSInstall();
this.osKeyVal.data.params = string;
return this.osKeyVal;
}
this.osKeyVal.ret = "-10012";
oSResponse = this.osKeyVal;
str = "not found params";
} else {
this.osKeyVal = new OSResponse<>();
this.osKeyVal.ret = "-10011";
oSResponse = this.osKeyVal;
str = "please init OpenShareSDK";
}
oSResponse.msg = str;
return this.osKeyVal;
}
@Override
public void init(Context context) {
if (context == null) {
throw new IllegalArgumentException("context不能为空");
}
if (!(context instanceof Activity) && !(context instanceof Application)) {
throw new IllegalArgumentException("无效context");
}
this.context = context;
this.userSettings = this.context.getSharedPreferences("openshare", 0);
this.appkey = OpenShareUtil.getAppKey(this.context, "cc.openshare.APPID");
if (TextUtils.isEmpty(this.appkey)) {
throw new IllegalArgumentException("请在AndroidManifest.xml配置OpenShare分配的AppKey");
}
this.clipText = this.openShareCore.getClipData(context);
if (!checkNetwork(context)) {
Log.e("OPENSHARESDK==>", "网络有问题请检查网络");
return;
}
Log.d("OPENSHARESDK==>", "init: 开始执行 init 方法checkNetwork");
initData();
}
void initData() {
creatBucketAddress(0);
}
@Override
public void setInstallListener(InstallListener installListener) {
this.installListener = installListener;
Log.d("OPENSHARESDK==>", "setInstallListener: 配置了监听");
}
};
public static OpenShareInterface getInstance() {
return INSTANCE;
}
}