diff --git a/README.md b/README.md index e264564..f00349d 100644 --- a/README.md +++ b/README.md @@ -27,68 +27,31 @@ A flutter im plugin for android and ios. #### 3, Init config ``` -// Initialize SDK + // Initialize SDK OpenIM.iMManager ..initSDK( platform: Platform.isAndroid ? IMPlatform.android : IMPlatform.ios, - ipApi: '', - ipWs: '', - dbPath: '', - listener: OnInitSDKListener( - onConnecting: () {}, - onConnectFailed: (code, error) {}, - onConnectSuccess: () {}, - onKickedOffline: () {}, - onUserSigExpired: () {}, - onSelfInfoUpdated: (user) {}, - ), + apiAddr: '', + wsAddr: '', + dataDir: '', + listener: OnConnectListener(), ) - + // Set up current user info changed listener + ..userManager.setUserListener(OnUserListener()) // Add message listener (remove when not in use) - ..messageManager.addAdvancedMsgListener(OnAdvancedMsgListener( - onRecvMessageRevoked: (msgId) {}, - onRecvC2CReadReceipt: (list) {}, - onRecvNewMessage: (msg) {}, - )) + ..messageManager.setAdvancedMsgListener(OnAdvancedMsgListener()) // Set up message sending progress listener - ..messageManager.setMsgSendProgressListener(OnMsgSendProgressListener( - onProgress: (msgId, progress) {}, - )) + ..messageManager.setMsgSendProgressListener(OnMsgSendProgressListener()) // Set up friend relationship listener - ..friendshipManager.setFriendshipListener(OnFriendshipListener( - onBlackListAdd: (u) {}, - onBlackListDeleted: (u) {}, - onFriendApplicationListAccept: (u) {}, - onFriendApplicationListAdded: (u) {}, - onFriendApplicationListDeleted: (u) {}, - onFriendApplicationListReject: (u) {}, - onFriendInfoChanged: (u) {}, - onFriendListAdded: (u) {}, - onFriendListDeleted: (u) {}, - )) + ..friendshipManager.setFriendshipListener(OnFriendshipListener()) // Set up conversation listener - ..conversationManager.setConversationListener(OnConversationListener( - onConversationChanged: (list) {}, - onNewConversation: (list) {}, - onTotalUnreadMessageCountChanged: (count) {}, - onSyncServerFailed: () {}, - onSyncServerFinish: () {}, - onSyncServerStart: () {}, - )) + ..conversationManager.setConversationListener(OnConversationListener()) // Set up group listener ..groupManager.setGroupListener(OnGroupListener( - onApplicationProcessed: (groupId, opUser, agreeOrReject, opReason) {}, - onGroupCreated: (groupId) {}, - onGroupInfoChanged: (groupId, info) {}, - onMemberEnter: (groupId, list) {}, - onMemberInvited: (groupId, opUser, list) {}, - onMemberKicked: (groupId, opUser, list) {}, - onMemberLeave: (groupId, info) {}, - onReceiveJoinApplication: (groupId, info, opReason) {}, )); ``` @@ -139,7 +102,7 @@ var message = await OpenIM.iMManager.messageManager.createTextMessage( // Send OpenIM.iMManager.messageManager.sendMessage( message: message, - onlineUserOnly: false, + offlinePushInfo: offlinePushInfo, userID: uid, // Single chat value is not null groupID: gid, // The group chat value is not null ).then((v) { @@ -153,120 +116,116 @@ OpenIM.iMManager.messageManager.sendMessage( OpenIM.iMManager.logout(); ``` - - #### OpenIM.iMManager -| method | description | -| ---------------- | ------------------------------- | -| initSDK | Initialize SDK | -| unInitSDK | | -| login | Log in | -| logout | Sign out | -| getLoginStatus | Login status | -| getLoginUid | Current user id | -| getLoginUserInfo | Current user information | -| setSelfInfo | Modify current user information | -| getUsersInfo | Get user information by user id | -| enabledSDKLog | Setup sdk log | +| method | description | +| ---------------- | ------------------------ | +| initSDK | Initialize SDK | +| unInitSDK | | +| login | Log in | +| logout | Sign out | +| getLoginStatus | Login status | +| getLoginUid | Current user id | +| getLoginUserInfo | Current user information | +#### OpenIM.userManager +| method | description | +| --------------- | --------------------------------------------------- | +| setSelfInfo | Modify current user information | +| getUsersInfo | Get user information by user id | +| getSelfUserInfo | Get the information of the currently logged in user | #### OpenIM.iMManager.conversationManager -| method | description | -| ----------------------------- | --------------------------------------- | -| setConversationListener | Listener | -| getAllConversationList | Get all conversation | -| getSingleConversation | Get single conversation | -| getMultipleConversation | Get multiple conversation | -| deleteConversation | Delete conversation | -| setConversationDraft | Set conversation draftText | -| pinConversation | Top conversation | -| markSingleMessageHasRead | Mark single chat messages as read | -| markGroupMessageHasRead | Mark group chat messages as read | -| getTotalUnreadMsgCount | Get the total number of unread messages | -| getConversationID | Query conversation id | -| setConversationRecvMessageOpt | Setup message do not disturb | -| getConversationRecvMessageOpt | Message do not disturb status | - - +| method | description | +| ------------------------------ | ------------------------------------------------------------ | +| setConversationListener | Listener | +| getAllConversationList | Get all conversation | +| getConversationListSplit | Paging to get conversation | +| getOneConversation | Get a conversation, if it doesn't exist it will be created automatically | +| getMultipleConversation | Get conversation list by id list | +| deleteConversation | Delete conversation by id | +| setConversationDraft | Set conversation draftText | +| pinConversation | Pinned conversation | +| markGroupMessageHasRead | Mark group chat messages as read | +| getTotalUnreadMsgCount | Get the total number of unread messages | +| getConversationIDBySessionType | Query conversation id | +| setConversationRecvMessageOpt | Setup message do not disturb | +| getConversationRecvMessageOpt | Message do not disturb status | #### OpenIM.iMManager.friendshipManager -| method | description | -| ------------------------ | ------------------------------------------------------------ | -| setFriendshipListener | Listener | -| getFriendsInfo | Get friend information | -| addFriend | Send an friend application | -| getFriendApplicationList | Get all friend application, sent to you by others | -| getFriendList | Find all friends including those who have been added to the blacklist | -| setFriendInfo | Modify friend information, only comment can be modified | -| addToBlackList | Add to blacklist | -| getBlackList | Get blacklist list | -| deleteFromBlackList | Remove from blacklist | -| checkFriend | Check friendship | -| deleteFromFriendList | Remove friend | -| acceptFriendApplication | Accept friend application | -| refuseFriendApplication | Reject friend application | - - +| method | description | +| ---------------------------- | ------------------------------------------------------------ | +| setFriendshipListener | Set up a friend relationship listener | +| getFriendsInfo | Get friend info by user id | +| addFriend | Send an friend application | +| getRecvFriendApplicationList | Get someone's request to add me as a friend | +| getSendFriendApplicationList | Get friend requests from me | +| getFriendList | Find all friends including those who have been added to the blacklist | +| setFriendRemark | Modify friend remark name | +| addBlacklist | Add friends to blacklist | +| getBlacklist | Get blacklist list | +| removeBlacklist | Remove from blacklist | +| checkFriend | Determine if there is a friendship by userId | +| deleteFriend | Dissolve friendship from friend list | +| acceptFriendApplication | Accept application of be friend | +| refuseFriendApplication | Refuse application of be friend | #### OpenIM.iMManager.messageManager -| method | description | -| --------------------------------- | --------------------------------- | -| addAdvancedMsgListener | Add message listener | -| setMsgSendProgressListener | Message sending progress listener | -| sendMessage | Send a message | -| getHistoryMessageList | Get history news | -| revokeMessage | Revoke message | -| deleteMessageFromLocalStorage | Delete message | -| insertSingleMessageToLocalStorage | Insert message | -| findMessages | Query the message by id | -| markC2CMessageAsRead | Mark c2c message as read | -| typingStatusUpdate | Typing prompt | -| createTextMessage | Create text message | -| createTextAtMessage | Create @ message | -| createImageMessage | Create picture message | -| createImageMessageFromFullPath | Create picture message | -| createSoundMessage | Create voice message | -| createSoundMessageFromFullPath | Create voice message | -| createVideoMessage | Create video message | -| createVideoMessageFromFullPath | Create video message | -| createFileMessage | Create file message | -| createFileMessageFromFullPath | Create file message | -| createMergerMessage | Create merge message | -| createForwardMessage | Create a forwarded message | -| createLocationMessage | Create location message | -| createCustomMessage | Create custom message | -| createQuoteMessage | Create quote message | -| createCardMessage | Create card message | -| clearC2CHistoryMessage | Clear all message history | -| clearGroupHistoryMessage | Clear all message history | - - +| method | description | +| --------------------------------- | ------------------------------------------ | +| setAdvancedMsgListener | Set a message listener | +| setMsgSendProgressListener | Set up message sending progress monitoring | +| sendMessage | Send a message to user or to group | +| getHistoryMessageList | Find all history message | +| revokeMessage | Revoke the sent information | +| deleteMessageFromLocalStorage | Delete message | +| insertSingleMessageToLocalStorage | Insert message | +| markC2CMessageAsRead | Mark c2c message as read | +| typingStatusUpdate | Typing prompt | +| createTextMessage | Create text message | +| createTextAtMessage | Create @ message | +| createImageMessage | Create picture message | +| createImageMessageFromFullPath | Create picture message | +| createSoundMessage | Create voice message | +| createSoundMessageFromFullPath | Create voice message | +| createVideoMessage | Create video message | +| createVideoMessageFromFullPath | Create video message | +| createFileMessage | Create file message | +| createFileMessageFromFullPath | Create file message | +| createMergerMessage | Create merge message | +| createForwardMessage | Create a forwarded message | +| createLocationMessage | Create location message | +| createCustomMessage | Create custom message | +| createQuoteMessage | Create quote message | +| createCardMessage | Create card message | +| clearC2CHistoryMessage | Clear all c2c history message | +| clearGroupHistoryMessage | Clear all group history | #### OpenIM.iMManager.groupManager -| method | description | -| ----------------------- | ------------------------------- | -| setGroupListener | Listener | -| inviteUserToGroup | Invite into the group | -| kickGroupMember | Remove group members | -| getGroupMembersInfo | Get group member information | -| getGroupMemberList | Get group members | -| getJoinedGroupList | Get joined groups | -| isJoinedGroup | Check you have joined the group | -| createGroup | Create a group | -| setGroupInfo | Edit group information | -| getGroupsInfo | Get group information | -| joinGroup | Join group | -| quitGroup | Exit group | -| transferGroupOwner | Group permission transfer | -| getGroupApplicationList | Get group application list | -| acceptGroupApplication | Accept group invitation | -| refuseGroupApplication | Refuse group application | +| method | description | +| --------------------------- | ------------------------------------------------------------ | +| setGroupListener | Set up group relationship monitoring | +| inviteUserToGroup | Invite friends into the group | +| kickGroupMember | Remove member from group | +| getGroupMembersInfo | Get group member information | +| getGroupMemberList | Get the list of group members | +| getJoinedGroupList | Find all groups you have joined | +| isJoinedGroup | Check if you are a member of the group | +| createGroup | Create a group | +| setGroupInfo | Edit group information | +| getGroupsInfo | Find group information by group id | +| joinGroup | Apply to join the group | +| quitGroup | Leave group | +| transferGroupOwner | Give group permissions to others | +| getRecvGroupApplicationList | As the group owner or administrator, get the list of received group members' applications to join the group. | +| getSendGroupApplicationList | Get the record of the group membership application issued by yourself | +| acceptGroupApplication | Accept group application | +| refuseGroupApplication | Refuse group application | #### Other @@ -323,19 +282,19 @@ Platform static const linux = 7; ``` -Group member role +Group member role level ``` - static const member = 0; - static const owner = 1; - static const admin = 2; + static const member = 1; + static const owner = 2; + static const admin = 3; ``` Conversation type ``` - static const single_chat = 1; - static const group_chat = 2; + static const single = 1; + static const group = 2; ``` Message status diff --git a/README.zh-cn.md b/README.zh-cn.md index 4ecdd7b..4476b63 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -1,1741 +1,984 @@ - - - - -# 1. 初始化与登录 - -## 1.1. initSDK - -初始化OpenIM SDK,设置SDK网络连接地址以及本地数据存放目录等。 - -``` - OpenIM.iMManager.initSDK( - platform: 1, - ipApi: 'ipApi', - ipWs: 'ipWs', - dbPath: 'dbPath', - listener: OnInitSDKListener( - onConnectFailed: (int? code, String? errorMsg) {}, - onConnecting: () {}, - onConnectSuccess: () {}, - onKickedOffline: () {}, - onSelfInfoUpdated: (UserInfo info) {}, - onUserSigExpired: () {}, +## SDK使用步骤 + +##### 1,初始化 + +``` +OpenIM.iMManager.initSDK( + platform: 0, // 平台,参照IMPlatform类, + apiAddr: "", // SDK的API接口地址。如:http:xxx:10000 + wsAddr: "", // SDK的web socket地址。如: ws:xxx:17778 + dataDir: "", // 数据存储路径。如:var apath =(await getApplicationDocumentsDirectory()).path + listener: OnConnectListener( + onConnectSuccess: () { + // 已经成功连接到服务器 + }, + onConnecting: () { + // 正在连接到服务器,适合在 UI 上展示“正在连接”状态。 + }, + onConnectFailed: (code, errorMsg) { + // 连接服务器失败,可以提示用户当前网络连接不可用 + }, + onUserSigExpired: () { + // 登录票据已经过期,请使用新签发的 UserSig 进行登录。 + }, + onKickedOffline: () { + // 当前用户被踢下线,此时可以 UI 提示用户“您已经在其他端登录了当前账号,是否重新登录?” + }, ), - ); -``` - -- 参数说明: - -| 名称 | 类型 | 描述 | -| -------- | ----------------- | ------------------------------------------------------------ | -| platform | int | 平台类型:IMPlatform类 | -| ipApi | String | SDK的API接口地址。如:http:xxx:10000 | -| ipWs | String | SDK的web socket地址。如: ws:xxx:17778 | -| dbPath | String | 数据存储路径。如:var apath =(await getApplicationDocumentsDirectory()).path | -| listener | OnInitSDKListener | SDK初始化监听 | + ).then((value){ + if(value == true){ + // 初始化成功 + } + }); +``` + +##### 2,设置监听器 + +``` +OpenIM.iMManager + ..userManager.setUserListener(OnUserListener( + onSelfInfoUpdated: (userInfo) { + // 当前登录用户资料变更回调 + }, + )) + ..messageManager.setAdvancedMsgListener(OnAdvancedMsgListener( + onRecvNewMessage: (message) { + // 收到新消息,界面添加新消息 + }, + onRecvMessageRevoked: (messageID) { + // 消息成功撤回,从界面移除消息 + }, + onRecvC2CReadReceipt: (list) { + // 消息被阅读回执,将消息标记为已读 + }, + )) + ..messageManager.setMsgSendProgressListener(OnMsgSendProgressListener( + onProgress: (messageID, progress) { + // 消息发送进度回调 + }, + )) + ..friendshipManager.setFriendshipListener(OnFriendshipListener( + onFriendApplicationRejected: (applicationInfo) { + // 发出或收到的好友申请被拒绝 + }, + onFriendApplicationDeleted: (applicationInfo) { + // 发出或收到的好友申请被删除 + }, + onFriendApplicationAdded: (applicationInfo) { + // 发出或收到的好友申请被添加 + }, + onFriendApplicationAccepted: (applicationInfo) { + // 发出或收到的好友申请已同意 + }, + onFriendAdded: (frinedInfo) { + // 好友被添加 + }, + onFriendDeleted: (frinedInfo) { + // 好友被删除 + }, + onFriendInfoChanged: (frinedInfo) { + // 朋友的资料发生变化 + }, + onBlacklistDeleted: (blackInfo) { + // 从黑名单删除 + }, + onBlacklistAdded: (blackInfo) { + // 拉入黑名单 + }, + )) + ..conversationManager.setConversationListener(OnConversationListener( + onNewConversation: (list) { + // 新增会话 + }, + onConversationChanged: (list) { + // 已添加的会话发送改变 + }, + onTotalUnreadMessageCountChanged: (count) { + // 未读消息数发送变化 + }, + )) + ..groupManager.setGroupListener(OnGroupListener( + onGroupMemberInfoChanged: (memberInfo) { + // 组成员信息发生变化 + }, + onGroupMemberDeleted: (memberInfo) { + // 组成员退出 + }, + onGroupMemberAdded: (memberInfo) { + // 组成员进入 + }, + onGroupApplicationRejected: (applicationInfo) { + // 发出或收到的组申请被拒绝 + }, + onGroupApplicationDeleted: (applicationInfo) { + // 发出或收到的组申请被删除 + }, + onGroupApplicationAdded: (applicationInfo) { + // 发出或收到的组申请有新增 + }, + onGroupApplicationAccepted: (applicationInfo) { + // 发出或收到的组申请被接受 + }, + onJoinedGroupDeleted: (groupInfo) { + // 退出群:退出者收到;踢出群:被踢者收到 + }, + onJoinedGroupAdded: (groupInfo) { + // 创建群: 初始成员收到;邀请进群:被邀请者收到 + }, + onGroupInfoChanged: (groupInfo) { + // 组资料变更 + }, + )); +``` + +##### 3,登录 + +``` + OpenIM.iMManager.login( + uid: "", // uid来自于自身业务服务器 + token: "", // token需要业务服务器根据secret向OpenIM服务端交换获取 + ).then((userInfo) { + // 返回当前登录用户的资料 + }); +``` + + - 注:在创建图片,语音,视频,文件等需要路径参数的消息体时,如果选择的是非全路径方法如:createSoundMessage(全路径方法为:createSoundMessageFromFullPath),需要将文件自行拷贝到dbPath目录下,如果此时文件路径为 apath+"/sound/a.mp3",则参数path的值为:/sound/a.mp3。如果选择的全路径方法,路径为你文件的实际路径不需要再拷贝。 +## 方法名、参数、返回值说明 -- OnInitSDKListener - - -| 事件回调 | 事件描述 | 推荐操作 | -| ----------------- | ------------------------ | ------------------------------------------------------------ | -| onConnecting | 正在连接到服务器 | 适合在 UI 上展示“正在连接”状态。 | -| onConnectSuccess | 已经成功连接到服务器 | - | -| onConnectFailed | 连接服务器失败 | 可以提示用户当前网络连接不可用 | -| onKickedOffline | 当前用户被踢下线 | 此时可以 UI 提示用户“您已经在其他端登录了当前账号,是否重新登录?” | -| onUserSigExpired | 登录票据已经过期 | 请使用新签发的 UserSig 进行登录。 | -| onSelfInfoUpdated | 当前用户的资料发生了更新 | 可以在 UI 上更新自己的头像和昵称。 | - -- 返回值说明: - -initSDK方法返回Future对象 +- ##### logout( 登出) ``` -futrue.then((value) => '初始化成功').catchError((e)=>'初始化失败') + OpenIM.iMManager.logout().then((_){ + // 退出成功 + }); ``` -## 1.2. unInitSDK - -取消初始化,一般用于在初始化后需要重新初始化 +- ##### getLoginUserInfo(获取当前登录用户的资料) ``` -OpenIM.iMManager.unInitSDK(); +OpenIM.iMManager.getLoginUserInfo().then((userInfo){ + // 当前登录用户的信息 + }); ``` -## 1.3. login - -使用用户ID(uid)和token登录,uid来自于自身业务服务器,token需要业务服务器根据secret向OpenIM服务端交换获取。 +- ##### getLoginUserID(获取当前登录用户的ID) ``` - OpenIM.iMManager.login(uid: uid, token: token); + OpenIM.iMManager.getLoginUserID().then((userID){ + // 当前登录用户的ID + }); ``` -- 参数说明 - -| 名称 | 类型 | 描述 | -| ----- | ------ | --------- | -| uid | String | 用户ID | -| token | String | 用户token | - -- 返回值说明: - -login方法返回Future对象 +- ##### getUsersInfo(根据用户ID批量获取用户信息) ``` -futrue.then((value) => '登录成功').catchError((e)=>'登录失败') + OpenIM.iMManager.userManager.getUsersInfo( + uidList: [], // 用户ID集合 + ).then((userInfoList) { + // 用户信息列表 + }); ``` -## 1.4. logout - -登出OpenIM,通常在切换账号的时候调用,清除登录态以及内存中的所有数据。 +- ##### getSelfUserInfo(获取当前登录用户的资料) ``` -OpenIM.iMManager.logout(); + OpenIM.iMManager.userManager.getSelfUserInfo().then((userInfo){ + // 返回当前登录用户的资料 + }); ``` -- 返回值说明: +- ##### setSelfInfo(修改当前用登录户资料) -logout方法返回Future对象 +会触发当用户的onSelfInfoUpdated回调,以及好友的onFriendInfoChanged、onConversationChanged回调。 ``` -futrue.then((value) => '登出成功').catchError((e)=>'登出失败') + OpenIM.iMManager.userManager.setSelfInfo( + nickname: '', // 昵称 + faceURL: '', // 头像 + gender: 0, // 性别: 男1,女0 + phoneNumber: '', // 手机号 + email: '', //邮箱 + birth: 0, //生日 + ex: '', // 其他信息 + ); ``` -## 1.5. getLoginStatus - -获取当前用户登录状态。 +- ##### getAllConversationList(获取所有会话) ``` -OpenIM.iMManager.getLoginStatus(); + OpenIM.iMManager.conversationManager.getAllConversationList().then((list) { + // List 会话列表 + }); ``` -## 1.6. getLoginUid - -获取当前登录用户ID。 +- ##### getConversationListSplit(分页获取会话) ``` -var uid = await OpenIM.iMManager.getLoginUid() +OpenIM.iMManager.conversationManager.getConversationListSplit( + offset: 0, // 偏移量,如:第1页,offet:0,count:20;第2页:offset:20; + count: 0, // 每页数量 + ).then((list) { + // List 会话列表 + }); ``` -## 1.7. getLoginUserInfo - -获取当前登录用户的信息 +- ##### getOneConversation(获取一个会话,如果不存在会自动创建) ``` -var userInfo = await OpenIM.iMManager.getLoginUserInfo(); +OpenIM.iMManager.conversationManager.getOneConversation( + sourceID: "", // 如果是单聊值传userID,如果是群聊groupID + sessionType: 1, // 如果是单聊值传1,如果是群聊值传2 + ).then((info) { + // 会话信息 + }); ``` -## 1.8. setSelfInfo - -修改当前登录用户信息 +- ##### getMultipleConversation(根据会话id查询会话) ``` -var result = await OpenIM.iMManager.setSelfInfo() + OpenIM.iMManager.conversationManager.getMultipleConversation( + conversationIDList: [], // 会话ID集合 + ).then((list) { + // 返回与id匹配的会话列表 + }); ``` -参数说明: +- ##### deleteConversation(根据会话id删除指定会话) -| 名称 | 类型 | 描述 | -| ------ | ------ | -------- | -| name | String | 用户名 | -| icon | String | 头像 | -| gender | int | 性别 | -| mobile | String | 手机号 | -| birth | String | 年龄 | -| email | String | 邮箱 | -| ex | String | 附加信息 | - -## 1.9. enabledSDKLog - -sdk日志管理 +会触onTotalUnreadMessageCountChanged回调 ``` -OpenIM.iMManager.enabledSDKLog(enabled: false); +OpenIM.iMManager.conversationManager.deleteConversation( + conversationID: "", // 会话id + ).then((_) { + // 成功 + }).catchError((_){ + // 失败 + }); ``` +- ##### setConversationDraft(设置会话草稿) +会触onConversationChanged回调 -# 2. 用户资料 - -## 2.1. getUsersInfo - -根据用户ID批量获取用户信息 - -``` -List list = await OpenIM.iMManager.getUsersInfo(uidList); -``` - -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------- | -------------- | ---------- | -| uidList | List< String > | 用户ID集合 | - -- 返回值说明: - -| 类型 | 描述 | -| ----------------------- | ------------ | -| Future> | 用户信息列表 | - - - -# 3. 消息 - -## 3.1. addAdvancedMsgListener - -添加消息监听 - -``` - OpenIM.iMManager.messageManager.addAdvancedMsgListener(OnAdvancedMsgListener( - onRecvC2CReadReceipt: (List list) {}, - onRecvMessageRevoked: (String msgId) {}, - onRecvNewMessage: (Message msg) {}, - )); ``` - -| 事件回调 | 事件描述 | 推荐操作 | -| -------------------- | -------------- | ---------------- | -| onRecvMessageRevoked | 消息成功撤回 | 从界面移除消息 | -| onRecvC2CReadReceipt | 消息被阅读回执 | 将消息标记为已读 | -| onRecvNewMessage | 收到新消息 | 界面添加新消息 | - -## 3.2. setMsgSendProgressListener - -消息发送进度监听,主要用途:图片,视频,文件等上传进度监听。 - -``` - OpenIM.iMManager.messageManager.setMsgSendProgressListener( - OnMsgSendProgressListener(onProgress: (String msgID, int progress) { - // 根据消息id(clientMsgID),判断图片等上传进度 - })); -``` - -## 3.3. sendMessage - -发送消息 - -``` -OpenIM.iMManager.messageManager.sendMessage( - message: message, - userID: userId, - groupID: groupId, -) -.then((value){ - // 发送成功 -}) -.catchError((e){ - // 发送失败 -}) -``` - -- 参数说明: - -| 名称 | 类型 | 描述 | -| -------------- | ------- | ------------------ | -| message | Message | 创建的消息结构体 | -| userID | String | 单聊对象的用户id | -| groupID | String | 群聊id | -| onlineUserOnly | Bool | 是否仅在线用户接收 | - -注:如果一对一聊天 userID不能为空。如果群聊天groupID不能为空。如果消息发送成功执行then方法,发送失败执行catchError方法。 - -## 3.4. getHistoryMessageList - -获取聊天记录 - -``` -OpenIM.iMManager.messageManager.getHistoryMessageList( - userID: '单聊对象id', - groupID: '群聊群id', - count: '获取的条数', - startMsg:'从哪一个消息开始' -) +OpenIM.iMManager.conversationManager.setConversationDraft( + conversationID: "", // 会话id + draftText: "", // 草稿 + ).then((_) { + // 成功 + }).catchError((_){ + // 失败 + }); ``` -- 参数说明: +- ##### pinConversation(置顶会话) -| 名称 | 类型 | 描述 | -| -------- | ------- | ---------------- | -| userID | String | 单聊对象的用户id | -| groupID | String | 群聊id | -| count | int | 拉取的条数 | -| startMsg | Message | 从哪一个消息开始 | - -注:startMsg:如第一次拉取20条记录 startMsg=null && count=20 得到List< Message> list;下一次拉取消息记录参数:startMsg=list.first && count =20;以此内推,startMsg始终为list的第一条。 - -## 3.5. revokeMessage - -撤回消息 +会触onConversationChanged回调 ``` -OpenIM.iMManager.messageManager.revokeMessage(message: message) +OpenIM.iMManager.conversationManager.pinConversation( + conversationID: "", // 会话id + isPinned: true, // true:置顶;false:取消置顶 + ).then((_) { + // 成功 + }).catchError((_){ + // 失败 + }); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------- | ------- | -------------- | -| message | Message | 被撤回的消息体 | - -注:调用此方法会触发消息撤回回调,可以在回调里移除界面上的消息显示。也会触发新增消息回调,新增的消息类型为撤回消息类型,可以在界面显示一条xx撤回了一条消息 - -## 3.6. deleteMessageFromLocalStorage +- ##### markGroupMessageHasRead(标记群会话已读,清除未读数) -删除本地消息。 +会触onConversationChanged、onTotalUnreadMessageCountChanged回调 ``` -OpenIM.iMManager.messageManager.deleteMessageFromLocalStorage(message); +OpenIM.iMManager.conversationManager.markGroupMessageHasRead( + groupID: "", // 组id + ); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------- | ------- | ---------------- | -| message | Message | 被删除的消息对象 | - -## 3.7. insertSingleMessageToLocalStorage - -插入一条消息到本地。 +- ##### getTotalUnreadMsgCount(获取未读消息总数) ``` -OpenIM.iMManager.messageManager.insertSingleMessageToLocalStorage( - userID: '接收者ID', - message: '消息结构体', - sender: '发送者ID' -) +OpenIM.iMManager.conversationManager.getTotalUnreadMsgCount().then((count){ + // 总数 +}); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| -------- | ------- | ---------- | -| recevier | String | 接收者ID | -| sender | String | 发送者ID | -| message | Message | 消息结构体 | - -## 3.8. findMessages - -根据消息ID查找本地消息。 +- ##### getConversationIDBySessionType(查询会话id) ``` -OpenIM.iMManager.messageManager.findMessages(messageIDList: [id1,di2]) + OpenIM.iMManager.conversationManager.getConversationIDBySessionType( + sourceID: "", // 如果是单聊值传userID,如果是群聊groupID + sessionType: 1, // 如果是单聊值传1,如果是群聊值传2 + ).then((conversationID){ + // 会话ID + }); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------------- | ------------- | ------------------------- | -| messageIDList | List< String> | 消息id(clientMsgID)集合 | - -## 3.9. markC2CMessageAsRead - -标记接收的消息为已读 +- ##### setConversationRecvMessageOpt(设置免打扰模式) ``` -OpenIM.iMManager.messageManager.markC2CMessageAsRead( - userID: userID, - messageIDList: [msgId1,msgId2,..], -) +OpenIM.iMManager.conversationManager.setConversationRecvMessageOpt( + conversationIDList: [], // 会话id列表 + status: 1, // 1:不接受消息;2:接受在线消息不接受离线消息;0:正常 + ).then((_) { + // 成功 + }).catchError((_){ + // 失败 + }); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------------- | ------------- | ------------------------ | -| userID | String | 单聊对象的用户id | -| messageIDList | List< String> | 被标记为已读消息的消息id | - -注:单聊使用此功能,调用此方法会触发对方的c2c消息已读回调,可以在回调里修改界面上的消息已读状态 - -## 3.10. typingStatusUpdate - -提示用户正在输入 +- ##### getConversationRecvMessageOpt(查询免打扰状态) ``` -OpenIM.iMManager.messageManager.typingStatusUpdate( - userID: uid, - typing: true, -) -``` - -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------ | ------ | ----------------------------------- | -| userID | String | 单聊对象的用户id | -| typing | Bool | typing:true正在输入,false停止输入 | - -注:单聊使用此功能,在收到的新消息回调里如果消息类型为typing消息且typing == 'yes'提示正在输入。typing=='no'取消提示 - -## 3.11. createTextMessage - -创建一条文字消息。 - -``` -Message message = await OpenIM.iMManager.messageManager.createTextMessage( - text: '这里是消息内容', -) -``` - -- 参数说明: - -| 名称 | 类型 | 描述 | -| ---- | ------ | -------- | -| text | String | 消息内容 | - -返回值说明: - -| 类型 | 描述 | -| ---------------- | -------- | -| Future< Message> | 消息对象 | - -## 3.12. createTextAtMessage - -创建一条@消息 - -``` -Message message = await OpenIM.iMManager.messageManager.createTextAtMessage( - text: '消息内容', - atUidList: [uid1,uid2,...], -); +OpenIM.iMManager.conversationManager.getConversationRecvMessageOpt( + conversationIDList: [], // 会话id列表 + ).then((list) { + // 返回列表 [{"conversationId":"single_13922222222","result":0}] + // result: 1:不接受消息;2:接受在线消息不接受离线消息;0:正常 + }); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| --------- | ------------- | ---------------- | -| text | String | 消息内容 | -| atUidList | List< String> | 选择的用户id集合 | - -## 3.13. createImageMessage - -创建图片消息 +- ##### simpleSort(自定义会话排序规则) ``` -Message message = await OpenIM.iMManager.messageManager.createImageMessage( - imagePath: '图片的相对路径', -) +var list = OpenIM.iMManager.conversationManager.simpleSort([]);// 返回排序好的列表 ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| --------- | ------ | -------------- | -| imagePath | String | 图片的相对路径 | - -注:initSDK时传入了数据缓存路径,如路径:A,这时需要你将图片复制到A路径下后,如 A/pic/a.png路径,imagePath的值:“/pic/a.png”。 - -## 3.14. createImageMessageFromFullPath - -创建图片消息(绝对路径) +- ##### getFriendsInfo(根据userID查询好友资料) ``` -Message message = await OpenIM.iMManager.messageManager.createImageMessageFromFullPath( - imagePath: path, -) + OpenIM.iMManager.friendshipManager.getFriendsInfo( + uidList: [], // userId列表 + ).then((list) { + // List + }); ``` -- 参数说明: +- ##### addFriend(发起好友申请) -| 名称 | 类型 | 描述 | -| --------- | ------ | ------------------------ | -| imagePath | String | 图片在设备上的的绝对路径 | +主动申请者收到OnFriendApplicationAdded -此方法不需要拷贝,推荐使用。 - -## 3.15. createSoundMessage - -创建语音消息 +被添加者收到OnFriendApplicationAdded ``` -Message message = await OpenIM.iMManager.messageManager.createSoundMessage( - soundPath: '相对路径', - duration: '语音时长,单位秒', -) + OpenIM.iMManager.friendshipManager.addFriend( + uid: "", // 用户id + reason: '', // 发起好友申请的描述信息 + ).then((_) { + // 成功 + }).catchError((_){ + // 失败 + }); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| --------- | ------ | ---------------- | -| soundPath | String | 相对路径 | -| duration | int | 语音时长,单位秒 | - -注:initSDK时传入了数据缓存路径,如路径:A,这时需要你将语音文件复制到A路径下后,如 A/sound/a.m4a路径,soundPath的值:“/sound/a.m4a”。 - -## 3.16. createSoundMessageFromFullPath - -创建语音消息(绝对路径) +- ##### checkFriend(检查是否是好友) ``` -Message message = await OpenIM.iMManager.messageManager.createSoundMessageFromFullPath( - soundPath: '在设备上的的实际路径', - duration: '语音时长,单位秒', -) +OpenIM.iMManager.friendshipManager.checkFriend( + uidList: [], // userID 列表 + ).then((list) { + // List + }); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| --------- | ------ | -------------------- | -| soundPath | String | 在设备上的的绝对路径 | -| duration | int | 语音时长,单位秒 | - -此方法不需要拷贝,推荐使用。 +- ##### deleteFriend(删除好友) -## 3.17. createVideoMessage - -创建视频消息 +操作者收到OnFriendDeleted ``` -Message message = await OpenIM.iMManager.messageManager.createVideoMessage( - videoPath: '相对路径', - videoType: '文件的mineType', - duration: '视频时长,单位秒', - snapshotPath: '视频的缩略图', -) +OpenIM.iMManager.friendshipManager.deleteFriend( + uid: '', // userID + ).then((_) { + // 成功 + }).catchError((_){ + // 失败 + }); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------------ | ------ | ---------------- | -| videoPath | String | 相对路径 | -| videoType | String | 文件的mineType | -| duration | int | 视频时长,单位秒 | -| snapshotPath | String | 视频的缩略图 | +- ##### setFriendRemark(好友备注设置) -注:initSDK时传入了数据缓存路径,如路径:A,这时需要你将视频文件复制到A路径下后,如 A/video/a.mp4路径,videoPath的值:“/video/a.mp4” - -## 3.18. createVideoMessageFromFullPath - -创建视频消息(绝对路径) +操作者收到OnFriendInfoChanged ``` -Message message = await OpenIM.iMManager.messageManager.createVideoMessageFromFullPath( - videoPath: '在设备上的的实际路径', - videoType: '文件的mineType', - duration: '视频时长,单位秒', - snapshotPath: '视频的缩略图', -) + OpenIM.iMManager.friendshipManager.setFriendRemark( + uid: '', // 好友userID + remark: '', // 备注名 + ).then((_) { + // 成功 + }).catchError((_){ + // 失败 + }); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------------ | ------ | -------------------- | -| videoPath | String | 在设备上的的绝对路径 | -| videoType | String | 文件的mineType | -| duration | int | 视频时长,单位秒 | -| snapshotPath | String | 视频的缩略图 | - -此方法不需要拷贝,推荐使用。 - -## 3.19. createFileMessage +- ##### getFriendList(好友列表) -创建文件消息 +返回的数据里包含已拉入黑名单的好友,可以根据isBlacklist字段筛选。 ``` -Message message = await OpenIM.iMManager.messageManager.createFileMessage( - filePath: '相对路径', - fileName: '文件名', -); +OpenIM.iMManager.friendshipManager.getFriendList().then((list){ + // List 好友信息列表 +}); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| -------- | ------ | -------- | -| filePath | String | 相对路径 | -| fileName | String | 文件名 | - -注:initSDK时传入了数据缓存路径,如路径:A,这时需要你将视频文件复制到A路径下后,如 A/file/a.txt路径,filePath的值:“/file/a.txt” - -## 3.20. createFileMessageFromFullPath - -创建文件消息(绝对路径) +- ##### getRecvFriendApplicationList(收到的好友申请) ``` -Message message = await OpenIM.iMManager.messageManager.createFileMessageFromFullPath( - filePath: '在设备上的的绝对路径', - fileName: '文件名', -) + OpenIM.iMManager.friendshipManager.getRecvFriendApplicationList().then((list) { + // List 申请列表 + }); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| -------- | ------ | -------------------- | -| filePath | String | 在设备上的的绝对路径 | -| fileName | String | 文件名 | - -此方法不需要拷贝,推荐使用。 - -## 3.21. createMergerMessage - -创建合并消息 +- ##### getSendFriendApplicationList(发出的好友申请) ``` -Message message = await OpenIM.iMManager.messageManager.createMergerMessage( - messageList: '被选中的消息', - title: '标题', - summaryList: '摘要', -) +OpenIM.iMManager.friendshipManager.getSendFriendApplicationList().then((list){ + // List 申请列表 + }); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ----------- | -------------- | ---------------- | -| title | String | 标题 | -| summaryList | List< String> | 摘要 | -| messageList | List< Message> | 被选中的消息集合 | - -## 3.22. createForwardMessage +- ##### addBlacklist(拉黑好友) -创建转发消息 +操作者收到OnBlackAdded ``` -Message message = await OpenIM.iMManager.messageManager.createForwardMessage( - message: '被转发的Message', -) + OpenIM.iMManager.friendshipManager.addBlacklist( + uid: "", // 好友userID + ).then((_) { + // 成功 + }).catchError((_){ + // 失败 + }); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------- | ------- | ----------------------- | -| message | Message | 被选择转发的Message对象 | - -## 3.23. createLocationMessage - -创建位置消息 +- ##### getBlacklist(黑名单) ``` -Message message = await OpenIM.iMManager.messageManager.createLocationMessage( - latitude: ’纬度‘, - longitude: ’经度‘, - description: ’描述信息,可以根据自己的需求传任何数据‘, -) +OpenIM.iMManager.friendshipManager.getBlacklist().then((list){ + // List + }); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ----------- | ------ | -------------------------------------- | -| latitude | double | 纬度 | -| longitude | double | 经度 | -| description | String | 描述信息,可以根据自己的需求传任何数据 | - -description:在位置消息展示时,有位置名,位置描述,定位图片信息。推荐 description:{"title":"天府新谷","detail":"四川省高新区石羊街道府城大道西段399号","url":"https://apis.map.qq.com/ws/staticmap/v2/?center=%s&zoom=18&size=600*300&maptype=roadmap&markers=size:large|color:0xFFCCFF|label:k|%s&key=TMNBZ-3CGC6-C6SSL-EJA3B-E2P5Q-V7F6Q"} +- ##### removeBlacklist(移除黑名单) -## 3.24. createCustomMessage - -创建自定义消息 +操作者收到OnBlackDeleted ``` -OpenIM.iMManager.messageManager.createCustomMessage( - data: '自定义数据', - extension: '自定义数据', - description: '自定义数据', -) +OpenIM.iMManager.friendshipManager.removeBlacklist( + uid: "", // userID + ).then((_) { + // 成功 + }).catchError((_){ + // 失败 + }); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ----------- | ------ | -------------- | -| data | String | 自定义数据数组 | -| extension | String | 自定义数据数组 | -| description | String | 自定义数据 | +- ##### acceptFriendApplication(接受好友申请) -## 3.25. createQuoteMessage +操作者收到OnFriendApplicationAccepted、OnFriendAdded -创建引用消息 +申请者收到OnFriendApplicationAccepted、OnFriendAdded ``` -Message message = await OpenIM.iMManager.messageManager.createQuoteMessage( - text: '消息内容', - quoteMsg: '被引用的消息对象Message', -) +OpenIM.iMManager.friendshipManager.acceptFriendApplication( + uid: "", // userID + handleMsg: '', // 备注信息 + ).then((_) { + // 成功 + }).catchError((_){ + // 失败 + }); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| -------- | ----------- | ----------------------- | -| text | String | 消息内容 | -| quoteMsg | Message对象 | 被引用的消息对象Message | +- ##### refuseFriendApplication(拒绝好友申请) -## 3.26 . createCardMessage +操作者收到OnFriendApplicationRejected -创建名片消息 +申请者收到OnFriendApplicationRejected ``` -Message message = await OpenIM.iMManager.messageManager.createCardMessage( - data: '用户信息Map', -) + OpenIM.iMManager.friendshipManager.refuseFriendApplication( + uid: "", // userID + handleMsg: '', // 备注信息 + ).then((_) { + // 成功 + }).catchError((_){ + // 失败 + }); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ---- | ---- | ------------------------------------------------------------ | -| data | Map | 如{"uid": uid, 'name': name, 'icon': icon},按需求自定义内容。 | - -## 3.27. clearC2CHistoryMessage +- ##### inviteUserToGroup(邀请进组) -清空单聊记录 +直接进组无需同意。 -``` - OpenIM.iMManager.messageManager.clearC2CHistoryMessage(uid: 'uid'); -``` - -## 3.28. clearGroupHistoryMessage +被邀请者收到OnJoinedGroupAdded -清空群聊记录 +群成员(不包括被邀请者)收到OnGroupMemberAdded ``` - OpenIM.iMManager.messageManager.clearGroupHistoryMessage(gid: 'gid'); + OpenIM.iMManager.groupManager.inviteUserToGroup( + groupId: '', // 组ID + uidList: [], // 成员 userID 列表 + reason: '', // 备注信息 + ).then((list){ + // List + }); +} ``` +- ##### kickGroupMember(移除组成员) +被踢者收到OnJoinedGroupDeleted -# 4. 会话 - -## 4.1. setConversationListener - -设置会话监听器,会话记录发生改变时回调。 +群成员收到OnGroupMemberDeleted ``` - OpenIM.iMManager.conversationManager.setConversationListener( - OnConversationListener( - onConversationChanged: (List list) {}, - onNewConversation: (List list) {}, - onSyncServerFailed: () {}, - onSyncServerFinish: () {}, - onSyncServerStart: () {}, - onTotalUnreadMessageCountChanged: (int count) {}, - ), - ); +OpenIM.iMManager.groupManager.kickGroupMember( + groupId: '', // 组ID + uidList: [], // 成员 userID 列表 + reason: '', // 备注信息 +).then((list){ + // List + }); ``` -| 事件回调 | 事件描述 | 推荐操作 | -| -------------------------- | -------------------- | -------------- | -| conversationChanged | 会话记录发生改变 | 更新会话列表 | -| newConversation | 有新的会话被添加 | 更新会话列表 | -| totalUnreadMsgCountChanged | 未读消息总数发生改变 | 更新消息未读数 | - -## 4.2. getAllConversationList - -拉取当前所有的会话记录 +- ##### getGroupMembersInfo(查询组成员信息) ``` -List list = await OpenIM.iMManager.conversationManager.getAllConversationList() +OpenIM.iMManager.groupManager.getGroupMembersInfo( + groupId: '', // 组ID + uidList: [], // 成员 userID 列表 +).then((list){ + // List +}); ``` -## 4.3. getConversationListSplit - -分页获取会话列表 +- ##### getGroupMemberList(组成员列表) ``` - OpenIM.iMManager.conversationManager.getConversationListSplit(offset: offest,count: count) +OpenIM.iMManager.groupManager.getGroupMemberList( + groupId: '', // 组ID + filter: 0, // 1普通成员, 2群主,3管理员 + offset: 0, // 偏移量,每次开始的index值 + count: 0, // 每次拉取的数量 +).then((list){ + // List +}); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------ | ---- | --------------------------------------------------- | -| offest | int | 偏移量,默认0。如第一次拉取20条,下一次的offset为20 | -| count | int | 当前拉取的数量 | - -## 4.4. getOneConversation - -根据用户ID或群聊ID和session类型获取单个会话。会话不存在的情况下会创建一个空会话 +- ##### getJoinedGroupList(获取已加入的群组) ``` -ConversationInfo info = await OpenIM.iMManager.conversationManager.getSingleConversation( - sourceID: sourceID, - sessionType: sessionType, -) +OpenIM.iMManager.groupManager.getJoinedGroupList().then((list){ + // List +}); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ----------- | ------ | ------------------------------------------------------------ | -| sourceID | String | 如果是单聊其值为单聊对象的userId;如果是群聊其值为群的groupId | -| sessionType | String | 如果是单聊sessionType=1;群聊sessionType=2 | - -## 4.5. getMultipleConversation - -根据会话ID获取多个会话。 +- ##### isJoinedGroup(检查是否已入群) ``` -List list = await OpenIM.iMManager.conversationManager.getMultipleConversation( conversationIDList: conversationIDList); +OpenIM.iMManager.groupManager.isJoinedGroup( + gid: '', // 组ID +).then((joned) { + // true已加入;false未加入 +}); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------------------ | ------------- | ------------ | -| conversationIDList | List< String> | 会话的id集合 | - -## 4.6. deleteConversation +- ##### createGroup(创建组) -删除会话,执行此操作会触发会话记录发生改变回调。 +初始成员收到OnJoinedGroupAdded ``` -OpenIM.iMManager.conversationManager.deleteConversation(conversationID: conversationID,); -``` - -- 参数说明: - -| 名称 | 类型 | 描述 | -| -------------- | ------ | -------------- | -| conversationID | String | 被删除的会话id | - -## 4.7. setConversationDraft - -设置草稿,执行此操作会触发会话记录发生改变回调。 - -``` -OpenIM.iMManager.conversationManager.setConversationDraft( - conversationID: conversationID, - draftText: draftText, +OpenIM.iMManager.groupManager.createGroup( + groupName: '', // 组名 + faceUrl: '', // 头像 + notification: '', // 群公告 + introduction: '', // 群简介 + groupType: 0, // 类型 + ex: '', // 扩展信息 + list: [], // 成员角色集合 List +).then((groupInfo){ + // 返回组信息 GroupInfo +}); +``` + +- ##### setGroupInfo(修改组信息) + +群成员收到OnGroupInfoChanged + +``` +OpenIM.iMManager.groupManager.setGroupInfo( + groupID: '', + groupName: '', // 组名 + faceUrl: '', // 头像 + notification: '', // 群公告 + introduction: '', // 群简介 + ex: '', // 扩展信息 ); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| -------------- | ------ | -------------------- | -| draftText | String | 未完成发送的消息内容 | -| conversationID | String | 会话id | - -## 4.8. pinConversation - -置顶会话,执行此操作会触发会话记录发生改变回调。 - -``` -OpenIM.iMManager.conversationManager.pinConversation(conversationID: conversationID, isPinned: true,); -``` - -- 参数说明: - -| 名称 | 类型 | 描述 | -| -------------- | ------ | --------------------------- | -| isPinned | bool | true:置顶,false:取消置顶 | -| conversationID | String | 会话id | - -注:ConversationInfo对象里的isPinned字段,isPinned==1代表置顶 - -## 4.9. markSingleMessageHasRead - -标记单聊会话消息为已读。 - -``` -OpenIM.iMManager.conversationManager.markSingleMessageHasRead(userID: userID) -``` - -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------ | ------ | ---------- | -| userID | String | 单聊用户id | - -## 4.10. markGroupMessageHasRead - -标记群聊会话消息已读。 - -``` -OpenIM.iMManager.conversationManager.markGroupMessageHasRead(groupID: groupID) -``` - -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------- | ------ | ------ | -| groupID | String | 群组id | - -## 4.11. getTotalUnreadMsgCount - -获取消息总未读。 - -``` -int count = await OpenIM.iMManager.conversationManager.getTotalUnreadMsgCount(); -``` - -## 4.12. getConversationID - -获取会话ID - -``` -OpenIM.iMManager.conversationManager.getConversationID( - sourceID: sourceID, - sessionType: sessionType -) -``` - -- 参数说明: - -| 名称 | 类型 | 描述 | -| ----------- | ------ | ------------------------------------------------------------ | -| sourceID | String | 如果是单聊其值为单聊对象的userId;如果是群聊其值为群的groupId | -| sessionType | String | 如果是单聊sessionType=1;群聊sessionType=2 | - -## 4.13. setConversationRecvMessageOpt - -设置会话消息免打扰 - -``` -OpenIM.iMManager.conversationManager.conversationIDList( - conversationIDList: conversationIDList, - status: status -) -``` - -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------------------ | ------------ | --------------------------------------------------- | -| conversationIDList | List | 会话id列表 | -| status | int | 1:不接受消息和推送;2:接受消息但没有推送;0:正常 | - -## 4.14. getConversationRecvMessageOpt - -获取会话消息免打扰状态 +- ##### getGroupsInfo(根据id查询组信息) ``` -OpenIM.iMManager.conversationManager.getConversationRecvMessageOpt( - conversationIDList: conversationIDList, -) +OpenIM.iMManager.groupManager.getGroupsInfo( + gidList: [], // 组id集合 +).then((list){ + // List +}); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------------------ | ------------ | ---------- | -| conversationIDList | List | 会话id列表 | +- ##### joinGroup(申请入群组) +需要通过管理员同意。 +申请者收到OnGroupApplicationAdded -# 5.好友关系 - -## 5.1. setFriendListener - -设置好友监听器。 +群主+管理员收到OnGroupApplicationAdded ``` - OpenIM.iMManager.friendshipManager.setFriendshipListener(OnFriendshipListener( - onBlackListAdd: (UserInfo u) {}, - onBlackListDeleted: (UserInfo u) {}, - onFriendApplicationListAccept: (UserInfo u) {}, - onFriendApplicationListAdded: (UserInfo u) {}, - onFriendApplicationListDeleted: (UserInfo u) {}, - onFriendApplicationListReject: (UserInfo u) {}, - onFriendInfoChanged: (UserInfo u) {}, - onFriendListAdded: (UserInfo u) {}, - onFriendListDeleted: (UserInfo u) {}, - )); +OpenIM.iMManager.groupManager.joinGroup( + gid: '', // 组id + reason: '', // 入群备注信息 +); ``` -| 事件回调 | 事件描述 | 推荐操作 | -| ---------------------------- | ---------------------- | ---------------------------------- | -| blackListAdd | 好友被加入黑名 | 刷新好友列表或黑名单列表 | -| blackListDeleted | 好友从黑名单移除 | 刷新好友列表或黑名单列表 | -| friendApplicationListAccept | 发起的好友请求被接受 | 刷新好友请求列表 | -| friendApplicationListAdded | 别人向我发起了好友请求 | 刷新好友请求列表 | -| friendApplicationListDeleted | 好友申请被删除 | 刷新好友请求列表 | -| friendApplicationListReject | 请求被拒绝 | 刷新好友请求列表 | -| friendInfoChanged | 好友资料发生变化 | 刷新好友列表,好友信息或黑名单列表 | -| friendListAdded | 已成为好友 | 刷新好友列表 | -| friendListDeleted | 好友被删除 | 刷新好友列表 | +- ##### quitGroup(退出组) -## 5.2. getFriendsInfo +退出者收到OnJoinedGroupDeleted -获取好友信息。 +群成员收到OnGroupMemberDeleted ``` -List list = await OpenIM.iMManager.friendshipManager.getFriendsInfo(uidList: uidList) +OpenIM.iMManager.groupManager.quitGroup( + gid: '', // 组id +).then((_) { + // 成功 + }).catchError((_){ + // 失败 + }); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------- | ------------- | ------------ | -| uidList | List< String> | 用户的ID集合 | - -## 5.3. addFriend - -发起添加好友申请。 +- ##### transferGroupOwner(群转让) ``` -OpenIM.iMManager.friendshipManager.addFriend(uid: uid, reason: reason); +OpenIM.iMManager.groupManager.transferGroupOwner( + gid: '', // 组ID + uid: '', // 新 owner userID +).then((_) { + // 成功 + }).catchError((_){ + // 失败 + }); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------ | ------ | -------- | -| uid | String | 用户的ID | -| reason | String | 添加说明 | - -返回Future,执行then方法为添加成功,执行cathError方法为添加失败。 +- ##### getRecvGroupApplicationList(收到的入群申请) -## 5.4. getFriendList - -获取好友列表。返回的数据包含了黑名单。 +作为群主或者管理员,获取收到的群成员申请进群列表。 ``` -List list = await OpenIM.iMManager.friendshipManager.getFriendList(); +OpenIM.iMManager.groupManager.getRecvGroupApplicationList().then((list){ + // List +}); ``` -## 5.5. setFriendInfo - -设置好友备注信息。 +- ##### getSendGroupApplicationList(发出的入群申请) ``` -OpenIM.iMManager.friendshipManager.setFriendInfo(uid: uid, comment: '备注') +OpenIM.iMManager.groupManager.getSendGroupApplicationList().then((list){ + // List +}); ``` -- 参数说明: +- ##### acceptGroupApplication(接受入群申请) -| 名称 | 类型 | 描述 | -| ------- | ------ | -------- | -| uid | String | 用户的ID | -| comment | String | 备注 | +申请者收到OnJoinedGroupAdded OnGroupApplicationAccepted -## 5.6. checkFriend +群成员(不包括申请者)收到OnGroupMemberAdded -检查与用户间是否有好友关系。 +审批者(群主或者管理员)收到OnGroupMemberAdded OnGroupApplicationAccepted ``` -List list = await OpenIM.iMManager.friendshipManager.checkFriend([id1,id2, ...]); +OpenIM.iMManager.groupManager.acceptGroupApplication( + gid: '', // 组ID + uid: '', // 申请人userID + handleMsg: '', // 备注信息 +); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------- | ------------- | ------------ | -| uidList | List< String> | 用户的ID集合 | - -根据类UserInfo的flag字段判断。flag == 1:是好友关系,其他非好友关系。 +- ##### refuseGroupApplication(拒绝入群申请) -## 5.7. deleteFromFriendList +申请者收到OnGroupApplicationRejected -从好友列表中删除用户。 +审批者(群主或者管理员)收到OnGroupApplicationRejected ``` -OpenIM.iMManager.friendshipManager.deleteFromFriendList(uid: uid); +OpenIM.iMManager.groupManager.refuseGroupApplication( + gid: '', // 组ID + uid: '', // 申请人userID + handleMsg: '', // 备注信息 +); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ---- | ------ | -------- | -| uid | String | 用户的ID | - -返回Future,执行then方法为删除成功,执行cathError方法为删除失败。 - -## 5.8. getFriendApplicationList - -获取好友请求列表。 +- ##### sendMessage(发送消息) ``` -List list = await OpenIM.iMManager.friendshipManager.getFriendApplicationList(); +OpenIM.iMManager.messageManager.sendMessage( + message: Message(), // 消息体 + userID: '', // 接受消息的userID + groupID: '', // 接受消息的群ID + offlinePushInfo: OfflinePushInfo(), // 离线推送的消息备注 +).then((_) { + // 成功 + }).catchError((_){ + // 失败 + }); ``` -类UserInfo的flag字段:flag == 0:等待处理;flag == 1:已添加;flag == -1:已拒绝。 - -注:新朋友的红点数通过计算列表里flag == 0的item的数量。 - -## 5.9. acceptFriendApplication - -接受好友请求。 +- ##### getHistoryMessageList(获取聊天记录) ``` -OpenIM.iMManager.friendshipManager.acceptFriendApplication(uid: uid) +OpenIM.iMManager.messageManager.getHistoryMessageList( + userID: '', // 单聊对象的userID + groupID: '', // 群聊的组id + startMsg: null, // 消息体 + count: 0, // 每次拉取的数量 +).then((list){ + // List +}); ``` -uid:为好友申请列表返回的数据里UserInfo类的uid字段。 +注:消息列表list,index == list.length -1 是最新的一条消息。 index == 0 是从最新的这条记录后的第19条。所以startMsg首次传null, -返回Future,执行then方法为操作成功,执行cathError方法为操作失败。 +下次就是list.first(index == 0),以此类推。 -## 5.10. refuseFriendApplication +- ##### revokeMessage(撤回消息) -拒绝好友请求。 +撤回成功需要当前用户从列表里移除Message然后更新ui,而另外一方通过撤回监听(onRecvMessageRevoked)移除。 ``` -OpenIM.iMManager.friendshipManager.refuseFriendApplication(uid: uid) +OpenIM.iMManager.messageManager.revokeMessage( + message: Message(), // 消息体 +).then((_) { + // 成功 + }).catchError((_){ + // 失败 + }); ``` -返回Future,执行then方法为操作成功,执行cathError方法为操作失败。 - -## 5.11. addToBlackList - -将用户添加到黑名单。 +- ##### deleteMessageFromLocalStorage(删除单条消息) ``` -OpenIM.iMManager.friendshipManager.addToBlackList(uid: uid) +OpenIM.iMManager.messageManager.deleteMessageFromLocalStorage( + message: Message(), +).then((_) { + // 成功,从列表里移除Message,然后更新ui + }).catchError((_){ + // 失败 + }); ``` -返回Future,执行then方法为操作成功,执行cathError方法为操作失败。 - -## 5.12. deleteFromBlackList - -从黑名单移除用户。 +- ##### insertSingleMessageToLocalStorage(向本地插入一条消息) ``` -OpenIM.iMManager.friendshipManager.deleteFromBlackList(uid: uid); +OpenIM.iMManager.messageManager.insertSingleMessageToLocalStorage( + receiverID: '', // 接收者userID + senderID: '', // 发送者userID + message: Message(), // 消息体 +); ``` -返回Future,执行then方法为操作成功,执行cathError方法为操作失败。 +- ##### markC2CMessageAsRead(标记c2c消息已读) -## 5.13. getBlackList - -获取黑名单列表。 +当调用此方法后,已读的消息会通过已读回执(onRecvC2CReadReceipt)告诉对方。 ``` -List list = await OpenIM.iMManager.friendshipManager.getBlackList(); +OpenIM.iMManager.messageManager.markC2CMessageAsRead( + userID: '', // 接收者 userID + messageIDList: [], // 已读的消息id列表 +); ``` -注:如果好友被拉进黑名单,调用getFriendList 或 getFriendListMap方法得到好友包含了黑名单的人,需要通过UserInfo类的isInBlackList字段筛选,如果isInBlackList == 1说明被拉入黑名单。 - - +- ##### typingStatusUpdate(正在输入提示) -# 6. 群关系 - -## 6.1. createGroup - -创建一个群聊,并指定群信息以及群成员。 +会通过onRecvNewMessage回调 ``` -OpenIM.iMManager.groupManager.createGroup( - groupName: groupName, - notification: notification, - introduction: introduction, - faceUrl: faceUrl, - list: roles, -) +OpenIM.iMManager.messageManager.typingStatusUpdate( + userID: '', // 接收者 userID + msgTip: '', // 自定义提示内容 +); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------------ | ---------------------- | ------------------------------------------------------------ | -| groupName | String | 群名 | -| notification | String | 群公告 | -| introduction | String | 群介绍 | -| faceUrl | String | 群icon | -| list | List< GroupMemberRole> | 在发起群聊时选择的群成员列表。
GroupMemberRole类字段说明:setRole:0:普通成员 2:管理员;uid:成员的uid。 | - -## 6.2. getGroupsInfo - -批量获取群组信息。 +- ##### clearC2CHistoryMessage(清空c2c聊天记录) ``` -List list = await OpenIM.iMManager.groupManager.getGroupsInfo(gidList: [gid1,gid2,...]); +OpenIM.iMManager.messageManager.clearC2CHistoryMessage( + uid: "", // userID +).then((_) { + // 成功 + }).catchError((_){ + // 失败 + }); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------- | ------------- | ---------- | -| gidList | List< String> | 群组id集合 | - -## 6.3. setGroupInfo - -设置、更新群聊信息。 +- ##### clearGroupHistoryMessage(清空群聊天记录) ``` -OpenIM.iMManager.groupManager.setGroupInfo( - groupID: groupID, - groupName: groupName, - notification: notification, - introduction: introduction, - faceUrl: faceUrl, -) +OpenIM.iMManager.messageManager.clearGroupHistoryMessage( + gid: '', // 群ID +).then((_) { + // 成功 + }).catchError((_){ + // 失败 + }); ``` -返回Future,执行then方法为操作成功,执行cathError方法为操作失败。 - -## 6.4. getJoinedGroupList - -获取已加入的群列表。 +- ##### createTextMessage(文本消息) ``` -List list = await OpenIM.iMManager.groupManager.getJoinedGroupList(); +var message = await OpenIM.iMManager.messageManager.createTextMessage( + text: '', // 发送的内容 +); ``` -如果类GroupInfo的ownerId字段的值跟当前用户的uid一致,则当前用户就是群的发起者。否则是参与者。 - -## 6.5. getGroupMemberList - -获取群成员列表。 - -GroupMembersList类的nextSeq字段:下一页的开始index。data字段:群成员。 +- ##### createTextAtMessage(@消息) ``` -GroupMembersList value = await OpenIM.iMManager.groupManager.getGroupMemberList( - groupId: gid, - filter:0, - next:0, -) +var message = await OpenIM.iMManager.messageManager.createTextAtMessage( + text: '', // 发送的内容 + atUidList: [], // 被@到的userID集合 + ); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------- | ------ | ------------------------------------------------------------ | -| groupId | String | 群组id | -| filter | int | 过滤成员,0不过滤,1群的创建者,2管理员;默认值0 | -| next | int | 分页,从哪一条开始获取,默认值0。参照GroupMembersList的nextSeq字段的值。 | - -## 6.6. getGroupMembersInfo - -批量获取群成员信息。 +- ##### createImageMessage(图片消息,相对路径) ``` -List list = await OpenIM.iMManager.groupManager.getGroupMembersInfo( - groupId: groupId, - uidList: uidList -) +var message = await OpenIM.iMManager.messageManager.createImageMessage( + imagePath: '', // 相对路径 +); ``` -- 参数说明: +注:initSDK时传入了数据缓存(dataDir)路径,如路径:A,这时需要你将图片复制到A路径下后,如 A/pic/a.png路径,imagePath的值:“/pic/a.png”。同以下其他消息的相对路径。 -| 名称 | 类型 | 描述 | -| ------- | ------------- | ------------ | -| groupId | String | 群组id | -| uidList | List< String> | 群成员ID集合 | - -## 6.7. joinGroup - -申请加入群聊。 +- ##### createImageMessageFromFullPath(图片消息全路径) ``` -OpenIM.iMManager.groupManager.joinGroup(gid: gid, reason: null) +var message = await OpenIM.iMManager.messageManager.createImageMessageFromFullPath( + imagePath: '', // 绝对路径 +); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------ | ------ | ------------ | -| gid | String | 群组id | -| reason | String | 请求验证信息 | - -返回Future,执行then方法为操作成功,执行cathError方法为操作失败。 - -## 6.8. getGroupApplicationList - -获取加入群聊申请列表。 +- ##### createSoundMessage(语音消息,相对路径) ``` -GroupApplicationList list = await OpenIM.iMManager.groupManager.getGroupApplicationList() +var message = await OpenIM.iMManager.messageManager.createSoundMessage( + soundPath: '', // 相对路径 + duration: 0, // 时长s +); ``` -- GroupApplicationList字段说明: - -| 名称 | 类型 | 描述 | -| ----- | --------------------------- | -------- | -| count | int | 未处理数 | -| user | List< GroupApplicationInfo> | 申请列表 | - -## 6.9. acceptGroupApplication - -同意入群请求。 +- ##### createSoundMessageFromFullPath(语音消息全路径) ``` -OpenIM.iMManager.groupManager.acceptGroupApplication(info: info, reason: reason) +var message = await OpenIM.iMManager.messageManager.createSoundMessageFromFullPath( + soundPath: '', // 绝对路径 + duration: 0, // 时长s +); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------ | -------------------- | --------------------- | -| info | GroupApplicationInfo | 取6.8里申请列表的item | -| reason | String | 同意原因 | - -返回Future,执行then方法为操作成功,执行cathError方法为操作失败。 - -## 6.10. refuseGroupApplication - -拒绝入群请求。 +- ##### createVideoMessage(视频消息,相对路径) ``` -OpenIM.iMManager.groupManager.refuseGroupApplication(info: info, reason: reason) +var message = await OpenIM.iMManager.messageManager.createVideoMessage( + videoPath: '', // 相对路径 + videoType: '', // minetype + duration: 0, // 时长s + snapshotPath: '', // 站位缩略图 +); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------ | -------------------- | --------------------- | -| info | GroupApplicationInfo | 取6.8里申请列表的item | -| reason | String | 拒绝入群原因 | - -返回Future,执行then方法为操作成功,执行cathError方法为操作失败。 - -## 6.11. inviteUserToGroup - -邀请用户加入群组(可批量)。 +- ##### createVideoMessageFromFullPath(视频消息全路径) ``` -OpenIM.iMManager.groupManager.inviteUserToGroup( - groupId: gid, - uidList: uidList, - reason: reason, +var message = await OpenIM.iMManager.messageManager.createVideoMessageFromFullPath( + videoPath: '', // 绝对路径 + videoType: '', // minetype + duration: 0, // 时长s + snapshotPath: '', // 站位缩略图 ); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------- | ------------- | ---------------- | -| groupId | String | 群聊ID | -| uidList | List< String> | 邀请用户的id集合 | -| reason | String | 请求验证信息 | - -返回Future,执行then方法为操作成功,执行cathError方法为操作失败。 - -## 6.12. kickGroupMember - -踢出群聊(可批量)。 +- ##### createFileMessage(文件消息,相对路径) ``` -OpenIM.iMManager.groupManager.kickGroupMember( - groupId: gid, - uidList: uidList, - reason: reason, +var message = await OpenIM.iMManager.messageManager.createFileMessage( + filePath: '', // 相对路径 + fileName: '', // 文件名 ); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ------- | ------------- | -------------- | -| groupId | String | 群聊ID | -| uidList | List< String> | 踢出用户ID集合 | -| reason | String | 踢出原因 | - -返回Future,执行then方法为操作成功,执行cathError方法为操作失败。 - -## 6.13. quitGroup - -退出群聊。 +- ##### createFileMessageFromFullPath(文件消息全路径) ``` -OpenIM.iMManager.groupManager.quitGroup(gid: gid) +var message = await OpenIM.iMManager.messageManager.createFileMessageFromFullPath( + filePath: '', // 绝对路径 + fileName: '', // 文件名 +); ``` -返回Future,执行then方法为操作成功,执行cathError方法为操作失败。 - -## 6.14. transferGroupOwner - -转让群主。 +- ##### createForwardMessage(转发消息) ``` -OpenIM.iMManager.groupManager.transferGroupOwner(gid: gid, uid: uid) +var message = await OpenIM.iMManager.messageManager.createForwardMessage( + message: Message(), // 被转发的消息体 +); ``` -- 参数说明: - -| 名称 | 类型 | 描述 | -| ---- | ------ | ------------- | -| gid | String | 群id | -| uid | String | 新的拥有者uid | - -注:此方法只有群的发起者(拥有者)才有权限访问,管理员和普通成员无权限访问。如果是发起者群资料展示可显示群权限转移按钮。 - -## 6.15. setGroupListener - -设置群组监听器。 +- ##### createMergerMessage(合并消息) ``` - OpenIM.iMManager.groupManager.setGroupListener(OnGroupListener( - onApplicationProcessed: (groupId, opUser, agreeOrReject, opReason) {}, - onGroupCreated: (groupId) {}, - onGroupInfoChanged: (groupId, info) {}, - onMemberEnter: (groupId, list) {}, - onMemberInvited: (groupId, opUser, list) {}, - onMemberKicked: (groupId, opUser, list) {}, - onMemberLeave: (groupId, info) {}, - onReceiveJoinApplication: (groupId, info, opReason) {}, - )); +var message = await OpenIM.iMManager.messageManager.createMergerMessage( + messageList: [], // 被转发的消息列表 + title: '', // 标题 + summaryList: [], // 每一条消息摘要 +); ``` -| 事件回调 | 事件描述 | 推荐操作 | -| ---------------------- | -------------- | -------------- | -| applicationProcessed | 群申请被处理 | | -| groupCreated | 群创建完成 | | -| groupInfoChanged | 群资料发生变化 | 刷新群资料 | -| memberEnter | 进群 | 刷新群成员列表 | -| memberInvited | 接受邀请 | 刷新群成员列表 | -| memberKicked | 成员被踢出 | 刷新群成员列表 | -| memberLeave | 群成员退群 | 刷新群成员列表 | -| receiveJoinApplication | 收到入群申请 | | - - - -# 7. 数据对象结构 - -## 7.1. 用户信息对象 +- ##### createLocationMessage(位置消息) ``` -class UserInfo { - String uid; - String? name; - String? icon; - int? gender; - String? mobile; - String? birth; - String? email; - String? ex; - String? comment; - int? isInBlackList; - String? reqMessage; - String? applyTime; - int? flag; -} +var message = await OpenIM.iMManager.messageManager.createLocationMessage( + latitude: 0,// 纬度 + longitude: 0, // 经度 + description: '', // 位置描述信息 +); ``` -| Field | **Description** | -| ------------- | ------------------------------------------------------------ | -| uid | 用户id | -| name | 用户名 | -| icon | 用户头像 | -| gender | 性别:1男,2女 | -| mobile | 手机号 | -| birth | 生日 | -| email | 邮箱 | -| ex | 扩展字段 | -| comment | 备注 | -| isInBlackList | 黑名单:1已拉入黑名单 | -| reqMessage | 验证消息 | -| applyTime | 申请时间 | -| flag | 好友申请列表:0等待处理;1已同意;-1已拒绝
好友关系:1已经是好友 | - -## 7.2. 消息对象 - -``` -class Message { - String? clientMsgID; - String? serverMsgID; - int? createTime; - int? sendTime; - String? sendID; - String? recvID; - int? msgFrom; - - /// [MessageType] - int? contentType; - int? platformID; - List? forceList; - String? senderNickName; - String? senderFaceUrl; - String? groupID; - String? content; - int? seq; - bool? isRead; - - /// [MessageStatus] - int? status; - String? remark; - dynamic ext; - - /// [ConversationType] - int? sessionType; - PictureElem? pictureElem; - SoundElem? soundElem; - VideoElem? videoElem; - FileElem? fileElem; - AtElem? atElem; - LocationElem? locationElem; - CustomElem? customElem; - QuoteElem? quoteElem; - MergeElem? mergeElem; -} -``` +- ##### createCustomMessage(自定义消息) -| Field | Description | -| -------------- | ------------------------------------------------------------ | -| clientMsgID | 消息唯一ID | -| serverMsgID | 消息服务器ID,暂时不使用 | -| createTime | 消息创建时间,单位纳秒 | -| sendTime | 消息发送时间,单位纳秒 | -| sendID | 发送者ID | -| recvID | 接收者ID | -| msgFrom | 标识消息是用户级别还是系统级别 100:用户 200:系统 | -| contentType | 消息类型:
101:文本消息
102:图片消息
103:语音消息
104:视频消息
105:文件消息
106:@消息
107:合并消息
108:名片消息
109:位置消息
110:自定义消息
111:撤回消息回执
112:C2C已读回执
113:正在输入状态
114:引用消息
| -| platformID | 平台类型
1:ios
2:android
3:windows
4:osx
5:web
6:mini
7:linux | -| forceList | 强制推送列表(被@的用户) | -| senderNickName | 发送者昵称 | -| senderFaceUrl | 发送者头像 | -| groupID | 群聊ID | -| content | 消息内容 | -| seq | 消息唯一序列号 | -| isRead | 是否已读 | -| status | 消息状态
1:发送中
2:发送成功
3:发送失败
4:已删除
5:已撤回 | -| remark | 消息备注 | -| sessionType | 会话类型 1:单聊 2:群聊 | -| pictureElem | 图片信息 | -| soundElem | 语音信息 | -| videoElem | 视频信息 | -| fileElem | 文件信息 | -| atElem | @信息 | -| locationElem | 位置信息 | -| customElem | 自定义信息 | -| quoteElem | 引用消息 | -| mergeElem | 合并信息 | - -### 7.2.1. PictureElem - -| Field | Description | -| --------------- | ------------ | -| sourcePath | 本地资源地址 | -| sourcePicture | 本地图片详情 | -| bigPicture | 大图详情 | -| snapshotPicture | 缩略图详情 | - -### 7.2.2. PictureInfo - -| Field | Description | -| ------ | ----------- | -| uuid | 唯一ID | -| type | 图片类型 | -| size | 图片大小 | -| width | 图片宽度 | -| height | 图片高度 | -| url | 图片oss地址 | - -### 7.2.3. SoundElem - -| Field | Description | -| --------- | ------------ | -| uuid | 唯一ID | -| soundPath | 本地资源地址 | -| sourceUrl | oss地址 | -| dataSize | 音频大小 | -| duration | 音频时长 | - -### 7.2.4. VideoElem - -| Field | Description | -| -------------- | ---------------- | -| videoPath | 视频本地资源地址 | -| videoUUID | 视频唯一ID | -| videoUrl | 视频oss地址 | -| videoType | 视频类型 | -| videoSize | 视频大小 | -| duration | 视频时长 | -| snapshotPath | 视频快照本地地址 | -| snapshotUUID | 视频快照唯一ID | -| snapshotSize | 视频快照大小 | -| snapshotUrl | 视频快照oss地址 | -| snapshotWidth | 视频快照宽度 | -| snapshotHeight | 视频快照高度 | - -### 7.2.5. FileElem - -| Field | Description | -| --------- | ---------------- | -| filePath | 文件本地资源地址 | -| uuid | 唯一ID | -| sourceUrl | oss地址 | -| fileName | 文件名称 | -| fileSize | 文件大小 | - -### 7.2.6. MergeElem - -| Field | Description | -| ------------ | ------------ | -| title | 合并消息标题 | -| abstractList | 摘要列表 | -| multiMessage | 合并消息列表 | - -### 7.2.7. AtElem - -| Field | Description | -| ---------- | ----------- | -| text | 文本消息 | -| atUserList | @用户ID列表 | -| isAtSelf | 是否@自己 | - -### 7.2.8. LocationElem - -| Field | Description | -| ----------- | ----------- | -| description | 描述 | -| longitude | 经度 | -| latitude | 纬度 | - -### 7.2.9. CustomElem - -| Field | Description | -| ----------- | ---------------------- | -| data | 自定义消息字节数据 | -| extension | 自定义消息扩展字节数据 | -| description | 描述 | - -### 7.2.10. QuoteElem - -| Field | Description | -| ------------ | ----------- | -| quoteMessage | 引用消息 | - -## 7.3. 会话对象 - -``` -class ConversationInfo { - String conversationID; - - /// [ConversationType] - int? conversationType; - String? userID; - String? groupID; - String? showName; - String? faceUrl; - int? recvMsgOpt; - int? unreadCount; - Message? latestMsg; - int? latestMsgSendTime; - String? draftText; - int? draftTimestamp; - - /// pinned value is 1 - dynamic isPinned; -} ``` - -| Field | Description | -| ----------------- | ------------------------------------------------------------ | -| conversationID | 会话ID | -| conversationType | 会话类型 1:单聊 2:群聊 | -| userID | 会话对象用户ID | -| groupID | 会话群聊ID | -| showName | 会话对象(用户或群聊)名称 | -| faceUrl | 用户头像或群聊头像 | -| recvMsgOpt | 接收消息选项:
0:在线正常接收消息,离线时进行推送
1:不会接收到消息
2:在线正常接收消息,离线不会有推送 | -| unreadCount | 未读消息数量 | -| latestMsg | 最后一条消息json字符串 | -| latestMsgSendTime | 最后一条消息发送时间(ns) | -| draftText | 会话草稿 | -| draftTimestamp | 会话草稿设置时间 | -| isPinned | 是否置顶,1置顶 | - -## 7.4. 已读消息回执 - -``` -class HaveReadInfo { - String? uid; - List? msgIDList; - int? readTime; - int? msgFrom; - int? contentType; - int? sessionType; -} +var message = await OpenIM.iMManager.messageManager.createCustomMessage( + data: '', // 自定义内容 + extension: '', // 扩展信息 + description: '', // 描述消息 +); ``` -| Field | Description | -| ----------- | ------------------------------------------------------------ | -| uid | 单聊对象的ID | -| contentType | 消息类型:
101:文本消息
102:图片消息
103:语音消息
104:视频消息
105:文件消息
106:@消息
107:合并消息
108:名片消息
109:位置消息
110:自定义消息
111:撤回消息回执
112:C2C已读回执
113:正在输入状态
114:引用消息
| -| msgFrom | 标识消息是用户级别还是系统级别 100:用户 200:系统 | -| msgIDList | 已读消息clientMsgID集合 | -| readTime | 已读时间 | -| sessionType | 会话类型 1:单聊 2:群聊 | - -## 7.5. 群组信息对象 +- ##### createQuoteMessage(引用消息/消息回复) ``` -class GroupInfo { - String groupID; - String? groupName; - String? notification; - String? introduction; - String? faceUrl; - String? ownerId; - int? createTime; - int? memberCount; -} +var message = await OpenIM.iMManager.messageManager.createQuoteMessage( + text: '', // 回复内容 + quoteMsg: Message(), // 被回复的消息体 +); ``` -| Field | Description | -| ------------ | ------------ | -| groupID | 群组ID | -| groupName | 群组名称 | -| notification | 群公告 | -| introduction | 群介绍 | -| faceUrl | 群头像 | -| ownerId | 群主ID | -| createTime | 群组创建时间 | -| memberCount | 群成员总数 | - -## 7.6. 群组成员信息 - -``` -class GroupMembersInfo { - String? groupID; - String? userId; - int? role; - int? joinTime; - String? nickName; - String? faceUrl; - dynamic ext; -} -``` +- ##### createCardMessage(名片消息) -| Field | Description | -| -------- | ------------------------------------------ | -| groupID | 群id | -| userId | 用户id | -| role | 用户的角色,0:普通成员 1:发起者 2:管理员 | -| joinTime | 加入时间 | -| nickName | 群昵称 | -| faceUrl | 头像 | -| ext | 扩展字段 | - -## 7.7. 群申请信息 - -``` -class GroupApplicationInfo { - String? id; - String? groupID; - String? fromUserID; - String? toUserID; - int? flag; //INIT = 0, REFUSE = -1, AGREE = 1 - String? reqMsg; - String? handledMsg; - int? createTime; - String? fromUserNickName; - String? toUserNickName; - String? fromUserFaceURL; - String? toUserFaceURL; - String? handledUser; - int? type; //APPLICATION = 0, INVITE = 1 - int? handleStatus; //UNHANDLED = 0, BY_OTHER = 1, BY_SELF = 2 - int? handleResult; //REFUSE = 0, AGREE = 1 -} ``` - -| Field | Description | -| ---------------- | ----------------------------------------- | -| groupID | 群组ID | -| fromUserID | 申请用户的ID | -| toUserID | 接收用户的ID | -| flag | 0:未处理,1:拒绝,2:同意 | -| reqMsg | 入群原因 | -| handledMsg | 处理反馈 | -| createTime | 申请事件 | -| fromUserNickName | 申请用户的昵称 | -| toUserNickName | 接收用户的昵称 | -| fromUserFaceURL | 申请用户的头像 | -| toUserFaceURL | 接收用户的头像 | -| handledUser | 处理人 | -| type | 0:申请进群, 1:邀请进群 | -| handleStatus | 0:未处理, 1:被其他人处理, 2:被自己处理 | -| handleResult | 0:拒绝,1:同意 | - +OpenIM.iMManager.messageManager.createCardMessage( + data: {}, // 自定义内容 +); +``` \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index e60001d..974d6f7 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -41,5 +41,5 @@ android { } } dependencies { - implementation 'io.openim:client-sdk:1.5.4@aar' + implementation 'io.openim:client-sdk:1.6.1@aar' } \ No newline at end of file diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnAdvancedMsgListener.java b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnAdvancedMsgListener.java index a890a83..f0b2b84 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnAdvancedMsgListener.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnAdvancedMsgListener.java @@ -7,12 +7,10 @@ import java.util.Map; import io.openim.flutter_openim_sdk.util.CommonUtil; public class OnAdvancedMsgListener implements open_im_sdk_callback.OnAdvancedMsgListener { - // final Map values = new HashMap<>(); private final String id; public OnAdvancedMsgListener(String listenerId) { this.id = listenerId; -// this.values.put("id", listenerId); } @Override diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnFriendshipListener.java b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnFriendshipListener.java index a8d8468..f118a09 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnFriendshipListener.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnFriendshipListener.java @@ -2,31 +2,6 @@ package io.openim.flutter_openim_sdk.listener; import io.openim.flutter_openim_sdk.util.CommonUtil; -/** - * 申请添加好友: - * 主动申请者收到OnFriendApplicationAdded - * 被添加者收到OnFriendApplicationAdded ok 111加222 - *

- * 同意好友申请: - * 操作者收到 OnFriendApplicationAccepted OnFriendAdded; - * 申请者收到:OnFriendApplicationAccepted OnFriendAdded ok - *

- * 好友拒绝申请: - * 操作者收到OnFriendApplicationRejected; - * 申请者收到:OnFriendApplicationRejected ok - *

- * 删除好友: - * 操作者收到OnFriendDeleted ok - *

- * 修改备注: - * 操作者收到OnFriendInfoChanged ok - *

- * 添加黑名单: - * 操作者收到OnBlackAdded; ok - *

- * 移除黑名单: - * 操作者收到OnBlackDeleted ok - */ public class OnFriendshipListener implements open_im_sdk_callback.OnFriendshipListener { @Override diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnGroupListener.java b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnGroupListener.java index 4ade91f..711385d 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnGroupListener.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnGroupListener.java @@ -2,37 +2,6 @@ package io.openim.flutter_openim_sdk.listener; import io.openim.flutter_openim_sdk.util.CommonUtil; -/** - * 创建群: - * 初始成员收到:OnJoinedGroupAdded 验证ok 1111 创建 2222 - *

- * 退出群: - * 退出者收到:OnJoinedGroupDeleted - * 群成员收到:OnGroupMemberDeleted 2222退出群 验证ok - *

- * 踢出群: - * 被踢者收到:OnJoinedGroupDeleted - * 群成员收到:OnGroupMemberDeleted 验证ok - *

- * 邀请进群: - * 被邀请者收到:OnJoinedGroupAdded - * 群成员(不包括被邀请者)收到:OnGroupMemberAdded 1111邀请2222 验证ok - *

- * 申请加群: - * 申请者收到:OnGroupApplicationAdded - * 群主+管理员收到:OnReceiveJoinGroupApplicationAdded 验证ok - *

- * 同意进群: - * 申请者收到:OnJoinedGroupAdded OnGroupApplicationAccepted - * 群成员(不包括申请者)收到:OnGroupMemberAdded - * 审批者(群主或者管理员)收到:OnGroupMemberAdded OnGroupApplicationAccepted 验证ok - *

- * 拒绝进群: - * 申请者收到:OnGroupApplicationRejected; - * 审批者(群主或者管理员)收到:OnGroupApplicationRejected 验证ok - *

- * 修改群资料: 群成员收到: OnGroupInfoChanged 验证ok - */ public class OnGroupListener implements open_im_sdk_callback.OnGroupListener { @Override @@ -84,14 +53,4 @@ public class OnGroupListener implements open_im_sdk_callback.OnGroupListener { public void onJoinedGroupDeleted(String s) { CommonUtil.emitEvent("groupListener", "onJoinedGroupDeleted", s); } - - @Override - public void onReceiveJoinGroupApplicationAdded(String s) { - CommonUtil.emitEvent("groupListener", "onReceiveJoinGroupApplicationAdded", s); - } - - @Override - public void onReceiveJoinGroupApplicationDeleted(String s) { - CommonUtil.emitEvent("groupListener", "onReceiveJoinGroupApplicationDeleted", s); - } } diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnMsgSendListener.java b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnMsgSendListener.java index 4b57e0b..c51f2b4 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnMsgSendListener.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnMsgSendListener.java @@ -11,14 +11,14 @@ import open_im_sdk_callback.SendMsgCallBack; public class OnMsgSendListener implements SendMsgCallBack { final private MethodChannel.Result result; -// final private MethodCall call; - final private Object clientMsgID; + private Object clientMsgID; public OnMsgSendListener(MethodChannel.Result result, MethodCall call) { this.result = result; -// this.call = call; Map args = call.argument("message"); - this.clientMsgID = args.get("clientMsgID"); + if (null != args) { + this.clientMsgID = args.get("clientMsgID"); + } } @Override @@ -28,10 +28,12 @@ public class OnMsgSendListener implements SendMsgCallBack { @Override public void onProgress(long l) { - final Map values = new ArrayMap<>(); - values.put("clientMsgID", clientMsgID); - values.put("progress", l); - CommonUtil.emitEvent("msgSendProgressListener", "onProgress", values); + if (null != clientMsgID) { + final Map values = new ArrayMap<>(); + values.put("clientMsgID", clientMsgID); + values.put("progress", l); + CommonUtil.emitEvent("msgSendProgressListener", "onProgress", values); + } } @Override diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnUserListener.java b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnUserListener.java index 5d48819..9f37cf8 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnUserListener.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnUserListener.java @@ -4,9 +4,6 @@ import io.openim.flutter_openim_sdk.util.CommonUtil; public class OnUserListener implements open_im_sdk_callback.OnUserListener { - /** - * 登录用户个人资料有变化时回调 - */ @Override public void onSelfInfoUpdated(String s) { CommonUtil.emitEvent("userListener", "onSelfInfoUpdated", s); 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 c6a28b0..1432d21 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 @@ -15,7 +15,6 @@ public class IMManager extends BaseManager { value(methodCall, "operationID"), jsonValue(methodCall)) ); -// CommonUtil.runMainThreadReturn(result, null); } public void login(MethodCall methodCall, MethodChannel.Result result) { diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 65599d8..8a9c9b1 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -155,7 +155,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a28140c..3db53b6 100644 --- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ { @override void initState() { - _initSDK(); super.initState(); } @@ -28,43 +26,526 @@ class _MyAppState extends State { ), body: Column( children: [ - TextButton(onPressed: _login, child: Text('login')), + TextButton(onPressed: () {}, child: Text('login')), ], ), ), ); } - void _login() { - OpenIM.iMManager.login(uid: '', token: ''); + void initSDK() { + OpenIM.iMManager + .initSDK( + // "当前平台,参照IMPlatform类", + platform: 0, + // SDK的API接口地址。如:http:xxx:10000 + apiAddr: "", + // SDK的web socket地址。如: ws:xxx:17778 + wsAddr: "", + // 数据存储路径。如:var apath =(await getApplicationDocumentsDirectory()).path + dataDir: "", + listener: OnConnectListener( + onConnectSuccess: () { + // 已经成功连接到服务器 + }, + onConnecting: () { + // 正在连接到服务器,适合在 UI 上展示“正在连接”状态。 + }, + onConnectFailed: (code, errorMsg) { + // 连接服务器失败,可以提示用户当前网络连接不可用 + }, + onUserSigExpired: () { + // 登录票据已经过期,请使用新签发的 UserSig 进行登录。 + }, + onKickedOffline: () { + // 当前用户被踢下线,此时可以 UI 提示用户“您已经在其他端登录了当前账号,是否重新登录?” + }, + ), + ) + .then((value) { + if (value == true) { + // 初始化成功 + } + }); } - void _initSDK() async { - // Initialize SDK + void setLisenter() { OpenIM.iMManager - ..initSDK( - platform: Platform.isAndroid ? IMPlatform.android : IMPlatform.ios, - apiAddr: '', - wsAddr: '', - dataDir: '', - listener: OnConnectListener(), - ) - // - ..userManager.setUserListener(OnUserListener()) - // Add message listener (remove when not in use) - ..messageManager.setAdvancedMsgListener(OnAdvancedMsgListener()) - - // Set up message sending progress listener - ..messageManager.setMsgSendProgressListener(OnMsgSendProgressListener()) - - // Set up friend relationship listener - ..friendshipManager.setFriendshipListener(OnFriendshipListener()) - - // Set up conversation listener - ..conversationManager.setConversationListener(OnConversationListener()) - - // Set up group listener + ..userManager.setUserListener(OnUserListener( + onSelfInfoUpdated: (userInfo) { + // 当前登录用户资料变更回调 + }, + )) + ..messageManager.setAdvancedMsgListener(OnAdvancedMsgListener( + onRecvNewMessage: (message) { + // 收到新消息,界面添加新消息 + }, + onRecvMessageRevoked: (messageID) { + // 消息成功撤回,从界面移除消息 + }, + onRecvC2CReadReceipt: (list) { + // 消息被阅读回执,将消息标记为已读 + }, + )) + ..messageManager.setMsgSendProgressListener(OnMsgSendProgressListener( + onProgress: (messageID, progress) { + // 消息发送进度回调 + }, + )) + ..friendshipManager.setFriendshipListener(OnFriendshipListener( + onFriendApplicationRejected: (applicationInfo) { + // 发出或收到的好友申请被拒绝 + }, + onFriendApplicationDeleted: (applicationInfo) { + // 发出或收到的好友申请被删除 + }, + onFriendApplicationAdded: (applicationInfo) { + // 发出或收到的好友申请被添加 + }, + onFriendApplicationAccepted: (applicationInfo) { + // 发出或收到的好友申请已同意 + }, + onFriendAdded: (frinedInfo) { + // 好友被添加 + }, + onFriendDeleted: (frinedInfo) { + // 好友被删除 + }, + onFriendInfoChanged: (frinedInfo) { + // 朋友的资料发生变化 + }, + onBlacklistDeleted: (blackInfo) { + // 从黑名单删除 + }, + onBlacklistAdded: (blackInfo) { + // 拉入黑名单 + }, + )) + ..conversationManager.setConversationListener(OnConversationListener( + onNewConversation: (list) { + // 新增会话 + }, + onConversationChanged: (list) { + // 已添加的会话发送改变 + }, + onTotalUnreadMessageCountChanged: (count) { + // 未读消息数发送变化 + }, + )) ..groupManager.setGroupListener(OnGroupListener( + onGroupMemberInfoChanged: (memberInfo) { + // 组成员信息发生变化 + }, + onGroupMemberDeleted: (memberInfo) { + // 组成员退出 + }, + onGroupMemberAdded: (memberInfo) { + // 组成员进入 + }, + onGroupApplicationRejected: (applicationInfo) { + // 发出或收到的组申请被拒绝 + }, + onGroupApplicationDeleted: (applicationInfo) { + // 发出或收到的组申请被删除 + }, + onGroupApplicationAdded: (applicationInfo) { + // 发出或收到的组申请有新增 + }, + onGroupApplicationAccepted: (applicationInfo) { + // 发出或收到的组申请被接受 + }, + onJoinedGroupDeleted: (groupInfo) { + // 退出群:退出者收到;踢出群:被踢者收到 + }, + onJoinedGroupAdded: (groupInfo) { + // 创建群: 初始成员收到;邀请进群:被邀请者收到 + }, + onGroupInfoChanged: (groupInfo) { + // 组资料变更 + }, )); } + + void login() { + OpenIM.iMManager + .login( + uid: "", // uid来自于自身业务服务器 + token: "", // token需要业务服务器根据secret向OpenIM服务端交换获取 + ) + .then((value) { + // 返回当前登录用户的资料 + }); + } + + void imMager() { + OpenIM.iMManager.logout().then((_) { + // 退出成功 + }); + + OpenIM.iMManager.getLoginUserInfo().then((userInfo) { + // 当前登录用户的信息 + }); + + OpenIM.iMManager.getLoginUserID().then((userID) { + // 当前登录用户的ID + }); + } + + void userManager() { + OpenIM.iMManager.userManager.getUsersInfo( + uidList: [], // 用户ID集合 + ).then((userInfoList) { + // 用户信息列表 + }); + + OpenIM.iMManager.userManager.getSelfUserInfo().then((userInfo) { + // 返回当前登录用户的资料 + }); + + OpenIM.iMManager.userManager + .setSelfInfo( + nickname: '', + // 昵称 + faceURL: '', + // 头像 + gender: 0, + // 性别: 男1,女0 + phoneNumber: '', + // 手机号 + email: '', + //邮箱 + birth: 0, + //生日 + ex: '', // 其他信息 + ) + .then((_) {}); + } + + void conversationManager() { + OpenIM.iMManager.conversationManager.getAllConversationList().then((list) { + // List 会话列表 + }); + OpenIM.iMManager.conversationManager.getConversationListSplit( + offset: 0, // 偏移量,如:第1页,offet:0,count:20;第2页:offset:20; + count: 0, // 每页数量 + ); + OpenIM.iMManager.conversationManager.getOneConversation( + sourceID: "", // 如果是单聊值传userID,如果是群聊groupID + sessionType: 1, // 如果是单聊值传1,如果是群聊值传2 + ); + OpenIM.iMManager.conversationManager.getMultipleConversation( + conversationIDList: [], // 会话ID集合 + ).then((list) { + // 返回与id匹配的会话列表 + }); + OpenIM.iMManager.conversationManager + .deleteConversation( + conversationID: "", // 会话id + ) + .then((_) => null) + .catchError((_) {}); + OpenIM.iMManager.conversationManager.setConversationDraft( + conversationID: "", // 会话id + draftText: "", // 草稿 + ); + OpenIM.iMManager.conversationManager.pinConversation( + conversationID: "", // 会话id + isPinned: true, // true:置顶;false:取消置顶 + ); + OpenIM.iMManager.conversationManager.markGroupMessageHasRead( + groupID: "", // 组id + ); + OpenIM.iMManager.conversationManager.getTotalUnreadMsgCount(); + OpenIM.iMManager.conversationManager.getConversationIDBySessionType( + sourceID: "", // 如果是单聊值传userID,如果是群聊groupID + sessionType: 1, // 如果是单聊值传1,如果是群聊值传2 + ); + OpenIM.iMManager.conversationManager.setConversationRecvMessageOpt( + conversationIDList: [], // 会话id列表 + status: 1, // 1:不接受消息;2:接受在线消息不接受离线消息;0:正常 + ); + OpenIM.iMManager.conversationManager.getConversationRecvMessageOpt( + conversationIDList: [], // 会话id列表 + ); + OpenIM.iMManager.conversationManager.simpleSort([]); + } + + void friendManager() { + OpenIM.iMManager.friendshipManager.getFriendsInfo( + uidList: [], // userId列表 + ).then((list) { + // List + }); + OpenIM.iMManager.friendshipManager.addFriend( + uid: "", // 用户id + reason: '', // 发起好友申请的描述信息 + ); + OpenIM.iMManager.friendshipManager + .getRecvFriendApplicationList() + .then((value) { + // List 申请列表 + }); + OpenIM.iMManager.friendshipManager + .getSendFriendApplicationList() + .then((list) { + // List 申请列表 + }); + OpenIM.iMManager.friendshipManager.getFriendList().then((list) { + // List 好友信息列表 + }); + OpenIM.iMManager.friendshipManager.setFriendRemark( + uid: '', // 好友userID + remark: '', // 备注名 + ); + OpenIM.iMManager.friendshipManager.addBlacklist( + uid: "", // 好友userID + ); + OpenIM.iMManager.friendshipManager.getBlacklist().then((list) { + // List + }); + OpenIM.iMManager.friendshipManager.removeBlacklist( + uid: "", // userID + ); + OpenIM.iMManager.friendshipManager.checkFriend( + uidList: [], // userID 列表 + ).then((value) { + // List + }); + OpenIM.iMManager.friendshipManager.deleteFriend( + uid: '', // userID + ); + OpenIM.iMManager.friendshipManager.acceptFriendApplication( + uid: "", // userID + handleMsg: '', // 备注信息 + ); + OpenIM.iMManager.friendshipManager.refuseFriendApplication( + uid: "", // userID + handleMsg: '', // 备注信息 + ); + } + + void groupManager() { + OpenIM.iMManager.groupManager + .inviteUserToGroup( + groupId: '', // 组ID + uidList: [], // 成员 userID 列表 + reason: '', // 备注信息 + ) + .then((list) { + // List + }); + + OpenIM.iMManager.groupManager.kickGroupMember( + groupId: '', // 组ID + uidList: [], // userID 列表 + reason: '', // 备注信息 + ); + OpenIM.iMManager.groupManager.getGroupMembersInfo( + groupId: '', // 组ID + uidList: [], // 成员 userID 列表 + ).then((list) { + // List + }); + + OpenIM.iMManager.groupManager + .getGroupMemberList( + groupId: '', // 组ID + filter: 0, // 1普通成员, 2群主,3管理员 + offset: 0, // 偏移量,每次开始的index值 + count: 0, // 每次拉取的数量 + ) + .then((list) { + // List + }); + + OpenIM.iMManager.groupManager.getJoinedGroupList().then((list) { + // List + }); + + OpenIM.iMManager.groupManager + .isJoinedGroup( + gid: '', // 组ID + ) + .then((joned) { + // true已加入;false未加入 + }); + + OpenIM.iMManager.groupManager.createGroup( + groupName: '', + // 组名 + faceUrl: '', + // 头像 + notification: '', + // 群公告 + introduction: '', + // 群简介 + groupType: 0, + // 类型 + ex: '', + // 扩展信息 + list: [], // 成员角色集合 List + ).then((groupInfo) { + // 返回组信息 GroupInfo + }); + + OpenIM.iMManager.groupManager.setGroupInfo( + groupID: '', + groupName: '', + // 组名 + faceUrl: '', + // 头像 + notification: '', + // 群公告 + introduction: '', + // 群简介 + ex: '', // 扩展信息 + ); + + OpenIM.iMManager.groupManager.getGroupsInfo( + gidList: [], // 组id集合 + ).then((list) { + // List + }); + + OpenIM.iMManager.groupManager.joinGroup( + gid: '', // 组id + reason: '', // 入群备注信息 + ); + + OpenIM.iMManager.groupManager.quitGroup( + gid: '', // 组id + ); + OpenIM.iMManager.groupManager.transferGroupOwner( + gid: '', // 组ID + uid: '', // 新 owner userID + ); + + OpenIM.iMManager.groupManager.getRecvGroupApplicationList().then((list) { + // List + }); + OpenIM.iMManager.groupManager.getSendGroupApplicationList().then((list) { + // List + }); + OpenIM.iMManager.groupManager.acceptGroupApplication( + gid: '', // 组ID + uid: '', // 申请人userID + handleMsg: '', // 备注信息 + ); + + OpenIM.iMManager.groupManager.refuseGroupApplication( + gid: '', // 组ID + uid: '', // 申请人userID + handleMsg: '', // 备注信息 + ); + } + + void messageManager() { + OpenIM.iMManager.messageManager.sendMessage( + message: Message(), // 消息体 + userID: '', // 接受消息的userID + groupID: '', // 接受消息的群ID + offlinePushInfo: OfflinePushInfo(), // 离线推送消息备注 + ); + OpenIM.iMManager.messageManager + .getHistoryMessageList( + userID: '', // 单聊对象的userID + groupID: '', // 群聊的组id + startMsg: null, // 消息体 + count: 0, // 每次拉取的数量 + ) + .then((list) { + // List + }); + OpenIM.iMManager.messageManager.revokeMessage( + message: Message(), // 消息体 + ); + OpenIM.iMManager.messageManager.deleteMessageFromLocalStorage( + message: Message(), // 消息体 + ); + OpenIM.iMManager.messageManager.insertSingleMessageToLocalStorage( + receiverID: '', // 接收者userID + senderID: '', // 发送者userID + message: Message(), // 消息体 + ); + OpenIM.iMManager.messageManager.markC2CMessageAsRead( + userID: '', // 接收者 userID + messageIDList: [], // 已读的消息id列表 + ); + OpenIM.iMManager.messageManager.typingStatusUpdate( + userID: '', // 接收者 userID + msgTip: '', // 自定义提示内容 + ); + OpenIM.iMManager.messageManager.createTextMessage( + text: '', + ); + OpenIM.iMManager.messageManager.createTextAtMessage( + text: '', // 发送的内容 + atUidList: [], // 被@到的userID集合 + ); + OpenIM.iMManager.messageManager.createImageMessage( + imagePath: '', // 图片相对路径 + ); + OpenIM.iMManager.messageManager.createImageMessageFromFullPath( + imagePath: '', // 图片的绝对路径 + ); + OpenIM.iMManager.messageManager.createSoundMessage( + soundPath: '', // 相对路径 + duration: 0, // 时长 + ); + OpenIM.iMManager.messageManager.createSoundMessageFromFullPath( + soundPath: '', // 绝对路径 + duration: 0, // 时长 + ); + OpenIM.iMManager.messageManager.createVideoMessage( + videoPath: '', // 相对路径 + videoType: '', // minetype + duration: 0, // 时长s + snapshotPath: '', // 站位缩略图 + ); + OpenIM.iMManager.messageManager.createVideoMessageFromFullPath( + videoPath: '', // 相对路径 + videoType: '', // minetype + duration: 0, // 时长s + snapshotPath: '', // 站位缩略图 + ); + OpenIM.iMManager.messageManager.createFileMessage( + filePath: '', // 相对路径 + fileName: '', // 文件名 + ); + OpenIM.iMManager.messageManager.createFileMessageFromFullPath( + filePath: '', // 相对路径 + fileName: '', // 文件名 + ); + OpenIM.iMManager.messageManager.createForwardMessage( + message: Message(), // 转发消息体 + ); + OpenIM.iMManager.messageManager.createMergerMessage( + messageList: [], // 被转发的消息列表 + title: '', // 标题 + summaryList: [], // 每一条消息摘要 + ); + OpenIM.iMManager.messageManager.createLocationMessage( + latitude: 0, // 纬度 + longitude: 0, // 经度 + description: '', // 位置描述信息 + ); + OpenIM.iMManager.messageManager.createCustomMessage( + data: '', // 自定义内容 + extension: '', // 扩展信息 + description: '', // 描述消息 + ); + OpenIM.iMManager.messageManager.createQuoteMessage( + text: '', // 回复内容 + quoteMsg: Message(), // 被回复的消息体 + ); + OpenIM.iMManager.messageManager.createCardMessage( + data: {}, // 自定义内容 + ); + OpenIM.iMManager.messageManager.clearC2CHistoryMessage( + uid: "", // 清空聊天记录 + ); + OpenIM.iMManager.messageManager.clearGroupHistoryMessage( + gid: '', // 群ID + ); + } } diff --git a/ios/Classes/BaseCallback.swift b/ios/Classes/BaseCallback.swift index e86283f..025291d 100644 --- a/ios/Classes/BaseCallback.swift +++ b/ios/Classes/BaseCallback.swift @@ -1,10 +1,3 @@ -// -// BaseCallback.swift -// flutter_openim_sdk -// -// Created by willem on 2021/10/9. -// - import Foundation import OpenIMCore @@ -16,7 +9,7 @@ public class BaseCallback: NSObject, Open_im_sdk_callbackBaseProtocol { self.result = result } - public func onError(_ errCode: Int, errMsg: String?) { + public func onError(_ errCode: Int32, errMsg: String?) { print("BaseResult: " + errMsg!) safeMainAsync { self.result(FlutterError(code: "\(errCode)", message: errMsg, details: nil)) } } diff --git a/ios/Classes/CommonUtil.swift b/ios/Classes/CommonUtil.swift index 3529b6c..9247b28 100644 --- a/ios/Classes/CommonUtil.swift +++ b/ios/Classes/CommonUtil.swift @@ -1,10 +1,9 @@ - import Foundation public class CommonUtil { - public static func emitEvent(channel: FlutterMethodChannel, method: String, type: String, errCode: Int?, errMsg: String?, data: Any?){ + public static func emitEvent(channel: FlutterMethodChannel, method: String, type: String, errCode: Int32?, errMsg: String?, data: Any?){ safeMainAsync { var res: [String: Any] = [:] res["type"] = type diff --git a/ios/Classes/JsonUtil.swift b/ios/Classes/JsonUtil.swift index 7c7faa7..5c005d6 100644 --- a/ios/Classes/JsonUtil.swift +++ b/ios/Classes/JsonUtil.swift @@ -1,10 +1,3 @@ -// -// JsonUtil.swift -// Runner -// -// Created by z1u24 on 2021/6/28. -// - import Foundation public class JsonUtil { diff --git a/ios/Classes/Module/BaseServiceManager.swift b/ios/Classes/Module/BaseServiceManager.swift index bf75bae..c21a46d 100644 --- a/ios/Classes/Module/BaseServiceManager.swift +++ b/ios/Classes/Module/BaseServiceManager.swift @@ -1,10 +1,3 @@ -// -// BaseServiceManager.swift -// flutter_openim_sdk -// -// Created by willem on 2021/10/9. -// - import Flutter import OpenIMCore import UIKit diff --git a/ios/Classes/Module/ConversationManager.swift b/ios/Classes/Module/ConversationManager.swift index b321c7c..18263e8 100644 --- a/ios/Classes/Module/ConversationManager.swift +++ b/ios/Classes/Module/ConversationManager.swift @@ -1,10 +1,3 @@ -// -// ConversationManager.swift -// Runner -// -// Created by z1u24 on 2021/6/29. -// - import Foundation import OpenIMCore @@ -12,7 +5,6 @@ public class ConversationManager: BaseServiceManager { public override func registerHandlers() { super.registerHandlers() - self["setConversationListener"] = setConversationListener self["getAllConversationList"] = getAllConversationList self["getConversationListSplit"] = getConversationListSplit diff --git a/ios/Classes/Module/FriendshipManager.swift b/ios/Classes/Module/FriendshipManager.swift index 0db8f6b..89edb34 100644 --- a/ios/Classes/Module/FriendshipManager.swift +++ b/ios/Classes/Module/FriendshipManager.swift @@ -1,10 +1,3 @@ -// -// FriendshipManager.swift -// Runner -// -// Created by z1u24 on 2021/6/29. -// - import Foundation import OpenIMCore @@ -81,11 +74,11 @@ public class FriendshipManager: BaseServiceManager { } func acceptFriendApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkAcceptFriendApplication(BaseCallback(result: result), methodCall[string: "operationID", methodCall.toJsonString()) + Open_im_sdkAcceptFriendApplication(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString()) } func refuseFriendApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkRefuseFriendApplication(BaseCallback(result: result), methodCall[string: "operationID", methodCall.toJsonString()) + Open_im_sdkRefuseFriendApplication(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString()) } // func forceSyncFriendApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ @@ -104,35 +97,35 @@ public class FriendshipManager: BaseServiceManager { // } } -public class FriendshipListener: NSObject, Open_im_sdk_callbackFriendshipListenerProtocol { +public class FriendshipListener: NSObject, Open_im_sdk_callbackOnFriendshipListenerProtocol { private let channel:FlutterMethodChannel init(channel:FlutterMethodChannel) { self.channel = channel } - public func onBlackAdded(_ userInfo: String?) { - CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onBlacklistAdded", errCode: nil, errMsg: nil, data: userInfo) + public func onBlackAdded(_ blackInfo: String?) { + CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onBlacklistAdded", errCode: nil, errMsg: nil, data: blackInfo) } - public func onBlackDeleted(_ userInfo: String?) { - CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onBlacklistDeleted", errCode: nil, errMsg: nil, data: userInfo) + public func onBlackDeleted(_ blackInfo: String?) { + CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onBlacklistDeleted", errCode: nil, errMsg: nil, data: blackInfo) } - public func onFriendApplicationAccepted(_ applyUserInfo: String?) { - CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationAccepted", errCode: nil, errMsg: nil, data: applyUserInfo) + public func onFriendApplicationAccepted(_ friendApplication: String?) { + CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationAccepted", errCode: nil, errMsg: nil, data: friendApplication) } - public func onFriendApplicationAdded(_ applyUserInfo: String?) { - CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationAdded", errCode: nil, errMsg: nil, data: applyUserInfo) + public func onFriendApplicationAdded(_ friendApplication: String?) { + CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationAdded", errCode: nil, errMsg: nil, data: friendApplication) } - public func onFriendApplicationDeleted(_ applyUserInfo: String?) { - CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationDeleted", errCode: nil, errMsg: nil, data: applyUserInfo) + public func onFriendApplicationDeleted(_ friendApplication: String?) { + CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationDeleted", errCode: nil, errMsg: nil, data: friendApplication) } - public func onFriendApplicationRejected(_ applyUserInfo: String?) { - CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationRejected", errCode: nil, errMsg: nil, data: applyUserInfo) + public func onFriendApplicationRejected(_ friendApplication: String?) { + CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationRejected", errCode: nil, errMsg: nil, data: friendApplication) } public func onFriendInfoChanged(_ friendInfo: String?) { @@ -146,6 +139,5 @@ public class FriendshipListener: NSObject, Open_im_sdk_callbackFriendshipListene public func onFriendDeleted(_ friendInfo: String?) { CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendDeleted", errCode: nil, errMsg: nil, data: friendInfo) } - } diff --git a/ios/Classes/Module/GroupManager.swift b/ios/Classes/Module/GroupManager.swift index d31aeb6..8b6c71f 100644 --- a/ios/Classes/Module/GroupManager.swift +++ b/ios/Classes/Module/GroupManager.swift @@ -1,10 +1,3 @@ -// -// GroupManager.swift -// flutter_openim_sdk -// -// Created by z1u24 on 2021/7/5. -// - import Foundation import OpenIMCore @@ -155,7 +148,7 @@ public class GroupListener: NSObject, Open_im_sdk_callbackOnGroupListenerProtoco CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupMemberAdded", errCode: nil, errMsg: nil, data: s) } - public func onGroupMemberDeleted(_ s: String?,member s1: String?) { + public func onGroupMemberDeleted(_ s: String?) { CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupMemberDeleted", errCode: nil, errMsg: nil, data: s) } @@ -170,12 +163,4 @@ public class GroupListener: NSObject, Open_im_sdk_callbackOnGroupListenerProtoco public func onJoinedGroupDeleted(_ s: String?) { CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onJoinedGroupDeleted", errCode: nil, errMsg: nil, data: s) } - - public func onReceiveJoinGroupApplicationAdded(_ s: String?) { - CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onReceiveJoinGroupApplicationAdded", errCode: nil, errMsg: nil, data: s) - } - - public func onReceiveJoinGroupApplicationDeleted(_ s: String?) { - CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onReceiveJoinGroupApplicationDeleted", errCode: nil, errMsg: nil, data: s) - } } diff --git a/ios/Classes/Module/IMManager.swift b/ios/Classes/Module/IMManager.swift index 5b606f7..43d8aad 100644 --- a/ios/Classes/Module/IMManager.swift +++ b/ios/Classes/Module/IMManager.swift @@ -1,10 +1,3 @@ -// -// IMManager.swift -// Runner -// -// Created by z1u24 on 2021/6/28. -// - import Foundation import OpenIMCore @@ -12,7 +5,6 @@ public class IMMananger: BaseServiceManager { public override func registerHandlers() { super.registerHandlers() - self["initSDK"] = initSDK self["login"] = login self["logout"] = logout @@ -75,10 +67,10 @@ public class ConnListener: NSObject, Open_im_sdk_callbackOnConnListenerProtocol self.channel = channel } - public func onConnectFailed(_ errCode: Int, errMsg: String?) { + public func onConnectFailed(_ errCode: Int32, errMsg: String?) { CommonUtil.emitEvent(channel: self.channel, method: "connectListener", type: "onConnectFailed", errCode: errCode, errMsg: errMsg, data: nil) } - + public func onConnectSuccess() { CommonUtil.emitEvent(channel: self.channel, method: "connectListener", type: "onConnectSuccess", errCode: nil, errMsg: nil, data: nil) } diff --git a/ios/Classes/Module/MessageManager.swift b/ios/Classes/Module/MessageManager.swift index 6c5690a..61f0004 100644 --- a/ios/Classes/Module/MessageManager.swift +++ b/ios/Classes/Module/MessageManager.swift @@ -1,10 +1,3 @@ -// -// MessageManager.swift -// Runner -// -// Created by z1u24 on 2021/6/29. -// - import Foundation import OpenIMCore @@ -14,7 +7,6 @@ public class MessageManager: BaseServiceManager { public override func registerHandlers() { super.registerHandlers() - self["setAdvancedMsgListener"] = setAdvancedMsgListener self["sendMessage"] = sendMessage self["getHistoryMessageList"] = getHistoryMessageList @@ -49,7 +41,7 @@ public class MessageManager: BaseServiceManager { func setAdvancedMsgListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ let key = methodCall[string: KEY_ID] let lis = AdvancedMsgListener(channel: channel, id: key) - open_im_sdkSetAdvancedMsgListener(lis) + Open_im_sdkSetAdvancedMsgListener(lis) callBack(result) } @@ -191,22 +183,11 @@ public class MessageManager: BaseServiceManager { self.call = methodCall } -// func setResult(result: @escaping FlutterResult){ -// self.result = result -// } -// -// func setCall(methodCall: FlutterMethodCall){ -// self.call = methodCall -// } - - public func onError(_ errCode: Int, errMsg: String?) { + public func onError(_ errCode: Int32, errMsg: String?) { DispatchQueue.main.async { self.result(FlutterError(code: "\(errCode)", message: errMsg, details: nil)) } } public func onProgress(_ progress: Int) { -// guard let call = call else { -// return -// } var values: [String: Any] = [:] let message = call[dict: "message"] values["clientMsgID"] = message["clientMsgID"] @@ -224,12 +205,9 @@ public class MessageManager: BaseServiceManager { private let channel: FlutterMethodChannel private let id: String -// private var values: [String: Any] = [:] - init(channel: FlutterMethodChannel, id: String) { self.channel = channel self.id = id -// values["id"] = id } public func onRecvC2CReadReceipt(_ msgReceiptList: String?) { diff --git a/ios/Classes/Module/UserManager.swift b/ios/Classes/Module/UserManager.swift index a723406..ddc03a6 100644 --- a/ios/Classes/Module/UserManager.swift +++ b/ios/Classes/Module/UserManager.swift @@ -1,4 +1,3 @@ - import Foundation import OpenIMCore @@ -6,6 +5,7 @@ public class UserManager: BaseServiceManager { public override func registerHandlers() { super.registerHandlers() + self["setUserListener"] = setUserListener self["getUsersInfo"] = getUsersInfo self["setSelfInfo"] = setSelfInfo self["getSelfUserInfo"] = getSelfUserInfo @@ -32,7 +32,7 @@ public class UserManager: BaseServiceManager { public class UserListener: NSObject, Open_im_sdk_callbackOnUserListenerProtocol { private let channel:FlutterMethodChannel - + init(channel:FlutterMethodChannel) { self.channel = channel } diff --git a/ios/Classes/SwiftFlutterOpenimSdkPlugin.swift b/ios/Classes/SwiftFlutterOpenimSdkPlugin.swift index b562fb2..00cc6e0 100644 --- a/ios/Classes/SwiftFlutterOpenimSdkPlugin.swift +++ b/ios/Classes/SwiftFlutterOpenimSdkPlugin.swift @@ -2,7 +2,6 @@ import Flutter import UIKit public class SwiftFlutterOpenimSdkPlugin: NSObject, FlutterPlugin { - let imManager: IMMananger let conversationManager: ConversationManager let friendshipManager: FriendshipManager diff --git a/ios/Framework/OpenIMCore.framework/Headers/OpenIMCore.h b/ios/Framework/OpenIMCore.framework/Headers/OpenIMCore.h deleted file mode 100644 index 9534b48..0000000 --- a/ios/Framework/OpenIMCore.framework/Headers/OpenIMCore.h +++ /dev/null @@ -1,15 +0,0 @@ - -// Objective-C API for talking to the following Go packages -// -// open_im_sdk/open_im_sdk -// open_im_sdk/open_im_sdk_callback -// -// File is generated by gomobile bind. Do not edit. -#ifndef __OpenIMCore_FRAMEWORK_H__ -#define __OpenIMCore_FRAMEWORK_H__ - -#include "Open_im_sdk.objc.h" -#include "Open_im_sdk_callback.objc.h" -#include "Universe.objc.h" - -#endif diff --git a/ios/Framework/OpenIMCore.framework/Headers/Open_im_sdk.objc.h b/ios/Framework/OpenIMCore.framework/Headers/Open_im_sdk.objc.h deleted file mode 100644 index 7361321..0000000 --- a/ios/Framework/OpenIMCore.framework/Headers/Open_im_sdk.objc.h +++ /dev/null @@ -1,206 +0,0 @@ -// Objective-C API for talking to open_im_sdk/open_im_sdk Go package. -// gobind -lang=objc open_im_sdk/open_im_sdk -// -// File is generated by gobind. Do not edit. - -#ifndef __Open_im_sdk_H__ -#define __Open_im_sdk_H__ - -@import Foundation; -#include "ref.h" -#include "Universe.objc.h" - -#include "Open_im_sdk_callback.objc.h" - -@interface Open_im_sdk : NSObject -// skipped variable UserRouterMap with unsupported type: map[string]*open_im_sdk/internal/login.LoginMgr - -// skipped variable UserSDKRwLock with unsupported type: sync.RWMutex - -@end - -FOUNDATION_EXPORT void Open_im_sdkAcceptFriendApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDHandleMsg); - -FOUNDATION_EXPORT void Open_im_sdkAcceptGroupApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable fromUserID, NSString* _Nullable handleMsg); - -FOUNDATION_EXPORT void Open_im_sdkAddBlack(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable blackUserID); - -FOUNDATION_EXPORT void Open_im_sdkAddFriend(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDReqMsg); - -FOUNDATION_EXPORT void Open_im_sdkCheckFriend(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT BOOL Open_im_sdkCheckToken(NSString* _Nullable userID, NSString* _Nullable token, NSError* _Nullable* _Nullable error); - -FOUNDATION_EXPORT void Open_im_sdkClearC2CHistoryMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userID); - -FOUNDATION_EXPORT void Open_im_sdkClearGroupHistoryMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCardMessage(NSString* _Nullable operationID, NSString* _Nullable cardInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCustomMessage(NSString* _Nullable operationID, NSString* _Nullable data, NSString* _Nullable extension, NSString* _Nullable description); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateFileMessage(NSString* _Nullable operationID, NSString* _Nullable filePath, NSString* _Nullable fileName); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateFileMessageByURL(NSString* _Nullable operationID, NSString* _Nullable fileBaseInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateFileMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable fileFullPath, NSString* _Nullable fileName); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateForwardMessage(NSString* _Nullable operationID, NSString* _Nullable m); - -FOUNDATION_EXPORT void Open_im_sdkCreateGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupBaseInfo, NSString* _Nullable memberList); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateImageMessage(NSString* _Nullable operationID, NSString* _Nullable imagePath); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateImageMessageByURL(NSString* _Nullable operationID, NSString* _Nullable sourcePicture, NSString* _Nullable bigPicture, NSString* _Nullable snapshotPicture); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateImageMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable imageFullPath); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateLocationMessage(NSString* _Nullable operationID, NSString* _Nullable description, double longitude, double latitude); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateMergerMessage(NSString* _Nullable operationID, NSString* _Nullable messageList, NSString* _Nullable title, NSString* _Nullable summaryList); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateQuoteMessage(NSString* _Nullable operationID, NSString* _Nullable text, NSString* _Nullable message); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateSoundMessage(NSString* _Nullable operationID, NSString* _Nullable soundPath, int64_t duration); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateSoundMessageByURL(NSString* _Nullable operationID, NSString* _Nullable soundBaseInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateSoundMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable soundPath, int64_t duration); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateTextAtMessage(NSString* _Nullable operationID, NSString* _Nullable text, NSString* _Nullable atUserList); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateTextMessage(NSString* _Nullable operationID, NSString* _Nullable text); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateVideoMessage(NSString* _Nullable operationID, NSString* _Nullable videoPath, NSString* _Nullable videoType, int64_t duration, NSString* _Nullable snapshotPath); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateVideoMessageByURL(NSString* _Nullable operationID, NSString* _Nullable videoBaseInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateVideoMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable videoFullPath, NSString* _Nullable videoType, int64_t duration, NSString* _Nullable snapshotFullPath); - -FOUNDATION_EXPORT void Open_im_sdkDeleteConversation(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationID); - -FOUNDATION_EXPORT void Open_im_sdkDeleteFriend(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable friendUserID); - -FOUNDATION_EXPORT void Open_im_sdkDeleteMessageFromLocalStorage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message); - -FOUNDATION_EXPORT void Open_im_sdkGetAllConversationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetBlackList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkGetConversationIDBySessionType(NSString* _Nullable sourceID, long sessionType); - -FOUNDATION_EXPORT void Open_im_sdkGetConversationListSplit(id _Nullable callback, NSString* _Nullable operationID, long offset, long count); - -FOUNDATION_EXPORT void Open_im_sdkGetConversationRecvMessageOpt(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetDesignatedFriendsInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetFriendList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetGroupMemberList(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, int32_t filter, int32_t offset, int32_t count); - -FOUNDATION_EXPORT void Open_im_sdkGetGroupMembersInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetGroupsInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetHistoryMessageList(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable getMessageOptions); - -FOUNDATION_EXPORT void Open_im_sdkGetJoinedGroupList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT int32_t Open_im_sdkGetLoginStatus(void); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkGetLoginUser(void); - -FOUNDATION_EXPORT void Open_im_sdkGetMultipleConversation(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetOneConversation(id _Nullable callback, NSString* _Nullable operationID, long sessionType, NSString* _Nullable sourceID); - -FOUNDATION_EXPORT void Open_im_sdkGetRecvFriendApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetRecvGroupApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetSelfUserInfo(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetSendFriendApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetSendGroupApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetTotalUnreadMsgCount(id _Nullable callback, NSString* _Nullable operationID); - -// skipped function GetUserWorker with unsupported parameter or return types - - -/** - * /////////////////////user///////////////////// - */ -FOUNDATION_EXPORT void Open_im_sdkGetUsersInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDList); - -// skipped function InitOnce with unsupported parameter or return types - - -FOUNDATION_EXPORT BOOL Open_im_sdkInitSDK(id _Nullable listener, NSString* _Nullable operationID, NSString* _Nullable config); - -FOUNDATION_EXPORT void Open_im_sdkInsertSingleMessageToLocalStorage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable sendID); - -FOUNDATION_EXPORT void Open_im_sdkInviteUserToGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable reason, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkJoinGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable reqMsg); - -FOUNDATION_EXPORT void Open_im_sdkKickGroupMember(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable reason, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkLogin(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userID, NSString* _Nullable token); - -FOUNDATION_EXPORT void Open_im_sdkLogout(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkMarkC2CMessageAsRead(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userID, NSString* _Nullable msgIDList); - -FOUNDATION_EXPORT void Open_im_sdkMarkGroupMessageHasRead(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID); - -FOUNDATION_EXPORT void Open_im_sdkPinConversation(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationID, BOOL isPinned); - -FOUNDATION_EXPORT void Open_im_sdkQuitGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID); - -FOUNDATION_EXPORT void Open_im_sdkRefuseFriendApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDHandleMsg); - -FOUNDATION_EXPORT void Open_im_sdkRefuseGroupApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable fromUserID, NSString* _Nullable handleMsg); - -FOUNDATION_EXPORT void Open_im_sdkRemoveBlack(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable removeUserID); - -FOUNDATION_EXPORT void Open_im_sdkRevokeMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkSdkVersion(void); - -FOUNDATION_EXPORT void Open_im_sdkSendMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable groupID, NSString* _Nullable offlinePushInfo); - -FOUNDATION_EXPORT void Open_im_sdkSendMessageNotOss(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable groupID, NSString* _Nullable offlinePushInfo); - -FOUNDATION_EXPORT void Open_im_sdkSetAdvancedMsgListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkSetConversationDraft(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationID, NSString* _Nullable draftText); - -FOUNDATION_EXPORT void Open_im_sdkSetConversationListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkSetConversationRecvMessageOpt(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationIDList, long opt); - -FOUNDATION_EXPORT void Open_im_sdkSetFriendListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkSetFriendRemark(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDRemark); - -FOUNDATION_EXPORT void Open_im_sdkSetGroupInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable groupInfo); - -/** - * ////////////////////////group////////////////////////////////////////// - */ -FOUNDATION_EXPORT void Open_im_sdkSetGroupListener(id _Nullable callback); - -FOUNDATION_EXPORT void Open_im_sdkSetSelfInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userInfo); - -FOUNDATION_EXPORT void Open_im_sdkSetUserListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkTransferGroupOwner(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable newOwnerUserID); - -FOUNDATION_EXPORT void Open_im_sdkTypingStatusUpdate(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable recvID, NSString* _Nullable msgTip); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkUploadImage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable filePath, NSString* _Nullable token, NSString* _Nullable obj); - -#endif diff --git a/ios/Framework/OpenIMCore.framework/Headers/Universe.objc.h b/ios/Framework/OpenIMCore.framework/Headers/Universe.objc.h deleted file mode 100644 index 019e750..0000000 --- a/ios/Framework/OpenIMCore.framework/Headers/Universe.objc.h +++ /dev/null @@ -1,29 +0,0 @@ -// Objective-C API for talking to Go package. -// gobind -lang=objc -// -// File is generated by gobind. Do not edit. - -#ifndef __Universe_H__ -#define __Universe_H__ - -@import Foundation; -#include "ref.h" - -@protocol Universeerror; -@class Universeerror; - -@protocol Universeerror -- (NSString* _Nonnull)error; -@end - -@class Universeerror; - -@interface Universeerror : NSError { -} -@property(strong, readonly) _Nonnull id _ref; - -- (nonnull instancetype)initWithRef:(_Nonnull id)ref; -- (NSString* _Nonnull)error; -@end - -#endif diff --git a/ios/Framework/OpenIMCore.framework/Headers/ref.h b/ios/Framework/OpenIMCore.framework/Headers/ref.h deleted file mode 100644 index b8036a4..0000000 --- a/ios/Framework/OpenIMCore.framework/Headers/ref.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#ifndef __GO_REF_HDR__ -#define __GO_REF_HDR__ - -#include - -// GoSeqRef is an object tagged with an integer for passing back and -// forth across the language boundary. A GoSeqRef may represent either -// an instance of a Go object, or an Objective-C object passed to Go. -// The explicit allocation of a GoSeqRef is used to pin a Go object -// when it is passed to Objective-C. The Go seq package maintains a -// reference to the Go object in a map keyed by the refnum along with -// a reference count. When the reference count reaches zero, the Go -// seq package will clear the corresponding entry in the map. -@interface GoSeqRef : NSObject { -} -@property(readonly) int32_t refnum; -@property(strong) id obj; // NULL when representing a Go object. - -// new GoSeqRef object to proxy a Go object. The refnum must be -// provided from Go side. -- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj; - -- (int32_t)incNum; - -@end - -@protocol goSeqRefInterface --(GoSeqRef*) _ref; -@end - -#endif diff --git a/ios/Framework/OpenIMCore.framework/Modules/module.modulemap b/ios/Framework/OpenIMCore.framework/Modules/module.modulemap deleted file mode 100644 index 6c7ae76..0000000 --- a/ios/Framework/OpenIMCore.framework/Modules/module.modulemap +++ /dev/null @@ -1,9 +0,0 @@ -framework module "OpenIMCore" { - header "ref.h" - header "Open_im_sdk.objc.h" - header "Open_im_sdk_callback.objc.h" - header "Universe.objc.h" - header "OpenIMCore.h" - - export * -} \ No newline at end of file diff --git a/ios/Framework/OpenIMCore.framework/OpenIMCore b/ios/Framework/OpenIMCore.framework/OpenIMCore deleted file mode 100644 index e430959..0000000 Binary files a/ios/Framework/OpenIMCore.framework/OpenIMCore and /dev/null differ diff --git a/ios/Framework/OpenIMCore.framework/Resources/Info.plist b/ios/Framework/OpenIMCore.framework/Resources/Info.plist deleted file mode 100644 index 0d1a4b8..0000000 --- a/ios/Framework/OpenIMCore.framework/Resources/Info.plist +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - 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 @@ LibraryIdentifier - ios-arm64 + ios-arm64_x86_64-simulator LibraryPath OpenIMCore.framework SupportedArchitectures arm64 + x86_64 SupportedPlatform ios + SupportedPlatformVariant + simulator LibraryIdentifier - ios-arm64_x86_64-simulator + ios-arm64 LibraryPath OpenIMCore.framework SupportedArchitectures arm64 - x86_64 SupportedPlatform ios - SupportedPlatformVariant - simulator CFBundlePackageType diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Headers b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Headers new file mode 120000 index 0000000..a177d2a --- /dev/null +++ b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Headers @@ -0,0 +1 @@ +Versions/Current/Headers \ No newline at end of file diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Headers/OpenIMCore.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Headers/OpenIMCore.h deleted file mode 100644 index 9534b48..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Headers/OpenIMCore.h +++ /dev/null @@ -1,15 +0,0 @@ - -// Objective-C API for talking to the following Go packages -// -// open_im_sdk/open_im_sdk -// open_im_sdk/open_im_sdk_callback -// -// File is generated by gomobile bind. Do not edit. -#ifndef __OpenIMCore_FRAMEWORK_H__ -#define __OpenIMCore_FRAMEWORK_H__ - -#include "Open_im_sdk.objc.h" -#include "Open_im_sdk_callback.objc.h" -#include "Universe.objc.h" - -#endif 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 deleted file mode 100644 index 7361321..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Headers/Open_im_sdk.objc.h +++ /dev/null @@ -1,206 +0,0 @@ -// Objective-C API for talking to open_im_sdk/open_im_sdk Go package. -// gobind -lang=objc open_im_sdk/open_im_sdk -// -// File is generated by gobind. Do not edit. - -#ifndef __Open_im_sdk_H__ -#define __Open_im_sdk_H__ - -@import Foundation; -#include "ref.h" -#include "Universe.objc.h" - -#include "Open_im_sdk_callback.objc.h" - -@interface Open_im_sdk : NSObject -// skipped variable UserRouterMap with unsupported type: map[string]*open_im_sdk/internal/login.LoginMgr - -// skipped variable UserSDKRwLock with unsupported type: sync.RWMutex - -@end - -FOUNDATION_EXPORT void Open_im_sdkAcceptFriendApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDHandleMsg); - -FOUNDATION_EXPORT void Open_im_sdkAcceptGroupApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable fromUserID, NSString* _Nullable handleMsg); - -FOUNDATION_EXPORT void Open_im_sdkAddBlack(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable blackUserID); - -FOUNDATION_EXPORT void Open_im_sdkAddFriend(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDReqMsg); - -FOUNDATION_EXPORT void Open_im_sdkCheckFriend(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT BOOL Open_im_sdkCheckToken(NSString* _Nullable userID, NSString* _Nullable token, NSError* _Nullable* _Nullable error); - -FOUNDATION_EXPORT void Open_im_sdkClearC2CHistoryMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userID); - -FOUNDATION_EXPORT void Open_im_sdkClearGroupHistoryMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCardMessage(NSString* _Nullable operationID, NSString* _Nullable cardInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCustomMessage(NSString* _Nullable operationID, NSString* _Nullable data, NSString* _Nullable extension, NSString* _Nullable description); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateFileMessage(NSString* _Nullable operationID, NSString* _Nullable filePath, NSString* _Nullable fileName); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateFileMessageByURL(NSString* _Nullable operationID, NSString* _Nullable fileBaseInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateFileMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable fileFullPath, NSString* _Nullable fileName); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateForwardMessage(NSString* _Nullable operationID, NSString* _Nullable m); - -FOUNDATION_EXPORT void Open_im_sdkCreateGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupBaseInfo, NSString* _Nullable memberList); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateImageMessage(NSString* _Nullable operationID, NSString* _Nullable imagePath); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateImageMessageByURL(NSString* _Nullable operationID, NSString* _Nullable sourcePicture, NSString* _Nullable bigPicture, NSString* _Nullable snapshotPicture); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateImageMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable imageFullPath); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateLocationMessage(NSString* _Nullable operationID, NSString* _Nullable description, double longitude, double latitude); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateMergerMessage(NSString* _Nullable operationID, NSString* _Nullable messageList, NSString* _Nullable title, NSString* _Nullable summaryList); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateQuoteMessage(NSString* _Nullable operationID, NSString* _Nullable text, NSString* _Nullable message); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateSoundMessage(NSString* _Nullable operationID, NSString* _Nullable soundPath, int64_t duration); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateSoundMessageByURL(NSString* _Nullable operationID, NSString* _Nullable soundBaseInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateSoundMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable soundPath, int64_t duration); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateTextAtMessage(NSString* _Nullable operationID, NSString* _Nullable text, NSString* _Nullable atUserList); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateTextMessage(NSString* _Nullable operationID, NSString* _Nullable text); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateVideoMessage(NSString* _Nullable operationID, NSString* _Nullable videoPath, NSString* _Nullable videoType, int64_t duration, NSString* _Nullable snapshotPath); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateVideoMessageByURL(NSString* _Nullable operationID, NSString* _Nullable videoBaseInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateVideoMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable videoFullPath, NSString* _Nullable videoType, int64_t duration, NSString* _Nullable snapshotFullPath); - -FOUNDATION_EXPORT void Open_im_sdkDeleteConversation(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationID); - -FOUNDATION_EXPORT void Open_im_sdkDeleteFriend(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable friendUserID); - -FOUNDATION_EXPORT void Open_im_sdkDeleteMessageFromLocalStorage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message); - -FOUNDATION_EXPORT void Open_im_sdkGetAllConversationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetBlackList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkGetConversationIDBySessionType(NSString* _Nullable sourceID, long sessionType); - -FOUNDATION_EXPORT void Open_im_sdkGetConversationListSplit(id _Nullable callback, NSString* _Nullable operationID, long offset, long count); - -FOUNDATION_EXPORT void Open_im_sdkGetConversationRecvMessageOpt(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetDesignatedFriendsInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetFriendList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetGroupMemberList(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, int32_t filter, int32_t offset, int32_t count); - -FOUNDATION_EXPORT void Open_im_sdkGetGroupMembersInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetGroupsInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetHistoryMessageList(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable getMessageOptions); - -FOUNDATION_EXPORT void Open_im_sdkGetJoinedGroupList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT int32_t Open_im_sdkGetLoginStatus(void); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkGetLoginUser(void); - -FOUNDATION_EXPORT void Open_im_sdkGetMultipleConversation(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetOneConversation(id _Nullable callback, NSString* _Nullable operationID, long sessionType, NSString* _Nullable sourceID); - -FOUNDATION_EXPORT void Open_im_sdkGetRecvFriendApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetRecvGroupApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetSelfUserInfo(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetSendFriendApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetSendGroupApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetTotalUnreadMsgCount(id _Nullable callback, NSString* _Nullable operationID); - -// skipped function GetUserWorker with unsupported parameter or return types - - -/** - * /////////////////////user///////////////////// - */ -FOUNDATION_EXPORT void Open_im_sdkGetUsersInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDList); - -// skipped function InitOnce with unsupported parameter or return types - - -FOUNDATION_EXPORT BOOL Open_im_sdkInitSDK(id _Nullable listener, NSString* _Nullable operationID, NSString* _Nullable config); - -FOUNDATION_EXPORT void Open_im_sdkInsertSingleMessageToLocalStorage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable sendID); - -FOUNDATION_EXPORT void Open_im_sdkInviteUserToGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable reason, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkJoinGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable reqMsg); - -FOUNDATION_EXPORT void Open_im_sdkKickGroupMember(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable reason, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkLogin(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userID, NSString* _Nullable token); - -FOUNDATION_EXPORT void Open_im_sdkLogout(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkMarkC2CMessageAsRead(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userID, NSString* _Nullable msgIDList); - -FOUNDATION_EXPORT void Open_im_sdkMarkGroupMessageHasRead(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID); - -FOUNDATION_EXPORT void Open_im_sdkPinConversation(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationID, BOOL isPinned); - -FOUNDATION_EXPORT void Open_im_sdkQuitGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID); - -FOUNDATION_EXPORT void Open_im_sdkRefuseFriendApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDHandleMsg); - -FOUNDATION_EXPORT void Open_im_sdkRefuseGroupApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable fromUserID, NSString* _Nullable handleMsg); - -FOUNDATION_EXPORT void Open_im_sdkRemoveBlack(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable removeUserID); - -FOUNDATION_EXPORT void Open_im_sdkRevokeMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkSdkVersion(void); - -FOUNDATION_EXPORT void Open_im_sdkSendMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable groupID, NSString* _Nullable offlinePushInfo); - -FOUNDATION_EXPORT void Open_im_sdkSendMessageNotOss(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable groupID, NSString* _Nullable offlinePushInfo); - -FOUNDATION_EXPORT void Open_im_sdkSetAdvancedMsgListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkSetConversationDraft(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationID, NSString* _Nullable draftText); - -FOUNDATION_EXPORT void Open_im_sdkSetConversationListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkSetConversationRecvMessageOpt(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationIDList, long opt); - -FOUNDATION_EXPORT void Open_im_sdkSetFriendListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkSetFriendRemark(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDRemark); - -FOUNDATION_EXPORT void Open_im_sdkSetGroupInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable groupInfo); - -/** - * ////////////////////////group////////////////////////////////////////// - */ -FOUNDATION_EXPORT void Open_im_sdkSetGroupListener(id _Nullable callback); - -FOUNDATION_EXPORT void Open_im_sdkSetSelfInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userInfo); - -FOUNDATION_EXPORT void Open_im_sdkSetUserListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkTransferGroupOwner(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable newOwnerUserID); - -FOUNDATION_EXPORT void Open_im_sdkTypingStatusUpdate(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable recvID, NSString* _Nullable msgTip); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkUploadImage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable filePath, NSString* _Nullable token, NSString* _Nullable obj); - -#endif diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Headers/Universe.objc.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Headers/Universe.objc.h deleted file mode 100644 index 019e750..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Headers/Universe.objc.h +++ /dev/null @@ -1,29 +0,0 @@ -// Objective-C API for talking to Go package. -// gobind -lang=objc -// -// File is generated by gobind. Do not edit. - -#ifndef __Universe_H__ -#define __Universe_H__ - -@import Foundation; -#include "ref.h" - -@protocol Universeerror; -@class Universeerror; - -@protocol Universeerror -- (NSString* _Nonnull)error; -@end - -@class Universeerror; - -@interface Universeerror : NSError { -} -@property(strong, readonly) _Nonnull id _ref; - -- (nonnull instancetype)initWithRef:(_Nonnull id)ref; -- (NSString* _Nonnull)error; -@end - -#endif diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Headers/ref.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Headers/ref.h deleted file mode 100644 index b8036a4..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Headers/ref.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#ifndef __GO_REF_HDR__ -#define __GO_REF_HDR__ - -#include - -// GoSeqRef is an object tagged with an integer for passing back and -// forth across the language boundary. A GoSeqRef may represent either -// an instance of a Go object, or an Objective-C object passed to Go. -// The explicit allocation of a GoSeqRef is used to pin a Go object -// when it is passed to Objective-C. The Go seq package maintains a -// reference to the Go object in a map keyed by the refnum along with -// a reference count. When the reference count reaches zero, the Go -// seq package will clear the corresponding entry in the map. -@interface GoSeqRef : NSObject { -} -@property(readonly) int32_t refnum; -@property(strong) id obj; // NULL when representing a Go object. - -// new GoSeqRef object to proxy a Go object. The refnum must be -// provided from Go side. -- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj; - -- (int32_t)incNum; - -@end - -@protocol goSeqRefInterface --(GoSeqRef*) _ref; -@end - -#endif diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Modules b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Modules new file mode 120000 index 0000000..5736f31 --- /dev/null +++ b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Modules @@ -0,0 +1 @@ +Versions/Current/Modules \ No newline at end of file diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Modules/module.modulemap b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Modules/module.modulemap deleted file mode 100644 index 6c7ae76..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Modules/module.modulemap +++ /dev/null @@ -1,9 +0,0 @@ -framework module "OpenIMCore" { - header "ref.h" - header "Open_im_sdk.objc.h" - header "Open_im_sdk_callback.objc.h" - header "Universe.objc.h" - header "OpenIMCore.h" - - export * -} \ No newline at end of file diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/OpenIMCore b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/OpenIMCore deleted file mode 100644 index e430959..0000000 Binary files a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/OpenIMCore and /dev/null differ diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/OpenIMCore b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/OpenIMCore new file mode 120000 index 0000000..ee0dd1d --- /dev/null +++ b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/OpenIMCore @@ -0,0 +1 @@ +Versions/Current/OpenIMCore \ No newline at end of file diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Resources b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Resources new file mode 120000 index 0000000..953ee36 --- /dev/null +++ b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources \ No newline at end of file diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Resources/Info.plist b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Resources/Info.plist deleted file mode 100644 index 0d1a4b8..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Resources/Info.plist +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - 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 7361321..9b7e917 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 @@ -140,6 +140,8 @@ FOUNDATION_EXPORT void Open_im_sdkGetUsersInfo(id _Nul FOUNDATION_EXPORT BOOL Open_im_sdkInitSDK(id _Nullable listener, NSString* _Nullable operationID, NSString* _Nullable config); +FOUNDATION_EXPORT void Open_im_sdkInsertGroupMessageToLocalStorage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable groupID, NSString* _Nullable sendID); + FOUNDATION_EXPORT void Open_im_sdkInsertSingleMessageToLocalStorage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable sendID); FOUNDATION_EXPORT void Open_im_sdkInviteUserToGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable reason, NSString* _Nullable userIDList); @@ -170,6 +172,8 @@ FOUNDATION_EXPORT void Open_im_sdkRevokeMessage(id _Nu FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkSdkVersion(void); +FOUNDATION_EXPORT void Open_im_sdkSearchLocalMessages(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable searchParam); + FOUNDATION_EXPORT void Open_im_sdkSendMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable groupID, NSString* _Nullable offlinePushInfo); FOUNDATION_EXPORT void Open_im_sdkSendMessageNotOss(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable groupID, NSString* _Nullable offlinePushInfo); diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/A/Headers/Open_im_sdk_callback.objc.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/A/Headers/Open_im_sdk_callback.objc.h new file mode 100644 index 0000000..fbd0f89 --- /dev/null +++ b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/A/Headers/Open_im_sdk_callback.objc.h @@ -0,0 +1,205 @@ +// Objective-C API for talking to open_im_sdk/open_im_sdk_callback Go package. +// gobind -lang=objc open_im_sdk/open_im_sdk_callback +// +// File is generated by gobind. Do not edit. + +#ifndef __Open_im_sdk_callback_H__ +#define __Open_im_sdk_callback_H__ + +@import Foundation; +#include "ref.h" +#include "Universe.objc.h" + + +@protocol Open_im_sdk_callbackBase; +@class Open_im_sdk_callbackBase; +@protocol Open_im_sdk_callbackOnAdvancedMsgListener; +@class Open_im_sdk_callbackOnAdvancedMsgListener; +@protocol Open_im_sdk_callbackOnConnListener; +@class Open_im_sdk_callbackOnConnListener; +@protocol Open_im_sdk_callbackOnConversationListener; +@class Open_im_sdk_callbackOnConversationListener; +@protocol Open_im_sdk_callbackOnFriendshipListener; +@class Open_im_sdk_callbackOnFriendshipListener; +@protocol Open_im_sdk_callbackOnGroupListener; +@class Open_im_sdk_callbackOnGroupListener; +@protocol Open_im_sdk_callbackOnUserListener; +@class Open_im_sdk_callbackOnUserListener; +@protocol Open_im_sdk_callbackSendMsgCallBack; +@class Open_im_sdk_callbackSendMsgCallBack; + +@protocol Open_im_sdk_callbackBase +- (void)onError:(int32_t)errCode errMsg:(NSString* _Nullable)errMsg; +- (void)onSuccess:(NSString* _Nullable)data; +@end + +@protocol Open_im_sdk_callbackOnAdvancedMsgListener +- (void)onRecvC2CReadReceipt:(NSString* _Nullable)msgReceiptList; +- (void)onRecvMessageRevoked:(NSString* _Nullable)msgId; +- (void)onRecvNewMessage:(NSString* _Nullable)message; +@end + +@protocol Open_im_sdk_callbackOnConnListener +- (void)onConnectFailed:(int32_t)errCode errMsg:(NSString* _Nullable)errMsg; +- (void)onConnectSuccess; +- (void)onConnecting; +- (void)onKickedOffline; +- (void)onUserTokenExpired; +@end + +@protocol Open_im_sdk_callbackOnConversationListener +- (void)onConversationChanged:(NSString* _Nullable)conversationList; +- (void)onNewConversation:(NSString* _Nullable)conversationList; +- (void)onSyncServerFailed; +- (void)onSyncServerFinish; +- (void)onSyncServerStart; +- (void)onTotalUnreadMessageCountChanged:(int32_t)totalUnreadCount; +@end + +@protocol Open_im_sdk_callbackOnFriendshipListener +- (void)onBlackAdded:(NSString* _Nullable)blackInfo; +- (void)onBlackDeleted:(NSString* _Nullable)blackInfo; +- (void)onFriendAdded:(NSString* _Nullable)friendInfo; +- (void)onFriendApplicationAccepted:(NSString* _Nullable)groupApplication; +- (void)onFriendApplicationAdded:(NSString* _Nullable)friendApplication; +- (void)onFriendApplicationDeleted:(NSString* _Nullable)friendApplication; +- (void)onFriendApplicationRejected:(NSString* _Nullable)friendApplication; +- (void)onFriendDeleted:(NSString* _Nullable)friendInfo; +- (void)onFriendInfoChanged:(NSString* _Nullable)friendInfo; +@end + +@protocol Open_im_sdk_callbackOnGroupListener +- (void)onGroupApplicationAccepted:(NSString* _Nullable)groupApplication; +- (void)onGroupApplicationAdded:(NSString* _Nullable)groupApplication; +- (void)onGroupApplicationDeleted:(NSString* _Nullable)groupApplication; +- (void)onGroupApplicationRejected:(NSString* _Nullable)groupApplication; +- (void)onGroupInfoChanged:(NSString* _Nullable)groupInfo; +- (void)onGroupMemberAdded:(NSString* _Nullable)groupMemberInfo; +- (void)onGroupMemberDeleted:(NSString* _Nullable)groupMemberInfo; +- (void)onGroupMemberInfoChanged:(NSString* _Nullable)groupMemberInfo; +- (void)onJoinedGroupAdded:(NSString* _Nullable)groupInfo; +- (void)onJoinedGroupDeleted:(NSString* _Nullable)groupInfo; +@end + +@protocol Open_im_sdk_callbackOnUserListener +- (void)onSelfInfoUpdated:(NSString* _Nullable)userInfo; +@end + +@protocol Open_im_sdk_callbackSendMsgCallBack +- (void)onError:(int32_t)errCode errMsg:(NSString* _Nullable)errMsg; +- (void)onProgress:(long)progress; +- (void)onSuccess:(NSString* _Nullable)data; +@end + +@class Open_im_sdk_callbackBase; + +@class Open_im_sdk_callbackOnAdvancedMsgListener; + +@class Open_im_sdk_callbackOnConnListener; + +@class Open_im_sdk_callbackOnConversationListener; + +@class Open_im_sdk_callbackOnFriendshipListener; + +@class Open_im_sdk_callbackOnGroupListener; + +@class Open_im_sdk_callbackOnUserListener; + +@class Open_im_sdk_callbackSendMsgCallBack; + +@interface Open_im_sdk_callbackBase : NSObject { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)onError:(int32_t)errCode errMsg:(NSString* _Nullable)errMsg; +- (void)onSuccess:(NSString* _Nullable)data; +@end + +@interface Open_im_sdk_callbackOnAdvancedMsgListener : NSObject { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)onRecvC2CReadReceipt:(NSString* _Nullable)msgReceiptList; +- (void)onRecvMessageRevoked:(NSString* _Nullable)msgId; +- (void)onRecvNewMessage:(NSString* _Nullable)message; +@end + +@interface Open_im_sdk_callbackOnConnListener : NSObject { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)onConnectFailed:(int32_t)errCode errMsg:(NSString* _Nullable)errMsg; +- (void)onConnectSuccess; +- (void)onConnecting; +- (void)onKickedOffline; +- (void)onUserTokenExpired; +@end + +@interface Open_im_sdk_callbackOnConversationListener : NSObject { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)onConversationChanged:(NSString* _Nullable)conversationList; +- (void)onNewConversation:(NSString* _Nullable)conversationList; +- (void)onSyncServerFailed; +- (void)onSyncServerFinish; +- (void)onSyncServerStart; +- (void)onTotalUnreadMessageCountChanged:(int32_t)totalUnreadCount; +@end + +@interface Open_im_sdk_callbackOnFriendshipListener : NSObject { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)onBlackAdded:(NSString* _Nullable)blackInfo; +- (void)onBlackDeleted:(NSString* _Nullable)blackInfo; +- (void)onFriendAdded:(NSString* _Nullable)friendInfo; +- (void)onFriendApplicationAccepted:(NSString* _Nullable)groupApplication; +- (void)onFriendApplicationAdded:(NSString* _Nullable)friendApplication; +- (void)onFriendApplicationDeleted:(NSString* _Nullable)friendApplication; +- (void)onFriendApplicationRejected:(NSString* _Nullable)friendApplication; +- (void)onFriendDeleted:(NSString* _Nullable)friendInfo; +- (void)onFriendInfoChanged:(NSString* _Nullable)friendInfo; +@end + +@interface Open_im_sdk_callbackOnGroupListener : NSObject { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)onGroupApplicationAccepted:(NSString* _Nullable)groupApplication; +- (void)onGroupApplicationAdded:(NSString* _Nullable)groupApplication; +- (void)onGroupApplicationDeleted:(NSString* _Nullable)groupApplication; +- (void)onGroupApplicationRejected:(NSString* _Nullable)groupApplication; +- (void)onGroupInfoChanged:(NSString* _Nullable)groupInfo; +- (void)onGroupMemberAdded:(NSString* _Nullable)groupMemberInfo; +- (void)onGroupMemberDeleted:(NSString* _Nullable)groupMemberInfo; +- (void)onGroupMemberInfoChanged:(NSString* _Nullable)groupMemberInfo; +- (void)onJoinedGroupAdded:(NSString* _Nullable)groupInfo; +- (void)onJoinedGroupDeleted:(NSString* _Nullable)groupInfo; +@end + +@interface Open_im_sdk_callbackOnUserListener : NSObject { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)onSelfInfoUpdated:(NSString* _Nullable)userInfo; +@end + +@interface Open_im_sdk_callbackSendMsgCallBack : NSObject { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)onError:(int32_t)errCode errMsg:(NSString* _Nullable)errMsg; +- (void)onProgress:(long)progress; +- (void)onSuccess:(NSString* _Nullable)data; +@end + +#endif 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 e430959..e8beb05 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 b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current new file mode 120000 index 0000000..8c7e5a6 --- /dev/null +++ b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current @@ -0,0 +1 @@ +A \ No newline at end of file diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Headers/OpenIMCore.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Headers/OpenIMCore.h deleted file mode 100644 index 9534b48..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Headers/OpenIMCore.h +++ /dev/null @@ -1,15 +0,0 @@ - -// Objective-C API for talking to the following Go packages -// -// open_im_sdk/open_im_sdk -// open_im_sdk/open_im_sdk_callback -// -// File is generated by gomobile bind. Do not edit. -#ifndef __OpenIMCore_FRAMEWORK_H__ -#define __OpenIMCore_FRAMEWORK_H__ - -#include "Open_im_sdk.objc.h" -#include "Open_im_sdk_callback.objc.h" -#include "Universe.objc.h" - -#endif 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 deleted file mode 100644 index 7361321..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Headers/Open_im_sdk.objc.h +++ /dev/null @@ -1,206 +0,0 @@ -// Objective-C API for talking to open_im_sdk/open_im_sdk Go package. -// gobind -lang=objc open_im_sdk/open_im_sdk -// -// File is generated by gobind. Do not edit. - -#ifndef __Open_im_sdk_H__ -#define __Open_im_sdk_H__ - -@import Foundation; -#include "ref.h" -#include "Universe.objc.h" - -#include "Open_im_sdk_callback.objc.h" - -@interface Open_im_sdk : NSObject -// skipped variable UserRouterMap with unsupported type: map[string]*open_im_sdk/internal/login.LoginMgr - -// skipped variable UserSDKRwLock with unsupported type: sync.RWMutex - -@end - -FOUNDATION_EXPORT void Open_im_sdkAcceptFriendApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDHandleMsg); - -FOUNDATION_EXPORT void Open_im_sdkAcceptGroupApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable fromUserID, NSString* _Nullable handleMsg); - -FOUNDATION_EXPORT void Open_im_sdkAddBlack(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable blackUserID); - -FOUNDATION_EXPORT void Open_im_sdkAddFriend(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDReqMsg); - -FOUNDATION_EXPORT void Open_im_sdkCheckFriend(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT BOOL Open_im_sdkCheckToken(NSString* _Nullable userID, NSString* _Nullable token, NSError* _Nullable* _Nullable error); - -FOUNDATION_EXPORT void Open_im_sdkClearC2CHistoryMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userID); - -FOUNDATION_EXPORT void Open_im_sdkClearGroupHistoryMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCardMessage(NSString* _Nullable operationID, NSString* _Nullable cardInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCustomMessage(NSString* _Nullable operationID, NSString* _Nullable data, NSString* _Nullable extension, NSString* _Nullable description); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateFileMessage(NSString* _Nullable operationID, NSString* _Nullable filePath, NSString* _Nullable fileName); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateFileMessageByURL(NSString* _Nullable operationID, NSString* _Nullable fileBaseInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateFileMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable fileFullPath, NSString* _Nullable fileName); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateForwardMessage(NSString* _Nullable operationID, NSString* _Nullable m); - -FOUNDATION_EXPORT void Open_im_sdkCreateGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupBaseInfo, NSString* _Nullable memberList); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateImageMessage(NSString* _Nullable operationID, NSString* _Nullable imagePath); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateImageMessageByURL(NSString* _Nullable operationID, NSString* _Nullable sourcePicture, NSString* _Nullable bigPicture, NSString* _Nullable snapshotPicture); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateImageMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable imageFullPath); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateLocationMessage(NSString* _Nullable operationID, NSString* _Nullable description, double longitude, double latitude); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateMergerMessage(NSString* _Nullable operationID, NSString* _Nullable messageList, NSString* _Nullable title, NSString* _Nullable summaryList); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateQuoteMessage(NSString* _Nullable operationID, NSString* _Nullable text, NSString* _Nullable message); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateSoundMessage(NSString* _Nullable operationID, NSString* _Nullable soundPath, int64_t duration); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateSoundMessageByURL(NSString* _Nullable operationID, NSString* _Nullable soundBaseInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateSoundMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable soundPath, int64_t duration); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateTextAtMessage(NSString* _Nullable operationID, NSString* _Nullable text, NSString* _Nullable atUserList); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateTextMessage(NSString* _Nullable operationID, NSString* _Nullable text); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateVideoMessage(NSString* _Nullable operationID, NSString* _Nullable videoPath, NSString* _Nullable videoType, int64_t duration, NSString* _Nullable snapshotPath); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateVideoMessageByURL(NSString* _Nullable operationID, NSString* _Nullable videoBaseInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateVideoMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable videoFullPath, NSString* _Nullable videoType, int64_t duration, NSString* _Nullable snapshotFullPath); - -FOUNDATION_EXPORT void Open_im_sdkDeleteConversation(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationID); - -FOUNDATION_EXPORT void Open_im_sdkDeleteFriend(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable friendUserID); - -FOUNDATION_EXPORT void Open_im_sdkDeleteMessageFromLocalStorage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message); - -FOUNDATION_EXPORT void Open_im_sdkGetAllConversationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetBlackList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkGetConversationIDBySessionType(NSString* _Nullable sourceID, long sessionType); - -FOUNDATION_EXPORT void Open_im_sdkGetConversationListSplit(id _Nullable callback, NSString* _Nullable operationID, long offset, long count); - -FOUNDATION_EXPORT void Open_im_sdkGetConversationRecvMessageOpt(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetDesignatedFriendsInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetFriendList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetGroupMemberList(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, int32_t filter, int32_t offset, int32_t count); - -FOUNDATION_EXPORT void Open_im_sdkGetGroupMembersInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetGroupsInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetHistoryMessageList(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable getMessageOptions); - -FOUNDATION_EXPORT void Open_im_sdkGetJoinedGroupList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT int32_t Open_im_sdkGetLoginStatus(void); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkGetLoginUser(void); - -FOUNDATION_EXPORT void Open_im_sdkGetMultipleConversation(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetOneConversation(id _Nullable callback, NSString* _Nullable operationID, long sessionType, NSString* _Nullable sourceID); - -FOUNDATION_EXPORT void Open_im_sdkGetRecvFriendApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetRecvGroupApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetSelfUserInfo(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetSendFriendApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetSendGroupApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetTotalUnreadMsgCount(id _Nullable callback, NSString* _Nullable operationID); - -// skipped function GetUserWorker with unsupported parameter or return types - - -/** - * /////////////////////user///////////////////// - */ -FOUNDATION_EXPORT void Open_im_sdkGetUsersInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDList); - -// skipped function InitOnce with unsupported parameter or return types - - -FOUNDATION_EXPORT BOOL Open_im_sdkInitSDK(id _Nullable listener, NSString* _Nullable operationID, NSString* _Nullable config); - -FOUNDATION_EXPORT void Open_im_sdkInsertSingleMessageToLocalStorage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable sendID); - -FOUNDATION_EXPORT void Open_im_sdkInviteUserToGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable reason, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkJoinGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable reqMsg); - -FOUNDATION_EXPORT void Open_im_sdkKickGroupMember(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable reason, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkLogin(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userID, NSString* _Nullable token); - -FOUNDATION_EXPORT void Open_im_sdkLogout(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkMarkC2CMessageAsRead(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userID, NSString* _Nullable msgIDList); - -FOUNDATION_EXPORT void Open_im_sdkMarkGroupMessageHasRead(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID); - -FOUNDATION_EXPORT void Open_im_sdkPinConversation(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationID, BOOL isPinned); - -FOUNDATION_EXPORT void Open_im_sdkQuitGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID); - -FOUNDATION_EXPORT void Open_im_sdkRefuseFriendApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDHandleMsg); - -FOUNDATION_EXPORT void Open_im_sdkRefuseGroupApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable fromUserID, NSString* _Nullable handleMsg); - -FOUNDATION_EXPORT void Open_im_sdkRemoveBlack(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable removeUserID); - -FOUNDATION_EXPORT void Open_im_sdkRevokeMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkSdkVersion(void); - -FOUNDATION_EXPORT void Open_im_sdkSendMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable groupID, NSString* _Nullable offlinePushInfo); - -FOUNDATION_EXPORT void Open_im_sdkSendMessageNotOss(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable groupID, NSString* _Nullable offlinePushInfo); - -FOUNDATION_EXPORT void Open_im_sdkSetAdvancedMsgListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkSetConversationDraft(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationID, NSString* _Nullable draftText); - -FOUNDATION_EXPORT void Open_im_sdkSetConversationListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkSetConversationRecvMessageOpt(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationIDList, long opt); - -FOUNDATION_EXPORT void Open_im_sdkSetFriendListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkSetFriendRemark(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDRemark); - -FOUNDATION_EXPORT void Open_im_sdkSetGroupInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable groupInfo); - -/** - * ////////////////////////group////////////////////////////////////////// - */ -FOUNDATION_EXPORT void Open_im_sdkSetGroupListener(id _Nullable callback); - -FOUNDATION_EXPORT void Open_im_sdkSetSelfInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userInfo); - -FOUNDATION_EXPORT void Open_im_sdkSetUserListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkTransferGroupOwner(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable newOwnerUserID); - -FOUNDATION_EXPORT void Open_im_sdkTypingStatusUpdate(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable recvID, NSString* _Nullable msgTip); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkUploadImage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable filePath, NSString* _Nullable token, NSString* _Nullable obj); - -#endif diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Headers/Universe.objc.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Headers/Universe.objc.h deleted file mode 100644 index 019e750..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Headers/Universe.objc.h +++ /dev/null @@ -1,29 +0,0 @@ -// Objective-C API for talking to Go package. -// gobind -lang=objc -// -// File is generated by gobind. Do not edit. - -#ifndef __Universe_H__ -#define __Universe_H__ - -@import Foundation; -#include "ref.h" - -@protocol Universeerror; -@class Universeerror; - -@protocol Universeerror -- (NSString* _Nonnull)error; -@end - -@class Universeerror; - -@interface Universeerror : NSError { -} -@property(strong, readonly) _Nonnull id _ref; - -- (nonnull instancetype)initWithRef:(_Nonnull id)ref; -- (NSString* _Nonnull)error; -@end - -#endif diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Headers/ref.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Headers/ref.h deleted file mode 100644 index b8036a4..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Headers/ref.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#ifndef __GO_REF_HDR__ -#define __GO_REF_HDR__ - -#include - -// GoSeqRef is an object tagged with an integer for passing back and -// forth across the language boundary. A GoSeqRef may represent either -// an instance of a Go object, or an Objective-C object passed to Go. -// The explicit allocation of a GoSeqRef is used to pin a Go object -// when it is passed to Objective-C. The Go seq package maintains a -// reference to the Go object in a map keyed by the refnum along with -// a reference count. When the reference count reaches zero, the Go -// seq package will clear the corresponding entry in the map. -@interface GoSeqRef : NSObject { -} -@property(readonly) int32_t refnum; -@property(strong) id obj; // NULL when representing a Go object. - -// new GoSeqRef object to proxy a Go object. The refnum must be -// provided from Go side. -- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj; - -- (int32_t)incNum; - -@end - -@protocol goSeqRefInterface --(GoSeqRef*) _ref; -@end - -#endif diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Modules/module.modulemap b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Modules/module.modulemap deleted file mode 100644 index 6c7ae76..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Modules/module.modulemap +++ /dev/null @@ -1,9 +0,0 @@ -framework module "OpenIMCore" { - header "ref.h" - header "Open_im_sdk.objc.h" - header "Open_im_sdk_callback.objc.h" - header "Universe.objc.h" - header "OpenIMCore.h" - - export * -} \ No newline at end of file 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 deleted file mode 100644 index e430959..0000000 Binary files a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/OpenIMCore and /dev/null differ diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Resources/Info.plist b/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Resources/Info.plist deleted file mode 100644 index 0d1a4b8..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64/OpenIMCore.framework/Versions/Current/Resources/Info.plist +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Headers b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Headers new file mode 120000 index 0000000..a177d2a --- /dev/null +++ b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Headers @@ -0,0 +1 @@ +Versions/Current/Headers \ No newline at end of file diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Headers/OpenIMCore.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Headers/OpenIMCore.h deleted file mode 100644 index 9534b48..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Headers/OpenIMCore.h +++ /dev/null @@ -1,15 +0,0 @@ - -// Objective-C API for talking to the following Go packages -// -// open_im_sdk/open_im_sdk -// open_im_sdk/open_im_sdk_callback -// -// File is generated by gomobile bind. Do not edit. -#ifndef __OpenIMCore_FRAMEWORK_H__ -#define __OpenIMCore_FRAMEWORK_H__ - -#include "Open_im_sdk.objc.h" -#include "Open_im_sdk_callback.objc.h" -#include "Universe.objc.h" - -#endif 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 deleted file mode 100644 index 7361321..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Headers/Open_im_sdk.objc.h +++ /dev/null @@ -1,206 +0,0 @@ -// Objective-C API for talking to open_im_sdk/open_im_sdk Go package. -// gobind -lang=objc open_im_sdk/open_im_sdk -// -// File is generated by gobind. Do not edit. - -#ifndef __Open_im_sdk_H__ -#define __Open_im_sdk_H__ - -@import Foundation; -#include "ref.h" -#include "Universe.objc.h" - -#include "Open_im_sdk_callback.objc.h" - -@interface Open_im_sdk : NSObject -// skipped variable UserRouterMap with unsupported type: map[string]*open_im_sdk/internal/login.LoginMgr - -// skipped variable UserSDKRwLock with unsupported type: sync.RWMutex - -@end - -FOUNDATION_EXPORT void Open_im_sdkAcceptFriendApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDHandleMsg); - -FOUNDATION_EXPORT void Open_im_sdkAcceptGroupApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable fromUserID, NSString* _Nullable handleMsg); - -FOUNDATION_EXPORT void Open_im_sdkAddBlack(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable blackUserID); - -FOUNDATION_EXPORT void Open_im_sdkAddFriend(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDReqMsg); - -FOUNDATION_EXPORT void Open_im_sdkCheckFriend(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT BOOL Open_im_sdkCheckToken(NSString* _Nullable userID, NSString* _Nullable token, NSError* _Nullable* _Nullable error); - -FOUNDATION_EXPORT void Open_im_sdkClearC2CHistoryMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userID); - -FOUNDATION_EXPORT void Open_im_sdkClearGroupHistoryMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCardMessage(NSString* _Nullable operationID, NSString* _Nullable cardInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCustomMessage(NSString* _Nullable operationID, NSString* _Nullable data, NSString* _Nullable extension, NSString* _Nullable description); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateFileMessage(NSString* _Nullable operationID, NSString* _Nullable filePath, NSString* _Nullable fileName); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateFileMessageByURL(NSString* _Nullable operationID, NSString* _Nullable fileBaseInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateFileMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable fileFullPath, NSString* _Nullable fileName); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateForwardMessage(NSString* _Nullable operationID, NSString* _Nullable m); - -FOUNDATION_EXPORT void Open_im_sdkCreateGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupBaseInfo, NSString* _Nullable memberList); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateImageMessage(NSString* _Nullable operationID, NSString* _Nullable imagePath); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateImageMessageByURL(NSString* _Nullable operationID, NSString* _Nullable sourcePicture, NSString* _Nullable bigPicture, NSString* _Nullable snapshotPicture); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateImageMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable imageFullPath); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateLocationMessage(NSString* _Nullable operationID, NSString* _Nullable description, double longitude, double latitude); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateMergerMessage(NSString* _Nullable operationID, NSString* _Nullable messageList, NSString* _Nullable title, NSString* _Nullable summaryList); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateQuoteMessage(NSString* _Nullable operationID, NSString* _Nullable text, NSString* _Nullable message); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateSoundMessage(NSString* _Nullable operationID, NSString* _Nullable soundPath, int64_t duration); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateSoundMessageByURL(NSString* _Nullable operationID, NSString* _Nullable soundBaseInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateSoundMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable soundPath, int64_t duration); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateTextAtMessage(NSString* _Nullable operationID, NSString* _Nullable text, NSString* _Nullable atUserList); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateTextMessage(NSString* _Nullable operationID, NSString* _Nullable text); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateVideoMessage(NSString* _Nullable operationID, NSString* _Nullable videoPath, NSString* _Nullable videoType, int64_t duration, NSString* _Nullable snapshotPath); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateVideoMessageByURL(NSString* _Nullable operationID, NSString* _Nullable videoBaseInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateVideoMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable videoFullPath, NSString* _Nullable videoType, int64_t duration, NSString* _Nullable snapshotFullPath); - -FOUNDATION_EXPORT void Open_im_sdkDeleteConversation(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationID); - -FOUNDATION_EXPORT void Open_im_sdkDeleteFriend(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable friendUserID); - -FOUNDATION_EXPORT void Open_im_sdkDeleteMessageFromLocalStorage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message); - -FOUNDATION_EXPORT void Open_im_sdkGetAllConversationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetBlackList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkGetConversationIDBySessionType(NSString* _Nullable sourceID, long sessionType); - -FOUNDATION_EXPORT void Open_im_sdkGetConversationListSplit(id _Nullable callback, NSString* _Nullable operationID, long offset, long count); - -FOUNDATION_EXPORT void Open_im_sdkGetConversationRecvMessageOpt(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetDesignatedFriendsInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetFriendList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetGroupMemberList(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, int32_t filter, int32_t offset, int32_t count); - -FOUNDATION_EXPORT void Open_im_sdkGetGroupMembersInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetGroupsInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetHistoryMessageList(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable getMessageOptions); - -FOUNDATION_EXPORT void Open_im_sdkGetJoinedGroupList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT int32_t Open_im_sdkGetLoginStatus(void); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkGetLoginUser(void); - -FOUNDATION_EXPORT void Open_im_sdkGetMultipleConversation(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetOneConversation(id _Nullable callback, NSString* _Nullable operationID, long sessionType, NSString* _Nullable sourceID); - -FOUNDATION_EXPORT void Open_im_sdkGetRecvFriendApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetRecvGroupApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetSelfUserInfo(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetSendFriendApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetSendGroupApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetTotalUnreadMsgCount(id _Nullable callback, NSString* _Nullable operationID); - -// skipped function GetUserWorker with unsupported parameter or return types - - -/** - * /////////////////////user///////////////////// - */ -FOUNDATION_EXPORT void Open_im_sdkGetUsersInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDList); - -// skipped function InitOnce with unsupported parameter or return types - - -FOUNDATION_EXPORT BOOL Open_im_sdkInitSDK(id _Nullable listener, NSString* _Nullable operationID, NSString* _Nullable config); - -FOUNDATION_EXPORT void Open_im_sdkInsertSingleMessageToLocalStorage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable sendID); - -FOUNDATION_EXPORT void Open_im_sdkInviteUserToGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable reason, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkJoinGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable reqMsg); - -FOUNDATION_EXPORT void Open_im_sdkKickGroupMember(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable reason, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkLogin(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userID, NSString* _Nullable token); - -FOUNDATION_EXPORT void Open_im_sdkLogout(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkMarkC2CMessageAsRead(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userID, NSString* _Nullable msgIDList); - -FOUNDATION_EXPORT void Open_im_sdkMarkGroupMessageHasRead(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID); - -FOUNDATION_EXPORT void Open_im_sdkPinConversation(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationID, BOOL isPinned); - -FOUNDATION_EXPORT void Open_im_sdkQuitGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID); - -FOUNDATION_EXPORT void Open_im_sdkRefuseFriendApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDHandleMsg); - -FOUNDATION_EXPORT void Open_im_sdkRefuseGroupApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable fromUserID, NSString* _Nullable handleMsg); - -FOUNDATION_EXPORT void Open_im_sdkRemoveBlack(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable removeUserID); - -FOUNDATION_EXPORT void Open_im_sdkRevokeMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkSdkVersion(void); - -FOUNDATION_EXPORT void Open_im_sdkSendMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable groupID, NSString* _Nullable offlinePushInfo); - -FOUNDATION_EXPORT void Open_im_sdkSendMessageNotOss(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable groupID, NSString* _Nullable offlinePushInfo); - -FOUNDATION_EXPORT void Open_im_sdkSetAdvancedMsgListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkSetConversationDraft(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationID, NSString* _Nullable draftText); - -FOUNDATION_EXPORT void Open_im_sdkSetConversationListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkSetConversationRecvMessageOpt(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationIDList, long opt); - -FOUNDATION_EXPORT void Open_im_sdkSetFriendListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkSetFriendRemark(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDRemark); - -FOUNDATION_EXPORT void Open_im_sdkSetGroupInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable groupInfo); - -/** - * ////////////////////////group////////////////////////////////////////// - */ -FOUNDATION_EXPORT void Open_im_sdkSetGroupListener(id _Nullable callback); - -FOUNDATION_EXPORT void Open_im_sdkSetSelfInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userInfo); - -FOUNDATION_EXPORT void Open_im_sdkSetUserListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkTransferGroupOwner(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable newOwnerUserID); - -FOUNDATION_EXPORT void Open_im_sdkTypingStatusUpdate(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable recvID, NSString* _Nullable msgTip); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkUploadImage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable filePath, NSString* _Nullable token, NSString* _Nullable obj); - -#endif diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Headers/Universe.objc.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Headers/Universe.objc.h deleted file mode 100644 index 019e750..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Headers/Universe.objc.h +++ /dev/null @@ -1,29 +0,0 @@ -// Objective-C API for talking to Go package. -// gobind -lang=objc -// -// File is generated by gobind. Do not edit. - -#ifndef __Universe_H__ -#define __Universe_H__ - -@import Foundation; -#include "ref.h" - -@protocol Universeerror; -@class Universeerror; - -@protocol Universeerror -- (NSString* _Nonnull)error; -@end - -@class Universeerror; - -@interface Universeerror : NSError { -} -@property(strong, readonly) _Nonnull id _ref; - -- (nonnull instancetype)initWithRef:(_Nonnull id)ref; -- (NSString* _Nonnull)error; -@end - -#endif diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Headers/ref.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Headers/ref.h deleted file mode 100644 index b8036a4..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Headers/ref.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#ifndef __GO_REF_HDR__ -#define __GO_REF_HDR__ - -#include - -// GoSeqRef is an object tagged with an integer for passing back and -// forth across the language boundary. A GoSeqRef may represent either -// an instance of a Go object, or an Objective-C object passed to Go. -// The explicit allocation of a GoSeqRef is used to pin a Go object -// when it is passed to Objective-C. The Go seq package maintains a -// reference to the Go object in a map keyed by the refnum along with -// a reference count. When the reference count reaches zero, the Go -// seq package will clear the corresponding entry in the map. -@interface GoSeqRef : NSObject { -} -@property(readonly) int32_t refnum; -@property(strong) id obj; // NULL when representing a Go object. - -// new GoSeqRef object to proxy a Go object. The refnum must be -// provided from Go side. -- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj; - -- (int32_t)incNum; - -@end - -@protocol goSeqRefInterface --(GoSeqRef*) _ref; -@end - -#endif diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Modules b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Modules new file mode 120000 index 0000000..5736f31 --- /dev/null +++ b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Modules @@ -0,0 +1 @@ +Versions/Current/Modules \ No newline at end of file diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Modules/module.modulemap b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Modules/module.modulemap deleted file mode 100644 index 6c7ae76..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Modules/module.modulemap +++ /dev/null @@ -1,9 +0,0 @@ -framework module "OpenIMCore" { - header "ref.h" - header "Open_im_sdk.objc.h" - header "Open_im_sdk_callback.objc.h" - header "Universe.objc.h" - header "OpenIMCore.h" - - export * -} \ No newline at end of file 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 deleted file mode 100644 index feca0c6..0000000 Binary files a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/OpenIMCore and /dev/null differ 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 new file mode 120000 index 0000000..ee0dd1d --- /dev/null +++ b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/OpenIMCore @@ -0,0 +1 @@ +Versions/Current/OpenIMCore \ No newline at end of file diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Resources b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Resources new file mode 120000 index 0000000..953ee36 --- /dev/null +++ b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources \ No newline at end of file diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Resources/Info.plist b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Resources/Info.plist deleted file mode 100644 index 0d1a4b8..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Resources/Info.plist +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - 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 7361321..9b7e917 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 @@ -140,6 +140,8 @@ FOUNDATION_EXPORT void Open_im_sdkGetUsersInfo(id _Nul FOUNDATION_EXPORT BOOL Open_im_sdkInitSDK(id _Nullable listener, NSString* _Nullable operationID, NSString* _Nullable config); +FOUNDATION_EXPORT void Open_im_sdkInsertGroupMessageToLocalStorage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable groupID, NSString* _Nullable sendID); + FOUNDATION_EXPORT void Open_im_sdkInsertSingleMessageToLocalStorage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable sendID); FOUNDATION_EXPORT void Open_im_sdkInviteUserToGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable reason, NSString* _Nullable userIDList); @@ -170,6 +172,8 @@ FOUNDATION_EXPORT void Open_im_sdkRevokeMessage(id _Nu FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkSdkVersion(void); +FOUNDATION_EXPORT void Open_im_sdkSearchLocalMessages(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable searchParam); + FOUNDATION_EXPORT void Open_im_sdkSendMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable groupID, NSString* _Nullable offlinePushInfo); FOUNDATION_EXPORT void Open_im_sdkSendMessageNotOss(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable groupID, NSString* _Nullable offlinePushInfo); diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/A/Headers/Open_im_sdk_callback.objc.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/A/Headers/Open_im_sdk_callback.objc.h new file mode 100644 index 0000000..fbd0f89 --- /dev/null +++ b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/A/Headers/Open_im_sdk_callback.objc.h @@ -0,0 +1,205 @@ +// Objective-C API for talking to open_im_sdk/open_im_sdk_callback Go package. +// gobind -lang=objc open_im_sdk/open_im_sdk_callback +// +// File is generated by gobind. Do not edit. + +#ifndef __Open_im_sdk_callback_H__ +#define __Open_im_sdk_callback_H__ + +@import Foundation; +#include "ref.h" +#include "Universe.objc.h" + + +@protocol Open_im_sdk_callbackBase; +@class Open_im_sdk_callbackBase; +@protocol Open_im_sdk_callbackOnAdvancedMsgListener; +@class Open_im_sdk_callbackOnAdvancedMsgListener; +@protocol Open_im_sdk_callbackOnConnListener; +@class Open_im_sdk_callbackOnConnListener; +@protocol Open_im_sdk_callbackOnConversationListener; +@class Open_im_sdk_callbackOnConversationListener; +@protocol Open_im_sdk_callbackOnFriendshipListener; +@class Open_im_sdk_callbackOnFriendshipListener; +@protocol Open_im_sdk_callbackOnGroupListener; +@class Open_im_sdk_callbackOnGroupListener; +@protocol Open_im_sdk_callbackOnUserListener; +@class Open_im_sdk_callbackOnUserListener; +@protocol Open_im_sdk_callbackSendMsgCallBack; +@class Open_im_sdk_callbackSendMsgCallBack; + +@protocol Open_im_sdk_callbackBase +- (void)onError:(int32_t)errCode errMsg:(NSString* _Nullable)errMsg; +- (void)onSuccess:(NSString* _Nullable)data; +@end + +@protocol Open_im_sdk_callbackOnAdvancedMsgListener +- (void)onRecvC2CReadReceipt:(NSString* _Nullable)msgReceiptList; +- (void)onRecvMessageRevoked:(NSString* _Nullable)msgId; +- (void)onRecvNewMessage:(NSString* _Nullable)message; +@end + +@protocol Open_im_sdk_callbackOnConnListener +- (void)onConnectFailed:(int32_t)errCode errMsg:(NSString* _Nullable)errMsg; +- (void)onConnectSuccess; +- (void)onConnecting; +- (void)onKickedOffline; +- (void)onUserTokenExpired; +@end + +@protocol Open_im_sdk_callbackOnConversationListener +- (void)onConversationChanged:(NSString* _Nullable)conversationList; +- (void)onNewConversation:(NSString* _Nullable)conversationList; +- (void)onSyncServerFailed; +- (void)onSyncServerFinish; +- (void)onSyncServerStart; +- (void)onTotalUnreadMessageCountChanged:(int32_t)totalUnreadCount; +@end + +@protocol Open_im_sdk_callbackOnFriendshipListener +- (void)onBlackAdded:(NSString* _Nullable)blackInfo; +- (void)onBlackDeleted:(NSString* _Nullable)blackInfo; +- (void)onFriendAdded:(NSString* _Nullable)friendInfo; +- (void)onFriendApplicationAccepted:(NSString* _Nullable)groupApplication; +- (void)onFriendApplicationAdded:(NSString* _Nullable)friendApplication; +- (void)onFriendApplicationDeleted:(NSString* _Nullable)friendApplication; +- (void)onFriendApplicationRejected:(NSString* _Nullable)friendApplication; +- (void)onFriendDeleted:(NSString* _Nullable)friendInfo; +- (void)onFriendInfoChanged:(NSString* _Nullable)friendInfo; +@end + +@protocol Open_im_sdk_callbackOnGroupListener +- (void)onGroupApplicationAccepted:(NSString* _Nullable)groupApplication; +- (void)onGroupApplicationAdded:(NSString* _Nullable)groupApplication; +- (void)onGroupApplicationDeleted:(NSString* _Nullable)groupApplication; +- (void)onGroupApplicationRejected:(NSString* _Nullable)groupApplication; +- (void)onGroupInfoChanged:(NSString* _Nullable)groupInfo; +- (void)onGroupMemberAdded:(NSString* _Nullable)groupMemberInfo; +- (void)onGroupMemberDeleted:(NSString* _Nullable)groupMemberInfo; +- (void)onGroupMemberInfoChanged:(NSString* _Nullable)groupMemberInfo; +- (void)onJoinedGroupAdded:(NSString* _Nullable)groupInfo; +- (void)onJoinedGroupDeleted:(NSString* _Nullable)groupInfo; +@end + +@protocol Open_im_sdk_callbackOnUserListener +- (void)onSelfInfoUpdated:(NSString* _Nullable)userInfo; +@end + +@protocol Open_im_sdk_callbackSendMsgCallBack +- (void)onError:(int32_t)errCode errMsg:(NSString* _Nullable)errMsg; +- (void)onProgress:(long)progress; +- (void)onSuccess:(NSString* _Nullable)data; +@end + +@class Open_im_sdk_callbackBase; + +@class Open_im_sdk_callbackOnAdvancedMsgListener; + +@class Open_im_sdk_callbackOnConnListener; + +@class Open_im_sdk_callbackOnConversationListener; + +@class Open_im_sdk_callbackOnFriendshipListener; + +@class Open_im_sdk_callbackOnGroupListener; + +@class Open_im_sdk_callbackOnUserListener; + +@class Open_im_sdk_callbackSendMsgCallBack; + +@interface Open_im_sdk_callbackBase : NSObject { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)onError:(int32_t)errCode errMsg:(NSString* _Nullable)errMsg; +- (void)onSuccess:(NSString* _Nullable)data; +@end + +@interface Open_im_sdk_callbackOnAdvancedMsgListener : NSObject { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)onRecvC2CReadReceipt:(NSString* _Nullable)msgReceiptList; +- (void)onRecvMessageRevoked:(NSString* _Nullable)msgId; +- (void)onRecvNewMessage:(NSString* _Nullable)message; +@end + +@interface Open_im_sdk_callbackOnConnListener : NSObject { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)onConnectFailed:(int32_t)errCode errMsg:(NSString* _Nullable)errMsg; +- (void)onConnectSuccess; +- (void)onConnecting; +- (void)onKickedOffline; +- (void)onUserTokenExpired; +@end + +@interface Open_im_sdk_callbackOnConversationListener : NSObject { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)onConversationChanged:(NSString* _Nullable)conversationList; +- (void)onNewConversation:(NSString* _Nullable)conversationList; +- (void)onSyncServerFailed; +- (void)onSyncServerFinish; +- (void)onSyncServerStart; +- (void)onTotalUnreadMessageCountChanged:(int32_t)totalUnreadCount; +@end + +@interface Open_im_sdk_callbackOnFriendshipListener : NSObject { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)onBlackAdded:(NSString* _Nullable)blackInfo; +- (void)onBlackDeleted:(NSString* _Nullable)blackInfo; +- (void)onFriendAdded:(NSString* _Nullable)friendInfo; +- (void)onFriendApplicationAccepted:(NSString* _Nullable)groupApplication; +- (void)onFriendApplicationAdded:(NSString* _Nullable)friendApplication; +- (void)onFriendApplicationDeleted:(NSString* _Nullable)friendApplication; +- (void)onFriendApplicationRejected:(NSString* _Nullable)friendApplication; +- (void)onFriendDeleted:(NSString* _Nullable)friendInfo; +- (void)onFriendInfoChanged:(NSString* _Nullable)friendInfo; +@end + +@interface Open_im_sdk_callbackOnGroupListener : NSObject { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)onGroupApplicationAccepted:(NSString* _Nullable)groupApplication; +- (void)onGroupApplicationAdded:(NSString* _Nullable)groupApplication; +- (void)onGroupApplicationDeleted:(NSString* _Nullable)groupApplication; +- (void)onGroupApplicationRejected:(NSString* _Nullable)groupApplication; +- (void)onGroupInfoChanged:(NSString* _Nullable)groupInfo; +- (void)onGroupMemberAdded:(NSString* _Nullable)groupMemberInfo; +- (void)onGroupMemberDeleted:(NSString* _Nullable)groupMemberInfo; +- (void)onGroupMemberInfoChanged:(NSString* _Nullable)groupMemberInfo; +- (void)onJoinedGroupAdded:(NSString* _Nullable)groupInfo; +- (void)onJoinedGroupDeleted:(NSString* _Nullable)groupInfo; +@end + +@interface Open_im_sdk_callbackOnUserListener : NSObject { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)onSelfInfoUpdated:(NSString* _Nullable)userInfo; +@end + +@interface Open_im_sdk_callbackSendMsgCallBack : NSObject { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)onError:(int32_t)errCode errMsg:(NSString* _Nullable)errMsg; +- (void)onProgress:(long)progress; +- (void)onSuccess:(NSString* _Nullable)data; +@end + +#endif 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 feca0c6..c336f86 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 b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current new file mode 120000 index 0000000..8c7e5a6 --- /dev/null +++ b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current @@ -0,0 +1 @@ +A \ No newline at end of file diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Headers/OpenIMCore.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Headers/OpenIMCore.h deleted file mode 100644 index 9534b48..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Headers/OpenIMCore.h +++ /dev/null @@ -1,15 +0,0 @@ - -// Objective-C API for talking to the following Go packages -// -// open_im_sdk/open_im_sdk -// open_im_sdk/open_im_sdk_callback -// -// File is generated by gomobile bind. Do not edit. -#ifndef __OpenIMCore_FRAMEWORK_H__ -#define __OpenIMCore_FRAMEWORK_H__ - -#include "Open_im_sdk.objc.h" -#include "Open_im_sdk_callback.objc.h" -#include "Universe.objc.h" - -#endif 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 deleted file mode 100644 index 7361321..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Headers/Open_im_sdk.objc.h +++ /dev/null @@ -1,206 +0,0 @@ -// Objective-C API for talking to open_im_sdk/open_im_sdk Go package. -// gobind -lang=objc open_im_sdk/open_im_sdk -// -// File is generated by gobind. Do not edit. - -#ifndef __Open_im_sdk_H__ -#define __Open_im_sdk_H__ - -@import Foundation; -#include "ref.h" -#include "Universe.objc.h" - -#include "Open_im_sdk_callback.objc.h" - -@interface Open_im_sdk : NSObject -// skipped variable UserRouterMap with unsupported type: map[string]*open_im_sdk/internal/login.LoginMgr - -// skipped variable UserSDKRwLock with unsupported type: sync.RWMutex - -@end - -FOUNDATION_EXPORT void Open_im_sdkAcceptFriendApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDHandleMsg); - -FOUNDATION_EXPORT void Open_im_sdkAcceptGroupApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable fromUserID, NSString* _Nullable handleMsg); - -FOUNDATION_EXPORT void Open_im_sdkAddBlack(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable blackUserID); - -FOUNDATION_EXPORT void Open_im_sdkAddFriend(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDReqMsg); - -FOUNDATION_EXPORT void Open_im_sdkCheckFriend(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT BOOL Open_im_sdkCheckToken(NSString* _Nullable userID, NSString* _Nullable token, NSError* _Nullable* _Nullable error); - -FOUNDATION_EXPORT void Open_im_sdkClearC2CHistoryMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userID); - -FOUNDATION_EXPORT void Open_im_sdkClearGroupHistoryMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCardMessage(NSString* _Nullable operationID, NSString* _Nullable cardInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateCustomMessage(NSString* _Nullable operationID, NSString* _Nullable data, NSString* _Nullable extension, NSString* _Nullable description); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateFileMessage(NSString* _Nullable operationID, NSString* _Nullable filePath, NSString* _Nullable fileName); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateFileMessageByURL(NSString* _Nullable operationID, NSString* _Nullable fileBaseInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateFileMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable fileFullPath, NSString* _Nullable fileName); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateForwardMessage(NSString* _Nullable operationID, NSString* _Nullable m); - -FOUNDATION_EXPORT void Open_im_sdkCreateGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupBaseInfo, NSString* _Nullable memberList); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateImageMessage(NSString* _Nullable operationID, NSString* _Nullable imagePath); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateImageMessageByURL(NSString* _Nullable operationID, NSString* _Nullable sourcePicture, NSString* _Nullable bigPicture, NSString* _Nullable snapshotPicture); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateImageMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable imageFullPath); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateLocationMessage(NSString* _Nullable operationID, NSString* _Nullable description, double longitude, double latitude); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateMergerMessage(NSString* _Nullable operationID, NSString* _Nullable messageList, NSString* _Nullable title, NSString* _Nullable summaryList); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateQuoteMessage(NSString* _Nullable operationID, NSString* _Nullable text, NSString* _Nullable message); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateSoundMessage(NSString* _Nullable operationID, NSString* _Nullable soundPath, int64_t duration); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateSoundMessageByURL(NSString* _Nullable operationID, NSString* _Nullable soundBaseInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateSoundMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable soundPath, int64_t duration); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateTextAtMessage(NSString* _Nullable operationID, NSString* _Nullable text, NSString* _Nullable atUserList); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateTextMessage(NSString* _Nullable operationID, NSString* _Nullable text); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateVideoMessage(NSString* _Nullable operationID, NSString* _Nullable videoPath, NSString* _Nullable videoType, int64_t duration, NSString* _Nullable snapshotPath); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateVideoMessageByURL(NSString* _Nullable operationID, NSString* _Nullable videoBaseInfo); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkCreateVideoMessageFromFullPath(NSString* _Nullable operationID, NSString* _Nullable videoFullPath, NSString* _Nullable videoType, int64_t duration, NSString* _Nullable snapshotFullPath); - -FOUNDATION_EXPORT void Open_im_sdkDeleteConversation(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationID); - -FOUNDATION_EXPORT void Open_im_sdkDeleteFriend(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable friendUserID); - -FOUNDATION_EXPORT void Open_im_sdkDeleteMessageFromLocalStorage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message); - -FOUNDATION_EXPORT void Open_im_sdkGetAllConversationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetBlackList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkGetConversationIDBySessionType(NSString* _Nullable sourceID, long sessionType); - -FOUNDATION_EXPORT void Open_im_sdkGetConversationListSplit(id _Nullable callback, NSString* _Nullable operationID, long offset, long count); - -FOUNDATION_EXPORT void Open_im_sdkGetConversationRecvMessageOpt(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetDesignatedFriendsInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetFriendList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetGroupMemberList(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, int32_t filter, int32_t offset, int32_t count); - -FOUNDATION_EXPORT void Open_im_sdkGetGroupMembersInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetGroupsInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetHistoryMessageList(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable getMessageOptions); - -FOUNDATION_EXPORT void Open_im_sdkGetJoinedGroupList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT int32_t Open_im_sdkGetLoginStatus(void); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkGetLoginUser(void); - -FOUNDATION_EXPORT void Open_im_sdkGetMultipleConversation(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationIDList); - -FOUNDATION_EXPORT void Open_im_sdkGetOneConversation(id _Nullable callback, NSString* _Nullable operationID, long sessionType, NSString* _Nullable sourceID); - -FOUNDATION_EXPORT void Open_im_sdkGetRecvFriendApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetRecvGroupApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetSelfUserInfo(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetSendFriendApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetSendGroupApplicationList(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkGetTotalUnreadMsgCount(id _Nullable callback, NSString* _Nullable operationID); - -// skipped function GetUserWorker with unsupported parameter or return types - - -/** - * /////////////////////user///////////////////// - */ -FOUNDATION_EXPORT void Open_im_sdkGetUsersInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDList); - -// skipped function InitOnce with unsupported parameter or return types - - -FOUNDATION_EXPORT BOOL Open_im_sdkInitSDK(id _Nullable listener, NSString* _Nullable operationID, NSString* _Nullable config); - -FOUNDATION_EXPORT void Open_im_sdkInsertSingleMessageToLocalStorage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable sendID); - -FOUNDATION_EXPORT void Open_im_sdkInviteUserToGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable reason, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkJoinGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable reqMsg); - -FOUNDATION_EXPORT void Open_im_sdkKickGroupMember(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable reason, NSString* _Nullable userIDList); - -FOUNDATION_EXPORT void Open_im_sdkLogin(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userID, NSString* _Nullable token); - -FOUNDATION_EXPORT void Open_im_sdkLogout(id _Nullable callback, NSString* _Nullable operationID); - -FOUNDATION_EXPORT void Open_im_sdkMarkC2CMessageAsRead(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userID, NSString* _Nullable msgIDList); - -FOUNDATION_EXPORT void Open_im_sdkMarkGroupMessageHasRead(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID); - -FOUNDATION_EXPORT void Open_im_sdkPinConversation(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationID, BOOL isPinned); - -FOUNDATION_EXPORT void Open_im_sdkQuitGroup(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID); - -FOUNDATION_EXPORT void Open_im_sdkRefuseFriendApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDHandleMsg); - -FOUNDATION_EXPORT void Open_im_sdkRefuseGroupApplication(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable fromUserID, NSString* _Nullable handleMsg); - -FOUNDATION_EXPORT void Open_im_sdkRemoveBlack(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable removeUserID); - -FOUNDATION_EXPORT void Open_im_sdkRevokeMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkSdkVersion(void); - -FOUNDATION_EXPORT void Open_im_sdkSendMessage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable groupID, NSString* _Nullable offlinePushInfo); - -FOUNDATION_EXPORT void Open_im_sdkSendMessageNotOss(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable message, NSString* _Nullable recvID, NSString* _Nullable groupID, NSString* _Nullable offlinePushInfo); - -FOUNDATION_EXPORT void Open_im_sdkSetAdvancedMsgListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkSetConversationDraft(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationID, NSString* _Nullable draftText); - -FOUNDATION_EXPORT void Open_im_sdkSetConversationListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkSetConversationRecvMessageOpt(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable conversationIDList, long opt); - -FOUNDATION_EXPORT void Open_im_sdkSetFriendListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkSetFriendRemark(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userIDRemark); - -FOUNDATION_EXPORT void Open_im_sdkSetGroupInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable groupInfo); - -/** - * ////////////////////////group////////////////////////////////////////// - */ -FOUNDATION_EXPORT void Open_im_sdkSetGroupListener(id _Nullable callback); - -FOUNDATION_EXPORT void Open_im_sdkSetSelfInfo(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable userInfo); - -FOUNDATION_EXPORT void Open_im_sdkSetUserListener(id _Nullable listener); - -FOUNDATION_EXPORT void Open_im_sdkTransferGroupOwner(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable groupID, NSString* _Nullable newOwnerUserID); - -FOUNDATION_EXPORT void Open_im_sdkTypingStatusUpdate(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable recvID, NSString* _Nullable msgTip); - -FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkUploadImage(id _Nullable callback, NSString* _Nullable operationID, NSString* _Nullable filePath, NSString* _Nullable token, NSString* _Nullable obj); - -#endif diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Headers/Universe.objc.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Headers/Universe.objc.h deleted file mode 100644 index 019e750..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Headers/Universe.objc.h +++ /dev/null @@ -1,29 +0,0 @@ -// Objective-C API for talking to Go package. -// gobind -lang=objc -// -// File is generated by gobind. Do not edit. - -#ifndef __Universe_H__ -#define __Universe_H__ - -@import Foundation; -#include "ref.h" - -@protocol Universeerror; -@class Universeerror; - -@protocol Universeerror -- (NSString* _Nonnull)error; -@end - -@class Universeerror; - -@interface Universeerror : NSError { -} -@property(strong, readonly) _Nonnull id _ref; - -- (nonnull instancetype)initWithRef:(_Nonnull id)ref; -- (NSString* _Nonnull)error; -@end - -#endif diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Headers/ref.h b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Headers/ref.h deleted file mode 100644 index b8036a4..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Headers/ref.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#ifndef __GO_REF_HDR__ -#define __GO_REF_HDR__ - -#include - -// GoSeqRef is an object tagged with an integer for passing back and -// forth across the language boundary. A GoSeqRef may represent either -// an instance of a Go object, or an Objective-C object passed to Go. -// The explicit allocation of a GoSeqRef is used to pin a Go object -// when it is passed to Objective-C. The Go seq package maintains a -// reference to the Go object in a map keyed by the refnum along with -// a reference count. When the reference count reaches zero, the Go -// seq package will clear the corresponding entry in the map. -@interface GoSeqRef : NSObject { -} -@property(readonly) int32_t refnum; -@property(strong) id obj; // NULL when representing a Go object. - -// new GoSeqRef object to proxy a Go object. The refnum must be -// provided from Go side. -- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj; - -- (int32_t)incNum; - -@end - -@protocol goSeqRefInterface --(GoSeqRef*) _ref; -@end - -#endif diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Modules/module.modulemap b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Modules/module.modulemap deleted file mode 100644 index 6c7ae76..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Modules/module.modulemap +++ /dev/null @@ -1,9 +0,0 @@ -framework module "OpenIMCore" { - header "ref.h" - header "Open_im_sdk.objc.h" - header "Open_im_sdk_callback.objc.h" - header "Universe.objc.h" - header "OpenIMCore.h" - - export * -} \ No newline at end of file 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 deleted file mode 100644 index feca0c6..0000000 Binary files a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/OpenIMCore and /dev/null differ diff --git a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Resources/Info.plist b/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Resources/Info.plist deleted file mode 100644 index 0d1a4b8..0000000 --- a/ios/Framework/OpenIMCore.xcframework/ios-arm64_x86_64-simulator/OpenIMCore.framework/Versions/Current/Resources/Info.plist +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/ios/flutter_openim_sdk.podspec b/ios/flutter_openim_sdk.podspec index 14639d5..e08535e 100644 --- a/ios/flutter_openim_sdk.podspec +++ b/ios/flutter_openim_sdk.podspec @@ -17,7 +17,7 @@ A new Flutter project. s.dependency 'Flutter' s.platform = :ios, '8.0' - s.vendored_frameworks = 'Framework/*.framework' + s.vendored_frameworks = 'Framework/*.xcframework' # Flutter.framework does not contain a i386 slice. s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386 arm64' } s.swift_version = '5.0' diff --git a/lib/flutter_openim_sdk.dart b/lib/flutter_openim_sdk.dart index b3ab2ef..0cbcb0d 100644 --- a/lib/flutter_openim_sdk.dart +++ b/lib/flutter_openim_sdk.dart @@ -1,7 +1,7 @@ library flutter_openim_sdk; export 'src/enum/conversation_type.dart'; -export 'src/enum/group_role.dart'; +export 'src/enum/group_role_level.dart'; export 'src/enum/im_platform.dart'; export 'src/enum/listener_type.dart'; export 'src/enum/message_status.dart'; @@ -27,8 +27,10 @@ export 'src/manager/im_manager.dart'; export 'src/manager/im_message_manager.dart'; export 'src/manager/im_offline_push_manager.dart'; export 'src/manager/im_signaling_manager.dart'; +export 'src/manager/im_user_manager.dart'; export 'src/models/conversation_info.dart'; export 'src/models/group_info.dart'; export 'src/models/message.dart'; export 'src/models/user_info.dart'; export 'src/openim.dart'; +export 'src/utils.dart'; diff --git a/lib/src/enum/conversation_type.dart b/lib/src/enum/conversation_type.dart index ab3af3f..af1b0f7 100644 --- a/lib/src/enum/conversation_type.dart +++ b/lib/src/enum/conversation_type.dart @@ -1,4 +1,4 @@ class ConversationType { - static const single_chat = 1; - static const group_chat = 2; + static const single = 1; + static const group = 2; } diff --git a/lib/src/enum/group_role.dart b/lib/src/enum/group_role.dart deleted file mode 100644 index ec1874f..0000000 --- a/lib/src/enum/group_role.dart +++ /dev/null @@ -1,5 +0,0 @@ -class GroupRole { - static const member = 0; - static const owner = 1; - static const admin = 2; -} diff --git a/lib/src/enum/group_role_level.dart b/lib/src/enum/group_role_level.dart new file mode 100644 index 0000000..731bd1f --- /dev/null +++ b/lib/src/enum/group_role_level.dart @@ -0,0 +1,7 @@ +/// 1 ordinary member, 2 group owners, 3 administrators +/// 1普通成员, 2群主,3管理员 +class GroupRoleLevel { + static const member = 1; + static const owner = 2; + static const admin = 3; +} diff --git a/lib/src/listener/advanced_msg_listener.dart b/lib/src/listener/advanced_msg_listener.dart index 311b084..c1d53ae 100644 --- a/lib/src/listener/advanced_msg_listener.dart +++ b/lib/src/listener/advanced_msg_listener.dart @@ -10,7 +10,7 @@ abstract class AdvancedMsgListener { void recvNewMessage(Message msg); /// Message read receipt - void recvC2CReadReceipt(List list); + void recvC2CReadReceipt(List list); /// A friend withdrew a message void recvMessageRevoked(String msgId); diff --git a/lib/src/listener/group_listener.dart b/lib/src/listener/group_listener.dart index 5b55df3..b8cb374 100644 --- a/lib/src/listener/group_listener.dart +++ b/lib/src/listener/group_listener.dart @@ -9,10 +9,6 @@ abstract class GroupListener { void groupMemberDeleted(GroupMembersInfo info); - void receiveJoinGroupApplicationAdded(GroupApplicationInfo info); - - void receiveJoinGroupApplicationDeleted(GroupApplicationInfo info); - void groupApplicationAdded(GroupApplicationInfo info); void groupApplicationDeleted(GroupApplicationInfo info); diff --git a/lib/src/listener/impl/advanced_msg_listener.dart b/lib/src/listener/impl/advanced_msg_listener.dart index ae3acef..0ceea24 100644 --- a/lib/src/listener/impl/advanced_msg_listener.dart +++ b/lib/src/listener/impl/advanced_msg_listener.dart @@ -1,7 +1,7 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; class OnAdvancedMsgListener extends AdvancedMsgListener { - Function(List list)? onRecvC2CReadReceipt; + Function(List list)? onRecvC2CReadReceipt; Function(String msgId)? onRecvMessageRevoked; Function(Message msg)? onRecvNewMessage; @@ -12,7 +12,7 @@ class OnAdvancedMsgListener extends AdvancedMsgListener { }); @override - void recvC2CReadReceipt(List list) { + void recvC2CReadReceipt(List list) { if (null != onRecvC2CReadReceipt) onRecvC2CReadReceipt!(list); } diff --git a/lib/src/listener/impl/friendship_listener.dart b/lib/src/listener/impl/friendship_listener.dart index 1f26557..132a782 100644 --- a/lib/src/listener/impl/friendship_listener.dart +++ b/lib/src/listener/impl/friendship_listener.dart @@ -1,28 +1,5 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; -/// 申请添加好友: -/// 主动申请者收到 OnFriendApplicationAdded -/// 被添加者收到 OnFriendApplicationAdded -/// -/// 同意好友申请: -/// 操作者收到 OnFriendApplicationAccepted OnFriendAdded -/// 申请者收到 OnFriendApplicationAccepted OnFriendAdded -/// -/// 好友拒绝申请: -/// 操作者收到 OnFriendApplicationRejected -/// 申请者收到 OnFriendApplicationRejected -/// -/// 删除好友: -/// 操作者收到 OnFriendDeleted -/// -/// 修改备注: -/// 操作者收到 OnFriendInfoChanged -/// -/// 添加黑名单: -/// 操作者收到 OnBlacklistAdded; -/// -/// 移除黑名单: -/// 操作者收到 OnBlacklistDeleted class OnFriendshipListener extends FriendshipListener { Function(FriendApplicationInfo i)? onFriendApplicationAdded; Function(FriendApplicationInfo i)? onFriendApplicationDeleted; diff --git a/lib/src/listener/impl/group_listener.dart b/lib/src/listener/impl/group_listener.dart index 77d3ae1..8a104ad 100644 --- a/lib/src/listener/impl/group_listener.dart +++ b/lib/src/listener/impl/group_listener.dart @@ -1,35 +1,5 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; -/// 创建群: -/// 初始成员收到 OnJoinedGroupAdded -/// -/// 退出群: -/// 退出者收到 OnJoinedGroupDeleted -/// 群成员收到 OnGroupMemberDeleted -/// -/// 踢出群: -/// 被踢者收到 OnJoinedGroupDeleted -/// 群成员收到 OnGroupMemberDeleted -/// -/// 邀请进群: -/// 被邀请者收到 OnJoinedGroupAdded -/// 群成员(不包括被邀请者)收到 OnGroupMemberAdded -/// -/// 申请加群: -/// 申请者收到 OnGroupApplicationAdded -/// 群主+管理员收到 OnReceiveJoinGroupApplicationAdded -/// -/// 同意进群: -/// 申请者收到 OnJoinedGroupAdded OnGroupApplicationAccepted -/// 群成员(不包括申请者)收到 OnGroupMemberAdded -/// 审批者(群主或者管理员)收到 OnGroupMemberAdded OnGroupApplicationAccepted -/// -/// 拒绝进群: -/// 申请者收到 OnGroupApplicationRejected; -/// 审批者(群主或者管理员)收到 OnGroupApplicationRejected -/// -/// 修改群资料: -/// 群成员收到 OnGroupInfoChanged class OnGroupListener extends GroupListener { Function(GroupApplicationInfo info)? onGroupApplicationAccepted; Function(GroupApplicationInfo info)? onGroupApplicationAdded; @@ -41,8 +11,6 @@ class OnGroupListener extends GroupListener { Function(GroupMembersInfo info)? onGroupMemberInfoChanged; Function(GroupInfo info)? onJoinedGroupAdded; Function(GroupInfo info)? onJoinedGroupDeleted; - Function(GroupApplicationInfo info)? onReceiveJoinGroupApplicationAdded; - Function(GroupApplicationInfo info)? onReceiveJoinGroupApplicationDeleted; OnGroupListener({ this.onGroupApplicationAccepted, @@ -55,8 +23,6 @@ class OnGroupListener extends GroupListener { this.onGroupMemberInfoChanged, this.onJoinedGroupAdded, this.onJoinedGroupDeleted, - this.onReceiveJoinGroupApplicationAdded, - this.onReceiveJoinGroupApplicationDeleted, }); @override @@ -108,14 +74,4 @@ class OnGroupListener extends GroupListener { void joinedGroupDeleted(GroupInfo info) { onJoinedGroupDeleted?.call(info); } - - @override - void receiveJoinGroupApplicationAdded(GroupApplicationInfo info) { - onReceiveJoinGroupApplicationAdded?.call(info); - } - - @override - void receiveJoinGroupApplicationDeleted(GroupApplicationInfo info) { - onReceiveJoinGroupApplicationDeleted?.call(info); - } } diff --git a/lib/src/manager/im_conversation_manager.dart b/lib/src/manager/im_conversation_manager.dart index 199e5c1..12eb02c 100644 --- a/lib/src/manager/im_conversation_manager.dart +++ b/lib/src/manager/im_conversation_manager.dart @@ -1,10 +1,6 @@ -import 'dart:convert'; - import 'package:flutter/services.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; -/// -/// class ConversationManager { MethodChannel _channel; late ConversationListener conversationListener; @@ -26,9 +22,10 @@ class ConversationManager { .invokeMethod( 'getAllConversationList', _buildParam({ - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _toList(value)); + .then((value) => + Utils.toList(value, (map) => ConversationInfo.fromJson(map))); /// Paging to get conversation /// 分页获取会话 @@ -43,9 +40,10 @@ class ConversationManager { _buildParam({ 'offset': offset, 'count': count, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _toList(value)); + .then((value) => + Utils.toList(value, (map) => ConversationInfo.fromJson(map))); /// Get a conversation, if it doesn't exist it will be created automatically /// [sourceID] if it is a single chat, Its value is userID. if it is a group chat, Its value is groupID @@ -64,9 +62,10 @@ class ConversationManager { _buildParam({ "sourceID": sourceID, "sessionType": sessionType, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _toObj(value)); + .then((value) => + Utils.toObj(value, (map) => ConversationInfo.fromJson(map))); /// Get conversation list by id list /// 获取多个会话 @@ -79,9 +78,10 @@ class ConversationManager { 'getMultipleConversation', _buildParam({ "conversationIDList": conversationIDList, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _toList(value)); + .then((value) => + Utils.toList(value, (map) => ConversationInfo.fromJson(map))); /// Delete conversation by id /// 删除会话 @@ -89,14 +89,12 @@ class ConversationManager { required String conversationID, String? operationID, }) => - _channel - .invokeMethod( - 'deleteConversation', - _buildParam({ - "conversationID": conversationID, - "operationID": _checkOperationID(operationID), - })) - .then((value) => _printValue(value)); + _channel.invokeMethod( + 'deleteConversation', + _buildParam({ + "conversationID": conversationID, + "operationID": Utils.checkOperationID(operationID), + })); /// Set draft /// 设置会话草稿 @@ -105,15 +103,13 @@ class ConversationManager { required String draftText, String? operationID, }) => - _channel - .invokeMethod( - 'setConversationDraft', - _buildParam({ - "conversationID": conversationID, - "draftText": draftText, - "operationID": _checkOperationID(operationID), - })) - .then((value) => _printValue(value)); + _channel.invokeMethod( + 'setConversationDraft', + _buildParam({ + "conversationID": conversationID, + "draftText": draftText, + "operationID": Utils.checkOperationID(operationID), + })); /// Pinned conversation /// 置顶会话 @@ -122,18 +118,14 @@ class ConversationManager { required bool isPinned, String? operationID, }) => - _channel - .invokeMethod( - 'pinConversation', - _buildParam({ - "conversationID": conversationID, - "isPinned": isPinned, - "operationID": _checkOperationID(operationID), - })) - .then((value) => _printValue(value)); + _channel.invokeMethod( + 'pinConversation', + _buildParam({ + "conversationID": conversationID, + "isPinned": isPinned, + "operationID": Utils.checkOperationID(operationID), + })); - /// Mark single chat messages as read - /// 标记单聊已读 // Future markSingleMessageHasRead({required String userID}) => // _channel.invokeMethod( // 'markSingleMessageHasRead', _buildParam({'userID': userID})); @@ -148,7 +140,7 @@ class ConversationManager { 'markGroupMessageHasRead', _buildParam({ 'groupID': groupID, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })); /// Get the total number of unread messages @@ -159,7 +151,7 @@ class ConversationManager { _channel.invokeMethod( 'getTotalUnreadMsgCount', _buildParam({ - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })); /// Query conversation id @@ -180,9 +172,9 @@ class ConversationManager { })); /// Message Do Not Disturb - /// [status] 1: Do not receive messages. 2: Do not notify when messages are received. 0: Normal. + /// [status] 0: Normal. 1: Do not receive messages. 2: Do not notify when messages are received. /// 消息免打扰设置 - /// [status] 1:不接受消息;2:接受在线消息不接受离线消息;3:正常 + /// [status] 0:正常;1:不接受消息;2:接受在线消息不接受离线消息; Future setConversationRecvMessageOpt({ required List conversationIDList, required int status, @@ -193,7 +185,7 @@ class ConversationManager { _buildParam({ "conversationIDList": conversationIDList, "status": status, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })); /// Message Do Not Disturb @@ -208,12 +200,12 @@ class ConversationManager { 'getConversationRecvMessageOpt', _buildParam({ "conversationIDList": conversationIDList, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _formatJson(value)); + .then((value) => Utils.toListMap(value)); /// Custom sort for conversation list - /// 会话列表自定义排序规则 + /// 会话列表自定义排序规则。 List simpleSort(List list) => list ..sort((a, b) { if ((a.isPinned == true && b.isPinned == true) || @@ -242,23 +234,4 @@ class ConversationManager { param["ManagerName"] = "conversationManager"; return param; } - - static List _toList(String? value) { - var list = _formatJson(value); - if (null == list) return []; - return (list as List).map((e) => ConversationInfo.fromJson(e)).toList(); - } - - static ConversationInfo _toObj(String value) => - ConversationInfo.fromJson(_formatJson(value)); - - static dynamic _formatJson(value) => jsonDecode(_printValue(value)); - - static String _printValue(value) { - return value; - } - - static String _checkOperationID(String? obj) { - return obj ?? DateTime.now().millisecondsSinceEpoch.toString(); - } } diff --git a/lib/src/manager/im_friendship_manager.dart b/lib/src/manager/im_friendship_manager.dart index 8410648..19e3952 100644 --- a/lib/src/manager/im_friendship_manager.dart +++ b/lib/src/manager/im_friendship_manager.dart @@ -1,5 +1,3 @@ -import 'dart:convert'; - import 'package:flutter/services.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; @@ -27,9 +25,9 @@ class FriendshipManager { 'getFriendsInfo', _buildParam({ "uidList": uidList, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _toList(value, (v) => UserInfo.fromJson(v.cast()))); + .then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v))); /// Send an friend application /// 发送一个好友请求 @@ -43,7 +41,7 @@ class FriendshipManager { _buildParam({ "toUserID": uid, "reqMsg": reason, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })); /// Get someone's request to add me as a friend @@ -54,10 +52,10 @@ class FriendshipManager { .invokeMethod( 'getRecvFriendApplicationList', _buildParam({ - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) .then((value) => - _toList(value, (v) => FriendApplicationInfo.fromJson(v.cast()))); + Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v))); /// Get friend requests from me /// 获取我发出的好友申请 @@ -67,10 +65,10 @@ class FriendshipManager { .invokeMethod( 'getSendFriendApplicationList', _buildParam({ - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) .then((value) => - _toList(value, (v) => FriendApplicationInfo.fromJson(v.cast()))); + Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v))); /// Find all friends including those who have been added to the blacklist /// 获取好友列表包含已拉入黑名单的好友 @@ -78,9 +76,9 @@ class FriendshipManager { .invokeMethod( 'getFriendList', _buildParam({ - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _toList(value, (v) => UserInfo.fromJson(v.cast()))); + .then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v))); /// Find all friends including those who have been added to the blacklist /// 获取好友列表 @@ -88,11 +86,11 @@ class FriendshipManager { .invokeMethod( 'getFriendList', _buildParam({ - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _toListMap(value)); + .then((value) => Utils.toListMap(value)); - /// Modify friend information, only [comment] can be modified + /// Modify friend remark name /// 设置好友备注 Future setFriendRemark({ required String uid, @@ -104,7 +102,7 @@ class FriendshipManager { _buildParam({ 'toUserID': uid, 'remark': remark, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })); /// Add friends to blacklist @@ -117,7 +115,7 @@ class FriendshipManager { 'addBlacklist', _buildParam({ "uid": uid, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })); /// Find all blacklist @@ -126,9 +124,9 @@ class FriendshipManager { .invokeMethod( 'getBlacklist', _buildParam({ - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _toList(value, (v) => UserInfo.fromJson(v.cast()))); + .then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v))); /// Remove from blacklist /// 从黑名单移除 @@ -140,7 +138,7 @@ class FriendshipManager { 'removeBlacklist', _buildParam({ "uid": uid, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })); /// Determine if there is a friendship by userId @@ -154,10 +152,10 @@ class FriendshipManager { 'checkFriend', _buildParam({ 'uidList': uidList, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) .then((value) => - _toList(value, (v) => FriendshipInfo.fromJson(v.cast()))); + Utils.toList(value, (v) => FriendshipInfo.fromJson(v))); /// Dissolve friendship from friend list /// 删除好友 @@ -169,7 +167,7 @@ class FriendshipManager { 'deleteFriend', _buildParam({ "uid": uid, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })); /// Accept application of be friend @@ -184,7 +182,7 @@ class FriendshipManager { _buildParam({ "toUserID": uid, "handleMsg": handleMsg, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })); /// Refuse application of be friend @@ -199,49 +197,11 @@ class FriendshipManager { _buildParam({ "toUserID": uid, "handleMsg": handleMsg, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })); - /// - // Future forceSyncFriendApplication() { - // return _channel.invokeMethod('forceSyncFriendApplication', _buildParam({})); - // } - - /// - // Future forceSyncFriend() { - // return _channel.invokeMethod('forceSyncFriend', _buildParam({})); - // } - - /// - // Future forceSyncBlackList() { - // return _channel.invokeMethod('forceSyncBlackList', _buildParam({})); - // } - static Map _buildParam(Map param) { param["ManagerName"] = "friendshipManager"; return param; } - - static List _toList(String? value, T f(Map map)) { - var list = _formatJson(value); - if (null == list) return []; - return (list as List).map((e) => f(e)).toList(); - } - - static List _toListMap(String? value) { - var list = _formatJson(value); - return list; - } - - // static UserInfo _toObj(String value) => UserInfo.fromJson(_formatJson(value)); - - static dynamic _formatJson(value) => jsonDecode(_printValue(value)); - - static String _printValue(value) { - return value; - } - - static String _checkOperationID(String? obj) { - return obj ?? DateTime.now().millisecondsSinceEpoch.toString(); - } } diff --git a/lib/src/manager/im_group_manager.dart b/lib/src/manager/im_group_manager.dart index 793adaf..0bf5607 100644 --- a/lib/src/manager/im_group_manager.dart +++ b/lib/src/manager/im_group_manager.dart @@ -1,8 +1,5 @@ -import 'dart:convert'; - import 'package:flutter/services.dart'; -import 'package:flutter_openim_sdk/src/listener/group_listener.dart'; -import 'package:flutter_openim_sdk/src/models/group_info.dart'; +import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; class GroupManager { MethodChannel _channel; @@ -32,11 +29,10 @@ class GroupManager { 'gid': groupId, 'reason': reason, 'uidList': uidList, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => (_formatJson(value) as List) - .map((e) => GroupInviteResult.fromJson(e)) - .toList()); + .then((value) => + Utils.toList(value, (map) => GroupInviteResult.fromJson(map))); /// Remove member from group /// 移除组成员 @@ -53,11 +49,10 @@ class GroupManager { 'gid': groupId, 'reason': reason, 'uidList': uidList, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => (_formatJson(value) as List) - .map((e) => GroupInviteResult.fromJson(e)) - .toList()); + .then((value) => + Utils.toList(value, (map) => GroupInviteResult.fromJson(map))); /// Get group member's info /// 查询组成员资料 @@ -72,11 +67,10 @@ class GroupManager { _buildParam({ 'gid': groupId, 'uidList': uidList, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => (_formatJson(value) as List) - .map((e) => GroupMembersInfo.fromJson(e)) - .toList()); + .then((value) => + Utils.toList(value, (map) => GroupMembersInfo.fromJson(map))); /// Get the list of group members /// 分页获取组成员列表 @@ -95,15 +89,14 @@ class GroupManager { 'filter': filter, 'offset': offset, 'count': count, - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), })) - .then((value) => (_formatJson(value) as List) - .map((e) => GroupMembersInfo.fromJson(e)) - .toList()); + .then((value) => + Utils.toList(value, (map) => GroupMembersInfo.fromJson(map))); /// Get the list of group members /// 分页获取组成员列表 - Future getGroupMemberListMap({ + Future> getGroupMemberListMap({ required String groupId, int filter = 0, int offset = 0, @@ -118,9 +111,9 @@ class GroupManager { 'filter': filter, 'offset': offset, 'count': count, - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), })) - .then((value) => _formatJson(value)); + .then((value) => Utils.toListMap(value)); /// Find all groups you have joined /// 查询已加入的组列表 @@ -128,11 +121,9 @@ class GroupManager { .invokeMethod( 'getJoinedGroupList', _buildParam({ - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), })) - .then((value) => (_formatJson(value) as List) - .map((e) => GroupInfo.fromJson(e)) - .toList()); + .then((value) => Utils.toList(value, (map) => GroupInfo.fromJson(map))); /// Find all groups you have joined /// 查询已加入的组列表 @@ -140,9 +131,9 @@ class GroupManager { .invokeMethod( 'getJoinedGroupList', _buildParam({ - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), })) - .then((value) => _formatJson(value)); + .then((value) => Utils.toListMap(value)); /// Check if you are a member of the group /// 检查是否已加入组 @@ -151,7 +142,7 @@ class GroupManager { String? operationID, }) => getJoinedGroupList( - operationID: _checkOperationID(operationID), + operationID: Utils.checkOperationID(operationID), ).then((list) => list.where((e) => e.groupID == gid).length > 0); /// Create a group @@ -179,9 +170,10 @@ class GroupManager { "ex": ex, }, 'memberList': list.map((e) => e.toJson()).toList(), - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), })) - .then((value) => GroupInfo.fromJson(_formatJson(value))); + .then( + (value) => Utils.toObj(value, (map) => GroupInfo.fromJson(map))); /// Edit group information /// 编辑组资料 @@ -206,7 +198,7 @@ class GroupManager { "faceURL": faceUrl, "ex": ex, }, - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), })); /// Find group information by group id @@ -220,12 +212,10 @@ class GroupManager { 'getGroupsInfo', _buildParam({ 'gidList': gidList, - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), })) - .then((value) { - List list = _formatJson(value); - return list.map((e) => GroupInfo.fromJson(e)).toList(); - }); + .then( + (value) => Utils.toList(value, (map) => GroupInfo.fromJson(map))); /// Apply to join the group /// 申请加入组,需要通过管理员同意。 @@ -239,7 +229,7 @@ class GroupManager { _buildParam({ 'gid': gid, 'reason': reason, - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), })); /// Leave group @@ -252,7 +242,7 @@ class GroupManager { 'quitGroup', _buildParam({ 'gid': gid, - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), })); /// Give group permissions to others @@ -267,7 +257,7 @@ class GroupManager { _buildParam({ 'gid': gid, 'uid': uid, - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), })); /// As the group owner or administrator, get the list of received group members' applications to join the group. @@ -278,11 +268,10 @@ class GroupManager { .invokeMethod( 'getRecvGroupApplicationList', _buildParam({ - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), })) - .then((value) => (_formatJson(value) as List) - .map((e) => GroupApplicationInfo.fromJson(e)) - .toList()); + .then((value) => + Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map))); /// Get the record of the group membership application issued by yourself /// 获取自己发出的入群申请记录 @@ -292,11 +281,10 @@ class GroupManager { .invokeMethod( 'getSendGroupApplicationList', _buildParam({ - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), })) - .then((value) => (_formatJson(value) as List) - .map((e) => GroupApplicationInfo.fromJson(e)) - .toList()); + .then((value) => + Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map))); /// Accept group application /// 管理员或者群主同意某人进入某群 @@ -312,7 +300,7 @@ class GroupManager { 'gid': gid, 'uid': uid, 'handleMsg': handleMsg, - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), })); /// Refuse group application @@ -329,41 +317,11 @@ class GroupManager { 'gid': gid, 'uid': uid, 'handleMsg': handleMsg, - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), })); - /// - // Future forceSyncApplyGroupRequest() { - // return _channel.invokeMethod('forceSyncApplyGroupRequest', _buildParam({})); - // } - - /// - // Future forceSyncGroupRequest() { - // return _channel.invokeMethod('forceSyncGroupRequest', _buildParam({})); - // } - - /// - // Future forceSyncJoinedGroup() { - // return _channel.invokeMethod('forceSyncJoinedGroup', _buildParam({})); - // } - - /// - // Future forceSyncJoinedGroupMember() { - // return _channel.invokeMethod('forceSyncJoinedGroupMember', _buildParam({})); - // } - static Map _buildParam(Map param) { param["ManagerName"] = "groupManager"; return param; } - - static dynamic _formatJson(value) => jsonDecode(_printValue(value)); - - static String _printValue(value) { - return value; - } - - static String _checkOperationID(String? obj) { - return obj ?? DateTime.now().millisecondsSinceEpoch.toString(); - } } diff --git a/lib/src/manager/im_manager.dart b/lib/src/manager/im_manager.dart index 280fabd..2a1ee09 100644 --- a/lib/src/manager/im_manager.dart +++ b/lib/src/manager/im_manager.dart @@ -1,9 +1,7 @@ -import 'dart:convert'; import 'dart:developer'; import 'package:flutter/services.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; -import 'package:flutter_openim_sdk/src/manager/im_user_manager.dart'; class IMManager { MethodChannel _channel; @@ -61,7 +59,7 @@ class IMManager { dynamic data = call.arguments['data']; switch (type) { case 'onSelfInfoUpdated': - uInfo = UserInfo.fromJson(_formatJson(data)); + uInfo = Utils.toObj(data, (map) => UserInfo.fromJson(map)); userManager.userListener.selfInfoUpdated(uInfo); break; } @@ -70,53 +68,52 @@ class IMManager { dynamic data = call.arguments['data']; switch (type) { case 'onGroupApplicationAccepted': - final i = GroupApplicationInfo.fromJson(_formatJson(data)); + final i = Utils.toObj( + data, (map) => GroupApplicationInfo.fromJson(map)); groupManager.groupListener.groupApplicationAccepted(i); break; case 'onGroupApplicationAdded': - final i = GroupApplicationInfo.fromJson(_formatJson(data)); + final i = Utils.toObj( + data, (map) => GroupApplicationInfo.fromJson(map)); groupManager.groupListener.groupApplicationAdded(i); break; case 'onGroupApplicationDeleted': - final i = GroupApplicationInfo.fromJson(_formatJson(data)); + final i = Utils.toObj( + data, (map) => GroupApplicationInfo.fromJson(map)); groupManager.groupListener.groupApplicationDeleted(i); break; case 'onGroupApplicationRejected': - final i = GroupApplicationInfo.fromJson(_formatJson(data)); + final i = Utils.toObj( + data, (map) => GroupApplicationInfo.fromJson(map)); groupManager.groupListener.groupApplicationRejected(i); break; case 'onGroupInfoChanged': - final i = GroupInfo.fromJson(_formatJson(data)); + final i = Utils.toObj(data, (map) => GroupInfo.fromJson(map)); groupManager.groupListener.groupInfoChanged(i); break; case 'onGroupMemberAdded': - final i = GroupMembersInfo.fromJson(_formatJson(data)); + final i = + Utils.toObj(data, (map) => GroupMembersInfo.fromJson(map)); groupManager.groupListener.groupMemberAdded(i); break; case 'onGroupMemberDeleted': - final i = GroupMembersInfo.fromJson(_formatJson(data)); + final i = + Utils.toObj(data, (map) => GroupMembersInfo.fromJson(map)); groupManager.groupListener.groupMemberDeleted(i); break; case 'onGroupMemberInfoChanged': - final i = GroupMembersInfo.fromJson(_formatJson(data)); + final i = + Utils.toObj(data, (map) => GroupMembersInfo.fromJson(map)); groupManager.groupListener.groupMemberInfoChanged(i); break; case 'onJoinedGroupAdded': - final i = GroupInfo.fromJson(_formatJson(data)); + final i = Utils.toObj(data, (map) => GroupInfo.fromJson(map)); groupManager.groupListener.joinedGroupAdded(i); break; case 'onJoinedGroupDeleted': - final i = GroupInfo.fromJson(_formatJson(data)); + final i = Utils.toObj(data, (map) => GroupInfo.fromJson(map)); groupManager.groupListener.joinedGroupDeleted(i); break; - case 'onReceiveJoinGroupApplicationAdded': - final i = GroupApplicationInfo.fromJson(_formatJson(data)); - groupManager.groupListener.receiveJoinGroupApplicationAdded(i); - break; - case 'onReceiveJoinGroupApplicationDeleted': - final i = GroupApplicationInfo.fromJson(_formatJson(data)); - groupManager.groupListener.receiveJoinGroupApplicationDeleted(i); - break; } } else if (call.method == ListenerType.advancedMsgListener) { var type = call.arguments['type']; @@ -124,7 +121,7 @@ class IMManager { switch (type) { case 'onRecvNewMessage': var value = call.arguments['data']['newMessage']; - var msg = Message.fromJson(_formatJson(value)); + final msg = Utils.toObj(value, (map) => Message.fromJson(map)); messageManager.advancedMsgListener.recvNewMessage(msg); break; case 'onRecvMessageRevoked': @@ -133,8 +130,8 @@ class IMManager { break; case 'onRecvC2CReadReceipt': var value = call.arguments['data']['haveReadMessage']; - var l = _formatJson(value) as List; - var list = l.map((e) => HaveReadInfo.fromJson(e)).toList(); + var list = + Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map)); messageManager.advancedMsgListener.recvC2CReadReceipt(list); break; } @@ -166,21 +163,13 @@ class IMManager { conversationManager.conversationListener.syncServerFailed(); break; case 'onNewConversation': - List list = List.empty(growable: true); - if (null != data) { - list = (_formatJson(data) as List) - .map((e) => ConversationInfo.fromJson(e)) - .toList(); - } + var list = + Utils.toList(data, (map) => ConversationInfo.fromJson(map)); conversationManager.conversationListener.newConversation(list); break; case 'onConversationChanged': - List list = List.empty(growable: true); - if (null != data) { - list = (_formatJson(data) as List) - .map((e) => ConversationInfo.fromJson(e)) - .toList(); - } + var list = + Utils.toList(data, (map) => ConversationInfo.fromJson(map)); conversationManager.conversationListener .conversationChanged(list); break; @@ -195,46 +184,50 @@ class IMManager { switch (type) { case 'onBlacklistAdded': - final u = BlacklistInfo.fromJson(_formatJson(data)); + final u = Utils.toObj(data, (map) => BlacklistInfo.fromJson(map)); friendshipManager.friendshipListener.blacklistAdded(u); break; case 'onBlacklistDeleted': - final u = BlacklistInfo.fromJson(_formatJson(data)); + final u = Utils.toObj(data, (map) => BlacklistInfo.fromJson(map)); friendshipManager.friendshipListener.blacklistDeleted(u); break; case 'onFriendApplicationAccepted': - final u = FriendApplicationInfo.fromJson(_formatJson(data)); + final u = Utils.toObj( + data, (map) => FriendApplicationInfo.fromJson(map)); friendshipManager.friendshipListener.friendApplicationAccepted(u); break; case 'onFriendApplicationAdded': - final u = FriendApplicationInfo.fromJson(_formatJson(data)); + final u = Utils.toObj( + data, (map) => FriendApplicationInfo.fromJson(map)); friendshipManager.friendshipListener.friendApplicationAdded(u); break; case 'onFriendApplicationDeleted': - final u = FriendApplicationInfo.fromJson(_formatJson(data)); + final u = Utils.toObj( + data, (map) => FriendApplicationInfo.fromJson(map)); friendshipManager.friendshipListener.friendApplicationDeleted(u); break; case 'onFriendApplicationListRejected': - final u = FriendApplicationInfo.fromJson(_formatJson(data)); + final u = Utils.toObj( + data, (map) => FriendApplicationInfo.fromJson(map)); friendshipManager.friendshipListener.friendApplicationRejected(u); break; case 'onFriendInfoChanged': - final u = FriendInfo.fromJson(_formatJson(data)); + final u = Utils.toObj(data, (map) => FriendInfo.fromJson(map)); friendshipManager.friendshipListener.friendInfoChanged(u); break; case 'onFriendAdded': - final u = FriendInfo.fromJson(_formatJson(data)); + final u = Utils.toObj(data, (map) => FriendInfo.fromJson(map)); friendshipManager.friendshipListener.friendAdded(u); break; case 'onFriendDeleted': - final u = FriendInfo.fromJson(_formatJson(data)); + final u = Utils.toObj(data, (map) => FriendInfo.fromJson(map)); friendshipManager.friendshipListener.friendDeleted(u); break; } } } catch (err) { print( - "回调失败了,数据类型异常。$err ${call.method} ${call.arguments['type']} ${call.arguments['data']}"); + "回调失败了。$err ${call.method} ${call.arguments['type']} ${call.arguments['data']}"); } return Future.value(null); }); @@ -242,14 +235,16 @@ class IMManager { /// Initialize SDK /// - /// [platform] Refer to [IMPlatform] - /// [apiAddr] Api server ip address - /// [wsAddr] WebSocket ip address - /// [dataDir] Data storage directory + /// [platform] platform number [IMPlatform] + /// [apiAddr] api server ip address + /// [wsAddr] webSocket ip address + /// [dataDir] data storage directory + /// /// 初始化SDK - /// [platform] 平台编号[IMPlatform] - /// [apiAddr] SDK api地址 - /// [wsAddr] SDK websocket地址 + /// + /// [platform] 平台编号[IMPlatform] + /// [apiAddr] SDK api地址 + /// [wsAddr] SDK websocket地址 /// [dataDir] SDK数据库存储目录 Future initSDK({ required int platform, @@ -272,7 +267,7 @@ class IMManager { "data_dir": dataDir, "log_level": logLevel, "object_storage": objectStorage, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), }, )); } @@ -294,7 +289,7 @@ class IMManager { _buildParam({ 'uid': uid, 'token': token, - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), }), ); this.isLogined = true; @@ -309,7 +304,7 @@ class IMManager { var value = await _channel.invokeMethod( 'logout', _buildParam({ - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), })); this.isLogined = false; return value; @@ -331,14 +326,4 @@ class IMManager { param["ManagerName"] = "imManager"; return param; } - - static dynamic _formatJson(value) => jsonDecode(_printValue(value)); - - static String _printValue(value) { - return value; - } - - static String _checkOperationID(String? obj) { - return obj ?? DateTime.now().millisecondsSinceEpoch.toString(); - } } diff --git a/lib/src/manager/im_message_manager.dart b/lib/src/manager/im_message_manager.dart index 2c2fffd..5e9f500 100644 --- a/lib/src/manager/im_message_manager.dart +++ b/lib/src/manager/im_message_manager.dart @@ -1,5 +1,3 @@ -import 'dart:convert'; - import 'package:flutter/services.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; @@ -35,22 +33,24 @@ class MessageManager { /// 发送消息 /// [userID]接收消息的用户id /// [groupID]接收消息的组id - Future sendMessage({ + Future sendMessage({ required Message message, String? userID, String? groupID, OfflinePushInfo? offlinePushInfo, String? operationID, }) => - _channel.invokeMethod( - 'sendMessage', - _buildParam({ - 'message': message.toJson(), - 'userID': userID ?? '', - 'groupID': groupID ?? '', - 'offlinePushInfo': offlinePushInfo?.toJson(), - 'operationID': _checkOperationID(operationID), - })) /*.then((value) => _toObj(value))*/; + _channel + .invokeMethod( + 'sendMessage', + _buildParam({ + 'message': message.toJson(), + 'userID': userID ?? '', + 'groupID': groupID ?? '', + 'offlinePushInfo': offlinePushInfo?.toJson() ?? {}, + 'operationID': Utils.checkOperationID(operationID), + })) + .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); /// Find all history message /// 获取聊天记录 @@ -71,9 +71,9 @@ class MessageManager { 'groupID': groupID ?? '', 'startClientMsgID': startMsg?.clientMsgID ?? '', 'count': count ?? 10, - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), })) - .then((value) => _toList(value)); + .then((value) => Utils.toList(value, (map) => Message.fromJson(map))); /// Revoke the sent information /// 撤回消息 @@ -85,7 +85,7 @@ class MessageManager { 'revokeMessage', _buildParam(message.toJson() ..addAll({ - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), }))); /// Delete message @@ -98,7 +98,7 @@ class MessageManager { 'deleteMessageFromLocalStorage', _buildParam(message.toJson() ..addAll({ - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), }))); /// @@ -119,7 +119,7 @@ class MessageManager { "message": message?.toJson(), "receiverID": receiverID, "senderID": senderID, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })); /// Query the message according to the message id @@ -142,7 +142,7 @@ class MessageManager { _buildParam({ "messageIDList": messageIDList, "userID": userID, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })); /// Typing @@ -157,7 +157,7 @@ class MessageManager { _buildParam({ "msgTip": msgTip, "userID": userID, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })); /// Create text message @@ -171,9 +171,9 @@ class MessageManager { 'createTextMessage', _buildParam({ 'text': text, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _toObj(value)); + .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); /// Create @ message /// 创建@消息 @@ -188,10 +188,10 @@ class MessageManager { _buildParam({ 'text': text, 'atUserList': atUidList, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), }), ) - .then((value) => _toObj(value)); + .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); /// Create picture message /// 创建图片消息 @@ -204,10 +204,10 @@ class MessageManager { 'createImageMessage', _buildParam({ 'imagePath': imagePath, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), }), ) - .then((value) => _toObj(value)); + .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); /// Create picture message /// 创建图片消息 @@ -220,10 +220,10 @@ class MessageManager { 'createImageMessageFromFullPath', _buildParam({ 'imagePath': imagePath, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), }), ) - .then((value) => _toObj(value)); + .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); /// Create sound message /// 创建语音消息 @@ -238,10 +238,10 @@ class MessageManager { _buildParam({ 'soundPath': soundPath, "duration": duration, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), }), ) - .then((value) => _toObj(value)); + .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); /// Create sound message /// 创建语音消息 @@ -256,10 +256,10 @@ class MessageManager { _buildParam({ 'soundPath': soundPath, "duration": duration, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), }), ) - .then((value) => _toObj(value)); + .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); /// Create video message /// 创建视频消息 @@ -278,9 +278,9 @@ class MessageManager { 'videoType': videoType, 'duration': duration, 'snapshotPath': snapshotPath, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _toObj(value)); + .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); /// Create video message /// 创建视频消息 @@ -299,9 +299,9 @@ class MessageManager { 'videoType': videoType, 'duration': duration, 'snapshotPath': snapshotPath, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _toObj(value)); + .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); /// Create file message /// 创建文件消息 @@ -316,9 +316,9 @@ class MessageManager { _buildParam({ 'filePath': filePath, 'fileName': fileName, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _toObj(value)); + .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); } /// Create file message @@ -334,9 +334,9 @@ class MessageManager { _buildParam({ 'filePath': filePath, 'fileName': fileName, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _toObj(value)); + .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); /// Create merger message /// 创建合并消息 @@ -353,9 +353,9 @@ class MessageManager { 'messageList': messageList.map((e) => e.toJson()).toList(), 'title': title, 'summaryList': summaryList, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _toObj(value)); + .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); /// Create forward message /// 创建转发消息 @@ -368,9 +368,9 @@ class MessageManager { 'createForwardMessage', _buildParam({ 'message': message.toJson(), - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _toObj(value)); + .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); } /// Create location message @@ -388,9 +388,9 @@ class MessageManager { 'latitude': latitude, 'longitude': longitude, 'description': description, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _toObj(value)); + .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); /// Create custom message /// 创建自定义消息 @@ -407,9 +407,9 @@ class MessageManager { 'data': data, 'extension': extension, 'description': description, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _toObj(value)); + .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); /// Create quote message /// 创建引用消息 @@ -424,9 +424,9 @@ class MessageManager { _buildParam({ 'quoteText': text, 'quoteMessage': quoteMsg.toJson(), - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _toObj(value)); + .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); /// Create card message /// 创建卡片消息 @@ -439,9 +439,9 @@ class MessageManager { 'createCardMessage', _buildParam({ 'cardMessage': data, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })) - .then((value) => _toObj(value)); + .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); /// Clear all c2c history message /// 清空单聊消息记录 @@ -453,7 +453,7 @@ class MessageManager { 'clearC2CHistoryMessage', _buildParam({ "userID": uid, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })); /// Clear all group history @@ -466,31 +466,11 @@ class MessageManager { 'clearGroupHistoryMessage', _buildParam({ "groupID": gid, - "operationID": _checkOperationID(operationID), + "operationID": Utils.checkOperationID(operationID), })); - /// - // void forceSyncMsg() { - // _channel.invokeMethod('forceSyncMsg', _buildParam({})); - // } - static Map _buildParam(Map param) { param["ManagerName"] = "messageManager"; return param; } - - static List _toList(String value) => - (_formatJson(value) as List).map((e) => Message.fromJson(e)).toList(); - - static Message _toObj(String value) => Message.fromJson(_formatJson(value)); - - static dynamic _formatJson(value) => jsonDecode(_printValue(value)); - - static String _printValue(value) { - return value; - } - - static String _checkOperationID(String? obj) { - return obj ?? DateTime.now().millisecondsSinceEpoch.toString(); - } } diff --git a/lib/src/manager/im_user_manager.dart b/lib/src/manager/im_user_manager.dart index 0b51082..165b70b 100644 --- a/lib/src/manager/im_user_manager.dart +++ b/lib/src/manager/im_user_manager.dart @@ -1,5 +1,3 @@ -import 'dart:convert'; - import 'package:flutter/services.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; @@ -27,9 +25,9 @@ class UserManager { 'getUsersInfo', _buildParam({ 'uidList': uidList, - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), })) - .then((value) => _toList(value, (v) => UserInfo.fromJson(v.cast()))); + .then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v))); /// Get the information of the currently logged in user /// 获取当前登录用户的信息 @@ -40,9 +38,9 @@ class UserManager { .invokeMethod( 'getSelfUserInfo', _buildParam({ - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), })) - .then((value) => UserInfo.fromJson(_formatJson(value))); + .then((value) => Utils.toObj(value, (map) => UserInfo.fromJson(map))); /// Modify current user info /// 修改当前登录用户资料 @@ -52,7 +50,7 @@ class UserManager { int? gender, int? appMangerLevel, String? phoneNumber, - String? birth, + int? birth, String? email, String? ex, String? operationID, @@ -69,27 +67,11 @@ class UserManager { 'birth': birth, 'email': email, 'ex': ex, - 'operationID': _checkOperationID(operationID), + 'operationID': Utils.checkOperationID(operationID), })); static Map _buildParam(Map param) { param["ManagerName"] = "userManager"; return param; } - - static List _toList(String? value, T f(Map map)) { - var list = _formatJson(value); - if (null == list) return []; - return (list as List).map((e) => f(e)).toList(); - } - - static dynamic _formatJson(value) => jsonDecode(_printValue(value)); - - static String _printValue(value) { - return value; - } - - static String _checkOperationID(String? obj) { - return obj ?? DateTime.now().millisecondsSinceEpoch.toString(); - } } diff --git a/lib/src/models/conversation_info.dart b/lib/src/models/conversation_info.dart index d63a68f..b2f0475 100644 --- a/lib/src/models/conversation_info.dart +++ b/lib/src/models/conversation_info.dart @@ -38,7 +38,6 @@ class ConversationInfo { ConversationInfo.fromJson(Map json) : conversationID = json['conversationID'] { - // conversationID = json['conversationID']; conversationType = json['conversationType']; userID = json['userID']; groupID = json['groupID']; @@ -46,8 +45,6 @@ class ConversationInfo { faceURL = json['faceURL']; recvMsgOpt = json['recvMsgOpt']; unreadCount = json['unreadCount']; - // latestMsg = json['latestMsg']; - // if (null != json['latestMsg']) { try { if (json['latestMsg'] is String) { latestMsg = Message.fromJson(jsonDecode(json['latestMsg'])); @@ -55,9 +52,6 @@ class ConversationInfo { latestMsg = Message.fromJson(json['latestMsg']); } } catch (e) {} - - // } - latestMsgSendTime = json['latestMsgSendTime']; draftText = json['draftText']; draftTextTime = json['draftTextTime']; @@ -65,7 +59,7 @@ class ConversationInfo { } Map toJson() { - final Map data = new Map(); + final data = Map(); data['conversationID'] = this.conversationID; data['conversationType'] = this.conversationType; data['userID'] = this.userID; @@ -82,10 +76,9 @@ class ConversationInfo { return data; } - bool get isSingleChat => conversationType == ConversationType.single_chat; - - bool get isGroupChat => conversationType == ConversationType.group_chat; + bool get isSingleChat => conversationType == ConversationType.single; + bool get isGroupChat => conversationType == ConversationType.group; @override bool operator ==(Object other) => diff --git a/lib/src/models/group_info.dart b/lib/src/models/group_info.dart index 5fc3302..428574c 100644 --- a/lib/src/models/group_info.dart +++ b/lib/src/models/group_info.dart @@ -43,7 +43,7 @@ class GroupInfo { } Map toJson() { - final Map data = new Map(); + final data = Map(); data['groupID'] = this.groupID; data['groupName'] = this.groupName; data['notification'] = this.notification; @@ -96,7 +96,7 @@ class GroupMembersInfo { } Map toJson() { - final Map data = new Map(); + final data = Map(); data['groupID'] = this.groupID; data['userID'] = this.userID; data['roleLevel'] = this.roleLevel; @@ -125,7 +125,7 @@ class GroupMemberRole { } Map toJson() { - final Map data = new Map(); + final data = Map(); data['userID'] = this.userID; data['roleLevel'] = this.roleLevel; return data; @@ -148,7 +148,10 @@ class GroupApplicationInfo { String? nickname; String? userFaceURL; int? gender; - int? handleResult; //REFUSE = -1, AGREE = 1 + + /// REFUSE = -1, AGREE = 1 + /// -1:拒绝,1:同意 + int? handleResult; String? reqMsg; String? handledMsg; int? reqTime; @@ -246,59 +249,9 @@ class GroupInviteResult { } Map toJson() { - final Map data = new Map(); + final data = Map(); data['userID'] = this.userID; data['result'] = this.result; return data; } } - -// class GroupMembersList { -// int? nextSeq; -// List? data; -// -// GroupMembersList({this.nextSeq, this.data}); -// -// GroupMembersList.fromJson(Map json) { -// nextSeq = json['nextSeq']; -// if (json['data'] is List) { -// data = (json['data'] as List) -// .map((e) => GroupMembersInfo.fromJson(e)) -// .toList(); -// } -// } -// -// Map toJson() { -// final Map data = new Map(); -// data['nextSeq'] = this.nextSeq; -// if (this.data != null) { -// data['data'] = this.data!.map((v) => v.toJson()).toList(); -// } -// return data; -// } -// } -// -// class GroupApplicationList { -// int? count; -// List? user; -// -// GroupApplicationList({this.count, this.user}); -// -// GroupApplicationList.fromJson(Map json) { -// count = json['count']; -// if (json['user'] is List) { -// user = (json['user'] as List) -// .map((e) => GroupApplicationInfo.fromJson(e)) -// .toList(); -// } -// } -// -// Map toJson() { -// final Map data = new Map(); -// data['count'] = this.count; -// if (this.user != null) { -// data['user'] = this.user!.map((v) => v.toJson()).toList(); -// } -// return data; -// } -// } diff --git a/lib/src/models/message.dart b/lib/src/models/message.dart index 81c3678..51c901f 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -71,8 +71,7 @@ class Message { this.notificationElem, }); - Message.fromJson( - Map json) /* : clientMsgID = json['clientMsgID']*/ { + Message.fromJson(Map json) { clientMsgID = json['clientMsgID']; serverMsgID = json['serverMsgID']; createTime = json['createTime']; @@ -127,7 +126,7 @@ class Message { } Map toJson() { - final Map data = new Map(); + final data = Map(); data['clientMsgID'] = this.clientMsgID; data['serverMsgID'] = this.serverMsgID; data['createTime'] = this.createTime; @@ -171,6 +170,41 @@ class Message { @override int get hashCode => clientMsgID.hashCode; + + void update(Message message) { + if (clientMsgID != message.clientMsgID) return; + // clientMsgID = message.clientMsgID; + serverMsgID = message.serverMsgID; + createTime = message.createTime; + sendTime = message.sendTime; + sendID = message.sendID; + recvID = message.recvID; + msgFrom = message.msgFrom; + contentType = message.contentType; + platformID = message.platformID; + senderNickname = message.senderNickname; + senderFaceUrl = message.senderFaceUrl; + groupID = message.groupID; + content = message.content; + seq = message.seq; + isRead = message.isRead; + status = message.status; + offlinePush = message.offlinePush; + attachedInfo = message.attachedInfo; + ex = message.ex; + ext = message.ext; + sessionType = message.sessionType; + pictureElem = message.pictureElem; + soundElem = message.soundElem; + videoElem = message.videoElem; + fileElem = message.fileElem; + atElem = message.atElem; + locationElem = message.locationElem; + customElem = message.customElem; + quoteElem = message.quoteElem; + mergeElem = message.mergeElem; + notificationElem = message.notificationElem; + } } class PictureElem { @@ -199,7 +233,7 @@ class PictureElem { } Map toJson() { - final Map data = new Map(); + final data = Map(); data['sourcePath'] = this.sourcePath; if (this.sourcePicture != null) { data['sourcePicture'] = this.sourcePicture?.toJson(); @@ -235,7 +269,7 @@ class PictureInfo { } Map toJson() { - final Map data = new Map(); + final data = Map(); data['uuid'] = this.uuid; data['type'] = this.type; data['size'] = this.size; @@ -269,7 +303,7 @@ class SoundElem { } Map toJson() { - final Map data = new Map(); + final data = Map(); data['uuid'] = this.uuid; data['soundPath'] = this.soundPath; data['sourceUrl'] = this.sourceUrl; @@ -323,7 +357,7 @@ class VideoElem { } Map toJson() { - final Map data = new Map(); + final data = Map(); data['videoPath'] = this.videoPath; data['videoUUID'] = this.videoUUID; data['videoUrl'] = this.videoUrl; @@ -359,7 +393,7 @@ class FileElem { } Map toJson() { - final Map data = new Map(); + final data = Map(); data['filePath'] = this.filePath; data['uuid'] = this.uuid; data['sourceUrl'] = this.sourceUrl; @@ -385,7 +419,7 @@ class AtElem { } Map toJson() { - final Map data = new Map(); + final data = Map(); data['text'] = this.text; data['atUserList'] = this.atUserList; data['isAtSelf'] = this.isAtSelf; @@ -416,7 +450,7 @@ class LocationElem { } Map toJson() { - final Map data = new Map(); + final data = Map(); data['description'] = this.description; data['longitude'] = this.longitude; data['latitude'] = this.latitude; @@ -438,7 +472,7 @@ class CustomElem { } Map toJson() { - final Map data = new Map(); + final data = Map(); data['data'] = this.data; data['extension'] = this.extension; data['description'] = this.description; @@ -460,7 +494,7 @@ class QuoteElem { } Map toJson() { - final Map data = new Map(); + final data = Map(); data['text'] = this.text; data['quoteMessage'] = this.quoteMessage?.toJson(); return data; @@ -487,7 +521,7 @@ class MergeElem { } Map toJson() { - final Map data = new Map(); + final data = Map(); data['title'] = this.title; data['abstractList'] = this.abstractList; data['multiMessage'] = this.multiMessage?.map((e) => e.toJson()).toList(); @@ -507,14 +541,14 @@ class NotificationElem { } Map toJson() { - final Map data = new Map(); + final data = Map(); data['detail'] = this.detail; data['defaultTips'] = this.defaultTips; return data; } } -class HaveReadInfo { +class ReadReceiptInfo { String? uid; List? msgIDList; int? readTime; @@ -522,7 +556,7 @@ class HaveReadInfo { int? contentType; int? sessionType; - HaveReadInfo( + ReadReceiptInfo( {this.uid, this.msgIDList, this.readTime, @@ -530,7 +564,7 @@ class HaveReadInfo { this.contentType, this.sessionType}); - HaveReadInfo.fromJson(Map json) { + ReadReceiptInfo.fromJson(Map json) { uid = json['uid']; if (json['msgIDList'] is List) { msgIDList = (json['msgIDList'] as List).map((e) => '$e').toList(); @@ -542,7 +576,7 @@ class HaveReadInfo { } Map toJson() { - final Map data = new Map(); + final data = Map(); data['uid'] = this.uid; data['msgIDList'] = this.msgIDList; data['readTime'] = this.readTime; @@ -572,7 +606,7 @@ class OfflinePushInfo { } Map toJson() { - final Map data = new Map(); + final data = Map(); data['title'] = this.title; data['desc'] = this.desc; data['ex'] = this.ex; diff --git a/lib/src/utils.dart b/lib/src/utils.dart new file mode 100644 index 0000000..520442c --- /dev/null +++ b/lib/src/utils.dart @@ -0,0 +1,27 @@ +import 'dart:convert'; + +class Utils { + static List toList(String? value, T f(Map map)) { + var list = _formatJson(value); + if (null == list) return []; + return (list as List).map((e) => f(e)).toList(); + } + + static T toObj(String value, T f(Map map)) => + f(_formatJson(value)); + + static List toListMap(String? value) => _formatJson(value) ?? []; + + static dynamic _formatJson(String? value) { + if (null == value) return null; + return jsonDecode(_printValue(value)); + } + + static String _printValue(value) { + return value; + } + + static String checkOperationID(String? obj) { + return obj ?? DateTime.now().millisecondsSinceEpoch.toString(); + } +} diff --git a/test/flutter_openim_sdk_test.dart b/test/flutter_openim_sdk_test.dart index d9a8e8c..1f50843 100644 --- a/test/flutter_openim_sdk_test.dart +++ b/test/flutter_openim_sdk_test.dart @@ -1,41 +1,5 @@ +import 'package:flutter_test/flutter_test.dart'; void main() { - /* const MethodChannel channel = MethodChannel('flutter_openim_sdk'); - TestWidgetsFlutterBinding.ensureInitialized(); - - setUp(() { - channel.setMockMethodCallHandler((MethodCall methodCall) async { - return '42'; - }); - }); - - tearDown(() { - channel.setMockMethodCallHandler(null); - }); - - test('getPlatformVersion', () async {});*/ - - // Message m1 = new Message(clientMsgID: '1', content: 'c1'); - // Message m2 = new Message(clientMsgID: '2', content: 'c2'); - // Message m3 = new Message(clientMsgID: '3', content: 'c3'); - // Message m4 = new Message(clientMsgID: '3', content: 'c4'); - // List list = List.of([m1, m2, m3]); - // - // print(list.contains(m4)); - // print(m1 == m4); - // print(m2 == m4); - // print(m3 == m4); - // var input = "1234 @abc @bbc @hha 开什么玩笑"; - // RegExp exp = new RegExp(r"(@\w+) "); - // final ms = exp.allMatches(input); - // for (Match m in ms) { - // String match = m.group(0)??''; - // print('====$match ${m.start} ${m.end}'); - // } - - // DateTime now = DateTime.now(); - // print('${now.millisecond}'); - // print('${now.microsecondsSinceEpoch}'); - // print('${now.millisecondsSinceEpoch}'); }