优化个播房主播头像
This commit is contained in:
@@ -117,7 +117,9 @@
|
||||
///得到首页轮播图
|
||||
- (void)getHomeTopBannerList{
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
@kWeakify(self);
|
||||
[Api homeBannerList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
NSArray * array = [HomeBannerInfoModel modelsWithArray:data.data];
|
||||
[[self getView]getHomeTopBannerListSuccess:array];
|
||||
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
@@ -127,17 +129,9 @@
|
||||
|
||||
/// 获取所有的房间的tag
|
||||
- (void)getHomeTagList {
|
||||
// NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
// [Api homeTagComplection:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
// NSArray * array = [PIHomeCategoryTitleModel modelsWithArray:data.data];
|
||||
// for (PIHomeCategoryTitleModel *model in array) {
|
||||
// model.checkedWidth = [UILabel getWidthWithText:model.name height:kGetScaleWidth(44) font:kFontSemibold(16)];
|
||||
// model.noCheckedWidth = [UILabel getWidthWithText:model.name height:kGetScaleWidth(44) font:kFontRegular(14)];
|
||||
// }
|
||||
// [[self getView] getHomeTagListSuccess:array];
|
||||
//
|
||||
// }] uid:uid];
|
||||
@kWeakify(self);
|
||||
[Api getHomeTabsCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
// TODO: 不能在 API call 的地方返回 UI 元素
|
||||
NSArray * array = [PIHomeCategoryTitleModel modelsWithArray:data.data];
|
||||
for (PIHomeCategoryTitleModel *model in array) {
|
||||
@@ -149,14 +143,18 @@
|
||||
}
|
||||
///首页改版资源位
|
||||
-(void)getCurrentResourceList{
|
||||
@kWeakify(self);
|
||||
[Api requestCurrentResourceListCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
NSArray *list = [PIHomeItemModel modelsWithArray:data.data];
|
||||
[[self getView]getCurrentResourceListSuccess:list];
|
||||
}]];
|
||||
}]];
|
||||
}
|
||||
/// 一键匹配
|
||||
- (void)homeChatPick {
|
||||
@kWeakify(self);
|
||||
[Api homeChatPick:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
if (data.data) {
|
||||
NSString *uid = [NSString stringWithFormat:@"%@",data.data];
|
||||
[[self getView] homeChatPickSuccess:uid];
|
||||
@@ -164,6 +162,7 @@
|
||||
[[self getView] homeChatPickFail:data.message];
|
||||
}
|
||||
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
[[self getView] homeChatPickFail:msg];
|
||||
} showLoading:YES errorToast:YES]];
|
||||
}
|
||||
|
@@ -8,17 +8,20 @@
|
||||
#import "MvpViewController.h"
|
||||
#import <JXPagingView/JXPagerView.h>
|
||||
#import "PIHomeCategoryTitleModel.h"
|
||||
|
||||
@class HomeBannerInfoModel;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
|
||||
|
||||
@interface XPHomePartyViewController : MvpViewController<JXPagerViewListViewDelegate>
|
||||
@property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView);
|
||||
@property (nonatomic, copy) void(^didTapBannerItem)(HomeBannerInfoModel *itemModel);
|
||||
@property (nonatomic, copy) void(^loadBannerInfo)(void);
|
||||
|
||||
@property(nonatomic,strong) PIHomeCategoryTitleModel *tagModel;
|
||||
|
||||
|
||||
@property (nonatomic, copy) NSArray<HomeBannerInfoModel *> *bannerInfoList;
|
||||
|
||||
|
||||
@end
|
||||
|
@@ -24,10 +24,77 @@
|
||||
#import "XPHomeProtocol.h"
|
||||
///VC
|
||||
#import "XPRoomViewController.h"
|
||||
#import <SDCycleScrollView/SDCycleScrollView.h>
|
||||
#import "HomeBannerInfoModel.h"
|
||||
|
||||
@interface HomePartyBannerCell : UICollectionViewCell <SDCycleScrollViewDelegate>
|
||||
|
||||
@property (nonatomic, strong) SDCycleScrollView *bannerView;
|
||||
@property (nonatomic, copy) NSArray<HomeBannerInfoModel *> *bannerInfoList;
|
||||
@property (nonatomic, copy) void(^didTapBannerItem)(HomeBannerInfoModel *model);
|
||||
|
||||
@end
|
||||
|
||||
@implementation HomePartyBannerCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self.contentView addSubview:self.bannerView];
|
||||
[self.bannerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.contentView);
|
||||
}];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setBannerInfoList:(NSArray<HomeBannerInfoModel *> *)bannerInfoList {
|
||||
_bannerInfoList = bannerInfoList;
|
||||
NSMutableArray *picArray = @[].mutableCopy;
|
||||
for (HomeBannerInfoModel *model in bannerInfoList) {
|
||||
[picArray addObject:model.bannerPic];
|
||||
}
|
||||
self.bannerView.imageURLStringsGroup = picArray.copy;
|
||||
self.bannerView.autoScroll = YES;
|
||||
}
|
||||
|
||||
- (SDCycleScrollView *)bannerView {
|
||||
if (!_bannerView) {
|
||||
_bannerView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero
|
||||
delegate:self
|
||||
placeholderImage:[UIImageConstant defaultBannerPlaceholder]];
|
||||
_bannerView.backgroundColor = [UIColor clearColor];
|
||||
_bannerView.layer.cornerRadius = 12;
|
||||
_bannerView.layer.masksToBounds = YES;
|
||||
_bannerView.showPageControl = NO;
|
||||
_bannerView.autoScrollTimeInterval = 5.0;
|
||||
_bannerView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
|
||||
if (isMSRTL()) {
|
||||
for (UIView *subView in _bannerView.subviews) {
|
||||
subView.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight;
|
||||
}
|
||||
}
|
||||
}
|
||||
return _bannerView;
|
||||
}
|
||||
|
||||
#pragma mark - SDCycleScrollViewDelegate
|
||||
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
|
||||
HomeBannerInfoModel * bannerInfo = [self.bannerInfoList xpSafeObjectAtIndex:index];
|
||||
if (bannerInfo && self.didTapBannerItem) {
|
||||
self.didTapBannerItem(bannerInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface XPHomePartyViewController ()<UICollectionViewDelegate, UICollectionViewDataSource, XPHomeProtocol>
|
||||
///数据源
|
||||
@property (nonatomic,strong) NSMutableArray *datasource;
|
||||
@property (nonatomic,strong) NSMutableArray *displayDatasource;
|
||||
///列表
|
||||
@property (nonatomic,strong) UICollectionView *collectionView;
|
||||
///当前的页数
|
||||
@@ -35,6 +102,7 @@
|
||||
///没有新的数据了
|
||||
@property (nonatomic,assign) BOOL hasNoMoreData;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPHomePartyViewController
|
||||
@@ -100,31 +168,61 @@
|
||||
|
||||
#pragma mark - UICollectionViewDelegate And UICollectionViewDataSource
|
||||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if(self.datasource.count == 0){
|
||||
if(self.displayDatasource.count == 0){
|
||||
XPGuildEmptyCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPGuildEmptyCollectionViewCell class]) forIndexPath:indexPath];
|
||||
[cell setConstraints];
|
||||
[cell setTitle:YMLocalizedString(@"XPGuildEmptyCollectionViewCell0")];
|
||||
return cell;
|
||||
}
|
||||
XPNewHomePartyCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPNewHomePartyCollectionViewCell class]) forIndexPath:indexPath];
|
||||
cell.roomInfo = [self.datasource xpSafeObjectAtIndex:indexPath.row];
|
||||
return cell;
|
||||
id item = [self.displayDatasource xpSafeObjectAtIndex:indexPath.row];
|
||||
if ([item isKindOfClass:[NSArray class]]) {
|
||||
HomePartyBannerCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([HomePartyBannerCell class])
|
||||
forIndexPath:indexPath];
|
||||
cell.bannerInfoList = item;
|
||||
@kWeakify(self);
|
||||
[cell setDidTapBannerItem:^(HomeBannerInfoModel *model) {
|
||||
@kStrongify(self);
|
||||
if (self.didTapBannerItem) {
|
||||
self.didTapBannerItem(model);
|
||||
}
|
||||
}];
|
||||
return cell;
|
||||
} else {
|
||||
XPNewHomePartyCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPNewHomePartyCollectionViewCell class]) forIndexPath:indexPath];
|
||||
cell.roomInfo = [self.displayDatasource xpSafeObjectAtIndex:indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSInteger)collectionView:(nonnull UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
||||
if(self.datasource.count == 0)return 1;
|
||||
return self.datasource.count;
|
||||
if(self.displayDatasource.count == 0) {
|
||||
return 1;
|
||||
}
|
||||
return self.displayDatasource.count;
|
||||
}
|
||||
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if(self.datasource.count == 0)return self.collectionView.frame.size;
|
||||
return CGSizeMake(kGetScaleWidth(345), kGetScaleWidth(92));
|
||||
if(self.displayDatasource.count == 0) {
|
||||
return self.collectionView.frame.size;
|
||||
}
|
||||
|
||||
id item = [self.displayDatasource xpSafeObjectAtIndex:indexPath.row];
|
||||
if ([item isKindOfClass:[NSArray class]]) {
|
||||
return CGSizeMake(kGetScaleWidth(345), kGetScaleWidth(118));
|
||||
} else {
|
||||
return CGSizeMake(kGetScaleWidth(345), kGetScaleWidth(92));
|
||||
}
|
||||
}
|
||||
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
HomePlayRoomModel * roomInfo = [self.datasource xpSafeObjectAtIndex:indexPath.row];
|
||||
if (roomInfo.uid.length > 0) {
|
||||
[XPRoomViewController openRoom:roomInfo.uid viewController:self];
|
||||
id item = [self.displayDatasource xpSafeObjectAtIndex:indexPath.row];
|
||||
if ([item isKindOfClass:[NSArray class]]) {
|
||||
|
||||
} else {
|
||||
HomePlayRoomModel * roomInfo = (HomePlayRoomModel *)item;
|
||||
if (roomInfo.uid.length > 0) {
|
||||
[XPRoomViewController openRoom:roomInfo.uid viewController:self];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +232,9 @@
|
||||
for (HomePlayRoomModel *model in list) {
|
||||
model.width = [UILabel getWidthWithText:@(model.onlineNum).stringValue height:kGetScaleWidth(12) font:kFontBold(10)]+1;
|
||||
}
|
||||
|
||||
self.datasource = [NSMutableArray arrayWithArray:list];
|
||||
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
@@ -142,16 +242,43 @@
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"khomeVCRefreshComplete" object:nil];
|
||||
}
|
||||
|
||||
- (void)sortDataSource {
|
||||
if (!self.bannerInfoList || self.bannerInfoList.count == 0) {
|
||||
return;
|
||||
}
|
||||
NSMutableArray *mutableArrayA = [self.datasource mutableCopy];
|
||||
NSInteger insertIndex = 5;
|
||||
|
||||
// 若数组 a 不足 5,在末尾插入 b
|
||||
if (mutableArrayA.count < insertIndex) {
|
||||
[mutableArrayA addObject:self.bannerInfoList];
|
||||
} else {
|
||||
while (insertIndex < mutableArrayA.count) {
|
||||
[mutableArrayA insertObject:self.bannerInfoList atIndex:insertIndex];
|
||||
insertIndex += 6; // 插入后下一个第5个元素位置需要加上 arrayB 本身占的 1 个位置
|
||||
}
|
||||
}
|
||||
|
||||
self.displayDatasource = mutableArrayA.mutableCopy;
|
||||
}
|
||||
|
||||
- (void)getHomeRecommendRoomListSuccess:(NSArray *)list{
|
||||
[self.collectionView.mj_footer endRefreshing];
|
||||
for (HomePlayRoomModel *model in list) {
|
||||
model.width = [UILabel getWidthWithText:@(model.onlineNum).stringValue height:kGetScaleWidth(12) font:kFontBold(10)]+1;
|
||||
}
|
||||
|
||||
if(self.page == 1){
|
||||
self.datasource = [NSMutableArray arrayWithArray:list];
|
||||
}else{
|
||||
[self.datasource addObjectsFromArray:list];
|
||||
}
|
||||
|
||||
if (!self.bannerInfoList) {
|
||||
self.loadBannerInfo();
|
||||
}
|
||||
[self sortDataSource];
|
||||
|
||||
[self.collectionView reloadData];
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"khomeVCRefreshComplete" object:nil];
|
||||
}
|
||||
@@ -217,7 +344,9 @@
|
||||
|
||||
-(void)setTagModel:(PIHomeCategoryTitleModel *)tagModel{
|
||||
_tagModel = tagModel;
|
||||
@kWeakify(self);
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
@kStrongify(self);
|
||||
[self headerRefresh];
|
||||
});
|
||||
}
|
||||
@@ -235,6 +364,8 @@
|
||||
_collectionView.tag = 78574;
|
||||
[_collectionView registerClass:[XPNewHomePartyCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPNewHomePartyCollectionViewCell class])];
|
||||
[_collectionView registerClass:[XPGuildEmptyCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPGuildEmptyCollectionViewCell class])];
|
||||
[_collectionView registerClass:[HomePartyBannerCell class] forCellWithReuseIdentifier:NSStringFromClass([HomePartyBannerCell class])];
|
||||
_collectionView.contentInset = UIEdgeInsetsMake(0, 0, 10, 0);
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
|
@@ -73,6 +73,9 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
|
||||
@property(nonatomic,assign) BOOL isCheckIp;
|
||||
@property(nonatomic,assign) NSInteger type;
|
||||
@property(nonatomic,strong) NSMutableDictionary *validListDict;
|
||||
|
||||
@property (nonatomic, copy) NSArray<HomeBannerInfoModel *> *bannerInfoList;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPNewHomeViewController
|
||||
@@ -195,6 +198,18 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
|
||||
PIHomeCategoryTitleModel *tagModel = [self.tagModelList xpSafeObjectAtIndex:self.type];
|
||||
XPHomePartyViewController *homeVC = [self.validListDict objectForKey:[NSNumber numberWithInteger:self.type]];
|
||||
homeVC.tagModel = tagModel;
|
||||
homeVC.bannerInfoList = self.bannerInfoList;
|
||||
@kWeakify(self);
|
||||
[homeVC setDidTapBannerItem:^(HomeBannerInfoModel * _Nonnull itemModel) {
|
||||
@kStrongify(self);
|
||||
[self handleTapBannerItem:itemModel];
|
||||
}];
|
||||
@kWeakify(homeVC);
|
||||
[homeVC setLoadBannerInfo:^{
|
||||
@kStrongify(self);
|
||||
@kStrongify(homeVC);
|
||||
homeVC.bannerInfoList = self.bannerInfoList;
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)openRoomNotification:(NSNotification *)notification{
|
||||
@@ -316,7 +331,19 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
|
||||
return homeV;
|
||||
}
|
||||
XPHomePartyViewController *homeVC = [[XPHomePartyViewController alloc] init];
|
||||
homeVC.bannerInfoList = self.bannerInfoList;
|
||||
homeVC.tagModel = [self.tagModelList xpSafeObjectAtIndex:index];
|
||||
@kWeakify(self);
|
||||
[homeVC setDidTapBannerItem:^(HomeBannerInfoModel * _Nonnull itemModel) {
|
||||
@kStrongify(self);
|
||||
[self handleTapBannerItem:itemModel];
|
||||
}];
|
||||
@kWeakify(homeVC);
|
||||
[homeVC setLoadBannerInfo:^{
|
||||
@kStrongify(self);
|
||||
@kStrongify(homeVC);
|
||||
homeVC.bannerInfoList = self.bannerInfoList;
|
||||
}];
|
||||
[self.validListDict setObject:homeVC forKey:@(index)];
|
||||
return homeVC;
|
||||
}
|
||||
@@ -350,6 +377,7 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
|
||||
- (void)getHomeTopDataSuccess:(NSArray*)list menuList:(NSArray *)memuList{
|
||||
self.headView.itemList = memuList;
|
||||
self.headView.bannerList = list;
|
||||
self.bannerInfoList = list;
|
||||
[self.pagingView reloadData];
|
||||
[self.pagingView resizeTableHeaderViewHeightWithAnimatable:NO duration:0 curve:0];
|
||||
}
|
||||
@@ -455,24 +483,7 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
|
||||
}
|
||||
}
|
||||
-(void)selectBannerListWithModel:(HomeBannerInfoModel *)model{
|
||||
switch (model.skipType) {
|
||||
case HomeBannerInfoSkipType_Room:
|
||||
{
|
||||
if (model.skipUri.length > 0) {
|
||||
[XPRoomViewController openRoom:model.skipUri viewController:self];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HomeBannerInfoSkipType_Web:
|
||||
{
|
||||
XPWebViewController *vc = [[XPWebViewController alloc] initWithRoomUID:nil];
|
||||
vc.url = model.skipUri;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
[self handleTapBannerItem:model];
|
||||
}
|
||||
///点击了进入房间
|
||||
- (void)xPHomeRecommendOtherRoomView:(XPHomeRecommendOtherRoomView *)view didClickEnterRoom:(HomeMenuSourceModel *)model{
|
||||
@@ -481,6 +492,28 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
- (void)handleTapBannerItem:(HomeBannerInfoModel *)model {
|
||||
switch (model.skipType) {
|
||||
case HomeBannerInfoSkipType_Room:
|
||||
{
|
||||
if (model.skipUri.length > 0) {
|
||||
[XPRoomViewController openRoom:model.skipUri viewController:self];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HomeBannerInfoSkipType_Web:
|
||||
{
|
||||
XPWebViewController *vc = [[XPWebViewController alloc] initWithRoomUID:nil];
|
||||
vc.url = model.skipUri;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (JXCategoryTitleView *)titleView {
|
||||
if (!_titleView) {
|
||||
|
@@ -73,6 +73,7 @@
|
||||
if ([self.subviews containsObject:self.leaveLabel]) {
|
||||
[self.leaveLabel removeFromSuperview];
|
||||
}
|
||||
self.avatarImageView.imageUrl = userInfo.avatar;
|
||||
} else {
|
||||
if (![self.subviews containsObject:self.leaveLabel]) {
|
||||
[self insertSubview:self.leaveLabel belowSubview:self.giftValueView];
|
||||
|
@@ -155,10 +155,12 @@
|
||||
- (void)initNIMMicroQueues {
|
||||
RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo;
|
||||
// 获取麦位的状态,并初始化 self.micQueue 。
|
||||
@kWeakify(self);
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchChatroomInfo:[NSString stringWithFormat:@"%ld", (long)roomInfo.roomId] completion:^(NSError * _Nullable error, NIMChatroom * _Nullable chatroom) {
|
||||
if (error) {
|
||||
return;
|
||||
}
|
||||
@kStrongify(self);
|
||||
NSDictionary *info = (NSDictionary *)[chatroom.ext toJSONObject];
|
||||
NSDictionary *micState = [info[@"micQueue"] toJSONObject];
|
||||
for (NSString *position in micState.allKeys) {
|
||||
@@ -172,6 +174,7 @@
|
||||
// 获取麦位的用户,并初始化 self.micQueue 。
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchChatroomQueue:[NSString stringWithFormat:@"%ld", (long)roomInfo.roomId] completion:^(NSError * _Nullable error, NSArray<NSDictionary<NSString *,NSString *> *> * _Nullable info) {
|
||||
if (error) return;
|
||||
@kStrongify(self);
|
||||
BOOL ownerRTCChange = NO;
|
||||
MicroQueueModel *meQuence = nil;
|
||||
for (NSDictionary *item in info) {
|
||||
@@ -211,10 +214,12 @@
|
||||
-(void)updateNIMMicroQueues{
|
||||
RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo;
|
||||
// 获取麦位的状态,并初始化 self.micQueue 。
|
||||
@kWeakify(self);
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchChatroomInfo:[NSString stringWithFormat:@"%ld", (long)roomInfo.roomId] completion:^(NSError * _Nullable error, NIMChatroom * _Nullable chatroom) {
|
||||
if (error) {
|
||||
return;
|
||||
}
|
||||
@kStrongify(self);
|
||||
NSDictionary *info = (NSDictionary *)[chatroom.ext toJSONObject];
|
||||
NSDictionary *micState = [info[@"micQueue"] toJSONObject];
|
||||
for (NSString *position in micState.allKeys) {
|
||||
@@ -228,6 +233,7 @@
|
||||
// 获取麦位的用户,并初始化 self.micQueue 。
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchChatroomQueue:[NSString stringWithFormat:@"%ld", (long)roomInfo.roomId] completion:^(NSError * _Nullable error, NSArray<NSDictionary<NSString *,NSString *> *> * _Nullable info) {
|
||||
if (error) return;
|
||||
@kStrongify(self);
|
||||
BOOL ownerRTCChange = NO;
|
||||
|
||||
for (NSDictionary *item in info) {
|
||||
@@ -269,9 +275,16 @@
|
||||
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
|
||||
BOOL leaveMode = roomInfo.leaveMode;
|
||||
NSMutableArray *statisMicArray = [NSMutableArray array];
|
||||
|
||||
MicroQueueModel *anchorModel = nil;
|
||||
|
||||
for (int i = 0; i < self.countOfMicroView; i++) {
|
||||
MicroQueueModel * model = [self.micQueue objectForKey:[self indexToPosition:i]];
|
||||
|
||||
|
||||
if (model.microState.position == -1) {
|
||||
anchorModel = model;
|
||||
}
|
||||
|
||||
UIView<MicroViewProtocol> * view = [self findMicroViewByIndex:i];
|
||||
[view configRoomInfo:roomInfo];
|
||||
[view configMicQueue:self.micQueue];
|
||||
@@ -307,7 +320,7 @@
|
||||
}
|
||||
if (leaveMode) {
|
||||
UserInfoModel *owner = [[UserInfoModel alloc] init];
|
||||
owner.avatar = roomInfo.avatar;
|
||||
owner.avatar = anchorModel.userInfo.avatar? anchorModel.userInfo.avatar : roomInfo.avatar;
|
||||
owner.nick = roomInfo.nick;
|
||||
owner.uid = roomInfo.uid;
|
||||
owner.gender = roomInfo.gender;
|
||||
|
@@ -835,12 +835,10 @@
|
||||
switch (model.type) {
|
||||
case UserCardMicroType_UpDown: {
|
||||
// VIP 防 T 权限
|
||||
if (self.targetUserInfo.userVipInfoVO.preventKick) {
|
||||
if (self.targetUserInfo.userVipInfoVO.preventKick &&
|
||||
self.targetUserInfo.uid != [AccountInfoStorage instance].getUid.integerValue) {
|
||||
NSString *message = [NSString stringWithFormat:YMLocalizedString(@"UserCard_1.0.17_0"), @(self.targetUserInfo.userVipInfoVO.vipLevel)];
|
||||
[TTPopup alertWithMessage:YMLocalizedString(@"UserCard_1.0.17_1") confirmHandler:^{
|
||||
|
||||
} cancelHandler:^{
|
||||
}];
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:message];
|
||||
return;
|
||||
}
|
||||
if (model.status) {
|
||||
@@ -923,13 +921,14 @@
|
||||
case UserCardItemType_KickOut:
|
||||
{
|
||||
// 1、判断是否为防被踢用户
|
||||
if (self.targetUserInfo.userVipInfoVO.preventKick) {
|
||||
if (self.targetUserInfo.userVipInfoVO.preventKick &&
|
||||
self.targetUserInfo.uid != [AccountInfoStorage instance].getUid.integerValue) {
|
||||
//2、判断是否为管理员操作
|
||||
// if (self.cardInfo.roomInfo.uid != [AccountInfoStorage instance].getUid.integerValue) {
|
||||
// [self showErrorToast:[NSString stringWithFormat:YMLocalizedString(@"XPUserCardViewController5"), self.targetUserInfo.userVipInfoVO.vipName]];
|
||||
// } else {//房主操作
|
||||
NSString *message = [NSString stringWithFormat:YMLocalizedString(@"UserCard_1.0.17_0"), @(self.targetUserInfo.userVipInfoVO.vipLevel)];
|
||||
[TTPopup alertWithMessage:YMLocalizedString(@"UserCard_1.0.17_1") confirmHandler:^{
|
||||
[TTPopup alertWithMessage:message confirmHandler:^{
|
||||
|
||||
} cancelHandler:^{
|
||||
}];
|
||||
@@ -986,9 +985,10 @@
|
||||
case UserCardItemType_Black:
|
||||
{
|
||||
// 1、判断是否为防被踢用户
|
||||
if (self.targetUserInfo.userVipInfoVO.preventKick) {
|
||||
if (self.targetUserInfo.userVipInfoVO.preventKick &&
|
||||
self.targetUserInfo.uid != [AccountInfoStorage instance].getUid.integerValue) {
|
||||
NSString *message = [NSString stringWithFormat:YMLocalizedString(@"UserCard_1.0.17_0"), @(self.targetUserInfo.userVipInfoVO.vipLevel)];
|
||||
[TTPopup alertWithMessage:YMLocalizedString(@"UserCard_1.0.17_1") confirmHandler:^{
|
||||
[TTPopup alertWithMessage:message confirmHandler:^{
|
||||
|
||||
} cancelHandler:^{
|
||||
}];
|
||||
|
Reference in New Issue
Block a user