1.0.18 feat:房间设置增加修改房间头像的选项
This commit is contained in:
@@ -20,6 +20,8 @@ typedef NS_ENUM(NSInteger, RoomSettingItemType) {
|
||||
RoomSettingItemType_Class,
|
||||
///房间标签
|
||||
RoomSettingItemType_Tag,
|
||||
///房间头像
|
||||
RoomSettingItemType_Avatar,
|
||||
///管理员
|
||||
RoomSettingItemType_Manager_List,
|
||||
///黑名单
|
||||
|
@@ -47,7 +47,12 @@
|
||||
classItem.title = YMLocalizedString(@"XPRoomSettingPresenter2");
|
||||
classItem.subTitle = roomInfo.sortName;
|
||||
classItem.type = RoomSettingItemType_Class;
|
||||
|
||||
|
||||
XPRoomSettingItemModel *avatarItem = [[XPRoomSettingItemModel alloc] init];
|
||||
avatarItem.title = YMLocalizedString(@"RoomSetting_1.0.17_0");
|
||||
avatarItem.subTitle = roomInfo.roomTag;
|
||||
avatarItem.type = RoomSettingItemType_Avatar;
|
||||
|
||||
XPRoomSettingItemModel *tagItem = [[XPRoomSettingItemModel alloc] init];
|
||||
tagItem.title = YMLocalizedString(@"XPRoomSettingPresenter3");
|
||||
tagItem.subTitle = roomInfo.roomTag;
|
||||
@@ -80,14 +85,12 @@
|
||||
leaveItem.title = YMLocalizedString(@"XPRoomSettingPresenter9");
|
||||
leaveItem.switchState = roomInfo.leaveMode;
|
||||
leaveItem.type = RoomSettingItemType_Leave_Model;
|
||||
|
||||
|
||||
|
||||
XPRoomSettingItemModel * giftValueItem = [[XPRoomSettingItemModel alloc] init];
|
||||
giftValueItem.title = roomInfo.showGiftValue ? YMLocalizedString(@"XPMoreMenuPresenter27") : YMLocalizedString(@"XPMoreMenuPresenter3");
|
||||
giftValueItem.switchState = roomInfo.showGiftValue;
|
||||
giftValueItem.type = RoomSettingItemType_Gift_Value_Model;
|
||||
|
||||
|
||||
|
||||
NSString * roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
///获取房间角色
|
||||
@@ -98,129 +101,61 @@
|
||||
NSArray * array;
|
||||
if (error == nil) {
|
||||
NIMChatroomMember * member = members.firstObject;
|
||||
|
||||
// 是否是创建者或超级管理员
|
||||
BOOL isCreatorOrSuperAdmin = (member.type == NIMChatroomMemberTypeCreator || isSuperAdmin);
|
||||
|
||||
// 是否是许可房间
|
||||
BOOL isPermitRoom = (roomInfo.isPermitRoom == PermitRoomType_License);
|
||||
|
||||
// 是否设置了房间密码
|
||||
BOOL hasRoomPwd = (roomInfo.roomPwd.length > 0);
|
||||
|
||||
// 基础数组构建
|
||||
NSMutableArray *firstSection = [@[titleItem, lockItem] mutableCopy];
|
||||
if (hasRoomPwd) {
|
||||
[firstSection addObject:pwdItem];
|
||||
}
|
||||
|
||||
NSMutableArray *secondSection = [@[tagItem] mutableCopy];
|
||||
NSMutableArray *thirdSection = [@[blackItem, giftEffectItem, messageScreedItem] mutableCopy];
|
||||
|
||||
if (isCreatorOrSuperAdmin) {
|
||||
// 创建者和超级管理员特有的 avatarItem
|
||||
[secondSection insertObject:avatarItem atIndex:0];
|
||||
[thirdSection insertObject:managerItem atIndex:0];
|
||||
}
|
||||
|
||||
if (roomInfo.type == RoomType_Anchor) {
|
||||
if (member.type == NIMChatroomMemberTypeCreator || isSuperAdmin) {
|
||||
if (roomInfo.isPermitRoom == PermitRoomType_License) {
|
||||
if (roomInfo.roomPwd.length > 0) {
|
||||
array = @[
|
||||
@[titleItem, lockItem, pwdItem],
|
||||
@[classItem, tagItem],
|
||||
@[managerItem, blackItem, giftEffectItem, messageScreedItem]
|
||||
];
|
||||
} else {
|
||||
array = @[
|
||||
@[titleItem, lockItem],
|
||||
@[classItem, tagItem],
|
||||
@[managerItem, blackItem, giftEffectItem, messageScreedItem]
|
||||
];
|
||||
}
|
||||
} else {
|
||||
if (roomInfo.roomPwd.length > 0) {
|
||||
array = @[
|
||||
@[titleItem, lockItem, pwdItem],
|
||||
@[classItem, tagItem],
|
||||
@[managerItem, blackItem, giftEffectItem, messageScreedItem]
|
||||
];
|
||||
} else {
|
||||
array = @[
|
||||
@[titleItem, lockItem],
|
||||
@[classItem, tagItem],
|
||||
@[managerItem, blackItem, giftEffectItem, messageScreedItem]
|
||||
];
|
||||
}
|
||||
}
|
||||
if (isCreatorOrSuperAdmin) {
|
||||
// 直播间类型(主播房间) - 创建者或超级管理员
|
||||
array = @[firstSection, secondSection, thirdSection];
|
||||
} else {
|
||||
if (roomInfo.roomPwd.length > 0) {
|
||||
array = @[
|
||||
@[titleItem, lockItem, pwdItem],
|
||||
@[tagItem],
|
||||
@[managerItem, blackItem, giftEffectItem, messageScreedItem]
|
||||
];
|
||||
} else {
|
||||
array = @[
|
||||
@[titleItem, lockItem],
|
||||
@[tagItem],
|
||||
@[blackItem, giftEffectItem]
|
||||
];
|
||||
}
|
||||
// 直播间类型(主播房间) - 非创建者或超级管理员
|
||||
array = @[firstSection, secondSection, thirdSection];
|
||||
}
|
||||
} else {
|
||||
// 非主播房间
|
||||
if (member.type == NIMChatroomMemberTypeCreator) {
|
||||
if (roomInfo.isPermitRoom == PermitRoomType_License) {
|
||||
if (roomInfo.roomPwd.length > 0) {
|
||||
array = @[
|
||||
@[titleItem, lockItem,pwdItem],
|
||||
@[tagItem],
|
||||
@[managerItem, blackItem, giftEffectItem, messageScreedItem, arrangeMicItem, leaveItem]
|
||||
];
|
||||
} else {
|
||||
array = @[
|
||||
@[titleItem, lockItem],
|
||||
@[tagItem],
|
||||
@[managerItem, blackItem, giftEffectItem, messageScreedItem, arrangeMicItem, leaveItem]
|
||||
];
|
||||
}
|
||||
} else {
|
||||
if (roomInfo.type == RoomType_MiniGame) {
|
||||
if (roomInfo.roomPwd.length > 0) {
|
||||
array = @[
|
||||
@[titleItem, lockItem, pwdItem],
|
||||
@[tagItem],
|
||||
@[managerItem, blackItem, giftEffectItem, messageScreedItem]
|
||||
];
|
||||
}else {
|
||||
array = @[
|
||||
@[titleItem, lockItem],
|
||||
@[tagItem],
|
||||
@[managerItem, blackItem, giftEffectItem, messageScreedItem]
|
||||
];
|
||||
}
|
||||
} else {
|
||||
if (roomInfo.roomPwd.length > 0) {
|
||||
array = @[
|
||||
@[titleItem, lockItem, pwdItem],
|
||||
@[tagItem],
|
||||
@[managerItem, blackItem, giftEffectItem, messageScreedItem, arrangeMicItem]
|
||||
];
|
||||
}else {
|
||||
array = @[
|
||||
@[titleItem, lockItem],
|
||||
@[tagItem],
|
||||
@[managerItem, blackItem, giftEffectItem, messageScreedItem, arrangeMicItem]
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(isSuperAdmin) {
|
||||
if (roomInfo.roomPwd.length > 0) {
|
||||
array = @[
|
||||
@[titleItem, lockItem,pwdItem],
|
||||
@[tagItem],
|
||||
@[managerItem,blackItem, giftEffectItem, messageScreedItem, arrangeMicItem]
|
||||
];
|
||||
} else {
|
||||
array = @[
|
||||
@[titleItem, lockItem],
|
||||
@[tagItem],
|
||||
@[managerItem,blackItem, giftEffectItem, messageScreedItem, arrangeMicItem]
|
||||
];
|
||||
}
|
||||
} else if(member.type == NIMChatroomMemberTypeManager) {
|
||||
if (roomInfo.roomPwd.length > 0) {
|
||||
array = @[
|
||||
@[titleItem, lockItem,pwdItem],
|
||||
@[tagItem],
|
||||
@[blackItem, giftEffectItem, messageScreedItem, arrangeMicItem]
|
||||
];
|
||||
} else {
|
||||
array = @[
|
||||
@[titleItem, lockItem],
|
||||
@[tagItem],
|
||||
@[blackItem, giftEffectItem, messageScreedItem, arrangeMicItem]
|
||||
];
|
||||
}
|
||||
}
|
||||
// 创建者特有的选项
|
||||
[thirdSection addObjectsFromArray:@[arrangeMicItem, leaveItem]];
|
||||
} else if (isSuperAdmin) {
|
||||
// 超级管理员特有的选项
|
||||
[thirdSection addObject:arrangeMicItem];
|
||||
} else if (member.type == NIMChatroomMemberTypeManager) {
|
||||
// 管理员特有的选项
|
||||
[thirdSection addObject:arrangeMicItem];
|
||||
}
|
||||
|
||||
if (roomInfo.type == RoomType_MiniGame) {
|
||||
// 迷你游戏房间的特有逻辑
|
||||
array = @[firstSection, secondSection, thirdSection];
|
||||
} else {
|
||||
// 其他房间类型
|
||||
array = @[firstSection, secondSection, thirdSection];
|
||||
}
|
||||
}
|
||||
|
||||
NSMutableArray *list = [[NSMutableArray alloc]initWithArray:array];
|
||||
if(member.type == NIMChatroomMemberTypeManager || member.type == NIMChatroomMemberTypeCreator || isSuperAdmin){
|
||||
NSMutableArray *subList = [[NSMutableArray alloc]initWithArray:[list xpSafeObjectAtIndex:2]?:@[]];
|
||||
@@ -242,8 +177,6 @@
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// 获取房间信息
|
||||
/// @param roomUid 房主的uid
|
||||
- (void)getRoomInfo:(NSString *)roomUid {
|
||||
|
@@ -36,7 +36,7 @@
|
||||
#import "XPRoomRoleViewController.h"
|
||||
#import "MSRoomSetingBackdropVC.h"
|
||||
|
||||
@interface XPRoomSettingViewController ()<UITableViewDelegate, UITableViewDataSource, XPRoomSettingProtocol, XPRoomSettingTableViewCellDelegate, XPRoomSettingInputViewDelegate>
|
||||
@interface XPRoomSettingViewController ()<UITableViewDelegate, UITableViewDataSource, XPRoomSettingProtocol, XPRoomSettingTableViewCellDelegate, XPRoomSettingInputViewDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate>
|
||||
///房间信息
|
||||
@property (nonatomic,strong) RoomInfoModel *roomInfo;
|
||||
///列表
|
||||
@@ -229,6 +229,28 @@ XPRoomSettingItemModel * itemModel = [[self.datasource xpSafeObjectAtIndex:index
|
||||
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:self.roomInfo.roomPwd tagId:tag classifyId:roomClassifyId hasAnimationEffect:self.roomInfo.hasAnimationEffect roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:itemModel.type mgId:mgId backPic:self.roomInfo.backPic];
|
||||
};
|
||||
[TTPopup popupView:view style:TTPopupStyleAlert];
|
||||
}
|
||||
break;
|
||||
case RoomSettingItemType_Avatar: {
|
||||
@kWeakify(self);
|
||||
[YYUtility checkAssetsLibrayAvailable:^{
|
||||
@kStrongify(self);
|
||||
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
|
||||
imagePicker.modalPresentationCapturesStatusBarAppearance = YES;
|
||||
imagePicker.delegate = self;
|
||||
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
|
||||
imagePicker.allowsEditing = YES;
|
||||
|
||||
// [self presentViewController:[self photoPickerWillDisplayGIF: NO]
|
||||
// animated:YES
|
||||
// completion:nil];
|
||||
} denied:^{
|
||||
@kStrongify(self);
|
||||
[self showNotPhoto:YMLocalizedString(@"XPMineUserInfoEditViewController7") content:YMLocalizedString(@"XPMineUserInfoEditViewController8")];
|
||||
} restriction:^{
|
||||
@kStrongify(self);
|
||||
[self showNotPhoto:YMLocalizedString(@"XPMineUserInfoEditViewController9") content:YMLocalizedString(@"XPMineUserInfoEditViewController10")];
|
||||
}];
|
||||
}
|
||||
break;
|
||||
case RoomSettingItemType_Title:
|
||||
@@ -282,6 +304,22 @@ XPRoomSettingItemModel * itemModel = [[self.datasource xpSafeObjectAtIndex:index
|
||||
}
|
||||
}
|
||||
|
||||
- (void)showNotPhoto:(NSString *)title content:(NSString *)content {
|
||||
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
||||
config.title = title;
|
||||
config.message = content;
|
||||
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
|
||||
if ([[UIApplication sharedApplication] canOpenURL:url]) {
|
||||
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) {
|
||||
|
||||
}];
|
||||
}
|
||||
} cancelHandler:^{
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - XPRoomSettingInputViewDelegate
|
||||
- (void)xPRoomSettingInputView:(XPRoomSettingInputView *)view didClickConfirm:(NSString *)text type:(RoomSettingInputType)type {
|
||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid];
|
||||
@@ -426,6 +464,27 @@ XPRoomSettingItemModel * itemModel = [[self.datasource xpSafeObjectAtIndex:index
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UIImagePickerControllerDelegate
|
||||
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
|
||||
{
|
||||
UIImage *selectedPhoto = [info objectForKey:UIImagePickerControllerEditedImage];
|
||||
if (selectedPhoto) {
|
||||
if (picker.sourceType == UIImagePickerControllerSourceTypeCamera) {
|
||||
UIImageWriteToSavedPhotosAlbum(selectedPhoto, nil, nil, nil);
|
||||
}
|
||||
// TODO: 更新房间头像 API
|
||||
// [self showLoading];
|
||||
// [self.presenter uploadAvatar:selectedPhoto];
|
||||
}
|
||||
[picker dismissViewControllerAnimated:YES completion:^{}];
|
||||
}
|
||||
|
||||
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
|
||||
[picker dismissViewControllerAnimated:YES completion:^{
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - XPRoomSettingProtocol
|
||||
|
||||
-(void)closeRoomGiftValueSuccessWithItemModel:(XPRoomSettingItemModel *)itemModel{
|
||||
|
Reference in New Issue
Block a user