package com.tencent.open; 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.huawei.hms.support.api.entity.common.CommonConstant; import com.tencent.connect.auth.QQToken; import com.tencent.connect.common.BaseApi; import com.tencent.connect.common.Constants; import com.tencent.open.a.d; import com.tencent.open.log.SLog; import com.tencent.open.utils.HttpUtils; import com.tencent.open.utils.i; import com.tencent.open.utils.l; import com.tencent.tauth.DefaultUiListener; import com.tencent.tauth.IUiListener; import com.tencent.tauth.UiError; import org.json.JSONObject; /* compiled from: ProGuard */ public class SocialOperation extends BaseApi { public static final String GAME_FRIEND_ADD_MESSAGE = "add_msg"; public static final String GAME_FRIEND_LABEL = "friend_label"; public static final String GAME_FRIEND_OPENID = "fopen_id"; public static final String GAME_SIGNATURE = "signature"; public static final String GAME_UNION_ID = "unionid"; public static final String GAME_UNION_NAME = "union_name"; public static final String GAME_ZONE_ID = "zoneid"; 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 (activity == null) { SLog.e("openSDK_LOG.GameAppOperation", "-->bindQQGroup, activity is empty."); if (iUiListener != null) { iUiListener.onError(new UiError(1001, "param acitivty is null", "activity param of api can not be null.")); return; } return; } StringBuffer stringBuffer = new StringBuffer("mqqapi://opensdk/bind_group?src_type=app&version=1"); String appId = this.f31009c.getAppId(); if (TextUtils.isEmpty(appId)) { SLog.e("openSDK_LOG.GameAppOperation", "-->bindQQGroup, appId is empty."); if (iUiListener != null) { iUiListener.onError(new UiError(1003, "appid is null", "please login.")); return; } return; } String openId = this.f31009c.getOpenId(); if (TextUtils.isEmpty(openId)) { SLog.e("openSDK_LOG.GameAppOperation", "-->bindQQGroup, openid is empty."); if (iUiListener != null) { iUiListener.onError(new UiError(1004, "openid params is null", "please login.")); return; } return; } String a14 = l.a(activity); if (TextUtils.isEmpty(a14)) { SLog.e("openSDK_LOG.GameAppOperation", "-->bindQQGroup, appname is empty."); if (iUiListener != null) { iUiListener.onError(new UiError(1005, "appName params is null", "")); } } else if (TextUtils.isEmpty(str)) { SLog.e("openSDK_LOG.GameAppOperation", "-->bindQQGroup, organization id is empty."); if (iUiListener != null) { iUiListener.onError(new UiError(1006, "organizationId params is null", "")); } } else if (TextUtils.isEmpty(str2)) { SLog.e("openSDK_LOG.GameAppOperation", "-->bindQQGroup, organization name is empty."); if (iUiListener != null) { iUiListener.onError(new UiError(1007, "organizationName params is null", "")); } } else { stringBuffer.append("&app_name=" + Base64.encodeToString(l.i(a14), 2)); stringBuffer.append("&organization_id=" + Base64.encodeToString(l.i(str), 2)); stringBuffer.append("&organization_name=" + Base64.encodeToString(l.i(str2), 2)); stringBuffer.append("&openid=" + Base64.encodeToString(l.i(openId), 2)); stringBuffer.append("&appid=" + Base64.encodeToString(l.i(appId), 2)); stringBuffer.append("&sdk_version=" + Base64.encodeToString(l.i(Constants.SDK_VERSION), 2)); SLog.v("openSDK_LOG.GameAppOperation", "-->bindQQGroup, url: " + stringBuffer.toString()); Uri parse = Uri.parse(stringBuffer.toString()); final Intent intent = new Intent(CommonConstant.ACTION.HWID_SCHEME_URL); intent.setData(parse); if (!a(intent) || i.c(activity, "8.1.0") < 0) { SLog.w("openSDK_LOG.GameAppOperation", "-->bind group, there is no activity, show download page."); a(activity); return; } AnonymousClass3 r122 = 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) { iUiListener.onError(new UiError(4001, "服务端错误,请稍后重试", "资格检查回包为null。")); } } else if (((JSONObject) obj).optInt("bind") != 1) { try { SocialOperation.this.a((SocialOperation) activity, (Activity) 10112, (int) intent, (Intent) false); } catch (Exception e14) { SLog.e("openSDK_LOG.GameAppOperation", "-->bind group, start activity exception.", e14); SocialOperation.this.a((SocialOperation) activity); } } else { IUiListener iUiListener2 = iUiListener; if (iUiListener2 != null) { iUiListener2.onError(new UiError(3002, "该群已绑定!", "绑定过的群不能再次绑定。")); } 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 a15 = a(); a15.putString("appid", appId); a15.putString("orgid", str); HttpUtils.requestAsync(this.f31009c, activity, "https://openmobile.qq.com/cgi-bin/qunopensdk/check_group", a15, "GET", new BaseApi.TempRequestListener(r122)); 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 (activity == null) { SLog.e("openSDK_LOG.GameAppOperation", "-->joinGroup, activity is empty."); if (iUiListener != null) { iUiListener.onError(new UiError(1001, "param acitivty is null", "activity param of api can not be null.")); } } else if (TextUtils.isEmpty(str)) { SLog.e("openSDK_LOG.GameAppOperation", "-->joinGroup, params is empty."); if (iUiListener != null) { iUiListener.onError(new UiError(1006, "param organizationId is null", "organizationId param of api can not be null.")); } } else { final Intent intent = new Intent(); String appId = this.f31009c.getAppId(); if (TextUtils.isEmpty(appId)) { SLog.e("openSDK_LOG.GameAppOperation", "-->joinGroup, appid is empty."); if (iUiListener != null) { iUiListener.onError(new UiError(1003, "appid is null", "appid is null, please login.")); return; } return; } String openId = this.f31009c.getOpenId(); if (TextUtils.isEmpty(openId)) { SLog.e("openSDK_LOG.GameAppOperation", "-->joinGroup, openid is empty."); if (iUiListener != null) { iUiListener.onError(new UiError(1004, "openid is null", "openid is null, please login.")); return; } return; } StringBuffer stringBuffer = new StringBuffer("mqqapi://opensdk/join_group?src_type=app&version=1"); stringBuffer.append("&openid=" + Base64.encodeToString(l.i(openId), 2)); stringBuffer.append("&appid=" + Base64.encodeToString(l.i(appId), 2)); stringBuffer.append("&organization_id=" + Base64.encodeToString(l.i(str), 2)); stringBuffer.append("&sdk_version=" + Base64.encodeToString(l.i(Constants.SDK_VERSION), 2)); intent.setData(Uri.parse(stringBuffer.toString())); if (!a(intent) || i.c(activity, "8.1.0") < 0) { SLog.w("openSDK_LOG.GameAppOperation", "-->bind group, there is no activity, show download page."); a(activity); return; } AnonymousClass2 r33 = 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) { iUiListener.onError(new UiError(4001, "服务端错误,请稍后重试", "资格检查回包为null。")); } } else if (((JSONObject) obj).optInt("bind") == 1) { try { SocialOperation.this.a((SocialOperation) activity, (Activity) 10111, (int) intent, (Intent) false); } catch (Exception e14) { SLog.e("openSDK_LOG.GameAppOperation", "-->join group, start activity exception.", e14); SocialOperation.this.a((SocialOperation) activity); } } else { IUiListener iUiListener2 = iUiListener; if (iUiListener2 != null) { iUiListener2.onError(new UiError(3003, "该组织未绑群,无法加入", "该组织未绑群,无法加入。")); } } } @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 a14 = a(); a14.putString("appid", appId); a14.putString("orgid", str); HttpUtils.requestAsync(this.f31009c, activity, "https://openmobile.qq.com/cgi-bin/qunopensdk/check_group", a14, "GET", new BaseApi.TempRequestListener(r33)); SLog.i("openSDK_LOG.GameAppOperation", "-->joinQQGroup() do."); } } public void makeFriend(Activity activity, Bundle bundle) { SLog.i("openSDK_LOG.GameAppOperation", "-->makeFriend() -- start"); if (bundle == null) { SLog.e("openSDK_LOG.GameAppOperation", "-->makeFriend params is null"); d.a().a(this.f31009c.getOpenId(), this.f31009c.getAppId(), Constants.VIA_MAKE_FRIEND, Constants.VIA_REPORT_TYPE_MAKE_FRIEND, "18", "1"); return; } String string = bundle.getString(GAME_FRIEND_OPENID); if (TextUtils.isEmpty(string)) { SLog.e("openSDK_LOG.GameAppOperation", "-->make friend, fOpenid is empty."); d.a().a(this.f31009c.getOpenId(), this.f31009c.getAppId(), Constants.VIA_MAKE_FRIEND, Constants.VIA_REPORT_TYPE_MAKE_FRIEND, "18", "1"); return; } String string2 = bundle.getString(GAME_FRIEND_LABEL); String string3 = bundle.getString(GAME_FRIEND_ADD_MESSAGE); String a14 = l.a(activity); String openId = this.f31009c.getOpenId(); String appId = this.f31009c.getAppId(); SLog.v("openSDK_LOG.GameAppOperation", "-->make friend, fOpenid: " + string + " | label: " + string2 + " | message: " + string3 + " | openid: " + openId + " | appid:" + appId); StringBuffer stringBuffer = new StringBuffer("mqqapi://gamesdk/add_friend?src_type=app&version=1"); StringBuilder sb3 = new StringBuilder(); sb3.append("&fopen_id="); sb3.append(Base64.encodeToString(l.i(string), 2)); stringBuffer.append(sb3.toString()); if (!TextUtils.isEmpty(openId)) { stringBuffer.append("&open_id=" + Base64.encodeToString(l.i(openId), 2)); } if (!TextUtils.isEmpty(appId)) { stringBuffer.append("&app_id=" + appId); } if (!TextUtils.isEmpty(string2)) { stringBuffer.append("&friend_label=" + Base64.encodeToString(l.i(string2), 2)); } if (!TextUtils.isEmpty(string3)) { stringBuffer.append("&add_msg=" + Base64.encodeToString(l.i(string3), 2)); } if (!TextUtils.isEmpty(a14)) { stringBuffer.append("&app_name=" + Base64.encodeToString(l.i(a14), 2)); } SLog.v("openSDK_LOG.GameAppOperation", "-->make friend, url: " + stringBuffer.toString()); Intent intent = new Intent(CommonConstant.ACTION.HWID_SCHEME_URL); intent.setData(Uri.parse(stringBuffer.toString())); if (!a(intent) || l.f(activity, "5.1.0")) { SLog.w("openSDK_LOG.GameAppOperation", "-->make friend, there is no activity."); a(activity); d.a().a(this.f31009c.getOpenId(), this.f31009c.getAppId(), Constants.VIA_MAKE_FRIEND, Constants.VIA_REPORT_TYPE_MAKE_FRIEND, "18", "1"); } else { SLog.i("openSDK_LOG.GameAppOperation", "-->makeFriend target activity found, qqver greater than 5.1.0"); try { activity.startActivity(intent); d.a().a(this.f31009c.getOpenId(), this.f31009c.getAppId(), Constants.VIA_MAKE_FRIEND, Constants.VIA_REPORT_TYPE_MAKE_FRIEND, "18", "0"); } catch (Exception e14) { SLog.e("openSDK_LOG.GameAppOperation", "-->make friend, start activity exception.", e14); a(activity); d.a().a(this.f31009c.getOpenId(), this.f31009c.getAppId(), Constants.VIA_MAKE_FRIEND, Constants.VIA_REPORT_TYPE_MAKE_FRIEND, "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 (context == null) { SLog.e("openSDK_LOG.GameAppOperation", "-->uinBindGroup, activity is empty."); if (iUiListener != null) { iUiListener.onError(new UiError(1001, "param acitivty is null", "activity param of api can not be null.")); } } else if (TextUtils.isEmpty(str)) { SLog.e("openSDK_LOG.GameAppOperation", "-->unBindGroup, params is empty."); if (iUiListener != null) { iUiListener.onError(new UiError(1006, "param organizationId is null", "organizationId param of api can not be null.")); } } else { String appId = this.f31009c.getAppId(); if (TextUtils.isEmpty(appId)) { SLog.e("openSDK_LOG.GameAppOperation", "-->unBindGroup, appid is empty."); if (iUiListener != null) { iUiListener.onError(new UiError(1003, "param appId is null", "appid is null please login.")); return; } return; } AnonymousClass1 r23 = 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) { iUiListener.onError(new UiError(4001, "服务端错误,请稍后重试", "资格检查回包为null。")); 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 a14 = a(); a14.putString("appid", appId); a14.putString("orgid", str); HttpUtils.requestAsync(this.f31009c, context, "https://openmobile.qq.com/cgi-bin/qunopensdk/unbind", a14, "GET", new BaseApi.TempRequestListener(r23)); 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.f31009c).show(); } }