得物.apk(点击下载) / SocialOperation.java


package com.tencent.open;

import a.f;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Base64;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.tencent.connect.a;
import com.tencent.connect.auth.QQToken;
import com.tencent.connect.common.BaseApi;
import com.tencent.open.b.e;
import com.tencent.open.log.SLog;
import com.tencent.open.utils.HttpUtils;
import com.tencent.open.utils.k;
import com.tencent.open.utils.m;
import com.tencent.tauth.DefaultUiListener;
import com.tencent.tauth.IUiListener;
import com.tencent.tauth.UiError;
import fd.i;
import h.b;
import org.json.JSONObject;

/* compiled from: ProGuard */
public class SocialOperation extends BaseApi {
    public SocialOperation(QQToken qQToken) {
        super(qQToken);
    }

    public void bindQQGroup(final Activity activity, String str, String str2, final IUiListener iUiListener) {
        SLog.i("openSDK_LOG.GameAppOperation", "-->bindQQGroup()  -- start");
        if (!a.a("openSDK_LOG.GameAppOperation", iUiListener)) {
            if (activity == null) {
                SLog.e("openSDK_LOG.GameAppOperation", "-->bindQQGroup, activity is empty.");
                if (iUiListener != null) {
                    g.a.r(PushConstants.PUSHSERVICE_INFO_SEND_MESSAGE_BY_BROADCAST, "param acitivty is null", "activity param of api can not be null.", iUiListener);
                    return;
                }
                return;
            }
            StringBuffer stringBuffer = new StringBuffer("mqqapi://opensdk/bind_group?src_type=app&version=1");
            String appId = this.f27894c.getAppId();
            if (TextUtils.isEmpty(appId)) {
                SLog.e("openSDK_LOG.GameAppOperation", "-->bindQQGroup, appId is empty.");
                if (iUiListener != null) {
                    g.a.r(1003, "appid is null", "please login.", iUiListener);
                    return;
                }
                return;
            }
            String openId = this.f27894c.getOpenId();
            if (TextUtils.isEmpty(openId)) {
                SLog.e("openSDK_LOG.GameAppOperation", "-->bindQQGroup, openid is empty.");
                if (iUiListener != null) {
                    g.a.r(1004, "openid params is null", "please login.", iUiListener);
                    return;
                }
                return;
            }
            String a5 = m.a(activity);
            if (TextUtils.isEmpty(a5)) {
                SLog.e("openSDK_LOG.GameAppOperation", "-->bindQQGroup, appname is empty.");
                if (iUiListener != null) {
                    g.a.r(1005, "appName params is null", "", iUiListener);
                }
            } else if (TextUtils.isEmpty(str)) {
                SLog.e("openSDK_LOG.GameAppOperation", "-->bindQQGroup, organization id is empty.");
                if (iUiListener != null) {
                    g.a.r(1006, "organizationId params is null", "", iUiListener);
                }
            } else if (TextUtils.isEmpty(str2)) {
                SLog.e("openSDK_LOG.GameAppOperation", "-->bindQQGroup, organization name is empty.");
                if (iUiListener != null) {
                    g.a.r(1007, "organizationName params is null", "", iUiListener);
                }
            } else {
                StringBuilder h12 = f.h("&app_name=");
                h12.append(Base64.encodeToString(m.j(a5), 2));
                stringBuffer.append(h12.toString());
                stringBuffer.append("&organization_id=" + Base64.encodeToString(m.j(str), 2));
                stringBuffer.append("&organization_name=" + Base64.encodeToString(m.j(str2), 2));
                stringBuffer.append("&openid=" + Base64.encodeToString(m.j(openId), 2));
                stringBuffer.append("&appid=" + Base64.encodeToString(m.j(appId), 2));
                stringBuffer.append("&sdk_version=" + Base64.encodeToString(m.j("3.5.13.lite"), 2));
                stringBuffer.append("&app_name_url_encode=" + m.f(Base64.encodeToString(m.j(a5), 2)));
                stringBuffer.append("&organization_name_url_encode=" + m.f(Base64.encodeToString(m.j(str2), 2)));
                SLog.v("openSDK_LOG.GameAppOperation", "-->bindQQGroup, url: " + stringBuffer.toString());
                Uri parse = Uri.parse(stringBuffer.toString());
                final Intent intent = new Intent("android.intent.action.VIEW");
                intent.setData(parse);
                intent.setPackage("com.tencent.mobileqq");
                if (k.c(activity, "8.1.0") < 0) {
                    SLog.w("openSDK_LOG.GameAppOperation", "-->bind group, there is no activity, show download page.");
                    a(activity);
                    return;
                }
                AnonymousClass3 r12 = new DefaultUiListener() {
                    /* class com.tencent.open.SocialOperation.AnonymousClass3 */

                    @Override // com.tencent.tauth.IUiListener, com.tencent.tauth.DefaultUiListener
                    public void onCancel() {
                    }

                    @Override // com.tencent.tauth.IUiListener, com.tencent.tauth.DefaultUiListener
                    public void onComplete(Object obj) {
                        SLog.w("openSDK_LOG.GameAppOperation", "-->bind group resp is: " + obj);
                        if (obj == null) {
                            IUiListener iUiListener = iUiListener;
                            if (iUiListener != null) {
                                g.a.r(4001, "服务端错误,请稍后重试", "资格检查回包为null。", iUiListener);
                            }
                        } else if (((JSONObject) obj).optInt("bind") != 1) {
                            try {
                                SocialOperation.this.a((SocialOperation) activity, (Activity) 10112, (int) intent, (Intent) false);
                            } catch (Exception e) {
                                SLog.e("openSDK_LOG.GameAppOperation", "-->bind group, start activity exception.", e);
                                SocialOperation.this.a((SocialOperation) activity);
                            }
                        } else {
                            IUiListener iUiListener2 = iUiListener;
                            if (iUiListener2 != null) {
                                g.a.r(3002, "该群已绑定!", "绑定过的群不能再次绑定。", iUiListener2);
                            }
                            SLog.i("openSDK_LOG.GameAppOperation", "-->bindQQGroup() binded return.");
                        }
                    }

                    @Override // com.tencent.tauth.IUiListener, com.tencent.tauth.DefaultUiListener
                    public void onError(UiError uiError) {
                        SLog.v("openSDK_LOG.GameAppOperation", "-->bindQQGroup, error: " + uiError);
                        IUiListener iUiListener = iUiListener;
                        if (iUiListener != null) {
                            iUiListener.onError(uiError);
                        }
                    }
                };
                Bundle a12 = a();
                a12.putString("appid", appId);
                a12.putString("orgid", str);
                HttpUtils.requestAsync(this.f27894c, activity, "https://openmobile.qq.com/cgi-bin/qunopensdk/check_group", a12, "GET", new BaseApi.TempRequestListener(r12));
                SLog.i("openSDK_LOG.GameAppOperation", "-->bindQQGroup() do.");
            }
        }
    }

