OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046
以下内容为反编译后的 LoginEngine.java 源代码,内容仅作参考
package com.excean.lysdk.engine;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.widget.Toast;
import androidx.annotation.Keep;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.Observer;
import com.android.spush.util.WebActionRouter;
import com.excean.bytedancebi.bean.BiEventLyLogin;
import com.excean.lysdk.LYUser;
import com.excean.lysdk.R;
import com.excean.lysdk.app.VerifyIDFragment;
import com.excean.lysdk.app.vo.VerifyInfo;
import com.excean.lysdk.d;
import com.excean.lysdk.data.a;
import com.excean.lysdk.data.b;
import com.excean.lysdk.data.i;
import com.excean.lysdk.e.c;
import com.excean.lysdk.e.f;
import com.excean.lysdk.engine.event.RequestAccountStateEvent;
import com.excean.lysdk.router.EventBus;
import com.excean.lysdk.router.Subscribe;
import com.excean.lysdk.router.ThreadMode;
import com.excelliance.kxqp.gs.util.av;
import com.excelliance.kxqp.gs.util.by;
import com.excelliance.kxqp.gs.util.cd;
import com.excelliance.kxqp.gs.util.ce;
import com.excelliance.kxqp.util.ai;
import com.tencent.open.SocialConstants;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
public abstract class LoginEngine extends Engine<a> implements Observer<LYUser> {
private boolean f1597a = true;
private VerifyInfo f1598b;
protected abstract void a();
@Override
public void run() {
Log.d("lysdk", "run: " + getClass().getName());
getStubViewModel().postLoading(R.string.lysdk_state_login);
if (!com.excean.lysdk.e.a.c()) {
com.excean.lysdk.e.a.a().execute(this);
return;
}
d.f().a(this);
StubRequest stubRequest = getStubRequest();
LYUser e = d.e();
boolean isFromOurPlay = stubRequest.isFromOurPlay();
Log.d("lysdk", "run: isFromOurPlay::" + isFromOurPlay);
this.f1597a = stubRequest.getBoolean("verifyIdentity", true);
if ((e == null || !e.c()) && !isFromOurPlay) {
this.f1597a = true;
a();
} else {
d.d().a(e);
}
}
@Override
public void onChanged(LYUser lYUser) {
if (getStubRequest().isFromOurPlay()) {
EventBus.get().post(new RequestAccountStateEvent(lYUser));
return;
}
if (lYUser.c() && !lYUser.b()) {
EventBus.get().post(new RequestAccountStateEvent(lYUser));
} else if (lYUser.c()) {
postValue(c.b(new a(lYUser)));
} else {
postValue(c.a(new a(lYUser)));
}
reportLoginEventToBi(lYUser);
}
public void reportLoginEventToBi(LYUser lYUser) {
BiEventLyLogin biEventLyLogin = new BiEventLyLogin();
StubRequest stubRequest = getStubRequest();
if (lYUser.c()) {
biEventLyLogin.is_succeed = "成功";
biEventLyLogin.game_packagename = stubRequest.getPackageName();
biEventLyLogin.is_register = lYUser.d() ? "是" : "否";
if (lYUser.d()) {
lYUser.a(false);
d.d().b(lYUser);
}
} else {
biEventLyLogin.is_succeed = "失败";
biEventLyLogin.game_packagename = stubRequest.getPackageName();
biEventLyLogin.is_register = lYUser.d() ? "是" : "否";
}
com.excelliance.kxqp.gs.g.c.a().a(biEventLyLogin);
}
@Keep
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void handleSyncAccountState(RequestAccountStateEvent requestAccountStateEvent) {
b c;
StubViewModel stubViewModel = getStubViewModel();
StubRequest stubRequest = getStubRequest();
boolean isFromOurPlay = stubRequest.isFromOurPlay();
Log.d("lysdk", "handleSyncAccountState: isFromOurPlay::" + isFromOurPlay);
if (isFromOurPlay) {
c<com.excean.lysdk.data.c> b2 = b(requestAccountStateEvent.getUser());
Log.d("lysdk", "handleSyncAccountState: stateResponse::" + b2);
com.excean.lysdk.data.c c2 = b2.c();
if (c2 == null) {
postValue(c.a(115));
return;
} else {
int i = c2.e;
c = a(c2);
}
} else {
c = a(requestAccountStateEvent.getUser()).c();
}
if (c == null) {
postValue(c.a(115));
return;
}
new com.excean.lysdk.c.b(requestAccountStateEvent.getUser().f(), stubRequest.getPackageName()).update(c.c(), c.b(), c.f1543b, c.c);
a aVar = new a(requestAccountStateEvent.getUser(), c);
if (!aVar.b()) {
stubViewModel.postDismiss();
postValue(c.b(aVar));
} else if (isFromOurPlay) {
stubViewModel.postDismiss();
postValue(c.b(aVar));
} else {
getStubViewModel().postNavigation(new VerifyInfo(this, aVar), VerifyIDFragment.class);
}
}
@Keep
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onVerifyId(VerifyInfo verifyInfo) {
if (a(verifyInfo)) {
StubViewModel stubViewModel = getStubViewModel();
StubRequest request = stubViewModel.getRequest();
Log.d("lysdk", "onVerifyId: " + request);
if (request.isFromOurPlay()) {
a(stubViewModel, verifyInfo);
} else {
stubViewModel.postLoading(R.string.lysdk_state_confirm);
b(stubViewModel, verifyInfo);
}
}
}
private void a(StubViewModel stubViewModel, VerifyInfo verifyInfo) {
final Application c = d.c();
if (a(c)) {
f.getMainHandler().post(new Runnable() {
@Override
public void run() {
Toast.makeText(c, R.string.lysdk_over_test_times, 0).show();
}
});
return;
}
stubViewModel.postLoading(R.string.lysdk_state_confirm);
LYUser a2 = verifyInfo.a();
HashMap hashMap = new HashMap();
hashMap.put("name", verifyInfo.b());
hashMap.put("idCard", verifyInfo.c());
hashMap.put("rid", a2.e());
c<i> cVar = new com.excean.lysdk.d.b<i>("https://api.ourplay.com.cn/user/verify", hashMap, 1) {
}.execute(com.excean.lysdk.e.a.b()).get();
i c2 = cVar.c();
stubViewModel.postDismiss();
if (cVar.b() && c2.f1556a != 0) {
SharedPreferences sharedPreferences = c.getSharedPreferences("USERINFO", 0);
if (sharedPreferences != null) {
SharedPreferences.Editor edit = sharedPreferences.edit();
setSpValueWithAesEncrypt(edit, "USER_REAL_NAME_VERIFY", String.valueOf(1));
setSpValueWithAesEncrypt(edit, "USER_REAL_NAME", verifyInfo.b());
setSpValueWithAesEncrypt(edit, "USER_ID_NUMBER", verifyInfo.c());
setSpValueWithAesEncrypt(edit, "USER_ID_NUMBER", verifyInfo.c());
setSpValueWithAesEncrypt(edit, "USER_IS_ADULT", String.valueOf(c2.f1557b));
edit.apply();
ai.a();
ai.b(c);
}
c<com.excean.lysdk.data.c> b2 = b(verifyInfo.a());
Log.d("lysdk", "requestIDVerifyByNonLyGame fetchAccountState2: " + b2);
if (b2.b()) {
b a3 = a(b2.c());
new com.excean.lysdk.c.b(verifyInfo.a().f(), getStubRequest().getPackageName()).update(a3.c(), a3.b(), a3.f1543b, a3.c);
postValue(c.b(new a(verifyInfo.a(), a3)));
return;
}
return;
}
String d = cVar.d();
if (!cd.a(d)) {
ai.a().a(c, "联运游戏", d);
}
stubViewModel.postDismiss();
int c3 = by.a(c, "sp_config").c("sp_key_real_name_commit_times", 0) + 1;
if (c3 == 1) {
c(c);
}
by.a(c, "sp_config").a("sp_key_real_name_commit_times", c3);
if (this.f1598b != null) {
b(c);
this.f1598b.a(true);
}
}
public void setSpValueWithAesEncrypt(SharedPreferences.Editor editor, String str, String str2) {
editor.putString(str, com.excelliance.kxqp.gs.util.c.a(String.valueOf(str2)));
}
private boolean a(Context context) {
return by.a(context, "sp_config").c("sp_key_real_name_commit_times", 0) >= 3;
}
private void b(Context context) {
int c = 3 - by.a(context, "sp_config").c("sp_key_real_name_commit_times", 0);
if (c < 0) {
c = 0;
}
String format = String.format(context.getString(R.string.lysdk_real_name_verify_dialog_content), Integer.valueOf(c));
SpannableString spannableString = new SpannableString(format);
spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, com.excean.ggspace.main.R.color.new_main_color)), format.length() - 6, format.length(), 33);
this.f1598b.a(spannableString);
}
private void c(Context context) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(ce.a(context));
calendar.set(11, 0);
calendar.set(12, 0);
calendar.set(13, 0);
calendar.add(5, 1);
by.a(context, "sp_config").a("sp_key_last_time_identification_authentication", calendar.getTimeInMillis());
}
private void b(StubViewModel stubViewModel, VerifyInfo verifyInfo) {
Map<String, String> map = stubViewModel.getRequest().getDefault();
map.put("name", verifyInfo.b());
map.put("idCard", verifyInfo.c());
int sourceType = getStubRequest().getSourceType();
if (sourceType == 0) {
sourceType = getStubRequest().getType();
}
if (sourceType != 0) {
map.put(SocialConstants.PARAM_SOURCE, String.valueOf(getStubRequest().getType()));
}
c<i> cVar = new com.excean.lysdk.d.b<i>("plat/to-check-name", map) {
}.execute(com.excean.lysdk.e.a.b()).get();
stubViewModel.postDismiss();
i c = cVar.c();
if (cVar.b() && c != null && c.f1556a != 0) {
c<b> a2 = a(verifyInfo.a());
if (a2.b()) {
Application c2 = d.c();
SharedPreferences sharedPreferences = c2.getSharedPreferences("USERINFO", 0);
if (sharedPreferences != null) {
SharedPreferences.Editor edit = sharedPreferences.edit();
setSpValueWithAesEncrypt(edit, "USER_REAL_NAME_VERIFY", String.valueOf(1));
setSpValueWithAesEncrypt(edit, "USER_REAL_NAME", verifyInfo.b());
setSpValueWithAesEncrypt(edit, "USER_ID_NUMBER", verifyInfo.c());
edit.apply();
ai.a();
ai.b(c2);
}
b c3 = a2.c();
new com.excean.lysdk.c.b(verifyInfo.a().f(), getStubRequest().getPackageName()).update(c3.c(), c3.b(), c3.f1543b, c3.c);
postValue(c.b(new a(verifyInfo.a(), a2.c())));
return;
}
return;
}
String a3 = a(cVar.d());
if (a3 != null) {
stubViewModel.postError(a3);
} else {
stubViewModel.postError(R.string.lysdk_state_verify_error);
}
}
private boolean a(VerifyInfo verifyInfo) {
StubViewModel stubViewModel = getStubViewModel();
if (verifyInfo.b() == null || verifyInfo.b().isEmpty()) {
stubViewModel.postError(R.string.lysdk_state_verify_name_null);
return false;
}
if (verifyInfo.c() != null && !verifyInfo.c().isEmpty()) {
return true;
}
stubViewModel.postError(R.string.lysdk_state_verify_number_null);
return false;
}
private String a(String str) {
if (str != null) {
String[] split = str.split(com.alipay.sdk.util.i.f491b);
if (split.length > 1) {
String[] split2 = split[1].split("=");
if (split2.length > 1) {
return split2[1];
}
}
}
return null;
}
private c<b> a(LYUser lYUser) {
StubViewModel stubViewModel = getStubViewModel();
stubViewModel.postLoading(R.string.lysdk_state_login_verify);
c<b> cVar = new com.excean.lysdk.d.b<b>("plat/get-game-time", stubViewModel.getRequest().getDefault()) {
}.execute(com.excean.lysdk.e.a.b()).get();
if (cVar.b()) {
lYUser.update(stubViewModel.getRequest().getAppId(), cVar.c());
}
stubViewModel.postDismiss();
return cVar;
}
private c<com.excean.lysdk.data.c> b(LYUser lYUser) {
StubViewModel stubViewModel = getStubViewModel();
stubViewModel.postLoading(R.string.lysdk_state_login_verify);
StubRequest request = stubViewModel.getRequest();
HashMap hashMap = new HashMap();
hashMap.put("rid", lYUser.e());
hashMap.put(WebActionRouter.KEY_PKG, request.getPackageName());
hashMap.put("aid", av.a().a(d.c()));
c<com.excean.lysdk.data.c> cVar = new com.excean.lysdk.d.b<com.excean.lysdk.data.c>("https://api.ourplay.com.cn/user/anti-addic", hashMap, 1) {
}.execute(com.excean.lysdk.e.a.b()).get();
if (cVar.b()) {
lYUser.update(stubViewModel.getRequest().getAppId(), a(cVar.c()));
}
stubViewModel.postDismiss();
return cVar;
}
@Override
public void postValue(c<a> cVar) {
super.postValue(cVar);
if (cVar.b()) {
c(cVar.c().a());
}
}
private void c(LYUser lYUser) {
Map<String, String> map = getStubRequest().getDefault();
map.put("openId", lYUser.f());
new com.excean.lysdk.d.b<String>("plat/login-count", map) {
}.executeImmediate();
}
private b a(com.excean.lysdk.data.c cVar) {
b bVar = new b();
bVar.f1542a = cVar.c;
bVar.d = cVar.c >= 18 ? 1 : 0;
bVar.f = 1;
bVar.f1543b = cVar.f1545b;
bVar.e = cVar.f1544a ? 1 : 0;
bVar.c = cVar.d == 1 ? 180L : 90L;
return bVar;
}
}