From 771c1ac83f2dde7585b7e1bb6f21ecc3b27dc884 Mon Sep 17 00:00:00 2001 From: Brett <> Date: Sun, 29 Sep 2024 19:55:04 +0800 Subject: [PATCH] chore: https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.8.1 --- .../OpenIMSDKiOS/OPENIMSDKViewController.m | 17 +----- OpenIMSDK.podspec | 4 +- OpenIMSDK/Callbacker/OIMCallbacker.h | 6 +-- OpenIMSDK/Callbacker/OIMCallbacker.m | 15 ++++++ OpenIMSDK/Interface/OIMManager+Connection.m | 2 +- OpenIMSDK/Interface/OIMManager+Conversation.h | 12 ++--- OpenIMSDK/Interface/OIMManager+Conversation.m | 54 ++++++++++--------- OpenIMSDK/Interface/OIMManager+Friend.h | 15 ++++-- OpenIMSDK/Interface/OIMManager+Friend.m | 48 +++++++++++------ OpenIMSDK/Interface/OIMManager+Group.h | 2 +- OpenIMSDK/Interface/OIMManager+Group.m | 34 ++++++++---- OpenIMSDK/Interface/OIMManager+Message.h | 2 +- OpenIMSDK/Interface/OIMManager+Message.m | 2 - OpenIMSDK/Interface/OIMManager+User.h | 19 ++++--- OpenIMSDK/Interface/OIMManager+User.m | 25 +++++---- OpenIMSDK/Model/OIMConversationInfo.h | 32 +++++++++++ OpenIMSDK/Model/OIMConversationInfo.m | 4 ++ OpenIMSDK/Model/OIMFullUserInfo.h | 21 -------- OpenIMSDK/Model/OIMFullUserInfo.m | 46 ---------------- OpenIMSDK/Model/OIMGroupMemberInfo.h | 11 ++++ OpenIMSDK/Model/OIMGroupMemberInfo.m | 4 ++ OpenIMSDK/Model/OIMUpdateFriendsReq.h | 19 +++++++ OpenIMSDK/Model/OIMUpdateFriendsReq.m | 6 +++ 23 files changed, 226 insertions(+), 174 deletions(-) create mode 100644 OpenIMSDK/Model/OIMUpdateFriendsReq.h create mode 100644 OpenIMSDK/Model/OIMUpdateFriendsReq.m diff --git a/Example/OpenIMSDKiOS/OPENIMSDKViewController.m b/Example/OpenIMSDKiOS/OPENIMSDKViewController.m index ab26acd..bb3f2d8 100644 --- a/Example/OpenIMSDKiOS/OPENIMSDKViewController.m +++ b/Example/OpenIMSDKiOS/OPENIMSDKViewController.m @@ -508,6 +508,7 @@ - (void)getDesignatedFriendsInfo { todo:^(void (^callback)(NSNumber *code, NSString *msg)) { [OIMManager.manager getSpecifiedFriendsInfo:@[OTHER_USER_ID] + filterBlack:NO onSuccess:^(NSArray * _Nullable friendInfo) { callback(nil, nil); } onFailure:^(NSInteger code, NSString * _Nullable msg) { @@ -521,7 +522,7 @@ - (void)getFriendList { [self operate:_cmd todo:^(void (^callback)(NSNumber *code, NSString *msg)) { - [OIMManager.manager getFriendListWithOnSuccess:^(NSArray * _Nullable userInfos) { + [OIMManager.manager getFriendListWithFilterBlack:NO onSuccess:^(NSArray * _Nullable userInfos) { callback(nil, nil); } onFailure:^(NSInteger code, NSString * _Nullable msg) { callback(@(code), msg); @@ -1465,20 +1466,6 @@ - (void)markGroupMessageHasRead { }]; } -- (void)getConversationRecvMessageOpt { - [self operate:_cmd - todo:^(void (^callback)(NSNumber *code, NSString *msg)) { - - [OIMManager.manager getConversationRecvMessageOpt:@[CONVERSASTION_ID] - onSuccess:^(NSArray * _Nullable conversations) { - - callback(nil, nil); - } onFailure:^(NSInteger code, NSString * _Nullable msg) { - callback(@(code), msg); - }]; - }]; -} - - (void)setConversationRecvMessageOpt { [self operate:_cmd todo:^(void (^callback)(NSNumber *code, NSString *msg)) { diff --git a/OpenIMSDK.podspec b/OpenIMSDK.podspec index 02763c4..7481866 100644 --- a/OpenIMSDK.podspec +++ b/OpenIMSDK.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'OpenIMSDK' - s.version = '3.8.1-rc.0' + s.version = '3.8.1' s.summary = 'Open-IM-SDK' # This description is used to generate tags and improve search results. @@ -77,6 +77,6 @@ Pod::Spec.new do |s| s.static_framework = true - s.dependency 'OpenIMSDKCore', '3.8.1-rc.0' + s.dependency 'OpenIMSDKCore', '3.8.1' s.dependency 'MJExtension' end diff --git a/OpenIMSDK/Callbacker/OIMCallbacker.h b/OpenIMSDK/Callbacker/OIMCallbacker.h index aee47ef..25a498e 100644 --- a/OpenIMSDK/Callbacker/OIMCallbacker.h +++ b/OpenIMSDK/Callbacker/OIMCallbacker.h @@ -32,9 +32,9 @@ typedef void (^OIMSimpleResultsCallback)(NSArray * _Null typedef void (^OIMUserInfoCallback)(OIMUserInfo * _Nullable userInfo); typedef void (^OIMUsersInfoCallback)(NSArray * _Nullable usersInfo); -typedef void (^OIMUsersCallback)(NSArray * _Nullable userInfos); -typedef void (^OIMFullUserInfoCallback)(OIMFullUserInfo * _Nullable userInfo); -typedef void (^OIMFullUsersInfoCallback)(NSArray * _Nullable userInfos); +typedef void (^OIMUsersCallback)(NSArray * _Nullable userInfos); +typedef void (^OIMPublicUserInfoCallback)(OIMPublicUserInfo * _Nullable userInfo); +typedef void (^OIMPublicUsersInfoCallback)(NSArray * _Nullable userInfos); typedef void (^OIMBlacksInfoCallback)(NSArray * _Nullable blackInfos); typedef void (^OIMUserStatusInfoCallback)(OIMUserStatusInfo * _Nullable statusInfo); typedef void (^OIMUserStatusInfosCallback)(NSArray * _Nullable statusInfos); diff --git a/OpenIMSDK/Callbacker/OIMCallbacker.m b/OpenIMSDK/Callbacker/OIMCallbacker.m index c253592..b565727 100644 --- a/OpenIMSDK/Callbacker/OIMCallbacker.m +++ b/OpenIMSDK/Callbacker/OIMCallbacker.m @@ -246,6 +246,21 @@ - (void)onUserStatusChanged:(NSString *)statusMap { }]; } +- (void)onUserCommandAdd:(NSString * _Nullable)userCommand { + +} + + +- (void)onUserCommandDelete:(NSString * _Nullable)userCommand { + +} + + +- (void)onUserCommandUpdate:(NSString * _Nullable)userCommand { + +} + + #pragma mark - #pragma mark - Friend diff --git a/OpenIMSDK/Interface/OIMManager+Connection.m b/OpenIMSDK/Interface/OIMManager+Connection.m index 554fbe1..dc7db45 100644 --- a/OpenIMSDK/Interface/OIMManager+Connection.m +++ b/OpenIMSDK/Interface/OIMManager+Connection.m @@ -18,7 +18,7 @@ - (instancetype)init { self.dataDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject stringByAppendingString:@"/"]; self.logFilePath = self.dataDir; self.isLogStandardOutput = YES; - self.logLevel = 6; + self.logLevel = 5; self.compression = NO; self.systemType = @"native_iOS"; } diff --git a/OpenIMSDK/Interface/OIMManager+Conversation.h b/OpenIMSDK/Interface/OIMManager+Conversation.h index 9074a7c..1d2c354 100644 --- a/OpenIMSDK/Interface/OIMManager+Conversation.h +++ b/OpenIMSDK/Interface/OIMManager+Conversation.h @@ -97,13 +97,6 @@ NS_ASSUME_NONNULL_BEGIN - (void)getTotalUnreadMsgCountWithOnSuccess:(nullable OIMNumberCallback)onSuccess onFailure:(nullable OIMFailureCallback)onFailure; -/** - * Get the "do not disturb" status for a conversation - */ -- (void)getConversationRecvMessageOpt:(NSArray *)conversationIDs - onSuccess:(nullable OIMConversationNotDisturbInfoCallback)onSuccess - onFailure:(nullable OIMFailureCallback)onFailure; - /** * Set the "do not disturb" status for a conversation */ @@ -186,6 +179,11 @@ NS_ASSUME_NONNULL_BEGIN userID:(NSString *)userID onSuccess:(nullable OIMInputStatusChangedCallback)onSuccess onFailure:(nullable OIMFailureCallback)onFailure; + +- (void)setConversation:(NSString *)conversationID + userID:(OIMConversationReq *)req + onSuccess:(nullable OIMSuccessCallback)onSuccess + onFailure:(nullable OIMFailureCallback)onFailure; @end NS_ASSUME_NONNULL_END diff --git a/OpenIMSDK/Interface/OIMManager+Conversation.m b/OpenIMSDK/Interface/OIMManager+Conversation.m index 22dccef..cc1dab9 100644 --- a/OpenIMSDK/Interface/OIMManager+Conversation.m +++ b/OpenIMSDK/Interface/OIMManager+Conversation.m @@ -7,6 +7,7 @@ #import "OIMManager+Conversation.h" #import "CallbackProxy.h" +#import "OIMConversationInfo.h" @implementation OIMManager (Conversation) @@ -98,9 +99,10 @@ - (void)pinConversation:(NSString *)conversationID isPinned:(BOOL)isPinned onSuccess:(OIMSuccessCallback)onSuccess onFailure:(OIMFailureCallback)onFailure { - CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure]; + OIMConversationReq *req = [OIMConversationReq new]; + req.isPinned = isPinned; - Open_im_sdkPinConversation(callback, [self operationId], conversationID, isPinned); + [self setConversation:conversationID req:req onSuccess:onSuccess onFailure:onFailure]; } - (void)getTotalUnreadMsgCountWithOnSuccess:(OIMNumberCallback)onSuccess @@ -114,51 +116,43 @@ - (void)getTotalUnreadMsgCountWithOnSuccess:(OIMNumberCallback)onSuccess Open_im_sdkGetTotalUnreadMsgCount(callback, [self operationId]); } -- (void)getConversationRecvMessageOpt:(NSArray *)conversationIDs - onSuccess:(OIMConversationNotDisturbInfoCallback)onSuccess - onFailure:(OIMFailureCallback)onFailure { - CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:^(NSString * _Nullable data) { - if (onSuccess) { - onSuccess([OIMConversationNotDisturbInfo mj_objectArrayWithKeyValuesArray:data]); - } - } onFailure:onFailure]; - - Open_im_sdkGetConversationRecvMessageOpt(callback, [self operationId], conversationIDs.mj_JSONString); -} - - (void)setConversationRecvMessageOpt:(NSString *)conversationID status:(OIMReceiveMessageOpt)status onSuccess:(OIMSuccessCallback)onSuccess onFailure:(OIMFailureCallback)onFailure { - CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure]; + OIMConversationReq *req = [OIMConversationReq new]; + req.recvMsgOpt = status; - Open_im_sdkSetConversationRecvMessageOpt(callback, [self operationId], conversationID, status); + [self setConversation:conversationID req:req onSuccess:onSuccess onFailure:onFailure]; } - (void)setConversationPrivateChat:(NSString *)conversationID isPrivate:(BOOL)isPrivate onSuccess:(OIMSuccessCallback)onSuccess onFailure:(OIMFailureCallback)onFailure { - CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure]; + OIMConversationReq *req = [OIMConversationReq new]; + req.isPrivateChat = isPrivate; - Open_im_sdkSetConversationPrivateChat(callback, [self operationId], conversationID, isPrivate); + [self setConversation:conversationID req:req onSuccess:onSuccess onFailure:onFailure]; } - (void)setConversationBurnDuration:(NSString *)conversationID duration:(NSInteger)burnDuration onSuccess:(OIMSuccessCallback)onSuccess onFailure:(OIMFailureCallback)onFailure { - CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure]; + OIMConversationReq *req = [OIMConversationReq new]; + req.burnDuration = burnDuration; - Open_im_sdkSetConversationBurnDuration(callback, [self operationId], conversationID, (int32_t)burnDuration); + [self setConversation:conversationID req:req onSuccess:onSuccess onFailure:onFailure]; } - (void)resetConversationGroupAtType:(NSString *)conversationID onSuccess:(OIMSuccessCallback)onSuccess onFailure:(OIMFailureCallback)onFailure { - CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure]; + OIMConversationReq *req = [OIMConversationReq new]; + req.groupAtType = 0; - Open_im_sdkResetConversationGroupAtType(callback, [self operationId], conversationID); + [self setConversation:conversationID req:req onSuccess:onSuccess onFailure:onFailure]; } - (void)hideConversation:(NSString *)conversationID @@ -188,9 +182,10 @@ - (void)setConversationEx:(NSString *)conversationID ex:(NSString *)ex onSuccess:(nullable OIMSuccessCallback)onSuccess onFailure:(nullable OIMFailureCallback)onFailure { - CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure]; - - Open_im_sdkSetConversationEx(callback, [self operationId], conversationID, ex); + OIMConversationReq *req = [OIMConversationReq new]; + req.ex = ex; + + [self setConversation:conversationID req:req onSuccess:onSuccess onFailure:onFailure]; } - (void)searchConversation:(NSString *)name @@ -226,4 +221,13 @@ - (void)getInputstates:(NSString *)conversationID Open_im_sdkGetInputStates(callback, [self operationId], conversationID, userID); } + +- (void)setConversation:(NSString *)conversationID + req:(OIMConversationReq *)req + onSuccess:(nullable OIMSuccessCallback)onSuccess + onFailure:(nullable OIMFailureCallback)onFailure { + CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure]; + + Open_im_sdkSetConversation(callback, [self operationId], conversationID, req.mj_JSONString); +} @end diff --git a/OpenIMSDK/Interface/OIMManager+Friend.h b/OpenIMSDK/Interface/OIMManager+Friend.h index 79dac7c..3bad58e 100644 --- a/OpenIMSDK/Interface/OIMManager+Friend.h +++ b/OpenIMSDK/Interface/OIMManager+Friend.h @@ -6,6 +6,7 @@ // #import "OIMManager.h" +#import "OIMUpdateFriendsReq.h" NS_ASSUME_NONNULL_BEGIN @@ -87,18 +88,21 @@ NS_ASSUME_NONNULL_BEGIN * @param usersID List of user IDs */ - (void)getSpecifiedFriendsInfo:(NSArray *)usersID - onSuccess:(nullable OIMFullUsersInfoCallback)onSuccess + filterBlack:(BOOL)filterBlack + onSuccess:(nullable OIMPublicUsersInfoCallback)onSuccess onFailure:(nullable OIMFailureCallback)onFailure; /** * Get information for all friends */ -- (void)getFriendListWithOnSuccess:(nullable OIMFullUsersInfoCallback)onSuccess +- (void)getFriendListWithFilterBlack:(BOOL)filterBlack + onSuccess:(nullable OIMPublicUsersInfoCallback)onSuccess onFailure:(nullable OIMFailureCallback)onFailure; - (void)getFriendListPageWithOffset:(NSInteger)offset count:(NSInteger)count - onSuccess:(nullable OIMFullUsersInfoCallback)onSuccess + filterBlack:(BOOL)filterBlack + onSuccess:(nullable OIMPublicUsersInfoCallback)onSuccess onFailure:(nullable OIMFailureCallback)onFailure; /** @@ -142,6 +146,11 @@ NS_ASSUME_NONNULL_BEGIN ex:(NSString *)ex onSuccess:(nullable OIMSuccessCallback)onSuccess onFailure:(nullable OIMFailureCallback)onFailure; + + +- (void)updateFriends:(OIMUpdateFriendsReq *)req + onSuccess:(nullable OIMSuccessCallback)onSuccess + onFailure:(nullable OIMFailureCallback)onFailure; @end NS_ASSUME_NONNULL_END diff --git a/OpenIMSDK/Interface/OIMManager+Friend.m b/OpenIMSDK/Interface/OIMManager+Friend.m index 06ad8c0..313673a 100644 --- a/OpenIMSDK/Interface/OIMManager+Friend.m +++ b/OpenIMSDK/Interface/OIMManager+Friend.m @@ -98,41 +98,44 @@ - (void)removeFromBlackList:(NSString *)userID Open_im_sdkRemoveBlack(callback, [self operationId], userID); } -- (void)getSpecifiedFriendsInfo:(NSArray *)usersID - onSuccess:(OIMFullUsersInfoCallback)onSuccess - onFailure:(OIMFailureCallback)onFailure { +- (void)getSpecifiedFriendsInfo:(NSArray *)usersID + filterBlack:(BOOL)filterBlack + onSuccess:(nullable OIMPublicUsersInfoCallback)onSuccess + onFailure:(nullable OIMFailureCallback)onFailure { CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:^(NSString * _Nullable data) { if (onSuccess) { - onSuccess([OIMFullUserInfo mj_objectArrayWithKeyValuesArray:data]); + onSuccess([OIMPublicUserInfo mj_objectArrayWithKeyValuesArray:data]); } } onFailure:onFailure]; - Open_im_sdkGetSpecifiedFriendsInfo(callback, [self operationId], usersID.mj_JSONString); + Open_im_sdkGetSpecifiedFriendsInfo(callback, [self operationId], usersID.mj_JSONString, filterBlack); } -- (void)getFriendListWithOnSuccess:(OIMFullUsersInfoCallback)onSuccess - onFailure:(OIMFailureCallback)onFailure { +- (void)getFriendListWithFilterBlack:(BOOL)filterBlack + onSuccess:(nullable OIMPublicUsersInfoCallback)onSuccess + onFailure:(nullable OIMFailureCallback)onFailure { CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:^(NSString * _Nullable data) { if (onSuccess) { - onSuccess([OIMFullUserInfo mj_objectArrayWithKeyValuesArray:data]); + onSuccess([OIMPublicUserInfo mj_objectArrayWithKeyValuesArray:data]); } } onFailure:onFailure]; - Open_im_sdkGetFriendList(callback, [self operationId]); + Open_im_sdkGetFriendList(callback, [self operationId], filterBlack); } - (void)getFriendListPageWithOffset:(NSInteger)offset count:(NSInteger)count - onSuccess:(OIMFullUsersInfoCallback)onSuccess + filterBlack:(BOOL)filterBlack + onSuccess:(OIMPublicUsersInfoCallback)onSuccess onFailure:(OIMFailureCallback)onFailure { CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:^(NSString * _Nullable data) { if (onSuccess) { - onSuccess([OIMFullUserInfo mj_objectArrayWithKeyValuesArray:data]); + onSuccess([OIMPublicUserInfo mj_objectArrayWithKeyValuesArray:data]); } } onFailure:onFailure]; - Open_im_sdkGetFriendListPage(callback, [self operationId], (int32_t)offset, (int32_t)count); + Open_im_sdkGetFriendListPage(callback, [self operationId], (int32_t)offset, (int32_t)count, filterBlack); } - (void)checkFriend:(NSArray *)usersID @@ -152,9 +155,12 @@ - (void)setFriendRemark:(NSString *)userID onSuccess:(OIMSuccessCallback)onSuccess onFailure:(OIMFailureCallback)onFailure { CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure]; + + OIMUpdateFriendsReq *req = [OIMUpdateFriendsReq new]; + req.friendUserIDs = @[userID]; + req.remark = remark; - NSDictionary *param = @{@"toUserID": userID, @"remark": remark ?: @""}; - Open_im_sdkSetFriendRemark(callback, [self operationId], param.mj_JSONString); + [self updateFriends:req onSuccess:onSuccess onFailure:onFailure]; } - (void)deleteFriend:(NSString *)friendUserID @@ -185,6 +191,18 @@ - (void)setFriendsEx:(NSArray *)friendIDs onFailure:(OIMFailureCallback)onFailure { CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure]; - Open_im_sdkSetFriendsEx(callback, [self operationId], friendIDs.mj_JSONString, ex); + OIMUpdateFriendsReq *req = [OIMUpdateFriendsReq new]; + req.friendUserIDs = friendIDs; + req.ex = ex; + + [self updateFriends:req onSuccess:onSuccess onFailure:onFailure]; +} + +- (void)updateFriends:(OIMUpdateFriendsReq *)req + onSuccess:(nullable OIMSuccessCallback)onSuccess + onFailure:(nullable OIMFailureCallback)onFailure { + CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure]; + + Open_im_sdkUpdateFriends(callback, [self operationId], req.mj_JSONString); } @end diff --git a/OpenIMSDK/Interface/OIMManager+Group.h b/OpenIMSDK/Interface/OIMManager+Group.h index 96f8cb5..8e5d781 100644 --- a/OpenIMSDK/Interface/OIMManager+Group.h +++ b/OpenIMSDK/Interface/OIMManager+Group.h @@ -228,7 +228,7 @@ NS_ASSUME_NONNULL_BEGIN /** * Set group member's info */ -- (void)setGroupMemberInfo:(OIMGroupMemberInfo *)groupMemberInfo +- (void)setGroupMemberInfo:(OIMSetGroupMemberInfo *)groupMemberInfo onSuccess:(nullable OIMSuccessCallback)onSuccess onFailure:(nullable OIMFailureCallback)onFailure; diff --git a/OpenIMSDK/Interface/OIMManager+Group.m b/OpenIMSDK/Interface/OIMManager+Group.m index 7605ef3..487f99c 100644 --- a/OpenIMSDK/Interface/OIMManager+Group.m +++ b/OpenIMSDK/Interface/OIMManager+Group.m @@ -241,9 +241,12 @@ - (void)setGroupMemberNickname:(NSString *)groupID groupNickname:(NSString *)groupNickname onSuccess:(OIMSuccessCallback)onSuccess onFailure:(OIMFailureCallback)onFailure { - CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure]; + OIMSetGroupMemberInfo *info = [OIMSetGroupMemberInfo new]; + info.groupID = groupID; + info.userID = userID; + info.nickname = groupNickname; - Open_im_sdkSetGroupMemberNickname(callback, [self operationId], groupID, userID, groupNickname ?: @""); + [self setGroupMemberInfo:info onSuccess:onSuccess onFailure:onFailure]; } - (void)setGroupMemberRoleLevel:(NSString *)groupID @@ -251,12 +254,15 @@ - (void)setGroupMemberRoleLevel:(NSString *)groupID roleLevel:(OIMGroupMemberRole)roleLevel onSuccess:(OIMSuccessCallback)onSuccess onFailure:(OIMFailureCallback)onFailure { - CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure]; + OIMSetGroupMemberInfo *info = [OIMSetGroupMemberInfo new]; + info.groupID = groupID; + info.userID = userID; + info.roleLevel = roleLevel; - Open_im_sdkSetGroupMemberRoleLevel(callback, [self operationId], groupID, userID, roleLevel); + [self setGroupMemberInfo:info onSuccess:onSuccess onFailure:onFailure]; } -- (void)setGroupMemberInfo:(OIMGroupMemberInfo *)groupMemberInfo +- (void)setGroupMemberInfo:(OIMSetGroupMemberInfo *)groupMemberInfo onSuccess:(nullable OIMSuccessCallback)onSuccess onFailure:(nullable OIMFailureCallback)onFailure { CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure]; @@ -285,9 +291,11 @@ - (void)setGroupVerification:(NSString *)groupID needVerification:(OIMGroupVerificationType)needVerification onSuccess:(OIMSuccessCallback)onSuccess onFailure:(OIMFailureCallback)onFailure { - CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure]; + OIMGroupInfo *info = [OIMGroupInfo new]; + info.groupID = groupID; + info.needVerification = needVerification; - Open_im_sdkSetGroupVerification(callback, [self operationId], groupID, (int32_t)needVerification); + [self setGroupInfo:info onSuccess:onSuccess onFailure:onFailure]; } - (void)getGroupMemberOwnerAndAdmin:(NSString *)groupID @@ -308,18 +316,22 @@ - (void)setGroupApplyMemberFriend:(NSString *)groupID onSuccess:(nullable OIMSuccessCallback)onSuccess onFailure:(nullable OIMFailureCallback)onFailure { - CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure]; + OIMGroupInfo *info = [OIMGroupInfo new]; + info.groupID = groupID; + info.applyMemberFriend = rule; - Open_im_sdkSetGroupApplyMemberFriend(callback, [self operationId], groupID, rule); + [self setGroupInfo:info onSuccess:onSuccess onFailure:onFailure]; } - (void)setGroupLookMemberInfo:(NSString *)groupID rule:(int32_t)rule onSuccess:(nullable OIMSuccessCallback)onSuccess onFailure:(nullable OIMFailureCallback)onFailure { - CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure]; + OIMGroupInfo *info = [OIMGroupInfo new]; + info.groupID = groupID; + info.applyMemberFriend = rule; - Open_im_sdkSetGroupLookMemberInfo(callback, [self operationId], groupID, rule); + [self setGroupInfo:info onSuccess:onSuccess onFailure:onFailure]; } - (void)searchGroupMembers:(OIMSearchParam *)searchParam diff --git a/OpenIMSDK/Interface/OIMManager+Message.h b/OpenIMSDK/Interface/OIMManager+Message.h index d12e16d..29d32f2 100644 --- a/OpenIMSDK/Interface/OIMManager+Message.h +++ b/OpenIMSDK/Interface/OIMManager+Message.h @@ -425,7 +425,7 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)setGlobalRecvMessageOpt:(OIMReceiveMessageOpt)opt onSuccess:(nullable OIMSuccessCallback)onSuccess - onFailure:(nullable OIMFailureCallback)onFailure; + onFailure:(nullable OIMFailureCallback)onFailure __attribute__((deprecated("Use OIMManager+User: setSelfInfo instead"))); /** * Advanced Message Series Usage diff --git a/OpenIMSDK/Interface/OIMManager+Message.m b/OpenIMSDK/Interface/OIMManager+Message.m index 1a9398e..18539e9 100644 --- a/OpenIMSDK/Interface/OIMManager+Message.m +++ b/OpenIMSDK/Interface/OIMManager+Message.m @@ -444,9 +444,7 @@ - (void)uploadFile:(NSString *)fullPath - (void)setGlobalRecvMessageOpt:(OIMReceiveMessageOpt)opt onSuccess:(OIMSuccessCallback)onSuccess onFailure:(OIMFailureCallback)onFailure { - CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure]; - Open_im_sdkSetGlobalRecvMessageOpt(callback, [self operationId], opt); } - (void)getAdvancedHistoryMessageList:(OIMGetAdvancedHistoryMessageListParam *)opts diff --git a/OpenIMSDK/Interface/OIMManager+User.h b/OpenIMSDK/Interface/OIMManager+User.h index 62819ee..67a00e9 100644 --- a/OpenIMSDK/Interface/OIMManager+User.h +++ b/OpenIMSDK/Interface/OIMManager+User.h @@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN * @param uids List of user IDs */ - (void)getUsersInfo:(NSArray *)uids - onSuccess:(nullable OIMFullUsersInfoCallback)onSuccess + onSuccess:(nullable OIMPublicUsersInfoCallback)onSuccess onFailure:(nullable OIMFailureCallback)onFailure; /** @@ -74,13 +74,16 @@ NS_ASSUME_NONNULL_BEGIN - (void)getUsersInfoWithCache:(NSArray *)userIDs groupID:(NSString * _Nullable)groupID - onSuccess:(nullable OIMFullUsersInfoCallback)onSuccess - onFailure:(nullable OIMFailureCallback)onFailure; -/* -- (void)setSelfInfoEx:(OIMUserInfo *)userInfo - onSuccess:(nullable OIMSuccessCallback)onSuccess - onFailure:(nullable OIMFailureCallback)onFailure; - */ + onSuccess:(nullable OIMPublicUsersInfoCallback)onSuccess + onFailure:(nullable OIMFailureCallback)onFailure __attribute__((deprecated("Use getUsersInfo instead"))); + + +/// Global Do Not Disturb +/// [status] 0: Normal; 1: Do not accept messages; 2: Accept online messages but not offline messages; +- (void)setGlobalRecvMessageOpt:(NSInteger )status + onSuccess:(nullable OIMSuccessCallback)onSuccess + onFailure:(nullable OIMFailureCallback)onFailure; + @end NS_ASSUME_NONNULL_END diff --git a/OpenIMSDK/Interface/OIMManager+User.m b/OpenIMSDK/Interface/OIMManager+User.m index 9e2abd0..f63167d 100644 --- a/OpenIMSDK/Interface/OIMManager+User.m +++ b/OpenIMSDK/Interface/OIMManager+User.m @@ -11,11 +11,11 @@ @implementation OIMManager (User) - (void)getUsersInfo:(NSArray *)uids - onSuccess:(OIMFullUsersInfoCallback)onSuccess + onSuccess:(OIMPublicUsersInfoCallback)onSuccess onFailure:(OIMFailureCallback)onFailure { CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:^(NSString * _Nullable data) { if (onSuccess) { - onSuccess([OIMFullUserInfo mj_objectArrayWithKeyValuesArray:data]); + onSuccess([OIMPublicUserInfo mj_objectArrayWithKeyValuesArray:data]); } } onFailure:onFailure]; @@ -95,24 +95,23 @@ - (void)getUserStatus:(NSArray *)userIDs - (void)getUsersInfoWithCache:(NSArray *)userIDs groupID:(NSString *)groupID - onSuccess:(nullable OIMFullUsersInfoCallback)onSuccess + onSuccess:(nullable OIMPublicUsersInfoCallback)onSuccess onFailure:(nullable OIMFailureCallback)onFailure { CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:^(NSString * _Nullable data) { if (onSuccess) { - onSuccess([OIMFullUserInfo mj_objectArrayWithKeyValuesArray:data]); + onSuccess([OIMPublicUserInfo mj_objectArrayWithKeyValuesArray:data]); } } onFailure:onFailure]; - Open_im_sdkGetUsersInfoWithCache(callback, [self operationId], userIDs.mj_JSONString, groupID ?: @""); + Open_im_sdkGetUsersInfo(callback, [self operationId], userIDs.mj_JSONString); } -/* -- (void)setSelfInfoEx:(OIMUserInfo *)userInfo - onSuccess:(nullable OIMSuccessCallback)onSuccess - onFailure:(nullable OIMFailureCallback)onFailure { - CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure]; - - Open_im_sdkSetSelfInfoEx(callback, [self operationId], userInfo.mj_JSONString); +- (void)setGlobalRecvMessageOpt:(NSInteger )status + onSuccess:(nullable OIMSuccessCallback)onSuccess + onFailure:(nullable OIMFailureCallback)onFailure { + OIMUserInfo *info = [OIMUserInfo new]; + info.globalRecvMsgOpt = status; + + [self setSelfInfo:info onSuccess:onSuccess onFailure:onFailure]; } - */ @end diff --git a/OpenIMSDK/Model/OIMConversationInfo.h b/OpenIMSDK/Model/OIMConversationInfo.h index 64d3c1e..163e576 100644 --- a/OpenIMSDK/Model/OIMConversationInfo.h +++ b/OpenIMSDK/Model/OIMConversationInfo.h @@ -92,4 +92,36 @@ NS_ASSUME_NONNULL_BEGIN @end +@interface OIMConversationReq : NSObject + +@property (nonatomic, nullable, copy) NSString *userID; + +@property (nonatomic, nullable, copy) NSString *groupID; + +@property (nonatomic, assign) OIMReceiveMessageOpt recvMsgOpt; + +@property (nonatomic, assign) BOOL isPinned; + +@property (nonatomic, assign) OIMGroupAtType groupAtType; + +/** + * Whether private chat (burn after reading) is enabled + */ +@property (nonatomic, assign) BOOL isPrivateChat; +/** + * Private chat duration + */ +@property (nonatomic, assign) NSTimeInterval burnDuration; + +/** + * Whether still in the group, return true if left the group + */ +@property (nonatomic, assign) BOOL isMsgDestruct; + +@property (nonatomic, assign) NSTimeInterval msgDestructTime; + +@property (nonatomic, nullable, copy) NSString *ex; + +@end + NS_ASSUME_NONNULL_END diff --git a/OpenIMSDK/Model/OIMConversationInfo.m b/OpenIMSDK/Model/OIMConversationInfo.m index 5d3b1de..8dd8407 100644 --- a/OpenIMSDK/Model/OIMConversationInfo.m +++ b/OpenIMSDK/Model/OIMConversationInfo.m @@ -22,3 +22,7 @@ @implementation OIMConversationNotDisturbInfo @implementation OIMInputStatusChangedData @end + +@implementation OIMConversationReq + +@end diff --git a/OpenIMSDK/Model/OIMFullUserInfo.h b/OpenIMSDK/Model/OIMFullUserInfo.h index 40320c0..e3faf56 100644 --- a/OpenIMSDK/Model/OIMFullUserInfo.h +++ b/OpenIMSDK/Model/OIMFullUserInfo.h @@ -63,25 +63,4 @@ NS_ASSUME_NONNULL_BEGIN @end -/** - Integrates PublicUserInfo, FriendInfo, and BlackInfo. - When getting user information: - - If it's a friend, publicInfo and friendInfo will be set. - - If it's in the blacklist, publicInfo and blackInfo will be set. - - If it's both a friend and in the blacklist, all three will be set. - - When getting friend information: - - If it's in the blacklist, friendInfo and blackInfo will be set, but publicInfo is not set. - */ -@interface OIMFullUserInfo : NSObject - -@property (nonatomic, nullable, strong) OIMPublicUserInfo *publicInfo; -@property (nonatomic, nullable, strong) OIMFriendInfo *friendInfo; -@property (nonatomic, nullable, strong) OIMBlackInfo *blackInfo; - -@property (nonatomic, copy, readonly) NSString *userID; -@property (nonatomic, copy, readonly) NSString *showName; -@property (nonatomic, copy, readonly) NSString *faceURL; -@end - NS_ASSUME_NONNULL_END diff --git a/OpenIMSDK/Model/OIMFullUserInfo.m b/OpenIMSDK/Model/OIMFullUserInfo.m index 4efb933..3c8118f 100644 --- a/OpenIMSDK/Model/OIMFullUserInfo.m +++ b/OpenIMSDK/Model/OIMFullUserInfo.m @@ -22,49 +22,3 @@ @implementation OIMFriendInfo @implementation OIMSearchFriendsInfo @end - -@implementation OIMFullUserInfo - -- (NSString *)userID { - NSString *userID = self.publicInfo.userID; - - if (userID.length == 0) { - userID = self.friendInfo.userID; - } - - if (userID.length == 0) { - userID = self.blackInfo.userID; - } - - return userID; -} - -- (NSString *)showName { - NSString *name = nil; - - if (self.friendInfo != nil) { - name = self.friendInfo.nickname.length > 0 ? self.friendInfo.nickname : self.friendInfo.userID; - } else if (self.blackInfo != nil) { - name = self.blackInfo.nickname.length > 0 ? self.blackInfo.nickname : self.blackInfo.userID; - } else if (self.publicInfo != nil) { - name = self.publicInfo.nickname.length > 0 ? self.publicInfo.nickname : self.publicInfo.userID; - } - - return name; -} - -- (NSString *)faceURL { - NSString *url = self.publicInfo.faceURL; - - if (url.length == 0) { - url = self.friendInfo.faceURL; - } - - if (url.length == 0) { - url = self.blackInfo.faceURL; - } - - return url; -} - -@end diff --git a/OpenIMSDK/Model/OIMGroupMemberInfo.h b/OpenIMSDK/Model/OIMGroupMemberInfo.h index 48eea77..b45ced1 100644 --- a/OpenIMSDK/Model/OIMGroupMemberInfo.h +++ b/OpenIMSDK/Model/OIMGroupMemberInfo.h @@ -50,4 +50,15 @@ NS_ASSUME_NONNULL_BEGIN @end +@interface OIMSetGroupMemberInfo : NSObject + +@property (nonatomic, nullable, copy) NSString *userID; +@property (nonatomic, nullable, copy) NSString *groupID; +@property (nonatomic, nullable, copy) NSString *nickname; +@property (nonatomic, nullable, copy) NSString *faceURL; +@property (nonatomic, assign) OIMGroupMemberRole roleLevel; +@property (nonatomic, nullable, copy) NSString *ex; + +@end + NS_ASSUME_NONNULL_END diff --git a/OpenIMSDK/Model/OIMGroupMemberInfo.m b/OpenIMSDK/Model/OIMGroupMemberInfo.m index 42e22c6..434c123 100644 --- a/OpenIMSDK/Model/OIMGroupMemberInfo.m +++ b/OpenIMSDK/Model/OIMGroupMemberInfo.m @@ -14,3 +14,7 @@ @implementation OIMGroupMemberBaseInfo @implementation OIMGroupMemberInfo @end + +@implementation OIMSetGroupMemberInfo + +@end diff --git a/OpenIMSDK/Model/OIMUpdateFriendsReq.h b/OpenIMSDK/Model/OIMUpdateFriendsReq.h new file mode 100644 index 0000000..bb2f43f --- /dev/null +++ b/OpenIMSDK/Model/OIMUpdateFriendsReq.h @@ -0,0 +1,19 @@ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface OIMUpdateFriendsReq : NSObject + +@property (nonatomic, nullable, copy) NSString *ownerUserID; + +@property (nonatomic, nullable, copy) NSArray *friendUserIDs; + +@property (nonatomic, nullable, copy) NSString *ex; + +@property (nonatomic, nullable, copy) NSString *remark; + +@property (nonatomic, assign) BOOL isPinned; +@end + +NS_ASSUME_NONNULL_END diff --git a/OpenIMSDK/Model/OIMUpdateFriendsReq.m b/OpenIMSDK/Model/OIMUpdateFriendsReq.m new file mode 100644 index 0000000..b778040 --- /dev/null +++ b/OpenIMSDK/Model/OIMUpdateFriendsReq.m @@ -0,0 +1,6 @@ + +#import "OIMUpdateFriendsReq.h" + +@implementation OIMUpdateFriendsReq + +@end