308 lines
16 KiB
Java
308 lines
16 KiB
Java
package com.tencent.connect.share;
|
||
|
||
import android.app.Activity;
|
||
import android.content.Context;
|
||
import android.content.Intent;
|
||
import android.net.Uri;
|
||
import android.os.Bundle;
|
||
import android.os.SystemClock;
|
||
import android.text.TextUtils;
|
||
import android.util.Base64;
|
||
import com.ijm.dataencryption.de.DataDecryptTool;
|
||
import com.tencent.connect.auth.QQToken;
|
||
import com.tencent.connect.common.BaseApi;
|
||
import com.tencent.connect.common.UIListenerManager;
|
||
import com.tencent.open.SocialConstants;
|
||
import com.tencent.open.TDialog;
|
||
import com.tencent.open.a.f;
|
||
import com.tencent.open.b.d;
|
||
import com.tencent.open.utils.b;
|
||
import com.tencent.open.utils.c;
|
||
import com.tencent.open.utils.i;
|
||
import com.tencent.tauth.IUiListener;
|
||
import com.tencent.tauth.UiError;
|
||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||
import java.io.File;
|
||
import java.util.ArrayList;
|
||
|
||
/* compiled from: ProGuard */
|
||
/* loaded from: classes.dex */
|
||
public class QQShare extends BaseApi {
|
||
public String c;
|
||
|
||
public QQShare(Context context, QQToken qQToken) {
|
||
super(qQToken);
|
||
this.c = "";
|
||
}
|
||
|
||
private void c(final Activity activity, final Bundle bundle, final IUiListener iUiListener) {
|
||
f.c("openSDK_LOG.QQShare", "shareToMobileQQ() -- start.");
|
||
String string = bundle.getString(SocialConstants.PARAM_IMAGE_URL);
|
||
final String string2 = bundle.getString("title");
|
||
final String string3 = bundle.getString(SocialConstants.PARAM_SUMMARY);
|
||
f.a("openSDK_LOG.QQShare", "shareToMobileQQ -- imageUrl: " + string);
|
||
if (TextUtils.isEmpty(string)) {
|
||
d(activity, bundle, iUiListener);
|
||
} else if (!i.g(string)) {
|
||
bundle.putString(SocialConstants.PARAM_IMAGE_URL, null);
|
||
if (i.f(activity, "4.3.0")) {
|
||
f.b("openSDK_LOG.QQShare", "shareToMobileQQ -- QQ Version is < 4.3.0 ");
|
||
d(activity, bundle, iUiListener);
|
||
} else {
|
||
f.b("openSDK_LOG.QQShare", "shareToMobileQQ -- QQ Version is > 4.3.0 ");
|
||
a.a(activity, string, new c() { // from class: com.tencent.connect.share.QQShare.2
|
||
@Override // com.tencent.open.utils.c
|
||
public void a(int i, String str) {
|
||
if (i == 0) {
|
||
bundle.putString("imageLocalUrl", str);
|
||
} else if (TextUtils.isEmpty(string2) && TextUtils.isEmpty(string3)) {
|
||
IUiListener iUiListener2 = iUiListener;
|
||
if (iUiListener2 != null) {
|
||
iUiListener2.onError(new UiError(-6, "获取分享图片失败!", null));
|
||
f.e("openSDK_LOG.QQShare", "shareToMobileQQ -- error: 获取分享图片失败!");
|
||
}
|
||
d.a().a(1, "SHARE_CHECK_SDK", "1000", ((BaseApi) QQShare.this).b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "获取分享图片失败!");
|
||
return;
|
||
}
|
||
QQShare.this.d(activity, bundle, iUiListener);
|
||
}
|
||
|
||
@Override // com.tencent.open.utils.c
|
||
public void a(int i, ArrayList<String> arrayList) {
|
||
}
|
||
});
|
||
}
|
||
} else {
|
||
if (TextUtils.isEmpty(string2) && TextUtils.isEmpty(string3)) {
|
||
if (iUiListener != null) {
|
||
iUiListener.onError(new UiError(-6, "分享图片失败,检测不到SD卡!", null));
|
||
f.e("openSDK_LOG.QQShare", "分享图片失败,检测不到SD卡!");
|
||
}
|
||
d.a().a(1, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "分享图片失败,检测不到SD卡!");
|
||
return;
|
||
}
|
||
if (i.f(activity, "4.3.0")) {
|
||
new b(activity).a(string, new c() { // from class: com.tencent.connect.share.QQShare.1
|
||
@Override // com.tencent.open.utils.c
|
||
public void a(int i, String str) {
|
||
if (i == 0) {
|
||
bundle.putString("imageLocalUrl", str);
|
||
} else if (TextUtils.isEmpty(string2) && TextUtils.isEmpty(string3)) {
|
||
IUiListener iUiListener2 = iUiListener;
|
||
if (iUiListener2 != null) {
|
||
iUiListener2.onError(new UiError(-6, "获取分享图片失败!", null));
|
||
f.e("openSDK_LOG.QQShare", "shareToMobileQQ -- error: 获取分享图片失败!");
|
||
}
|
||
d.a().a(1, "SHARE_CHECK_SDK", "1000", ((BaseApi) QQShare.this).b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "获取分享图片失败!");
|
||
return;
|
||
}
|
||
QQShare.this.d(activity, bundle, iUiListener);
|
||
}
|
||
|
||
@Override // com.tencent.open.utils.c
|
||
public void a(int i, ArrayList<String> arrayList) {
|
||
}
|
||
});
|
||
} else {
|
||
d(activity, bundle, iUiListener);
|
||
}
|
||
}
|
||
f.c("openSDK_LOG.QQShare", "shareToMobileQQ() -- end");
|
||
}
|
||
|
||
/* JADX INFO: Access modifiers changed from: private */
|
||
public void d(Activity activity, Bundle bundle, IUiListener iUiListener) {
|
||
int i;
|
||
int i2;
|
||
f.c("openSDK_LOG.QQShare", "doShareToQQ() -- start");
|
||
StringBuffer stringBuffer = new StringBuffer("mqqapi://share/to_fri?src_type=app&version=1&file_type=news");
|
||
String string = bundle.getString(SocialConstants.PARAM_IMAGE_URL);
|
||
String string2 = bundle.getString("title");
|
||
String string3 = bundle.getString(SocialConstants.PARAM_SUMMARY);
|
||
String string4 = bundle.getString(SocialConstants.PARAM_TARGET_URL);
|
||
String string5 = bundle.getString("audio_url");
|
||
int i3 = bundle.getInt("req_type", 1);
|
||
String string6 = bundle.getString("share_to_qq_ark_info");
|
||
int i4 = bundle.getInt("cflag", 0);
|
||
String string7 = bundle.getString("share_qq_ext_str");
|
||
String a = i.a(activity);
|
||
if (a == null) {
|
||
a = bundle.getString(SocialConstants.PARAM_APPNAME);
|
||
}
|
||
String str = a;
|
||
String string8 = bundle.getString("imageLocalUrl");
|
||
String b = this.b.b();
|
||
String c = this.b.c();
|
||
f.a("openSDK_LOG.QQShare", "doShareToQQ -- openid: " + c);
|
||
if (!TextUtils.isEmpty(string)) {
|
||
stringBuffer.append("&image_url=" + Base64.encodeToString(i.i(string), 2));
|
||
}
|
||
if (!TextUtils.isEmpty(string8)) {
|
||
stringBuffer.append("&file_data=" + Base64.encodeToString(i.i(string8), 2));
|
||
}
|
||
if (!TextUtils.isEmpty(string2)) {
|
||
stringBuffer.append("&title=" + Base64.encodeToString(i.i(string2), 2));
|
||
}
|
||
if (!TextUtils.isEmpty(string3)) {
|
||
stringBuffer.append("&description=" + Base64.encodeToString(i.i(string3), 2));
|
||
}
|
||
if (!TextUtils.isEmpty(b)) {
|
||
stringBuffer.append("&share_id=" + b);
|
||
}
|
||
if (!TextUtils.isEmpty(string4)) {
|
||
stringBuffer.append("&url=" + Base64.encodeToString(i.i(string4), 2));
|
||
}
|
||
if (!TextUtils.isEmpty(str)) {
|
||
if (str.length() > 20) {
|
||
str = str.substring(0, 20) + "...";
|
||
}
|
||
stringBuffer.append("&app_name=" + Base64.encodeToString(i.i(str), 2));
|
||
}
|
||
if (!TextUtils.isEmpty(c)) {
|
||
stringBuffer.append("&open_id=" + Base64.encodeToString(i.i(c), 2));
|
||
}
|
||
if (!TextUtils.isEmpty(string5)) {
|
||
stringBuffer.append("&audioUrl=" + Base64.encodeToString(i.i(string5), 2));
|
||
}
|
||
stringBuffer.append("&req_type=" + Base64.encodeToString(i.i(String.valueOf(i3)), 2));
|
||
if (!TextUtils.isEmpty(string6)) {
|
||
stringBuffer.append("&share_to_qq_ark_info=" + Base64.encodeToString(i.i(string6), 2));
|
||
}
|
||
if (!TextUtils.isEmpty(string7)) {
|
||
stringBuffer.append("&share_qq_ext_str=" + Base64.encodeToString(i.i(string7), 2));
|
||
}
|
||
stringBuffer.append("&cflag=" + Base64.encodeToString(i.i(String.valueOf(i4)), 2));
|
||
f.a("openSDK_LOG.QQShare", "doShareToQQ -- url: " + stringBuffer.toString());
|
||
com.tencent.connect.a.a.a(com.tencent.open.utils.d.a(), this.b, "requireApi", "shareToNativeQQ");
|
||
Intent intent = new Intent("android.intent.action.VIEW");
|
||
intent.setData(Uri.parse(stringBuffer.toString()));
|
||
intent.putExtra("pkg_name", activity.getPackageName());
|
||
if (i.f(activity, "4.6.0")) {
|
||
f.c("openSDK_LOG.QQShare", "doShareToQQ, qqver below 4.6.");
|
||
if (a(intent)) {
|
||
UIListenerManager.a().a(11103, iUiListener);
|
||
a(activity, intent, 11103);
|
||
}
|
||
i2 = i4;
|
||
i = 1;
|
||
} else {
|
||
f.c("openSDK_LOG.QQShare", "doShareToQQ, qqver greater than 4.6.");
|
||
if (UIListenerManager.a().a("shareToQQ", iUiListener) != null) {
|
||
f.c("openSDK_LOG.QQShare", "doShareToQQ, last listener is not null, cancel it.");
|
||
}
|
||
if (a(intent)) {
|
||
i = 1;
|
||
a(activity, 10103, intent, true);
|
||
} else {
|
||
i = 1;
|
||
}
|
||
i2 = i4;
|
||
}
|
||
String str2 = i2 == i ? "11" : "10";
|
||
if (a(intent)) {
|
||
d.a().a(this.b.c(), this.b.b(), "ANDROIDQQ.SHARETOQQ.XX", str2, "3", "0", this.c, "0", "1", "0");
|
||
d.a().a(0, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "");
|
||
} else {
|
||
d.a().a(this.b.c(), this.b.b(), "ANDROIDQQ.SHARETOQQ.XX", str2, "3", "1", this.c, "0", "1", "0");
|
||
d.a().a(1, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "hasActivityForIntent fail");
|
||
}
|
||
f.c("openSDK_LOG.QQShare", "doShareToQQ() --end");
|
||
}
|
||
|
||
@Override // com.tencent.connect.common.BaseApi
|
||
public void releaseResource() {
|
||
}
|
||
|
||
public void b(Activity activity, Bundle bundle, IUiListener iUiListener) {
|
||
String str;
|
||
f.c("openSDK_LOG.QQShare", "shareToQQ() -- start.");
|
||
String string = bundle.getString(SocialConstants.PARAM_IMAGE_URL);
|
||
String string2 = bundle.getString("title");
|
||
String string3 = bundle.getString(SocialConstants.PARAM_SUMMARY);
|
||
String string4 = bundle.getString(SocialConstants.PARAM_TARGET_URL);
|
||
String string5 = bundle.getString("imageLocalUrl");
|
||
int i = bundle.getInt("req_type", 1);
|
||
f.c("openSDK_LOG.QQShare", "shareToQQ -- type: " + i);
|
||
if (i == 1) {
|
||
this.c = "1";
|
||
} else if (i == 2) {
|
||
this.c = "3";
|
||
} else if (i == 5) {
|
||
this.c = "2";
|
||
} else if (i == 6) {
|
||
this.c = "4";
|
||
}
|
||
if (i == 6) {
|
||
if (i.f(activity, "5.0.0")) {
|
||
iUiListener.onError(new UiError(-15, "手Q版本过低,应用分享只支持手Q5.0及其以上版本", null));
|
||
f.e("openSDK_LOG.QQShare", "shareToQQ, app share is not support below qq5.0.");
|
||
d.a().a(1, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "shareToQQ, app share is not support below qq5.0.");
|
||
return;
|
||
}
|
||
string4 = String.format("http://fusion.qq.com/cgi-bin/qzapps/unified_jump?appid=%1$s&from=%2$s&isOpenAppID=1", this.b.b(), "mqq");
|
||
bundle.putString(SocialConstants.PARAM_TARGET_URL, string4);
|
||
}
|
||
if (!i.b() && i.f(activity, "4.5.0")) {
|
||
iUiListener.onError(new UiError(-6, "分享图片失败,检测不到SD卡!", null));
|
||
f.e("openSDK_LOG.QQShare", "shareToQQ sdcard is null--end");
|
||
d.a().a(1, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "shareToQQ sdcard is null");
|
||
return;
|
||
}
|
||
if (i == 5) {
|
||
if (i.f(activity, "4.3.0")) {
|
||
iUiListener.onError(new UiError(-6, "低版本手Q不支持该项功能!", null));
|
||
f.e("openSDK_LOG.QQShare", "shareToQQ, version below 4.3 is not support.");
|
||
d.a().a(1, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "shareToQQ, version below 4.3 is not support.");
|
||
return;
|
||
} else if (!i.h(string5)) {
|
||
iUiListener.onError(new UiError(-6, "非法的图片地址!", null));
|
||
f.e("openSDK_LOG.QQShare", "shareToQQ -- error: 非法的图片地址!");
|
||
d.a().a(1, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "非法的图片地址!");
|
||
return;
|
||
}
|
||
}
|
||
if (i != 5) {
|
||
if (TextUtils.isEmpty(string4) || !(string4.startsWith("http://") || string4.startsWith("https://"))) {
|
||
iUiListener.onError(new UiError(-6, "传入参数有误!", null));
|
||
f.e("openSDK_LOG.QQShare", "shareToQQ, targetUrl is empty or illegal..");
|
||
d.a().a(1, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "shareToQQ, targetUrl is empty or illegal..");
|
||
return;
|
||
} else if (TextUtils.isEmpty(string2)) {
|
||
iUiListener.onError(new UiError(-6, "title不能为空!", null));
|
||
f.e("openSDK_LOG.QQShare", "shareToQQ, title is empty.");
|
||
d.a().a(1, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "shareToQQ, title is empty.");
|
||
return;
|
||
}
|
||
}
|
||
if (!TextUtils.isEmpty(string) && !string.startsWith("http://") && !string.startsWith("https://") && !new File(string).exists()) {
|
||
iUiListener.onError(new UiError(-6, "非法的图片地址!", null));
|
||
f.e("openSDK_LOG.QQShare", "shareToQQ, image url is emprty or illegal.");
|
||
d.a().a(1, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "shareToQQ, image url is emprty or illegal.");
|
||
return;
|
||
}
|
||
if (TextUtils.isEmpty(string2) || string2.length() <= 128) {
|
||
str = null;
|
||
} else {
|
||
str = null;
|
||
bundle.putString("title", i.a(string2, PeripheralType.SERVO, (String) null, (String) null));
|
||
}
|
||
if (!TextUtils.isEmpty(string3) && string3.length() > 512) {
|
||
bundle.putString(SocialConstants.PARAM_SUMMARY, i.a(string3, DataDecryptTool.DECRYPT_DB_FILE, str, str));
|
||
}
|
||
if (i.a(activity, bundle.getInt("cflag", 0) == 1)) {
|
||
f.c("openSDK_LOG.QQShare", "shareToQQ, support share");
|
||
c(activity, bundle, iUiListener);
|
||
} else {
|
||
try {
|
||
f.d("openSDK_LOG.QQShare", "shareToQQ, don't support share, will show download dialog");
|
||
new TDialog(activity, "", a(""), null, this.b).show();
|
||
} catch (RuntimeException e) {
|
||
f.b("openSDK_LOG.QQShare", " shareToQQ, TDialog.show not in main thread", e);
|
||
e.printStackTrace();
|
||
iUiListener.onError(new UiError(-6, "没有在主线程调用!", null));
|
||
}
|
||
}
|
||
f.c("openSDK_LOG.QQShare", "shareToQQ() -- end.");
|
||
}
|
||
}
|