diff --git a/android/build.gradle b/android/build.gradle index 2feb142..6f8a904 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -51,5 +51,5 @@ android { } } dependencies { - implementation 'io.openim:client-sdk:1.1.5@aar' + implementation 'io.openim:client-sdk:1.1.9@aar' } \ No newline at end of file diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/FlutterOpenimSdkPlugin.java b/android/src/main/java/io/openim/flutter_openim_sdk/FlutterOpenimSdkPlugin.java index 4bc81fd..7e7b30f 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/FlutterOpenimSdkPlugin.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/FlutterOpenimSdkPlugin.java @@ -5,7 +5,6 @@ import android.content.Context; import androidx.annotation.NonNull; import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import io.flutter.Log; @@ -19,7 +18,6 @@ import io.openim.flutter_openim_sdk.manager.FriendshipManager; import io.openim.flutter_openim_sdk.manager.GroupManager; import io.openim.flutter_openim_sdk.manager.IMManager; import io.openim.flutter_openim_sdk.manager.MessageManager; -import io.openim.flutter_openim_sdk.util.CommonUtil; /** @@ -68,18 +66,12 @@ public class FlutterOpenimSdkPlugin implements FlutterPlugin, MethodCallHandler void parse(@NonNull MethodCall call, @NonNull Result result) { try { - String managerName = CommonUtil.getParamValue(call, "ManagerName"); + String managerName = call.argument("ManagerName"); Field field = FlutterOpenimSdkPlugin.class.getDeclaredField(managerName); Method method = field.get(new Object()).getClass().getDeclaredMethod(call.method, MethodCall.class, Result.class); Log.i("F-OpenIMSDK(flutter call native)", "{ class:" + managerName + ", method:" + method.getName() + " }"); method.invoke(field.get(new Object()), call, result); - } catch (NoSuchFieldException e) { - e.printStackTrace(); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { + } catch (Exception e) { e.printStackTrace(); } } diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/listener/MsgSendProgressListener.java b/android/src/main/java/io/openim/flutter_openim_sdk/listener/MsgSendProgressListener.java index 3998880..c873b82 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/listener/MsgSendProgressListener.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/listener/MsgSendProgressListener.java @@ -11,11 +11,14 @@ import open_im_sdk.SendMsgCallBack; public class MsgSendProgressListener implements SendMsgCallBack { final private MethodChannel.Result result; - final private MethodCall call; +// final private MethodCall call; + final private Object clientMsgID; public MsgSendProgressListener(MethodChannel.Result result, MethodCall call) { this.result = result; - this.call = call; +// this.call = call; + Map<String, Object> args = call.argument("message"); + this.clientMsgID = args.get("clientMsgID"); } @Override @@ -26,7 +29,7 @@ public class MsgSendProgressListener implements SendMsgCallBack { @Override public void onProgress(long l) { final Map<String, Object> values = new ArrayMap<>(); - values.put("clientMsgID", CommonUtil.getSendMessageClientMsgID(call)); + values.put("clientMsgID", clientMsgID); values.put("progress", l); CommonUtil.emitEvent("msgSendProgressListener", "onProgress", values); } diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/BaseManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/BaseManager.java new file mode 100644 index 0000000..3142c3b --- /dev/null +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/BaseManager.java @@ -0,0 +1,24 @@ +package io.openim.flutter_openim_sdk.manager; + +import io.flutter.plugin.common.MethodCall; +import io.openim.flutter_openim_sdk.util.JsonUtil; + +class BaseManager { + + static String jsonValue(MethodCall methodCall, String key) { + return JsonUtil.toString(methodCall.argument(key)); + } + + static String jsonValue(MethodCall methodCall) { + return JsonUtil.toString(methodCall.arguments); + } + + static <T> T value(MethodCall methodCall, String key) { + return methodCall.argument(key); + } + + static Long int2long(MethodCall methodCall, String key) { + Integer i = value(methodCall, key); + return Long.valueOf(i); + } +} diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/ConversationManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/ConversationManager.java index 0636d2c..294393d 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/manager/ConversationManager.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/ConversationManager.java @@ -7,7 +7,7 @@ import io.openim.flutter_openim_sdk.listener.ConversationListener; import io.openim.flutter_openim_sdk.util.CommonUtil; import open_im_sdk.Open_im_sdk; -public class ConversationManager { +public class ConversationManager extends BaseManager { public void setConversationListener(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.setConversationListener(new ConversationListener()); @@ -19,41 +19,47 @@ public class ConversationManager { public void getOneConversation(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.getOneConversation( - CommonUtil.getConversationSourceId(methodCall), - CommonUtil.getConversationSessionType(methodCall), + value(methodCall, "sourceID"), + int2long(methodCall, "sessionType"), new BaseListener(result)); } public void getMultipleConversation(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.getMultipleConversation( - CommonUtil.getConversationIds(methodCall), + jsonValue(methodCall, "conversationIDList"), new BaseListener(result)); } public void deleteConversation(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.deleteConversation(CommonUtil.getConversationId(methodCall), new BaseListener(result)); + Open_im_sdk.deleteConversation( + value(methodCall, "conversationID"), + new BaseListener(result)); } public void setConversationDraft(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.setConversationDraft( - CommonUtil.getConversationId(methodCall), - CommonUtil.getConversationDraft(methodCall), + value(methodCall, "conversationID"), + value(methodCall, "draftText"), new BaseListener(result)); } public void pinConversation(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.pinConversation( - CommonUtil.getConversationId(methodCall), - CommonUtil.isPinnedConversation(methodCall), + value(methodCall, "conversationID"), + value(methodCall, "isPinned"), new BaseListener(result)); } public void markSingleMessageHasRead(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.markSingleMessageHasRead(new BaseListener(result), CommonUtil.getSingleMessageUserid(methodCall)); + Open_im_sdk.markSingleMessageHasRead( + new BaseListener(result), + value(methodCall, "userID")); } public void markGroupMessageHasRead(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.markGroupMessageHasRead(new BaseListener(result), CommonUtil.getGroupMessageGroupid(methodCall)); + Open_im_sdk.markGroupMessageHasRead( + new BaseListener(result), + value(methodCall, "groupID")); } public void getTotalUnreadMsgCount(MethodCall methodCall, MethodChannel.Result result) { @@ -61,9 +67,8 @@ public class ConversationManager { } public void getConversationIDBySessionType(MethodCall methodCall, MethodChannel.Result result) { - CommonUtil.runMainThreadReturn(result, - Open_im_sdk.getConversationIDBySessionType(CommonUtil.getConversationSourceId(methodCall), - CommonUtil.getConversationSessionType(methodCall))); + CommonUtil.runMainThreadReturn(result, Open_im_sdk.getConversationIDBySessionType( + value(methodCall, "sourceID"), + int2long(methodCall, "sessionType"))); } - } diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/FriendshipManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/FriendshipManager.java index 27d7604..c0ff9cc 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/manager/FriendshipManager.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/FriendshipManager.java @@ -4,10 +4,9 @@ import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; import io.openim.flutter_openim_sdk.listener.BaseListener; import io.openim.flutter_openim_sdk.listener.FriendshipListener; -import io.openim.flutter_openim_sdk.util.CommonUtil; import open_im_sdk.Open_im_sdk; -public class FriendshipManager { +public class FriendshipManager extends BaseManager { public void setFriendListener(MethodCall methodCall, MethodChannel.Result result) { @@ -15,11 +14,13 @@ public class FriendshipManager { } public void getFriendsInfo(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.getFriendsInfo(new BaseListener(result), CommonUtil.getUidList(methodCall)); + Open_im_sdk.getFriendsInfo(new BaseListener(result), + jsonValue(methodCall, "uidList")); } public void addFriend(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.addFriend(new BaseListener(result), CommonUtil.getSDKJsonParam(methodCall)); + Open_im_sdk.addFriend(new BaseListener(result), + jsonValue(methodCall)); } public void getFriendApplicationList(MethodCall methodCall, MethodChannel.Result result) { @@ -31,11 +32,13 @@ public class FriendshipManager { } public void setFriendInfo(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.setFriendInfo(CommonUtil.getSDKJsonParam(methodCall), new BaseListener(result)); + Open_im_sdk.setFriendInfo( + jsonValue(methodCall), new BaseListener(result)); } public void addToBlackList(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.addToBlackList(new BaseListener(result), CommonUtil.getJsonUid(methodCall)); + Open_im_sdk.addToBlackList(new BaseListener(result), + jsonValue(methodCall, "uid")); } public void getBlackList(MethodCall methodCall, MethodChannel.Result result) { @@ -43,23 +46,28 @@ public class FriendshipManager { } public void deleteFromBlackList(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.deleteFromBlackList(new BaseListener(result), CommonUtil.getJsonUid(methodCall)); + Open_im_sdk.deleteFromBlackList(new BaseListener(result), + jsonValue(methodCall, "uid")); } public void checkFriend(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.checkFriend(new BaseListener(result), CommonUtil.getUidList(methodCall)); + Open_im_sdk.checkFriend(new BaseListener(result), + jsonValue(methodCall, "uidList")); } public void deleteFromFriendList(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.deleteFromFriendList(CommonUtil.getJsonUid(methodCall), new BaseListener(result)); + Open_im_sdk.deleteFromFriendList( + jsonValue(methodCall, "uid"), new BaseListener(result)); } public void acceptFriendApplication(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.acceptFriendApplication(new BaseListener(result), CommonUtil.getJsonUid(methodCall)); + Open_im_sdk.acceptFriendApplication(new BaseListener(result), + jsonValue(methodCall, "uid")); } public void refuseFriendApplication(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.refuseFriendApplication(new BaseListener(result), CommonUtil.getJsonUid(methodCall)); + Open_im_sdk.refuseFriendApplication(new BaseListener(result), + jsonValue(methodCall, "uid")); } // public void forceSyncFriendApplication(MethodCall methodCall, MethodChannel.Result result) { diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/GroupManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/GroupManager.java index 4f61299..f24952a 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/manager/GroupManager.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/GroupManager.java @@ -4,10 +4,9 @@ import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; import io.openim.flutter_openim_sdk.listener.BaseListener; import io.openim.flutter_openim_sdk.listener.GroupListener; -import io.openim.flutter_openim_sdk.util.CommonUtil; import open_im_sdk.Open_im_sdk; -public class GroupManager { +public class GroupManager extends BaseManager { public void setGroupListener(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.setGroupListener(new GroupListener()); @@ -15,32 +14,32 @@ public class GroupManager { public void inviteUserToGroup(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.inviteUserToGroup( - CommonUtil.getGid(methodCall), - CommonUtil.getGroupOpReason(methodCall), - CommonUtil.getUidList(methodCall), + value(methodCall, "gid"), + value(methodCall, "reason"), + jsonValue(methodCall, "uidList"), new BaseListener(result)); } public void kickGroupMember(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.kickGroupMember( - CommonUtil.getGid(methodCall), - CommonUtil.getGroupOpReason(methodCall), - CommonUtil.getUidList(methodCall), + value(methodCall, "gid"), + value(methodCall, "reason"), + jsonValue(methodCall, "uidList"), new BaseListener(result)); } public void getGroupMembersInfo(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.getGroupMembersInfo( - CommonUtil.getGid(methodCall), - CommonUtil.getUidList(methodCall), + value(methodCall, "gid"), + jsonValue(methodCall, "uidList"), new BaseListener(result)); } public void getGroupMemberList(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.getGroupMemberList( - CommonUtil.getGid(methodCall), - CommonUtil.getGroupListFilter(methodCall), - CommonUtil.getGroupListNext(methodCall), + value(methodCall, "gid"), + value(methodCall, "filter"), + value(methodCall, "next"), new BaseListener(result)); } @@ -51,40 +50,36 @@ public class GroupManager { public void createGroup(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.createGroup( - CommonUtil.getGroupInfo(methodCall), - CommonUtil.getGroupMemberRoleList(methodCall), + jsonValue(methodCall, "gInfo"), + jsonValue(methodCall, "memberList"), new BaseListener(result)); } public void setGroupInfo(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.setGroupInfo( - CommonUtil.getGroupInfo(methodCall), - new BaseListener(result)); + Open_im_sdk.setGroupInfo(jsonValue(methodCall, "gInfo"), new BaseListener(result)); } public void getGroupsInfo(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.getGroupsInfo( - CommonUtil.getGidList(methodCall), - new BaseListener(result)); + Open_im_sdk.getGroupsInfo(jsonValue(methodCall, "gidList"), new BaseListener(result)); } public void joinGroup(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.joinGroup( - CommonUtil.getGid(methodCall), - CommonUtil.getGroupOpReason(methodCall), + value(methodCall, "gid"), + value(methodCall, "reason"), new BaseListener(result)); } public void quitGroup(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.quitGroup( - CommonUtil.getGid(methodCall), + value(methodCall, "gid"), new BaseListener(result)); } public void transferGroupOwner(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.transferGroupOwner( - CommonUtil.getGid(methodCall), - CommonUtil.getUid(methodCall), + value(methodCall, "gid"), + value(methodCall, "uid"), new BaseListener(result)); } @@ -94,16 +89,16 @@ public class GroupManager { public void acceptGroupApplication(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.acceptGroupApplication( - CommonUtil.getGroupApplicationInfo(methodCall), - CommonUtil.getGroupOpReason(methodCall), + jsonValue(methodCall, "application"), + value(methodCall, "reason"), new BaseListener(result)); } public void refuseGroupApplication(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.refuseGroupApplication( - CommonUtil.getGroupApplicationInfo(methodCall), - CommonUtil.getGroupOpReason(methodCall), + jsonValue(methodCall, "application"), + value(methodCall, "reason"), new BaseListener(result)); } diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/IMManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/IMManager.java index f277762..ccb41bf 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/manager/IMManager.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/IMManager.java @@ -7,15 +7,18 @@ import io.openim.flutter_openim_sdk.listener.SDKListener; import io.openim.flutter_openim_sdk.util.CommonUtil; import open_im_sdk.Open_im_sdk; -public class IMManager { +public class IMManager extends BaseManager { public void initSDK(MethodCall methodCall, MethodChannel.Result result) { - CommonUtil.runMainThreadReturn(result, Open_im_sdk.initSDK(CommonUtil.getSDKJsonParam(methodCall), new SDKListener())); + CommonUtil.runMainThreadReturn(result, Open_im_sdk.initSDK( + jsonValue(methodCall), new SDKListener())); // CommonUtil.runMainThreadReturn(result, null); } public void login(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.login(CommonUtil.getUid(methodCall), CommonUtil.getToken(methodCall), new BaseListener(result)); + Open_im_sdk.login( + value(methodCall, "uid"), + value(methodCall, "token"), new BaseListener(result)); } public void logout(MethodCall methodCall, MethodChannel.Result result) { @@ -31,11 +34,13 @@ public class IMManager { // } public void getUsersInfo(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.getUsersInfo(CommonUtil.getUidList(methodCall), new BaseListener(result)); + Open_im_sdk.getUsersInfo( + jsonValue(methodCall, "uidList"), new BaseListener(result)); } public void setSelfInfo(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.setSelfInfo(CommonUtil.getSDKJsonParam(methodCall), new BaseListener(result)); + Open_im_sdk.setSelfInfo( + jsonValue(methodCall), new BaseListener(result)); } public void forceSyncLoginUerInfo(MethodCall methodCall, MethodChannel.Result result) { @@ -47,6 +52,6 @@ public class IMManager { // } public void setSdkLog(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.setSdkLog(CommonUtil.getSDKLog(methodCall)); + Open_im_sdk.setSdkLog(value(methodCall, "sdkLog")); } } diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/MessageManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/MessageManager.java index 9544a82..3992d22 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/manager/MessageManager.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/MessageManager.java @@ -13,7 +13,7 @@ import open_im_sdk.OnAdvancedMsgListener; import open_im_sdk.Open_im_sdk; -public class MessageManager { +public class MessageManager extends BaseManager { private final static String KEY_ID = "id"; // private final static Map<String, OnAdvancedMsgListener> listeners = new HashMap<>(); private static boolean initializedListener = false; @@ -81,22 +81,22 @@ public class MessageManager { public void sendMessage(MethodCall methodCall, MethodChannel.Result result) { MsgSendProgressListener listener = new MsgSendProgressListener(result, methodCall); Open_im_sdk.sendMessage(listener, - CommonUtil.getSendMessageContent(methodCall), - CommonUtil.getSendMessageReceiver(methodCall), - CommonUtil.geSendMessageGroupId(methodCall), - CommonUtil.getSendMessageOnlineOnly(methodCall)); + jsonValue(methodCall, "message"), + value(methodCall, "receiver"), + value(methodCall, "groupID"), + value(methodCall, "onlineUserOnly")); } public void getHistoryMessageList(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.getHistoryMessageList(new BaseListener(result), CommonUtil.getSDKJsonParam(methodCall)); + Open_im_sdk.getHistoryMessageList(new BaseListener(result), jsonValue(methodCall)); } public void revokeMessage(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.revokeMessage(new BaseListener(result), CommonUtil.getSDKJsonParam(methodCall)); + Open_im_sdk.revokeMessage(new BaseListener(result), jsonValue(methodCall)); } public void deleteMessageFromLocalStorage(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.deleteMessageFromLocalStorage(new BaseListener(result), CommonUtil.getSDKJsonParam(methodCall)); + Open_im_sdk.deleteMessageFromLocalStorage(new BaseListener(result), jsonValue(methodCall)); } public void deleteMessages(MethodCall methodCall, MethodChannel.Result result) { @@ -105,141 +105,151 @@ public class MessageManager { public void insertSingleMessageToLocalStorage(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.insertSingleMessageToLocalStorage(new BaseListener(result), - CommonUtil.getSingleMessageContent(methodCall), - CommonUtil.getSingleMessageUserid(methodCall), - CommonUtil.getSingleMessageSender(methodCall)); + jsonValue(methodCall, "message"), + value(methodCall, "userID"), + value(methodCall, "sender")); } public void findMessages(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.findMessages(new BaseListener(result), CommonUtil.getMessageIdList(methodCall)); + Open_im_sdk.findMessages(new BaseListener(result), jsonValue(methodCall, "messageIDList")); } public void markC2CMessageAsRead(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.markC2CMessageAsRead(new BaseListener(result), - CommonUtil.getSingleMessageUserid(methodCall), - CommonUtil.getMessageIdList(methodCall)); + value(methodCall, "userID"), + jsonValue(methodCall, "messageIDList")); } public void typingStatusUpdate(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.typingStatusUpdate(CommonUtil.getSingleMessageUserid(methodCall), - CommonUtil.getSingleMessageTyping(methodCall)); + Open_im_sdk.typingStatusUpdate(value(methodCall, "userID"), + value(methodCall, "typing")); } public void createTextMessage(MethodCall methodCall, MethodChannel.Result result) { CommonUtil.runMainThreadReturn(result, Open_im_sdk.createTextMessage( - CommonUtil.getMessageText(methodCall))); + value(methodCall, "text"))); } public void createTextAtMessage(MethodCall methodCall, MethodChannel.Result result) { CommonUtil.runMainThreadReturn(result, Open_im_sdk.createTextAtMessage( - CommonUtil.getMessageText(methodCall), - CommonUtil.getAtUserList(methodCall))); + value(methodCall, "text"), + jsonValue(methodCall, "atUserList"))); } public void createImageMessage(MethodCall methodCall, MethodChannel.Result result) { CommonUtil.runMainThreadReturn(result, Open_im_sdk.createImageMessage( - CommonUtil.getImagePath(methodCall))); + value(methodCall, "imagePath"))); } public void createImageMessageFromFullPath(MethodCall methodCall, MethodChannel.Result result) { CommonUtil.runMainThreadReturn(result, Open_im_sdk.createImageMessageFromFullPath( - CommonUtil.getImagePath(methodCall))); + value(methodCall, "imagePath"))); } public void createSoundMessage(MethodCall methodCall, MethodChannel.Result result) { CommonUtil.runMainThreadReturn(result, Open_im_sdk.createSoundMessage( - CommonUtil.getSoundPath(methodCall), - CommonUtil.getSoundDuration(methodCall))); + value(methodCall, "soundPath"), + int2long(methodCall, "duration"))); } public void createSoundMessageFromFullPath(MethodCall methodCall, MethodChannel.Result result) { CommonUtil.runMainThreadReturn(result, Open_im_sdk.createSoundMessageFromFullPath( - CommonUtil.getSoundPath(methodCall), - CommonUtil.getSoundDuration(methodCall))); + value(methodCall, "soundPath"), + int2long(methodCall, "duration"))); } public void createVideoMessage(MethodCall methodCall, MethodChannel.Result result) { CommonUtil.runMainThreadReturn(result, Open_im_sdk.createVideoMessage( - CommonUtil.getVideoPath(methodCall), - CommonUtil.getVideoType(methodCall), - CommonUtil.getVideoDuration(methodCall), - CommonUtil.getVideoSnapshotPath(methodCall))); + value(methodCall, "videoPath"), + value(methodCall, "videoType"), + int2long(methodCall, "duration"), + value(methodCall, "snapshotPath"))); } public void createVideoMessageFromFullPath(MethodCall methodCall, MethodChannel.Result result) { CommonUtil.runMainThreadReturn(result, Open_im_sdk.createVideoMessageFromFullPath( - CommonUtil.getVideoPath(methodCall), - CommonUtil.getVideoType(methodCall), - CommonUtil.getVideoDuration(methodCall), - CommonUtil.getVideoSnapshotPath(methodCall))); + value(methodCall, "videoPath"), + value(methodCall, "videoType"), + int2long(methodCall, "duration"), + value(methodCall, "snapshotPath"))); } public void createFileMessage(MethodCall methodCall, MethodChannel.Result result) { CommonUtil.runMainThreadReturn(result, Open_im_sdk.createFileMessage( - CommonUtil.getFilePath(methodCall), - CommonUtil.getFileName(methodCall))); + value(methodCall, "filePath"), + value(methodCall, "fileName"))); } public void createFileMessageFromFullPath(MethodCall methodCall, MethodChannel.Result result) { CommonUtil.runMainThreadReturn(result, Open_im_sdk.createFileMessageFromFullPath( - CommonUtil.getFilePath(methodCall), - CommonUtil.getFileName(methodCall))); + value(methodCall, "filePath"), + value(methodCall, "fileName"))); } public void createMergerMessage(MethodCall methodCall, MethodChannel.Result result) { CommonUtil.runMainThreadReturn(result, Open_im_sdk.createMergerMessage( - CommonUtil.getMergerMessageList(methodCall), - CommonUtil.getMergerMessageTitle(methodCall), - CommonUtil.getSummaryList(methodCall))); + jsonValue(methodCall, "messageList"), + value(methodCall, "title"), + jsonValue(methodCall, "summaryList"))); } public void createForwardMessage(MethodCall methodCall, MethodChannel.Result result) { CommonUtil.runMainThreadReturn(result, Open_im_sdk.createForwardMessage( - CommonUtil.getForwardMessage(methodCall))); + jsonValue(methodCall, "message"))); } public void createLocationMessage(MethodCall methodCall, MethodChannel.Result result) { CommonUtil.runMainThreadReturn(result, Open_im_sdk.createLocationMessage( - CommonUtil.getMessageDes(methodCall), - CommonUtil.getLocationLongitude(methodCall), - CommonUtil.getLocationLatitude(methodCall) + value(methodCall, "description"), + value(methodCall, "longitude"), + value(methodCall, "latitude") )); } public void createCustomMessage(MethodCall methodCall, MethodChannel.Result result) { CommonUtil.runMainThreadReturn(result, Open_im_sdk.createCustomMessage( - CommonUtil.getCustomMessageData(methodCall), - CommonUtil.getCustomMessageExt(methodCall), - CommonUtil.getMessageDes(methodCall) + value(methodCall, "data"), + value(methodCall, "extension"), + value(methodCall, "description") )); } public void createQuoteMessage(MethodCall methodCall, MethodChannel.Result result) { CommonUtil.runMainThreadReturn(result, Open_im_sdk.createQuoteMessage( - CommonUtil.getQuoteMessageText(methodCall), - CommonUtil.getQuoteMessageBody(methodCall) + value(methodCall, "quoteText"), + jsonValue(methodCall, "quoteMessage") )); } public void createCardMessage(MethodCall methodCall, MethodChannel.Result result) { CommonUtil.runMainThreadReturn(result, Open_im_sdk.createCardMessage( - CommonUtil.getCardMessage(methodCall) + jsonValue(methodCall, "cardMessage") )); } public void forceSyncMsg(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.forceSyncMsg(); } + + public void clearC2CHistoryMessage(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.clearC2CHistoryMessage(new BaseListener(result), + value(methodCall, "userID")); + } + + public void clearGroupHistoryMessage(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.clearGroupHistoryMessage(new BaseListener(result), + value(methodCall, "groupID")); + } } diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/util/CommonUtil.java b/android/src/main/java/io/openim/flutter_openim_sdk/util/CommonUtil.java index a142c98..325362f 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/util/CommonUtil.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/util/CommonUtil.java @@ -8,7 +8,6 @@ import androidx.collection.ArrayMap; import java.util.Map; import io.flutter.Log; -import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; import io.openim.flutter_openim_sdk.FlutterOpenimSdkPlugin; @@ -16,18 +15,6 @@ import io.openim.flutter_openim_sdk.FlutterOpenimSdkPlugin; public class CommonUtil { private final static Handler MAIN_HANDLER = new Handler(Looper.getMainLooper()); - public static <T> T getParamValue(MethodCall methodCall, String param) { - return methodCall.argument(param); - } - - public static String getSDKJsonParam(MethodCall methodCall, String key) { - return JsonUtil.toString(methodCall.argument(key)); - } - - public static String getSDKJsonParam(MethodCall methodCall) { - return JsonUtil.toString(methodCall.arguments); - } - public static void runMainThreadReturn(final MethodChannel.Result result, final Object param) { MAIN_HANDLER.post(() -> result.success(param)); } @@ -68,288 +55,4 @@ public class CommonUtil { public static <T> void emitEvent(String method, String type, T data) { emitEvent(method, type, null, null, data); } - - - /////////////////////////////////////// - ////////////////////////////////////// - public static String getUid(MethodCall methodCall) { - return getParamValue(methodCall, KEY_UID); - } - - public static String getJsonUid(MethodCall methodCall) { - return getSDKJsonParam(methodCall, KEY_UID); - } - - public static String getToken(MethodCall methodCall) { - return getParamValue(methodCall, KEY_TOKEN); - } - - public static String getUidList(MethodCall methodCall) { - return getSDKJsonParam(methodCall, KEY_USER_IDS); - } - - public static String getMessageText(MethodCall methodCall) { - return getParamValue(methodCall, KEY_TEXT); - } - - public static String getAtUserList(MethodCall methodCall) { - return getSDKJsonParam(methodCall, KEY_AT_USER_LIST); - } - - public static String getImagePath(MethodCall methodCall) { - return getParamValue(methodCall, KEY_IMAGE_PATH); - } - - public static String getSoundPath(MethodCall methodCall) { - return getParamValue(methodCall, KEY_SOUND_PATH); - } - - public static long getSoundDuration(MethodCall methodCall) { - Integer i = getParamValue(methodCall, KEY_SOUND_DURATION); - return Long.valueOf(i); - } - - public static String getVideoPath(MethodCall methodCall) { - return getParamValue(methodCall, KEY_VIDEO_PATH); - } - - public static String getVideoType(MethodCall methodCall) { - return getParamValue(methodCall, KEY_VIDEO_TYPE); - } - - public static long getVideoDuration(MethodCall methodCall) { - Integer i = getParamValue(methodCall, KEY_VIDEO_DURATION); - return Long.valueOf(i); - } - - public static String getVideoSnapshotPath(MethodCall methodCall) { - return getParamValue(methodCall, KEY_VIDEO_SNAPSHOT_PATH); - } - - public static String getFilePath(MethodCall methodCall) { - return getParamValue(methodCall, KEY_FILE_PATH); - } - - public static String getFileName(MethodCall methodCall) { - return getParamValue(methodCall, KEY_FILE_NAME); - } - - public static String getMergerMessageList(MethodCall methodCall) { - return getSDKJsonParam(methodCall, KEY_MERGER_MESSAGE_LIST); - } - - public static String getMergerMessageTitle(MethodCall methodCall) { - return getParamValue(methodCall, KEY_MERGER_MESSAGE_TITLE); - } - - public static String getSummaryList(MethodCall methodCall) { - return getSDKJsonParam(methodCall, KEY_SUMMARY_LIST); - } - - public static String getForwardMessage(MethodCall methodCall) { - return getSDKJsonParam(methodCall, KEY_FORWARD_MESSAGE); - } - - public static String getSendMessageContent(MethodCall methodCall) { - return getSDKJsonParam(methodCall, KEY_SEND_MESSAGE_CONTENT); - } - - public static Object getSendMessageClientMsgID(MethodCall methodCall) { - Map<String, Object> map = getParamValue(methodCall, KEY_SEND_MESSAGE_CONTENT); - return map.get(KEY_SEND_MESSAGE_CONTENT_CLIENT_ID); - } - - public static String getSendMessageReceiver(MethodCall methodCall) { - return getParamValue(methodCall, KEY_SEND_MESSAGE_RECEIVER); - } - - public static String geSendMessageGroupId(MethodCall methodCall) { - return getParamValue(methodCall, KEY_SEND_MESSAGE_GROUP_ID); - } - - public static boolean getSendMessageOnlineOnly(MethodCall methodCall) { - return getParamValue(methodCall, KEY_SEND_MESSAGE_ONLINE_ONLY); - } - - public static String getSingleMessageContent(MethodCall methodCall) { - return getParamValue(methodCall, KEY_SINGLE_MESSAGE_CONTENT); - } - - public static String getSingleMessageUserid(MethodCall methodCall) { - return getParamValue(methodCall, KEY_SINGLE_MESSAGE_USERID); - } - - public static String getGroupMessageGroupid(MethodCall methodCall) { - return getParamValue(methodCall, KEY_GROUP_MESSAGE_GROUPID); - } - - public static String getSingleMessageSender(MethodCall methodCall) { - return getParamValue(methodCall, KEY_SINGLE_MESSAGE_SENDER); - } - - public static String getSingleMessageTyping(MethodCall methodCall) { - return getParamValue(methodCall, KEY_SINGLE_MESSAGE_TYPING); - } - - public static String getMessageIdList(MethodCall methodCall) { - return getSDKJsonParam(methodCall, KEY_FIND_MESSAGE_IDS); - } - - public static String getConversationId(MethodCall methodCall) { - return getParamValue(methodCall, KEY_CONVERSATION_ID); - } - - public static String getConversationIds(MethodCall methodCall) { - return getSDKJsonParam(methodCall, KEY_CONVERSATION_IDS); - } - - public static String getConversationSourceId(MethodCall methodCall) { - return getParamValue(methodCall, KEY_CONVERSATION_SOURCE_ID); - } - - public static int getConversationSessionType(MethodCall methodCall) { - return getParamValue(methodCall, KEY_CONVERSATION_SESSION_TYPE); - } - - public static String getConversationDraft(MethodCall methodCall) { - return getParamValue(methodCall, KEY_CONVERSATION_DRAFT); - } - - public static boolean isPinnedConversation(MethodCall methodCall) { - return getParamValue(methodCall, KEY_CONVERSATION_PINNED); - } - - public static String getGid(MethodCall methodCall) { - return getParamValue(methodCall, KEY_GROUP_ID); - } - - public static String getGidList(MethodCall methodCall) { - return getSDKJsonParam(methodCall, KEY_GROUP_IDS); - } - - public static String getGroupOpReason(MethodCall methodCall) { - return getParamValue(methodCall, KEY_GROUP_OP_REASON); - } - - public static int getGroupListFilter(MethodCall methodCall) { - return getParamValue(methodCall, KEY_GROUP_LIST_FILTER); - } - - public static int getGroupListNext(MethodCall methodCall) { - return getParamValue(methodCall, KEY_GROUP_LIST_NEXT); - } - - public static String getGroupInfo(MethodCall methodCall) { - return getSDKJsonParam(methodCall, KEY_GROUP_INFO); - } - - public static String getGroupMemberRoleList(MethodCall methodCall) { - return getSDKJsonParam(methodCall, KEY_GROUP_MEMBER_ROLE_LIST); - } - - public static String getGroupApplicationInfo(MethodCall methodCall) { - return getSDKJsonParam(methodCall, KEY_GROUP_APPLICATION_INFO); - } - - - public static double getLocationLatitude(MethodCall methodCall) { - return getParamValue(methodCall, KEY_LOCATION_MESSAGE_LA); - } - - public static double getLocationLongitude(MethodCall methodCall) { - return getParamValue(methodCall, KEY_LOCATION_MESSAGE_LO); - } - - public static String getMessageDes(MethodCall methodCall) { - return getParamValue(methodCall, KEY_MESSAGE_DES); - } - - public static String getCustomMessageData(MethodCall methodCall) { - return getParamValue(methodCall, KEY_CUSTOM_MESSAGE_DATA); - } - - public static String getCustomMessageExt(MethodCall methodCall) { - return getParamValue(methodCall, KEY_CUSTOM_MESSAGE_EXT); - } - - public static String getQuoteMessageText(MethodCall methodCall) { - return getParamValue(methodCall, KEY_QUOTE_MESSAGE_TEXT); - } - - public static String getQuoteMessageBody(MethodCall methodCall) { - return getSDKJsonParam(methodCall, KEY_QUOTE_MESSAGE_BODY); - } - - public static String getCardMessage(MethodCall methodCall) { - return getSDKJsonParam(methodCall, KEY_CARD_MESSAGE); - } - - public static int getSDKLog(MethodCall methodCall) { - return getParamValue(methodCall, KEY_SDK_LOG); - } - - //login - final static String KEY_UID = "uid"; - final static String KEY_TOKEN = "token"; - //create message body - final static String KEY_TEXT = "text"; - final static String KEY_AT_USER_LIST = "atUserList"; - final static String KEY_IMAGE_PATH = "imagePath"; - final static String KEY_SOUND_PATH = "soundPath"; - final static String KEY_SOUND_DURATION = "duration"; - final static String KEY_VIDEO_PATH = "videoPath"; - final static String KEY_VIDEO_TYPE = "videoType"; - final static String KEY_VIDEO_DURATION = "duration"; - final static String KEY_VIDEO_SNAPSHOT_PATH = "snapshotPath"; - final static String KEY_FILE_PATH = "filePath"; - final static String KEY_FILE_NAME = "fileName"; - final static String KEY_MERGER_MESSAGE_LIST = "messageList"; - final static String KEY_MERGER_MESSAGE_TITLE = "title"; - final static String KEY_SUMMARY_LIST = "summaryList"; - final static String KEY_FORWARD_MESSAGE = "message"; - final static String KEY_LOCATION_MESSAGE_LO = "longitude"; - final static String KEY_LOCATION_MESSAGE_LA = "latitude"; - final static String KEY_MESSAGE_DES = "description"; - final static String KEY_CUSTOM_MESSAGE_DATA = "data"; - final static String KEY_CUSTOM_MESSAGE_EXT = "extension"; - final static String KEY_QUOTE_MESSAGE_TEXT = "quoteText"; - final static String KEY_QUOTE_MESSAGE_BODY = "quoteMessage"; - final static String KEY_CARD_MESSAGE = "cardMessage"; - //send message - final static String KEY_SEND_MESSAGE_CONTENT = "message"; - final static String KEY_SEND_MESSAGE_CONTENT_CLIENT_ID = "clientMsgID"; - final static String KEY_SEND_MESSAGE_RECEIVER = "receiver"; - final static String KEY_SEND_MESSAGE_GROUP_ID = "groupID"; - final static String KEY_SEND_MESSAGE_ONLINE_ONLY = "onlineUserOnly"; - //single chat - final static String KEY_SINGLE_MESSAGE_CONTENT = "message"; - final static String KEY_SINGLE_MESSAGE_USERID = "userID"; - final static String KEY_SINGLE_MESSAGE_SENDER = "sender"; - final static String KEY_SINGLE_MESSAGE_TYPING = "typing"; - //group chat - final static String KEY_GROUP_MESSAGE_GROUPID = "groupID"; - // find message - final static String KEY_FIND_MESSAGE_IDS = "messageIDList"; - // conversation - final static String KEY_CONVERSATION_ID = "conversationID"; - final static String KEY_CONVERSATION_IDS = "conversationIDList"; - final static String KEY_CONVERSATION_DRAFT = "draftText"; - final static String KEY_CONVERSATION_PINNED = "isPinned"; - final static String KEY_CONVERSATION_SOURCE_ID = "sourceID"; - final static String KEY_CONVERSATION_SESSION_TYPE = "sessionType"; - // user info - final static String KEY_USER_IDS = "uidList"; - // group - final static String KEY_GROUP_ID = "gid"; - final static String KEY_GROUP_IDS = "gidList"; - final static String KEY_GROUP_OP_REASON = "reason"; - // final static String KEY_GROUP_USER_ID = "uid"; -// final static String KEY_GROUP_USER_IDS = "uidList"; - final static String KEY_GROUP_LIST_FILTER = "filter"; - final static String KEY_GROUP_LIST_NEXT = "next"; - final static String KEY_GROUP_INFO = "gInfo"; - final static String KEY_GROUP_MEMBER_ROLE_LIST = "memberList"; - final static String KEY_GROUP_APPLICATION_INFO = "application"; - // - final static String KEY_SDK_LOG = "sdkLog"; } diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 58752cf..65599d8 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 51; objects = { /* Begin PBXBuildFile section */ @@ -121,7 +121,6 @@ 3A6AB9CCD90A2F5C2CE719D0 /* Pods-Runner.release.xcconfig */, 076751BE520B721535096B75 /* Pods-Runner.profile.xcconfig */, ); - name = Pods; path = Pods; sourceTree = "<group>"; }; @@ -353,12 +352,17 @@ isa = XCBuildConfiguration; baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { + ARCHS = "$(ARCHS_STANDARD)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = BDLHL8GNFV; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = io.openim.flutterOpenimSdkExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -467,7 +471,8 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -477,12 +482,17 @@ isa = XCBuildConfiguration; baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { + ARCHS = "$(ARCHS_STANDARD)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = BDLHL8GNFV; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = io.openim.flutterOpenimSdkExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -496,12 +506,17 @@ isa = XCBuildConfiguration; baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { + ARCHS = "$(ARCHS_STANDARD)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = BDLHL8GNFV; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = io.openim.flutterOpenimSdkExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png index dc9ada4..e69de29 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png index 28c6bf0..e69de29 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png index 2ccbfd9..e69de29 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png index f091b6b..e69de29 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png index 4cde121..e69de29 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png index d0ef06e..e69de29 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png index dcdc230..e69de29 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png index 2ccbfd9..e69de29 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png index c8f9ed8..e69de29 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png index a6d6b86..e69de29 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png index a6d6b86..e69de29 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png index 75b2d16..e69de29 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png index c4df70d..e69de29 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png index 6a84f41..e69de29 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png index d0e1f58..e69de29 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png index 9da19ea..e69de29 100644 Binary files a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png and b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png index 9da19ea..e69de29 100644 Binary files a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png and b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png index 9da19ea..e69de29 100644 Binary files a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png and b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/example/pubspec.lock b/example/pubspec.lock index 129a44f..ab2de77 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -68,7 +68,7 @@ packages: path: ".." relative: true source: path - version: "1.0.2" + version: "1.0.3" flutter_test: dependency: "direct dev" description: flutter diff --git a/ios/Classes/Module/MessageManager.swift b/ios/Classes/Module/MessageManager.swift index e2fdc58..bda47b8 100644 --- a/ios/Classes/Module/MessageManager.swift +++ b/ios/Classes/Module/MessageManager.swift @@ -42,6 +42,8 @@ public class MessageManager: BaseServiceManager { self["createQuoteMessage"] = createQuoteMessage self["createCardMessage"] = createCardMessage self["forceSyncMsg"] = forceSyncMsg + self["clearC2CHistoryMessage"] = clearC2CHistoryMessage + self["clearGroupHistoryMessage"] = clearGroupHistoryMessage } func addAdvancedMsgListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ @@ -187,6 +189,14 @@ public class MessageManager: BaseServiceManager { callBack(result) } + func clearC2CHistoryMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkClearC2CHistoryMessage(BaseCallback(result: result), methodCall[string: "userID"]) + } + + func clearGroupHistoryMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkClearGroupHistoryMessage(BaseCallback(result: result), methodCall[string: "groupID"]) + } + public class SendMsgProgressListener: NSObject, Open_im_sdkSendMsgCallBackProtocol { private let channel: FlutterMethodChannel diff --git a/ios/Framework/OpenIMCore.xcframework/Info.plist b/ios/Framework/OpenIMCore.xcframework/Info.plist index 35102e0..f1e1512 100644 --- a/ios/Framework/OpenIMCore.xcframework/Info.plist +++ b/ios/Framework/OpenIMCore.xcframework/Info.plist @@ -6,30 +6,30 @@ <array> <dict> <key>LibraryIdentifier</key> - <string>ios-arm64</string> + <string>ios-arm64_x86_64-simulator</string> <key>LibraryPath</key> <string>OpenIMCore.framework</string> <key>SupportedArchitectures</key> <array> <string>arm64</string> + <string>x86_64</string> </array> <key>SupportedPlatform</key> <string>ios</string> + <key>SupportedPlatformVariant</key> + <string>simulator</string> </dict> <dict> <key>LibraryIdentifier</key> - <string>ios-arm64_x86_64-simulator</string> + <string>ios-arm64</string> <key>LibraryPath</key> <string>OpenIMCore.framework</string> <key>SupportedArchitectures</key> <array> <string>arm64</string> - <string>x86_64</string> </array> <key>SupportedPlatform</key> <string>ios</string> - <key>SupportedPlatformVariant</key> - <string>simulator</string> </dict> </array> <key>CFBundlePackageType</key> diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Headers/Open_im_sdk.objc.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Headers/Open_im_sdk.objc.h index 2be1858..935b01c 100644 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Headers/Open_im_sdk.objc.h +++ b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Headers/Open_im_sdk.objc.h @@ -794,6 +794,8 @@ - (void)addFriend:(id<Open_im_sdkBase> _Nullable)callback paramsReq:(NSString* _Nullable)paramsReq; - (void)addToBlackList:(id<Open_im_sdkBase> _Nullable)callback blackUid:(NSString* _Nullable)blackUid; - (void)checkFriend:(id<Open_im_sdkBase> _Nullable)callback uidList:(NSString* _Nullable)uidList; +- (void)clearC2CHistoryMessage:(id<Open_im_sdkBase> _Nullable)callback userID:(NSString* _Nullable)userID; +- (void)clearGroupHistoryMessage:(id<Open_im_sdkBase> _Nullable)callback groupID:(NSString* _Nullable)groupID; - (NSString* _Nonnull)createCardMessage:(NSString* _Nullable)cardInfo; - (NSString* _Nonnull)createCustomMessage:(NSString* _Nullable)data extension:(NSString* _Nullable)extension description:(NSString* _Nullable)description; - (NSString* _Nonnull)createFileMessage:(NSString* _Nullable)filePath fileName:(NSString* _Nullable)fileName; @@ -1117,7 +1119,6 @@ FOUNDATION_EXPORT const int64_t Open_im_sdkSingleChatType; */ FOUNDATION_EXPORT const int64_t Open_im_sdkSingleTipBegin; FOUNDATION_EXPORT const int64_t Open_im_sdkSingleTipEnd; -FOUNDATION_EXPORT const int64_t Open_im_sdkSound; FOUNDATION_EXPORT const int64_t Open_im_sdkSysMsgType; /** * ContentType @@ -1136,6 +1137,7 @@ MsgFrom */ FOUNDATION_EXPORT const int64_t Open_im_sdkUserMsgType; FOUNDATION_EXPORT const int64_t Open_im_sdkVideo; +FOUNDATION_EXPORT const int64_t Open_im_sdkVoice; FOUNDATION_EXPORT const int64_t Open_im_sdkWSDataError; FOUNDATION_EXPORT const int64_t Open_im_sdkWSGetNewestSeq; FOUNDATION_EXPORT const int64_t Open_im_sdkWSPullMsg; @@ -1168,6 +1170,10 @@ FOUNDATION_EXPORT void Open_im_sdkAddToBlackList(id<Open_im_sdkBase> _Nullable c FOUNDATION_EXPORT void Open_im_sdkCheckFriend(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable uidList); +FOUNDATION_EXPORT void Open_im_sdkClearC2CHistoryMessage(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable userID); + +FOUNDATION_EXPORT void Open_im_sdkClearGroupHistoryMessage(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable groupID); + FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCardMessage(NSString* _Nullable cardInfo); FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCustomMessage(NSString* _Nullable data, NSString* _Nullable extension, NSString* _Nullable description); diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/OpenIMCore b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/OpenIMCore index f3c4650..95ba267 100644 Binary files a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/OpenIMCore and b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/OpenIMCore differ diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/A/Headers/Open_im_sdk.objc.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/A/Headers/Open_im_sdk.objc.h index 2be1858..935b01c 100644 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/A/Headers/Open_im_sdk.objc.h +++ b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/A/Headers/Open_im_sdk.objc.h @@ -794,6 +794,8 @@ - (void)addFriend:(id<Open_im_sdkBase> _Nullable)callback paramsReq:(NSString* _Nullable)paramsReq; - (void)addToBlackList:(id<Open_im_sdkBase> _Nullable)callback blackUid:(NSString* _Nullable)blackUid; - (void)checkFriend:(id<Open_im_sdkBase> _Nullable)callback uidList:(NSString* _Nullable)uidList; +- (void)clearC2CHistoryMessage:(id<Open_im_sdkBase> _Nullable)callback userID:(NSString* _Nullable)userID; +- (void)clearGroupHistoryMessage:(id<Open_im_sdkBase> _Nullable)callback groupID:(NSString* _Nullable)groupID; - (NSString* _Nonnull)createCardMessage:(NSString* _Nullable)cardInfo; - (NSString* _Nonnull)createCustomMessage:(NSString* _Nullable)data extension:(NSString* _Nullable)extension description:(NSString* _Nullable)description; - (NSString* _Nonnull)createFileMessage:(NSString* _Nullable)filePath fileName:(NSString* _Nullable)fileName; @@ -1117,7 +1119,6 @@ FOUNDATION_EXPORT const int64_t Open_im_sdkSingleChatType; */ FOUNDATION_EXPORT const int64_t Open_im_sdkSingleTipBegin; FOUNDATION_EXPORT const int64_t Open_im_sdkSingleTipEnd; -FOUNDATION_EXPORT const int64_t Open_im_sdkSound; FOUNDATION_EXPORT const int64_t Open_im_sdkSysMsgType; /** * ContentType @@ -1136,6 +1137,7 @@ MsgFrom */ FOUNDATION_EXPORT const int64_t Open_im_sdkUserMsgType; FOUNDATION_EXPORT const int64_t Open_im_sdkVideo; +FOUNDATION_EXPORT const int64_t Open_im_sdkVoice; FOUNDATION_EXPORT const int64_t Open_im_sdkWSDataError; FOUNDATION_EXPORT const int64_t Open_im_sdkWSGetNewestSeq; FOUNDATION_EXPORT const int64_t Open_im_sdkWSPullMsg; @@ -1168,6 +1170,10 @@ FOUNDATION_EXPORT void Open_im_sdkAddToBlackList(id<Open_im_sdkBase> _Nullable c FOUNDATION_EXPORT void Open_im_sdkCheckFriend(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable uidList); +FOUNDATION_EXPORT void Open_im_sdkClearC2CHistoryMessage(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable userID); + +FOUNDATION_EXPORT void Open_im_sdkClearGroupHistoryMessage(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable groupID); + FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCardMessage(NSString* _Nullable cardInfo); FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCustomMessage(NSString* _Nullable data, NSString* _Nullable extension, NSString* _Nullable description); diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/A/OpenIMCore b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/A/OpenIMCore index f3c4650..95ba267 100644 Binary files a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/A/OpenIMCore and b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/A/OpenIMCore differ diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Headers/Open_im_sdk.objc.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Headers/Open_im_sdk.objc.h index 2be1858..935b01c 100644 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Headers/Open_im_sdk.objc.h +++ b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Headers/Open_im_sdk.objc.h @@ -794,6 +794,8 @@ - (void)addFriend:(id<Open_im_sdkBase> _Nullable)callback paramsReq:(NSString* _Nullable)paramsReq; - (void)addToBlackList:(id<Open_im_sdkBase> _Nullable)callback blackUid:(NSString* _Nullable)blackUid; - (void)checkFriend:(id<Open_im_sdkBase> _Nullable)callback uidList:(NSString* _Nullable)uidList; +- (void)clearC2CHistoryMessage:(id<Open_im_sdkBase> _Nullable)callback userID:(NSString* _Nullable)userID; +- (void)clearGroupHistoryMessage:(id<Open_im_sdkBase> _Nullable)callback groupID:(NSString* _Nullable)groupID; - (NSString* _Nonnull)createCardMessage:(NSString* _Nullable)cardInfo; - (NSString* _Nonnull)createCustomMessage:(NSString* _Nullable)data extension:(NSString* _Nullable)extension description:(NSString* _Nullable)description; - (NSString* _Nonnull)createFileMessage:(NSString* _Nullable)filePath fileName:(NSString* _Nullable)fileName; @@ -1117,7 +1119,6 @@ FOUNDATION_EXPORT const int64_t Open_im_sdkSingleChatType; */ FOUNDATION_EXPORT const int64_t Open_im_sdkSingleTipBegin; FOUNDATION_EXPORT const int64_t Open_im_sdkSingleTipEnd; -FOUNDATION_EXPORT const int64_t Open_im_sdkSound; FOUNDATION_EXPORT const int64_t Open_im_sdkSysMsgType; /** * ContentType @@ -1136,6 +1137,7 @@ MsgFrom */ FOUNDATION_EXPORT const int64_t Open_im_sdkUserMsgType; FOUNDATION_EXPORT const int64_t Open_im_sdkVideo; +FOUNDATION_EXPORT const int64_t Open_im_sdkVoice; FOUNDATION_EXPORT const int64_t Open_im_sdkWSDataError; FOUNDATION_EXPORT const int64_t Open_im_sdkWSGetNewestSeq; FOUNDATION_EXPORT const int64_t Open_im_sdkWSPullMsg; @@ -1168,6 +1170,10 @@ FOUNDATION_EXPORT void Open_im_sdkAddToBlackList(id<Open_im_sdkBase> _Nullable c FOUNDATION_EXPORT void Open_im_sdkCheckFriend(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable uidList); +FOUNDATION_EXPORT void Open_im_sdkClearC2CHistoryMessage(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable userID); + +FOUNDATION_EXPORT void Open_im_sdkClearGroupHistoryMessage(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable groupID); + FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCardMessage(NSString* _Nullable cardInfo); FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCustomMessage(NSString* _Nullable data, NSString* _Nullable extension, NSString* _Nullable description); diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/OpenIMCore b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/OpenIMCore index f3c4650..95ba267 100644 Binary files a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/OpenIMCore and b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/OpenIMCore differ diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Headers/Open_im_sdk.objc.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Headers/Open_im_sdk.objc.h index 2be1858..935b01c 100644 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Headers/Open_im_sdk.objc.h +++ b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Headers/Open_im_sdk.objc.h @@ -794,6 +794,8 @@ - (void)addFriend:(id<Open_im_sdkBase> _Nullable)callback paramsReq:(NSString* _Nullable)paramsReq; - (void)addToBlackList:(id<Open_im_sdkBase> _Nullable)callback blackUid:(NSString* _Nullable)blackUid; - (void)checkFriend:(id<Open_im_sdkBase> _Nullable)callback uidList:(NSString* _Nullable)uidList; +- (void)clearC2CHistoryMessage:(id<Open_im_sdkBase> _Nullable)callback userID:(NSString* _Nullable)userID; +- (void)clearGroupHistoryMessage:(id<Open_im_sdkBase> _Nullable)callback groupID:(NSString* _Nullable)groupID; - (NSString* _Nonnull)createCardMessage:(NSString* _Nullable)cardInfo; - (NSString* _Nonnull)createCustomMessage:(NSString* _Nullable)data extension:(NSString* _Nullable)extension description:(NSString* _Nullable)description; - (NSString* _Nonnull)createFileMessage:(NSString* _Nullable)filePath fileName:(NSString* _Nullable)fileName; @@ -1117,7 +1119,6 @@ FOUNDATION_EXPORT const int64_t Open_im_sdkSingleChatType; */ FOUNDATION_EXPORT const int64_t Open_im_sdkSingleTipBegin; FOUNDATION_EXPORT const int64_t Open_im_sdkSingleTipEnd; -FOUNDATION_EXPORT const int64_t Open_im_sdkSound; FOUNDATION_EXPORT const int64_t Open_im_sdkSysMsgType; /** * ContentType @@ -1136,6 +1137,7 @@ MsgFrom */ FOUNDATION_EXPORT const int64_t Open_im_sdkUserMsgType; FOUNDATION_EXPORT const int64_t Open_im_sdkVideo; +FOUNDATION_EXPORT const int64_t Open_im_sdkVoice; FOUNDATION_EXPORT const int64_t Open_im_sdkWSDataError; FOUNDATION_EXPORT const int64_t Open_im_sdkWSGetNewestSeq; FOUNDATION_EXPORT const int64_t Open_im_sdkWSPullMsg; @@ -1168,6 +1170,10 @@ FOUNDATION_EXPORT void Open_im_sdkAddToBlackList(id<Open_im_sdkBase> _Nullable c FOUNDATION_EXPORT void Open_im_sdkCheckFriend(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable uidList); +FOUNDATION_EXPORT void Open_im_sdkClearC2CHistoryMessage(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable userID); + +FOUNDATION_EXPORT void Open_im_sdkClearGroupHistoryMessage(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable groupID); + FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCardMessage(NSString* _Nullable cardInfo); FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCustomMessage(NSString* _Nullable data, NSString* _Nullable extension, NSString* _Nullable description); diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/OpenIMCore b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/OpenIMCore index 1e53a0a..85f5795 100644 Binary files a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/OpenIMCore and b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/OpenIMCore differ diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/A/Headers/Open_im_sdk.objc.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/A/Headers/Open_im_sdk.objc.h index 2be1858..935b01c 100644 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/A/Headers/Open_im_sdk.objc.h +++ b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/A/Headers/Open_im_sdk.objc.h @@ -794,6 +794,8 @@ - (void)addFriend:(id<Open_im_sdkBase> _Nullable)callback paramsReq:(NSString* _Nullable)paramsReq; - (void)addToBlackList:(id<Open_im_sdkBase> _Nullable)callback blackUid:(NSString* _Nullable)blackUid; - (void)checkFriend:(id<Open_im_sdkBase> _Nullable)callback uidList:(NSString* _Nullable)uidList; +- (void)clearC2CHistoryMessage:(id<Open_im_sdkBase> _Nullable)callback userID:(NSString* _Nullable)userID; +- (void)clearGroupHistoryMessage:(id<Open_im_sdkBase> _Nullable)callback groupID:(NSString* _Nullable)groupID; - (NSString* _Nonnull)createCardMessage:(NSString* _Nullable)cardInfo; - (NSString* _Nonnull)createCustomMessage:(NSString* _Nullable)data extension:(NSString* _Nullable)extension description:(NSString* _Nullable)description; - (NSString* _Nonnull)createFileMessage:(NSString* _Nullable)filePath fileName:(NSString* _Nullable)fileName; @@ -1117,7 +1119,6 @@ FOUNDATION_EXPORT const int64_t Open_im_sdkSingleChatType; */ FOUNDATION_EXPORT const int64_t Open_im_sdkSingleTipBegin; FOUNDATION_EXPORT const int64_t Open_im_sdkSingleTipEnd; -FOUNDATION_EXPORT const int64_t Open_im_sdkSound; FOUNDATION_EXPORT const int64_t Open_im_sdkSysMsgType; /** * ContentType @@ -1136,6 +1137,7 @@ MsgFrom */ FOUNDATION_EXPORT const int64_t Open_im_sdkUserMsgType; FOUNDATION_EXPORT const int64_t Open_im_sdkVideo; +FOUNDATION_EXPORT const int64_t Open_im_sdkVoice; FOUNDATION_EXPORT const int64_t Open_im_sdkWSDataError; FOUNDATION_EXPORT const int64_t Open_im_sdkWSGetNewestSeq; FOUNDATION_EXPORT const int64_t Open_im_sdkWSPullMsg; @@ -1168,6 +1170,10 @@ FOUNDATION_EXPORT void Open_im_sdkAddToBlackList(id<Open_im_sdkBase> _Nullable c FOUNDATION_EXPORT void Open_im_sdkCheckFriend(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable uidList); +FOUNDATION_EXPORT void Open_im_sdkClearC2CHistoryMessage(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable userID); + +FOUNDATION_EXPORT void Open_im_sdkClearGroupHistoryMessage(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable groupID); + FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCardMessage(NSString* _Nullable cardInfo); FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCustomMessage(NSString* _Nullable data, NSString* _Nullable extension, NSString* _Nullable description); diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/A/OpenIMCore b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/A/OpenIMCore index 1e53a0a..85f5795 100644 Binary files a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/A/OpenIMCore and b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/A/OpenIMCore differ diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Headers/Open_im_sdk.objc.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Headers/Open_im_sdk.objc.h index 2be1858..935b01c 100644 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Headers/Open_im_sdk.objc.h +++ b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Headers/Open_im_sdk.objc.h @@ -794,6 +794,8 @@ - (void)addFriend:(id<Open_im_sdkBase> _Nullable)callback paramsReq:(NSString* _Nullable)paramsReq; - (void)addToBlackList:(id<Open_im_sdkBase> _Nullable)callback blackUid:(NSString* _Nullable)blackUid; - (void)checkFriend:(id<Open_im_sdkBase> _Nullable)callback uidList:(NSString* _Nullable)uidList; +- (void)clearC2CHistoryMessage:(id<Open_im_sdkBase> _Nullable)callback userID:(NSString* _Nullable)userID; +- (void)clearGroupHistoryMessage:(id<Open_im_sdkBase> _Nullable)callback groupID:(NSString* _Nullable)groupID; - (NSString* _Nonnull)createCardMessage:(NSString* _Nullable)cardInfo; - (NSString* _Nonnull)createCustomMessage:(NSString* _Nullable)data extension:(NSString* _Nullable)extension description:(NSString* _Nullable)description; - (NSString* _Nonnull)createFileMessage:(NSString* _Nullable)filePath fileName:(NSString* _Nullable)fileName; @@ -1117,7 +1119,6 @@ FOUNDATION_EXPORT const int64_t Open_im_sdkSingleChatType; */ FOUNDATION_EXPORT const int64_t Open_im_sdkSingleTipBegin; FOUNDATION_EXPORT const int64_t Open_im_sdkSingleTipEnd; -FOUNDATION_EXPORT const int64_t Open_im_sdkSound; FOUNDATION_EXPORT const int64_t Open_im_sdkSysMsgType; /** * ContentType @@ -1136,6 +1137,7 @@ MsgFrom */ FOUNDATION_EXPORT const int64_t Open_im_sdkUserMsgType; FOUNDATION_EXPORT const int64_t Open_im_sdkVideo; +FOUNDATION_EXPORT const int64_t Open_im_sdkVoice; FOUNDATION_EXPORT const int64_t Open_im_sdkWSDataError; FOUNDATION_EXPORT const int64_t Open_im_sdkWSGetNewestSeq; FOUNDATION_EXPORT const int64_t Open_im_sdkWSPullMsg; @@ -1168,6 +1170,10 @@ FOUNDATION_EXPORT void Open_im_sdkAddToBlackList(id<Open_im_sdkBase> _Nullable c FOUNDATION_EXPORT void Open_im_sdkCheckFriend(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable uidList); +FOUNDATION_EXPORT void Open_im_sdkClearC2CHistoryMessage(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable userID); + +FOUNDATION_EXPORT void Open_im_sdkClearGroupHistoryMessage(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable groupID); + FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCardMessage(NSString* _Nullable cardInfo); FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCustomMessage(NSString* _Nullable data, NSString* _Nullable extension, NSString* _Nullable description); diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/OpenIMCore b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/OpenIMCore index 1e53a0a..85f5795 100644 Binary files a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/OpenIMCore and b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/OpenIMCore differ diff --git a/lib/src/manager/im_manager.dart b/lib/src/manager/im_manager.dart index 8d248ef..b2c3e76 100644 --- a/lib/src/manager/im_manager.dart +++ b/lib/src/manager/im_manager.dart @@ -31,6 +31,7 @@ class IMManager { void _addNativeCallback(MethodChannel _channel) { _channel.setMethodCallHandler((call) { try { + print('call:$call'); if (call.method == ListenerType.initSDKListener) { String type = call.arguments['type']; dynamic data = call.arguments['data']; @@ -186,6 +187,7 @@ class IMManager { } else if (call.method == ListenerType.conversationListener) { String type = call.arguments['type']; dynamic data = call.arguments['data']; + print('type:$type data:$data'); switch (type) { case 'onSyncServerStart': conversationManager.conversationListener.syncServerStart(); diff --git a/lib/src/manager/im_message_manager.dart b/lib/src/manager/im_message_manager.dart index d390f07..bc9b1fa 100644 --- a/lib/src/manager/im_message_manager.dart +++ b/lib/src/manager/im_message_manager.dart @@ -369,6 +369,18 @@ class MessageManager { .then((value) => _toObj(value)); } + /// + Future<dynamic> clearC2CHistoryMessage({required String uid}) { + return _channel.invokeMethod( + 'clearC2CHistoryMessage', _buildParam({"userID": uid})); + } + + /// + Future<dynamic> clearGroupHistoryMessage({required String gid}) { + return _channel.invokeMethod( + 'clearGroupHistoryMessage', _buildParam({"groupID": gid})); + } + /// void forceSyncMsg() { _channel.invokeMethod('forceSyncMsg', _buildParam({})); diff --git a/lib/src/models/conversation_info.dart b/lib/src/models/conversation_info.dart index 579b02c..a443130 100644 --- a/lib/src/models/conversation_info.dart +++ b/lib/src/models/conversation_info.dart @@ -48,11 +48,14 @@ class ConversationInfo { unreadCount = json['unreadCount']; // latestMsg = json['latestMsg']; // if (null != json['latestMsg']) { - if (json['latestMsg'] is String) { - latestMsg = Message.fromJson(jsonDecode(json['latestMsg'])); - } else if (json['latestMsg'] is Map) { - latestMsg = Message.fromJson(json['latestMsg']); - } + try { + if (json['latestMsg'] is String) { + latestMsg = Message.fromJson(jsonDecode(json['latestMsg'])); + } else if (json['latestMsg'] is Map) { + latestMsg = Message.fromJson(json['latestMsg']); + } + } catch (e) {} + // } latestMsgSendTime = json['latestMsgSendTime'];