    public void joinGroup(final Activity activity, String str, final IUiListener iUiListener) {
        SLog.i("openSDK_LOG.GameAppOperation", "joinQQGroup()");
        if (!a.a("openSDK_LOG.GameAppOperation", iUiListener)) {
            if (activity == null) {
                SLog.e("openSDK_LOG.GameAppOperation", "-->joinGroup, activity is empty.");
                if (iUiListener != null) {
                    g.a.r(PushConstants.PUSHSERVICE_INFO_SEND_MESSAGE_BY_BROADCAST, "param acitivty is null", "activity param of api can not be null.", iUiListener);
                }
            } else if (TextUtils.isEmpty(str)) {
                SLog.e("openSDK_LOG.GameAppOperation", "-->joinGroup, params is empty.");
                if (iUiListener != null) {
                    g.a.r(1006, "param organizationId is null", "organizationId param of api can not be null.", iUiListener);
                }
            } else {
                final Intent intent = new Intent();
                String appId = this.f27894c.getAppId();
                if (TextUtils.isEmpty(appId)) {
                    SLog.e("openSDK_LOG.GameAppOperation", "-->joinGroup, appid is empty.");
                    if (iUiListener != null) {
                        g.a.r(1003, "appid is null", "appid is null, please login.", iUiListener);
                        return;
                    }
                    return;
                }
                String openId = this.f27894c.getOpenId();
                if (TextUtils.isEmpty(openId)) {
                    SLog.e("openSDK_LOG.GameAppOperation", "-->joinGroup, openid is empty.");
                    if (iUiListener != null) {
                        g.a.r(1004, "openid is null", "openid is null, please login.", iUiListener);
                        return;
                    }
                    return;
                }
                StringBuffer stringBuffer = new StringBuffer("mqqapi://opensdk/join_group?src_type=app&version=1");
                StringBuilder h12 = f.h("&openid=");
                h12.append(Base64.encodeToString(m.j(openId), 2));
                stringBuffer.append(h12.toString());
                stringBuffer.append("&appid=" + Base64.encodeToString(m.j(appId), 2));
                stringBuffer.append("&organization_id=" + Base64.encodeToString(m.j(str), 2));
                stringBuffer.append("&sdk_version=" + Base64.encodeToString(m.j("3.5.13.lite"), 2));
                intent.setData(Uri.parse(stringBuffer.toString()));
                intent.setPackage("com.tencent.mobileqq");
                if (k.c(activity, "8.1.0") < 0) {
                    SLog.w("openSDK_LOG.GameAppOperation", "-->bind group, there is no activity, show download page.");
                    a(activity);
                    return;
                }
                AnonymousClass2 r32 = new DefaultUiListener() {
                    /* class com.tencent.open.SocialOperation.AnonymousClass2 */

                    @Override // com.tencent.tauth.IUiListener, com.tencent.tauth.DefaultUiListener
                    public void onCancel() {
                    }

                    @Override // com.tencent.tauth.IUiListener, com.tencent.tauth.DefaultUiListener
                    public void onComplete(Object obj) {
                        SLog.w("openSDK_LOG.GameAppOperation", "-->join group resp is: " + obj);
                        if (obj == null) {
                            IUiListener iUiListener = iUiListener;
                            if (iUiListener != null) {
                                g.a.r(4001, "服务端错误,请稍后重试", "资格检查回包为null。", iUiListener);
                            }
                        } else if (((JSONObject) obj).optInt("bind") == 1) {
                            try {
                                SocialOperation.this.a((SocialOperation) activity, (Activity) 10111, (int) intent, (Intent) false);
                            } catch (Exception e) {
                                SLog.e("openSDK_LOG.GameAppOperation", "-->join group, start activity exception.", e);
                                SocialOperation.this.a((SocialOperation) activity);
                            }
                        } else {
                            IUiListener iUiListener2 = iUiListener;
                            if (iUiListener2 != null) {
                                g.a.r(3003, "该组织未绑群,无法加入", "该组织未绑群,无法加入。", iUiListener2);
                            }
                        }
                    }

                    @Override // com.tencent.tauth.IUiListener, com.tencent.tauth.DefaultUiListener
                    public void onError(UiError uiError) {
                        SLog.v("openSDK_LOG.GameAppOperation", "-->joinQQGroup, error: " + uiError);
                        IUiListener iUiListener = iUiListener;
                        if (iUiListener != null) {
                            iUiListener.onError(uiError);
                        }
                    }
                };
                Bundle a5 = a();
                a5.putString("appid", appId);
                a5.putString("orgid", str);
                HttpUtils.requestAsync(this.f27894c, activity, "https://openmobile.qq.com/cgi-bin/qunopensdk/check_group", a5, "GET", new BaseApi.TempRequestListener(r32));
                SLog.i("openSDK_LOG.GameAppOperation", "-->joinQQGroup() do.");
            }
        }
    }

