Initial commit
This commit is contained in:
107
sources/com/tencent/tauth/AuthActivity.java
Normal file
107
sources/com/tencent/tauth/AuthActivity.java
Normal file
@@ -0,0 +1,107 @@
|
||||
package com.tencent.tauth;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import com.tencent.connect.common.AssistActivity;
|
||||
import com.tencent.connect.common.UIListenerManager;
|
||||
import com.tencent.open.a.f;
|
||||
import com.tencent.open.utils.g;
|
||||
import com.tencent.open.utils.i;
|
||||
|
||||
/* compiled from: ProGuard */
|
||||
/* loaded from: classes.dex */
|
||||
public class AuthActivity extends Activity {
|
||||
private static int a;
|
||||
|
||||
private void a(Uri uri) {
|
||||
f.c("openSDK_LOG.AuthActivity", "-->handleActionUri--start");
|
||||
if (uri != null && uri.toString() != null) {
|
||||
String str = "";
|
||||
if (!uri.toString().equals("")) {
|
||||
String uri2 = uri.toString();
|
||||
Bundle a2 = i.a(uri2.substring(uri2.indexOf("#") + 1));
|
||||
if (a2 == null) {
|
||||
f.d("openSDK_LOG.AuthActivity", "-->handleActionUri, bundle is null");
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
String string = a2.getString("action");
|
||||
f.c("openSDK_LOG.AuthActivity", "-->handleActionUri, action: " + string);
|
||||
if (string == null) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
if (string.equals("shareToQQ") || string.equals("shareToQzone") || string.equals("sendToMyComputer") || string.equals("shareToTroopBar")) {
|
||||
if (string.equals("shareToQzone") && g.a(this, "com.tencent.mobileqq") != null && g.c(this, "5.2.0") < 0) {
|
||||
a++;
|
||||
if (a == 2) {
|
||||
a = 0;
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
f.c("openSDK_LOG.AuthActivity", "-->handleActionUri, most share action, start assistactivity");
|
||||
Intent intent = new Intent(this, (Class<?>) AssistActivity.class);
|
||||
intent.putExtras(a2);
|
||||
intent.setFlags(603979776);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
if (string.equals("addToQQFavorites")) {
|
||||
Intent intent2 = getIntent();
|
||||
intent2.putExtras(a2);
|
||||
intent2.putExtra("key_action", "action_share");
|
||||
IUiListener a3 = UIListenerManager.a().a(string);
|
||||
if (a3 != null) {
|
||||
UIListenerManager.a().a(intent2, a3);
|
||||
}
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
if (!string.equals("sharePrize")) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
Intent launchIntentForPackage = getPackageManager().getLaunchIntentForPackage(getPackageName());
|
||||
try {
|
||||
str = i.d(a2.getString("response")).getString("activityid");
|
||||
} catch (Exception e) {
|
||||
f.b("openSDK_LOG.AuthActivity", "sharePrize parseJson has exception.", e);
|
||||
}
|
||||
if (!TextUtils.isEmpty(str)) {
|
||||
launchIntentForPackage.putExtra("sharePrize", true);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("activityid", str);
|
||||
launchIntentForPackage.putExtras(bundle);
|
||||
}
|
||||
startActivity(launchIntentForPackage);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
f.d("openSDK_LOG.AuthActivity", "-->handleActionUri, uri invalid");
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
if (getIntent() == null) {
|
||||
f.d("openSDK_LOG.AuthActivity", "-->onCreate, getIntent() return null");
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
Uri uri = null;
|
||||
try {
|
||||
uri = getIntent().getData();
|
||||
} catch (Exception e) {
|
||||
f.e("openSDK_LOG.AuthActivity", "-->onCreate, getIntent().getData() has exception! " + e.getMessage());
|
||||
}
|
||||
f.a("openSDK_LOG.AuthActivity", "-->onCreate, uri: " + uri);
|
||||
a(uri);
|
||||
}
|
||||
}
|
31
sources/com/tencent/tauth/IRequestListener.java
Normal file
31
sources/com/tencent/tauth/IRequestListener.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.tencent.tauth;
|
||||
|
||||
import com.tencent.open.utils.HttpUtils;
|
||||
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 interface IRequestListener {
|
||||
void a(HttpUtils.HttpStatusException httpStatusException);
|
||||
|
||||
void a(HttpUtils.NetworkUnavailableException networkUnavailableException);
|
||||
|
||||
void a(IOException iOException);
|
||||
|
||||
void a(Exception exc);
|
||||
|
||||
void a(MalformedURLException malformedURLException);
|
||||
|
||||
void a(SocketTimeoutException socketTimeoutException);
|
||||
|
||||
void a(ConnectTimeoutException connectTimeoutException);
|
||||
|
||||
void a(JSONException jSONException);
|
||||
|
||||
void a(JSONObject jSONObject);
|
||||
}
|
11
sources/com/tencent/tauth/IUiListener.java
Normal file
11
sources/com/tencent/tauth/IUiListener.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.tencent.tauth;
|
||||
|
||||
/* compiled from: ProGuard */
|
||||
/* loaded from: classes.dex */
|
||||
public interface IUiListener {
|
||||
void onCancel();
|
||||
|
||||
void onComplete(Object obj);
|
||||
|
||||
void onError(UiError uiError);
|
||||
}
|
105
sources/com/tencent/tauth/Tencent.java
Normal file
105
sources/com/tencent/tauth/Tencent.java
Normal file
@@ -0,0 +1,105 @@
|
||||
package com.tencent.tauth;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import com.tencent.connect.auth.QQToken;
|
||||
import com.tencent.connect.auth.c;
|
||||
import com.tencent.connect.common.UIListenerManager;
|
||||
import com.tencent.connect.share.QQShare;
|
||||
import com.tencent.connect.share.QzoneShare;
|
||||
import com.tencent.open.a.f;
|
||||
import com.tencent.open.utils.d;
|
||||
import com.tencent.open.utils.e;
|
||||
|
||||
/* compiled from: ProGuard */
|
||||
/* loaded from: classes.dex */
|
||||
public class Tencent {
|
||||
private static Tencent b;
|
||||
private final c a;
|
||||
|
||||
private Tencent(String str, Context context) {
|
||||
this.a = c.a(str, context);
|
||||
}
|
||||
|
||||
public static synchronized Tencent a(String str, Context context) {
|
||||
synchronized (Tencent.class) {
|
||||
d.a(context.getApplicationContext());
|
||||
f.c("openSDK_LOG.Tencent", "createInstance() -- start, appId = " + str);
|
||||
if (b == null) {
|
||||
b = new Tencent(str, context);
|
||||
} else if (!str.equals(b.a())) {
|
||||
b.a(context);
|
||||
b = new Tencent(str, context);
|
||||
}
|
||||
if (!a(context, str)) {
|
||||
return null;
|
||||
}
|
||||
e.a(context, str);
|
||||
f.c("openSDK_LOG.Tencent", "createInstance() -- end");
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
public void b(Activity activity, Bundle bundle, IUiListener iUiListener) {
|
||||
f.c("openSDK_LOG.Tencent", "shareToQzone()");
|
||||
new QzoneShare(activity, this.a.a()).b(activity, bundle, iUiListener);
|
||||
}
|
||||
|
||||
public QQToken b() {
|
||||
return this.a.a();
|
||||
}
|
||||
|
||||
private static boolean a(Context context, String str) {
|
||||
try {
|
||||
context.getPackageManager().getActivityInfo(new ComponentName(context.getPackageName(), "com.tencent.tauth.AuthActivity"), 0);
|
||||
try {
|
||||
context.getPackageManager().getActivityInfo(new ComponentName(context.getPackageName(), "com.tencent.connect.common.AssistActivity"), 0);
|
||||
return true;
|
||||
} catch (PackageManager.NameNotFoundException unused) {
|
||||
f.e("openSDK_LOG.Tencent", "AndroidManifest.xml 没有检测到com.tencent.connect.common.AssistActivity\n" + ("没有在AndroidManifest.xml中检测到com.tencent.connect.common.AssistActivity,请加上com.tencent.connect.common.AssistActivity,详细信息请查看官网文档.\n配置示例如下: \n<activity\n android:name=\"com.tencent.connect.common.AssistActivity\"\n android:screenOrientation=\"behind\"\n android:theme=\"@android:style/Theme.Translucent.NoTitleBar\"\n android:configChanges=\"orientation|keyboardHidden\">\n</activity>"));
|
||||
return false;
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException unused2) {
|
||||
f.e("openSDK_LOG.Tencent", "AndroidManifest.xml 没有检测到com.tencent.tauth.AuthActivity" + (("没有在AndroidManifest.xml中检测到com.tencent.tauth.AuthActivity,请加上com.tencent.tauth.AuthActivity,并配置<data android:scheme=\"tencent" + str + "\" />,详细信息请查看官网文档.") + "\n配置示例如下: \n<activity\n android:name=\"com.tencent.tauth.AuthActivity\"\n android:noHistory=\"true\"\n android:launchMode=\"singleTask\">\n<intent-filter>\n <action android:name=\"android.intent.action.VIEW\" />\n <category android:name=\"android.intent.category.DEFAULT\" />\n <category android:name=\"android.intent.category.BROWSABLE\" />\n <data android:scheme=\"tencent" + str + "\" />\n</intent-filter>\n</activity>"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int a(Activity activity, String str, IUiListener iUiListener) {
|
||||
f.c("openSDK_LOG.Tencent", "login() with activity, scope is " + str);
|
||||
return this.a.a(activity, str, iUiListener);
|
||||
}
|
||||
|
||||
public void a(Context context) {
|
||||
f.c("openSDK_LOG.Tencent", "logout()");
|
||||
this.a.a().a(null, "0");
|
||||
this.a.a().a(null);
|
||||
}
|
||||
|
||||
public void a(Activity activity, Bundle bundle, IUiListener iUiListener) {
|
||||
f.c("openSDK_LOG.Tencent", "shareToQQ()");
|
||||
new QQShare(activity, this.a.a()).b(activity, bundle, iUiListener);
|
||||
}
|
||||
|
||||
public static boolean a(int i, int i2, Intent intent, IUiListener iUiListener) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("onActivityResultData() reqcode = ");
|
||||
sb.append(i);
|
||||
sb.append(", resultcode = ");
|
||||
sb.append(i2);
|
||||
sb.append(", data = null ? ");
|
||||
sb.append(intent == null);
|
||||
sb.append(", listener = null ? ");
|
||||
sb.append(iUiListener == null);
|
||||
f.c("openSDK_LOG.Tencent", sb.toString());
|
||||
return UIListenerManager.a().a(i, i2, intent, iUiListener);
|
||||
}
|
||||
|
||||
public String a() {
|
||||
return this.a.a().b();
|
||||
}
|
||||
}
|
15
sources/com/tencent/tauth/UiError.java
Normal file
15
sources/com/tencent/tauth/UiError.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.tencent.tauth;
|
||||
|
||||
/* compiled from: ProGuard */
|
||||
/* loaded from: classes.dex */
|
||||
public class UiError {
|
||||
public int a;
|
||||
public String b;
|
||||
public String c;
|
||||
|
||||
public UiError(int i, String str, String str2) {
|
||||
this.b = str;
|
||||
this.a = i;
|
||||
this.c = str2;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user