Initial commit
This commit is contained in:
264
sources/com/tencent/connect/common/AssistActivity.java
Normal file
264
sources/com/tencent/connect/common/AssistActivity.java
Normal file
@@ -0,0 +1,264 @@
|
||||
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");
|
||||
}
|
||||
}
|
275
sources/com/tencent/connect/common/BaseApi.java
Normal file
275
sources/com/tencent/connect/common/BaseApi.java
Normal file
@@ -0,0 +1,275 @@
|
||||
package com.tencent.connect.common;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import com.facebook.AccessToken;
|
||||
import com.tencent.connect.auth.QQToken;
|
||||
import com.tencent.connect.auth.c;
|
||||
import com.tencent.open.SocialConstants;
|
||||
import com.tencent.open.TDialog;
|
||||
import com.tencent.open.a.f;
|
||||
import com.tencent.open.utils.HttpUtils;
|
||||
import com.tencent.open.utils.d;
|
||||
import com.tencent.open.utils.g;
|
||||
import com.tencent.open.utils.i;
|
||||
import com.tencent.tauth.IRequestListener;
|
||||
import com.tencent.tauth.IUiListener;
|
||||
import com.tencent.tauth.UiError;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import org.apache.http.conn.ConnectTimeoutException;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* compiled from: ProGuard */
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class BaseApi {
|
||||
public static String businessId = null;
|
||||
public static String installChannel = null;
|
||||
public static boolean isOEM = false;
|
||||
public static String registerChannel;
|
||||
protected c a;
|
||||
protected QQToken b;
|
||||
|
||||
/* compiled from: ProGuard */
|
||||
public class TempRequestListener implements IRequestListener {
|
||||
private final IUiListener a;
|
||||
private final Handler b;
|
||||
|
||||
public TempRequestListener(BaseApi baseApi, IUiListener iUiListener) {
|
||||
this.a = iUiListener;
|
||||
this.b = new Handler(d.a().getMainLooper(), baseApi) { // from class: com.tencent.connect.common.BaseApi.TempRequestListener.1
|
||||
@Override // android.os.Handler
|
||||
public void handleMessage(Message message) {
|
||||
if (message.what == 0) {
|
||||
TempRequestListener.this.a.onComplete(message.obj);
|
||||
} else {
|
||||
TempRequestListener.this.a.onError(new UiError(message.what, (String) message.obj, null));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override // com.tencent.tauth.IRequestListener
|
||||
public void a(JSONObject jSONObject) {
|
||||
Message obtainMessage = this.b.obtainMessage();
|
||||
obtainMessage.obj = jSONObject;
|
||||
obtainMessage.what = 0;
|
||||
this.b.sendMessage(obtainMessage);
|
||||
}
|
||||
|
||||
@Override // com.tencent.tauth.IRequestListener
|
||||
public void a(IOException iOException) {
|
||||
Message obtainMessage = this.b.obtainMessage();
|
||||
obtainMessage.obj = iOException.getMessage();
|
||||
obtainMessage.what = -2;
|
||||
this.b.sendMessage(obtainMessage);
|
||||
}
|
||||
|
||||
@Override // com.tencent.tauth.IRequestListener
|
||||
public void a(MalformedURLException malformedURLException) {
|
||||
Message obtainMessage = this.b.obtainMessage();
|
||||
obtainMessage.obj = malformedURLException.getMessage();
|
||||
obtainMessage.what = -3;
|
||||
this.b.sendMessage(obtainMessage);
|
||||
}
|
||||
|
||||
@Override // com.tencent.tauth.IRequestListener
|
||||
public void a(JSONException jSONException) {
|
||||
Message obtainMessage = this.b.obtainMessage();
|
||||
obtainMessage.obj = jSONException.getMessage();
|
||||
obtainMessage.what = -4;
|
||||
this.b.sendMessage(obtainMessage);
|
||||
}
|
||||
|
||||
@Override // com.tencent.tauth.IRequestListener
|
||||
public void a(ConnectTimeoutException connectTimeoutException) {
|
||||
Message obtainMessage = this.b.obtainMessage();
|
||||
obtainMessage.obj = connectTimeoutException.getMessage();
|
||||
obtainMessage.what = -7;
|
||||
this.b.sendMessage(obtainMessage);
|
||||
}
|
||||
|
||||
@Override // com.tencent.tauth.IRequestListener
|
||||
public void a(SocketTimeoutException socketTimeoutException) {
|
||||
Message obtainMessage = this.b.obtainMessage();
|
||||
obtainMessage.obj = socketTimeoutException.getMessage();
|
||||
obtainMessage.what = -8;
|
||||
this.b.sendMessage(obtainMessage);
|
||||
}
|
||||
|
||||
@Override // com.tencent.tauth.IRequestListener
|
||||
public void a(HttpUtils.NetworkUnavailableException networkUnavailableException) {
|
||||
Message obtainMessage = this.b.obtainMessage();
|
||||
obtainMessage.obj = networkUnavailableException.getMessage();
|
||||
obtainMessage.what = -10;
|
||||
this.b.sendMessage(obtainMessage);
|
||||
}
|
||||
|
||||
@Override // com.tencent.tauth.IRequestListener
|
||||
public void a(HttpUtils.HttpStatusException httpStatusException) {
|
||||
Message obtainMessage = this.b.obtainMessage();
|
||||
obtainMessage.obj = httpStatusException.getMessage();
|
||||
obtainMessage.what = -9;
|
||||
this.b.sendMessage(obtainMessage);
|
||||
}
|
||||
|
||||
@Override // com.tencent.tauth.IRequestListener
|
||||
public void a(Exception exc) {
|
||||
Message obtainMessage = this.b.obtainMessage();
|
||||
obtainMessage.obj = exc.getMessage();
|
||||
obtainMessage.what = -6;
|
||||
this.b.sendMessage(obtainMessage);
|
||||
}
|
||||
}
|
||||
|
||||
public BaseApi(c cVar, QQToken qQToken) {
|
||||
this.a = cVar;
|
||||
this.b = qQToken;
|
||||
}
|
||||
|
||||
protected Bundle a() {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("format", "json");
|
||||
bundle.putString("status_os", Build.VERSION.RELEASE);
|
||||
bundle.putString("status_machine", Build.MODEL);
|
||||
bundle.putString("status_version", Build.VERSION.SDK);
|
||||
bundle.putString("sdkv", "3.3.0.lite");
|
||||
bundle.putString("sdkp", "a");
|
||||
QQToken qQToken = this.b;
|
||||
if (qQToken != null && qQToken.d()) {
|
||||
bundle.putString(AccessToken.ACCESS_TOKEN_KEY, this.b.a());
|
||||
bundle.putString(SocialConstants.PARAM_CONSUMER_KEY, this.b.b());
|
||||
bundle.putString(SocialConstants.PARAM_OPEN_ID, this.b.c());
|
||||
bundle.putString("appid_for_getting_config", this.b.b());
|
||||
}
|
||||
SharedPreferences sharedPreferences = d.a().getSharedPreferences("pfStore", 0);
|
||||
if (isOEM) {
|
||||
bundle.putString("pf", "desktop_m_qq-" + installChannel + "-android-" + registerChannel + "-" + businessId);
|
||||
} else {
|
||||
bundle.putString("pf", sharedPreferences.getString("pf", "openmobile_android"));
|
||||
}
|
||||
return bundle;
|
||||
}
|
||||
|
||||
protected Bundle b() {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(SocialConstants.PARAM_APP_ID, this.b.b());
|
||||
if (this.b.d()) {
|
||||
bundle.putString("keystr", this.b.a());
|
||||
bundle.putString("keytype", "0x80");
|
||||
}
|
||||
String c = this.b.c();
|
||||
if (c != null) {
|
||||
bundle.putString(SocialConstants.PARAM_HOPEN_ID, c);
|
||||
}
|
||||
bundle.putString("platform", "androidqz");
|
||||
SharedPreferences sharedPreferences = d.a().getSharedPreferences("pfStore", 0);
|
||||
if (isOEM) {
|
||||
bundle.putString("pf", "desktop_m_qq-" + installChannel + "-android-" + registerChannel + "-" + businessId);
|
||||
} else {
|
||||
bundle.putString("pf", sharedPreferences.getString("pf", "openmobile_android"));
|
||||
bundle.putString("pf", "openmobile_android");
|
||||
}
|
||||
bundle.putString("sdkv", "3.3.0.lite");
|
||||
bundle.putString("sdkp", "a");
|
||||
return bundle;
|
||||
}
|
||||
|
||||
protected Intent c(String str) {
|
||||
Intent intent = new Intent();
|
||||
Intent b = b(str);
|
||||
if (b == null || b.getComponent() == null) {
|
||||
return null;
|
||||
}
|
||||
intent.setClassName(b.getComponent().getPackageName(), "com.tencent.open.agent.AgentActivity");
|
||||
return intent;
|
||||
}
|
||||
|
||||
public void releaseResource() {
|
||||
}
|
||||
|
||||
public BaseApi(QQToken qQToken) {
|
||||
this(null, qQToken);
|
||||
}
|
||||
|
||||
protected Intent b(String str) {
|
||||
Intent intent = new Intent();
|
||||
if (i.d(d.a())) {
|
||||
intent.setClassName("com.tencent.minihd.qq", str);
|
||||
if (g.a(d.a(), intent)) {
|
||||
return intent;
|
||||
}
|
||||
}
|
||||
intent.setClassName("com.tencent.mobileqq", str);
|
||||
if (g.a(d.a(), intent)) {
|
||||
return intent;
|
||||
}
|
||||
intent.setClassName("com.tencent.tim", str);
|
||||
if (g.a(d.a(), intent)) {
|
||||
return intent;
|
||||
}
|
||||
intent.setClassName("com.tencent.qim", str);
|
||||
if (g.a(d.a(), intent)) {
|
||||
return intent;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String a(String str) {
|
||||
Bundle a = a();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (!TextUtils.isEmpty(str)) {
|
||||
a.putString("need_version", str);
|
||||
}
|
||||
sb.append("http://openmobile.qq.com/oauth2.0/m_jump_by_version?");
|
||||
sb.append(HttpUtils.encodeUrl(a));
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private Intent a(Activity activity, Intent intent) {
|
||||
Intent intent2 = new Intent(activity.getApplicationContext(), (Class<?>) AssistActivity.class);
|
||||
intent2.putExtra("is_login", true);
|
||||
intent2.putExtra("openSDK_LOG.AssistActivity.ExtraIntent", intent);
|
||||
return intent2;
|
||||
}
|
||||
|
||||
protected void a(Activity activity, int i, Intent intent, boolean z) {
|
||||
Intent intent2 = new Intent(activity.getApplicationContext(), (Class<?>) AssistActivity.class);
|
||||
if (z) {
|
||||
intent2.putExtra("is_qq_mobile_share", true);
|
||||
}
|
||||
intent2.putExtra("openSDK_LOG.AssistActivity.ExtraIntent", intent);
|
||||
activity.startActivityForResult(intent2, i);
|
||||
}
|
||||
|
||||
protected void a(Activity activity, Intent intent, int i) {
|
||||
intent.putExtra("key_request_code", i);
|
||||
activity.startActivityForResult(a(activity, intent), i);
|
||||
}
|
||||
|
||||
protected void a(Fragment fragment, Intent intent, int i) {
|
||||
intent.putExtra("key_request_code", i);
|
||||
fragment.startActivityForResult(a(fragment.getActivity(), intent), i);
|
||||
}
|
||||
|
||||
protected boolean a(Intent intent) {
|
||||
if (intent != null) {
|
||||
return g.a(d.a(), intent);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void a(Activity activity, Bundle bundle, IUiListener iUiListener) {
|
||||
f.c("openSDK_LOG.BaseApi", "--handleDownloadLastestQQ");
|
||||
new TDialog(activity, "", "http://qzs.qq.com/open/mobile/login/qzsjump.html?" + HttpUtils.encodeUrl(bundle), null, this.b).show();
|
||||
}
|
||||
}
|
239
sources/com/tencent/connect/common/UIListenerManager.java
Normal file
239
sources/com/tencent/connect/common/UIListenerManager.java
Normal file
@@ -0,0 +1,239 @@
|
||||
package com.tencent.connect.common;
|
||||
|
||||
import android.content.Intent;
|
||||
import com.baidu.cloud.media.player.BDCloudMediaPlayer;
|
||||
import com.tencent.open.a.f;
|
||||
import com.tencent.open.utils.g;
|
||||
import com.tencent.open.utils.i;
|
||||
import com.tencent.tauth.IUiListener;
|
||||
import com.tencent.tauth.UiError;
|
||||
import com.ubt.jimu.base.dialog.SimpleQuestionDialog;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* compiled from: ProGuard */
|
||||
/* loaded from: classes.dex */
|
||||
public class UIListenerManager {
|
||||
private static UIListenerManager b;
|
||||
private Map<String, ApiTask> a;
|
||||
|
||||
/* compiled from: ProGuard */
|
||||
public class ApiTask {
|
||||
public IUiListener a;
|
||||
|
||||
public ApiTask(UIListenerManager uIListenerManager, int i, IUiListener iUiListener) {
|
||||
this.a = iUiListener;
|
||||
}
|
||||
}
|
||||
|
||||
private UIListenerManager() {
|
||||
this.a = Collections.synchronizedMap(new HashMap());
|
||||
if (this.a == null) {
|
||||
this.a = Collections.synchronizedMap(new HashMap());
|
||||
}
|
||||
}
|
||||
|
||||
public static UIListenerManager a() {
|
||||
if (b == null) {
|
||||
b = new UIListenerManager();
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
private IUiListener b(int i, IUiListener iUiListener) {
|
||||
if (i == 11101) {
|
||||
f.e("openSDK_LOG.UIListenerManager", "登录的接口回调不能重新构建,暂时无法提供,先记录下来这种情况是否存在");
|
||||
} else if (i == 11105) {
|
||||
f.e("openSDK_LOG.UIListenerManager", "Social Api 的接口回调需要使用param来重新构建,暂时无法提供,先记录下来这种情况是否存在");
|
||||
} else if (i == 11106) {
|
||||
f.e("openSDK_LOG.UIListenerManager", "Social Api 的H5接口回调需要使用param来重新构建,暂时无法提供,先记录下来这种情况是否存在");
|
||||
}
|
||||
return iUiListener;
|
||||
}
|
||||
|
||||
public Object a(int i, IUiListener iUiListener) {
|
||||
ApiTask put;
|
||||
String a = g.a(i);
|
||||
if (a == null) {
|
||||
f.e("openSDK_LOG.UIListenerManager", "setListener action is null! rquestCode=" + i);
|
||||
return null;
|
||||
}
|
||||
synchronized (this.a) {
|
||||
put = this.a.put(a, new ApiTask(this, i, iUiListener));
|
||||
}
|
||||
if (put == null) {
|
||||
return null;
|
||||
}
|
||||
return put.a;
|
||||
}
|
||||
|
||||
public Object a(String str, IUiListener iUiListener) {
|
||||
ApiTask put;
|
||||
int a = g.a(str);
|
||||
if (a == -1) {
|
||||
f.e("openSDK_LOG.UIListenerManager", "setListnerWithAction fail, action = " + str);
|
||||
return null;
|
||||
}
|
||||
synchronized (this.a) {
|
||||
put = this.a.put(str, new ApiTask(this, a, iUiListener));
|
||||
}
|
||||
if (put == null) {
|
||||
return null;
|
||||
}
|
||||
return put.a;
|
||||
}
|
||||
|
||||
public IUiListener a(int i) {
|
||||
String a = g.a(i);
|
||||
if (a == null) {
|
||||
f.e("openSDK_LOG.UIListenerManager", "getListner action is null! rquestCode=" + i);
|
||||
return null;
|
||||
}
|
||||
return a(a);
|
||||
}
|
||||
|
||||
public IUiListener a(String str) {
|
||||
ApiTask apiTask;
|
||||
if (str == null) {
|
||||
f.e("openSDK_LOG.UIListenerManager", "getListnerWithAction action is null!");
|
||||
return null;
|
||||
}
|
||||
synchronized (this.a) {
|
||||
apiTask = this.a.get(str);
|
||||
this.a.remove(str);
|
||||
}
|
||||
if (apiTask == null) {
|
||||
return null;
|
||||
}
|
||||
return apiTask.a;
|
||||
}
|
||||
|
||||
public void a(Intent intent, IUiListener iUiListener) {
|
||||
f.c("openSDK_LOG.UIListenerManager", "handleDataToListener");
|
||||
if (intent == null) {
|
||||
iUiListener.onCancel();
|
||||
return;
|
||||
}
|
||||
String stringExtra = intent.getStringExtra("key_action");
|
||||
if ("action_login".equals(stringExtra)) {
|
||||
int intExtra = intent.getIntExtra("key_error_code", 0);
|
||||
if (intExtra == 0) {
|
||||
String stringExtra2 = intent.getStringExtra("key_response");
|
||||
if (stringExtra2 != null) {
|
||||
try {
|
||||
iUiListener.onComplete(i.d(stringExtra2));
|
||||
return;
|
||||
} catch (JSONException e) {
|
||||
iUiListener.onError(new UiError(-4, "服务器返回数据格式有误!", stringExtra2));
|
||||
f.b("openSDK_LOG.UIListenerManager", "OpenUi, onActivityResult, json error", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
f.b("openSDK_LOG.UIListenerManager", "OpenUi, onActivityResult, onComplete");
|
||||
iUiListener.onComplete(new JSONObject());
|
||||
return;
|
||||
}
|
||||
f.e("openSDK_LOG.UIListenerManager", "OpenUi, onActivityResult, onError = " + intExtra + "");
|
||||
iUiListener.onError(new UiError(intExtra, intent.getStringExtra("key_error_msg"), intent.getStringExtra("key_error_detail")));
|
||||
return;
|
||||
}
|
||||
if ("action_share".equals(stringExtra)) {
|
||||
String stringExtra3 = intent.getStringExtra(UnityActivity.RESULT);
|
||||
String stringExtra4 = intent.getStringExtra("response");
|
||||
if (SimpleQuestionDialog.KEY_CANCELBUTTON.equals(stringExtra3)) {
|
||||
iUiListener.onCancel();
|
||||
return;
|
||||
}
|
||||
if (BDCloudMediaPlayer.OnNativeInvokeListener.ARG_ERROR.equals(stringExtra3)) {
|
||||
iUiListener.onError(new UiError(-6, "unknown error", stringExtra4 + ""));
|
||||
return;
|
||||
}
|
||||
if ("complete".equals(stringExtra3)) {
|
||||
try {
|
||||
iUiListener.onComplete(new JSONObject(stringExtra4 == null ? "{\"ret\": 0}" : stringExtra4));
|
||||
} catch (JSONException e2) {
|
||||
e2.printStackTrace();
|
||||
iUiListener.onError(new UiError(-4, "json error", stringExtra4 + ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a(int i, int i2, Intent intent, IUiListener iUiListener) {
|
||||
f.c("openSDK_LOG.UIListenerManager", "onActivityResult req=" + i + " res=" + i2);
|
||||
IUiListener a = a(i);
|
||||
if (a != null) {
|
||||
iUiListener = a;
|
||||
} else if (iUiListener != null) {
|
||||
b(i, iUiListener);
|
||||
} else {
|
||||
f.e("openSDK_LOG.UIListenerManager", "onActivityResult can't find the listener");
|
||||
return false;
|
||||
}
|
||||
if (i2 != -1) {
|
||||
iUiListener.onCancel();
|
||||
} else {
|
||||
if (intent == null) {
|
||||
iUiListener.onError(new UiError(-6, "onActivityResult intent data is null.", "onActivityResult intent data is null."));
|
||||
return true;
|
||||
}
|
||||
String stringExtra = intent.getStringExtra("key_action");
|
||||
if ("action_login".equals(stringExtra)) {
|
||||
int intExtra = intent.getIntExtra("key_error_code", 0);
|
||||
if (intExtra == 0) {
|
||||
String stringExtra2 = intent.getStringExtra("key_response");
|
||||
if (stringExtra2 != null) {
|
||||
try {
|
||||
iUiListener.onComplete(i.d(stringExtra2));
|
||||
} catch (JSONException e) {
|
||||
iUiListener.onError(new UiError(-4, "服务器返回数据格式有误!", stringExtra2));
|
||||
f.b("openSDK_LOG.UIListenerManager", "OpenUi, onActivityResult, json error", e);
|
||||
}
|
||||
} else {
|
||||
f.b("openSDK_LOG.UIListenerManager", "OpenUi, onActivityResult, onComplete");
|
||||
iUiListener.onComplete(new JSONObject());
|
||||
}
|
||||
} else {
|
||||
f.e("openSDK_LOG.UIListenerManager", "OpenUi, onActivityResult, onError = " + intExtra + "");
|
||||
iUiListener.onError(new UiError(intExtra, intent.getStringExtra("key_error_msg"), intent.getStringExtra("key_error_detail")));
|
||||
}
|
||||
} else if ("action_share".equals(stringExtra)) {
|
||||
String stringExtra3 = intent.getStringExtra(UnityActivity.RESULT);
|
||||
String stringExtra4 = intent.getStringExtra("response");
|
||||
if (SimpleQuestionDialog.KEY_CANCELBUTTON.equals(stringExtra3)) {
|
||||
iUiListener.onCancel();
|
||||
} else if (BDCloudMediaPlayer.OnNativeInvokeListener.ARG_ERROR.equals(stringExtra3)) {
|
||||
iUiListener.onError(new UiError(-6, "unknown error", stringExtra4 + ""));
|
||||
} else if ("complete".equals(stringExtra3)) {
|
||||
try {
|
||||
iUiListener.onComplete(new JSONObject(stringExtra4 == null ? "{\"ret\": 0}" : stringExtra4));
|
||||
} catch (JSONException e2) {
|
||||
e2.printStackTrace();
|
||||
iUiListener.onError(new UiError(-4, "json error", stringExtra4 + ""));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int intExtra2 = intent.getIntExtra("key_error_code", 0);
|
||||
if (intExtra2 == 0) {
|
||||
String stringExtra5 = intent.getStringExtra("key_response");
|
||||
if (stringExtra5 != null) {
|
||||
try {
|
||||
iUiListener.onComplete(i.d(stringExtra5));
|
||||
} catch (JSONException unused) {
|
||||
iUiListener.onError(new UiError(-4, "服务器返回数据格式有误!", stringExtra5));
|
||||
}
|
||||
} else {
|
||||
iUiListener.onComplete(new JSONObject());
|
||||
}
|
||||
} else {
|
||||
iUiListener.onError(new UiError(intExtra2, intent.getStringExtra("key_error_msg"), intent.getStringExtra("key_error_detail")));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user