106 lines
		
	
	
		
			4.8 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			106 lines
		
	
	
		
			4.8 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
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();
 | 
						|
    }
 | 
						|
}
 |