BMXGroupManager Protocol Reference
Conforms to NSObject
Declared in BMXGroupManager.h
Instance Methods
acceptApplicationByGroup:applicantId:completion:
接受入群申请
- (void)acceptApplicationByGroup:(BMXGroup *)*group* applicantId:(long long)*applicantId* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
接受入群申请
Declared In
BMXGroupManager.h
-(void) touchedActionWithRet:(BOOL) ret atIndex:(NSInteger) index {
BMXGroupApplication* application = [self.applicationArray objectAtIndex:index];
if(ret) { //同意
[[[BMXClient sharedClient] groupService] acceptApplicationByGroup:self.group applicantId:application.applicationId completion:^(BMXError *error) {
acceptInvitationByGroup:inviter:completion:
接受入群邀请
- (void)acceptInvitationByGroup:(BMXGroup *)*group* inviter:(long long)*inviter* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
接受入群邀请
Declared In
BMXGroupManager.h
addAdmins:admins:message:completion:
添加管理员
- (void)addAdmins:(BMXGroup *)*group* admins:(NSArray<NSNumber*> *)*admins* message:(NSString *)*message* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Parameters
group
BMXGroup
admins
Array:id
message
String
aCompletionBlock
BMXError
Discussion
添加管理员
Declared In
BMXGroupManager.h
-(void) dealWithMembersWithSection:(NSInteger) section Row:(NSInteger) row
{
if(section == 0) {// 取消管理
NSString* uid = [self.adminUidArray objectAtIndex:row];
NSNumber *uidnumber = [NSNumber numberWithLongLong:[uid longLongValue]];
[[[BMXClient sharedClient] groupService] removeAdmins:self.group admins:@[uidnumber] reason:NSLocalizedString(@"Add_admin", @"添加管理") completion:^(BMXError *error) {
if(!error) {
[self.adminUidArray removeObject:uid];
[self.normalUidArray addObject:uid];
[self.tableView reloadData];
}else {
MAXLog(@"error : %ld", error.errorCode);
}
}];
}else { //添加管理
NSNumber* uid = [NSNumber numberWithLongLong:[[self.normalUidArray objectAtIndex:row] longLongValue]];
[[[BMXClient sharedClient] groupService] addAdmins:self.group admins:@[uid] message:NSLocalizedString(@"Cancellation_management", @"取消管理") completion:^(BMXError *error) {
- (void)addAdminsId:(NSArray*)adminsId message:(NSString *)message {
[[[BMXClient sharedClient] groupService] addAdmins:self.group admins:adminsId message:message completion:^(BMXError *error) {
addDelegate:
- (void)addDelegate:(id<BMXGroupServiceProtocol>)*aDelegate*
- (void)registerAPNs {
[[[BMXClient sharedClient] pushService] start];
[[[BMXClient sharedClient] pushService] addDelegate:self];
- (void)viewDidLoad {
[super viewDidLoad];
[self configCollectionView];
self.view.clipsToBounds = YES;
[[[BMXClient sharedClient] chatService] addDelegate:self];
- (void)addIMListener {
BMXClient *client = [BMXClient sharedClient];
[[client rosterService] addDelegate:self];
- (void)addIMListener {
BMXClient *client = [BMXClient sharedClient];
[[client rosterService] addDelegate:self];
[[client chatService] addDelegate:self];
- (void)addIMListener {
BMXClient *client = [BMXClient sharedClient];
[[client rosterService] addDelegate:self];
[[client chatService] addDelegate:self];
[[client userService] addDelegate:self];
- (void)addIMListener {
BMXClient *client = [BMXClient sharedClient];
[[client rosterService] addDelegate:self];
[[client chatService] addDelegate:self];
[[client userService] addDelegate:self];
[[client groupService] addDelegate:self];
addDelegate:delegateQueue:
- (void)addDelegate:(id<BMXGroupServiceProtocol>)*aDelegate* delegateQueue:(dispatch_queue_t)*aQueue*
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
self.automaticallyAdjustsScrollViewInsets = NO;
self.account = [IMAcountInfoStorage loadObject];
[self getMyProfile];
[self setUpNavItem];
[self setupSubview];
[self loadMessages];
[self scrollToBottomAnimated:NO refresh:NO];
[[[BMXClient sharedClient] chatService] addDelegate:self delegateQueue:dispatch_get_main_queue()];
addGroupListener:
添加群组变化监听者
- (void)addGroupListener:(id<BMXGroupServiceProtocol>)*listener*
Discussion
添加群组变化监听者
Declared In
BMXGroupManager.h
addMembersToGroup:memberIdlist:message:completion:
添加群成员
- (void)addMembersToGroup:(BMXGroup *)*group* memberIdlist:(NSArray<NSNumber*> *)*memberIdlist* message:(NSString *)*message* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Parameters
group
BMXGroup
memberIdlist
id数组
message
添加信息
aCompletionBlock
BMXError
Discussion
添加群成员
Declared In
BMXGroupManager.h
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Confirm", @"确定") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
UITextField* tfield = alertController.textFields.firstObject;
NSString* message = tfield.text;
[[[BMXClient sharedClient] groupService] addMembersToGroup:self.group memberIdlist:ids message:message completion:^(BMXError *error) {
- (void)addMembersWithmembersId:(NSArray*)membersId message:(NSString *)message {
[[[BMXClient sharedClient] groupService] addMembersToGroup:self.group memberIdlist:membersId message:message completion:^(BMXError *error) {
banGroup:duration:completion:
全员禁言
- (void)banGroup:(BMXGroup *)*group* duration:(long long)*duration* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
全员禁言
Declared In
BMXGroupManager.h
- (void)p_configBanGroup {
void(^aCompletionBlock)(BMXError *error) =^(BMXError *error) {
if (error == nil) {
MAXLog(@"设置成功");
[HQCustomToast showDialog:NSLocalizedString(@"Set_successfully", @"设置成功")];
[self.tableView reloadData];
} else {
[HQCustomToast showDialog:error.errorMessage];
}
};
if (self.isGroupBanned){
[[[BMXClient sharedClient] groupService] unbanGroup:self.group completion:aCompletionBlock];
}else{
[[[BMXClient sharedClient] groupService] banGroup:self.group duration:600 completion:aCompletionBlock];
banMembers:group:reason:duration:completion:
禁言
- (void)banMembers:(NSArray<NSNumber*> *)*members* group:(BMXGroup *)*group* reason:(NSString *)*reason* duration:(long long)*duration* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
禁言
Declared In
BMXGroupManager.h
UIAlertAction* okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Confirm", @"确定") style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
BMXRoster* roster = [self.memberList objectAtIndex:index];
NSNumber* rosterId = [NSNumber numberWithLongLong:roster.rosterId];
NSString* muteDurationStr = [alert.textFields objectAtIndex:0].text;
NSInteger duration = [muteDurationStr longLongValue];
[[[BMXClient sharedClient] groupService] banMembers:@[rosterId] group:self.group reason:NSLocalizedString(@"Ban", @"禁言") duration:duration completion:^(BMXError *error) {
blockMembers:members:completion:
添加黑名单
- (void)blockMembers:(BMXGroup *)*group* members:(NSArray<NSNumber*> *)*members* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
添加黑名单
Declared In
BMXGroupManager.h
UIAlertAction* okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Confirm", @"确定") style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
BMXRoster* roster = [self.memberList objectAtIndex:index];
NSNumber *rosterId = [NSNumber numberWithLongLong:roster.rosterId];
[[[BMXClient sharedClient] groupService] blockMembers:self.group members:@[rosterId] completion:^(BMXError *error) {
creatGroupWithCreateGroupOption:completion:
创建群
- (void)creatGroupWithCreateGroupOption:(BMXCreatGroupOption *)*option* completion:(void ( ^ ) ( BMXGroup *group , BMXError *error ))*aCompletionBlock*
Parameters
option
BMXCreatGroupOption
aCompletionBlock
Group info ,Error
Discussion
创建群
Declared In
BMXGroupManager.h
[[GroupCreateAlertView alloc] initWithFrame:CGRectZero Text:NSLocalizedString(@"Create_message", @"创建信息") OK:^(NSString *title, NSString *description, NSString *message, BOOL isChatroom) {
BMXCreatGroupOption *option = [[BMXCreatGroupOption alloc] initWithGroupName:title groupDescription:description isPublic:YES];
option.message = message;
option.members = ids;
option.isChatroom = isChatroom;
[[[BMXClient sharedClient] groupService] creatGroupWithCreateGroupOption:option completion:^(BMXGroup *group, BMXError *error) {
declineApplicationByGroup:applicantId:completion:
拒绝入群申请
- (void)declineApplicationByGroup:(BMXGroup *)*group* applicantId:(long long)*applicantId* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
拒绝入群申请
Declared In
BMXGroupManager.h
-(void) touchedActionWithRet:(BOOL) ret atIndex:(NSInteger) index {
BMXGroupApplication* application = [self.applicationArray objectAtIndex:index];
if(ret) { //同意
[[[BMXClient sharedClient] groupService] acceptApplicationByGroup:self.group applicantId:application.applicationId completion:^(BMXError *error) {
MAXLog(@"同意成功...");
if (!error) {
[self getApplyList];
[[NSNotificationCenter defaultCenter] postNotificationName:@"KEY_NOTIFICATION_GROUP_MEMBER_UPDATED" object:nil];
}
}];
}else {
[[[BMXClient sharedClient] groupService] declineApplicationByGroup:self.group applicantId:application.applicationId completion:^(BMXError *error) {
declineInvitationByGroup:inviter:completion:
拒绝入群邀请
- (void)declineInvitationByGroup:(BMXGroup *)*group* inviter:(long long)*inviter* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
拒绝入群邀请
Declared In
BMXGroupManager.h
deleteAnnouncementWithGroup:announcementId:completion:
删除群公告
- (void)deleteAnnouncementWithGroup:(BMXGroup *)*group* announcementId:(long long)*announcementId* completion:(void ( ^ ) ( BMXGroup *group , BMXError *error ))*aCompletionBlock*
Discussion
删除群公告
Declared In
BMXGroupManager.h
destroyGroup:completion:
销毁群(群主权限)
- (void)destroyGroup:(BMXGroup *)*group* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Parameters
group
BMXGroup
aCompletionBlock
Error
Discussion
销毁群(群主权限)
Declared In
BMXGroupManager.h
- (void) destroyGroup {
[[[BMXClient sharedClient] groupService] destroyGroup:self.group completion:^(BMXError *error) {
- (void)destroyGroupWithGroup:(BMXGroup *)group {
[[[BMXClient sharedClient] groupService] destroyGroup:group completion:^(BMXError *error) {
- (void)destroyGroupWithGroup:(BMXGroup *)group {
[[[BMXClient sharedClient] groupService] destroyGroup:group completion:^(BMXError *error) {
downloadAvatarWithGroup:progress:completion:
下载群头像
- (void)downloadAvatarWithGroup:(BMXGroup *)*group* progress:(void ( ^ ) ( int progress , BMXError *error ))*aProgress* completion:(void ( ^ ) ( BMXGroup *resultGroup , BMXError *error ))*aCompletion*
Discussion
下载群头像
Declared In
BMXGroupManager.h
- (void)configGrouopCodeAndContent {
self.idLabel.text = [NSString stringWithFormat:@"id : %lld", self.group.groupId];
self.nameLabel.text = [NSString stringWithFormat:NSLocalizedString(@"Nickname_name", @"昵称 : %@"), self.group.name];
self.avatarImageView.image = [UIImage imageNamed:@"group_placeHo"];
if ([[NSFileManager defaultManager] fileExistsAtPath:self.group.avatarThumbnailPath]) {
UIImage *avarat = [UIImage imageWithContentsOfFile:self.group.avatarThumbnailPath];
self.avatarImageView.image = avarat;
} else {
[[[BMXClient sharedClient] groupService] downloadAvatarWithGroup:self.group progress:^(int progress, BMXError *error) {
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
[self setupSubview];
self.avatarImageview.image = [UIImage imageNamed:@"contact_placeholder"];
self.nameLabel.text = self.group.name;
[self setNavigationBarTitle:NSLocalizedString(@"Join_group", @"加入群") navLeftButtonIcon:@"blackback"];
UIImage *avarat = [UIImage imageWithContentsOfFile:self.group.avatarThumbnailPath];
if (avarat) {
self.avatarImageview.image = avarat;
}else {
[[[BMXClient sharedClient] groupService] downloadAvatarWithGroup:self.group progress:^(int progress, BMXError *error) {
-(UITableViewCell*) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger row = indexPath.row;
GroupCommonCell* cell = [tableView dequeueReusableCellWithIdentifier:@"GroupCommonCell"];
if(cell == nil) {
cell = [[GroupCommonCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"GroupCommonCell"];
}
NSString* tableTitle = [_tableTitleArray objectAtIndex:row];
if (row == 0) {
[cell setMainText:tableTitle detailText:@"" switcherFlag:NO switcherTarget:nil switcherSelector:nil];
[cell showAccesor:YES];
[cell.avatarImageView setHidden:NO];
if (self.group.avatarThumbnailPath > 0 && [[NSFileManager defaultManager] fileExistsAtPath:self.group.avatarThumbnailPath]) {
cell.avatarImageView.image = [UIImage imageWithContentsOfFile:self.group.avatarThumbnailPath];
}else {
[[[BMXClient sharedClient] groupService] downloadAvatarWithGroup:self.group progress:^(int progress, BMXError *error) {
- (void)refreshByGroup:(BMXGroup *)group {
self.avatarImg.image = [UIImage imageNamed:@"group_placeHo"];
self.nicknameLabel.text = group.name;
if (group.avatarThumbnailPath > 0 && [[NSFileManager defaultManager] fileExistsAtPath:group.avatarThumbnailPath]) {
self.avatarImg.image = [UIImage imageWithContentsOfFile:group.avatarThumbnailPath];
}else {
[[[BMXClient sharedClient] groupService] downloadAvatarWithGroup:group progress:^(int progress, BMXError *error) {
cell.titleLabel.text = group.name != nil ? group.name : NSLocalizedString(@"No_name_for_now", @"暂无名字");
cell.avatarImageView.image = [UIImage imageNamed:@"group_placeHo"];
if (group.avatarThumbnailPath > 0 && [[NSFileManager defaultManager] fileExistsAtPath:group.avatarThumbnailPath]) {
dispatch_async(dispatch_get_main_queue(), ^{
cell.avatarImageView.image = [UIImage imageWithContentsOfFile:group.avatarThumbnailPath];
});
// MAXLog(@"group:%@", group.avatarThumbnailPath);
}else {
[[[BMXClient sharedClient] groupService] downloadAvatarWithGroup:group progress:^(int progress, BMXError *error) {
downloadSharedFileFromGroup:shareFile:progress:completion:
下载群共享文件
- (void)downloadSharedFileFromGroup:(BMXGroup *)*group* shareFile:(BMXGroupSharedFile *)*shareFile* progress:(void ( ^ ) ( int progress , BMXError *error ))*aProgress* completion:(void ( ^ ) ( BMXGroup *resultGroup , BMXError *error ))*aCompletion*
Discussion
下载群共享文件
Declared In
BMXGroupManager.h
editGroupAnnouncement:title:content:completion:
设置群公告
- (void)editGroupAnnouncement:(BMXGroup *)*group* title:(NSString *)*title* content:(NSString *)*content* completion:(void ( ^ ) ( BMXGroup *group , BMXError *error ))*aCompletionBlock*
Discussion
设置群公告
Declared In
BMXGroupManager.h
- (void)touchedRightBar {
MAXLog(@"发布群公告...");
[[[BMXClient sharedClient] groupService] editGroupAnnouncement:self.group title:_titleField.text content:_textView.text completion:^(BMXGroup *group, BMXError *error) {
getAdmins:forceRefresh:completion:
获取Admins列表,如果设置了forceRefresh则从服务器拉取
- (void)getAdmins:(BMXGroup *)*group* forceRefresh:(BOOL)*forceRefresh* completion:(void ( ^ ) ( NSArray<BMXGroupMember*> *, BMXError *error ))*aCompletionBlock*
Discussion
获取Admins列表,如果设置了forceRefresh则从服务器拉取
Declared In
BMXGroupManager.h
-(void) getManageList
{
[[[BMXClient sharedClient] groupService] getAdmins:self.group forceRefresh:YES completion:^(NSArray<BMXGroupMember *> *adminList, BMXError *error) {
-(void) getAdminList
{
[[[BMXClient sharedClient] groupService] getAdmins:self.group forceRefresh:YES completion:^(NSArray<BMXGroupMember *> *groupMembers, BMXError *error) {
-(void) getManageList // 管理员不能被操作.
{
[[[BMXClient sharedClient] groupService] getAdmins:self.group forceRefresh:YES completion:^(NSArray<BMXGroupMember *> *adminList, BMXError *error) {
-(void) getAdminList
{
[[[BMXClient sharedClient] groupService] getAdmins:self.group forceRefresh:NO completion:^(NSArray<BMXGroupMember *> *groupMembers, BMXError *error) {
getAnnouncementListWithGroup:forceRefresh:completion:
获取群公告列表
- (void)getAnnouncementListWithGroup:(BMXGroup *)*group* forceRefresh:(BOOL)*forceRefresh* completion:(void ( ^ ) ( NSArray *annoucmentArray , BMXError *error ))*aCompletionBlock*
Discussion
获取群公告列表
Declared In
BMXGroupManager.h
- (void)getAnnoument {
[[[BMXClient sharedClient] groupService] getAnnouncementListWithGroup:self.group forceRefresh:YES completion:^(NSArray *annoucmentArray, BMXError *error) {
getApplicationListByCursor:pageSize:completion:
分页获取群组申请列表
- (void)getApplicationListByCursor:(NSString *)*cursor* pageSize:(int)*pageSize* completion:(void ( ^ ) ( NSArray *applicationList , NSString *cursor , long long offset , BMXError *error ))*aCompletionBlock*
Discussion
分页获取群组申请列表
Declared In
BMXGroupManager.h
- (void) getApplyList {
[[[BMXClient sharedClient] groupService] getApplicationListByCursor:@"" pageSize:100 completion:^(NSArray *applicationList, NSString *cursor, long long offset, BMXError *error) {
getBannedMembersByGroup:completion:
获取禁言列表
- (void)getBannedMembersByGroup:(BMXGroup *)*group* completion:(void ( ^ ) ( NSArray<BMXGroupBannedMember*> *bannedMemberList , BMXError *error ))*aCompletionBlock*
Discussion
获取禁言列表
Declared In
BMXGroupManager.h
- (void)getMuteList {
[[[BMXClient sharedClient] groupService] getBannedMembersByGroup:self.group completion:^(NSArray<BMXGroupBannedMember *> *muteMemberList, BMXError *error) {
getBlockList:cursor:pageSize:completion:
分页获取黑名单
- (void)getBlockList:(BMXGroup *)*group* cursor:(NSString *)*cursor* pageSize:(int)*pageSize* completion:(void ( ^ ) ( NSArray *memberList , NSString *cursor , long long offset , BMXError *error ))*aCompletionBlock*
Parameters
cursor
string
pageSize
int
aCompletionBlock
NSArray
Discussion
分页获取黑名单
Declared In
BMXGroupManager.h
getBlockListByGroup:forceRefresh:completion:
获取黑名单
- (void)getBlockListByGroup:(BMXGroup *)*group* forceRefresh:(BOOL)*forceRefresh* completion:(void ( ^ ) ( NSArray<BMXGroupMember*> *, BMXError *error ))*aCompletionBlock*
Discussion
获取黑名单
Declared In
BMXGroupManager.h
- (void)getBlackList {
[[[BMXClient sharedClient] groupService] getBlockListByGroup:self.group forceRefresh:YES completion:^(NSArray<BMXGroupMember *> *blockList, BMXError *error) {
getGroupByName:completion:
通过群名称查询本地群信息,从本地数据库中通过群名称查询获取群组
- (void)getGroupByName:(NSString *)*name* completion:(void ( ^ ) ( NSArray *groupList , BMXError *error ))*aCompletionBlock*
Parameters
name
查询的群名称关键字
aCompletionBlock
搜索结果返回的群列表信息,BMXErrorCode
Discussion
通过群名称查询本地群信息,从本地数据库中通过群名称查询获取群组
Declared In
BMXGroupManager.h
getGroupInfoByGroupId:forceRefresh:completion:
获取群信息
- (void)getGroupInfoByGroupId:(long long)*groupId* forceRefresh:(BOOL)*forceRefresh* completion:(void ( ^ ) ( BMXGroup *group , BMXError *error ))*aCompletionBlock*
Parameters
groupId
群id
forceRefresh
如果设置了forceRefresh则从服务器拉取
aCompletionBlock
群
Discussion
获取群信息
Declared In
BMXGroupManager.h
- (void)getGroupDetailInfo {
[[[BMXClient sharedClient] groupService] getGroupInfoByGroupId:self.group.groupId forceRefresh:YES completion:^(BMXGroup *group, BMXError *error) {
}else {
// 获取不到资料时,新建一个对象占位
[tempProfileArray addObject:NSLocalizedString(@"Unable_to_access_profile", @"无法获取资料")];
}
}];
}
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
} else {
[[[BMXClient sharedClient] groupService] getGroupInfoByGroupId:conversation.conversationId forceRefresh:NO completion:^(BMXGroup *group, BMXError *error) {
- (void)searcGroupById:(NSInteger)groupId WithInfo:(NSString *)info{
[HQCustomToast showWating];
[[[BMXClient sharedClient] groupService] getGroupInfoByGroupId:groupId forceRefresh:YES completion:^(BMXGroup *group, BMXError *error) {
dispatch_async(queue, ^{
if (messageObjc.messageType == BMXMessageTypeSingle) {
IMAcount *im = [IMAcountInfoStorage loadObject];
NSString *fromIdstr = [NSString stringWithFormat:@"%lld", messageObjc.fromId];
NSInteger rosterId = [fromIdstr isEqualToString:im.usedId] ? messageObjc.toId : messageObjc.fromId;
[[[BMXClient sharedClient] rosterService] searchByRosterId:rosterId forceRefresh:NO completion:^(BMXRoster *roster, BMXError *error) {
dispatch_semaphore_signal(semaphore);
if (roster) {
[tempProfileArray addObject:roster];
}
}];
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
}else {
[[[BMXClient sharedClient] groupService] getGroupInfoByGroupId:messageObjc.conversationId forceRefresh:NO completion:^(BMXGroup *group, BMXError *error) {
dispatch_async(queue, ^{
if (messageObjc.messageType == BMXMessageTypeSingle) {
IMAcount *im = [IMAcountInfoStorage loadObject];
NSString *fromIdStr = [NSString stringWithFormat:@"%lld", messageObjc.fromId];
NSInteger rosterId = [fromIdStr isEqualToString:im.usedId] ? messageObjc.toId : messageObjc.fromId;
[[[BMXClient sharedClient] rosterService] searchByRosterId:rosterId forceRefresh:NO completion:^(BMXRoster *roster, BMXError *error) {
dispatch_semaphore_signal(semaphore);
if (roster) {
[tempProfileArray addObject:roster];
}
}];
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
}else {
[[[BMXClient sharedClient] groupService] getGroupInfoByGroupId:messageObjc.conversationId forceRefresh:NO completion:^(BMXGroup *group, BMXError *error) {
getGroupInfoByGroupIdArray:forceRefresh:completion:
获取传入群组id的群组信息列表,如果设置了forceRefresh则从服务器拉取
- (void)getGroupInfoByGroupIdArray:(NSArray<NSNumber*> *)*groupIdArray* forceRefresh:(BOOL)*forceRefresh* completion:(void ( ^ ) ( NSArray *aGroups , BMXError *aError ))*aCompletionBlock*
Discussion
获取传入群组id的群组信息列表,如果设置了forceRefresh则从服务器拉取
Declared In
BMXGroupManager.h
dispatch_group_async(group, dispatch_get_global_queue(0, 0), ^{
dispatch_group_enter(group);
[[[BMXClient sharedClient] rosterService] searchRostersByRosterIdList:rosterIds forceRefresh:NO completion:^(NSArray<BMXRoster *> *rosterList, BMXError *error) {
MAXLog(@"%lu", (unsigned long)rosterList.count);
for (BMXRoster* roster in rosterList) {
[self.rosterInfos setObject:roster forKey:[NSString stringWithFormat:@"%lld", roster.rosterId]];
}
dispatch_group_leave(group);
}];
// // 下面是群的。。。。
dispatch_group_enter(group);
[[[BMXClient sharedClient] groupService] getGroupInfoByGroupIdArray:gids forceRefresh:NO completion:^(NSArray *aGroups, BMXError *aError) {
getGroupListForceRefresh:completion:
获取群组列表
- (void)getGroupListForceRefresh:(BOOL)*forceRefresh* completion:(void ( ^ ) ( NSArray *groupList , BMXError *error ))*aCompletionBlock*
Parameters
forceRefresh
如果设置了forceRefresh则从服务器拉取
aCompletionBlock
GroupList, Error
Discussion
获取群组列表
Declared In
BMXGroupManager.h
- (void)getGroupList {
[HQCustomToast showWating];
[[[BMXClient sharedClient] groupService] getGroupListForceRefresh:NO completion:^(NSArray *groupList, BMXError *error) {
+ (void)getGroupListcompletion:(void(^)(NSArray <BMXGroup *>*group, NSString *errmsg))aCompletionBlock {
[[[BMXClient sharedClient] groupService] getGroupListForceRefresh:YES completion:^(NSArray *groupList, BMXError *error) {
- (void)getGroupList {
[HQCustomToast showWating];
[[[BMXClient sharedClient] groupService] getGroupListForceRefresh:NO completion:^(NSArray *groupList, BMXError *error) {
- (void)getGroupList {
[[[BMXClient sharedClient] groupService] getGroupListForceRefresh:YES completion:^(NSArray *groupList, BMXError *error) {
getInvitationListByCursor:pageSize:completion:
分页获取群组邀请列表
- (void)getInvitationListByCursor:(NSString *)*cursor* pageSize:(int)*pageSize* completion:(void ( ^ ) ( NSArray *invitationList , NSString *cursor , long long offset , BMXError *error ))*aCompletionBlock*
Parameters
cursor
string
pageSize
int
aCompletionBlock
NSArray
Discussion
分页获取群组邀请列表
Declared In
BMXGroupManager.h
- (void) getApplyList {
[[[BMXClient sharedClient] groupService] getInvitationListByCursor:@"" pageSize:100 completion:^(NSArray *invitationList, NSString *cursor, long long offset, BMXError *error) {
getLatestAnnouncementWithGroup:forceRefresh:completion:
获取最新的群公告
- (void)getLatestAnnouncementWithGroup:(BMXGroup *)*group* forceRefresh:(BOOL)*forceRefresh* completion:(void ( ^ ) ( BMXGroupAnnounment *groupAnnounment , BMXError *error ))*aCompletionBlock*
Discussion
获取最新的群公告
Declared In
BMXGroupManager.h
getMemberList:cursor:pageSize:completion:
分页获取群成员列表
- (void)getMemberList:(BMXGroup *)*group* cursor:(NSString *)*cursor* pageSize:(int)*pageSize* completion:(void ( ^ ) ( NSArray *memberList , NSString *cursor , long long offset , BMXError *error ))*aCompletionBlock*
Parameters
group
BMXGroup
cursor
String
pageSize
int
aCompletionBlock
NSArray
Discussion
分页获取群成员列表
Declared In
BMXGroupManager.h
getMembers:forceRefresh:completion:
获取群成员列表,
- (void)getMembers:(BMXGroup *)*group* forceRefresh:(BOOL)*forceRefresh* completion:(void ( ^ ) ( NSArray<BMXGroupMember*> *groupList , BMXError *error ))*aCompletionBlock*
Parameters
group
BMXGroup
forceRefresh
如果设置了forceRefresh则从服务器拉取,最多拉取1000人
aCompletionBlock
List:BMXGroupMember ,BMXError
Discussion
获取群成员列表,
Declared In
BMXGroupManager.h
- (void)getMembers {
[[[BMXClient sharedClient] groupService] getMembers:self.group forceRefresh:YES completion:^(NSArray<BMXGroupMember *> *groupList, BMXError *error) {
- (void)getMembers {
[[[BMXClient sharedClient] groupService] getMembers:self.group forceRefresh:YES completion:^(NSArray<BMXGroupMember *> *groupList, BMXError *error) {
- (void)getMembers {
[[[BMXClient sharedClient] groupService] getMembers:self.currentGroup forceRefresh:NO completion:^(NSArray<BMXGroupMember *> *groupList, BMXError *error) {
- (void)getMembers {
[[[BMXClient sharedClient] groupService] getMembers:self.group forceRefresh:YES completion:^(NSArray<BMXGroupMember *> *groupList, BMXError *error) {
- (void)getMembers {
[[[BMXClient sharedClient] groupService] getMembers:self.group forceRefresh:YES completion:^(NSArray<BMXGroupMember *> *groupList, BMXError *error) {
- (void)getMembers {
[[[BMXClient sharedClient] groupService] getMembers:self.group forceRefresh:YES completion:^(NSArray<BMXGroupMember *> *groupList, BMXError *error) {
getMembersNickName:memberIdlist:completion:
批量获取群组成员昵称
- (void)getMembersNickName:(BMXGroup *)*group* memberIdlist:(NSArray<NSNumber*> *)*memberIdlist* completion:(void ( ^ ) ( NSArray *aGroupMembers , BMXError *aError ))*aCompletionBlock*
Discussion
批量获取群组成员昵称
Declared In
BMXGroupManager.h
getSharedFilesListByGroup:forceRefresh:completion:
获取群共享文件列表
- (void)getSharedFilesListByGroup:(BMXGroup *)*group* forceRefresh:(BOOL)*forceRefresh* completion:(void ( ^ ) ( NSArray<BMXGroupSharedFile*> *sharedFileList , BMXError *error ))*aCompletionBlock*
Discussion
获取群共享文件列表
Declared In
BMXGroupManager.h
- (void)get {
[[[BMXClient sharedClient ] groupService] getSharedFilesListByGroup:self.group forceRefresh:YES
getbannedMemberListGroup:cursor:pageSize:completion:
分页获取禁言列表
- (void)getbannedMemberListGroup:(BMXGroup *)*group* cursor:(NSString *)*cursor* pageSize:(int)*pageSize* completion:(void ( ^ ) ( NSArray *memberList , NSString *cursor , long long offset , BMXError *error ))*aCompletionBlock*
Parameters
cursor
string
pageSize
int
aCompletionBlock
NSArray
Discussion
分页获取禁言列表
Declared In
BMXGroupManager.h
joinGroup:message:completion:
加入一个群,根据群设置可能需要管理员批准
- (void)joinGroup:(BMXGroup *)*group* message:(NSString *)*message* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Parameters
group
BMXGroup
message
申请信息
aCompletionBlock
Error
Discussion
加入一个群,根据群设置可能需要管理员批准
Declared In
BMXGroupManager.h
leaveGroup:completion:
退出群
- (void)leaveGroup:(BMXGroup *)*group* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Parameters
group
BMXGroup
aCompletionBlock
Error
Discussion
退出群
Declared In
BMXGroupManager.h
- (void)leaveGroup {
[[[BMXClient sharedClient] groupService] leaveGroup:self.group completion:^(BMXError *error) {
loadGroupInfo:completion:
获取群详情,从服务端拉取最新信息
- (void)loadGroupInfo:(BMXGroup *)*group* completion:(void ( ^ ) ( BMXGroup *group , BMXError *error ))*aCompletionBlock*
Parameters
group
BMXGroup
aCompletionBlock
BMXGroup,BMXError
Discussion
获取群详情,从服务端拉取最新信息
Declared In
BMXGroupManager.h
- (void)getGroupDetailInfo {
[[[BMXClient sharedClient] groupService] loadGroupInfo:self.group completion:^(BMXGroup *group, BMXError *error) {
muteMessageByGroup:msgMuteMode:completion:
屏蔽群消息
- (void)muteMessageByGroup:(BMXGroup *)*group* msgMuteMode:(BMXGroupMsgMuteMode)*msgMuteMode* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
屏蔽群消息
Declared In
BMXGroupManager.h
-(void)setMsgMuteModeBy:(BMXGroupMsgMuteMode)mode {
[[[BMXClient sharedClient] groupService] muteMessageByGroup:self.group msgMuteMode:mode completion:^(BMXError *error) {
removeAdmins:admins:reason:completion:
删除管理员
- (void)removeAdmins:(BMXGroup *)*group* admins:(NSArray<NSNumber*> *)*admins* reason:(NSString *)*reason* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Parameters
group
BMXGroup
admins
Array:id
reason
String
aCompletionBlock
BMXError
Discussion
删除管理员
Declared In
BMXGroupManager.h
-(void) dealWithMembersWithSection:(NSInteger) section Row:(NSInteger) row
{
if(section == 0) {// 取消管理
NSString* uid = [self.adminUidArray objectAtIndex:row];
NSNumber *uidnumber = [NSNumber numberWithLongLong:[uid longLongValue]];
[[[BMXClient sharedClient] groupService] removeAdmins:self.group admins:@[uidnumber] reason:NSLocalizedString(@"Add_admin", @"添加管理") completion:^(BMXError *error) {
removeDelegate:
- (void)removeDelegate:(id<BMXGroupServiceProtocol>)*aDelegate*
removeGroupListener:
移除群组变化监听者
- (void)removeGroupListener:(id<BMXGroupServiceProtocol>)*listener*
Discussion
移除群组变化监听者
Declared In
BMXGroupManager.h
removeMembersWithGroup:memberlist:reason:completion:
删除群成员
- (void)removeMembersWithGroup:(BMXGroup *)*group* memberlist:(NSArray<NSNumber*> *)*memberList* reason:(NSString *)*reason* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Parameters
group
BMXGroup
memberList
memberlist
reason
reason
aCompletionBlock
BMXError
Discussion
删除群成员
Declared In
BMXGroupManager.h
- (void)removeMembersWithMembersId:(NSArray*)membersId message:(NSString *)message {
[[[BMXClient sharedClient] groupService] removeMembersWithGroup:self.group memberlist:membersId reason:message completion:^(BMXError *error) {
- (void)deleteR:(BMXRoster *)roster{
NSNumber *s= [NSNumber numberWithLongLong: roster.rosterId];
[[[BMXClient sharedClient] groupService]removeMembersWithGroup:self.group memberlist:@[s] reason:@"" completion:^(BMXError *error) {
removeSharedFileFromGroup:file:completion:
移除群共享文件
- (void)removeSharedFileFromGroup:(BMXGroup *)*group* file:(BMXGroupSharedFile *)*file* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
移除群共享文件
Declared In
BMXGroupManager.h
setAllowMemberModifyWithGroup:enable:completion:
设置是否允许群成员设置群信息
- (void)setAllowMemberModifyWithGroup:(BMXGroup *)*group* enable:(BOOL)*enable* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Parameters
group
进行操作的群组
enable
是否允许操作
aCompletionBlock
BMXError
Discussion
设置是否允许群成员设置群信息
Declared In
BMXGroupManager.h
setAvatarWithGroup:avatarData:progress:completion:
设置群头像
- (void)setAvatarWithGroup:(BMXGroup *)*group* avatarData:(NSData *)*avatarData* progress:(void ( ^ ) ( int progress , BMXError *error ))*aProgress* completion:(void ( ^ ) ( BMXGroup *resultGroup , BMXError *error ))*aCompletion*
Discussion
设置群头像
Declared In
BMXGroupManager.h
[imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
UIImage *image = [photos firstObject];
NSData *imageData = UIImagePNGRepresentation(image);
[[[BMXClient sharedClient] groupService] setAvatarWithGroup:self.group avatarData:imageData progress:^(int progress, BMXError *error) {
setEnableReadAckWithGroup:enable:completion:
设置是否开启群消息已读功能
- (void)setEnableReadAckWithGroup:(BMXGroup *)*group* enable:(BOOL)*enable* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Parameters
group
进行操作的群组
enable
是否开启
aCompletionBlock
BMXError
Discussion
设置是否开启群消息已读功能
Declared In
BMXGroupManager.h
- (void)p_configEnableRecieveAck {
[[[BMXClient sharedClient] groupService] setEnableReadAckWithGroup:self.group enable:!self.group.enableReadAck completion:^(BMXError *error) {
setGroupDescription:description:completion:
设置群描述信息
- (void)setGroupDescription:(BMXGroup *)*group* description:(NSString *)*description* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
设置群描述信息
Declared In
BMXGroupManager.h
setGroupExtensionWithGroup:extension:completion:
设置群扩展信息
- (void)setGroupExtensionWithGroup:(BMXGroup *)*group* extension:(NSString *)*extension* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
设置群扩展信息
Declared In
BMXGroupManager.h
setGroupName:name:completion:
设置群名称
- (void)setGroupName:(BMXGroup *)*group* name:(NSString *)*name* completion:(void ( ^ ) ( BMXGroup *group , BMXError *error ))*aCompletionBlock*
Discussion
设置群名称
Declared In
BMXGroupManager.h
-(void) touchedRightBar {
[[[BMXClient sharedClient] groupService] setGroupName:self.group name:_textField.text completion:^(BMXGroup *group, BMXError *error) {
setHistoryVisibleWithGroup:enable:completion:
设置群成员是否开可见群历史聊天记录
- (void)setHistoryVisibleWithGroup:(BMXGroup *)*group* enable:(BOOL)*enable* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Parameters
group
进行操作的群组
enable
是否开启
aCompletionBlock
BMXError
Discussion
设置群成员是否开可见群历史聊天记录
Declared In
BMXGroupManager.h
setInviteModeWithGroup:mode:completion:
设置邀请模式
- (void)setInviteModeWithGroup:(BMXGroup *)*group* mode:(BMXGroupInviteMode)*inviteMode* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
设置邀请模式
Declared In
BMXGroupManager.h
- (void)invitmodeWith:(BMXGroupInviteMode)mode {
[[[BMXClient sharedClient] groupService] setInviteModeWithGroup:self.group mode:mode completion:^(BMXError *error) {
setJoinAuthModeWithGroup:joinAuthMode:completion:
设置入群审批模式
- (void)setJoinAuthModeWithGroup:(BMXGroup *)*group* joinAuthMode:(BMXGroupJoinAuthMode)*mode* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
设置入群审批模式
Declared In
BMXGroupManager.h
- (void)joinAuthWith:(BMXGroupJoinAuthMode)mode {
[[[BMXClient sharedClient] groupService] setJoinAuthModeWithGroup:self.group joinAuthMode:mode completion:^(BMXError *error) {
setMsgPushModeWithGroup:mode:completion:
设置群消息通知模式
- (void)setMsgPushModeWithGroup:(BMXGroup *)*group* mode:(BMXGroupMsgPushMode)*mode* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
设置群消息通知模式
Declared In
BMXGroupManager.h
- (void)groupNofiyWith:(BMXGroupMsgPushMode)mode {
[[[BMXClient sharedClient] groupService] setMsgPushModeWithGroup:self.group mode:mode completion:^(BMXError *error) {
setMyNicknameWithGroup:nickName:completion:
设置在群里的昵称
- (void)setMyNicknameWithGroup:(BMXGroup *)*group* nickName:(NSString *)*nickName* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
设置在群里的昵称
Declared In
BMXGroupManager.h
handler:^(UIAlertAction * action) {
//响应事件
//得到文本信息
for(UITextField *text in alert.textFields){
MAXLog(@"text = %@", text.text);
[[[BMXClient sharedClient] groupService] setMyNicknameWithGroup:self.group nickName:text.text completion:^(BMXError *error) {
transferOwnerByGroup:newOwnerId:completion:
转移群主
- (void)transferOwnerByGroup:(BMXGroup *)*group* newOwnerId:(long long)*newOwnerId* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
转移群主
Declared In
BMXGroupManager.h
-(void) transferOwner
{
BMXRoster* roster = [self.memberList objectAtIndex:_selectedIndex];
[[[BMXClient sharedClient] groupService] transferOwnerByGroup:self.group newOwnerId:roster.rosterId completion:^(BMXError *error) {
unbanGroup:completion:
解除全员禁言
- (void)unbanGroup:(BMXGroup *)*group* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
解除全员禁言
Declared In
BMXGroupManager.h
- (void)p_configBanGroup {
void(^aCompletionBlock)(BMXError *error) =^(BMXError *error) {
if (error == nil) {
MAXLog(@"设置成功");
[HQCustomToast showDialog:NSLocalizedString(@"Set_successfully", @"设置成功")];
[self.tableView reloadData];
} else {
[HQCustomToast showDialog:error.errorMessage];
}
};
if (self.isGroupBanned){
[[[BMXClient sharedClient] groupService] unbanGroup:self.group completion:aCompletionBlock];
unbanMembersByGroup:members:reason:completion:
解除禁言
- (void)unbanMembersByGroup:(BMXGroup *)*group* members:(NSArray<NSNumber*> *)*members* reason:(NSString *)*reason* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
解除禁言
Declared In
BMXGroupManager.h
-(void) removeMuteListWithIds: (NSArray*) uids
{
[[[BMXClient sharedClient] groupService] unbanMembersByGroup:self.group members:uids reason:@"unmute member" completion:^(BMXError *error) {
unblockMember:members:completion:
从黑名单删除
- (void)unblockMember:(BMXGroup *)*group* members:(NSArray<NSNumber*> *)*members* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
从黑名单删除
Declared In
BMXGroupManager.h
-(void) removeBlackList: (NSArray*) uids
{
[[[BMXClient sharedClient] groupService] unblockMember:self.group members:uids completion:^(BMXError *error) {
uploadSharedFileToGroup:filePathStr:displayName:extionName:progress:completion:
添加群共享文件
- (void)uploadSharedFileToGroup:(BMXGroup *)*group* filePathStr:(NSString *)*filePathStr* displayName:(NSString *)*displayName* extionName:(NSString *)*extionName* progress:(void ( ^ ) ( int progress , BMXError *error ))*aProgress* completion:(void ( ^ ) ( BMXGroup *resultGroup , BMXError *error ))*aCompletion*
Discussion
添加群共享文件
Declared In
BMXGroupManager.h
Example: