Bläddra i källkod

修改分享IM图片消息

Pq 1 år sedan
förälder
incheckning
40c7783fc8

+ 10 - 0
chatModule/src/main/java/com/cooleshow/chatmodule/manager/IMCenter.java

@@ -1,6 +1,7 @@
 package com.cooleshow.chatmodule.manager;
 
 import android.content.Context;
+import android.text.TextUtils;
 
 import com.alibaba.android.arouter.launcher.ARouter;
 import com.cooleshow.base.router.RouterPath;
@@ -13,6 +14,7 @@ import com.tencent.imsdk.v2.V2TIMCallback;
 import com.tencent.imsdk.v2.V2TIMConversationListener;
 import com.tencent.imsdk.v2.V2TIMManager;
 import com.tencent.imsdk.v2.V2TIMMessage;
+import com.tencent.imsdk.v2.V2TIMSendCallback;
 import com.tencent.qcloud.tuicore.TUILogin;
 import com.tencent.qcloud.tuicore.interfaces.TUICallback;
 import com.tencent.qcloud.tuicore.interfaces.TUILoginListener;
@@ -154,6 +156,14 @@ public class IMCenter {
         V2TIMManager.getConversationManager().removeConversationListener(unReadMessageObserver);
     }
 
+    public void sendImageMessage(String targetId, boolean isGroup, String imgPath, V2TIMSendCallback<V2TIMMessage> sendCallback) {
+        if (!TextUtils.isEmpty(targetId)) {
+            V2TIMMessage imageMessage = V2TIMManager.getMessageManager().createImageMessage(imgPath);
+            // 发送消息
+            V2TIMManager.getMessageManager().sendMessage(imageMessage, isGroup ? null : targetId, isGroup ? targetId : null, V2TIMMessage.V2TIM_PRIORITY_DEFAULT, false, null, sendCallback);
+        }
+    }
+
     private void goLogin() {
         ARouter.getInstance().build(RouterPath.UserCenter.PATH_VERIFY_LOGIN)
                 .withString(UserConstants.PHONE_NUM_KEY, UserHelper.getUserPhone())

+ 4 - 0
chatModule/src/main/java/com/cooleshow/chatmodule/utils/helper/ChatGroupHelper.java

@@ -140,4 +140,8 @@ public class ChatGroupHelper {
     public static boolean isTeacher(String roleType) {
         return TextUtils.equals(roleType, ROLE_TYPE_TEACHER);
     }
+
+    public static boolean isGroupConversation(int value) {
+        return value == 3;//h5那边过来的conversation类型值等于3为群组
+    }
 }

+ 298 - 0
chatModule/src/main/java/com/cooleshow/chatmodule/utils/helper/IMShareHelper.java

@@ -0,0 +1,298 @@
+package com.cooleshow.chatmodule.utils.helper;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.net.Uri;
+import android.provider.MediaStore;
+import android.text.TextUtils;
+import android.util.Base64;
+import android.util.Log;
+
+import com.cooleshow.base.utils.FileUtils;
+import com.cooleshow.base.utils.MyFileUtils;
+import com.cooleshow.base.utils.ToastUtil;
+import com.cooleshow.base.utils.Utils;
+import com.cooleshow.chatmodule.manager.IMCenter;
+import com.tencent.imsdk.v2.V2TIMMessage;
+import com.tencent.imsdk.v2.V2TIMSendCallback;
+import com.umeng.socialize.ShareAction;
+import com.umeng.socialize.UMShareAPI;
+import com.umeng.socialize.UMShareListener;
+import com.umeng.socialize.bean.SHARE_MEDIA;
+import com.umeng.socialize.media.UMImage;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
+import io.reactivex.rxjava3.core.Observable;
+import io.reactivex.rxjava3.core.ObservableEmitter;
+import io.reactivex.rxjava3.core.ObservableOnSubscribe;
+import io.reactivex.rxjava3.core.Observer;
+import io.reactivex.rxjava3.disposables.Disposable;
+import io.reactivex.rxjava3.schedulers.Schedulers;
+
+/**
+ * Author by pq, Date on 2022/5/31.
+ */
+public class IMShareHelper {
+    public static final String WECHAT_TAG = "wechat";
+    public static final String WECHAT_CIRCLE_TAG = "wechat_circle";
+    public static final String SINA_TAG = "sina";
+    public static final String IMAGE_TAG = "image";
+    public static final String VIDEO_TAG = "video";
+
+    public static void saveImg(Context context, String base64, ResultCallBack resultCallBack) {
+        Observable.create(new ObservableOnSubscribe<File>() {
+            @Override
+            public void subscribe(ObservableEmitter<File> emitter) throws Exception {
+                File file = saveImgToLocalFile(base64);
+                emitter.onNext(file);
+            }
+        }).subscribeOn(Schedulers.newThread())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new Observer<File>() {
+                    @Override
+                    public void onSubscribe(Disposable d) {
+
+                    }
+
+                    @Override
+                    public void onNext(File file) {
+                        if (context != null) {
+                            try {
+                                MediaStore.Images.Media.insertImage(context.getContentResolver(),
+                                        file.getAbsolutePath(), file.getName(), null);
+                                // 最后通知图库更新
+                                context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,
+                                        Uri.fromFile(new File(file.getPath()))));
+                                if (resultCallBack != null) {
+                                    resultCallBack.onResult(true);
+                                }
+                            } catch (FileNotFoundException e) {
+                                ToastUtil.getInstance().show(context, "保存失败");
+                                e.printStackTrace();
+                            }
+                        }
+                    }
+
+                    @Override
+                    public void onError(Throwable e) {
+                        if (resultCallBack != null) {
+                            resultCallBack.onResult(false);
+                        }
+                    }
+
+                    @Override
+                    public void onComplete() {
+
+                    }
+                });
+    }
+
+    public static void shareImgToChatGroup(Bitmap bitmap, String targetId, boolean isGroup, ResultCallBack resultCallBack) {
+        Observable.create(new ObservableOnSubscribe<String>() {
+            @Override
+            public void subscribe(ObservableEmitter<String> emitter) throws Exception {
+                File file = saveImgToLocalFile(bitmap);
+                toShare(file, targetId, isGroup, resultCallBack);
+                emitter.onNext("");
+            }
+        }).subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new Observer<String>() {
+                    @Override
+                    public void onSubscribe(Disposable d) {
+
+                    }
+
+                    @Override
+                    public void onNext(String s) {
+                        if (resultCallBack != null) {
+                            resultCallBack.onResult(true);
+                        }
+                    }
+
+                    @Override
+                    public void onError(Throwable e) {
+                        e.printStackTrace();
+                        if (resultCallBack != null) {
+                            resultCallBack.onResult(false);
+                        }
+                    }
+
+                    @Override
+                    public void onComplete() {
+
+                    }
+                });
+    }
+
+    public static void shareImgToChatGroup(String base64, String targetId, boolean isGroup, ResultCallBack resultCallBack) {
+        Observable.create(new ObservableOnSubscribe<String>() {
+            @Override
+            public void subscribe(ObservableEmitter<String> emitter) throws Exception {
+                File file = saveImgToLocalFile(base64);
+                toShare(file, targetId, isGroup, resultCallBack);
+                emitter.onNext("");
+            }
+        }).subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new Observer<String>() {
+                    @Override
+                    public void onSubscribe(Disposable d) {
+
+                    }
+
+                    @Override
+                    public void onNext(String s) {
+                        if (resultCallBack != null) {
+                            resultCallBack.onResult(true);
+                        }
+                    }
+
+                    @Override
+                    public void onError(Throwable e) {
+                        e.printStackTrace();
+                        if (resultCallBack != null) {
+                            resultCallBack.onResult(false);
+                        }
+                    }
+
+                    @Override
+                    public void onComplete() {
+
+                    }
+                });
+    }
+
+    public static void toShare(File file, String targetId, boolean isGroup, ResultCallBack resultCallBack) {
+        IMCenter.getInstance().sendImageMessage(targetId, isGroup, file.getAbsolutePath(), new V2TIMSendCallback<V2TIMMessage>() {
+            @Override
+            public void onProgress(int i) {
+
+            }
+
+            @Override
+            public void onSuccess(V2TIMMessage v2TIMMessage) {
+                Log.i("pq", "message send success");
+                if (resultCallBack != null) {
+                    resultCallBack.onResult(true);
+                }
+            }
+
+            @Override
+            public void onError(int i, String s) {
+                Log.i("pq", "message send onError:" + i);
+                if (resultCallBack != null) {
+                    resultCallBack.onResult(false);
+                }
+            }
+        });
+    }
+
+    private static File saveImgToLocalFile(String base64) {
+        byte[] bytes;
+        if (base64.startsWith("data:image/png;base64")) {
+            String[] split = base64.split(",");
+            bytes = Base64.decode(split[1], Base64.DEFAULT);
+        } else {
+            bytes = Base64.decode(base64, Base64.DEFAULT);
+        }
+        Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
+        File parentFile = new File(FileUtils.getCacheDir(Utils.getApp()) + File.separator + "share");
+        if (!parentFile.exists()) {
+            parentFile.mkdirs();
+        }
+        String targetFileName = "IMG_" + new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.CHINA).format(new Date()) + ".png";
+        File file = new File(parentFile, targetFileName);
+        FileUtils.saveImageToLocal(bitmap, file.getAbsolutePath());
+        return new File(file.getAbsolutePath());
+    }
+
+    private static File saveImgToLocalFile(Bitmap bitmap) {
+        File parentFile = new File(FileUtils.getCacheDir(Utils.getApp()) + File.separator + "share");
+        if (!parentFile.exists()) {
+            parentFile.mkdirs();
+        }
+        String targetFileName = "IMG_" + new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.CHINA).format(new Date()) + ".png";
+        File file = new File(parentFile, targetFileName);
+        FileUtils.saveImageToLocal(bitmap, file.getAbsolutePath());
+        return new File(file.getAbsolutePath());
+    }
+
+    public static void parseShareContactData(String base64, Intent data) {
+        String targetId = data.getStringExtra("targetId");
+        int conversationValue = data.getIntExtra("conversation", -1);
+        if (!TextUtils.isEmpty(base64)) {
+            //沿用之前的conversation=3为group
+            shareImgToChatGroup(base64, targetId, conversationValue ==3, new ResultCallBack() {
+                @Override
+                public void onResult(boolean isSuccess) {
+                    if (isSuccess) {
+                        ToastUtil.getInstance().showShort("分享成功");
+                    } else {
+                        ToastUtil.getInstance().showShort("分享失败");
+                    }
+                }
+            });
+        }
+    }
+
+    public static void parseShareActivity(Activity activity, JSONObject jsonObject, UMShareListener shareListener) {
+        JSONObject content = null;
+        try {
+            content = jsonObject.getJSONObject("content");
+            String shareTitle = content.getString("title");
+            String shareDesc = content.getString("desc");
+            String type = content.getString("type");
+            String shareType = content.getString("shareType");
+            SHARE_MEDIA share_media = SHARE_MEDIA.WEIXIN;
+            if (TextUtils.equals(shareType, WECHAT_TAG)) {
+                //分享微信
+                share_media = SHARE_MEDIA.WEIXIN;
+            }
+            if (TextUtils.equals(shareType, WECHAT_CIRCLE_TAG)) {
+                //分享朋友圈
+                share_media = SHARE_MEDIA.WEIXIN_CIRCLE;
+            }
+            if (TextUtils.equals(shareType, SINA_TAG)) {
+                //分享新浪微博
+                share_media = SHARE_MEDIA.SINA;
+            }
+            if (!UMShareAPI.get(Utils.getApp()).isInstall(activity, share_media)) {
+                ToastUtil.getInstance().show(Utils.getApp(), "应用未安装,分享失败");
+                return;
+            }
+            if (TextUtils.equals(type, IMAGE_TAG)) {
+                //分享图片
+                String imageData = content.getString("image");
+                UMImage image = new UMImage(activity, MyFileUtils.base64ToBitmap(imageData.split(",")[1]));//bitmap文件
+                image.setThumb(image);
+                image.compressFormat = Bitmap.CompressFormat.PNG;
+                image.compressStyle = UMImage.CompressStyle.SCALE;
+                image.setTitle(shareTitle);
+                image.setDescription(shareDesc);
+                new ShareAction(activity).withMedia(image)
+                        .setPlatform(share_media)
+                        .setCallback(shareListener)
+                        .share();
+            }
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public interface ResultCallBack {
+        void onResult(boolean isSuccess);
+    }
+}

+ 7 - 136
student/src/main/java/com/cooleshow/student/helper/ShareHelper.java

@@ -14,6 +14,8 @@ import android.view.View;
 import com.cooleshow.base.utils.FileUtils;
 import com.cooleshow.base.utils.ToastUtil;
 import com.cooleshow.base.utils.Utils;
+import com.cooleshow.chatmodule.utils.helper.ChatGroupHelper;
+import com.cooleshow.chatmodule.utils.helper.IMShareHelper;
 
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -137,49 +139,17 @@ public class ShareHelper {
                 });
     }
 