    public void makeFriend(Activity activity, Bundle bundle) {
        SLog.i("openSDK_LOG.GameAppOperation", "-->makeFriend()  -- start");
        if (!a.a("openSDK_LOG.GameAppOperation", null)) {
            if (bundle == null) {
                SLog.e("openSDK_LOG.GameAppOperation", "-->makeFriend params is null");
                e.a().a(this.f27894c.getOpenId(), this.f27894c.getAppId(), "ANDROIDQQ.MAKEAFRIEND.XX", "14", "18", "1");
                return;
            }
            String string = bundle.getString("fopen_id");
            if (TextUtils.isEmpty(string)) {
                SLog.e("openSDK_LOG.GameAppOperation", "-->make friend, fOpenid is empty.");
                e.a().a(this.f27894c.getOpenId(), this.f27894c.getAppId(), "ANDROIDQQ.MAKEAFRIEND.XX", "14", "18", "1");
                return;
            }
            String string2 = bundle.getString("friend_label");
            String string3 = bundle.getString("add_msg");
            String a5 = m.a(activity);
            String openId = this.f27894c.getOpenId();
            String appId = this.f27894c.getAppId();
            StringBuilder n = h.a.n("-->make friend, fOpenid: ", string, " | label: ", string2, " | message: ");
            b.u(n, string3, " | openid: ", openId, " | appid:");
            n.append(appId);
            SLog.v("openSDK_LOG.GameAppOperation", n.toString());
            StringBuffer stringBuffer = new StringBuffer("mqqapi://gamesdk/add_friend?src_type=app&version=1");
            StringBuilder h12 = f.h("&fopen_id=");
            h12.append(Base64.encodeToString(m.j(string), 2));
            stringBuffer.append(h12.toString());
            if (!TextUtils.isEmpty(openId)) {
                i.p(openId, 2, f.h("&open_id="), stringBuffer);
            }
            if (!TextUtils.isEmpty(appId)) {
                stringBuffer.append("&app_id=" + appId);
            }
            if (!TextUtils.isEmpty(string2)) {
                i.p(string2, 2, f.h("&friend_label="), stringBuffer);
            }
            if (!TextUtils.isEmpty(string3)) {
                i.p(string3, 2, f.h("&add_msg="), stringBuffer);
            }
            if (!TextUtils.isEmpty(a5)) {
                i.p(a5, 2, f.h("&app_name="), stringBuffer);
            }
            StringBuilder h13 = f.h("-->make friend, url: ");
            h13.append(stringBuffer.toString());
            SLog.v("openSDK_LOG.GameAppOperation", h13.toString());
            Intent intent = new Intent("android.intent.action.VIEW");
            intent.setData(Uri.parse(stringBuffer.toString()));
            if (!m.f(activity, "5.1.0")) {
                SLog.i("openSDK_LOG.GameAppOperation", "-->makeFriend target activity found, qqver greater than 5.1.0");
                try {
                    activity.startActivity(intent);
                    try {
                        a31.a.a();
                    } catch (Exception unused) {
                    }
                    e.a().a(this.f27894c.getOpenId(), this.f27894c.getAppId(), "ANDROIDQQ.MAKEAFRIEND.XX", "14", "18", "0");
                } catch (Exception e) {
                    SLog.e("openSDK_LOG.GameAppOperation", "-->make friend, start activity exception.", e);
                    a(activity);
                    e.a().a(this.f27894c.getOpenId(), this.f27894c.getAppId(), "ANDROIDQQ.MAKEAFRIEND.XX", "14", "18", "1");
                }
            } else {
                SLog.w("openSDK_LOG.GameAppOperation", "-->make friend, there is no activity.");
                a(activity);
                e.a().a(this.f27894c.getOpenId(), this.f27894c.getAppId(), "ANDROIDQQ.MAKEAFRIEND.XX", "14", "18", "1");
            }
            SLog.i("openSDK_LOG.GameAppOperation", "-->makeFriend()  -- end");
        }
    }

    public void unBindGroup(Context context, String str, final IUiListener iUiListener) {
        SLog.i("openSDK_LOG.GameAppOperation", "unBindQQGroup()");
        if (!a.a("openSDK_LOG.GameAppOperation", iUiListener)) {
            if (context == null) {
                SLog.e("openSDK_LOG.GameAppOperation", "-->uinBindGroup, activity is empty.");
                if (iUiListener != null) {
                    g.a.r(PushConstants.PUSHSERVICE_INFO_SEND_MESSAGE_BY_BROADCAST, "param acitivty is null", "activity param of api can not be null.", iUiListener);
                }
            } else if (TextUtils.isEmpty(str)) {
                SLog.e("openSDK_LOG.GameAppOperation", "-->unBindGroup, params is empty.");
                if (iUiListener != null) {
                    g.a.r(1006, "param organizationId is null", "organizationId param of api can not be null.", iUiListener);
                }
            } else {
                String appId = this.f27894c.getAppId();
                if (TextUtils.isEmpty(appId)) {
                    SLog.e("openSDK_LOG.GameAppOperation", "-->unBindGroup, appid is empty.");
                    if (iUiListener != null) {
                        g.a.r(1003, "param appId is null", "appid is null please login.", iUiListener);
                        return;
                    }
                    return;
                }
                AnonymousClass1 r22 = new DefaultUiListener() {
                    /* class com.tencent.open.SocialOperation.AnonymousClass1 */

                    @Override // com.tencent.tauth.IUiListener, com.tencent.tauth.DefaultUiListener
                    public void onCancel() {
                    }

                    @Override // com.tencent.tauth.IUiListener, com.tencent.tauth.DefaultUiListener
                    public void onComplete(Object obj) {
                        SLog.w("openSDK_LOG.GameAppOperation", "-->unbind group resp is: " + obj);
                        if (obj == null) {
                            IUiListener iUiListener = iUiListener;
                            if (iUiListener != null) {
                                g.a.r(4001, "服务端错误,请稍后重试", "资格检查回包为null。", iUiListener);
                                return;
                            }
                            return;
                        }
                        JSONObject jSONObject = (JSONObject) obj;
                        IUiListener iUiListener2 = iUiListener;
                        if (iUiListener2 != null) {
                            iUiListener2.onComplete(jSONObject);
                        }
                    }

                    @Override // com.tencent.tauth.IUiListener, com.tencent.tauth.DefaultUiListener
                    public void onError(UiError uiError) {
                        SLog.v("openSDK_LOG.GameAppOperation", "-->unbindQQGroup, error: " + uiError);
                        IUiListener iUiListener = iUiListener;
                        if (iUiListener != null) {
                            iUiListener.onError(uiError);
                        }
                    }
                };
                Bundle a5 = a();
                a5.putString("appid", appId);
                a5.putString("orgid", str);
                HttpUtils.requestAsync(this.f27894c, context, "https://openmobile.qq.com/cgi-bin/qunopensdk/unbind", a5, "GET", new BaseApi.TempRequestListener(r22));
                SLog.i("openSDK_LOG.GameAppOperation", "-->unBindQQGroup() do.");
            }
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void a(Activity activity) {
        a(activity, "");
    }

    private void a(Activity activity, String str) {
        new TDialog(activity, "", a(str), null, this.f27894c).show();
    }
}