fix: 处理 sonar 新变动代码的异味 https://jira.shanqu.cc/browse/GHZS-920
This commit is contained in:
@ -313,47 +313,44 @@ public class MessageShareUtils {
|
||||
}
|
||||
|
||||
public void shareTextFromWeb(Activity activity, String text, String type) {
|
||||
switch (type) {
|
||||
case "qq":
|
||||
Utils.toast(mContext, "分享跳转中...");
|
||||
if (ShareUtils.isQQClientAvailable(activity)) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_SEND);
|
||||
intent.putExtra(Intent.EXTRA_TEXT, text);
|
||||
intent.setType("text/plain");
|
||||
intent.setPackage("com.tencent.mobileqq");
|
||||
intent.setClassName("com.tencent.mobileqq", "com.tencent.mobileqq.activity.JumpActivity");
|
||||
try {
|
||||
activity.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Utils.toast(mContext, "分享失败");
|
||||
}
|
||||
} else {
|
||||
Utils.toast(mContext, "请安装QQ客户端");
|
||||
if ("qq".equals(type)) {
|
||||
Utils.toast(mContext, "分享跳转中...");
|
||||
if (ShareUtils.isQQClientAvailable(activity)) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_SEND);
|
||||
intent.putExtra(Intent.EXTRA_TEXT, text);
|
||||
intent.setType("text/plain");
|
||||
intent.setPackage("com.tencent.mobileqq");
|
||||
intent.setClassName("com.tencent.mobileqq", "com.tencent.mobileqq.activity.JumpActivity");
|
||||
try {
|
||||
activity.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Utils.toast(mContext, "分享失败");
|
||||
}
|
||||
break;
|
||||
case "wechat":
|
||||
Utils.toast(mContext, "分享跳转中...");
|
||||
} else {
|
||||
Utils.toast(mContext, "请安装QQ客户端");
|
||||
}
|
||||
} else if ("wechat".equals(type)) {
|
||||
Utils.toast(mContext, "分享跳转中...");
|
||||
|
||||
if (!mIWXAPI.isWXAppInstalled() && !PermissionHelper.isGetInstalledListPermissionDisabled(mContext)) {
|
||||
Utils.toast(mContext, mContext.getString(R.string.share_no_wechat_hint));
|
||||
return;
|
||||
}
|
||||
if (!mIWXAPI.isWXAppInstalled() && !PermissionHelper.isGetInstalledListPermissionDisabled(mContext)) {
|
||||
Utils.toast(mContext, mContext.getString(R.string.share_no_wechat_hint));
|
||||
return;
|
||||
}
|
||||
|
||||
WXTextObject textObj = new WXTextObject();
|
||||
textObj.text = text;
|
||||
WXTextObject textObj = new WXTextObject();
|
||||
textObj.text = text;
|
||||
|
||||
WXMediaMessage msg = new WXMediaMessage();
|
||||
msg.mediaObject = textObj;
|
||||
msg.description = text;
|
||||
WXMediaMessage msg = new WXMediaMessage();
|
||||
msg.mediaObject = textObj;
|
||||
msg.description = text;
|
||||
|
||||
SendMessageToWX.Req req = new SendMessageToWX.Req();
|
||||
req.transaction = buildTransaction("text");
|
||||
req.message = msg;
|
||||
req.scene = SendMessageToWX.Req.WXSceneSession;
|
||||
SendMessageToWX.Req req = new SendMessageToWX.Req();
|
||||
req.transaction = buildTransaction("text");
|
||||
req.message = msg;
|
||||
req.scene = SendMessageToWX.Req.WXSceneSession;
|
||||
|
||||
mIWXAPI.sendReq(req);
|
||||
break;
|
||||
mIWXAPI.sendReq(req);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user