Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Brett committed Sep 29, 2024
1 parent bafa194 commit 771c1ac
Show file tree
Hide file tree
Showing 23 changed files with 226 additions and 174 deletions.
17 changes: 2 additions & 15 deletions Example/OpenIMSDKiOS/OPENIMSDKViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ - (void)getDesignatedFriendsInfo {
todo:^(void (^callback)(NSNumber *code, NSString *msg)) {

[OIMManager.manager getSpecifiedFriendsInfo:@[OTHER_USER_ID]
filterBlack:NO
onSuccess:^(NSArray<OIMFriendInfo *> * _Nullable friendInfo) {
callback(nil, nil);
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
Expand All @@ -521,7 +522,7 @@ - (void)getFriendList {
[self operate:_cmd
todo:^(void (^callback)(NSNumber *code, NSString *msg)) {

[OIMManager.manager getFriendListWithOnSuccess:^(NSArray<OIMFullUserInfo *> * _Nullable userInfos) {
[OIMManager.manager getFriendListWithFilterBlack:NO onSuccess:^(NSArray<OIMPublicUserInfo *> * _Nullable userInfos) {
callback(nil, nil);
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
callback(@(code), msg);
Expand Down Expand Up @@ -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<OIMConversationNotDisturbInfo *> * _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)) {
Expand Down
4 changes: 2 additions & 2 deletions OpenIMSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
6 changes: 3 additions & 3 deletions OpenIMSDK/Callbacker/OIMCallbacker.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ typedef void (^OIMSimpleResultsCallback)(NSArray <OIMSimpleResultInfo *> * _Null

typedef void (^OIMUserInfoCallback)(OIMUserInfo * _Nullable userInfo);
typedef void (^OIMUsersInfoCallback)(NSArray <OIMUserInfo *> * _Nullable usersInfo);
typedef void (^OIMUsersCallback)(NSArray <OIMFullUserInfo *> * _Nullable userInfos);
typedef void (^OIMFullUserInfoCallback)(OIMFullUserInfo * _Nullable userInfo);
typedef void (^OIMFullUsersInfoCallback)(NSArray <OIMFullUserInfo *> * _Nullable userInfos);
typedef void (^OIMUsersCallback)(NSArray <OIMPublicUserInfo *> * _Nullable userInfos);
typedef void (^OIMPublicUserInfoCallback)(OIMPublicUserInfo * _Nullable userInfo);
typedef void (^OIMPublicUsersInfoCallback)(NSArray <OIMPublicUserInfo *> * _Nullable userInfos);
typedef void (^OIMBlacksInfoCallback)(NSArray <OIMBlackInfo *> * _Nullable blackInfos);
typedef void (^OIMUserStatusInfoCallback)(OIMUserStatusInfo * _Nullable statusInfo);
typedef void (^OIMUserStatusInfosCallback)(NSArray <OIMUserStatusInfo *> * _Nullable statusInfos);
Expand Down
15 changes: 15 additions & 0 deletions OpenIMSDK/Callbacker/OIMCallbacker.m
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion OpenIMSDK/Interface/OIMManager+Connection.m
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down
12 changes: 5 additions & 7 deletions OpenIMSDK/Interface/OIMManager+Conversation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <NSString *> *)conversationIDs
onSuccess:(nullable OIMConversationNotDisturbInfoCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;

/**
* Set the "do not disturb" status for a conversation
*/
Expand Down Expand Up @@ -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
54 changes: 29 additions & 25 deletions OpenIMSDK/Interface/OIMManager+Conversation.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#import "OIMManager+Conversation.h"
#import "CallbackProxy.h"
#import "OIMConversationInfo.h"

@implementation OIMManager (Conversation)

Expand Down Expand Up @@ -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
Expand All @@ -114,51 +116,43 @@ - (void)getTotalUnreadMsgCountWithOnSuccess:(OIMNumberCallback)onSuccess
Open_im_sdkGetTotalUnreadMsgCount(callback, [self operationId]);
}

- (void)getConversationRecvMessageOpt:(NSArray<NSString *> *)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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
15 changes: 12 additions & 3 deletions OpenIMSDK/Interface/OIMManager+Friend.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

#import "OIMManager.h"
#import "OIMUpdateFriendsReq.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -87,18 +88,21 @@ NS_ASSUME_NONNULL_BEGIN
* @param usersID List of user IDs
*/
- (void)getSpecifiedFriendsInfo:(NSArray <NSString *> *)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;

/**
Expand Down Expand Up @@ -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
48 changes: 33 additions & 15 deletions OpenIMSDK/Interface/OIMManager+Friend.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,41 +98,44 @@ - (void)removeFromBlackList:(NSString *)userID
Open_im_sdkRemoveBlack(callback, [self operationId], userID);
}

- (void)getSpecifiedFriendsInfo:(NSArray<NSString *> *)usersID
onSuccess:(OIMFullUsersInfoCallback)onSuccess
onFailure:(OIMFailureCallback)onFailure {
- (void)getSpecifiedFriendsInfo:(NSArray <NSString *> *)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<NSString *> *)usersID
Expand All @@ -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
Expand Down Expand Up @@ -185,6 +191,18 @@ - (void)setFriendsEx:(NSArray<NSString *> *)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
2 changes: 1 addition & 1 deletion OpenIMSDK/Interface/OIMManager+Group.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading

0 comments on commit 771c1ac

Please sign in to comment.