龙将斩千 v5.5.5.39856版本的 MD5 值为:5c05b1d6f8d872ca3fe0343d6ff07caf
以下内容为反编译后的 SocialDebug.java 源代码,内容仅作参考
package com.anysdk.framework;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.Toast;
import androidx.core.app.NotificationCompat;
import com.anysdk.Util.SdkHttpListener;
import com.anysdk.Util.i;
import com.qiyukf.nimlib.sdk.msg.model.RecentSession;
import com.yaya.sdk.constants.Constants;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Hashtable;
import org.json.JSONException;
import org.json.JSONObject;
public class SocialDebug implements InterfaceSocial {
protected static String TAG = "SocialDebug";
private SocialDebug mAdapter;
private Context mContext;
private final String SIMSDK_LOGIN_URL = "http://sim.qudao.info/account/login";
private final String SIMSDK_LOGOUT_URL = "http://sim.qudao.info/account/logout";
public final int PluginType = 7;
private boolean isInited = false;
private boolean mLogined = false;
private String mUserId = "";
private String mSessionId = "";
private String mUApiKey = "";
private String mUApiSecret = "";
private String mServerUrl = "";
class AnonymousClass4 implements Runnable {
AnonymousClass4() {
}
@Override
public void run() {
if (SocialDebug.this.mLogined) {
SocialWrapper.onSocialResult(SocialDebug.this.mAdapter, 6, "Already logined!");
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(SocialDebug.this.mContext);
builder.setTitle(SocialDebug.this.getResourceId("plugin_login_title", "string"));
final View inflate = LayoutInflater.from(SocialDebug.this.mContext).inflate(SocialDebug.this.getResourceId("plugin_login", "layout"), (ViewGroup) null);
builder.setView(inflate);
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
SocialDebug socialDebug;
String str;
switch (i) {
case -2:
SocialDebug.this.mLogined = false;
socialDebug = SocialDebug.this.mAdapter;
str = "the login has been canceled";
SocialWrapper.onSocialResult(socialDebug, 6, str);
return;
case -1:
EditText editText = (EditText) inflate.findViewById(SocialDebug.this.getResourceId("txt_username", Constants.HELLOINFO_ID));
EditText editText2 = (EditText) inflate.findViewById(SocialDebug.this.getResourceId("txt_password", Constants.HELLOINFO_ID));
if (!editText.getText().toString().isEmpty() && !editText2.getText().toString().isEmpty()) {
SocialDebug.this.userLogin(editText.getText().toString(), editText2.getText().toString(), new ILoginCallback() {
@Override
public void onFailed(int i2, String str2) {
SocialDebug.this.mLogined = false;
SocialWrapper.onSocialResult(SocialDebug.this.mAdapter, 6, str2);
}
@Override
public void onSuccessed(int i2, String str2) {
SocialDebug.this.mLogined = true;
SocialWrapper.onSocialResult(SocialDebug.this.mAdapter, 5, str2);
}
});
return;
}
socialDebug = SocialDebug.this.mAdapter;
str = "username or password is empty";
SocialWrapper.onSocialResult(socialDebug, 6, str);
return;
default:
return;
}
}
};
builder.setPositiveButton(SocialDebug.this.getResourceId("plugin_login", "string"), onClickListener);
builder.setNegativeButton(SocialDebug.this.getResourceId("plugin_cancel", "string"), onClickListener).create();
builder.setCancelable(false);
builder.show();
}
}
public SocialDebug(Context context) {
this.mContext = null;
this.mAdapter = null;
this.mContext = context;
this.mAdapter = this;
configDeveloperInfo(Wrapper.getDeveloperInfo());
}
protected static void LogD(String str) {
try {
PluginHelper.logD(TAG, str);
} catch (Exception e) {
PluginHelper.logE(TAG, str, e);
}
}
protected static void LogE(String str, Exception exc) {
try {
PluginHelper.logE(TAG, str, exc);
} catch (Exception e) {
PluginHelper.logE(TAG, str, e);
}
}
private void configDeveloperInfo(Hashtable<String, String> hashtable) {
this.isInited = true;
}
public void userLogin(String str, String str2, final ILoginCallback iLoginCallback) {
Hashtable hashtable = new Hashtable();
new ArrayList();
hashtable.put("username", str);
hashtable.put("password", str2);
hashtable.put("server_url", "http://sim.qudao.info/account/login");
i.c(this.mContext, hashtable, new SdkHttpListener() {
@Override
public void onError() {
iLoginCallback.onFailed(5, "");
}
@Override
public void onResponse(String str3) {
PluginHelper.logD("onResponse", str3);
try {
JSONObject jSONObject = new JSONObject(str3);
String string = jSONObject.getString(Constants.ERRREPORTREQ_ERRMSG);
if (string == null || !string.equals("success")) {
iLoginCallback.onFailed(5, "");
return;
}
JSONObject jSONObject2 = jSONObject.getJSONObject("data");
PluginHelper.logD("data", jSONObject2.toString());
SocialDebug.this.mUserId = jSONObject2.getString("user_id");
SocialDebug.this.mSessionId = jSONObject2.getString("session_id");
PluginHelper.logD("user_id", SocialDebug.this.mUserId);
PluginHelper.logD("session_id", SocialDebug.this.mSessionId);
Hashtable hashtable2 = new Hashtable();
hashtable2.put("channel", "simsdk");
hashtable2.put("server_url", SocialDebug.this.mServerUrl);
hashtable2.put("session_id", SocialDebug.this.mSessionId);
hashtable2.put("user_id", SocialDebug.this.mUserId);
hashtable2.put("uapi_key", SocialDebug.this.mUApiKey);
hashtable2.put("uapi_secret", SocialDebug.this.mUApiSecret);
UserWrapper.getAccessToken(SocialDebug.this.mContext, hashtable2, new SdkHttpListener() {
@Override
public void onError() {
iLoginCallback.onFailed(5, "");
}
@Override
public void onResponse(String str4) {
PluginHelper.logD("onResponse", str4);
try {
JSONObject jSONObject3 = new JSONObject(str4);
String string2 = jSONObject3.getString(NotificationCompat.CATEGORY_STATUS);
if (string2 == null || !string2.equals("ok")) {
iLoginCallback.onFailed(5, "");
return;
}
String optString = jSONObject3.optString(RecentSession.KEY_EXT);
if (optString == null) {
optString = "";
}
iLoginCallback.onSuccessed(2, optString);
} catch (JSONException e) {
iLoginCallback.onFailed(5, "");
}
}
});
} catch (JSONException e) {
iLoginCallback.onFailed(5, "");
}
}
});
}
public void userLogout() {
Hashtable hashtable = new Hashtable();
new ArrayList();
hashtable.put("user_id", this.mUserId);
hashtable.put("session_id", this.mSessionId);
hashtable.put("server_url", "http://sim.qudao.info/account/logout");
i.c(this.mContext, hashtable, new SdkHttpListener() {
@Override
public void onError() {
SocialWrapper.onSocialResult(SocialDebug.this.mAdapter, 8, "");
}
@Override
public void onResponse(String str) {
PluginHelper.logD("onResponse", str);
try {
String string = new JSONObject(str).getString(Constants.ERRREPORTREQ_ERRMSG);
if (string == null || !string.equals("success")) {
SocialWrapper.onSocialResult(SocialDebug.this.mAdapter, 8, string);
} else {
SocialDebug.this.mLogined = false;
SocialWrapper.onSocialResult(SocialDebug.this.mAdapter, 7, "");
}
} catch (JSONException e) {
SocialWrapper.onSocialResult(SocialDebug.this.mAdapter, 8, e.toString());
}
}
});
}
@Override
public String getPluginVersion() {
LogD("getPluginVersion() invoked!");
return PluginWrapper.VERSION;
}
public int getResourceId(String str, String str2) {
return this.mContext.getResources().getIdentifier(str, str2, this.mContext.getPackageName());
}
@Override
public String getSDKVersion() {
LogD("getSDKVersion() invoked!");
return PluginWrapper.VERSION;
}
public boolean isFunctionSupported(String str) {
LogD("isFunctionSupported(" + str + ")invoked!");
for (Method method : getClass().getMethods()) {
if (method.getName().equals(str)) {
return true;
}
}
return false;
}
public boolean isLogined() {
return this.mLogined;
}
@Override
public void setDebugMode(boolean z) {
LogD("setDebugMode deprecated");
}
@Override
public void showAchievements() {
LogD("showAchievements() invoked!");
PluginWrapper.runOnMainThread(new Runnable() {
@Override
public void run() {
SocialDebug.this.showDialog("plugin_achievement", "plugin_achievement");
}
});
}
public void showDialog(final String str, final String str2) {
final Context context = this.mContext;
PluginWrapper.runOnMainThread(new Runnable() {
@Override
public void run() {
new AlertDialog.Builder(context).setTitle(SocialDebug.this.getResourceId(str, "string")).setMessage(SocialDebug.this.getResourceId(str2, "string")).setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
}).create().show();
}
});
}
@Override
public void showLeaderboard(String str) {
LogD("showLeaderboard(" + str + ")invoked!");
PluginWrapper.runOnMainThread(new Runnable() {
@Override
public void run() {
SocialDebug.this.showDialog("plugin_rank", "plugin_rank");
}
});
}
@Override
public void signIn() {
LogD("signIn() invoked!");
PluginWrapper.runOnMainThread(new AnonymousClass4());
}
@Override
public void signOut() {
LogD("signOut() invoked!");
PluginWrapper.runOnMainThread(new Runnable() {
@Override
public void run() {
if (SocialDebug.this.isLogined()) {
SocialDebug.this.userLogout();
} else {
SocialWrapper.onSocialResult(SocialDebug.this.mAdapter, 6, "not need logout");
SocialDebug.LogD("User not logined!");
}
}
});
}
@Override
public void submitScore(String str, long j) {
LogD("submitScore(" + str + "," + j + ")invoked!");
PluginWrapper.runOnMainThread(new Runnable() {
@Override
public void run() {
Toast.makeText(SocialDebug.this.mContext, "success to submit", 0).show();
}
});
}
@Override
public void unlockAchievement(Hashtable<String, String> hashtable) {
LogD("unlockAchievement(" + hashtable.toString() + ")invoked!");
PluginWrapper.runOnMainThread(new Runnable() {
@Override
public void run() {
Toast.makeText(SocialDebug.this.mContext, "success to unlock", 0).show();
}
});
}
}