Skip to content

Commit

Permalink
[Update] Add API:
Browse files Browse the repository at this point in the history
1. Set the API for global message reception;
2. API to reset session at ID;
3. API related to organizational structure;
4. Set the API at the group member level.
  • Loading branch information
std-s committed Jun 20, 2022
1 parent 39895d3 commit 7af9439
Show file tree
Hide file tree
Showing 23 changed files with 320 additions and 58 deletions.
106 changes: 102 additions & 4 deletions Example/OpenIMSDKiOS/OPENIMSDKViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ - (void)viewDidLoad
@{OIM_LIST_CELL_TITLE: @"更改群成员禁言状态", OIM_LIST_CELL_FUNC: @"changeGroupMemberMute"},
@{OIM_LIST_CELL_TITLE: @"更改群禁言状态", OIM_LIST_CELL_FUNC: @"changeGroupMute"},
@{OIM_LIST_CELL_TITLE: @"搜索群", OIM_LIST_CELL_FUNC: @"searchGroups",},
@{OIM_LIST_CELL_TITLE: @"设置群昵称", OIM_LIST_CELL_FUNC: @"setGroupMemberNickname",}
@{OIM_LIST_CELL_TITLE: @"设置群昵称", OIM_LIST_CELL_FUNC: @"setGroupMemberNickname",},
@{OIM_LIST_CELL_TITLE: @"设置群成员级别", OIM_LIST_CELL_FUNC: @"setGroupMemberRoleLevel",}
],

@[@{OIM_LIST_CELL_TITLE: @"发送消息", OIM_LIST_CELL_FUNC: @"sendMessage"},
Expand All @@ -123,7 +124,8 @@ - (void)viewDidLoad
@{OIM_LIST_CELL_TITLE: @"本地插入消息", OIM_LIST_CELL_FUNC: @"insertSingleMessageToLocalStorage",},
@{OIM_LIST_CELL_TITLE: @"删除本地所有消息", OIM_LIST_CELL_FUNC: @"deleteAllMsgFromLocal",},
@{OIM_LIST_CELL_TITLE: @"删除本地和远端所有消息", OIM_LIST_CELL_FUNC: @"deleteAllMsgFromLocalAndSvr",},
@{OIM_LIST_CELL_TITLE: @"上传多媒体文件", OIM_LIST_CELL_FUNC: @"uploadFile",}
@{OIM_LIST_CELL_TITLE: @"上传多媒体文件", OIM_LIST_CELL_FUNC: @"uploadFile",},
@{OIM_LIST_CELL_TITLE: @"设置全局消息接收情况", OIM_LIST_CELL_FUNC: @"setGlobalRecvMessageOpt",},
],

@[@{OIM_LIST_CELL_TITLE: @"会话列表", OIM_LIST_CELL_FUNC: @"getAllConversationList"},
Expand All @@ -139,12 +141,16 @@ - (void)viewDidLoad
@{OIM_LIST_CELL_TITLE: @"设置免打扰", OIM_LIST_CELL_FUNC: @"setConversationRecvMessageOpt"},
@{OIM_LIST_CELL_TITLE: @"本地插入群消息", OIM_LIST_CELL_FUNC: @"insertGroupMessageToLocalStorage"},
@{OIM_LIST_CELL_TITLE: @"查找本地消息", OIM_LIST_CELL_FUNC: @"searchLocalMessages"},
@{OIM_LIST_CELL_TITLE: @"删除本地所有会话", OIM_LIST_CELL_FUNC: @"deleteAllConversationFromLocal"},],
@{OIM_LIST_CELL_TITLE: @"删除本地所有会话", OIM_LIST_CELL_FUNC: @"deleteAllConversationFromLocal"},
@{OIM_LIST_CELL_TITLE: @"重置会话at标准位", OIM_LIST_CELL_FUNC: @"resetConversationGroupAtType"},],

@[@{OIM_LIST_CELL_TITLE: @"获取子部门列表", OIM_LIST_CELL_FUNC: @"getSubDepartment"},
@{OIM_LIST_CELL_TITLE: @"获取父部门列表", OIM_LIST_CELL_FUNC: @"getParentDepartment"},
@{OIM_LIST_CELL_TITLE: @"获取部门成员信息", OIM_LIST_CELL_FUNC: @"getDepartmentMember"},
@{OIM_LIST_CELL_TITLE: @"获取用户在所有部门信息", OIM_LIST_CELL_FUNC: @"getUserInDepartment"},
@{OIM_LIST_CELL_TITLE: @"获取子部门信息和部门成员信息", OIM_LIST_CELL_FUNC: @"getDepartmentMemberAndSubDepartment"},],
@{OIM_LIST_CELL_TITLE: @"获取子部门信息和部门成员信息", OIM_LIST_CELL_FUNC: @"getDepartmentMemberAndSubDepartment"},
@{OIM_LIST_CELL_TITLE: @"获取部门信息", OIM_LIST_CELL_FUNC: @"getDepartmentInfo"},
@{OIM_LIST_CELL_TITLE: @"搜索组织架构", OIM_LIST_CELL_FUNC: @"searchOrganization"},],
];

UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(hiddenErrorView)];
Expand Down Expand Up @@ -956,6 +962,21 @@ - (void)setGroupMemberNickname {
}];
}

- (void)setGroupMemberRoleLevel {
[self operate:_cmd
todo:^(void (^callback)(NSNumber *code, NSString *msg)) {

[OIMManager.manager setGroupMemberRoleLevel:GROUP_ID
userID:OTHER_USER_ID
roleLevel:OIMGroupMemberRoleAdmin
onSuccess:^(NSString * _Nullable data) {
callback(nil, nil);
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
callback(@(code), msg);
}];
}];
}

#pragma mark -
#pragma mark - Message

Expand Down Expand Up @@ -1233,6 +1254,19 @@ - (void)uploadFile {
}];
}

- (void)setGlobalRecvMessageOpt {
[self operate:_cmd
todo:^(void (^callback)(NSNumber *code, NSString *msg)) {

[OIMManager.manager setGlobalRecvMessageOpt:OIMReceiveMessageOptNotReceive
onSuccess:^(NSString * _Nullable data) {
callback(nil, nil);
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
callback(@(code), msg);
}];
}];
}

#pragma mark -
#pragma mark - conversation

Expand Down Expand Up @@ -1408,6 +1442,20 @@ - (void)deleteAllConversationFromLocal {
}];
}

- (void)resetConversationGroupAtType {
[self operate:_cmd
todo:^(void (^callback)(NSNumber *code, NSString *msg)) {

[OIMManager.manager resetConversationGroupAtType:CONVERSASTION_ID
onSuccess:^(NSString * _Nullable data) {

callback(nil, nil);
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
callback(@(code), msg);
}];
}];
}

#pragma mark -
#pragma mark - Organization

Expand All @@ -1428,6 +1476,23 @@ - (void)getSubDepartment {
}];
}

- (void)getParentDepartment {

[self operate:_cmd
todo:^(void (^callback)(NSNumber *code, NSString *msg)) {

[OIMManager.manager getParentDepartment:@""
offset:0
count:100
onSuccess:^(NSArray<OIMDepartmentInfo *> * _Nullable departmentList) {

callback(nil, nil);
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
callback(@(code), msg);
}];
}];
}

- (void)getDepartmentMember {

[self operate:_cmd
Expand Down Expand Up @@ -1475,4 +1540,37 @@ - (void)getDepartmentMemberAndSubDepartment {
}];
}

- (void)getDepartmentInfo {
[self operate:_cmd
todo:^(void (^callback)(NSNumber *code, NSString *msg)) {

[OIMManager.manager getDepartmentInfo:@""
onSuccess:^(NSArray<OIMDepartmentInfo *> * _Nullable departmentList) {

callback(nil, nil);
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
callback(@(code), msg);
}];
}];
}

- (void)searchOrganization {
[self operate:_cmd
todo:^(void (^callback)(NSNumber *code, NSString *msg)) {

OIMSearchOrganizationParam *param = [OIMSearchOrganizationParam new];
param.keyword = @"";
param.isSearchUserName = YES;

[OIMManager.manager searchOrganization:param
offset:0
count:100
onSuccess:^(OIMDepartmentMemberAndSubInfo * _Nullable items) {
callback(nil, nil);
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
callback(@(code), msg);
}];
}];
}

@end
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 = '2.0.9.2'
s.version = '2.1.0'
s.summary = 'Open-IM-SDK'

# This description is used to generate tags and improve search results.
Expand Down Expand Up @@ -73,6 +73,6 @@ Pod::Spec.new do |s|


s.static_framework = true
s.dependency 'OpenIMSDKCore', '~>2.0.9+4'
s.dependency 'OpenIMSDKCore', '2.1.0'
s.dependency 'MJExtension'
end
20 changes: 13 additions & 7 deletions OpenIMSDK/Callbacker/OIMCallbacker.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,37 +274,42 @@ typedef void (^OIMDepartmentMemberAndSubInfoCallback)(OIMDepartmentMemberAndSubI
/*
* 被邀请者收到:音视频通话邀请
*/
- (void)onReceiveNewInvitation:(OIMSignalingInfo *)invitaion;
- (void)onReceiveNewInvitation:(OIMSignalingInfo *)signalingInfo;

/*
* 邀请者收到:被邀请者同意音视频通话
*/
- (void)onInviteeAccepted:(OIMSignalingInfo *)invitaion;
- (void)onInviteeAccepted:(OIMSignalingInfo *)signalingInfo;

/*
* 邀请者收到:被邀请者拒绝音视频通话
*/
- (void)onInviteeRejected:(OIMSignalingInfo *)invitaion;
- (void)onInviteeRejected:(OIMSignalingInfo *)signalingInfo;

/*
* 被邀请者收到:邀请者取消音视频通话
*/
- (void)onInvitationCancelled:(OIMSignalingInfo *)invitaion;
- (void)onInvitationCancelled:(OIMSignalingInfo *)signalingInfo;

/*
* 邀请者收到:被邀请者超时未接通
*/
- (void)onInvitationTimeout:(OIMSignalingInfo *)invitaion;
- (void)onInvitationTimeout:(OIMSignalingInfo *)signalingInfo;

/*
* 被邀请者(其他端)收到:比如被邀请者在手机拒接,在pc上会收到此回调
*/
- (void)onInviteeRejectedByOtherDevice:(OIMSignalingInfo *)invitaion;
- (void)onInviteeRejectedByOtherDevice:(OIMSignalingInfo *)signalingInfo;

/*
* 被邀请者(其他端)收到:比如被邀请者在手机拒接,在pc上会收到此回调
*/
- (void)onInviteeAcceptedByOtherDevice:(OIMSignalingInfo *)invitaion;
- (void)onInviteeAcceptedByOtherDevice:(OIMSignalingInfo *)signalingInfo;

/*
* 被挂断
*/
- (void)onHunguUp:(OIMSignalingInfo *)signalingInfo;
@end

/// 组织架构
Expand Down Expand Up @@ -446,6 +451,7 @@ Open_im_sdk_callbackOnOrganizationListener
@property (nonatomic, nullable, copy) OIMSignalingInvitationCallback onInvitationTimeout;
@property (nonatomic, nullable, copy) OIMSignalingInvitationCallback onInviteeRejectedByOtherDevice;
@property (nonatomic, nullable, copy) OIMSignalingInvitationCallback onInviteeAcceptedByOtherDevice;
@property (nonatomic, nullable, copy) OIMSignalingInvitationCallback onHunguUp;

- (void)addSignalingListener:(id<OIMSignalingListener>)listener NS_SWIFT_NAME(addSignalingListener(listener:));

Expand Down
12 changes: 12 additions & 0 deletions OpenIMSDK/Callbacker/OIMCallbacker.m
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,18 @@ - (void)onReceiveNewInvitation:(NSString * _Nullable)receiveNewInvitationCallbac
}];
}

- (void)onHangUp:(NSString *)hangUpCallback {
OIMSignalingInfo *info = [OIMSignalingInfo mj_objectWithKeyValues:hangUpCallback];

[self dispatchMainThread:^{
if (self.onHunguUp) {
self.onHunguUp(info);
}

[self.signalingListeners onHunguUp:info];
}];
}

#pragma mark -
#pragma mark - Organization

Expand Down
8 changes: 8 additions & 0 deletions OpenIMSDK/Interface/OIMManager+Conversation.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ NS_ASSUME_NONNULL_BEGIN
isPrivate:(BOOL)isPrivate
onSuccess:(nullable OIMSuccessCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;

/*
* 重置at标准位
*
*/
- (void)resetConversationGroupAtType:(NSString *)conversationID
onSuccess:(nullable OIMSuccessCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
@end

NS_ASSUME_NONNULL_END
8 changes: 8 additions & 0 deletions OpenIMSDK/Interface/OIMManager+Conversation.m
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,12 @@ - (void)setOneConversationPrivateChat:(NSString *)conversationID

Open_im_sdkSetOneConversationPrivateChat(callback, [self operationId], conversationID, isPrivate);
}

- (void)resetConversationGroupAtType:(NSString *)conversationID
onSuccess:(OIMSuccessCallback)onSuccess
onFailure:(OIMFailureCallback)onFailure {
CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure];

Open_im_sdkResetConversationGroupAtType(callback, [self operationId], conversationID);
}
@end
9 changes: 9 additions & 0 deletions OpenIMSDK/Interface/OIMManager+Group.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,15 @@ NS_ASSUME_NONNULL_BEGIN
groupNickname:(NSString * _Nullable)groupNickname
onSuccess:(nullable OIMSuccessCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;

/*
* 设置群成员级别
*/
- (void)setGroupMemberRoleLevel:(NSString *)groupID
userID:(NSString *)userID
roleLevel:(OIMGroupMemberRole)roleLevel
onSuccess:(nullable OIMSuccessCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
@end

NS_ASSUME_NONNULL_END
10 changes: 10 additions & 0 deletions OpenIMSDK/Interface/OIMManager+Group.m
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,14 @@ - (void)setGroupMemberNickname:(NSString *)groupID
Open_im_sdkSetGroupMemberNickname(callback, [self operationId], groupID, userID, groupNickname ?: @"");
}

- (void)setGroupMemberRoleLevel:(NSString *)groupID
userID:(NSString *)userID
roleLevel:(OIMGroupMemberRole)roleLevel
onSuccess:(OIMSuccessCallback)onSuccess
onFailure:(OIMFailureCallback)onFailure {
CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure];

Open_im_sdkSetGroupMemberRoleLevel(callback, [self operationId], groupID, userID, roleLevel);
}

@end
7 changes: 7 additions & 0 deletions OpenIMSDK/Interface/OIMManager+Message.h
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,13 @@ NS_ASSUME_NONNULL_BEGIN
onSuccess:(nullable OIMSuccessCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;

/*
* 全局设置消息提示
*
*/
- (void)setGlobalRecvMessageOpt:(OIMReceiveMessageOpt)opt
onSuccess:(nullable OIMSuccessCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
@end

NS_ASSUME_NONNULL_END
8 changes: 8 additions & 0 deletions OpenIMSDK/Interface/OIMManager+Message.m
Original file line number Diff line number Diff line change
Expand Up @@ -375,4 +375,12 @@ - (void)uploadFileWithFullPath:(NSString *)path
Open_im_sdkUploadFile(callback, [self operationId], path);
}

- (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);
}

@end
21 changes: 19 additions & 2 deletions OpenIMSDK/Interface/OIMManager+Organization.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ NS_ASSUME_NONNULL_BEGIN
offset:(NSInteger)offset
count:(NSInteger)count
onSuccess:(nullable OIMDepartmentInfoCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;;
onFailure:(nullable OIMFailureCallback)onFailure;

// 获取父部门列表
- (void)getParentDepartment:(NSString *)departmentID
offset:(NSInteger)offset
count:(NSInteger)count
onSuccess:(nullable OIMDepartmentInfoCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;

// 获取部门成员信息
- (void)getDepartmentMember:(NSString *)departmentID
Expand All @@ -36,7 +43,17 @@ NS_ASSUME_NONNULL_BEGIN
- (void)getDepartmentMemberAndSubDepartment:(NSString *)departmentID
onSuccess:(nullable OIMDepartmentMemberAndSubInfoCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;

// 获取部门信息
- (void)getDepartmentInfo:(NSString *)departmentID
onSuccess:(nullable OIMDepartmentInfoCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;

// 搜索
- (void)searchOrganization:(OIMSearchOrganizationParam *)param
offset:(NSInteger)offset
count:(NSInteger)count
onSuccess:(nullable OIMDepartmentMemberAndSubInfoCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit 7af9439

Please sign in to comment.