BMXRosterManager Protocol Reference
Conforms to NSObject
Declared in BMXRosterManager.h
Instance Methods
acceptRosterById:withCompletion:
接受加好友申请
- (void)acceptRosterById:(NSInteger)*rosterId* withCompletion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
接受加好友申请
Declared In
BMXRosterManager.h
- (void)acceptApplication:(NSInteger)rosterId {
[[[BMXClient sharedClient] rosterService] acceptRosterById:rosterId withCompletion:^(BMXError *error) {
- (void)acceptAddRosterById:(NSInteger)rosterId {
[[[BMXClient sharedClient] rosterService] acceptRosterById:rosterId withCompletion:^(BMXError *error) {
addDelegate:
- (void)addDelegate:(id<BMXRosterServiceProtocol>)*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<BMXRosterServiceProtocol>)*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()];
addRosterListener:
添加好友变化监听者
- (void)addRosterListener:(id<BMXRosterServiceProtocol>)*listener*
Discussion
添加好友变化监听者
Declared In
BMXRosterManager.h
- (void)viewDidLoad {
[super viewDidLoad];
[self setUpNavItem];
[self selectView];
[self rosterListTableView];
[self getAllRoster];
[self actionArray];
[self.rosterListTableView reloadData];
[self configSupportData];
[[[BMXClient sharedClient] rosterService] addRosterListener:self];
addToBlockList:withCompletion:
加入黑名单
- (void)addToBlockList:(long long)*rosterId* withCompletion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
加入黑名单
Declared In
BMXRosterManager.h
- (void)addToBlackList:(NSInteger)userId {
[[[BMXClient sharedClient] rosterService] addToBlockList:userId
- (void)addToBlackList:(NSString *)userId {
[[[BMXClient sharedClient] rosterService] addToBlockList:[userId integerValue] withCompletion:^(BMXError *error) {
applyAddRoster:reason:completion:
申请添加好友
- (void)applyAddRoster:(long long)*roster* reason:(NSString *)*reason* completion:(void ( ^ ) ( BMXRoster *roster , BMXError *error ))*aCompletionBlock*
Discussion
申请添加好友
Declared In
BMXRosterManager.h
- (void)addRosterId:(long long)rosterId reason:(NSString *)reason {
MAXLog(@"%@", [[BMXClient sharedClient] rosterService]);
[[[BMXClient sharedClient] rosterService] applyAddRoster:rosterId reason:reason completion:^(BMXRoster *roster, BMXError *error) {
- (void)addRosterId:(long long)rosterId reason:(NSString *)reason {
MAXLog(@"%@", [[BMXClient sharedClient] rosterService]);
[[[BMXClient sharedClient] rosterService] applyAddRoster:rosterId reason:reason completion:^(BMXRoster *roster, BMXError *error) {
declineRosterById:withReason:completion:
拒绝加好友申请
- (void)declineRosterById:(NSInteger)*rosterId* withReason:(NSString *)*reason* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
拒绝加好友申请
Declared In
BMXRosterManager.h
- (void)declineRosterById:(NSInteger)roster reason:(NSString *)reason {
[[[BMXClient sharedClient] rosterService] declineRosterById:roster withReason:reason completion:^(BMXError *error) {
downloadAvatarWithRoster:progress:completion:
下载头像
- (void)downloadAvatarWithRoster:(BMXRoster *)*roster* progress:(void ( ^ ) ( int progress , BMXError *error ))*aProgress* completion:(void ( ^ ) ( BMXRoster *roster , BMXError *error ))*aCompletion*
Discussion
下载头像
Declared In
BMXRosterManager.h
getApplicationListWithCursor:pageSize:completion:
获取申请添加好友列表
- (void)getApplicationListWithCursor:(NSString *)*cursor* pageSize:(int)*pageSize* completion:(void ( ^ ) ( NSArray *applicationList , NSString *cursor , int offset , BMXError *error ))*aCompletionBlock*
Discussion
获取申请添加好友列表
Declared In
BMXRosterManager.h
- (void)getApplicationList {
[HQCustomToast showWating];
[[[BMXClient sharedClient] rosterService] getApplicationListWithCursor:@"" pageSize:50 completion:^(NSArray *applicationList, NSString *cursor, int offset, BMXError *error) {
getBlockListforceRefresh:completion:
- 获取黑名单
- (void)getBlockListforceRefresh:(BOOL)*forceRefresh* completion:(void ( ^ ) ( NSArray *blockList , BMXError *error ))*aCompletionBlock*
Parameters
forceRefresh
如果forceRefresh == true,则强制从服务端拉取
aCompletionBlock
BlockList ,Error
Discussion
- 获取黑名单
Declared In
BMXRosterManager.h
- (void)getBlackList {
if (self.tipView) {
[self.tipView removeFromSuperview];
}
[[[BMXClient sharedClient] rosterService] getBlockListforceRefresh:YES completion:^(NSArray *blockList, BMXError *error) {
getRosterListforceRefresh:completion:
- 获取好友列表
- (void)getRosterListforceRefresh:(BOOL)*forceRefresh* completion:(void ( ^ ) ( NSArray *rostIdList , BMXError *error ))*aCompletionBlock*
Parameters
forceRefresh
如果forceRefresh == true,则强制从服务端拉取
aCompletionBlock
好友列表
Discussion
- 获取好友列表
Declared In
BMXRosterManager.h
- (void)getRosterList {
[[[BMXClient sharedClient] rosterService] getRosterListforceRefresh:YES completion:^(NSArray *rostIdList, BMXError *error) {
- (void)getAllRosterWithToast:(BOOL)isNeed {
if (isNeed == YES) {
[HQCustomToast showWating];
}
[[[BMXClient sharedClient] rosterService] getRosterListforceRefresh:NO completion:^(NSArray *rostIdList, BMXError *error) {
- (void)getAllRoster {
[HQCustomToast showWating];
[[[BMXClient sharedClient] rosterService] getRosterListforceRefresh:NO completion:^(NSArray *rostIdList, BMXError *error) {
- (void)getAllRoster {
[[[BMXClient sharedClient] rosterService] getRosterListforceRefresh:YES completion:^(NSArray *rostIdList, BMXError *error) {
- (void)getAllRoster {
[[[BMXClient sharedClient] rosterService] getRosterListforceRefresh:YES completion:^(NSArray *rostIdList, BMXError *error) {
- (void)getAllRoster {
[[[BMXClient sharedClient] rosterService] getRosterListforceRefresh:NO completion:^(NSArray *rostIdList, BMXError *error) {
- (void)getAllRosterWithToast:(BOOL)isNeed {
if (isNeed == YES) {
[HQCustomToast showWating];
}
[[[BMXClient sharedClient] rosterService] getRosterListforceRefresh:NO completion:^(NSArray *rostIdList, BMXError *error) {
- (void)getAllRoster {
[HQCustomToast showWating];
[[[BMXClient sharedClient] rosterService] getRosterListforceRefresh:NO completion:^(NSArray *rostIdList, BMXError *error) {
muteNotificationByRoster:muteNotificationStatus:completion:
设置是否拒收用户消息
- (void)muteNotificationByRoster:(BMXRoster *)*roster* muteNotificationStatus:(BOOL)*muteNotificationStatus* completion:(void ( ^ ) ( BMXRoster *roster , BMXError *error ))*aCompletionBlock*
Discussion
设置是否拒收用户消息
Declared In
BMXRosterManager.h
- (void)cellDidchangeSwitchStatus:(UISwitch *)mswtich cell:(TitleSwitchTableViewCell *)cell {
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
NSDictionary *dic = self.cellDataArray[indexPath.row];
NSString *str = dic[@"type"];
BOOL state = mswtich.on ? YES : NO;
if ([str isEqualToString:NSLocalizedString(@"Do-Not-Disturb", @"消息免打扰")]) {
[[[BMXClient sharedClient] rosterService] muteNotificationByRoster:self.currentRoster muteNotificationStatus:state completion:^(BMXRoster *roster, BMXError *error) {
removeDelegate:
- (void)removeDelegate:(id<BMXRosterServiceProtocol>)*aDelegate*
removeRosterById:withCompletion:
删除好友
- (void)removeRosterById:(long long)*rostId* withCompletion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
删除好友
Declared In
BMXRosterManager.h
- (void)removeRoster:(NSInteger)rosterId {
MAXLog(@"删除好友");
[[[BMXClient sharedClient] rosterService] removeRosterById:rosterId withCompletion:^(BMXError *error) {
removeRosterFromBlockList:withCompletion:
从黑名单移除
- (void)removeRosterFromBlockList:(NSInteger)*rostId* withCompletion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*
Discussion
从黑名单移除
Declared In
BMXRosterManager.h
- (void)removeRoster:(NSInteger)rosterId {
[[[BMXClient sharedClient] rosterService] removeRosterFromBlockList:rosterId
removeRosterListener:
移除好友变化监听者
- (void)removeRosterListener:(id<BMXRosterServiceProtocol>)*listener*
Discussion
移除好友变化监听者
Declared In
BMXRosterManager.h
searchByRoserName:forceRefresh:completion:
通过好友Name搜索
- (void)searchByRoserName:(NSString *)*name* forceRefresh:(BOOL)*forceRefresh* completion:(void ( ^ ) ( BMXRoster *roster , BMXError *error ))*aCompletionBlock*
Parameters
name
好友name
aCompletionBlock
好友
Discussion
通过好友Name搜索
Declared In
BMXRosterManager.h
- (void)searchByName:(NSString *)name {
MAXLog(@"通过名字搜索好友");
[[[BMXClient sharedClient] rosterService] searchByRoserName:name forceRefresh:NO completion:^(BMXRoster *roster, BMXError *error) {
searchByRosterId:forceRefresh:completion:
通过好友ID搜索
- (void)searchByRosterId:(long long)*rosterId* forceRefresh:(BOOL)*forceRefresh* completion:(void ( ^ ) ( BMXRoster *roster , BMXError *error ))*aCompletionBlock*
Parameters
rosterId
好友ID
aCompletionBlock
好友
Discussion
通过好友ID搜索
Declared In
BMXRosterManager.h
- (void)loadAccountData {
NSArray *list = [AccountListStorage loadObject];
self.accountArray = list;
IMAcount *a = self.accountArray[0];
[[[BMXClient sharedClient] rosterService] searchByRosterId:[a.usedId integerValue] forceRefresh:YES completion:^(BMXRoster *roster, BMXError *error) {
[[[BMXClient sharedClient] rosterService] updateItemAliasByRoster:self.currentRoster aliasJson:name completion:^(BMXRoster *roster, BMXError *error) {
if (!error) {
[HQCustomToast showDialog:NSLocalizedString(@"Set_successfully", @"设置成功")];
[[[BMXClient sharedClient] rosterService] searchByRosterId:self.currentRoster.rosterId forceRefresh:YES completion:^(BMXRoster *roster, BMXError *error) {
[[[BMXClient sharedClient] rosterService] updateItemExtensionByRoster:self.currentRoster extensionJson:ext completion:^(BMXRoster *roster, NSString *extensionJson) {
[[[BMXClient sharedClient] rosterService] searchByRosterId:self.currentRoster.rosterId forceRefresh:YES completion:^(BMXRoster *roster, BMXError *error) {
- (void)getRosterInfo {
[[[BMXClient sharedClient] rosterService] searchByRosterId:self.currentRoster.rosterId forceRefresh:YES completion:^(BMXRoster *roster, BMXError *error) {
if (messageModel.messageObjc.isReadAcked == YES) {
messageCell.readStatusLabel.text = NSLocalizedString(@"Read", @"已读");
} else {
messageCell.readStatusLabel.text = NSLocalizedString(@"Unread", @"未读");
}
}
} else {
__weak LHChatViewCell *weakCell = messageCell;
[[[BMXClient sharedClient] rosterService] searchByRosterId:messageModel.messageObjc.fromId forceRefresh:NO completion:^(BMXRoster *roster, BMXError *error) {
}
}
}];
}
if (self.messageType == BMXMessageTypeGroup) {
messageModel.isChatGroup = YES;
__weak LHChatViewCell *weakCell = messageCell;
[[[BMXClient sharedClient] rosterService] searchByRosterId:messageModel.messageObjc.fromId forceRefresh:NO completion:^(BMXRoster *roster, BMXError *error) {
} else {
// if (messageModel.messageObjct.enableGroupAck == YES) {
messageCell.readStatusLabel.text = [NSString stringWithFormat:NSLocalizedString(@"npersons_have_read", @"%d人已读"), messageModel.messageObjc.groupAckCount];
// } else {
// messageCell.readStatusLabel.text = @"";
//
// }
}
} else {
__weak LHChatViewCell *weakCell = messageCell;
[[[BMXClient sharedClient] rosterService] searchByRosterId:messageModel.messageObjc.fromId forceRefresh:NO completion:^(BMXRoster *roster, BMXError *error) {
}
}
}];
}
if (self.messageType == BMXMessageTypeGroup) {
messageModel.isChatGroup = YES;
__weak LHChatViewCell *weakCell = messageCell;
[[[BMXClient sharedClient] rosterService] searchByRosterId:messageModel.messageObjc.fromId forceRefresh:NO completion:^(BMXRoster *roster, BMXError *error) {
searchRostersByRosterIdList:forceRefresh:completion:
批量搜索用户
- (void)searchRostersByRosterIdList:(NSArray<NSNumber*> *)*rosterIdList* forceRefresh:(BOOL)*forceRefresh* completion:(void ( ^ ) ( NSArray<BMXRoster*> *rosterList , BMXError *error ))*aCompletionBlock*
Parameters
rosterIdList
id
forceRefresh
如果forceRefresh == true,则强制从服务端拉取
aCompletionBlock
rosterList,error
Discussion
批量搜索用户
Declared In
BMXRosterManager.h
- (void)getSupportListProfileWithArray:(NSArray *)array {
[[[BMXClient sharedClient] rosterService] searchRostersByRosterIdList:array forceRefresh:NO completion:^(NSArray<BMXRoster *> *rosterList, BMXError *error) {
- (void)searchRostersByidArray:(NSArray *)idArray {
[[[BMXClient sharedClient] rosterService] searchRostersByRosterIdList:idArray forceRefresh:NO completion:^(NSArray<BMXRoster *> *rosterList, BMXError *error) {
- (void)searchRostersByidArray:(NSArray *)idArray {
[[[BMXClient sharedClient] rosterService] searchRostersByRosterIdList:idArray forceRefresh:YES completion:^(NSArray<BMXRoster *> *rosterList, BMXError *error) {
- (void)getRostersByidArray:(NSArray *)idArray {
[[[BMXClient sharedClient] rosterService] searchRostersByRosterIdList:idArray forceRefresh:YES completion:^(NSArray<BMXRoster *> *rosterList, BMXError *error) {
[[[BMXClient sharedClient] chatService] getGroupAckMessageUserIdListWithMessage:self.message completion:^(NSArray *groupMemberIdList, BMXError *error) {
self.alreadyRosterIdArray = groupMemberIdList;
[[[BMXClient sharedClient] rosterService] searchRostersByRosterIdList:groupMemberIdList forceRefresh:NO completion:^(NSArray<BMXRoster *> *rosterList, BMXError *error) {
[[[BMXClient sharedClient] chatService] getGroupAckMessageUnreadUserIdListWithMessage:self.message completion:^(NSArray *groupMemberIdList, BMXError *error) {
[[[BMXClient sharedClient] rosterService] searchRostersByRosterIdList:groupMemberIdList forceRefresh:NO completion:^(NSArray<BMXRoster *> *rosterList, BMXError *error) {
- (void)searchRostersByidArray:(NSArray *)idArray {
[[[BMXClient sharedClient] rosterService] searchRostersByRosterIdList:idArray forceRefresh:YES completion:^(NSArray<BMXRoster *> *rosterList, BMXError *error) {
- (void)getRostersByidArray:(NSArray *)idArray {
[[[BMXClient sharedClient] rosterService] searchRostersByRosterIdList:idArray forceRefresh:YES completion:^(NSArray<BMXRoster *> *rosterList, BMXError *error) {
updateItemAliasByRoster:aliasJson:completion:
更新好友别名
- (void)updateItemAliasByRoster:(BMXRoster *)*roster* aliasJson:(NSString *)*aliasJson* completion:(void ( ^ ) ( BMXRoster *roster , BMXError *error ))*aCompletionBlock*
Discussion
更新好友别名
Declared In
BMXRosterManager.h
- (void)setalias:(NSString *)name {
[[[BMXClient sharedClient] rosterService] updateItemAliasByRoster:self.currentRoster aliasJson:name completion:^(BMXRoster *roster, BMXError *error) {
updateItemExtensionByRoster:extensionJson:completion:
更新好友扩展信息
- (void)updateItemExtensionByRoster:(BMXRoster *)*roster* extensionJson:(NSString *)*extensionJson* completion:(void ( ^ ) ( BMXRoster *roster , NSString *extensionJson ))*aCompletionBlock*
Discussion
更新好友扩展信息
Declared In
BMXRosterManager.h
- (void)setExtension:(NSString *)ext {
[[[BMXClient sharedClient] rosterService] updateItemExtensionByRoster:self.currentRoster extensionJson:ext completion:^(BMXRoster *roster, NSString *extensionJson) {
updateItemLocalExtensionByRoster:localExtensionJson:completion:
更新好友本地扩展信息
- (void)updateItemLocalExtensionByRoster:(BMXRoster *)*roster* localExtensionJson:(NSString *)*localExtensionJson* completion:(void ( ^ ) ( BMXRoster *roster , BMXError *error ))*aCompletionBlock*
Discussion
更新好友本地扩展信息
Declared In
BMXRosterManager.h
Example: