OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046
以下内容为反编译后的 WXEntryActivity.java 源代码,内容仅作参考
package com.excean.gspace.wxapi;
import a.q;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.work.WorkRequest;
import com.excelliance.dualaid.a;
import com.excelliance.kxqp.api.ApiManager;
import com.excelliance.kxqp.bitmap.ui.b;
import com.excelliance.kxqp.bitmap.ui.b.i;
import com.excelliance.kxqp.gs.main.MainActivity;
import com.excelliance.kxqp.gs.thpool.tp;
import com.excelliance.kxqp.gs.ui.share.core.ui.WxAssistActivity;
import com.excelliance.kxqp.gs.util.az;
import com.excelliance.kxqp.gs.util.by;
import com.excelliance.kxqp.gs.util.cg;
import com.excelliance.kxqp.gs.util.w;
import com.tencent.mm.opensdk.modelbase.BaseReq;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.modelbiz.WXLaunchMiniProgram;
import com.tencent.mm.opensdk.modelmsg.SendAuth;
import com.tencent.mm.opensdk.modelmsg.ShowMessageFromWX;
import com.tencent.mm.opensdk.modelmsg.WXAppExtendObject;
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import java.util.List;
import org.json.JSONException;
import org.json.JSONObject;
public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
private IWXAPI f1454a;
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
Log.d("WXEntryActivity", "onCreate intent " + getIntent());
if (this.f1454a == null) {
b();
Log.d("WXEntryActivity", "wxApi init");
}
}
private void b() {
this.f1454a = WXAPIFactory.createWXAPI(this, a(), true);
if (this.f1454a.isWXAppInstalled()) {
this.f1454a.registerApp(a());
}
try {
this.f1454a.handleIntent(getIntent(), this);
} catch (Exception e) {
e.printStackTrace();
Log.e("WXEntryActivity", "handle intent fail:" + e.getMessage());
}
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Log.d("WXEntryActivity", "onNewIntent");
setIntent(intent);
if (this.f1454a != null) {
this.f1454a.handleIntent(intent, this);
}
}
@Override
public void onReq(BaseReq baseReq) {
Log.d("WXEntryActivity", "onReq " + baseReq);
if (baseReq.getType() == 4) {
az.d("WXEntryActivity", "onReq COMMAND_SHOWMESSAGE_FROM_WX ");
WXMediaMessage wXMediaMessage = ((ShowMessageFromWX.Req) baseReq).message;
if (wXMediaMessage != null) {
az.d("WXEntryActivity", "onReq obj = " + ((WXAppExtendObject) wXMediaMessage.mediaObject) + ", messageExt = " + wXMediaMessage.messageExt);
try {
if (!TextUtils.isEmpty(wXMediaMessage.messageExt)) {
String optString = new JSONObject(wXMediaMessage.messageExt).optString("data");
az.d("WXEntryActivity", "onReq dpLink = " + optString);
if (!TextUtils.isEmpty(optString) && optString.startsWith("ourplay://")) {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(Uri.parse(optString));
intent.addFlags(268435456);
intent.setPackage(getPackageName());
startActivity(intent);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
finish();
}
@Override
public void onResp(BaseResp baseResp) {
Log.d("WXEntryActivity", "onResp");
a(baseResp);
finish();
}
private void a(final BaseResp baseResp) {
az.i("WXEntryActivity", "parseResult: /-----errStr: " + baseResp.errStr + " / -----openId: " + baseResp.openId + " / -----transaction: " + baseResp.transaction + " / -----getType: " + baseResp.getType() + " / -----checkArgs: " + baseResp.checkArgs() + " / -----errCode: " + baseResp.errCode);
if (baseResp.getType() == 19) {
WXLaunchMiniProgram.Resp resp = (WXLaunchMiniProgram.Resp) baseResp;
String str = resp.extMsg;
az.d("WXEntryActivity", "onResp --- extraData:" + str);
String str2 = "onResp --- errStr:" + baseResp.errStr + " --- errCode: " + baseResp.errCode + " --- transaction: " + baseResp.transaction + " --- openId:" + baseResp.openId + " --- extMsg:" + resp.extMsg;
if (!TextUtils.isEmpty(str)) {
try {
String optString = new JSONObject(str).optString("gamepkg");
if (!TextUtils.isEmpty(optString)) {
ActivityManager activityManager = (ActivityManager) getSystemService("activity");
List<ActivityManager.RunningTaskInfo> runningTasks = activityManager.getRunningTasks(2);
for (int i = 0; i < runningTasks.size(); i++) {
ActivityManager.RunningTaskInfo runningTaskInfo = runningTasks.get(i);
if (runningTaskInfo != null && runningTaskInfo.baseActivity != null && TextUtils.equals(runningTaskInfo.baseActivity.getClassName(), MainActivity.class.getName())) {
activityManager.moveTaskToFront(runningTaskInfo.id, 1);
by.a(this, "sp_config").a("sp_key_is_back_from_add_friends_mini_program", false);
b.a().b(new i.b(optString));
return;
}
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
com.chinaums.pppay.a.b.a(this).b().a(this, baseResp);
return;
}
int i2 = baseResp.errCode;
if (i2 == 0) {
Log.d("WXEntryActivity", "parse resp: success");
int type = baseResp.getType();
if (type != 18) {
switch (type) {
case 1:
SendAuth.Resp resp2 = (SendAuth.Resp) baseResp;
String str3 = resp2.code;
az.d("WXEntryActivity", "code = " + str3 + " state:" + resp2.state + " url:" + resp2.url + " lang" + resp2.lang + " country:" + resp2.country);
a(str3, WxAssistActivity.BUNDLE_OAUTH_MSC);
return;
case 2:
cg.a(this, w.e(this, "share_sdk_share_success"));
a(200, (String) null);
return;
default:
a(200, (String) null);
return;
}
}
if (TextUtils.isEmpty(baseResp.openId)) {
return;
}
tp.f(new Runnable() {
@Override
public void run() {
try {
Log.d("WXEntryActivity", "parseResult: " + ApiManager.getInstance().a(WXEntryActivity.this, WorkRequest.DEFAULT_BACKOFF_DELAY_MILLIS, WorkRequest.DEFAULT_BACKOFF_DELAY_MILLIS, "https://gapi.ourplay.com.cn/").a(new q.a().a("openid", baseResp.openId).a()).a());
} catch (Exception e2) {
e2.printStackTrace();
}
}
});
return;
}
switch (i2) {
case -4:
a("", WxAssistActivity.BUNDLE_OAUTH_ERROR);
cg.a(this, w.e(this, "wx_oauth_error"));
return;
case -3:
Log.d("WXEntryActivity", "parse resp: fail");
a(202, baseResp.errStr);
return;
case -2:
Log.d("WXEntryActivity", "parse resp: cancel");
if (2 == baseResp.getType()) {
cg.a(this, w.e(this, "share_sdk_share_cancel"));
a(201, (String) null);
return;
} else if (1 == baseResp.getType()) {
a("", WxAssistActivity.BUNDLE_OAUTH_ERROR);
cg.a(this, w.e(this, "cancel_wx_oauth"));
return;
} else {
a(201, (String) null);
return;
}
default:
return;
}
}
private void a(int i, String str) {
Intent intent = new Intent(WxAssistActivity.ACTION_RESULT);
intent.putExtra("status_code", i);
intent.putExtra("status_msg", str);
sendBroadcast(intent);
}
private void a(String str, String str2) {
Intent intent = new Intent(WxAssistActivity.ACTION_WXLOGIN_RESULT);
intent.putExtra(WxAssistActivity.BUNDLE_OAUTH_CODE, str);
intent.putExtra(WxAssistActivity.BUNDLE_OAUTH_RESULT, str2);
LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
}
protected String a() {
return a.a(getPackageName());
}
}