换机精灵 v2.5.2版本的 MD5 值为:469dcb6202646d6ec40973ea20c8c14b
以下内容为反编译后的 m.java 源代码,内容仅作参考
package com.cx.launcher.cloud;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
import com.cx.huanji.MyApplication;
import com.cx.huanji.R;
import com.cx.huanji.h.be;
import com.cx.launcher.cloud.ui.CloudLoginActivity;
import com.cx.launcher.cloud.ui.CloudMainActivity;
import com.tencent.connect.UserInfo;
import com.tencent.mm.sdk.modelmsg.SendAuth;
import com.tencent.mm.sdk.openapi.IWXAPI;
import com.tencent.mm.sdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.sdk.openapi.WXAPIFactory;
import com.tencent.tauth.Tencent;
import java.lang.ref.WeakReference;
import java.util.Iterator;
import java.util.Stack;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.http.HttpStatus;
public class m {
private static final String f3210a = m.class.getSimpleName();
private static m f3211b = null;
private Context f3212c;
private String e;
private com.cx.launcher.cloud.b.l l;
private IWXAPI n;
private com.cx.launcher.cloud.c.a o;
private String q;
private String r;
private String s;
private Tencent d = null;
private o f = null;
private o g = null;
private Stack h = null;
private boolean i = false;
private boolean j = false;
private com.cx.launcher.cloud.c.a k = null;
private AtomicBoolean m = new AtomicBoolean(false);
private ConcurrentLinkedQueue p = new ConcurrentLinkedQueue();
private boolean t = true;
private m(Context context) {
this.f3212c = null;
this.l = null;
this.f3212c = context;
this.l = com.cx.launcher.cloud.b.l.a(this.f3212c);
if (context.getPackageName().equals("com.cx.tidy") && this.t) {
com.cx.tools.e.a.c(f3210a, "Use tidy version login!");
this.q = "1105217371";
this.r = "wx7632cd32304387e0";
this.s = "c5ea3220b94172c0cf7f69fd644a7641";
return;
}
com.cx.tools.e.a.c(f3210a, "Use huanji version login!");
this.q = "1101695461";
this.r = "wx40a39a31498383a3";
this.s = "3ea43a7efb91f36a6ff90080840aafa1";
}
public static m a(Context context) {
if (f3211b == null) {
synchronized (m.class) {
if (f3211b == null) {
f3211b = new m(context);
}
}
}
return f3211b;
}
private void a(int i, String str) {
com.cx.launcher.cloud.f.d dVar = new com.cx.launcher.cloud.f.d();
dVar.a(new p(this, i));
dVar.a(str, com.cx.launcher.cloud.f.e.GET, null);
}
public void a(int i, Object... objArr) {
Iterator it = this.p.iterator();
while (it.hasNext()) {
n nVar = (n) ((WeakReference) it.next()).get();
if (nVar != null) {
com.cx.tools.e.a.c(f3210a, "sendLoginStatusToUI-->" + i + ",size:" + this.p.size());
switch (i) {
case 107:
nVar.a((com.cx.launcher.cloud.c.b) objArr[0]);
break;
case 109:
nVar.a((com.cx.launcher.cloud.c.a) objArr[0]);
break;
case 110:
nVar.a((com.cx.launcher.cloud.c.b) objArr[0], ((Integer) objArr[1]).intValue());
break;
case 111:
nVar.b((com.cx.launcher.cloud.c.b) objArr[0]);
break;
}
}
}
}
public void b(com.cx.launcher.cloud.c.b bVar) {
if (bVar != null) {
com.cx.launcher.cloud.f.a.a(this.f3212c, "accountType", bVar.a());
}
}
public void b(String str) {
try {
com.cx.tools.e.a.c(f3210a, "saveOpenId-->" + str);
if (be.a(str)) {
return;
}
com.cx.launcher.cloud.f.a.a(this.f3212c, "openId", com.cx.tools.i.a.a(MyApplication.f.toString(), str));
} catch (Exception e) {
e.printStackTrace();
}
}
private void b(String str, String str2) {
StringBuilder sb = new StringBuilder();
sb.append("https://api.weixin.qq.com/sns/auth");
sb.append("?access_token=" + str);
sb.append("&openid=" + str2);
a(104, sb.toString());
}
public void c(String str) {
if (be.a(str)) {
return;
}
com.cx.launcher.cloud.f.a.a(this.f3212c, "accessToken", str);
}
public void d(String str) {
if (be.a(str)) {
return;
}
com.cx.launcher.cloud.f.a.a(this.f3212c, "expiresIn", str);
}
private void e(String str) {
com.cx.launcher.cloud.f.a.a(this.f3212c, str);
}
public void f(String str) {
StringBuilder sb = new StringBuilder();
sb.append("https://api.weixin.qq.com/sns/oauth2/refresh_token");
sb.append("?appid=" + this.r);
sb.append("&grant_type=refresh_token");
sb.append("&refresh_token=" + str);
com.cx.tools.e.a.c(f3210a, "refreshWXAccessToken-->" + ((Object) sb));
a(HttpStatus.SC_PROCESSING, sb.toString());
}
private void j() {
new UserInfo(this.f3212c, this.d.getQQToken()).getUserInfo(this.g);
}
private com.cx.launcher.cloud.c.b k() {
com.cx.launcher.cloud.c.b bVar = com.cx.launcher.cloud.c.b.QQ_ACCOUNT;
try {
return com.cx.launcher.cloud.c.b.a(com.cx.launcher.cloud.f.a.b(this.f3212c, "accountType", 0));
} catch (Exception e) {
e.printStackTrace();
return bVar;
}
}
private String l() {
String b2 = com.cx.launcher.cloud.f.a.b(this.f3212c, "openId", "");
try {
return !be.a(b2) ? com.cx.tools.i.a.c(MyApplication.f.toString(), b2) : b2;
} catch (Exception e) {
e.printStackTrace();
return b2;
}
}
private String m() {
return com.cx.launcher.cloud.f.a.b(this.f3212c, "accessToken", "");
}
private void n() {
this.e = "all";
this.d = Tencent.createInstance(this.q, this.f3212c);
this.f = new o(this, "QQLogin");
this.g = new o(this, "GetQQUserInfo");
}
private void o() {
if (this.d == null) {
n();
}
com.cx.tools.e.a.c(f3210a, "setQQLoginInfo-->local file open id:" + l());
com.cx.launcher.cloud.c.a p = p();
if (p != null) {
this.d.setOpenId(p.a());
this.d.setAccessToken(p.b(), p.c());
}
}
private com.cx.launcher.cloud.c.a p() {
String l = l();
String m = m();
if (k() != com.cx.launcher.cloud.c.b.QQ_ACCOUNT || be.a(l) || be.a(m)) {
return null;
}
com.cx.launcher.cloud.c.a aVar = new com.cx.launcher.cloud.c.a();
aVar.a(com.cx.launcher.cloud.c.b.QQ_ACCOUNT);
aVar.a(l);
aVar.b(m);
return aVar;
}
private void q() {
Intent intent = new Intent();
intent.setClass(this.f3212c, CloudLoginActivity.class);
intent.addFlags(268435456);
this.f3212c.startActivity(intent);
}
public void r() {
this.o = null;
if (this.n != null) {
SendAuth.Req req = new SendAuth.Req();
req.scope = "snsapi_userinfo";
req.state = "cloud_weixin_login";
this.n.sendReq(req);
}
}
private com.cx.launcher.cloud.c.a s() {
String l = l();
String m = m();
if (k() != com.cx.launcher.cloud.c.b.WX_ACCOUNT || be.a(l) || be.a(m)) {
return null;
}
com.cx.launcher.cloud.c.a aVar = new com.cx.launcher.cloud.c.a();
aVar.a(com.cx.launcher.cloud.c.b.WX_ACCOUNT);
aVar.a(l);
aVar.b(m);
return aVar;
}
public com.cx.launcher.cloud.c.a a() {
return this.k;
}
public void a(int i, int i2, Intent intent) {
Tencent.onActivityResultData(i, i2, intent, this.f);
}
public void a(Activity activity) {
if (this.m.get()) {
Toast.makeText(this.f3212c, this.f3212c.getResources().getString(R.string.cloud_acount_relogin_tip), 0).show();
return;
}
this.m.set(true);
a(107, com.cx.launcher.cloud.c.b.QQ_ACCOUNT);
o();
if (this.d.isSessionValid()) {
com.cx.tools.e.a.c(f3210a, "QQ user info getting ....");
b();
} else {
com.cx.tools.e.a.c(f3210a, "QQ login ...." + this.e);
this.d.login(activity, this.e, this.f);
}
}
public void a(Context context, com.cx.launcher.cloud.c.a aVar) {
Intent intent = new Intent(context, (Class<?>) CloudMainActivity.class);
intent.putExtra("nickName", aVar.d());
intent.putExtra("photo_url1", aVar.e());
intent.addFlags(268435456);
context.startActivity(intent);
}
public void a(Intent intent, IWXAPIEventHandler iWXAPIEventHandler) {
if (this.n != null) {
this.n.handleIntent(intent, iWXAPIEventHandler);
}
}
public void a(com.cx.launcher.cloud.c.b bVar) {
if (bVar == com.cx.launcher.cloud.c.b.QQ_ACCOUNT && !this.i) {
this.m.set(false);
} else {
if (bVar != com.cx.launcher.cloud.c.b.WX_ACCOUNT || this.j) {
return;
}
this.m.set(false);
}
}
public void a(n nVar) {
if (nVar == null) {
return;
}
synchronized (m.class) {
Iterator it = this.p.iterator();
while (true) {
if (!it.hasNext()) {
this.p.add(new WeakReference(nVar));
break;
} else if (((n) ((WeakReference) it.next()).get()) == nVar) {
break;
}
}
}
}
public void a(String str) {
StringBuilder sb = new StringBuilder();
sb.append("https://api.weixin.qq.com/sns/oauth2/access_token");
sb.append("?appid=" + this.r);
sb.append("&secret=" + this.s);
sb.append("&code=" + str);
sb.append("&grant_type=authorization_code");
com.cx.tools.e.a.c(f3210a, "requestWXAccessToken-->" + ((Object) sb));
this.j = true;
a(HttpStatus.SC_SWITCHING_PROTOCOLS, sb.toString());
}
public void a(String str, String str2) {
StringBuilder sb = new StringBuilder();
sb.append("https://api.weixin.qq.com/sns/userinfo");
sb.append("?access_token=" + str);
sb.append("&openid=" + str2);
a(103, sb.toString());
}
public void b() {
com.cx.launcher.cloud.c.a a2 = this.l.a(this.d.getOpenId());
com.cx.tools.e.a.c(f3210a, "requestQQUserInfo : " + this.i);
if (this.i || a2 == null) {
j();
} else {
if (a2 == null) {
j();
return;
}
a(109, a2);
this.k = a2;
this.m.set(false);
}
}
public void b(n nVar) {
if (nVar == null) {
return;
}
synchronized (m.class) {
Iterator it = this.p.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
WeakReference weakReference = (WeakReference) it.next();
if (((n) weakReference.get()) == nVar) {
this.p.remove(weakReference);
break;
}
}
}
}
public void c() {
long currentTimeMillis = System.currentTimeMillis();
this.l.c();
com.cx.launcher.cloud.c.a a2 = this.l.a(l());
if (a2 != null) {
this.k = a2;
com.cx.launcher.cloud.d.i.a(this.f3212c).a();
com.cx.launcher.cloud.d.r.a(this.f3212c).a();
}
com.cx.huanji.tel.n.a().a(this.f3212c);
com.cx.tools.e.a.c(f3210a, "Cloud backup login init finished,use time:" + (System.currentTimeMillis() - currentTimeMillis) + "ms");
}
public void d() {
boolean z;
com.cx.launcher.cloud.c.a a2 = this.l.a(l());
if (a2 == null) {
q();
return;
}
com.cx.launcher.cloud.c.b g = a2.g();
String b2 = a2.b();
String d = a2.d();
String e = a2.e();
if (!be.a(b2) && !be.a(d) && !be.a(e)) {
com.cx.tools.e.a.c(f3210a, "requestCloudLogin-->" + g);
if (g != com.cx.launcher.cloud.c.b.QQ_ACCOUNT) {
z = true;
} else if (!be.a(a2.c())) {
z = true;
}
if (z) {
q();
return;
}
this.k = a2;
a(109, a2);
a(this.f3212c, a2);
return;
}
z = false;
if (z) {
}
}
public void e() {
com.cx.launcher.cloud.c.b k = k();
if (k == com.cx.launcher.cloud.c.b.QQ_ACCOUNT && this.d != null) {
this.d.logout(this.f3212c);
}
a(111, k);
e("accessToken");
e("openId");
e("accountType");
e("expiresIn");
this.k = null;
q();
}
public void f() {
if (this.n == null) {
this.n = WXAPIFactory.createWXAPI(this.f3212c, this.r, true);
this.n.registerApp(this.r);
}
if (!this.n.isWXAppInstalled()) {
Toast.makeText(this.f3212c, this.f3212c.getResources().getString(R.string.cloud_weixin_uninstalled), 0).show();
return;
}
if (this.m.get()) {
Toast.makeText(this.f3212c, this.f3212c.getResources().getString(R.string.cloud_acount_relogin_tip), 0).show();
return;
}
this.m.set(true);
a(107, com.cx.launcher.cloud.c.b.WX_ACCOUNT);
this.o = s();
if (this.o != null) {
b(this.o.b(), this.o.a());
} else {
r();
}
}
public void g() {
this.j = false;
this.m.set(false);
a(110, com.cx.launcher.cloud.c.b.WX_ACCOUNT, 113);
}
public long h() {
long d = this.l.d(this.k);
com.cx.tools.e.a.c(f3210a, "getLastSyncTime()==>" + d + "," + (System.currentTimeMillis() - d));
return d;
}
}