BMXUserManager Protocol Reference

Conforms to NSObject
Declared in BMXUserManager.h

Instance Methods

addDelegate:

- (void)addDelegate:(id<BMXUserServiceProtocol>)*aDelegate*

Example:

- (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<BMXUserServiceProtocol>)*aDelegate* delegateQueue:(dispatch_queue_t)*aQueue*

Example:

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

bindDevice:completion:

绑定设备推送token

- (void)bindDevice:(NSString *)*token* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*

Discussion

绑定设备推送token

Declared In

  • BMXUserManager.h

Example:

- (void)bindDeviceToken {
    NSString *deviceToken = [[NSUserDefaults standardUserDefaults] valueForKey:@"deviceToken"];
    if ([deviceToken length]) {
        [[[BMXClient sharedClient] userService] bindDevice:deviceToken completion:^(BMXError *error) {
- (void)bindDeviceToken {
    NSString *deviceToken = [[NSUserDefaults standardUserDefaults] valueForKey:@"deviceToken"];
    if ([deviceToken length]) {
        [[[BMXClient sharedClient] userService] bindDevice:deviceToken completion:^(BMXError *error) {

deleteDeviceByDeviceSN:completion:

删除设备

- (void)deleteDeviceByDeviceSN:(NSInteger)*deviceSN* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*

Discussion

删除设备

Declared In

  • BMXUserManager.h

Example:

UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:NSLocalizedString(@"Delete", @"删除")handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
    BMXDevice *device = self.deviceListArray[indexPath.row];
    [[[BMXClient sharedClient] userService] deleteDeviceByDeviceSN:device.deviceSN completion:^(BMXError *error) {
- (void)deviceTableViewCelldidClickButtonWithDevice:(BMXDevice *)device {
    [[[BMXClient sharedClient] userService] deleteDeviceByDeviceSN:device.deviceSN completion:^(BMXError *error) {

downloadAvatarWithProfile:thumbnail:progress:completion:

下载头像

- (void)downloadAvatarWithProfile:(BMXUserProfile *)*profile* thumbnail:(BOOL)*thumbnail* progress:(void ( ^ ) ( int progress , BMXError *error ))*aProgress* completion:(void ( ^ ) ( BMXUserProfile *profile , BMXError *error ))*aCompletion*

Parameters

profile
用户信息

aProgress
下载进度

aCompletion
回调

Discussion

下载头像

Declared In

  • BMXUserManager.h

Example:

[[[BMXClient sharedClient] userService] getProfileForceRefresh:YES completion:^(BMXUserProfile *profile, BMXError *aError) {
    if (!aError) {
        IMAcount *account = [IMAcountInfoStorage loadObject];
        account.usedId = [NSString stringWithFormat:@"%lld", profile.userId];
        account.userName = profile.userName;
        [IMAcountInfoStorage saveObject:account];
        account.appid = [[BMXClient sharedClient] sdkConfig].appID;
        [self saveAccountToLoaclListWithaccount:account];
            
        [[[BMXClient sharedClient] userService] downloadAvatarWithProfile:profile thumbnail:YES progress:^(int progress, BMXError *error) {
- (void)configUserCodeAndContent {
    self.idLabel.text = [NSString stringWithFormat:@"id : %lld", self.profile.userId];
    self.nameLabel.text = [NSString stringWithFormat:NSLocalizedString(@"Nickname_name", @"昵称 : %@"), self.profile.userName];
    
    self.avatarImageView.image = [UIImage imageNamed:@"profileavatar"];
    
    if ([[NSFileManager defaultManager] fileExistsAtPath:self.profile.avatarThumbnailPath]) {
        UIImage *avarat = [UIImage imageWithContentsOfFile:self.profile.avatarThumbnailPath];
        self.avatarImageView.image = avarat;
    } else {
        [[[BMXClient sharedClient] userService] downloadAvatarWithProfile:self.profile thumbnail:YES progress:^(int progress, BMXError *error) {
- (void)getSelfAvatar:(BMXUserProfile *)profile {
    UIImage *avarat = [UIImage imageWithContentsOfFile:profile.avatarThumbnailPath];
    if (avarat) {
        self.selfImage  = avarat;
    }else {
        [[[BMXClient sharedClient] userService] downloadAvatarWithProfile:profile thumbnail:YES progress:^(int progress, BMXError *error) {
[[[BMXClient sharedClient] userService] getProfileForceRefresh:YES completion:^(BMXUserProfile *profile, BMXError *aError) {
    if (!aError) {
        IMAcount *account = [IMAcountInfoStorage loadObject];
        account.usedId = [NSString stringWithFormat:@"%lld", profile.userId];
        account.userName = profile.userName;
        [IMAcountInfoStorage saveObject:account];
        account.appid = [[BMXClient sharedClient] sdkConfig].appID;
        [self saveAccountToLoaclListWithaccount:account];
            
        [[[BMXClient sharedClient] userService] downloadAvatarWithProfile:profile thumbnail:YES progress:^(int progress, BMXError *error) {
- (void)userInfoDidUpdated:(BMXUserProfile *)userProflie {
    MAXLog(@"用户信息改变");
    [[[BMXClient sharedClient] userService] downloadAvatarWithProfile:userProflie thumbnail:YES  progress:^(int progress, BMXError *error) {
//        self.subTitleLabel.text = @"个性签名:赶快去更新签名吧";
//
//    }
//    [self.subTitleLabel sizeToFit];

    
    UIImage *avarat = [UIImage imageWithContentsOfFile:profile.avatarThumbnailPath];
    if (avarat) {
        self.avatarImageView.image  = avarat;
    }else {
        [[[BMXClient sharedClient] userService] downloadAvatarWithProfile:profile thumbnail:YES  progress:^(int progress, BMXError *error) {

getDeviceListCompletion:

获取设备列表

- (void)getDeviceListCompletion:(void ( ^ ) ( BMXError *error , NSArray *deviceList ))*aCompletionBlock*

Discussion

获取设备列表

Declared In

  • BMXUserManager.h

Example:

- (void)getDeviceList {
    [[[BMXClient sharedClient] userService] getDeviceListCompletion:^(BMXError *error, NSArray *deviceList) {

getProfileForceRefresh:completion:

获取用户详情

- (void)getProfileForceRefresh:(BOOL)*forceRefresh* completion:(void ( ^ ) ( BMXUserProfile *profile , BMXError *aError ))*aCompletionBlock*

Discussion

获取用户详情

Declared In

  • BMXUserManager.h

Example:

- (void)getProfile {
    [[[BMXClient sharedClient] userService] getProfileForceRefresh:YES completion:^(BMXUserProfile *profile, BMXError *aError) {
- (void)getProfile {
    
    [[[BMXClient sharedClient] userService] getProfileForceRefresh:NO completion:^(BMXUserProfile *profile, BMXError *aError) {
- (void)getMyProfile {
    [[[BMXClient sharedClient] userService] getProfileForceRefresh:NO completion:^(BMXUserProfile *profile, BMXError *aError) {
- (void)getProfile{
    [[[BMXClient sharedClient] userService] getProfileForceRefresh:YES completion:^(BMXUserProfile *profile, BMXError *aError) {
- (void)getprofile {
    [[[BMXClient sharedClient] userService] getProfileForceRefresh:YES completion:^(BMXUserProfile *profile, BMXError *aError) {
- (void)viewDidLoad {
    [super viewDidLoad];
    
//    [self setMainNavigationBarTitle:self.roster.userName];
    
    
    
    [self setNavigationBarTitle:self.roster.userName navLeftButtonIcon:@"blackback" navRightButtonTitle:nil];
    
    
    
    [[[BMXClient sharedClient] userService] getProfileForceRefresh:NO completion:^(BMXUserProfile *profile, BMXError *aError) {
- (void)getprofileWithToast:(BOOL)isNeed {
    if (isNeed == YES) {
        [HQCustomToast showWating];
    }
    [[[BMXClient sharedClient] userService] getProfileForceRefresh:NO completion:^(BMXUserProfile *profile, BMXError *aError) {
- (void)getprofile {
    [HQCustomToast showWating];
    [[[BMXClient sharedClient] userService] getProfileForceRefresh:NO completion:^(BMXUserProfile *profile, BMXError *aError) {

removeDelegate:

- (void)removeDelegate:(id<BMXUserServiceProtocol>)*aDelegate*

Example:

setAddFriendAuthMode:completion:

设置加好友验证方式

- (void)setAddFriendAuthMode:(BMXAddFriendAuthMode)*addFriendAuthMode* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*

Parameters

addFriendAuthMode
BMXAddFriendAuthMode

Discussion

设置加好友验证方式

Declared In

  • BMXUserManager.h

Example:

- (void)setAddFriendAuth:(BMXAddFriendAuthMode)mode {
    [[[BMXClient sharedClient] userService] setAddFriendAuthMode:mode completion:^(BMXError *error) {

setAuthQuestion:completion:

设置加好友验证问题

- (void)setAuthQuestion:(BMXAuthQuestion *)*authQuestion* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*

Parameters

authQuestion
BMXAuthQuestion

Discussion

设置加好友验证问题

Declared In

  • BMXUserManager.h

Example:

- (void)setQuestion:(NSString *)question answer:(NSString *)answer {
    BMXAuthQuestion *qustionModel = [[BMXAuthQuestion alloc] init];
    qustionModel.mQuestion = question;
    qustionModel.mAnswer = answer;
    
    [[[BMXClient sharedClient] userService] setAuthQuestion:qustionModel completion:^(BMXError *error) {

setAutoAcceptGroupInvite:completion:

设置是否自动同意入群邀请

- (void)setAutoAcceptGroupInvite:(BOOL)*autoAcceptGroupInvite* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*

Parameters

autoAcceptGroupInvite
BOOL

Discussion

设置是否自动同意入群邀请

Declared In

  • BMXUserManager.h

Example:

            [HQCustomToast showDialog:NSLocalizedString(@"Set_successfully", @"设置成功")];
        }
    }];
} else if ([str isEqualToString:NSLocalizedString(@"Whether_to_download_thumbnail_attachments_automatically", @"是否自动下载缩略图附件")]) {
    [[[BMXClient sharedClient] userService] setAutoDownloadAttachment:state completion:^(BMXError *error) {
        if (!error) {
            [HQCustomToast showDialog:NSLocalizedString(@"Set_successfully", @"设置成功")];
        }
    }];
} else if ([str isEqualToString:NSLocalizedString(@"Whether_to_accept_group_invitation_automatically", @"是否自动接受群邀请")]) {
    [[[BMXClient sharedClient] userService] setAutoAcceptGroupInvite:state completion:^(BMXError *error) {

setAutoDownloadAttachment:completion:

设置是否自动缩略图和语音附件

- (void)setAutoDownloadAttachment:(BOOL)*autoDownloadAttachment* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*

Parameters

autoDownloadAttachment
BOOL

Discussion

设置是否自动缩略图和语音附件

Declared In

  • BMXUserManager.h

Example:

            [HQCustomToast showDialog:NSLocalizedString(@"Set_successfully", @"设置成功")];
        }
    }];
} else if ([str isEqualToString:NSLocalizedString(@"Whether_to_push_details", @"是否推送详情")]) {
    [[[BMXClient sharedClient] userService] setEnablePushDetail:state completion:^(BMXError *error) {
        if (!error) {
            [HQCustomToast showDialog:NSLocalizedString(@"Set_successfully", @"设置成功")];
        }
    }];
} else if ([str isEqualToString:NSLocalizedString(@"Whether_to_download_thumbnail_attachments_automatically", @"是否自动下载缩略图附件")]) {
    [[[BMXClient sharedClient] userService] setAutoDownloadAttachment:state completion:^(BMXError *error) {

setEnablePushDetail:completion:

设置是否推送详情

- (void)setEnablePushDetail:(BOOL)*enablePushDetail* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*

Parameters

enablePushDetail
BOOL

Discussion

设置是否推送详情

Declared In

  • BMXUserManager.h

Example:

            [HQCustomToast showDialog:NSLocalizedString(@"Set_successfully", @"设置成功")];
        }
    }];
} else if ([str isEqualToString:NSLocalizedString(@"Sound", @"声音")]) {
    [[[BMXClient sharedClient] userService] setNotificationSound:state completion:^(BMXError *error) {
        if (!error) {
            [HQCustomToast showDialog:NSLocalizedString(@"Set_successfully", @"设置成功")];
        }
    }];
} else if ([str isEqualToString:NSLocalizedString(@"Whether_to_push_details", @"是否推送详情")]) {
    [[[BMXClient sharedClient] userService] setEnablePushDetail:state completion:^(BMXError *error) {

setEnablePushStatus:completion:

设置是否允许推送

- (void)setEnablePushStatus:(BOOL)*enablePushStatus* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*

Parameters

enablePushStatus
BOOL

Discussion

设置是否允许推送

Declared In

  • BMXUserManager.h

Example:

- (void)cellDidchangeSwitchStatus:(UISwitch *)mswtich cell:(TitleSwitchTableViewCell *)cell {
    NSIndexPath *indexPath = [self indexPathForCell:cell];
    NSDictionary *dic = self.cellDataArray[indexPath.section*2 + indexPath.row];
    NSString *str = dic[@"type"];
    BOOL state = mswtich.on ? YES : NO;
    
   if ([str isEqualToString:NSLocalizedString(@"Accept_new_message_notification", @"接受新消息通知")]) {
        [[[BMXClient sharedClient] userService] setEnablePushStatus:state completion:^(BMXError *error) {

setNickname:completion:

设置昵称

- (void)setNickname:(NSString *)*nickname* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*

Discussion

设置昵称

Declared In

  • BMXUserManager.h

Example:

- (void)modifyNickname:(NSString *)nickname {
    [HQCustomToast showWating];
    [[[BMXClient sharedClient] userService] setNickname:nickname completion:^(BMXError *error) {

setNotificationSound:completion:

设置收到新消息是否声音提醒

- (void)setNotificationSound:(BOOL)*notificationSound* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*

Parameters

notificationSound
BOO

Discussion

设置收到新消息是否声音提醒

Declared In

  • BMXUserManager.h

Example:

- (void)cellDidchangeSwitchStatus:(UISwitch *)mswtich cell:(TitleSwitchTableViewCell *)cell {
    NSIndexPath *indexPath = [self indexPathForCell:cell];
    NSDictionary *dic = self.cellDataArray[indexPath.section*2 + indexPath.row];
    NSString *str = dic[@"type"];
    BOOL state = mswtich.on ? YES : NO;
    
   if ([str isEqualToString:NSLocalizedString(@"Accept_new_message_notification", @"接受新消息通知")]) {
        [[[BMXClient sharedClient] userService] setEnablePushStatus:state completion:^(BMXError *error) {
            if (!error) {
                [HQCustomToast showDialog:NSLocalizedString(@"Set_successfully", @"设置成功")];
            }
        }];
    } else if ([str isEqualToString:NSLocalizedString(@"Vibrate", @"震动")]) {
        [[[BMXClient sharedClient] userService] setNotificationVibrate:state completion:^(BMXError *error) {
            if (!error) {
                [HQCustomToast showDialog:NSLocalizedString(@"Set_successfully", @"设置成功")];
            }
        }];
    } else if ([str isEqualToString:NSLocalizedString(@"Sound", @"声音")]) {
        [[[BMXClient sharedClient] userService] setNotificationSound:state completion:^(BMXError *error) {

setNotificationVibrate:completion:

设置收到新消息是否震动

- (void)setNotificationVibrate:(BOOL)*notificationVibrate* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*

Parameters

notificationVibrate
BOOL

Discussion

设置收到新消息是否震动

Declared In

  • BMXUserManager.h

Example:

- (void)cellDidchangeSwitchStatus:(UISwitch *)mswtich cell:(TitleSwitchTableViewCell *)cell {
    NSIndexPath *indexPath = [self indexPathForCell:cell];
    NSDictionary *dic = self.cellDataArray[indexPath.section*2 + indexPath.row];
    NSString *str = dic[@"type"];
    BOOL state = mswtich.on ? YES : NO;
    
   if ([str isEqualToString:NSLocalizedString(@"Accept_new_message_notification", @"接受新消息通知")]) {
        [[[BMXClient sharedClient] userService] setEnablePushStatus:state completion:^(BMXError *error) {
            if (!error) {
                [HQCustomToast showDialog:NSLocalizedString(@"Set_successfully", @"设置成功")];
            }
        }];
    } else if ([str isEqualToString:NSLocalizedString(@"Vibrate", @"震动")]) {
        [[[BMXClient sharedClient] userService] setNotificationVibrate:state completion:^(BMXError *error) {

setPrivateInfo:completion:

设置私有扩展信息

- (void)setPrivateInfo:(NSString *)*privateInfo* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*

Parameters

privateInfo
string

Discussion

设置私有扩展信息

Declared In

  • BMXUserManager.h

Example:

- (void)setPrivateInfo:(NSString *)info {
    [HQCustomToast showWating];
    [[[BMXClient sharedClient] userService] setPrivateInfo:info completion:^(BMXError *error) {

setPublicInfo:completion:

设置公开扩展信息

- (void)setPublicInfo:(NSString *)*publicInfo* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*

Parameters

publicInfo
string

Discussion

设置公开扩展信息

Declared In

  • BMXUserManager.h

Example:

- (void)setpublicInfo:(NSString *)info {
    [HQCustomToast showWating];
    [[[BMXClient sharedClient] userService] setPublicInfo:info completion:^(BMXError *error) {

setsetPushNickname:completion:

设置推送昵称

- (void)setsetPushNickname:(NSString *)*nickname* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*

Discussion

设置推送昵称

Declared In

  • BMXUserManager.h

Example:

uploadAvatarWithData:progress:

上传头像

- (void)uploadAvatarWithData:(NSData *)*avatarData* progress:(void ( ^ ) ( int progress , BMXError *error ))*aProgressBlock*

Parameters

avatarData
头像

aProgressBlock
上传进度

Discussion

上传头像

Declared In

  • BMXUserManager.h

Example:

[imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
    UIImage *image = [photos firstObject];
    NSData *imageData = UIImagePNGRepresentation(image);
    [[[BMXClient sharedClient] userService] uploadAvatarWithData:imageData progress:^(int progress, BMXError *error) {

© 2019-2022 美信拓扑 | 官网 该文件修订时间: 2022-09-21 11:43:07

results matching ""

    No results matching ""