Files
yinmeng-ios/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m

553 lines
23 KiB
Mathematica
Raw Normal View History

2021-12-11 18:53:07 +08:00
//
// 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"
2022-01-02 17:16:12 +08:00
#import "XPConstant.h"
#import "AccountInfoStorage.h"
2022-05-24 18:03:41 +08:00
#import "ThemeColor.h"
2022-09-30 18:30:41 +08:00
#import "RtcManager.h"
2022-10-10 18:01:11 +08:00
#import "StatisticsServiceHelper.h"
///Model
#import "XPRoomMoreItemModel.h"
#import "RoomInfoModel.h"
2021-12-25 16:57:50 +08:00
#import "AttachmentModel.h"
2022-04-18 22:36:16 +08:00
#import "GuildSuperAdminInfoModel.h"
#import "AccountInfoStorage.h"
2022-11-11 17:46:37 +08:00
#import "NSArray+Safe.h"
2021-12-11 18:53:07 +08:00
///View
#import "XPRoomMoreMenuCollectionViewCell.h"
2021-12-27 15:47:36 +08:00
#import "XPRoomInviteFansView.h"
2022-01-10 18:54:23 +08:00
#import "XPAcrossRoomPKViewController.h"
2022-04-08 18:19:50 +08:00
#import "XPAnchorPKViewController.h"
2022-04-18 22:36:16 +08:00
#import "XPRoomSettingViewController.h"
#import "XPReleaseRadioViewController.h"
#import "XPRoomTrumpetViewController.h"
2022-03-17 19:05:06 +08:00
#import "XPRoomPKViewController.h"
2022-09-01 19:05:09 +08:00
#import "XPRoomSendRedPacketViewController.h"
#import "BaseNavigationController.h"
2022-10-18 19:10:05 +08:00
#import "XPWishGiftCreateViewController.h"
2022-11-17 15:43:01 +08:00
#import "XPAnchorPKSelectTypeController.h"
2021-12-11 18:53:07 +08:00
///P
#import "XPMoreMenuPresenter.h"
#import "XPMoreMenuProtocol.h"
2021-12-29 18:17:54 +08:00
UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
2021-12-11 18:53:07 +08:00
@interface XPRoomMoreMenuViewController ()<UICollectionViewDelegate, UICollectionViewDataSource,XPMoreMenuProtocol>
///View
@property (nonatomic,strong) UIView * topView;
///
@property (nonatomic, strong) UIVisualEffectView *effectView;
2021-12-11 18:53:07 +08:00
///
@property (nonatomic,strong) UICollectionView *collectionView;
///View
@property (nonatomic,strong) UIView * bottomView;
2021-12-11 18:53:07 +08:00
///
@property (nonatomic,strong) NSArray<XPRoomMoreItemModel *> *datasource;
///
@property (nonatomic,strong) RoomInfoModel *roomInfo;
2022-04-18 22:36:16 +08:00
@property (nonatomic,assign) id<RoomHostDelegate> hostDelegate;
2021-12-11 18:53:07 +08:00
@end
@implementation XPRoomMoreMenuViewController
2022-04-18 22:36:16 +08:00
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate{
2021-12-11 18:53:07 +08:00
if (self = [super init]) {
self.modalPresentationStyle = UIModalPresentationOverFullScreen;
2022-04-18 22:36:16 +08:00
self.roomInfo = delegate.getRoomInfo;
self.hostDelegate = delegate;
2021-12-11 18:53:07 +08:00
}
return self;
2021-12-25 16:57:50 +08:00
}
2021-12-11 18:53:07 +08:00
- (XPMoreMenuPresenter *)createPresenter {
return [[XPMoreMenuPresenter alloc] init];
}
- (void)viewDidLoad {
[super viewDidLoad];
[self initSubViews];
[self initSubViewConstraints];
2022-04-18 22:36:16 +08:00
///
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];
2021-12-11 18:53:07 +08:00
}
#pragma mark - Private Method
- (void)initSubViews {
self.modalPresentationStyle = UIModalPresentationOverFullScreen;
2021-12-11 18:53:07 +08:00
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];
2021-12-11 18:53:07 +08:00
}
- (void)initSubViewConstraints {
[self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.mas_equalTo(self.view);
make.bottom.mas_equalTo(self.collectionView.mas_top);
2021-12-11 18:53:07 +08:00
}];
[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);
2021-12-11 18:53:07 +08:00
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);
2021-12-11 18:53:07 +08:00
}];
}
#pragma mark - XPMoreMenuProtocol
- (void)getMoreMenuDataSuccess:(NSArray<XPRoomMoreItemModel *> *)list {
self.datasource = list;
[self.collectionView reloadData];
CGFloat contentHeight= 24 + 36;
2022-05-24 18:03:41 +08:00
CGFloat itemHeight = 50;
2022-03-11 18:44:16 +08:00
int page = list.count % 5;
int scale = (int)list.count / (int)5;
if (page == 0) {
contentHeight += (scale *itemHeight);
2022-01-10 18:54:23 +08:00
} else {
2022-05-24 18:03:41 +08:00
contentHeight += ((scale+1) *itemHeight + scale * 12);
2022-01-10 18:54:23 +08:00
}
2021-12-11 18:53:07 +08:00
CAShapeLayer * layer = [CAShapeLayer layer];
2022-05-24 18:03:41 +08:00
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, contentHeight) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(8, 8)];
2021-12-11 18:53:07 +08:00
layer.path = path.CGPath;
self.collectionView.layer.mask = layer;
[self.collectionView mas_updateConstraints:^(MASConstraintMaker *make) {
2021-12-11 18:53:07 +08:00
make.height.mas_equalTo(contentHeight);
}];
}
- (void)openRoomGiftValueSuccess {
[self showSuccessToast:@"开启礼物值成功"];
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)closeRoomGiftValueSuccess {
[self showSuccessToast:@"关闭礼物值成功"];
[self dismissViewControllerAnimated:YES completion:nil];
}
2021-12-25 16:57:50 +08:00
///
- (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];
}
2022-01-13 18:11:14 +08:00
///广
- (void)getReleaseRadioSuccess:(XPReleaseRadioModel *)model {
2022-04-18 22:36:16 +08:00
[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];
2022-01-13 18:11:14 +08:00
}
2022-03-16 11:48:00 +08:00
///
- (void)getTrumpetSuccess:(XPNobleTrumpetModel *)model {
2022-04-18 22:36:16 +08:00
[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];
2022-03-16 11:48:00 +08:00
}
2022-01-13 18:11:14 +08:00
2022-04-15 18:47:58 +08:00
///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];
}
2021-12-11 18:53:07 +08:00
#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];
2022-11-11 17:46:37 +08:00
cell.itemModel = [self.datasource safeObjectAtIndex1:indexPath.row];
2021-12-11 18:53:07 +08:00
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
2022-11-11 17:46:37 +08:00
XPRoomMoreItemModel * item = [self.datasource safeObjectAtIndex1:indexPath.row];
NSString * roomUid = [NSString stringWithFormat:@"%ld",self.roomInfo.uid];
2021-12-25 16:57:50 +08:00
NSString * roomId = [NSString stringWithFormat:@"%ld", self.roomInfo.roomId];
switch (item.type) {
case RoomMoreMenuType_Gift_Value_Close:
{
2022-10-10 18:01:11 +08:00
[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:
2022-10-10 18:01:11 +08:00
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"openGiftValue"}];
[self.presenter openRoomGiftValue:roomUid];
break;
2021-12-25 16:57:50 +08:00
case RoomMoreMenuType_Message_Screen_Open:
2022-10-10 18:01:11 +08:00
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"openScreen"}];
2021-12-25 16:57:50 +08:00
[self.presenter updateRoomMessageScreenState:NO roomId:roomId];
break;
case RoomMoreMenuType_Message_Screen_Close:
2022-10-10 18:01:11 +08:00
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"closeScreen"}];
2021-12-25 16:57:50 +08:00
[self.presenter updateRoomMessageScreenState:YES roomId:roomId];
break;
2021-12-25 18:34:54 +08:00
case RoomMoreMenuType_Gift_Effect_Open:
{
2022-10-10 18:01:11 +08:00
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"openGiftEffect"}];
2021-12-25 18:34:54 +08:00
[self showSuccessToast:@"礼物特效已开启"];
NSDictionary * dic = @{@"hasAnimationEffect": @(1)};
[[NSNotificationCenter defaultCenter] postNotificationName:kRoomGiftEffectUpdateNotificationKey object:dic];
[self dismissViewControllerAnimated:YES completion:nil];
}
break;
case RoomMoreMenuType_Gift_Effect_Close:
{
2022-10-10 18:01:11 +08:00
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"closeGiftEffect"}];
2021-12-25 18:34:54 +08:00
[self showSuccessToast:@"礼物特效已关闭"];
NSDictionary * dic = @{@"hasAnimationEffect": @(0)};
[[NSNotificationCenter defaultCenter] postNotificationName:kRoomGiftEffectUpdateNotificationKey object:dic];
[self dismissViewControllerAnimated:YES completion:nil];
}
break;
2021-12-27 15:47:36 +08:00
case RoomMoreMenuType_Invite_Fans:
{
2022-10-10 18:01:11 +08:00
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"inviteFans"}];
2021-12-27 15:47:36 +08:00
[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;
2021-12-27 20:44:33 +08:00
case RoomMoreMenuType_Room_Setting:
{
2022-10-10 18:01:11 +08:00
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"roomSetting"}];
2021-12-27 20:44:33 +08:00
[self dismissViewControllerAnimated:YES completion:nil];
2022-04-18 22:36:16 +08:00
XPRoomSettingViewController * roomsettingVC = [[XPRoomSettingViewController alloc] initWithDelegate:self.hostDelegate];
[self.hostDelegate.getCurrentNav pushViewController:roomsettingVC animated:YES];
2021-12-27 20:44:33 +08:00
}
break;
case RoomMoreMenuType_Room_Dating_Open:
{
2022-01-12 18:48:39 +08:00
if (self.roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode) {
[self showErrorToast:@"跨房PK中不可开启相亲模式!"];
[self dismissViewControllerAnimated:NO completion:nil];
return;
}
2022-05-29 14:16:31 +08:00
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:^{
}];
2022-10-10 18:01:11 +08:00
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"openRoomDating"}];
}
break;
case RoomMoreMenuType_Room_Dating_Close:
{
2022-10-10 18:01:11 +08:00
[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;
2022-01-02 17:16:12 +08:00
case RoomMoreMenuType_Release_Radio:
{
2022-10-10 18:01:11 +08:00
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"releaseRadio"}];
2022-01-13 18:11:14 +08:00
[self.presenter getRoomRadioMessageListWithType:[NSString stringWithFormat:@"%zd", self.roomInfo.type]];
2022-01-02 17:16:12 +08:00
}
2022-03-16 11:48:00 +08:00
break;
case RoomMoreMenuType_Room_trumpet:
2022-10-10 18:01:11 +08:00
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"trumpet"}];
2022-03-22 18:38:14 +08:00
[self.presenter getRoomgetUserVipRoomTrumpet:roomUid];
2022-01-02 17:16:12 +08:00
break;
2022-01-12 18:58:51 +08:00
case RoomMoreMenuType_Room_Across_PK_Open:
2022-01-10 18:54:23 +08:00
{
2022-01-12 18:48:39 +08:00
if (self.roomInfo.roomModeType == RoomModeType_Open_Blind) {
[self showErrorToast:@"相亲中不可开启跨房PK!"];
[self dismissViewControllerAnimated:NO completion:nil];
return;
}
2022-05-29 14:16:31 +08:00
if (self.roomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
[self showErrorToast:@"PK中不可以开启跨房PK"];
[self dismissViewControllerAnimated:NO completion:nil];
return;
}
2022-01-10 18:54:23 +08:00
[self dismissViewControllerAnimated:NO completion:nil];
XPAcrossRoomPKViewController * acrossRoomPKVC = [[XPAcrossRoomPKViewController alloc] initWithRoomUid:roomUid];
2022-04-18 22:36:16 +08:00
[self.hostDelegate.getCurrentNav presentViewController:acrossRoomPKVC animated:YES completion:nil];
2022-10-10 18:01:11 +08:00
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"openAcrossPk"}];
2022-01-10 18:54:23 +08:00
}
break;
2022-01-12 18:58:51 +08:00
case RoomMoreMenuType_Room_Across_PK_Close:
{
2022-10-10 18:01:11 +08:00
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"closeAcrossPk"}];
2022-01-12 18:58:51 +08:00
[self showErrorToast:@"正在跨房PK中!"];
[self dismissViewControllerAnimated:NO completion:nil];
}
break;
2022-04-08 18:19:50 +08:00
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];
}
2022-04-08 18:19:50 +08:00
}
break;
2022-04-18 22:36:16 +08:00
case RoomMoreMenuType_Room_Anchor_PK_Close:
{
2022-10-10 18:01:11 +08:00
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"closeAnchorPk"}];
2022-04-18 22:36:16 +08:00
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:
{
2022-10-10 18:01:11 +08:00
[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;
2022-03-17 19:05:06 +08:00
case RoomMoreMenuType_Room_PK_Open:
{
2022-05-29 14:16:31 +08:00
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;
}
2022-03-18 19:40:31 +08:00
[self dismissViewControllerAnimated:NO completion:nil];
XPRoomPKViewController * roomPKVC = [[XPRoomPKViewController alloc] initWithDelegate:self.hostDelegate];
2022-03-17 19:05:06 +08:00
[self.hostDelegate.getCurrentNav pushViewController:roomPKVC animated:YES];
2022-10-10 18:01:11 +08:00
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"openRoomPk"}];
2022-03-17 19:05:06 +08:00
}
break;
case RoomMoreMenuType_Room_PK_Close:
{
2022-10-10 18:01:11 +08:00
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"closeRoomPk"}];
2022-03-18 19:40:31 +08:00
[self dismissViewControllerAnimated:NO completion:nil];
XPRoomPKViewController * roomPKVC = [[XPRoomPKViewController alloc] initWithDelegate:self.hostDelegate];
2022-03-17 19:05:06 +08:00
[self.hostDelegate.getCurrentNav pushViewController:roomPKVC animated:YES];
}
break;
2022-09-01 19:05:09 +08:00
case RoomMoreMenuType_Room_redPacket:
{
2022-10-10 18:01:11 +08:00
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"redPacket"}];
2022-09-01 19:05:09 +08:00
[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];
2022-09-30 18:30:41 +08:00
}
break;
case RoomMoreMenuType_Room_Voice:
{
2022-10-10 18:01:11 +08:00
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"voice"}];
2022-09-30 18:30:41 +08:00
[self dismissViewControllerAnimated:YES completion:nil];
[RtcManager instance].remoteMuted = !item.isSelected;
item.isSelected = [RtcManager instance].isRemoteMuted;
2022-09-01 19:05:09 +08:00
}
break;
2022-10-18 19:10:05 +08:00
case RoomMoreMenuType_Room_Wish_Gift:
{
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"redPacket"}];
[self dismissViewControllerAnimated:YES completion:nil];
2022-10-21 18:03:00 +08:00
XPWishGiftCreateViewController *wishGiftVC = [[XPWishGiftCreateViewController alloc] initWithDelegate:self.hostDelegate];
2022-10-18 19:10:05 +08:00
[self.hostDelegate.getCurrentNav pushViewController:wishGiftVC animated:YES];
}
break;
default:
break;
}
}
2021-12-11 18:53:07 +08:00
#pragma mark - Event Response
- (void)disMissRecognizer {
[self dismissViewControllerAnimated:YES completion:nil];
2021-12-11 18:53:07 +08:00
}
#pragma mark - Getters And Setters
- (UICollectionView *)collectionView{
if (!_collectionView) {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.sectionInset = UIEdgeInsetsMake(24, 0, 10, 0);
2022-05-24 18:03:41 +08:00
layout.itemSize = CGSizeMake(KScreenWidth /5, 50);
layout.minimumLineSpacing = 12;
2021-12-11 18:53:07 +08:00
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;
2021-12-11 18:53:07 +08:00
[_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;
}
2021-12-11 18:53:07 +08:00
@end