265 lines
9.9 KiB
Java
265 lines
9.9 KiB
Java
package com.tencent.connect.common;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
import android.os.Handler;
|
|
import android.os.Message;
|
|
import android.text.TextUtils;
|
|
import com.facebook.AccessToken;
|
|
import com.tencent.open.SocialConstants;
|
|
import com.tencent.open.a.f;
|
|
import com.tencent.open.b.d;
|
|
import org.json.JSONObject;
|
|
|
|
/* compiled from: ProGuard */
|
|
/* loaded from: classes.dex */
|
|
public class AssistActivity extends Activity {
|
|
private String c;
|
|
private boolean a = false;
|
|
protected boolean b = false;
|
|
protected Handler d = new Handler() { // from class: com.tencent.connect.common.AssistActivity.1
|
|
@Override // android.os.Handler
|
|
public void handleMessage(Message message) {
|
|
if (message.what == 0 && !AssistActivity.this.isFinishing()) {
|
|
f.d("openSDK_LOG.AssistActivity", "-->finish by timeout");
|
|
AssistActivity.this.finish();
|
|
}
|
|
}
|
|
};
|
|
|
|
public void a(int i, Intent intent) {
|
|
if (intent == null) {
|
|
f.d("openSDK_LOG.AssistActivity", "--setResultData--intent is null, setResult ACTIVITY_CANCEL");
|
|
setResult(0);
|
|
if (i == 11101) {
|
|
d.a().a("", this.c, "2", "1", "7", "2");
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
try {
|
|
String stringExtra = intent.getStringExtra("key_response");
|
|
f.b("openSDK_LOG.AssistActivity", "--setResultDataForLogin-- " + stringExtra);
|
|
if (TextUtils.isEmpty(stringExtra)) {
|
|
f.d("openSDK_LOG.AssistActivity", "--setResultData--response is empty, setResult ACTIVITY_OK");
|
|
setResult(-1, intent);
|
|
} else {
|
|
JSONObject jSONObject = new JSONObject(stringExtra);
|
|
String optString = jSONObject.optString(SocialConstants.PARAM_OPEN_ID);
|
|
String optString2 = jSONObject.optString(AccessToken.ACCESS_TOKEN_KEY);
|
|
if (TextUtils.isEmpty(optString) || TextUtils.isEmpty(optString2)) {
|
|
f.d("openSDK_LOG.AssistActivity", "--setResultData--openid or token is empty, setResult ACTIVITY_CANCEL");
|
|
setResult(0, intent);
|
|
d.a().a("", this.c, "2", "1", "7", "1");
|
|
} else {
|
|
f.c("openSDK_LOG.AssistActivity", "--setResultData--openid and token not empty, setResult ACTIVITY_OK");
|
|
setResult(-1, intent);
|
|
d.a().a(optString, this.c, "2", "1", "7", "0");
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
f.e("openSDK_LOG.AssistActivity", "--setResultData--parse response failed");
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onActivityResult(int i, int i2, Intent intent) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("--onActivityResult--requestCode: ");
|
|
sb.append(i);
|
|
sb.append(" | resultCode: ");
|
|
sb.append(i2);
|
|
sb.append("data = null ? ");
|
|
sb.append(intent == null);
|
|
f.c("openSDK_LOG.AssistActivity", sb.toString());
|
|
super.onActivityResult(i, i2, intent);
|
|
if (i == 0) {
|
|
return;
|
|
}
|
|
if (intent != null) {
|
|
intent.putExtra("key_action", "action_login");
|
|
}
|
|
a(i, intent);
|
|
finish();
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onCreate(Bundle bundle) {
|
|
requestWindowFeature(1);
|
|
super.onCreate(bundle);
|
|
setRequestedOrientation(3);
|
|
f.b("openSDK_LOG.AssistActivity", "--onCreate--");
|
|
if (getIntent() == null) {
|
|
f.e("openSDK_LOG.AssistActivity", "-->onCreate--getIntent() returns null");
|
|
finish();
|
|
}
|
|
Intent intent = (Intent) getIntent().getParcelableExtra("openSDK_LOG.AssistActivity.ExtraIntent");
|
|
int intExtra = intent == null ? 0 : intent.getIntExtra("key_request_code", 0);
|
|
this.c = intent == null ? "" : intent.getStringExtra(SocialConstants.PARAM_APP_ID);
|
|
Bundle bundleExtra = getIntent().getBundleExtra("h5_share_data");
|
|
if (bundle != null) {
|
|
this.a = bundle.getBoolean("RESTART_FLAG");
|
|
this.b = bundle.getBoolean("RESUME_FLAG", false);
|
|
}
|
|
if (this.a) {
|
|
f.b("openSDK_LOG.AssistActivity", "is restart");
|
|
return;
|
|
}
|
|
if (bundleExtra != null) {
|
|
f.d("openSDK_LOG.AssistActivity", "--onCreate--h5 bundle not null, will open browser");
|
|
a(bundleExtra);
|
|
} else {
|
|
if (intent == null) {
|
|
f.e("openSDK_LOG.AssistActivity", "--onCreate--activityIntent is null");
|
|
finish();
|
|
return;
|
|
}
|
|
f.c("openSDK_LOG.AssistActivity", "--onCreate--activityIntent not null, will start activity, reqcode = " + intExtra);
|
|
startActivityForResult(intent, intExtra);
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onDestroy() {
|
|
f.b("openSDK_LOG.AssistActivity", "-->onDestroy");
|
|
super.onDestroy();
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onNewIntent(Intent intent) {
|
|
f.c("openSDK_LOG.AssistActivity", "--onNewIntent");
|
|
super.onNewIntent(intent);
|
|
intent.putExtra("key_action", "action_share");
|
|
setResult(-1, intent);
|
|
if (isFinishing()) {
|
|
return;
|
|
}
|
|
f.c("openSDK_LOG.AssistActivity", "--onNewIntent--activity not finished, finish now");
|
|
finish();
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onPause() {
|
|
f.b("openSDK_LOG.AssistActivity", "-->onPause");
|
|
this.d.removeMessages(0);
|
|
super.onPause();
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onResume() {
|
|
f.b("openSDK_LOG.AssistActivity", "-->onResume");
|
|
super.onResume();
|
|
Intent intent = getIntent();
|
|
if (intent.getBooleanExtra("is_login", false)) {
|
|
return;
|
|
}
|
|
if (!intent.getBooleanExtra("is_qq_mobile_share", false) && this.a && !isFinishing()) {
|
|
finish();
|
|
}
|
|
if (!this.b) {
|
|
this.b = true;
|
|
} else {
|
|
this.d.sendMessage(this.d.obtainMessage(0));
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onSaveInstanceState(Bundle bundle) {
|
|
f.b("openSDK_LOG.AssistActivity", "--onSaveInstanceState--");
|
|
bundle.putBoolean("RESTART_FLAG", true);
|
|
bundle.putBoolean("RESUME_FLAG", this.b);
|
|
super.onSaveInstanceState(bundle);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onStart() {
|
|
f.b("openSDK_LOG.AssistActivity", "-->onStart");
|
|
super.onStart();
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onStop() {
|
|
f.b("openSDK_LOG.AssistActivity", "-->onStop");
|
|
super.onStop();
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:14:0x006e */
|
|
/* JADX WARN: Removed duplicated region for block: B:7:0x0043 */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
|
*/
|
|
private void a(android.os.Bundle r13) {
|
|
/*
|
|
r12 = this;
|
|
java.lang.String r0 = "viaShareType"
|
|
java.lang.String r8 = r13.getString(r0)
|
|
java.lang.String r0 = "callbackAction"
|
|
java.lang.String r0 = r13.getString(r0)
|
|
java.lang.String r1 = "url"
|
|
java.lang.String r1 = r13.getString(r1)
|
|
java.lang.String r2 = "openId"
|
|
java.lang.String r2 = r13.getString(r2)
|
|
java.lang.String r3 = "appId"
|
|
java.lang.String r3 = r13.getString(r3)
|
|
java.lang.String r13 = "shareToQQ"
|
|
boolean r13 = r13.equals(r0)
|
|
java.lang.String r4 = ""
|
|
if (r13 == 0) goto L2f
|
|
java.lang.String r13 = "ANDROIDQQ.SHARETOQQ.XX"
|
|
java.lang.String r4 = "10"
|
|
L2c:
|
|
r5 = r4
|
|
r4 = r13
|
|
goto L3d
|
|
L2f:
|
|
java.lang.String r13 = "shareToQzone"
|
|
boolean r13 = r13.equals(r0)
|
|
if (r13 == 0) goto L3c
|
|
java.lang.String r13 = "ANDROIDQQ.SHARETOQZ.XX"
|
|
java.lang.String r4 = "11"
|
|
goto L2c
|
|
L3c:
|
|
r5 = r4
|
|
L3d:
|
|
boolean r13 = com.tencent.open.utils.i.a(r12, r1)
|
|
if (r13 != 0) goto L6e
|
|
com.tencent.connect.common.UIListenerManager r13 = com.tencent.connect.common.UIListenerManager.a()
|
|
com.tencent.tauth.IUiListener r13 = r13.a(r0)
|
|
if (r13 == 0) goto L59
|
|
com.tencent.tauth.UiError r0 = new com.tencent.tauth.UiError
|
|
r1 = -6
|
|
r6 = 0
|
|
java.lang.String r7 = "打开浏览器失败!"
|
|
r0.<init>(r1, r7, r6)
|
|
r13.onError(r0)
|
|
L59:
|
|
com.tencent.open.b.d r1 = com.tencent.open.b.d.a()
|
|
java.lang.String r6 = "3"
|
|
java.lang.String r7 = "1"
|
|
java.lang.String r9 = "0"
|
|
java.lang.String r10 = "2"
|
|
java.lang.String r11 = "0"
|
|
r1.a(r2, r3, r4, r5, r6, r7, r8, r9, r10, r11)
|
|
r12.finish()
|
|
goto L7f
|
|
L6e:
|
|
com.tencent.open.b.d r1 = com.tencent.open.b.d.a()
|
|
java.lang.String r6 = "3"
|
|
java.lang.String r7 = "0"
|
|
java.lang.String r9 = "0"
|
|
java.lang.String r10 = "2"
|
|
java.lang.String r11 = "0"
|
|
r1.a(r2, r3, r4, r5, r6, r7, r8, r9, r10, r11)
|
|
L7f:
|
|
android.content.Intent r13 = r12.getIntent()
|
|
java.lang.String r0 = "shareH5"
|
|
r13.removeExtra(r0)
|
|
return
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.tencent.connect.common.AssistActivity.a(android.os.Bundle):void");
|
|
}
|
|
}
|