586 lines
25 KiB
Objective-C
586 lines
25 KiB
Objective-C
//
|
|
// YMRoomMoreMenuViewController.m
|
|
// YUMI
|
|
//
|
|
// Created by YUMI on 2021/12/11.
|
|
//
|
|
|
|
#import "XPRoomMoreMenuViewController.h"
|
|
///Third
|
|
#import <Masonry/Masonry.h>
|
|
#import "FFPopup.h"
|
|
///Tool
|
|
#import "YUMIMacroUitls.h"
|
|
#import "TTPopup.h"
|
|
#import "YUMIConstant.h"
|
|
#import "AccountInfoStorage.h"
|
|
#import "DJDKMIMOMColor.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 "XPRoomPKViewController.h"
|
|
#import "BaseNavigationController.h"
|
|
#import "XPWishGiftCreateViewController.h"
|
|
#import "XPAnchorPKSelectTypeController.h"
|
|
#import "XPRoomTrumpetViewController.h"
|
|
#import "XPWebViewController.h"
|
|
#import "PIRoomPhotoAlbumVC.h"
|
|
#import "PIRoomSendRedPacketVC.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:YMLocalizedString(@"XPRoomMoreMenuViewController0")];
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
}
|
|
|
|
- (void)closeRoomGiftValueSuccess {
|
|
[self showSuccessToast:YMLocalizedString(@"XPRoomMoreMenuViewController1")];
|
|
[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];
|
|
|
|
XPAnchorPKViewController * acrossRoomPKVC = [[XPAnchorPKViewController alloc] initWithRoomUid:roomUid];
|
|
[self.hostDelegate.getCurrentNav presentViewController:acrossRoomPKVC animated:YES completion:nil];
|
|
|
|
// 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:YMLocalizedString(@"XPRoomMoreMenuViewController2")];
|
|
return;
|
|
}
|
|
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
|
config.title = @"";
|
|
config.message = YMLocalizedString(@"XPRoomMoreMenuViewController3");
|
|
[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:YMLocalizedString(@"XPRoomMoreMenuViewController4")];
|
|
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:YMLocalizedString(@"XPRoomMoreMenuViewController5")];
|
|
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:YMLocalizedString(@"XPRoomMoreMenuViewController6")];
|
|
[self dismissViewControllerAnimated:NO completion:nil];
|
|
return;
|
|
}
|
|
|
|
if (self.roomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
|
[self showErrorToast:YMLocalizedString(@"XPRoomMoreMenuViewController7")];
|
|
[self dismissViewControllerAnimated:NO completion:nil];
|
|
return;
|
|
}
|
|
|
|
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
|
config.message = YMLocalizedString(@"XPRoomMoreMenuViewController8");
|
|
config.confirmButtonConfig.title = YMLocalizedString(@"XPRoomMoreMenuViewController9");
|
|
[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 = YMLocalizedString(@"XPRoomMoreMenuViewController10");
|
|
config.message = YMLocalizedString(@"XPRoomMoreMenuViewController11");
|
|
config.confirmButtonConfig.title = YMLocalizedString(@"XPRoomMoreMenuViewController12");
|
|
[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:
|
|
[self.presenter getRoomgetUserVipRoomTrumpet:roomUid];
|
|
break;
|
|
case RoomMoreMenuType_Room_Across_PK_Open:
|
|
{
|
|
if (self.roomInfo.roomModeType == RoomModeType_Open_Blind) {
|
|
[self showErrorToast:YMLocalizedString(@"XPRoomMoreMenuViewController13")];
|
|
[self dismissViewControllerAnimated:NO completion:nil];
|
|
return;
|
|
}
|
|
|
|
if (self.roomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
|
[self showErrorToast:YMLocalizedString(@"XPRoomMoreMenuViewController14")];
|
|
[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:YMLocalizedString(@"XPRoomMoreMenuViewController15")];
|
|
[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 = YMLocalizedString(@"XPRoomMoreMenuViewController16");
|
|
[TTPopup alertWithConfig:config confirmHandler:^{
|
|
[self.presenter requestCancelMatchRandomPK:roomUid];
|
|
} cancelHandler:^{
|
|
}];
|
|
} else {
|
|
[self dismissViewControllerAnimated:NO completion:nil];
|
|
XPAnchorPKViewController * acrossRoomPKVC = [[XPAnchorPKViewController alloc] initWithRoomUid:roomUid];
|
|
[self.hostDelegate.getCurrentNav presentViewController:acrossRoomPKVC 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 = YMLocalizedString(@"XPRoomMoreMenuViewController17");
|
|
config.message = YMLocalizedString(@"XPRoomMoreMenuViewController18");
|
|
config.confirmButtonConfig.title = YMLocalizedString(@"XPRoomMoreMenuViewController19");
|
|
[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:YMLocalizedString(@"XPRoomMoreMenuViewController20")];
|
|
[self dismissViewControllerAnimated:NO completion:nil];
|
|
return;
|
|
}
|
|
|
|
if (self.roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode) {
|
|
[self showErrorToast:YMLocalizedString(@"XPRoomMoreMenuViewController21")];
|
|
[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];
|
|
PIRoomSendRedPacketVC *sendRedPacketVC = [[PIRoomSendRedPacketVC 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;
|
|
case RoomMoreMenuType_Room_report:
|
|
{
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
TTActionSheetConfig *action = [TTActionSheetConfig normalTitle:YMLocalizedString(@"RoomHeaderView10") clickAction:^{
|
|
[FFPopup dismissPopupForView:self.view animated:NO];
|
|
[self.hostDelegate requesstShieldingAction];
|
|
}];
|
|
TTActionSheetConfig *action1 = [TTActionSheetConfig normalTitle:YMLocalizedString(@"RoomHeaderView12") clickAction:^{
|
|
[FFPopup dismissPopupForView:self.view animated:NO];
|
|
|
|
XPWebViewController * webVC = [[XPWebViewController alloc] init];
|
|
NSString *urlstr = [NSString stringWithFormat:@"%@?reportUid=%ld&source=ROOM", URLWithType(kReportRoomURL),self.hostDelegate.getRoomInfo.uid];
|
|
webVC.url = urlstr;
|
|
[[self.hostDelegate getCurrentNav] pushViewController:webVC animated:YES];
|
|
|
|
}];
|
|
[TTPopup actionSheetWithItems:@[action,action1]];
|
|
break;
|
|
}
|
|
case RoomMoreMenuType_Room_Room_Photo_Album:
|
|
{
|
|
[self dismissViewControllerAnimated:NO completion:nil];
|
|
PIRoomPhotoAlbumVC *albumVC = [PIRoomPhotoAlbumVC new];
|
|
albumVC.roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid];
|
|
[self.hostDelegate.getCurrentNav pushViewController:albumVC 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
|