553 lines
23 KiB
Objective-C
553 lines
23 KiB
Objective-C
//
|
||
// XPRoomMoreMenuViewController.m
|
||
// xplan-ios
|
||
//
|
||
// Created by 冯硕 on 2021/12/11.
|
||
//
|
||
|
||
#import "XPRoomMoreMenuViewController.h"
|
||
///Third
|
||
#import <Masonry/Masonry.h>
|
||
///Tool
|
||
#import "XPMacro.h"
|
||
#import "TTPopup.h"
|
||
#import "XPConstant.h"
|
||
#import "AccountInfoStorage.h"
|
||
#import "ThemeColor.h"
|
||
#import "RtcManager.h"
|
||
#import "StatisticsServiceHelper.h"
|
||
///Model
|
||
#import "XPRoomMoreItemModel.h"
|
||
#import "RoomInfoModel.h"
|
||
#import "AttachmentModel.h"
|
||
#import "GuildSuperAdminInfoModel.h"
|
||
#import "AccountInfoStorage.h"
|
||
#import "NSArray+Safe.h"
|
||
///View
|
||
#import "XPRoomMoreMenuCollectionViewCell.h"
|
||
#import "XPRoomInviteFansView.h"
|
||
#import "XPAcrossRoomPKViewController.h"
|
||
#import "XPAnchorPKViewController.h"
|
||
#import "XPRoomSettingViewController.h"
|
||
#import "XPReleaseRadioViewController.h"
|
||
#import "XPRoomTrumpetViewController.h"
|
||
#import "XPRoomPKViewController.h"
|
||
#import "XPRoomSendRedPacketViewController.h"
|
||
#import "BaseNavigationController.h"
|
||
#import "XPWishGiftCreateViewController.h"
|
||
#import "XPAnchorPKSelectTypeController.h"
|
||
///P
|
||
#import "XPMoreMenuPresenter.h"
|
||
#import "XPMoreMenuProtocol.h"
|
||
|
||
UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
|
||
|
||
@interface XPRoomMoreMenuViewController ()<UICollectionViewDelegate, UICollectionViewDataSource,XPMoreMenuProtocol>
|
||
///顶部的View
|
||
@property (nonatomic,strong) UIView * topView;
|
||
///模糊背景
|
||
@property (nonatomic, strong) UIVisualEffectView *effectView;
|
||
///列表
|
||
@property (nonatomic,strong) UICollectionView *collectionView;
|
||
///底部的View
|
||
@property (nonatomic,strong) UIView * bottomView;
|
||
///数据源
|
||
@property (nonatomic,strong) NSArray<XPRoomMoreItemModel *> *datasource;
|
||
///房间信息
|
||
@property (nonatomic,strong) RoomInfoModel *roomInfo;
|
||
|
||
@property (nonatomic,assign) id<RoomHostDelegate> hostDelegate;
|
||
@end
|
||
|
||
@implementation XPRoomMoreMenuViewController
|
||
|
||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate{
|
||
if (self = [super init]) {
|
||
self.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||
self.roomInfo = delegate.getRoomInfo;
|
||
self.hostDelegate = delegate;
|
||
}
|
||
return self;
|
||
}
|
||
|
||
- (XPMoreMenuPresenter *)createPresenter {
|
||
return [[XPMoreMenuPresenter alloc] init];
|
||
}
|
||
|
||
- (void)viewDidLoad {
|
||
[super viewDidLoad];
|
||
[self initSubViews];
|
||
[self initSubViewConstraints];
|
||
///自己是公会超管
|
||
BOOL meIsSuperAdmin = NO;
|
||
for (GuildSuperAdminInfoModel *managerInfo in self.hostDelegate.getRoomSuperAdminList) {
|
||
if ([managerInfo.uid isEqualToString:[AccountInfoStorage instance].getUid]) {
|
||
meIsSuperAdmin = YES;
|
||
break;
|
||
}
|
||
}
|
||
[self.presenter getMoreMenuDataSource:self.roomInfo isSuperAdmin:meIsSuperAdmin];
|
||
}
|
||
|
||
#pragma mark - Private Method
|
||
- (void)initSubViews {
|
||
self.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||
self.view.backgroundColor = [UIColor clearColor];
|
||
[self.view addSubview:self.topView];
|
||
[self.view addSubview:self.effectView];
|
||
[self.view addSubview:self.collectionView];
|
||
[self.view addSubview:self.bottomView];
|
||
}
|
||
|
||
- (void)initSubViewConstraints {
|
||
[self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.right.top.mas_equalTo(self.view);
|
||
make.bottom.mas_equalTo(self.collectionView.mas_top);
|
||
}];
|
||
|
||
[self.effectView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.right.mas_equalTo(0);
|
||
make.top.mas_equalTo(self.collectionView);
|
||
make.bottom.mas_equalTo(self.bottomView);
|
||
}];
|
||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.right.mas_equalTo(self.view);
|
||
make.height.mas_equalTo(0);
|
||
make.bottom.mas_equalTo(self.bottomView.mas_top);
|
||
}];
|
||
|
||
[self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.right.bottom.mas_equalTo(self.view);
|
||
make.height.mas_equalTo(kSafeAreaBottomHeight);
|
||
}];
|
||
}
|
||
|
||
#pragma mark - XPMoreMenuProtocol
|
||
- (void)getMoreMenuDataSuccess:(NSArray<XPRoomMoreItemModel *> *)list {
|
||
self.datasource = list;
|
||
[self.collectionView reloadData];
|
||
CGFloat contentHeight= 24 + 36;
|
||
CGFloat itemHeight = 50;
|
||
int page = list.count % 5;
|
||
int scale = (int)list.count / (int)5;
|
||
if (page == 0) {
|
||
contentHeight += (scale *itemHeight);
|
||
} else {
|
||
contentHeight += ((scale+1) *itemHeight + scale * 12);
|
||
}
|
||
CAShapeLayer * layer = [CAShapeLayer layer];
|
||
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, contentHeight) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(8, 8)];
|
||
layer.path = path.CGPath;
|
||
self.collectionView.layer.mask = layer;
|
||
[self.collectionView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||
make.height.mas_equalTo(contentHeight);
|
||
}];
|
||
}
|
||
|
||
- (void)openRoomGiftValueSuccess {
|
||
[self showSuccessToast:@"开启礼物值成功"];
|
||
[self dismissViewControllerAnimated:YES completion:nil];
|
||
}
|
||
|
||
- (void)closeRoomGiftValueSuccess {
|
||
[self showSuccessToast:@"关闭礼物值成功"];
|
||
[self dismissViewControllerAnimated:YES completion:nil];
|
||
}
|
||
|
||
/// 设置公屏开关
|
||
- (void)updateRoomMessageScreenStateSuccess:(RoomInfoModel *)roomInfo {
|
||
AttachmentModel *attachement = [[AttachmentModel alloc]init];
|
||
attachement.first = CustomMessageType_Update_RoomInfo;
|
||
attachement.second = Custom_Message_Sub_Update_RoomInfo_MessageState;
|
||
attachement.data = @{@"roomInfo":roomInfo.model2dictionary};
|
||
NIMMessage *message = [[NIMMessage alloc]init];
|
||
NIMCustomObject *object = [[NIMCustomObject alloc] init];
|
||
object.attachment = attachement;
|
||
message.messageObject = object;
|
||
//构造会话
|
||
NSString * roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
|
||
NIMSession *session = [NIMSession session:roomId type:NIMSessionTypeChatroom];
|
||
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
|
||
[self dismissViewControllerAnimated:YES completion:nil];
|
||
}
|
||
|
||
///清空公屏成功
|
||
- (void)cleanScreenSuccess {
|
||
[self dismissViewControllerAnimated:YES completion:nil];
|
||
}
|
||
|
||
- (void)openRoomDatingSuccess {
|
||
[self dismissViewControllerAnimated:YES completion:nil];
|
||
}
|
||
|
||
- (void)closeRoomDatingSuccess {
|
||
[self dismissViewControllerAnimated:YES completion:nil];
|
||
}
|
||
|
||
///发布房间广播
|
||
- (void)getReleaseRadioSuccess:(XPReleaseRadioModel *)model {
|
||
[self dismissViewControllerAnimated:YES completion:nil];
|
||
XPReleaseRadioViewController * releaseRadioVC = [[XPReleaseRadioViewController alloc] initWithDelegate:self.hostDelegate];
|
||
releaseRadioVC.model = model;
|
||
releaseRadioVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||
[self.hostDelegate.getCurrentNav presentViewController:releaseRadioVC animated:YES completion:nil];
|
||
}
|
||
///获取房间贵族小喇叭
|
||
- (void)getTrumpetSuccess:(XPNobleTrumpetModel *)model {
|
||
[self dismissViewControllerAnimated:YES completion:nil];
|
||
XPRoomTrumpetViewController * trumpetVC = [[XPRoomTrumpetViewController alloc] initWithDelegate:self.hostDelegate];
|
||
trumpetVC.model = model;
|
||
trumpetVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||
[self.hostDelegate.getCurrentNav presentViewController:trumpetVC animated:YES completion:nil];
|
||
}
|
||
|
||
///结束个播PK失败
|
||
- (void)endAnchorPkSuccess:(BOOL)success msg:(NSString *)msg {
|
||
if (!success) {
|
||
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
||
config.message = msg;
|
||
config.actionStyle = TTAlertActionConfirmStyle;
|
||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||
} cancelHandler:^{
|
||
}];
|
||
} else {
|
||
[self dismissViewControllerAnimated:YES completion:nil];
|
||
}
|
||
}
|
||
|
||
- (void)cancelMatchRandomPKSuccess {
|
||
self.hostDelegate.getRoomInfo.pkMatchStartTime = nil;
|
||
[[NSNotificationCenter defaultCenter] postNotificationName:@"cancelMatchRandomPK" object:nil];
|
||
[self dismissViewControllerAnimated:YES completion:nil];
|
||
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid];
|
||
XPAnchorPKSelectTypeController *selectVc = [[XPAnchorPKSelectTypeController alloc] initWithRoomUid:roomUid];
|
||
[self.hostDelegate.getCurrentNav presentViewController:selectVc animated:YES completion:nil];
|
||
}
|
||
|
||
#pragma mark - UICollectionViewDelegate And UICollectionViewDatasource
|
||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
||
return self.datasource.count;
|
||
}
|
||
|
||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||
XPRoomMoreMenuCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPRoomMoreMenuCollectionViewCell class]) forIndexPath:indexPath];
|
||
cell.itemModel = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||
return cell;
|
||
}
|
||
|
||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
|
||
XPRoomMoreItemModel * item = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||
NSString * roomUid = [NSString stringWithFormat:@"%ld",self.roomInfo.uid];
|
||
NSString * roomId = [NSString stringWithFormat:@"%ld", self.roomInfo.roomId];
|
||
switch (item.type) {
|
||
case RoomMoreMenuType_Gift_Value_Close:
|
||
{
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"closeGiftValue"}];
|
||
if (self.roomInfo.roomModeType == RoomModeType_Open_Blind) {
|
||
[self showErrorToast:@"相亲模式中不能关闭房间礼物值"];
|
||
return;
|
||
}
|
||
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
||
config.title = @"";
|
||
config.message = @"关闭礼物值将会清除当前麦上所有礼物值数据,确认关闭吗?";
|
||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||
[self.presenter closeRoomGiftValue:roomUid];
|
||
} cancelHandler:^{
|
||
|
||
}];
|
||
}
|
||
break;
|
||
case RoomMoreMenuType_Gift_Value_Open:
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"openGiftValue"}];
|
||
[self.presenter openRoomGiftValue:roomUid];
|
||
break;
|
||
case RoomMoreMenuType_Message_Screen_Open:
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"openScreen"}];
|
||
[self.presenter updateRoomMessageScreenState:NO roomId:roomId];
|
||
break;
|
||
case RoomMoreMenuType_Message_Screen_Close:
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"closeScreen"}];
|
||
[self.presenter updateRoomMessageScreenState:YES roomId:roomId];
|
||
break;
|
||
case RoomMoreMenuType_Gift_Effect_Open:
|
||
{
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"openGiftEffect"}];
|
||
[self showSuccessToast:@"礼物特效已开启"];
|
||
NSDictionary * dic = @{@"hasAnimationEffect": @(1)};
|
||
[[NSNotificationCenter defaultCenter] postNotificationName:kRoomGiftEffectUpdateNotificationKey object:dic];
|
||
[self dismissViewControllerAnimated:YES completion:nil];
|
||
}
|
||
break;
|
||
case RoomMoreMenuType_Gift_Effect_Close:
|
||
{
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"closeGiftEffect"}];
|
||
[self showSuccessToast:@"礼物特效已关闭"];
|
||
NSDictionary * dic = @{@"hasAnimationEffect": @(0)};
|
||
[[NSNotificationCenter defaultCenter] postNotificationName:kRoomGiftEffectUpdateNotificationKey object:dic];
|
||
[self dismissViewControllerAnimated:YES completion:nil];
|
||
}
|
||
break;
|
||
case RoomMoreMenuType_Invite_Fans:
|
||
{
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"inviteFans"}];
|
||
[self dismissViewControllerAnimated:YES completion:nil];
|
||
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid];
|
||
XPRoomInviteFansView * inviteFansView = [[XPRoomInviteFansView alloc]initWithRoomUid:roomUid];
|
||
[TTPopup popupView:inviteFansView style:TTPopupStyleActionSheet];
|
||
}
|
||
break;
|
||
case RoomMoreMenuType_Room_Setting:
|
||
{
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"roomSetting"}];
|
||
[self dismissViewControllerAnimated:YES completion:nil];
|
||
XPRoomSettingViewController * roomsettingVC = [[XPRoomSettingViewController alloc] initWithDelegate:self.hostDelegate];
|
||
[self.hostDelegate.getCurrentNav pushViewController:roomsettingVC animated:YES];
|
||
}
|
||
break;
|
||
case RoomMoreMenuType_Room_Dating_Open:
|
||
{
|
||
if (self.roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode) {
|
||
[self showErrorToast:@"跨房PK中不可开启相亲模式!"];
|
||
[self dismissViewControllerAnimated:NO completion:nil];
|
||
return;
|
||
}
|
||
|
||
if (self.roomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
||
[self showErrorToast:@"房间PK中不可开启相亲模式!"];
|
||
[self dismissViewControllerAnimated:NO completion:nil];
|
||
return;
|
||
}
|
||
|
||
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
||
config.message = @"开启相亲模式?开启同时现有礼物值将被清空";
|
||
config.confirmButtonConfig.title = @"开启";
|
||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||
[self.presenter openRoomDating:roomUid];
|
||
} cancelHandler:^{
|
||
}];
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"openRoomDating"}];
|
||
}
|
||
break;
|
||
case RoomMoreMenuType_Room_Dating_Close:
|
||
{
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"closeRoomDating"}];
|
||
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
||
config.title = @"提示";
|
||
config.message = @"关闭相亲模式?";
|
||
config.confirmButtonConfig.title = @"关闭";
|
||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||
[self.presenter closeRoomDating:roomUid];
|
||
} cancelHandler:^{
|
||
|
||
}];
|
||
}
|
||
break;
|
||
case RoomMoreMenuType_Release_Radio:
|
||
{
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"releaseRadio"}];
|
||
[self.presenter getRoomRadioMessageListWithType:[NSString stringWithFormat:@"%zd", self.roomInfo.type]];
|
||
}
|
||
break;
|
||
case RoomMoreMenuType_Room_trumpet:
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"trumpet"}];
|
||
[self.presenter getRoomgetUserVipRoomTrumpet:roomUid];
|
||
break;
|
||
case RoomMoreMenuType_Room_Across_PK_Open:
|
||
{
|
||
if (self.roomInfo.roomModeType == RoomModeType_Open_Blind) {
|
||
[self showErrorToast:@"相亲中不可开启跨房PK!"];
|
||
[self dismissViewControllerAnimated:NO completion:nil];
|
||
return;
|
||
}
|
||
|
||
if (self.roomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
||
[self showErrorToast:@"PK中不可以开启跨房PK!"];
|
||
[self dismissViewControllerAnimated:NO completion:nil];
|
||
return;
|
||
}
|
||
[self dismissViewControllerAnimated:NO completion:nil];
|
||
XPAcrossRoomPKViewController * acrossRoomPKVC = [[XPAcrossRoomPKViewController alloc] initWithRoomUid:roomUid];
|
||
[self.hostDelegate.getCurrentNav presentViewController:acrossRoomPKVC animated:YES completion:nil];
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"openAcrossPk"}];
|
||
}
|
||
break;
|
||
case RoomMoreMenuType_Room_Across_PK_Close:
|
||
{
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"closeAcrossPk"}];
|
||
[self showErrorToast:@"正在跨房PK中!"];
|
||
[self dismissViewControllerAnimated:NO completion:nil];
|
||
}
|
||
break;
|
||
case RoomMoreMenuType_Room_Anchor_PK_Open:
|
||
{
|
||
if (self.hostDelegate.getRoomInfo.pkMatchStartTime) {//PK匹配中
|
||
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
||
config.message = @"取消匹配?";
|
||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||
[self.presenter requestCancelMatchRandomPK:roomUid];
|
||
} cancelHandler:^{
|
||
}];
|
||
} else {
|
||
[self dismissViewControllerAnimated:NO completion:nil];
|
||
XPAnchorPKSelectTypeController *selectVc = [[XPAnchorPKSelectTypeController alloc] initWithRoomUid:roomUid];
|
||
[self.hostDelegate.getCurrentNav presentViewController:selectVc animated:YES completion:nil];
|
||
}
|
||
}
|
||
break;
|
||
case RoomMoreMenuType_Room_Anchor_PK_Close:
|
||
{
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"closeAnchorPk"}];
|
||
if (self.roomInfo.pkState == AcrossRoomPkStateTypePenalty) {
|
||
if ([self.roomInfo.winUid isEqualToString:[AccountInfoStorage instance].getUid]) {//赢
|
||
if (self.roomInfo.roundId) {
|
||
[self.presenter requestFinishAnchorPK:[NSString stringWithFormat:@"%ld", self.roomInfo.roundId]];
|
||
}
|
||
} else if ([self.roomInfo.winUid isEqualToString:self.roomInfo.pkUid]) {//输
|
||
|
||
} else {//平局
|
||
if (self.roomInfo.roundId) {
|
||
[self.presenter requestFinishAnchorPK:[NSString stringWithFormat:@"%ld", self.roomInfo.roundId]];
|
||
}
|
||
}
|
||
} else {
|
||
if (self.roomInfo.roundId) {
|
||
[self.presenter requestFinishAnchorPK:[NSString stringWithFormat:@"%ld", self.roomInfo.roundId]];
|
||
}
|
||
}
|
||
|
||
}
|
||
break;
|
||
case RoomMoreMenuType_Message_Screen_Clear:
|
||
{
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"clearScreen"}];
|
||
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
||
config.title = @"提示";
|
||
config.message = @"确定要清空公屏消息吗?\n(清空后不可恢复哦~)";
|
||
config.confirmButtonConfig.title = @"确定";
|
||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||
[self.presenter cleanScreen:roomUid uid:[AccountInfoStorage instance].getUid];
|
||
} cancelHandler:^{
|
||
}];
|
||
}
|
||
break;
|
||
|
||
case RoomMoreMenuType_Room_PK_Open:
|
||
{
|
||
if (self.roomInfo.roomModeType == RoomModeType_Open_Blind) {
|
||
[self showErrorToast:@"相亲中不可以开启PK模式!"];
|
||
[self dismissViewControllerAnimated:NO completion:nil];
|
||
return;
|
||
}
|
||
|
||
if (self.roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode) {
|
||
[self showErrorToast:@"跨房PK中不可以开启PK模式!"];
|
||
[self dismissViewControllerAnimated:NO completion:nil];
|
||
return;
|
||
}
|
||
|
||
[self dismissViewControllerAnimated:NO completion:nil];
|
||
XPRoomPKViewController * roomPKVC = [[XPRoomPKViewController alloc] initWithDelegate:self.hostDelegate];
|
||
[self.hostDelegate.getCurrentNav pushViewController:roomPKVC animated:YES];
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"openRoomPk"}];
|
||
}
|
||
break;
|
||
case RoomMoreMenuType_Room_PK_Close:
|
||
{
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"closeRoomPk"}];
|
||
[self dismissViewControllerAnimated:NO completion:nil];
|
||
XPRoomPKViewController * roomPKVC = [[XPRoomPKViewController alloc] initWithDelegate:self.hostDelegate];
|
||
[self.hostDelegate.getCurrentNav pushViewController:roomPKVC animated:YES];
|
||
}
|
||
break;
|
||
case RoomMoreMenuType_Room_redPacket:
|
||
{
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"redPacket"}];
|
||
[self dismissViewControllerAnimated:YES completion:nil];
|
||
XPRoomSendRedPacketViewController *sendRedPacketVC = [[XPRoomSendRedPacketViewController alloc] initWithDelegate:self.hostDelegate];
|
||
sendRedPacketVC.roomUid = roomUid;
|
||
sendRedPacketVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||
BaseNavigationController *nav = [[BaseNavigationController alloc] initWithRootViewController:sendRedPacketVC];
|
||
nav.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||
[self.hostDelegate.getCurrentNav presentViewController:nav animated:YES completion:nil];
|
||
}
|
||
break;
|
||
case RoomMoreMenuType_Room_Voice:
|
||
{
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"voice"}];
|
||
[self dismissViewControllerAnimated:YES completion:nil];
|
||
[RtcManager instance].remoteMuted = !item.isSelected;
|
||
item.isSelected = [RtcManager instance].isRemoteMuted;
|
||
}
|
||
break;
|
||
case RoomMoreMenuType_Room_Wish_Gift:
|
||
{
|
||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"redPacket"}];
|
||
[self dismissViewControllerAnimated:YES completion:nil];
|
||
|
||
XPWishGiftCreateViewController *wishGiftVC = [[XPWishGiftCreateViewController alloc] initWithDelegate:self.hostDelegate];
|
||
[self.hostDelegate.getCurrentNav pushViewController:wishGiftVC animated:YES];
|
||
}
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
#pragma mark - Event Response
|
||
- (void)disMissRecognizer {
|
||
[self dismissViewControllerAnimated:YES completion:nil];
|
||
}
|
||
|
||
#pragma mark - Getters And Setters
|
||
- (UICollectionView *)collectionView{
|
||
if (!_collectionView) {
|
||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||
layout.sectionInset = UIEdgeInsetsMake(24, 0, 10, 0);
|
||
layout.itemSize = CGSizeMake(KScreenWidth /5, 50);
|
||
layout.minimumLineSpacing = 12;
|
||
layout.minimumInteritemSpacing = 0;
|
||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||
_collectionView.dataSource = self;
|
||
_collectionView.delegate = self;
|
||
_collectionView.backgroundColor = [UIColor clearColor];
|
||
_collectionView.alpha = 0.9;
|
||
_collectionView.scrollEnabled = NO;
|
||
[_collectionView registerClass:[XPRoomMoreMenuCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPRoomMoreMenuCollectionViewCell class])];
|
||
}
|
||
return _collectionView;
|
||
}
|
||
|
||
- (UIView *)topView {
|
||
if (!_topView) {
|
||
_topView = [[UIView alloc] init];
|
||
_topView.backgroundColor = [UIColor clearColor];
|
||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(disMissRecognizer)];
|
||
[_topView addGestureRecognizer:tap];
|
||
}
|
||
return _topView;
|
||
}
|
||
|
||
- (UIView *)bottomView {
|
||
if (!_bottomView) {
|
||
_bottomView = [[UIView alloc] init];
|
||
}
|
||
return _bottomView;
|
||
}
|
||
|
||
- (UIVisualEffectView *)effectView {
|
||
if (!_effectView) {
|
||
UIBlurEffect *beffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
|
||
_effectView = [[UIVisualEffectView alloc] initWithEffect:beffect];
|
||
|
||
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, KScreenHeight) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(8, 8)];
|
||
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
|
||
maskLayer.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
|
||
maskLayer.path = maskPath.CGPath;
|
||
_effectView.layer.mask = maskLayer;
|
||
}
|
||
return _effectView;
|
||
}
|
||
|
||
@end
|