OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046
以下内容为反编译后的 LaunchViewModel.java 源代码,内容仅作参考
package com.excelliance.kxqp.gs.launch;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.CheckBox;
import android.widget.Toast;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.ViewModel;
import com.excean.ggspace.main.R;
import com.excelliance.kxqp.annotation.ChildThread;
import com.excelliance.kxqp.api.request.GameAttrsRequest;
import com.excelliance.kxqp.bean.AppExtraBean;
import com.excelliance.kxqp.bean.LastAllProxyInfo;
import com.excelliance.kxqp.gs.bean.CityBean;
import com.excelliance.kxqp.gs.bean.DownloadAreaBean;
import com.excelliance.kxqp.gs.bean.InstallResultcallBack;
import com.excelliance.kxqp.gs.bean.LoginAreaBean;
import com.excelliance.kxqp.gs.bean.ProxyConfigHelper;
import com.excelliance.kxqp.gs.bean.ReginBean;
import com.excelliance.kxqp.gs.bean.ShareGameBean;
import com.excelliance.kxqp.gs.dialog.UpdateProgressDialog;
import com.excelliance.kxqp.gs.dialog.f;
import com.excelliance.kxqp.gs.dialog.o;
import com.excelliance.kxqp.gs.k.a.a;
import com.excelliance.kxqp.gs.launch.a.h;
import com.excelliance.kxqp.gs.launch.function.g;
import com.excelliance.kxqp.gs.launch.s;
import com.excelliance.kxqp.gs.service.ProxyDelayService;
import com.excelliance.kxqp.gs.thpool.tp;
import com.excelliance.kxqp.gs.ui.share.core.config.SocializeMedia;
import com.excelliance.kxqp.gs.ui.share.core.helper.ShareHelper;
import com.excelliance.kxqp.gs.util.ac;
import com.excelliance.kxqp.gs.util.af;
import com.excelliance.kxqp.gs.util.aj;
import com.excelliance.kxqp.gs.util.aq;
import com.excelliance.kxqp.gs.util.as;
import com.excelliance.kxqp.gs.util.au;
import com.excelliance.kxqp.gs.util.av;
import com.excelliance.kxqp.gs.util.ay;
import com.excelliance.kxqp.gs.util.az;
import com.excelliance.kxqp.gs.util.bd;
import com.excelliance.kxqp.gs.util.bf;
import com.excelliance.kxqp.gs.util.bs;
import com.excelliance.kxqp.gs.util.bt;
import com.excelliance.kxqp.gs.util.bx;
import com.excelliance.kxqp.gs.util.by;
import com.excelliance.kxqp.gs.util.bz;
import com.excelliance.kxqp.gs.util.cd;
import com.excelliance.kxqp.gs.util.cf;
import com.excelliance.kxqp.gs.util.cg;
import com.excelliance.kxqp.gs.util.cn;
import com.excelliance.kxqp.gs.util.w;
import com.excelliance.kxqp.platforms.ExcellianceAppInfo;
import com.excelliance.kxqp.util.ai;
import com.excelliance.kxqp.util.master.a;
import java.lang.ref.WeakReference;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import org.json.JSONObject;
public class LaunchViewModel extends ViewModel {
private Activity f6615a;
private Context f6616b;
private Handler c;
private DispatchFragment e;
private com.excelliance.kxqp.gs.dialog.o f;
private Dialog g;
private com.excelliance.kxqp.util.master.d i;
private j k;
private Handler d = new Handler(Looper.getMainLooper());
private final h h = new h();
private final Set<io.reactivex.b.b> j = new HashSet();
public void a(FragmentActivity fragmentActivity) {
this.f6615a = fragmentActivity;
this.f6616b = fragmentActivity.getApplicationContext();
HandlerThread handlerThread = new HandlerThread("LaunchWorkThread", 10);
handlerThread.start();
this.c = new Handler(handlerThread.getLooper());
this.e = DispatchFragment.a(fragmentActivity);
this.k = new j();
this.k.a(this.h);
this.e.a(this.k);
this.i = new com.excelliance.kxqp.util.master.d(this.f6615a);
this.h.a(false);
}
public com.excelliance.kxqp.util.master.d a() {
return this.i;
}
public void a(String str) {
this.h.a(str);
}
public String b() {
return this.h.a();
}
public void a(long j) {
this.h.a(j);
}
public long c() {
return this.h.b();
}
public WeakReference<Activity> getContext() {
return new WeakReference<>(this.f6615a);
}
public void a(io.reactivex.b.b bVar) {
synchronized (this.j) {
this.j.add(bVar);
}
}
private void a(final f.a aVar) {
com.excelliance.kxqp.gs.base.f fVar = new com.excelliance.kxqp.gs.base.f(this.f6615a) {
@Override
protected int a(WindowManager windowManager) {
return -1;
}
@Override
protected int b(WindowManager windowManager) {
return -1;
}
@Override
public String b() {
return "dialog_export_tips";
}
@Override
protected void a(View view) {
com.excelliance.kxqp.ui.util.b.a("btn_confirm", view).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view2) {
dismiss();
aVar.a(view2, null);
}
});
}
};
fVar.show();
fVar.getWindow().setBackgroundDrawable(new ColorDrawable(0));
}
public void a(final String str, final Context context, final SocializeMedia socializeMedia) {
this.c.post(new Runnable() {
@Override
public void run() {
ShareGameBean shareGameBean;
String a2 = as.a(str, context);
if (TextUtils.isEmpty(a2)) {
shareGameBean = null;
} else {
shareGameBean = ay.e(a2);
if (shareGameBean != null && !shareGameBean.beanIsNull()) {
by.a(context, "sp_share_info").a(str, true);
}
}
if (shareGameBean == null || shareGameBean.beanIsNull()) {
LaunchViewModel.this.f6615a.runOnUiThread(new Runnable() {
@Override
public void run() {
cg.a(LaunchViewModel.this.f6615a, w.e(LaunchViewModel.this.f6615a, "share_sdk_share_no_info"));
}
});
return;
}
ShareHelper instance = ShareHelper.instance(LaunchViewModel.this.f6615a);
instance.setCallBack(new ShareHelper.Callback() {
@Override
public void onDismiss(SocializeMedia socializeMedia2) {
}
@Override
public void onShareStart(SocializeMedia socializeMedia2) {
}
@Override
public void onShareComplete(SocializeMedia socializeMedia2, int i, Bundle bundle) {
if (i == 200) {
Toast.makeText(LaunchViewModel.this.f6615a, w.e(LaunchViewModel.this.f6615a, "share_sdk_share_success"), 0).show();
} else if (i == 202) {
Toast.makeText(LaunchViewModel.this.f6615a, w.e(LaunchViewModel.this.f6615a, "share_sdk_share_failed"), 0).show();
}
}
});
instance.shareTo(socializeMedia, shareGameBean);
}
});
}
public void a(final ExcellianceAppInfo excellianceAppInfo, int i, final boolean z) {
final Activity activity = this.f6615a;
au a2 = au.a();
String appPackageName = excellianceAppInfo.getAppPackageName();
boolean z2 = a2.v(appPackageName, this.f6616b) || com.excelliance.kxqp.gs.dialog.o.a(appPackageName);
final boolean z3 = i == 5 || (i & 16) == 16;
if (z2 && !z3 && !z) {
q.a(activity).b(new h.b.a().a(this).a(excellianceAppInfo).b(0).a(true).a());
return;
}
if (com.excelliance.kxqp.gs.util.b.bd(activity) && (z3 || z)) {
a(new f.a() {
@Override
public void a(View view, Dialog dialog) {
LaunchViewModel.this.d(excellianceAppInfo);
}
});
return;
}
if (this.f != null && this.f.isShowing()) {
this.f.dismiss();
}
int i2 = (z3 || !z) ? i : 16;
this.f = new com.excelliance.kxqp.gs.dialog.o(activity, R.style.theme_dialog_no_title2, excellianceAppInfo, i2);
this.f.a(new o.a() {
@Override
public void a(int i3, ExcellianceAppInfo excellianceAppInfo2) {
if (z3 || z) {
LaunchViewModel.this.d(excellianceAppInfo2);
com.excelliance.kxqp.gs.g.c.a().a((String) null, (String) null, "弹框页", "反外挂弹框", "反外挂", excellianceAppInfo);
} else if (i3 != 4) {
q.a(activity).b(new h.b.a().a(LaunchViewModel.this).a(LaunchViewModel.this.f.a()).b(0).a(true).a());
if (i3 == 6) {
com.excelliance.kxqp.gs.g.c.a().a((String) null, (String) null, "弹框页", "重新检测合规性弹框", "不检测", excellianceAppInfo);
}
}
}
});
if (i == 6) {
this.f.b(new o.a() {
@Override
public void a(int i3, ExcellianceAppInfo excellianceAppInfo2) {
com.excelliance.kxqp.gs.dialog.h hVar = new com.excelliance.kxqp.gs.dialog.h(activity);
hVar.a(w.e(activity, "requesting"));
LaunchViewModel.this.a(excellianceAppInfo, hVar);
com.excelliance.kxqp.gs.g.c.a().a((String) null, (String) null, "弹框页", "重新检测合规性弹框", "重新检测", excellianceAppInfo);
}
});
}
if (i2 == 16 && com.excelliance.kxqp.gs.util.e.b(excellianceAppInfo.getAppPackageName())) {
cf.a(this.f6616b, String.format(w.e(this.f6616b, "app_installing_doing_wait"), excellianceAppInfo.appName), 0);
return;
}
if (this.f.isShowing() || activity == null || activity.isFinishing()) {
return;
}
this.f.a(excellianceAppInfo, i2);
this.f.show();
if (i2 == 16) {
bz.a().b(this.f6616b, 4, excellianceAppInfo.getAppPackageName());
com.excelliance.kxqp.gs.g.c.a().b("反外挂弹框");
} else if (i == 6) {
com.excelliance.kxqp.gs.g.c.a().b("重新检测合规性弹框");
}
}
public void a(ExcellianceAppInfo excellianceAppInfo, int i, final af.b bVar) {
final Activity activity = this.f6615a;
final au a2 = au.a();
final String appPackageName = excellianceAppInfo.getAppPackageName();
boolean z = a2.x(appPackageName, this.f6616b) || com.excelliance.kxqp.gs.dialog.o.a(appPackageName);
Log.d("LaunchViewModel", "showLegalAlertDialog allow " + z);
if (this.f != null && this.f.isShowing()) {
this.f.dismiss();
}
this.f = new com.excelliance.kxqp.gs.dialog.o(activity, R.style.theme_dialog_no_title2, excellianceAppInfo, i);
this.f.a(new o.a() {
@Override
public void a(int i2, ExcellianceAppInfo excellianceAppInfo2) {
CheckBox b2 = LaunchViewModel.this.f.b();
if (b2 != null && b2.isChecked()) {
a2.c(appPackageName, activity, true);
}
bVar.a();
}
});
if (!z && !this.f.isShowing() && activity != null && !activity.isFinishing()) {
this.f.a(excellianceAppInfo, i);
this.f.show();
} else {
bVar.a();
}
}
public void b(final String str) {
a(io.reactivex.i.b(str).a(io.reactivex.g.a.b()).b((io.reactivex.d.e) new io.reactivex.d.e<String, Boolean>() {
@Override
public Boolean a(String str2) throws Exception {
JSONObject i = cn.i(LaunchViewModel.this.f6615a);
try {
i.put("pkgname", str);
String b2 = bd.b("https://api.ourplay.com.cn/rank/subscribefix", i.toString(), 3000, 3000);
if (!TextUtils.isEmpty(b2) && new JSONObject(cn.a(b2)).optInt("code") == 0) {
return true;
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
}).b(io.reactivex.a.b.a.a()).a(io.reactivex.a.b.a.a()).b((io.reactivex.d.d) new io.reactivex.d.d<Boolean>() {
@Override
public void accept(Boolean bool) throws Exception {
if (bool == null || !bool.booleanValue()) {
Toast.makeText(LaunchViewModel.this.f6615a, w.e(LaunchViewModel.this.f6615a, "ranking_fix_subscribe_failed"), 0).show();
} else {
Toast.makeText(LaunchViewModel.this.f6615a, w.e(LaunchViewModel.this.f6615a, "ranking_fix_subscribe_success"), 0).show();
}
}
}));
}
public void a(ExcellianceAppInfo excellianceAppInfo, final com.excelliance.kxqp.gs.dialog.h hVar) {
a(io.reactivex.i.b(excellianceAppInfo).a(io.reactivex.g.a.b()).a(new io.reactivex.d.d<ExcellianceAppInfo>() {
@Override
public void accept(ExcellianceAppInfo excellianceAppInfo2) throws Exception {
au.a().a(LaunchViewModel.this.f6615a, GameAttrsRequest.Factory.create(LaunchViewModel.this.f6615a, excellianceAppInfo2.getAppPackageName()));
}
}).a(io.reactivex.a.b.a.a()).a(new io.reactivex.d.d<ExcellianceAppInfo>() {
@Override
public void accept(ExcellianceAppInfo excellianceAppInfo2) throws Exception {
hVar.hide();
}
}).a(new io.reactivex.d.d<ExcellianceAppInfo>() {
@Override
public void accept(ExcellianceAppInfo excellianceAppInfo2) throws Exception {
h.b a2 = new h.b.a().a(LaunchViewModel.this).a(excellianceAppInfo2).a();
Activity b2 = a2.b();
if (b2 != null) {
q.a(b2).a(a2);
}
}
}, new io.reactivex.d.d<Throwable>() {
@Override
public void accept(Throwable th) throws Exception {
Log.e("LaunchViewModel", "accept: ex = [ " + th + "]");
}
}));
}
public void d(final ExcellianceAppInfo excellianceAppInfo) {
tp.f(new Runnable() {
@Override
public void run() {
final String path = excellianceAppInfo.getPath();
final String appPackageName = excellianceAppInfo.getAppPackageName();
az.d("LaunchViewModel", "install to native: " + path + " appPackageName: " + appPackageName);
if (com.excelliance.kxqp.gs.vip.f.a(excellianceAppInfo.getAppName(), path, appPackageName, LaunchViewModel.this.f6615a)) {
az.d("LaunchViewModel", "1 need split apk install");
com.excelliance.kxqp.gs.util.e.a(LaunchViewModel.this.f6615a, path, appPackageName, excellianceAppInfo.getAppName(), new InstallResultcallBack() {
@Override
public void onResult(boolean z) {
if (z) {
au.a().a(LaunchViewModel.this.f6616b, appPackageName, path, false);
}
}
});
}
}
});
}
public void a(final ExcellianceAppInfo excellianceAppInfo) {
int downloadStatus = excellianceAppInfo.getDownloadStatus();
Log.e("LaunchViewModel", "downloadStatus: " + downloadStatus);
if (downloadStatus == 4) {
if (!aq.v()) {
if (!aq.a().u() && !aq.a().t()) {
aq.a().e(this.f6615a);
return;
}
com.excelliance.kxqp.gs.multi.down.a.a(this.f6615a).a(excellianceAppInfo);
if (bs.n(excellianceAppInfo.getAppPackageName())) {
return;
}
com.excelliance.kxqp.gs.g.c.a().b(this.f6615a.getApplicationContext(), excellianceAppInfo);
return;
}
com.excelliance.kxqp.gs.multi.down.a.a(this.f6615a).a(excellianceAppInfo);
if (bs.n(excellianceAppInfo.getAppPackageName())) {
return;
}
com.excelliance.kxqp.gs.g.c.a().a(this.f6615a.getApplicationContext(), excellianceAppInfo);
return;
}
if (downloadStatus == 2) {
com.excelliance.kxqp.gs.multi.down.a.a(this.f6615a).a(excellianceAppInfo);
if (bs.n(excellianceAppInfo.getAppPackageName())) {
return;
}
com.excelliance.kxqp.gs.g.c.a().a(this.f6615a.getApplicationContext(), excellianceAppInfo);
return;
}
if (downloadStatus == 11) {
Toast.makeText(this.f6615a, com.excelliance.kxqp.swipe.a.a.getString(this.f6615a, "generating_obb"), 0).show();
return;
}
if (downloadStatus == 12) {
Toast.makeText(this.f6615a, com.excelliance.kxqp.swipe.a.a.getString(this.f6615a, "generating_obb_error"), 0).show();
return;
}
if (downloadStatus == 0) {
bz.a().a(this.f6615a, 41000, 2, "点击Icon");
ac.a(this.f6615a).a(excellianceAppInfo);
new com.excelliance.kxqp.bitmap.ui.a.e(this.f6615a, excellianceAppInfo, new Runnable() {
@Override
public void run() {
bz.a().a(LaunchViewModel.this.f6615a, 41000, 3, "点击下载");
com.excelliance.kxqp.gs.appstore.editors.detail.a.a(LaunchViewModel.this.f6615a, excellianceAppInfo, "defaultGame", 0);
}
}).run();
return;
}
if (downloadStatus == 9) {
cg.a(this.f6615a, w.e(this.f6615a, "tourist_play_already_down") + ":" + excellianceAppInfo.getAppName());
return;
}
Toast.makeText(this.f6615a, w.e(this.f6615a, "installing_now"), 0).show();
}
@Override
public void onCleared() {
super.onCleared();
Log.d("LaunchViewModel", String.format("LaunchViewModel/onCleared:thread(%s)", Thread.currentThread().getName()));
this.e.b(this.k);
this.k = null;
if (this.i != null) {
this.i.g();
}
synchronized (this.j) {
Iterator<io.reactivex.b.b> it = this.j.iterator();
while (it.hasNext()) {
it.next().a();
}
}
this.d.removeCallbacksAndMessages(null);
this.c.removeCallbacksAndMessages(null);
this.c.getLooper().quit();
}
public void b(final ExcellianceAppInfo excellianceAppInfo) {
final CityBean I;
int i;
final String appPackageName = excellianceAppInfo.getAppPackageName();
az.e("LaunchViewModel", "selectProxyBeforeStart appPackageName:" + appPackageName);
if (this.f6615a == null) {
return;
}
final Context applicationContext = this.f6615a.getApplicationContext();
if (by.a(applicationContext, "sp_total_info").b("sp_disconnectioin", false).booleanValue() || (I = as.I(applicationContext)) == null || au.a().a(applicationContext, excellianceAppInfo.getAppPackageName())) {
return;
}
if (!au.a().b(applicationContext, excellianceAppInfo.getAppPackageName())) {
i = 2;
} else if (com.excelliance.kxqp.gs.k.b.a().f() == null || I.getId() == null) {
i = 0;
} else {
Integer num = com.excelliance.kxqp.gs.k.b.a().f().get(I.getId());
i = num != null ? num.intValue() : 0;
}
az.d("LaunchViewModel", "selectProxyBeforeStart appPackageName:" + appPackageName + ", stateCode = " + i);
if (i == 1) {
final int i2 = i;
this.c.post(new Runnable() {
@Override
public void run() {
String str;
boolean z;
boolean z2;
boolean b2 = com.excelliance.kxqp.gs.ui.accelerate.a.a().b(applicationContext, appPackageName);
CountDownLatch countDownLatch = new CountDownLatch(1);
if (!b2) {
o.a(LaunchViewModel.this.f6615a).a(appPackageName, countDownLatch);
}
LastAllProxyInfo a2 = LaunchViewModel.a(appPackageName, LaunchViewModel.this.f6615a);
az.d("LaunchViewModel", "selectProxyBeforeStart appPackageName:" + appPackageName + " lastAllProxyInfo:" + a2);
if (a2.mGameReginBean != null) {
if (com.excelliance.kxqp.gs.util.b.cG(LaunchViewModel.this.f6615a) && a2.mGameReginBean.isTempUseVip == ReginBean.IS_TEMP_USE_VIP && !bx.a().n(LaunchViewModel.this.f6615a)) {
String id = I.getId();
az.d("LaunchViewModel", "selectProxyBeforeStart appPackageName:" + appPackageName + " commonArea:" + id);
str = id;
z = true;
} else {
str = null;
z = false;
}
if (z) {
a.b a3 = new a.b.C0249a().a(LaunchViewModel.this.f6615a).a(appPackageName).b(str).e(str).d(true).c(true).e(true).f(true).a(true).a(a2.dAreaBean).a(a2.downloadAreaBean).a();
com.excelliance.kxqp.gs.g.c.a().b(LaunchViewModel.this.f6615a, "是");
ProxyConfigHelper.getInstance(LaunchViewModel.this.f6615a).switchProxyWithTakeProxyWithCheck(a3);
} else {
a.b a4 = new com.excelliance.kxqp.gs.k.a.c().a(new a.b.C0249a().a(LaunchViewModel.this.f6615a).a(appPackageName).b(a2.cityGame).e(a2.citySpecial).b(a2.mSpecialReginBean).a(a2.mGameReginBean).g(false).h(false).d(true).c(true).e(true).f(true).a(true).a(a2.dAreaBean).a(a2.downloadAreaBean).a());
if (bt.f11927a) {
z2 = bt.a(LaunchViewModel.this.f6615a, appPackageName, a2.mGameReginBean != null ? a2.mGameReginBean.ip : null, a2.mGameReginBean != null ? a2.mGameReginBean.port : null, (LoginAreaBean) null, (DownloadAreaBean) null);
} else {
z2 = true;
}
az.d("LaunchViewModel", "selectProxyBeforeStart appPackageName:" + appPackageName + " gameProxyRunning:" + z2 + ", ipAvailableChange = " + a4.t());
if (a4.t() || (bt.f11927a && !z2)) {
com.excelliance.kxqp.gs.g.c.a().b(LaunchViewModel.this.f6615a, "是");
ProxyConfigHelper.getInstance(LaunchViewModel.this.f6615a).switchProxyWithTakeProxy(a4);
}
}
}
final com.excelliance.kxqp.gs.k.c a5 = new com.excelliance.kxqp.gs.k.c().a(applicationContext, i2).a(I.getName()).a(true);
if (excellianceAppInfo.apkFrom == 2) {
a5.a(false);
}
Runnable runnable = new Runnable() {
@Override
public void run() {
com.excelliance.kxqp.n.a().a(com.excelliance.kxqp.gs.k.c.f6576a, com.excelliance.kxqp.gs.k.c.class).postValue(a5);
LaunchViewModel.this.a(applicationContext, excellianceAppInfo.appPackageName);
}
};
if (com.excelliance.kxqp.gs.util.b.bx(applicationContext) && com.excelliance.kxqp.gs.ui.accelerate.a.b(applicationContext, excellianceAppInfo)) {
com.excelliance.kxqp.gs.ui.accelerate.a.a().a(runnable);
} else {
runnable.run();
}
if (b2) {
return;
}
countDownLatch.countDown();
}
});
return;
}
final com.excelliance.kxqp.gs.k.c a2 = new com.excelliance.kxqp.gs.k.c().a(applicationContext, i).a(I.getName()).a(true);
if (excellianceAppInfo.apkFrom == 2) {
a2.a(false);
}
Runnable runnable = new Runnable() {
@Override
public void run() {
com.excelliance.kxqp.n.a().a(com.excelliance.kxqp.gs.k.c.f6576a, com.excelliance.kxqp.gs.k.c.class).postValue(a2);
LaunchViewModel.this.a(applicationContext, excellianceAppInfo.appPackageName);
}
};
if (com.excelliance.kxqp.gs.util.b.bx(applicationContext) && com.excelliance.kxqp.gs.ui.accelerate.a.b(applicationContext, excellianceAppInfo)) {
com.excelliance.kxqp.gs.ui.accelerate.a.a().a(runnable);
} else {
runnable.run();
}
}
public void a(Context context, String str) {
String b2 = by.a(context, "sp_config_vpn_regin_id").b("sp_key_config_vpn_ip_and_port", "");
if (!TextUtils.isEmpty(b2) && b2.split(":").length == 2) {
by.a(context, "last_app_bind_proxy").a(str, b2);
az.d("LaunchViewModel", "bindProxyAndAppNoSwitchProxy bind app and proxy: " + str + " " + b2);
}
String b3 = by.a(context, "sp_config_vpn_regin_id").b("sp_key_config_vpn_id_and_port_for_gp", "");
if (TextUtils.isEmpty(b3) || b3.split(":").length != 2) {
return;
}
by.a(context, "last_app_bind_proxy").a(str + "_gp", b3);
az.d("LaunchViewModel", "bindProxyAndAppNoSwitchProxy bind app and proxy: " + str + " " + b3);
}
public void c(final ExcellianceAppInfo excellianceAppInfo) {
if (this.f6615a == null) {
return;
}
boolean z = true;
if (!aq.v()) {
boolean u = aq.a().u();
boolean t = aq.a().t();
boolean n = bx.a().n(this.f6615a);
if (!u && !t && !n) {
z = false;
}
}
if (z) {
Boolean valueOf = Boolean.valueOf(as.w(this.f6615a));
au a2 = au.a();
int c = a2.c(excellianceAppInfo.getAppPackageName());
az.d("LaunchViewModel", "selectOptimalProxyBeforeStart autoConnectOptimal: " + valueOf);
if (!valueOf.booleanValue() || a2.a(c)) {
return;
}
this.c.post(new Runnable() {
@Override
public void run() {
LaunchViewModel.this.c(excellianceAppInfo.getAppPackageName());
}
});
}
}
@ChildThread
public void c(String str) {
az.d("LaunchViewModel", "switchOptimalProxy appPackageName:" + str);
if (this.f6615a == null) {
return;
}
if (com.excelliance.kxqp.gs.ui.accelerate.a.a().b(this.f6615a, str)) {
d(str);
} else {
e(str);
}
}
@ChildThread
private void d(String str) {
String str2;
String str3;
boolean z;
az.d("LaunchViewModel", "switchOptimalProxyResume appPackageName:" + str);
LastAllProxyInfo a2 = a(str, this.f6615a);
az.d("LaunchViewModel", "switchOptimalProxyResume appPackageName:" + str + " lastAllProxyInfo:" + a2);
if (a2.mGameReginBean == null) {
return;
}
if (com.excelliance.kxqp.gs.util.b.cG(this.f6615a) && a2.mGameReginBean.isTempUseVip == ReginBean.IS_TEMP_USE_VIP && !bx.a().n(this.f6615a)) {
str2 = as.f(a2.mGameReginBean.id);
az.d("LaunchViewModel", "switchOptimalProxyResume appPackageName:" + str + " commonArea:" + str2);
if (!TextUtils.isEmpty(str2)) {
str3 = str2;
z = true;
if (!z) {
a.b a3 = new a.b.C0249a().a(this.f6615a).a(str).b(str3).e(str3).d(true).c(true).e(true).f(true).a(true).a(a2.dAreaBean).a(a2.downloadAreaBean).a();
com.excelliance.kxqp.gs.g.c.a().b(this.f6615a, "是");
ProxyConfigHelper.getInstance(this.f6615a).switchOptimalProxyResumeWithCheck(a3);
return;
} else {
a.b a4 = new com.excelliance.kxqp.gs.k.a.e().a(new a.b.C0249a().a(this.f6615a).a(str).b(a2.cityGame).e(a2.citySpecial).b(a2.mSpecialReginBean).a(a2.mGameReginBean).g(false).h(false).d(true).c(true).e(true).f(true).a(true).a(a2.dAreaBean).a(a2.downloadAreaBean).a());
if (a4.t()) {
com.excelliance.kxqp.gs.g.c.a().b(this.f6615a, "是");
ProxyConfigHelper.getInstance(this.f6615a).switchOptimalProxyResume(a4);
return;
}
return;
}
}
} else {
str2 = null;
}
str3 = str2;
z = false;
if (!z) {
}
}
@ChildThread
private void e(String str) {
LoginAreaBean loginAreaBean;
DownloadAreaBean downloadAreaBean;
boolean z;
az.d("LaunchViewModel", "switchOptimalProxyAllProcess appPackageName:" + str);
CountDownLatch countDownLatch = new CountDownLatch(1);
o.a(this.f6615a).a(str, countDownLatch);
AppExtraBean d = com.excelliance.kxqp.repository.a.a(this.f6615a).d(str);
if (d != null) {
LoginAreaBean g = ay.g(d.getDArea());
downloadAreaBean = ay.h(d.getXArea());
loginAreaBean = g;
} else {
loginAreaBean = null;
downloadAreaBean = null;
}
com.excelliance.kxqp.gs.g.c.a().b(this.f6615a, "是");
a.c switchOptimalProxy = ProxyConfigHelper.getInstance(this.f6615a).switchOptimalProxy(str, true, loginAreaBean, downloadAreaBean, false);
ReginBean b2 = switchOptimalProxy.b();
List<CityBean> a2 = ay.a(by.a(this.f6615a, "sp_city_config").b("sp_city_config", ""), !aq.v());
String v = as.v(this.f6615a);
if (b2 != null && !com.excelliance.kxqp.gs.util.s.a(a2)) {
Iterator<CityBean> it = a2.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
CityBean next = it.next();
if (TextUtils.equals(next.getId(), b2.id)) {
v = next.getName();
break;
}
}
}
int c = switchOptimalProxy.c();
az.d("LaunchViewModel", "switchOptimalProxy:state" + switchOptimalProxy.c());
boolean n = au.a().n(str, this.f6615a);
if (ProxyDelayService.f8210a.contains(str)) {
z = false;
c = 1;
} else {
z = !n;
}
if (!bf.e(this.f6615a)) {
z = true;
c = -3;
}
if (!au.a().b(this.f6615a, str)) {
if (au.a().a(this.f6615a, str)) {
as.i();
countDownLatch.countDown();
return;
}
c = 2;
}
final com.excelliance.kxqp.gs.k.c cVar = new com.excelliance.kxqp.gs.k.c();
cVar.a(this.f6615a, c).a(v).a(z).c((c == 2 || c == -3) ? false : true);
final ExcellianceAppInfo b3 = com.excelliance.kxqp.repository.a.a(this.f6615a).b(str);
Runnable runnable = new Runnable() {
@Override
public void run() {
if (b3 != null) {
az.d("LaunchViewModel", String.format("MainFragment/switchOptimalProxy:thread(%s) pkg = %s,apkFrom = %d", Thread.currentThread(), b3.getAppPackageName(), Integer.valueOf(b3.apkFrom)));
if (b3.apkFrom != 2) {
com.excelliance.kxqp.n.a().a(com.excelliance.kxqp.gs.k.c.f6576a, com.excelliance.kxqp.gs.k.c.class).postValue(cVar);
return;
}
return;
}
com.excelliance.kxqp.n.a().a(com.excelliance.kxqp.gs.k.c.f6576a, com.excelliance.kxqp.gs.k.c.class).postValue(cVar);
}
};
if (com.excelliance.kxqp.gs.util.b.bx(this.f6616b) && com.excelliance.kxqp.gs.ui.accelerate.a.b(this.f6616b, b3)) {
com.excelliance.kxqp.gs.ui.accelerate.a.a().a(runnable);
} else {
runnable.run();
}
as.i();
countDownLatch.countDown();
}
public static LastAllProxyInfo a(String str, Context context) {
CityBean cityBean;
String id;
LastAllProxyInfo lastAllProxyInfo = new LastAllProxyInfo();
lastAllProxyInfo.gamePkg = str;
List<CityBean> a2 = ay.a(context, ay.a(by.a(context, "sp_city_config").b("sp_city_config", ""), true));
int t = as.t(context);
if (a2 != null && a2.size() > t && (cityBean = a2.get(t)) != null) {
by a3 = by.a(context, "sp_config_vpn_regin_id");
ReginBean s = ay.s(a3.b("sp_key_config_vpn_game_all_info", ""));
if (s != null && !TextUtils.isEmpty(s.ip) && !TextUtils.isEmpty(s.port) && !TextUtils.isEmpty(s.key) && !TextUtils.isEmpty(s.pwd)) {
AppExtraBean d = com.excelliance.kxqp.repository.a.a(context).d(str);
if (d != null) {
LoginAreaBean g = ay.g(d.getDArea());
DownloadAreaBean h = ay.h(d.getXArea());
lastAllProxyInfo.dAreaBean = g;
lastAllProxyInfo.downloadAreaBean = h;
}
if (!TextUtils.isEmpty(cityBean.getId()) && (aq.v() || aq.e())) {
id = cityBean.getId().replace("_0", "").replace("_1", "");
} else {
id = cityBean.getId();
}
lastAllProxyInfo.mGameReginBean = s;
lastAllProxyInfo.cityGame = id;
String s2 = as.s(context);
ReginBean s3 = ay.s(a3.b("sp_key_config_vpn_special_all_info", ""));
if (s3 != null && !TextUtils.isEmpty(s3.ip) && !TextUtils.isEmpty(s3.port) && !TextUtils.isEmpty(s3.key) && !TextUtils.isEmpty(s3.pwd)) {
lastAllProxyInfo.mSpecialReginBean = s3;
lastAllProxyInfo.citySpecial = s2;
}
}
}
return lastAllProxyInfo;
}
public void a(String str, boolean z) {
az.i("LaunchViewModel", "LaunchViewModel/updateApk() called with: thread = 【" + Thread.currentThread() + "】, url = 【" + str + "】");
if (com.excelliance.kxqp.gs.util.n.a(str)) {
return;
}
aj b2 = com.excelliance.kxqp.gs.util.e.b(this.f6615a, str, z);
if (this.f6615a == null || this.f6615a.isFinishing() || !b2.f11765b) {
return;
}
UpdateProgressDialog.b(z ? com.excelliance.kxqp.gs.ui.home.b.a(this.f6615a).e() : this.f6615a.getPackageName()).a(new UpdateProgressDialog.a() {
@Override
public void a(boolean z2) {
}
}).a();
}
public void d() {
if (this.g == null || !this.g.isShowing()) {
return;
}
try {
int a2 = com.excelliance.kxqp.gs.util.g.a(this.f6615a).a(true);
int a3 = com.excelliance.kxqp.util.master.d.a(this.f6615a, com.excelliance.kxqp.util.master.e.b(this.f6615a), a2);
Log.d("LaunchViewModel", "onResume: forceUdateDialogOfAssistance " + a2 + "\t" + a3);
if (a2 <= 0 || a2 < a3) {
return;
}
this.g.dismiss();
this.g = null;
} catch (Exception e) {
e.printStackTrace();
}
}
public void a(final boolean z, final boolean z2) {
Log.d("LaunchViewModel", String.format("LaunchViewModel/checkNewVersion:thread(%s) isAassistant(%s) forceTake(%s)", Thread.currentThread().getName(), Boolean.valueOf(z), Boolean.valueOf(z2)));
if (com.excelliance.kxqp.gs.ui.novice.c.c(this.f6616b)) {
a(io.reactivex.i.a(new io.reactivex.k<Bundle>() {
@Override
public void a(io.reactivex.j<Bundle> jVar) throws Exception {
Bundle a2 = new com.excelliance.kxqp.gs.l.b(LaunchViewModel.this.f6615a).a(z);
if (a2 != null) {
jVar.a((io.reactivex.j<Bundle>) a2);
}
jVar.v_();
}
}).c(new io.reactivex.d.g<Bundle>() {
@Override
public boolean a(Bundle bundle) throws Exception {
return z2;
}
}).b(io.reactivex.g.a.b()).a(io.reactivex.g.a.b()).a(new AnonymousClass13(), new d()));
}
}
public class AnonymousClass13 implements io.reactivex.d.d<Bundle> {
AnonymousClass13() {
}
@Override
public void accept(final Bundle bundle) throws Exception {
Runnable runnable = new Runnable() {
@Override
public void run() {
com.excelliance.kxqp.gs.ui.novice.c.a((Context) LaunchViewModel.this.f6615a).a(new Runnable() {
@Override
public void run() {
LaunchViewModel.this.a(bundle);
}
});
}
};
if (com.excelliance.kxqp.gs.util.b.bt(LaunchViewModel.this.f6615a)) {
com.excelliance.kxqp.gs.guide.v2.a.a().a(LaunchViewModel.this.f6615a, runnable);
return;
}
if (com.excelliance.kxqp.gs.util.b.bD(LaunchViewModel.this.f6615a)) {
com.excelliance.kxqp.gs.guide.c.a().a(LaunchViewModel.this.f6615a, runnable);
} else if (com.excelliance.kxqp.gs.util.b.bS(LaunchViewModel.this.f6615a)) {
com.excelliance.kxqp.gs.guide.v3.b.a().a(LaunchViewModel.this.f6615a, runnable);
} else {
com.excelliance.kxqp.gs.guide.b.a().a(LaunchViewModel.this.f6615a, runnable);
}
}
}
class AnonymousClass16 implements Runnable {
AnonymousClass16() {
}
@Override
public void run() {
by a2 = by.a(LaunchViewModel.this.f6615a, "sp_new_version_info");
Boolean b2 = a2.b("has_need_show", true);
Log.d("LaunchViewModel", "showNewVersionOnResume: hasNeedShow = " + b2);
if (b2.booleanValue()) {
final Bundle a3 = new com.excelliance.kxqp.gs.l.b(LaunchViewModel.this.f6615a).a(false);
Boolean b3 = a2.b("has_saved_before", false);
Log.d("LaunchViewModel", "showNewVersionOnResume: hasSaved = " + b3);
if (b3.booleanValue()) {
Runnable runnable = new Runnable() {
@Override
public void run() {
com.excelliance.kxqp.gs.ui.novice.c.a((Context) LaunchViewModel.this.f6615a).a(new Runnable() {
@Override
public void run() {
LaunchViewModel.this.a(a3);
}
});
}
};
if (com.excelliance.kxqp.gs.util.b.bt(LaunchViewModel.this.f6615a)) {
com.excelliance.kxqp.gs.guide.v2.a.a().a(LaunchViewModel.this.f6615a, runnable);
} else if (com.excelliance.kxqp.gs.util.b.bD(LaunchViewModel.this.f6615a)) {
com.excelliance.kxqp.gs.guide.c.a().a(LaunchViewModel.this.f6615a, runnable);
} else if (com.excelliance.kxqp.gs.util.b.bS(LaunchViewModel.this.f6615a)) {
com.excelliance.kxqp.gs.guide.v3.b.a().a(LaunchViewModel.this.f6615a, runnable);
} else {
com.excelliance.kxqp.gs.guide.b.a().a(LaunchViewModel.this.f6615a, runnable);
}
a2.a("has_need_show", false);
}
}
}
}
public void e() {
this.c.post(new AnonymousClass16());
}
public void a(Bundle bundle) {
az.i("LaunchViewModel", "LaunchViewModel/handleVersionResult() called with: thread = 【" + Thread.currentThread() + "】, bundle = 【" + bundle + "】");
if (bundle == null) {
return;
}
if (bundle.getShort("b64", (short) 0) == 1 && !com.excelliance.kxqp.manager.d.a(this.f6615a).b()) {
a(bundle.getString("apkUrl"), bundle.getShort("b64") == 1);
} else {
a(io.reactivex.i.b(bundle).a(io.reactivex.g.a.b()).b((io.reactivex.d.e) new io.reactivex.d.e<Bundle, Message>() {
@Override
public Message a(Bundle bundle2) throws Exception {
return new com.excelliance.kxqp.gs.l.b(LaunchViewModel.this.f6615a).a(bundle2);
}
}).c(new io.reactivex.d.g<Message>() {
@Override
public boolean a(Message message) throws Exception {
return message.what != -1;
}
}).a(io.reactivex.a.b.a.a()).b((io.reactivex.d.d) new io.reactivex.d.d<Message>() {
@Override
public void accept(Message message) throws Exception {
s.a<ExcellianceAppInfo> aVar = new s.a<ExcellianceAppInfo>() {
@Override
public void call(ExcellianceAppInfo excellianceAppInfo) {
h.b a2 = new h.b.a().a(LaunchViewModel.this).a(excellianceAppInfo).a();
Activity b2 = a2.b();
if (b2 != null) {
q.a(b2).a(a2);
}
}
};
Activity activity = LaunchViewModel.this.f6615a;
if (activity != null) {
q.a(activity).a(message, new s(LaunchViewModel.this, aVar));
}
}
}));
}
}
public boolean a(Bundle bundle, g.a aVar) {
return com.excelliance.kxqp.util.master.a.a(this.f6615a, bundle, new a.InterfaceC0598a() {
@Override
public void a() {
LaunchViewModel.this.a(true, true);
}
}, aVar);
}
public void a(final String str, final String str2, final Runnable runnable) {
this.c.post(new Runnable() {
@Override
public void run() {
try {
bx a2 = bx.a();
String a3 = a2.a(LaunchViewModel.this.f6615a);
JSONObject jSONObject = new JSONObject();
jSONObject.put("rid", a3);
jSONObject.put("name", str);
jSONObject.put("idCard", str2);
jSONObject.put("aid", av.a().a(LaunchViewModel.this.f6615a));
String c = bd.c("https://api.ourplay.com.cn/user/verify", jSONObject.toString());
if (TextUtils.isEmpty(c)) {
ai.a().a(LaunchViewModel.this.f6615a, "");
ai.a().a((Context) LaunchViewModel.this.f6615a, "启动页");
return;
}
JSONObject jSONObject2 = new JSONObject(c);
int optInt = jSONObject2.optInt("code");
String optString = jSONObject2.optString("msg");
int optInt2 = jSONObject2.optJSONObject("data").optInt("isAdult");
if (optInt == 0) {
if (a2.b(LaunchViewModel.this.f6615a)) {
SharedPreferences sharedPreferences = LaunchViewModel.this.f6615a.getSharedPreferences("USERINFO", 0);
bx a4 = bx.a();
a4.a(sharedPreferences, "USER_REAL_NAME_VERIFY", 1);
a4.b(sharedPreferences, "USER_REAL_NAME", str);
a4.b(sharedPreferences, "USER_ID_NUMBER", str2);
a4.a(sharedPreferences, "USER_IS_ADULT", optInt2);
} else {
SharedPreferences sharedPreferences2 = LaunchViewModel.this.f6615a.getSharedPreferences("USERINFO", 0);
bx a5 = bx.a();
a5.a(sharedPreferences2, "DEVICE_ID_VERIFY", 1);
a5.b(sharedPreferences2, "DEVICE_REAL_NAME", str);
a5.b(sharedPreferences2, "DEVICE_ID_NUMBER", str2);
a5.a(sharedPreferences2, "DEVICE_IS_ADULT", optInt2);
}
ai.a();
ai.b(LaunchViewModel.this.f6615a);
runnable.run();
return;
}
ai.a().a(LaunchViewModel.this.f6615a, optString);
if (cd.a(optString)) {
ai.a().a((Context) LaunchViewModel.this.f6615a, "启动页");
} else {
ai.a().a(LaunchViewModel.this.f6615a, "启动页", optString);
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}