-    public static void shareImgToChatGroup(String base64, String targetId, Conversation.ConversationType conversationType, ResultCallBack resultCallBack) {
+    public static void shareImgToChatGroup(String base64, String targetId,boolean isGroup, IMShareHelper.ResultCallBack resultCallBack) {
         Observable.create(new ObservableOnSubscribe<String>() {
             @Override
             public void subscribe(ObservableEmitter<String> emitter) throws Exception {
                 File file = saveImgToLocalFile(base64);
-                Message imageMessage = createImageMessage(file, targetId, conversationType);
-                IMCenter.getInstance().sendMediaMessage(imageMessage, null, null, new IRongCallback.ISendMediaMessageCallback() {
-                    @Override
-                    public void onProgress(Message message, int progress) {
-
-                    }
-
-                    @Override
-                    public void onCanceled(Message message) {
-
-                    }
-
-                    @Override
-                    public void onAttached(Message message) {
-
-                    }
-
-                    @Override
-                    public void onSuccess(Message message) {
-                        Log.i("pq", "message send success");
-                        if (resultCallBack != null) {
-                            resultCallBack.onResult(true);
-                        }
-                    }
-
-                    @Override
-                    public void onError(Message message, RongIMClient.ErrorCode errorCode) {
-                        Log.i("pq", "message send onError:" + errorCode);
-                        if (resultCallBack != null) {
-                            resultCallBack.onResult(false);
-                        }
-                    }
-                });
+                IMShareHelper.toShare(file, targetId, isGroup, resultCallBack);
                 emitter.onNext("");
             }
         }).subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new Observer<String>() {
+        .observeOn(AndroidSchedulers.mainThread())
+        .subscribe(new Observer<String>() {
                     @Override
                     public void onSubscribe(Disposable d) {
 
@@ -187,9 +157,6 @@ public class ShareHelper {
 
                     @Override
                     public void onNext(String s) {
-                        if (resultCallBack != null) {
-                            resultCallBack.onResult(true);
-                        }
                     }
 
                     @Override
@@ -207,80 +174,6 @@ public class ShareHelper {
                 });
     }
 
-    public static void shareImgToChatGroup(File file, String targetId, Conversation.ConversationType conversationType, ResultCallBack resultCallBack) {
-        if (file == null || !file.exists()) {
-            if (resultCallBack != null) {
-                resultCallBack.onResult(false);
-            }
-            return;
-        }
-        Observable.create(new ObservableOnSubscribe<String>() {
-            @Override
-            public void subscribe(ObservableEmitter<String> emitter) throws Exception {
-                Message imageMessage = createImageMessage(file, targetId, conversationType);
-                IMCenter.getInstance().sendMediaMessage(imageMessage, null, null, new IRongCallback.ISendMediaMessageCallback() {
-                    @Override
-                    public void onProgress(Message message, int progress) {
-
-                    }
-
-                    @Override
-                    public void onCanceled(Message message) {
-
-                    }
-
-                    @Override
-                    public void onAttached(Message message) {
-
-                    }
-
-                    @Override
-                    public void onSuccess(Message message) {
-                        Log.i("pq", "message send success");
-                        if (resultCallBack != null) {
-                            resultCallBack.onResult(true);
-                        }
-                    }
-
-                    @Override
-                    public void onError(Message message, RongIMClient.ErrorCode errorCode) {
-                        Log.i("pq", "message send onError:" + errorCode);
-                        if (resultCallBack != null) {
-                            resultCallBack.onResult(false);
-                        }
-                    }
-                });
-                emitter.onNext("");
-            }
-        }).subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new Observer<String>() {
-                    @Override
-                    public void onSubscribe(Disposable d) {
-
-                    }
-
-                    @Override
-                    public void onNext(String s) {
-                        if (resultCallBack != null) {
-                            resultCallBack.onResult(true);
-                        }
-                    }
-
-                    @Override
-                    public void onError(Throwable e) {
-                        e.printStackTrace();
-                        if (resultCallBack != null) {
-                            resultCallBack.onResult(false);
-                        }
-                    }
-
-                    @Override
-                    public void onComplete() {
-
-                    }
-                });
-    }
 
     private static Message createImageMessage(String base64, Conversation conversation) {
         ImageMessage imageMessage = ImageMessage.obtain();
@@ -323,27 +216,7 @@ public class ShareHelper {
         String targetId = data.getStringExtra("targetId");
         int conversationValue = data.getIntExtra("conversation", -1);
         if (!TextUtils.isEmpty(base64)) {
-            Conversation.ConversationType conversationType = OpenChatHelper.getConversationType(conversationValue);
-            shareImgToChatGroup(base64, targetId, conversationType, new ShareHelper.ResultCallBack() {
-                @Override
-                public void onResult(boolean isSuccess) {
-                    if (isSuccess) {
-                        ToastUtil.getInstance().showShort("分享成功");
-                    } else {
-                        ToastUtil.getInstance().showShort("分享失败");
-                    }
-//                    sendCallBack("shareAchievements", "", true);
-                }
-            });
-        }
-    }
-
-    public static void parseShareContactData(File file, Intent data) {
-        String targetId = data.getStringExtra("targetId");
-        int conversationValue = data.getIntExtra("conversation", -1);
-        if (file != null) {
-            Conversation.ConversationType conversationType = OpenChatHelper.getConversationType(conversationValue);
-            shareImgToChatGroup(file, targetId, conversationType, new ShareHelper.ResultCallBack() {
+            shareImgToChatGroup(base64, targetId, ChatGroupHelper.isGroupConversation(conversationValue), new IMShareHelper.ResultCallBack() {
                 @Override
                 public void onResult(boolean isSuccess) {
                     if (isSuccess) {
@@ -351,13 +224,11 @@ public class ShareHelper {
                     } else {
                         ToastUtil.getInstance().showShort("分享失败");
                     }
-//                    sendCallBack("shareAchievements", "", true);
                 }
             });
         }
     }
 
-
     public static Bitmap createBitmapByView(View view) {
         //这种方式只适用于view正在显示的
         view.buildDrawingCache();

+ 5 - 110
teacher/src/main/java/com/cooleshow/teacher/helper/ShareHelper.java

@@ -13,6 +13,8 @@ import android.util.Log;
 import com.cooleshow.base.utils.FileUtils;
 import com.cooleshow.base.utils.ToastUtil;
 import com.cooleshow.base.utils.Utils;
+import com.cooleshow.chatmodule.utils.helper.ChatGroupHelper;
+import com.cooleshow.chatmodule.utils.helper.IMShareHelper;
 
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -88,114 +90,12 @@ public class ShareHelper {
                 });
     }
 
-    public static void shareImgToChatGroup(Bitmap bitmap, String targetId, Conversation.ConversationType conversationType, ResultCallBack resultCallBack) {
-        Observable.create(new ObservableOnSubscribe<String>() {
-            @Override
-            public void subscribe(ObservableEmitter<String> emitter) throws Exception {
-                File file = saveImgToLocalFile(bitmap);
-                Message imageMessage = createImageMessage(file, targetId, conversationType);
-                IMCenter.getInstance().sendMediaMessage(imageMessage, null, null, new IRongCallback.ISendMediaMessageCallback() {
-                    @Override
-                    public void onProgress(Message message, int progress) {
-
-                    }
-
-                    @Override
-                    public void onCanceled(Message message) {
-
-                    }
-
-                    @Override
-                    public void onAttached(Message message) {
-
-                    }
-
-                    @Override
-                    public void onSuccess(Message message) {
-                        Log.i("pq", "message send success");
-                        if (resultCallBack != null) {
-                            resultCallBack.onResult(true);
-                        }
-                    }
-
-                    @Override
-                    public void onError(Message message, RongIMClient.ErrorCode errorCode) {
-                        Log.i("pq", "message send onError:" + errorCode);
-                        if (resultCallBack != null) {
-                            resultCallBack.onResult(false);
-                        }
-                    }
-                });
-                emitter.onNext("");
-            }
-        }).subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new Observer<String>() {
-                    @Override
-                    public void onSubscribe(Disposable d) {
-
-                    }
-
-                    @Override
-                    public void onNext(String s) {
-                        if (resultCallBack != null) {
-                            resultCallBack.onResult(true);
-                        }
-                    }
-
-                    @Override
-                    public void onError(Throwable e) {
-                        e.printStackTrace();
-                        if (resultCallBack != null) {
-                            resultCallBack.onResult(false);
-                        }
-                    }
-
-                    @Override
-                    public void onComplete() {
-
-                    }
-                });
-    }
-
-    public static void shareImgToChatGroup(String base64, String targetId, Conversation.ConversationType conversationType, ResultCallBack resultCallBack) {
+    public static void shareImgToChatGroup(String base64, String targetId, boolean isGroup, IMShareHelper.ResultCallBack resultCallBack) {
         Observable.create(new ObservableOnSubscribe<String>() {
             @Override
             public void subscribe(ObservableEmitter<String> emitter) throws Exception {
                 File file = saveImgToLocalFile(base64);
-                Message imageMessage = createImageMessage(file, targetId, conversationType);
-                IMCenter.getInstance().sendMediaMessage(imageMessage, null, null, new IRongCallback.ISendMediaMessageCallback() {
-                    @Override
-                    public void onProgress(Message message, int progress) {
-
-                    }
-
-                    @Override
-                    public void onCanceled(Message message) {
-
-                    }
-
-                    @Override
-                    public void onAttached(Message message) {
-
-                    }
-
-                    @Override
-                    public void onSuccess(Message message) {
-                        Log.i("pq", "message send success");
-                        if (resultCallBack != null) {
-                            resultCallBack.onResult(true);
-                        }
-                    }
-
-                    @Override
-                    public void onError(Message message, RongIMClient.ErrorCode errorCode) {
-                        Log.i("pq", "message send onError:" + errorCode);
-                        if (resultCallBack != null) {
-                            resultCallBack.onResult(false);
-                        }
-                    }
-                });
+                IMShareHelper.toShare(file, targetId, isGroup, resultCallBack);
                 emitter.onNext("");
             }
         }).subscribeOn(Schedulers.io())
@@ -208,9 +108,6 @@ public class ShareHelper {
 
                     @Override
                     public void onNext(String s) {
-                        if (resultCallBack != null) {
-                            resultCallBack.onResult(true);
-                        }
                     }
 
                     @Override
@@ -282,8 +179,7 @@ public class ShareHelper {
         String targetId = data.getStringExtra("targetId");
         int conversationValue = data.getIntExtra("conversation", -1);
         if (!TextUtils.isEmpty(base64)) {
-            Conversation.ConversationType conversationType = OpenChatHelper.getConversationType(conversationValue);
-            shareImgToChatGroup(base64, targetId, conversationType, new ShareHelper.ResultCallBack() {
+            shareImgToChatGroup(base64, targetId, ChatGroupHelper.isGroupConversation(conversationValue), new IMShareHelper.ResultCallBack() {
                 @Override
                 public void onResult(boolean isSuccess) {
                     if (isSuccess) {
@@ -291,7 +187,6 @@ public class ShareHelper {
                     } else {
                         ToastUtil.getInstance().showShort("分享失败");
                     }
-//                    sendCallBack("shareAchievements", "", true);
                 }
             });
         }