12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886 |
- //
- // YOUPAILZChatRoomBaseVC.m
- // VQU
- //
- // Created by CY on 2021/10/28.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAILZChatRoomBaseVC.h"
- #import "NSString+YYAdd.h"
- #import "YBPopupMenu.h"
- #import "YOUPAILZChatRoomNoticeTitleCell.h"
- #import "YOUPAILZChatRoomNoticeContentCell.h"
- #import "YOUPAILZChatRoomEmojiAnimationWindow.h"
- #import "UIViewController+TFPresent.h"
- #import "YOUPAILCMessageVC.h"
- #import "YOUPAILZLiveUserInfoWindow.h"
- #import "YOUPAILZUserShowVC.h"
- #import "YOUPAILCReportVC.h"
- #import "YOUPAILZCommonGiftView.h"
- #import "YOUPAILPGuardHerVC.h"
- #import "LZAlertWindow.h"
- #import "YOUPAILZLiveChatMessageCell.h"
- #import "YOUPAILZChatRoomInfoEditWindow.h"
- #import "NIMMessageMaker.h"
- #import "YOUPAILZChatRoomUpLockWindow.h"
- #import "YOUPAILZChatRoomBlockListWindow.h"
- #import "YOUPAILZChatRoomReportWindow.h"
- #import "SDCycleScrollView.h"
- #import "YOUPAILCFirstRechargeModel.h"
- #import "YOUPAIHRChatRoomGiftView.h"
- #import "YOUPAIHRRechargePayWindow.h"
- #import "YOUPAILZChatRoomGiftAttachment.h"
- #import "YOUPAILZMusicLibraryWindow.h"
- #import "YOUPAILZMusicWindow.h"
- #import "YOUPAIZYFirstRechargeWindow.h"
- #import "YOUPAILCFirstRechargeModel.h"
- #import "YOUPAILZLiveAudienceVC.h"
- #import "YOUPAILZChatRoomBlindDateProgressView.h"
- #import "YOUPAILZBlindDateSelectWindow.h"
- #import "YOUPAIHRWebWindow.h"
- #import "YOUPAIBBMessageVC.h"
- #import "YOUPAILZChatRoomGameCenterWindow.h"
- #import "YOUPAIHRChatRoomContributeListVC.h"
- #import "YOUPAILZChatRoomSetterBgImgWindow.h"
- #import <SVGAPlayer.h>
- #import <SVGAParser.h>
- @interface YOUPAILZChatRoomBaseVC () <YBPopupMenuDelegate,LPGuardHerDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UITableViewDelegate,UITableViewDataSource,ZYFirstRechargeWindowDelegate>
- @property (nonatomic,weak)UIImageView *bgImgV;
- @property (nonatomic, strong) SVGAPlayer *youpaipBgSvgaPlayer;
- @property (nonatomic, strong) SVGAParser *youpaipBgParser;
- @property (nonatomic,weak) UIView *youpaipheaderView;
- @property (nonatomic,weak) UIButton *youpaipcloseBtn;
- @property (nonatomic,weak) UIButton *youpaipnoticeBtn; /// 公告
- @property (nonatomic,weak) UIButton *youpaipintroduceBtn; /// 玩法介绍
- @property (nonatomic,weak) YOUPAILZChatRoomBlindDateProgressView *youpaipblindDateProgressView; // 相亲玩法进度
- @property (nonatomic,strong) YBPopupMenu *youpaipnoticePopupMenu;// 公告弹窗
- //广告相关
- @property (nonatomic,strong) SDCycleScrollView* youpaipcycleScrollView;
- @property (nonatomic,strong) YOUPAILCFirstRechargeModel *youpaipfirstRechargeModel;
- @property (nonatomic,strong) YOUPAILCFirstRechargeModel *youpaipfirstRechargeModel1;
- @property (nonatomic,assign) CGFloat youpaipmusicPlayerViewY;
- @property (nonatomic,assign) BOOL isLoadingUserInfo; // 是否正在加载用户信息
- @end
- @implementation YOUPAILZChatRoomBaseVC
- - (void)viewWillAppear:(BOOL)animated{
- [super viewWillAppear:animated];
-
- [YOUPAILZChatRoomManager shareManager].chatroomWindow.hidden = YES;
- [self.youpaipfooterView youpaifupdateUnread];
- }
- - (void)viewWillDisappear:(BOOL)animated{
- [super viewWillDisappear:animated];
- self.navigationController.navigationBarHidden = NO;
- // [self.youpaipchatroomInfoView.titleL marqueeOfSettingWithState:MarqueeShutDown_H];
- [self youpaifnoticePopupMenuDismiss];
- }
- - (void)viewDidAppear:(BOOL)animated {
- [super viewDidAppear:animated];
- self.navigationController.navigationBarHidden = YES;
- // [self.youpaipchatroomInfoView.titleL marqueeOfSettingWithState:MarqueeStart_H];
- }
- - (void)viewDidDisappear:(BOOL)animated{
- [super viewDidDisappear:animated];
- if ([YOUPAILZChatRoomManager shareManager].chatroomController != nil) {
- [YOUPAILZChatRoomManager shareManager].chatroomWindow.hidden = self.youpaipisClose;
- }
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- [self youpaifinitBgImgV];
- [self youpaifinitHeaderView];
- [self youpaifinitNoticeView];
- [self youpaifinitBoardView];
- [self youpaifinitSeatHostView];
- [self youpaifinitSeatOtherView];
- [self youpaifinitFooterView];
- [self youpaifinitMessageTableView];
- [self youpaifinitKeyboardView];
- [self youpaifinitApplySeatButton];
- [self youpaifinitializeAgoraEngine];
- [self youpaifinitAdvertView];
- [self youpaifinitMusicLyrieView];
- [self youpaifloadAdvert1];
- [self youpaifinitPlayTypeIntroduce];
- [self youpaifinitBlindDateProgressView];
-
- self.youpaipchatroomInfoView.youpaiptitleL.text = self.youpaipchatroomModel.youpaiproom_title;
- self.youpaipchatroomInfoView.youpaiphotValueL.text = self.youpaipchatroomModel.youpaiproom_score;
- self.youpaipchatroomInfoView.youpaipchatroomIDL.text = [NSString stringWithFormat:@"房间号:%@",self.youpaipchatroomModel.youpaiproom_number];
- self.youpaipchatroomInfoView.youpaipfollowBtn.selected = self.youpaipchatroomModel.youpaipis_follow;
-
- [self performSelector:@selector(youpaifnoticeBtnClick) withObject:nil afterDelay:0.5f];
- [self performSelector:@selector(youpaifnoticePopupMenuDismiss) withObject:nil afterDelay:3.0f];
-
- }
- //获取首冲弹框数据
- -(void)youpaifloadAdvert1{
- @weakify(self);
- [LCHttpHelper requestWithURLString:GetAdvert parameters:@{@"position":@"7"} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- @strongify(self);
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- self.youpaipfirstRechargeModel1 = [YOUPAILCFirstRechargeModel mj_objectWithKeyValues:dict[@"data"]];
- for (int i = 0; i<self.youpaipfirstRechargeModel1.youpaiplist.count; i++) {
- YOUPAILCBannerModel* model = self.youpaipfirstRechargeModel1.youpaiplist[i];
-
- if([NSStringFromClass([LCTools getCurrentVC].class) isEqual:@"YOUPAILZLiveAnchorVC"]) {
- continue;
- }
- if([LCTools getCurrentVC].tabBarController == nil) {
- continue;
- }
-
- if (model.youpaipwindow_type == 2) {
- YOUPAIHRWebWindow *window = [[YOUPAIHRWebWindow alloc] init];
- window.isTouchDismiss = YES;
- window.youpaipurl = model.youpaipwindow_link;
- window.youpaipwidth = model.youpaipwidth;
- window.youpaipheight = model.youpaipheight;
- window.youpaipgravity = model.youpaipgravity;
- [self TFPresentVC:window completion:^{}];
- }else{
- YOUPAIZYFirstRechargeWindow *VC= [[YOUPAIZYFirstRechargeWindow alloc]init];
- VC.youpaipdelegate = self;
- VC.vWidth = KScreenWidth -30;
- VC.vHeight = KScreenWidth-30;
- VC.youpaipimageurl = model.youpaipimage;
- VC.youpaiplink_type = model.youpaiplink_type;
- VC.youpaiplink_url = model.youpaiplink_url;
- VC.isTouchDismiss = YES;
- [[LCTools getCurrentVC] TFPresentVC:VC completion:^{}];
- }
-
- }
-
-
- }
- } failure:^(NSError *error) {}];
-
- }
- - (void)youpaifLZFirstRechargeClickAdverImage:(NSInteger)link_type andUrl:(NSString *)link_url{
- if (link_type == 1) {
- ZCBaseWebVC* baseWeb = [[ZCBaseWebVC alloc]init];
- baseWeb.contentUrl = link_url;
- UIViewController *vc = [LCTools getContainNavigationControllerCurrentVC];
- if([NSStringFromClass([LCTools getContainNavigationControllerCurrentVC].class) isEqual:@"YOUPAILZLiveAudienceVC"]) {
- YOUPAILZLiveAudienceVC *audienceVC = (YOUPAILZLiveAudienceVC *)vc;
- audienceVC.youpaipisNotPanClose = YES;
- }
- [vc.navigationController pushViewController:baseWeb animated:YES];
- }else if (link_type==2 || link_type==3){
- UIViewController *vc = [LCTools getContainNavigationControllerCurrentVC];
- if([NSStringFromClass([LCTools getContainNavigationControllerCurrentVC].class) isEqual:@"YOUPAILZLiveAudienceVC"]) {
- YOUPAILZLiveAudienceVC *audienceVC = (YOUPAILZLiveAudienceVC *)vc;
- audienceVC.youpaipisNotPanClose = YES;
- }
- [vc youpaifpageToStr:link_url];
- }else{
-
-
- }
-
- }
- /// 背景设置
- - (void)youpaifinitBgImgV{
- UIImageView *bgImgV = [[UIImageView alloc] initWithFrame:self.view.bounds];
- bgImgV.contentMode = UIViewContentModeScaleAspectFill;
- bgImgV.image = [UIImage imageNamed:@"vqu_images_chatroom_bg"];
- [self.view addSubview:bgImgV];
- self.bgImgV = bgImgV;
-
- self.youpaipBgSvgaPlayer = [[SVGAPlayer alloc] initWithFrame:self.view.bounds];
- self.youpaipBgSvgaPlayer.contentMode = UIViewContentModeScaleAspectFill;
- self.youpaipBgSvgaPlayer.layer.cornerRadius = ScaleSize(10.0f);
- self.youpaipBgSvgaPlayer.clipsToBounds = YES;
- self.youpaipBgSvgaPlayer.layer.borderColor = HexColorFromRGB(0xF4003F).CGColor;
- self.youpaipBgSvgaPlayer.hidden = YES;
- self.youpaipBgSvgaPlayer.loops = 0;
- self.youpaipBgSvgaPlayer.clearsAfterStop = true;
- self.youpaipBgSvgaPlayer.userInteractionEnabled = NO;
- [self.view addSubview:self.youpaipBgSvgaPlayer];
-
- self.youpaipBgParser = [[SVGAParser alloc] init];
-
-
- [self youpaifsetupBgImage];
- }
- - (void)youpaifsetupBgImage{
-
- if (self.youpaipchatroomModel.youpaipbg_img.length == 0) {
- return;
- }
-
- self.bgImgV.hidden = YES;
- self.youpaipBgSvgaPlayer.hidden = YES;
-
- if ([self.youpaipchatroomModel.youpaipbg_img containsString:@".svga"]) {
- self.youpaipBgSvgaPlayer.hidden = NO;
- [self.youpaipBgSvgaPlayer stopAnimation];
-
- NSString* svgaName = [[self.youpaipchatroomModel.youpaipbg_img componentsSeparatedByString:@"/"] lastObject];
- NSString* svgaCanchesPath= [[NSString alloc]initWithFormat:@"%@/%@/%@",CachesPath,@"SVGA",svgaName];
- if (![LCTools giftSVGAWithSvgaUrlStr:self.youpaipchatroomModel.youpaipbg_img]){
- NSString* urlStr = [NSString stringWithFormat:@"%@/%@",[LCSaveData getImageUrl]?[LCSaveData getImageUrl]:BaseImgUrl,self.youpaipchatroomModel.youpaipbg_img];
- @weakify(self);
- [self.youpaipBgParser parseWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
- @strongify(self);
- if (videoItem != nil) {
- self.youpaipBgSvgaPlayer.videoItem = videoItem;
- [self.youpaipBgSvgaPlayer startAnimation];
- }
- } failureBlock:^(NSError * _Nullable error) {
- @strongify(self);
- self.youpaipBgSvgaPlayer.hidden = YES;
- }];
- [LCTools giftSVGAWithSvgaUrlStr:self.youpaipchatroomModel.youpaipbg_img];
- }else{
- @weakify(self);
- [self.youpaipBgParser parseWithData:[LCTools giftSVGAWithSvgaUrlStr:self.youpaipchatroomModel.youpaipbg_img] cacheKey:svgaCanchesPath completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
- @strongify(self);
- if (videoItem != nil) {
- self.youpaipBgSvgaPlayer.videoItem = videoItem;
- [self.youpaipBgSvgaPlayer startAnimation];
- }
- } failureBlock:^(NSError * _Nonnull error) {
- @strongify(self);
- self.youpaipBgSvgaPlayer.hidden = YES;
- }];
- }
-
- }else{
- self.bgImgV.hidden = NO;
- [self.bgImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipchatroomModel.youpaipbg_img]];
- }
-
-
- // CATransition *transition = [CATransition animation];
- // transition.duration = 0.25f;
- // transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
- // transition.type = kCATransitionFade;
- // [self.bgImgV.layer addAnimation:transition forKey:@"bgAnimation"];
- // switch (self.youpaipchatroomModel.youpaipplayType) {
- // case LZChatRoomPlayTypeWithNormal:
- //
- // break;
- // case LZChatRoomPlayTypeWithCardiac:
- // self.bgImgV.image = [UIImage imageNamed:@"vqu_chatroom_bg_cardiac"];
- // break;
- // case LZChatRoomPlayTypeWithBlindDate:
- // self.bgImgV.image = [UIImage imageNamed:@"vqu_image_chatroom_blinddate"];
- // break;
- //
- // default:
- // break;
- // }
- }
- /// 更新玩法UI
- - (void)youpaifreloadPlayTypeUI{
- // [self youpaifsetupBgImage];
- [self youpaifsetupIntroduceBtnShow];
- [self youpaifsetupBlindDateProgressData];
- [self.youpaipapplySeatButton youpaifrleoadWithType:self.youpaipapplySeatButton.youpaiptype playType:self.youpaipchatroomModel.youpaipplayType];
- }
- /// youpaipheaderView
- - (void)youpaifinitHeaderView{
- UIView *youpaipheaderView = [[UIView alloc] init];
- [self.view addSubview:youpaipheaderView];
- self.youpaipheaderView = youpaipheaderView;
- [youpaipheaderView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.offset(0.0f);
- make.top.offset(StatusBarHeight);
- make.height.offset(44.0f);
- }];
-
- UIButton *youpaipcloseBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [youpaipcloseBtn setImage:[UIImage imageNamed:@"vqu_images_chatroom_close"] forState:UIControlStateNormal];
- [youpaipcloseBtn setImage:[UIImage imageNamed:@"vqu_images_chatroom_close"] forState:UIControlStateHighlighted];
- [youpaipcloseBtn addTarget:self action:@selector(youpaifcloseBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [youpaipheaderView addSubview:youpaipcloseBtn];
- self.youpaipcloseBtn = youpaipcloseBtn;
- [youpaipcloseBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(-10.0f);
- make.centerY.equalTo(youpaipheaderView);
- make.size.mas_offset(CGSizeMake(20.0f, 44.0f));
- }];
-
- [self youpaifinitChatRoomInfoView];
- [self youpaifinitChatRoomMemberView];
- }
- /// 语聊房信息View
- - (void)youpaifinitChatRoomInfoView{
- YOUPAILZChatRoomInfoView *youpaipchatroomInfoView = [[YOUPAILZChatRoomInfoView alloc] init];
- [self.youpaipheaderView addSubview:youpaipchatroomInfoView];
- self.youpaipchatroomInfoView = youpaipchatroomInfoView;
- [youpaipchatroomInfoView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.top.bottom.offset(0.0f);
- make.width.greaterThanOrEqualTo(120.0f);
- }];
- @weakify(self);
- [youpaipchatroomInfoView setYoupaiffollowBtnClickBlock:^(BOOL isFollow) {
- if (isFollow) { // 关注
- @strongify(self);
- NSMutableDictionary *params = @{@"follow_room_id":self.youpaipchatroomModel.youpaiproom_id}.mutableCopy;
- if (self.youpaipchatroomModel.youpaiphostSeat.youpaipuserInfo.youpaipid.length != 0) {
- [params setValue:self.youpaipchatroomModel.youpaiphostSeat.youpaipuserInfo.youpaipid forKey:@"follow_user"];
- }
- [LCHttpHelper requestWithURLString:FollowRooms parameters:params needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- } failure:^(NSError *error) {
- }];
- }else{ // 取消关注
- [LCHttpHelper requestWithURLString:FollowRoomsCancel parameters:@{@"follow_room_id":self.youpaipchatroomModel.youpaiproom_id} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- } failure:^(NSError *error) {
- }];
- }
- }];
- }
- /// 语聊房成员View
- - (void)youpaifinitChatRoomMemberView{
- YOUPAILZChatRoomMemberView *youpaipchatroomMemberView = [[YOUPAILZChatRoomMemberView alloc] init];
- [youpaipchatroomMemberView youpaifreloadWithMemberList:self.youpaipchatroomModel.youpaiplive_top_three];
- [self.youpaipheaderView addSubview:youpaipchatroomMemberView];
- self.youpaipchatroomMemberView = youpaipchatroomMemberView;
- [youpaipchatroomMemberView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.youpaipcloseBtn.mas_left).offset(-1.0f);
- make.top.bottom.offset(0.0f);
- }];
- }
- /// 公告View
- - (void)youpaifinitNoticeView{
- UIButton *youpaipnoticeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- youpaipnoticeBtn.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3f];
- youpaipnoticeBtn.layer.cornerRadius = 10.5f;
- youpaipnoticeBtn.clipsToBounds = YES;
- [youpaipnoticeBtn addTarget:self action:@selector(youpaifnoticeBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [self.view addSubview:youpaipnoticeBtn];
- self.youpaipnoticeBtn = youpaipnoticeBtn;
- [youpaipnoticeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(14.0f);
- make.top.equalTo(self.youpaipheaderView.mas_bottom).offset(10.0f);
- make.height.offset(21.0f);
- }];
-
- UIImageView *iconImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_chatroom_notice"]];
- [youpaipnoticeBtn addSubview:iconImgV];
- [iconImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(9.0f);
- make.centerY.equalTo(youpaipnoticeBtn);
- make.size.mas_offset(CGSizeMake(11.0f, 13.0f));
- }];
- UILabel *noticeL = [[UILabel alloc] init];
- noticeL.font = LCFont(11.0f);
- noticeL.textColor = HexColorFromRGB(0xEEEEEE);
- noticeL.text = @"公告";
- [youpaipnoticeBtn addSubview:noticeL];
- [noticeL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(iconImgV.mas_right).offset(4.0f);
- make.centerY.equalTo(youpaipnoticeBtn);
- make.right.offset(-9.0f);
- }];
- }
- /// 榜单View
- - (void)youpaifinitBoardView{
- UIButton *youpaipboardBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- youpaipboardBtn.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3f];
- youpaipboardBtn.layer.cornerRadius = 10.5f;
- youpaipboardBtn.clipsToBounds = YES;
- [youpaipboardBtn addTarget:self action:@selector(youpaifboardBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [self.view addSubview:youpaipboardBtn];
- [youpaipboardBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(14.0f);
- make.top.equalTo(self.youpaipnoticeBtn.mas_bottom).offset(5.0f);
- make.height.offset(21.0f);
- }];
-
- UIImageView *iconImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_chatroom_board"]];
- [youpaipboardBtn addSubview:iconImgV];
- [iconImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(7.0f);
- make.centerY.equalTo(youpaipboardBtn);
- make.size.mas_offset(CGSizeMake(14.0f, 13.0f));
- }];
- UILabel *boardL = [[UILabel alloc] init];
- boardL.font = LCFont(11.0f);
- boardL.textColor = HexColorFromRGB(0xFFDD8D);
- boardL.text = @"榜单";
- [youpaipboardBtn addSubview:boardL];
- [boardL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(iconImgV.mas_right).offset(3.0f);
- make.centerY.equalTo(youpaipboardBtn);
- make.right.offset(-9.0f);
- }];
- }
- - (void)youpaifboardBtnClick{
- @weakify(self);
- [self.youpaipkeyboardView resignFirstResponder];
- self.youpaipkeyboardView.hidden = YES;
- YOUPAIHRChatRoomContributeListVC *window = [[YOUPAIHRChatRoomContributeListVC alloc] init];
- window.youpaipchatroomModel = self.youpaipchatroomModel;
- window.isTouchDismiss = YES;
- [window setYoupaipupseatBlock:^(YOUPAILZChatRoomMemberModel * _Nonnull model) {
- @strongify(self);
- [self youpaifshowSelectedSeatWindowWithUserId:model.youpaipid youpaipisInviation:YES];
- }];
- [window setYoupaiptouchUserBlock:^(NSString * _Nonnull userId) {
- @strongify(self);
- [self youpaifshowUserInfoWithUserId:userId];
- }];
- [self TFPresentVC:window completion:^{}];
- }
- /// 玩法介绍
- - (void)youpaifinitPlayTypeIntroduce{
- UIButton *youpaipintroduceBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- youpaipintroduceBtn.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3f];
- youpaipintroduceBtn.layer.cornerRadius = 10.5f;
- youpaipintroduceBtn.clipsToBounds = YES;
- [youpaipintroduceBtn setTitle:@"玩法介绍" forState:UIControlStateNormal];
- [youpaipintroduceBtn setTitleColor:HexColorFromRGB(0xEEEEEE) forState:UIControlStateNormal];
- youpaipintroduceBtn.titleLabel.font = LCFont(11.0f);
- youpaipintroduceBtn.hidden = YES;
- [youpaipintroduceBtn addTarget:self action:@selector(youpaifintroduceBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [self.view addSubview:youpaipintroduceBtn];
- self.youpaipintroduceBtn = youpaipintroduceBtn;
- [youpaipintroduceBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.youpaipnoticeBtn.mas_right).offset(5.0f);
- make.centerY.equalTo(self.youpaipnoticeBtn);
- make.size.mas_offset(CGSizeMake(62.0f, 21.0f));
- }];
- [self youpaifsetupIntroduceBtnShow];
- }
- - (void)youpaifintroduceBtnClick{
- YOUPAIHRWebWindow *window = [[YOUPAIHRWebWindow alloc] init];
- window.isTouchDismiss = YES;
- window.youpaipurl = self.youpaipchatroomModel.youpaippalyIntroduce.youpaipurl;
- window.youpaipwidth = self.youpaipchatroomModel.youpaippalyIntroduce.youpaipwidth;
- window.youpaipheight = self.youpaipchatroomModel.youpaippalyIntroduce.youpaipheight;
- window.youpaipgravity = self.youpaipchatroomModel.youpaippalyIntroduce.youpaipgravity;
- [self TFPresentVC:window completion:^{}];
- }
- - (void)youpaifsetupIntroduceBtnShow{
- self.youpaipintroduceBtn.hidden = YES;
- if (self.youpaipchatroomModel.youpaipplayType == LZChatRoomPlayTypeWithBlindDate) {
- self.youpaipintroduceBtn.hidden = NO;
- }
- }
- /// 相亲玩法状态
- - (void)youpaifinitBlindDateProgressView{
- YOUPAILZChatRoomBlindDateProgressView *youpaipblindDateProgressView = [[YOUPAILZChatRoomBlindDateProgressView alloc] init];
- youpaipblindDateProgressView.hidden = YES;
- [self.view addSubview:youpaipblindDateProgressView];
- self.youpaipblindDateProgressView = youpaipblindDateProgressView;
- [youpaipblindDateProgressView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.offset(0.0f);
- make.top.equalTo(self.youpaiphostSeatView.mas_bottom).offset(-10.0f);
- make.height.offset(48.5f);
- }];
- [self youpaifsetupBlindDateProgressData];
- @weakify(self);
- [youpaipblindDateProgressView setBlindDateProgressBlock:^(NSInteger index) {
- @strongify(self);
- NSInteger status = index + 1;
- if (index == self.youpaipchatroomModel.youpaiptalk_played_status.count - 1) {
- status = 0;
- }
- YOUPAIHRWebWindow *window = [[YOUPAIHRWebWindow alloc] init];
- window.isTouchDismiss = YES;
- window.youpaipurl = [NSString stringWithFormat:@"%@&room_id=%@&status=%@",self.youpaipchatroomModel.youpaipblindDateChange.youpaipurl,self.youpaipchatroomModel.youpaiproom_id,@(status)];
- window.youpaipwidth = self.youpaipchatroomModel.youpaipblindDateChange.youpaipwidth;
- window.youpaipheight = self.youpaipchatroomModel.youpaipblindDateChange.youpaipheight;
- window.youpaipgravity = self.youpaipchatroomModel.youpaipblindDateChange.youpaipgravity;
- [self TFPresentVC:window completion:^{}];
- }];
-
- [youpaipblindDateProgressView setBlindDateSelectedBlock:^{
- @strongify(self);
- [self youpaifshowBlindDateSelectWindow];
- }];
- }
- - (void)youpaifshowBlindDateSelectWindow{
- YOUPAILZBlindDateSelectWindow *window = [[YOUPAILZBlindDateSelectWindow alloc] init];
- window.youpaipnormalSeatJsons = [YOUPAILZChatRoomSeatModel mj_keyValuesArrayWithObjectArray:self.youpaipchatroomModel.youpaipnormalSeats];
- window.youpaipchatroomModel = self.youpaipchatroomModel;
- [self TFPresentVC:window completion:^{}];
- }
- - (void)youpaifsetupBlindDateProgressData{
- if (self.youpaipchatroomModel.youpaipplayType == LZChatRoomPlayTypeWithBlindDate) {
- self.youpaipblindDateProgressView.hidden = NO;
- [self.youpaipblindDateProgressView youpaifreloadWithModel:self.youpaipchatroomModel];
- [self.youpaipotherSeatCollectionView mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.youpaipblindDateProgressView.mas_bottom).offset(24.0f);
- make.left.right.offset(0.0f);
- make.height.offset(228.0f);
- }];
- }else{
- self.youpaipblindDateProgressView.hidden = YES;
- [self.youpaipotherSeatCollectionView mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.youpaiphostSeatView.mas_bottom).offset(0.0f);
- make.left.right.offset(0.0f);
- make.height.offset(228.0f);
- }];
- }
- }
- /// 主持麦位
- - (void)youpaifinitSeatHostView{
-
- self.youpaipchatroomModel.youpaiphostSeat.youpaipseatType = LZChatRoomSeatTypeWithHost;
- self.youpaipchatroomModel.youpaiphostSeat.youpaipseatName = @"主持人";
- self.youpaipchatroomModel.youpaiphostSeat.youpaipseatIndex = 0;
- self.youpaipchatroomModel.youpaiphostSeat.youpaipplayType = self.youpaipchatroomModel.youpaipplayType;
- YOUPAILZChatRoomSeatView *youpaiphostSeatView = [[YOUPAILZChatRoomSeatView alloc] initWithAvatarSize:CGSizeMake(60.0f, 60.0f)];
- youpaiphostSeatView.youpaipmodel = self.youpaipchatroomModel.youpaiphostSeat;
- [self.view addSubview:youpaiphostSeatView];
- self.youpaiphostSeatView = youpaiphostSeatView;
- [youpaiphostSeatView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.view);
- make.top.equalTo(self.youpaipheaderView.mas_bottom).offset(10.0f);
- make.size.mas_offset(CGSizeMake(80.0f, 114.0f));
- }];
- UITapGestureRecognizer *tapGest = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(youpaifhostSeatClick)];
- [youpaiphostSeatView addGestureRecognizer:tapGest];
- }
- /// 点击主持位
- - (void)youpaifhostSeatClick{
-
- }
- /// 点击其他麦位
- - (void)youpaifotherSeatClickWithIndex:(NSInteger)index{
-
- }
- - (void)youpaifinitSeatOtherView{
- for (NSInteger i = 0; i < self.youpaipchatroomModel.youpaipnormalSeats.count; i ++) {
- YOUPAILZChatRoomSeatModel *seatModel = self.youpaipchatroomModel.youpaipnormalSeats[i];
- seatModel.youpaipseatType = LZChatRoomSeatTypeWithOrdinary;
- seatModel.youpaipseatName = [NSString stringWithFormat:@"%@号位",@(i + 1)];
- seatModel.youpaipseatIndex = i + 1;
- seatModel.youpaipplayType = self.youpaipchatroomModel.youpaipplayType;
- }
-
- {
- YOUPAILZChatRoomSeatModel *seatModel = self.youpaipchatroomModel.youpaipnormalSeats.lastObject;
- seatModel.youpaipseatType = LZChatRoomSeatTypeWithGuest;
- seatModel.youpaipisSelected = YES;
- if (self.youpaipchatroomModel.youpaipplayType == LZChatRoomPlayTypeWithBlindDate) {
- seatModel.youpaipisSelected = NO;
- }
- seatModel.youpaipseatName = @"老板专座";
- seatModel.youpaipplayType = self.youpaipchatroomModel.youpaipplayType;
- }
-
- UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
- flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
- flowLayout.minimumLineSpacing = 0.0f;
- flowLayout.minimumInteritemSpacing = 0.0f;
- flowLayout.sectionInset = UIEdgeInsetsMake(0.0f, 0.0f, 0.0f, 0.0f);
- flowLayout.itemSize = CGSizeMake(KScreenWidth / 4.0f, 114.0f);
- UICollectionView *youpaipotherSeatCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:flowLayout];
- youpaipotherSeatCollectionView.delegate = self;
- youpaipotherSeatCollectionView.dataSource = self;
- youpaipotherSeatCollectionView.showsVerticalScrollIndicator = NO;
- youpaipotherSeatCollectionView.showsHorizontalScrollIndicator = NO;
- youpaipotherSeatCollectionView.backgroundColor = [UIColor clearColor];
- youpaipotherSeatCollectionView.clipsToBounds = NO;
- [youpaipotherSeatCollectionView registerClass:YOUPAILZChatRoomOthearSeatCell.class forCellWithReuseIdentifier:NSStringFromClass(YOUPAILZChatRoomOthearSeatCell.class)];
- [self.view addSubview:youpaipotherSeatCollectionView];
- self.youpaipotherSeatCollectionView = youpaipotherSeatCollectionView;
- [youpaipotherSeatCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.youpaiphostSeatView.mas_bottom).offset(0.0f);
- make.left.right.offset(0.0f);
- make.height.offset(228.0f);
- }];
- }
- /// 刷新座位
- - (void)youpaifreloadSeats{
-
- self.youpaipchatroomModel.youpaiphostSeat.youpaipseatType = LZChatRoomSeatTypeWithHost;
- self.youpaipchatroomModel.youpaiphostSeat.youpaipseatName = @"主持人";
- self.youpaipchatroomModel.youpaiphostSeat.youpaipseatIndex = 0;
- self.youpaipchatroomModel.youpaiphostSeat.youpaipplayType = self.youpaipchatroomModel.youpaipplayType;
-
- for (NSInteger i = 0; i < self.youpaipchatroomModel.youpaipnormalSeats.count; i ++) {
- YOUPAILZChatRoomSeatModel *seatModel = self.youpaipchatroomModel.youpaipnormalSeats[i];
- seatModel.youpaipseatType = LZChatRoomSeatTypeWithOrdinary;
- seatModel.youpaipseatName = [NSString stringWithFormat:@"%@号位",@(i + 1)];
- seatModel.youpaipseatIndex = i + 1;
- seatModel.youpaipplayType = self.youpaipchatroomModel.youpaipplayType;
- }
-
- {
- YOUPAILZChatRoomSeatModel *seatModel = self.youpaipchatroomModel.youpaipnormalSeats.lastObject;
- seatModel.youpaipseatType = LZChatRoomSeatTypeWithGuest;
- seatModel.youpaipisSelected = YES;
- if (self.youpaipchatroomModel.youpaipplayType == LZChatRoomPlayTypeWithBlindDate) {
- seatModel.youpaipisSelected = NO;
- }
- seatModel.youpaipseatName = @"老板专座";
- seatModel.youpaipplayType = self.youpaipchatroomModel.youpaipplayType;
- }
-
- self.youpaiphostSeatView.youpaipmodel = self.youpaipchatroomModel.youpaiphostSeat;
-
- for (NSInteger i = 0; i < self.youpaipchatroomModel.youpaipnormalSeats.count; i ++) {
- YOUPAILZChatRoomOthearSeatCell *cell = (YOUPAILZChatRoomOthearSeatCell *)[self.youpaipotherSeatCollectionView cellForItemAtIndexPath:[NSIndexPath indexPathForItem:i inSection:0]];
- cell.youpaipseatView.youpaipmodel = self.youpaipchatroomModel.youpaipnormalSeats[i];
- }
-
- // [self.youpaipotherSeatCollectionView reloadData];
-
- YOUPAILZChatRoomSeatModel *currentSeatModel = nil;
- BOOL youpaipisCurrentUserUpSeat = NO;
- if ([self.youpaipchatroomModel.youpaiphostSeat.youpaipuserInfo.youpaipid isEqual:self.youpaipchatroomModel.youpaipuserInfo.youpaipid]) {
- currentSeatModel = self.youpaipchatroomModel.youpaiphostSeat;
- youpaipisCurrentUserUpSeat = YES;
- }
- for (YOUPAILZChatRoomSeatModel *seatModel in self.youpaipchatroomModel.youpaipnormalSeats) {
- if ([seatModel.youpaipuserInfo.youpaipid isEqual:self.youpaipchatroomModel.youpaipuserInfo.youpaipid]) {
- youpaipisCurrentUserUpSeat = YES;
- currentSeatModel = seatModel;
- }
- }
- if (self.youpaipisCurrentUserUpSeat != youpaipisCurrentUserUpSeat) {
- self.youpaipisCurrentUserUpSeat = youpaipisCurrentUserUpSeat;
- [self.youpaipfooterView youpaifshowMicBtn:youpaipisCurrentUserUpSeat];
- if (youpaipisCurrentUserUpSeat) {
- [[YOUPAILZChatRoomManager shareManager] youpaifsetClientRole:AgoraClientRoleBroadcaster];
- }else{
- [[YOUPAILZChatRoomManager shareManager] youpaifsetClientRole:AgoraClientRoleAudience];
- }
- }
- self.youpaipkeyboardView.isCurrentUserUpSeat = youpaipisCurrentUserUpSeat;
- self.youpaiplocalSeatModel = currentSeatModel;
-
- if (currentSeatModel != nil) {
- if (currentSeatModel.youpaipisDisableMicrophone) {
- [[YOUPAILZChatRoomManager shareManager] youpaifmuteLocalAudioStream:YES];
- self.youpaiplocalSeatModel.youpaipisTalking = NO;
- }else{
- if (self.youpaipfooterView.youpaipmicBtn.selected) {
- [[YOUPAILZChatRoomManager shareManager] youpaifmuteLocalAudioStream:YES];
- self.youpaiplocalSeatModel.youpaipisTalking = NO;
- }else{
- [[YOUPAILZChatRoomManager shareManager] youpaifmuteLocalAudioStream:NO];
- }
- }
- if (self.youpaipchatroomModel.youpaipuserInfo.youpaifroleType == LZUserRoleTypeWithNormal) {
- self.youpaipapplySeatButton.hidden = YES;
- }
- }else{
- if (self.youpaipchatroomModel.youpaipchatroomType == LZChatRoomTypeWithHost) {
- self.youpaipapplySeatButton.hidden = NO;
- }
- }
-
- /// 更新相亲玩法进度
- [self youpaifsetupBlindDateProgressData];
-
- NSMutableArray *seats = [YOUPAILZChatRoomSeatModel mj_keyValuesArrayWithObjectArray:self.youpaipchatroomModel.youpaipnormalSeats];
- NSMutableDictionary *hostSeatDict = [self.youpaipchatroomModel.youpaiphostSeat mj_keyValues];
- if (hostSeatDict != nil) {
- [seats insertObject:hostSeatDict atIndex:0];
- }
- //所有座位
- [[NSNotificationCenter defaultCenter]postNotificationName:@"UpdateChatRoomAllSeat" object:nil userInfo:@{@"seats":seats}];
- // 除主持位的其他位置
- [[NSNotificationCenter defaultCenter]postNotificationName:@"UpdateChatRoomSeat" object:nil userInfo:@{@"seats":[YOUPAILZChatRoomSeatModel mj_keyValuesArrayWithObjectArray:self.youpaipchatroomModel.youpaipnormalSeats]}];
-
- if (![self.youpaipchatroomModel.youpaiphostSeat.youpaipuserInfo.youpaipid isEqual:self.youpaipchatroomModel.youpaipuserInfo.youpaipid]) {
- [self.youpaiplyrieView youpaifclose];
- self.youpaiplyrieView.hidden = YES;
- [[YOUPAILZChatRoomManager shareManager] youpaifStopPlayMusic];
- [[YOUPAILZMusicManager shareManager] youpaifpause];
- [[YOUPAILZMusicManager shareManager] youpaifstopPlay];
- }
- }
- - (void)youpaifinitFooterView{
- YOUPAILZChatRoomFooterView *youpaipfooterView = [[YOUPAILZChatRoomFooterView alloc] init];
- [self.view addSubview:youpaipfooterView];
- self.youpaipfooterView = youpaipfooterView;
- [youpaipfooterView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.offset(0.0f);
- make.bottom.offset(-SafeHeight-10.0f);
- make.height.offset(32.0f);
- }];
- @weakify(self);
- [youpaipfooterView setYoupaipchatBtnClickBlock:^{
- @strongify(self);
- self.youpaipkeyboardView.hidden = NO;
- [self.youpaipkeyboardView showKeyBoard];
- }];
- [youpaipfooterView setYoupaipemojiBtnClickBlock:^{
- @strongify(self);
- self.youpaipkeyboardView.hidden = NO;
- [self.youpaipkeyboardView showEmoji];
- }];
- [youpaipfooterView setYoupaipmoreBtnClickBlock:^{
- @strongify(self);
- self.youpaipmoreModel.youpaipisSeatFree = self.youpaipchatroomModel.youpaipchatroomType == LZChatRoomTypeWithFree;
- self.youpaipmoreModel.youpaipisCloseChatMessage = self.youpaipchatroomModel.youpaiptalk_mute != 0; //是否关闭公屏
- self.youpaipmoreModel.youpaipisLock = self.youpaipchatroomModel.youpaiptalk_pwd == 1; // 房间是否设置密码 1已设置 0未设置
- self.youpaipmoreModel.youpaipisOpenCardiac = self.youpaipchatroomModel.youpaipplayType == LZChatRoomPlayTypeWithCardiac; // 是否开启心动值玩法
- self.youpaipmoreModel.youpaipisOpenBlindDate = self.youpaipchatroomModel.youpaipplayType == LZChatRoomPlayTypeWithBlindDate; // 是否开启相亲玩法
- YOUPAIZYChatRoomMoreWindow *window = [[YOUPAIZYChatRoomMoreWindow alloc] initWithModel:self.youpaipchatroomModel youpaipmoreModel:self.youpaipmoreModel];
- window.isTouchDismiss = YES;
- [window setYoupaipitemClickBlock:^(LZChatRoomOperationType type, BOOL isOpen) {
- @strongify(self);
- [self youpaifmoreWindowItemClickWithType:type isOpen:isOpen];
- }];
- self.youpaipmoreWindow = window;
- [self TFPresentVC:window completion:^{}];
- }];
- [youpaipfooterView setMessageBtnClickBlock:^{
- @strongify(self);
- if ([LCSaveData getWhiteVersion]) {
- YOUPAIBBMessageVC *vc = [[YOUPAIBBMessageVC alloc]init];
- vc.title = @"消息";
- [self.navigationController pushViewController:vc animated:YES];
- }else{
- YOUPAILCMessageVC *vc = [[YOUPAILCMessageVC alloc]init];
- vc.title = @"消息";
- [self.navigationController pushViewController:vc animated:YES];
- }
-
- }];
- [youpaipfooterView setYoupaipmicBtnClickBlock:^{
- @strongify(self);
- if (self.youpaiplocalSeatModel.youpaipisDisableMicrophone) {
- [[YOUPAILZChatRoomManager shareManager] youpaifmuteLocalAudioStream:YES];
- self.youpaiplocalSeatModel.youpaipisTalking = NO;
- [ZCHUDHelper showTitle:@"已闭麦"];
- }else{
- if (self.youpaipfooterView.youpaipmicBtn.selected) {
- [[YOUPAILZChatRoomManager shareManager] youpaifmuteLocalAudioStream:YES];
- self.youpaiplocalSeatModel.youpaipisTalking = NO;
- [ZCHUDHelper showTitle:@"已闭麦"];
- }else{
- [[YOUPAILZChatRoomManager shareManager] youpaifmuteLocalAudioStream:NO];
- [ZCHUDHelper showTitle:@"已开麦"];
- }
- }
- }];
-
- [youpaipfooterView setYoupaipgameBtnClickBlock:^{
- @strongify(self);
- [self youpaifshowGameWindow];
- }];
- [youpaipfooterView setYoupaipgiftBtnClickBlock:^{
- @strongify(self);
- [self youpaifshowGiftWindow];
- }];
- }
- /// 游戏中心弹窗
- - (void)youpaifshowGameWindow{
- @weakify(self);
- [LCHttpHelper requestWithURLString:GetAdvert parameters:@{@"position":@(9)} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- @strongify(self);
- YOUPAILCFirstRechargeModel *firstRechargeModel = [YOUPAILCFirstRechargeModel mj_objectWithKeyValues:dict[@"data"]];
- if (firstRechargeModel.youpaiplist.count == 0) {
- [ZCHUDHelper showTitle:@"暂时没有相关活动"];
- return;
- }
- YOUPAILZChatRoomGameCenterWindow *window = [[YOUPAILZChatRoomGameCenterWindow alloc] init];
- window.youpaiplist = firstRechargeModel.youpaiplist;
- window.isTouchDismiss = YES;
- [window setYoupaipitemClickBlock:^(YOUPAILCBannerModel * _Nonnull model) {
- @strongify(self);
- if (model.youpaipwindow_type == 2) {
- YOUPAIHRWebWindow *window = [[YOUPAIHRWebWindow alloc] init];
- window.isTouchDismiss = YES;
- window.youpaipurl = model.youpaipwindow_link;
- window.youpaipwidth = model.youpaipwidth;
- window.youpaipheight = model.youpaipheight;
- window.youpaipgravity = model.youpaipgravity;
- [self TFPresentVC:window completion:^{}];
- }else{
- if (model.youpaiplink_type == 1) {
- ZCBaseWebVC* baseWeb = [[ZCBaseWebVC alloc]init];
- baseWeb.contentUrl = model.youpaiplink_url;
- [[LCTools getContainNavigationControllerCurrentVC].navigationController pushViewController:baseWeb animated:YES];
- }else if (model.youpaiplink_type==2 || model.youpaiplink_type==3){
- [[LCTools getContainNavigationControllerCurrentVC] youpaifpageToStr:model.youpaiplink_url];
- }else{
-
-
- }
- }
- }];
- [self TFPresentVC:window completion:^{}];
- }
- } failure:^(NSError *error) {
-
- }];
- }
- /// 礼物弹窗
- - (void)youpaifshowGiftWindow{
- @weakify(self);
- YOUPAIHRChatRoomGiftView *giftWindow = [[YOUPAIHRChatRoomGiftView alloc] init];
- giftWindow.isTouchDismiss = YES;
- NSMutableArray *seats = [YOUPAILZChatRoomSeatModel mj_keyValuesArrayWithObjectArray:self.youpaipchatroomModel.youpaipnormalSeats];
- NSMutableDictionary *hostSeatDict = [self.youpaipchatroomModel.youpaiphostSeat mj_keyValues];
- if (hostSeatDict != nil) {
- [seats insertObject:hostSeatDict atIndex:0];
- }
- giftWindow.youpaipnormalSeatJsons = seats;
-
-
- /// 赠送礼物
- [giftWindow setYoupaiplzgiftblock:^(YOUPAILCGiftModel * _Nonnull giftModel, NSString * _Nonnull userIds, NSInteger count, NSString * _Nonnull categoryID) {
- @strongify(self);
- [LCHttpHelper requestWithURLString:TalkSendGift parameters:@{@"to_uid":userIds,@"gift_id":giftModel.youpaipid,@"num":@(count),@"room_id":self.youpaipchatroomModel.youpaiproom_id,@"gift_type_id":categoryID} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- [ZCHUDHelper showTitle:@"礼物赠送成功"];
- [giftWindow youpaifreloadBalance];
- }
- } failure:^(NSError *error) {
- }];
- }];
-
- /// 跳转到钱包
- [giftWindow setYoupaipjumToWalletBlock1:^{
- @strongify(self);
- // YOUPAIHRRechargePayWindow *payWindow = [YOUPAIHRRechargePayWindow new];
- // payWindow.isTouchDismiss = NO;
- // [self TFPresentVC:payWindow completion:^{
- //
- // }];
- YMAccountBalanceViewModel *accountBalanceVM = [[YMAccountBalanceViewModel alloc]initWithParams:@{
- ParamsId:@([[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id intValue])
- }];
- YMAccountBalanceRechargePopupView *customView = [[YMAccountBalanceRechargePopupView alloc]init];
- [customView ym_bindViewModel:accountBalanceVM];
- YMPopupView *popupView = [YMPopupView initWithCustomView:customView parentView:nil popStyle:YMPopupStyleSmoothFromBottom dismissStyle:YMDismissStyleSmoothToBottom];
- popupView.priority = 999;
- popupView.cornerRadius = adapt(10);
- popupView.rectCorners = UIRectCornerTopLeft|UIRectCornerTopRight;
- popupView.positionStyle = YMPositionStyleBottom;
- popupView.isClickBgDismiss = YES;
- popupView.isHideBg = NO;
- popupView.bgAlpha = 0.5;
- [popupView pop];
-
- @weakify(popupView)
- customView.dismissBlock = ^{
- @strongify(popupView)
- [popupView dismissWithStyle:YMDismissStyleSmoothToBottom duration:2.0];
- };
- }];
-
- /// 广告
- [giftWindow setYoupaiptouchAdvertBlock:^(YOUPAILCBannerModel * _Nonnull bannerModel) {
- @strongify(self);
- if (bannerModel.youpaiplink_type==1) {
- ZCBaseWebVC* baseWeb = [[ZCBaseWebVC alloc]init];
- baseWeb.contentUrl = bannerModel.youpaiplink_url;
- [self.navigationController pushViewController:baseWeb animated:YES];
- }else if (bannerModel.youpaiplink_type==2||bannerModel.youpaiplink_type==3){
- [self youpaifpageToStr:bannerModel.youpaiplink_url];
- }
-
- }];
- [self TFPresentVC:giftWindow completion:^{}];
- }
- ///更多item点击操作
- - (void)youpaifmoreWindowItemClickWithType:(LZChatRoomOperationType)type isOpen:(BOOL)isOpen{
- switch (type) {
- case LZChatRoomOperationTypeWithAnimation:{
- self.youpaipmoreModel.youpaipisCloseAnimation = isOpen;
- if (self.youpaipmoreModel.youpaipisCloseAnimation) {
- [ZCHUDHelper showTitle:@"动画特效已关闭"];
- }else{
- [ZCHUDHelper showTitle:@"动画特效已开启"];
- }
- }
- break;
- case LZChatRoomOperationTypeWithFreeSeat:{
- [self youpaifadjustSeatAlertWithIsOpen:isOpen];
- }
- break;
- case LZChatRoomOperationTypeWithEmptyChat:{
- [self youpaifemptyChatAlert];
- }
- break;
- case LZChatRoomOperationTypeWithCloseChat:{
- [self youpaifchatroomMessageAlertWithIsOpen:isOpen];
- }
- break;
- case LZChatRoomOperationTypeWithRoomLock:{
- [self youpaifchatroomLockWithIsOpen:isOpen];
- }
- break;
- case LZChatRoomOperationTypeWithRoomInfo:{
- [self youpaifchatroomEditInfo];
- }
- break;
- case LZChatRoomOperationTypeWithDisableMessage:{
- [self youpaifblackOrDisableMessageListWithType:@"mute" youpaiptitleStr:@"禁言管理" youpaipbtnTitle:@"解除禁言"];
- }
- break;
- case LZChatRoomOperationTypeWithRoomBlockList:{
- [self youpaifblackOrDisableMessageListWithType:@"kick" youpaiptitleStr:@"房间黑名单" youpaipbtnTitle:@"解除限制"];
- }
- break;
- case LZChatRoomOperationTypeWithBgMusic:{
- [self youpaifbackgoundMusic];
- }
- break;
- case LZChatRoomOperationTypeWithMute:{
- self.youpaipmoreModel.youpaipisRemoteAudio = !self.youpaipmoreModel.youpaipisRemoteAudio;
- if (self.youpaipmoreModel.youpaipisRemoteAudio) {
- [ZCHUDHelper showTitle:@"静音已打开"];
- }else{
- [ZCHUDHelper showTitle:@"静音已关闭"];
- }
- [[YOUPAILZChatRoomManager shareManager] youpaifmuteAllRemoteAudioStreams:self.youpaipmoreModel.youpaipisRemoteAudio];
- }
- break;
- case LZChatRoomOperationTypeWithReport:{
- YOUPAILZChatRoomReportWindow *window = [[YOUPAILZChatRoomReportWindow alloc] init];
- window.youpaipchatroomModel = self.youpaipchatroomModel;
- [self TFPresentVC:window completion:^{}];
- }
- break;
- case LZChatRoomOperationTypeWithCardiac:{
-
- NSString *title = @"开启心动值";
- NSString *content = @"麦位下将开启心动值的展示与统计\n(礼物价值累加)";
- if (!isOpen) {
- title = @"关闭心动值";
- content = @"麦位下将关闭心动值的展示与统计";
- }
-
- @weakify(self);
- LZAlertAction *cancelAction = [LZAlertAction actionWithTitle:@"取消" handler:^(LZAlertAction *action) {
- }];
- cancelAction.cornerRadius = 24.0f;
- cancelAction.bgColor = HexColorFromRGB(0x9F9DA5);
- LZAlertAction *confimAction = [LZAlertAction actionWithTitle:@"确定" handler:^(LZAlertAction *action) {
- @strongify(self);
- if (isOpen) {
- [self youpaiftransferPlayWithType:1];
- }else{
- [self youpaiftransferPlayWithType:0];
- }
- }];
- confimAction.cornerRadius = 24.0f;
- confimAction.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 105.0f) / 2.0f, 48.0f) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:GradientLeftToRight]];
- LZAlertWindow *alert = [LZAlertWindow alertWithTitle:title content:content action:@[cancelAction,confimAction]];
- alert.contentTextAlignment = NSTextAlignmentCenter;
- [self TFPresentVC:alert completion:^{}];
- }
- break;
- case LZChatRoomOperationTypeWithClearCardiac:{
- @weakify(self);
- LZAlertAction *cancelAction = [LZAlertAction actionWithTitle:@"取消" handler:^(LZAlertAction *action) {
- }];
- cancelAction.cornerRadius = 24.0f;
- cancelAction.bgColor = HexColorFromRGB(0x9F9DA5);
- LZAlertAction *confimAction = [LZAlertAction actionWithTitle:@"确定" handler:^(LZAlertAction *action) {
- @strongify(self);
- [self youpaifclearCardiac];
- }];
- confimAction.cornerRadius = 24.0f;
- confimAction.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 105.0f) / 2.0f, 48.0f) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:GradientLeftToRight]];
- LZAlertWindow *alert = [LZAlertWindow alertWithTitle:@"清空心动值" content:@"将清空所有麦上用户现有的心动值,\n重新统计" action:@[cancelAction,confimAction]];
- alert.contentTextAlignment = NSTextAlignmentCenter;
- [self TFPresentVC:alert completion:^{}];
- }
- break;
- case LZChatRoomOperationTypeWithBlindDate:{
-
- NSString *title = @"开启相亲";
- NSString *content = @"当前房间将更换为相亲玩法";
- if (!isOpen) {
- title = @"关闭相亲";
- content = @"当前房间将关闭相亲玩法,恢复普通语聊房";
- }
-
- @weakify(self);
- LZAlertAction *cancelAction = [LZAlertAction actionWithTitle:@"取消" handler:^(LZAlertAction *action) {
- }];
- cancelAction.cornerRadius = 24.0f;
- cancelAction.bgColor = HexColorFromRGB(0x9F9DA5);
- LZAlertAction *confimAction = [LZAlertAction actionWithTitle:@"确定" handler:^(LZAlertAction *action) {
- @strongify(self);
- if (isOpen) {
- [self youpaiftransferPlayWithType:3];
- }else{
- [self youpaiftransferPlayWithType:2];
- }
- }];
- confimAction.cornerRadius = 24.0f;
- confimAction.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 105.0f) / 2.0f, 48.0f) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:GradientLeftToRight]];
- LZAlertWindow *alert = [LZAlertWindow alertWithTitle:title content:content action:@[cancelAction,confimAction]];
- alert.contentTextAlignment = NSTextAlignmentCenter;
- [self TFPresentVC:alert completion:^{}];
- }
- break;
- case LZChatRoomOperationTypeWithBackgoundImage:{
- YOUPAILZChatRoomSetterBgImgWindow *window = [[YOUPAILZChatRoomSetterBgImgWindow alloc] init];
- window.isTouchDismiss = YES;
- window.youpaipchatroomModel = self.youpaipchatroomModel;
- [self TFPresentVC:window completion:^{}];
- }
- break;
- default:
- break;
- }
- }
- /// 切换玩法
- /// type 0关闭心动 1开启心动 2关闭相亲 3开启相亲
- - (void)youpaiftransferPlayWithType:(NSInteger)type{
- [LCHttpHelper requestWithURLString:ChatroomCardiac parameters:@{@"room_id":self.youpaipchatroomModel.youpaiproom_id,@"type":@(type)} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- [ZCHUDHelper showTitle:@"操作成功"];
- }
- } failure:^(NSError *error) {
- }];
- }
- /// 清空心动值
- - (void)youpaifclearCardiac{
- [LCHttpHelper requestWithURLString:ChatroomClearCardiac parameters:@{@"room_id":self.youpaipchatroomModel.youpaiproom_id} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- [ZCHUDHelper showTitle:@"操作成功"];
- }
- } failure:^(NSError *error) {
- }];
- }
- /// 调整麦序弹框
- - (void)youpaifadjustSeatAlertWithIsOpen:(BOOL)isOpen{
- NSString *title = @"开启自由麦序";
- NSString *content = @"当前房间内所有用户可自由上下麦";
- if (!isOpen) {
- title = @"关闭自由麦序";
- content = @"当前房间内所有用户将无法自由上下麦";
- }
-
-
- @weakify(self);
- LZAlertAction *cancelAction = [LZAlertAction actionWithTitle:@"取消" handler:^(LZAlertAction *action) {
- }];
- cancelAction.cornerRadius = 24.0f;
- cancelAction.bgColor = HexColorFromRGB(0x9F9DA5);
- LZAlertAction *confimAction = [LZAlertAction actionWithTitle:@"确定" handler:^(LZAlertAction *action) {
- @strongify(self);
- [self youpaifadjustSeatWithIsOpen:isOpen];
- }];
- confimAction.cornerRadius = 24.0f;
- confimAction.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 105.0f) / 2.0f, 48.0f) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:GradientLeftToRight]];
- LZAlertWindow *alert = [LZAlertWindow alertWithTitle:title content:content action:@[cancelAction,confimAction]];
- alert.contentTextAlignment = NSTextAlignmentCenter;
- [self TFPresentVC:alert completion:^{}];
-
- }
- /// 调整麦序
- - (void)youpaifadjustSeatWithIsOpen:(BOOL)isOpen{
- if (isOpen) {
- self.youpaipchatroomModel.youpaiptalk_type = @"free"; // 自由麦
- }else{
- self.youpaipchatroomModel.youpaiptalk_type = @"host"; // 主持麦
- }
- [LCHttpHelper requestWithURLString:SetTalkType parameters:@{@"room_id":self.youpaipchatroomModel.youpaiproom_id,@"operate":self.youpaipchatroomModel.youpaiptalk_type} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- [ZCHUDHelper showTitle:@"操作成功"];
- }
- } failure:^(NSError *error) {
- }];
- }
- /// 清空公屏
- - (void)youpaifemptyChatAlert{
- @weakify(self);
- LZAlertAction *cancelAction = [LZAlertAction actionWithTitle:@"取消" handler:^(LZAlertAction *action) {
- }];
- cancelAction.cornerRadius = 24.0f;
- cancelAction.bgColor = HexColorFromRGB(0x9F9DA5);
- LZAlertAction *confimAction = [LZAlertAction actionWithTitle:@"确定" handler:^(LZAlertAction *action) {
- @strongify(self);
- [LCHttpHelper requestWithURLString:ClearTalk parameters:@{@"room_id":self.youpaipchatroomModel.youpaiproom_id} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- } failure:^(NSError *error) {
- }];
- }];
- confimAction.cornerRadius = 24.0f;
- confimAction.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 105.0f) / 2.0f, 48.0f) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:GradientLeftToRight]];
- LZAlertWindow *alert = [LZAlertWindow alertWithTitle:@"清空公屏" content:@"当前房间内所有用户的公屏消息将被清空" action:@[cancelAction,confimAction]];
- alert.contentTextAlignment = NSTextAlignmentCenter;
- [self TFPresentVC:alert completion:^{}];
- }
- /// 房间上锁
- - (void)youpaifchatroomLockWithIsOpen:(BOOL)isOpen{
- if (isOpen) {
- YOUPAILZChatRoomUpLockWindow *window = [[YOUPAILZChatRoomUpLockWindow alloc] init];
- @weakify(self);
- [window setYoupaipconfirmBtnClickBlock:^(NSString * _Nonnull password) {
- @strongify(self);
- [self youpaifchatroomLockWithPassword:password];
- }];
- [self TFPresentVC:window completion:^{}];
- }else{
- [self youpaifchatroomLockWithPassword:@""];
- }
-
- }
- /// 房间上锁、解锁
- - (void)youpaifchatroomLockWithPassword:(NSString *)password{
- [LCHttpHelper requestWithURLString:SetTalkPwd parameters:@{@"room_id":self.youpaipchatroomModel.youpaiproom_id,@"pwd":password} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- if (password.length == 0) {
- [ZCHUDHelper showTitle:@"房间已解锁"];
- }else{
- [ZCHUDHelper showTitle:@"房间已上锁"];
- }
-
- }
- } failure:^(NSError *error) {
- }];
- }
- /// 语聊房消息是否开启弹窗
- - (void)youpaifchatroomMessageAlertWithIsOpen:(BOOL)isOpen{
- NSString *title = @"关闭公屏";
- NSString *content = @"当前房间内所有用户将无法发送公屏消息";
- if (!isOpen) {
- title = @"开启公屏";
- content = @"当前房间内所有用户可正常发送公屏消息";
- }
-
-
- @weakify(self);
- LZAlertAction *cancelAction = [LZAlertAction actionWithTitle:@"取消" handler:^(LZAlertAction *action) {
- }];
- cancelAction.cornerRadius = 24.0f;
- cancelAction.bgColor = HexColorFromRGB(0x9F9DA5);
- LZAlertAction *confimAction = [LZAlertAction actionWithTitle:@"确定" handler:^(LZAlertAction *action) {
- @strongify(self);
- [self youpaifchatroomMessageWithIsOpen:isOpen];
- }];
- confimAction.cornerRadius = 24.0f;
- confimAction.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 105.0f) / 2.0f, 48.0f) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:GradientLeftToRight]];
- LZAlertWindow *alert = [LZAlertWindow alertWithTitle:title content:content action:@[cancelAction,confimAction]];
- alert.contentTextAlignment = NSTextAlignmentCenter;
- [self TFPresentVC:alert completion:^{}];
- }
- /// 语聊房消息是否开启
- - (void)youpaifchatroomMessageWithIsOpen:(BOOL)isOpen{
- NSInteger type = 0;
- if (isOpen) {
- type = 1;
- }
- [LCHttpHelper requestWithURLString:OpenACloseTalk parameters:@{@"room_id":self.youpaipchatroomModel.youpaiproom_id,@"type":@(type)} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- } failure:^(NSError *error) {
- }];
- }
- /// 编辑房间资料
- - (void)youpaifchatroomEditInfo{
- YOUPAILZChatRoomInfoEditWindow *window = [[YOUPAILZChatRoomInfoEditWindow alloc] init];
- window.youpaipchatroomModel = self.youpaipchatroomModel;
- window.isTouchDismiss = NO;
- [self TFPresentVC:window completion:^{}];
- }
- /// 背景音乐
- - (void)youpaifbackgoundMusic{
- self.youpaiplyrieView.hidden = NO;
- YOUPAILZMusicLibraryWindow *window = [[YOUPAILZMusicLibraryWindow alloc] init];
- window.isTouchDismiss = YES;
- @weakify(self);
- [window setMusicLibBtnClickBlock:^{
- @strongify(self);
- YOUPAILZMusicWindow *musicWindow = [[YOUPAILZMusicWindow alloc] init];
- musicWindow.isTouchDismiss = YES;
- [self TFPresentVC:musicWindow completion:^{}];
- }];
- [window setCloseBtnClickBlock:^{
- @strongify(self);
- [self.youpaiplyrieView youpaifclose];
- self.youpaiplyrieView.hidden = YES;
- [[YOUPAILZChatRoomManager shareManager] youpaifStopPlayMusic];
- [[YOUPAILZMusicManager shareManager] youpaifpause];
- [[YOUPAILZMusicManager shareManager] youpaifstopPlay];
- }];
- [self TFPresentVC:window completion:^{}];
- }
- /// 黑名单、禁言列表
- - (void)youpaifblackOrDisableMessageListWithType:(NSString *)type youpaiptitleStr:(NSString *)youpaiptitleStr youpaipbtnTitle:(NSString *)youpaipbtnTitle{
- YOUPAILZChatRoomBlockListWindow *window = [[YOUPAILZChatRoomBlockListWindow alloc] init];
- window.youpaipchatroomModel = self.youpaipchatroomModel;
- window.youpaiptype = type;
- window.youpaiptitleStr = youpaiptitleStr;
- window.youpaipbtnTitle = youpaipbtnTitle;
- [self TFPresentVC:window completion:^{}];
- }
- - (void)youpaifinitKeyboardView{
- @weakify(self);
- LZBKeyBoardToolEmojiBar *keyboardView = [LZBKeyBoardToolEmojiBar showKeyBoardWithConfigToolBarHeight:0 sendTextCompletion:^(NSString *sendText) {
- @strongify(self);
- NSString *temp = [sendText stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
- NSString *text = [temp stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
- if (text.length != 0) {
- @weakify(self);
- [LCHttpHelper requestWithURLString:ChatRoomSendMessage parameters:@{@"room_id":self.youpaipchatroomModel.youpaiproom_id,@"content":text} needToken:YES type:HttpRequestTypePost success:^(id responseObject) {
- @strongify(self);
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code == 0) {
- NIMSession *session = [NIMSession session:self.youpaipchatroomModel.youpaiproom_id type:NIMSessionTypeChatroom];
- NIMMessage *imMessage = [NIMMessageMaker msgWithText:[[dict objectForKey:@"data"] objectForKey:@"content"]];
- if ([[[NIMSDK sharedSDK] chatManager] sendMessage:imMessage toSession:session error:nil]) {
- [self.youpaipkeyboardView resignFirstResponder];
- self.youpaipkeyboardView.hidden = YES;
- }
- }else{
- [self.youpaipkeyboardView resignFirstResponder];
- self.youpaipkeyboardView.hidden = YES;
- [ZCHUDHelper showTitle:[dict objectForKey:@"message"]];
- }
- } failure:^(NSError *error) {
- @strongify(self);
- [self.youpaipkeyboardView resignFirstResponder];
- self.youpaipkeyboardView.hidden = YES;
- [ZCHUDHelper showTitle:error.localizedDescription];
- }];
- }
- }];
- [keyboardView setAnimationEmojiBtnClickBlock:^{
- @strongify(self);
- [self.youpaipkeyboardView resignFirstResponder];
- self.youpaipkeyboardView.hidden = YES;
- YOUPAILZChatRoomEmojiAnimationWindow *window = [[YOUPAILZChatRoomEmojiAnimationWindow alloc] init];
- window.youpaipchatroomModel = self.youpaipchatroomModel;
- window.isTouchDismiss = YES;
- [window setYoupaipyoupaifchatEmojiBtnClickBlock:^{
- @strongify(self);
- self.youpaipkeyboardView.hidden = NO;
- [self.youpaipkeyboardView showEmoji];
- }];
- [self TFPresentVC:window completion:^{}];
- }];
- [keyboardView setInputViewPlaceHolderText:@"说点什么…"];
- keyboardView.hidden = YES;
- [self.view addSubview:keyboardView];
- self.youpaipkeyboardView = keyboardView;
- }
- - (void)youpaifinitMessageTableView{
- //消息列表
- UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
- tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- tableView.showsVerticalScrollIndicator = NO;
- tableView.delegate = self;
- tableView.dataSource = self;
- tableView.backgroundColor = [UIColor clearColor];
- // tableView.transform = CGAffineTransformMakeRotation(M_PI * 1.0001f);
- tableView.transform = CGAffineTransformMakeScale(1, -1);
- tableView.rowHeight = UITableViewAutomaticDimension;
- tableView.estimatedSectionHeaderHeight = 0.0f;
- tableView.estimatedSectionFooterHeight = 0.0f;
- [self.view addSubview:tableView];
- self.youpaipmessageTableView = tableView;
- [tableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(10.0f);
- make.bottom.equalTo(self.youpaipfooterView.mas_top).offset(-14.0f);
- make.width.offset(276.0f);
- make.top.equalTo(self.youpaipotherSeatCollectionView.mas_bottom).offset(0.0f);
- }];
- }
- // 我要上麦、排麦中、上麦申请按钮
- - (void)youpaifinitApplySeatButton{
- BOOL youpaipisHide = NO;
- if (self.youpaipchatroomModel.youpaipchatroomType == LZChatRoomTypeWithFree) {
- youpaipisHide = YES;
- }
- LZChatRoomApplySeatType applySeatType = LZChatRoomApplySeatTypeWithUpSeat;
- if (self.youpaipchatroomModel.youpaipuserInfo.youpaifroleType != LZUserRoleTypeWithNormal) {
- applySeatType = LZChatRoomApplySeatTypeWithApplyList;
- }
- YOUPAILZChatRoomApplySeatButton *youpaipapplySeatButton = [[YOUPAILZChatRoomApplySeatButton alloc] initWithType:applySeatType playType:self.youpaipchatroomModel.youpaipplayType];
- youpaipapplySeatButton.hidden = youpaipisHide;
- youpaipapplySeatButton.youpaipmemberCount = [self.youpaipchatroomModel.youpaipsay_count integerValue];
- [youpaipapplySeatButton addTarget:self action:@selector(youpaifapplySeatButtonClick) forControlEvents:UIControlEventTouchUpInside];
- [self.view addSubview:youpaipapplySeatButton];
- self.youpaipapplySeatButton = youpaipapplySeatButton;
- [youpaipapplySeatButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(-14.0f);
- make.bottom.equalTo(self.youpaipfooterView.mas_top).offset(2.0f);
- make.size.mas_offset(CGSizeMake(50.0f, 50.0f));
- }];
- }
- /// 广告banner
- - (void)youpaifinitAdvertView{
- SDCycleScrollView *youpaipcycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero delegate:nil placeholderImage:nil];
- youpaipcycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFit;
- youpaipcycleScrollView.hidden = YES;
- [self.view addSubview:youpaipcycleScrollView];
- self.youpaipcycleScrollView = youpaipcycleScrollView;
- [youpaipcycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-14.0f);
- make.bottom.equalTo(self.youpaipapplySeatButton.mas_top).offset(-11.0f);
- make.size.mas_equalTo(CGSizeMake(50, 50));
- }];
- youpaipcycleScrollView.autoScrollTimeInterval = 5.0;//2s轮播
- youpaipcycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleNone;
- youpaipcycleScrollView.backgroundColor = [UIColor clearColor];
- @weakify(self);
- [youpaipcycleScrollView setClickItemOperationBlock:^(NSInteger currentIndex) {
- @strongify(self);
- YOUPAILCBannerModel* model = self.youpaipfirstRechargeModel.youpaiplist[currentIndex];
- if (model.youpaipwindow_type == 2) {
- YOUPAIHRWebWindow *window = [[YOUPAIHRWebWindow alloc] init];
- window.isTouchDismiss = YES;
- window.youpaipurl = model.youpaipwindow_link;
- window.youpaipwidth = model.youpaipwidth;
- window.youpaipheight = model.youpaipheight;
- window.youpaipgravity = model.youpaipgravity;
- [self TFPresentVC:window completion:^{}];
- }else{
- if (model.youpaiplink_type==1) {
- ZCBaseWebVC* baseWeb = [[ZCBaseWebVC alloc]init];
- baseWeb.contentUrl = model.youpaiplink_url;
- [self.navigationController pushViewController:baseWeb animated:YES];
- }else if (model.youpaiplink_type==2||model.youpaiplink_type==3){
- [self youpaifpageToStr:model.youpaiplink_url];
- }
- }
- }];
-
- [self youpaifloadAdvertRecharge];
- }
- /// 广告位数据
- -(void)youpaifloadAdvertRecharge{
- @weakify(self);
- [LCHttpHelper requestWithURLString:GetAdvert parameters:@{@"position":@"8"} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- @strongify(self);
- self.youpaipfirstRechargeModel = [YOUPAILCFirstRechargeModel mj_objectWithKeyValues:dict[@"data"]];
- NSMutableArray *imgUrlArray = [NSMutableArray new];
- for (YOUPAILCBannerModel* model in self.youpaipfirstRechargeModel.youpaiplist) {
- [imgUrlArray addObject:[LCTools getImageUrlWithAddress:model.youpaipimage]];
- }
- self.youpaipcycleScrollView.imageURLStringsGroup = imgUrlArray;
- if (self.youpaipfirstRechargeModel.youpaipis_open == 1) {
- self.youpaipcycleScrollView.hidden = NO;
- }else{
- self.youpaipcycleScrollView.hidden = YES;
- }
- }
- } failure:^(NSError *error) {}];
- }
- /// 歌词View
- - (void)youpaifinitMusicLyrieView{
- YOUPAILZMusicLyrieView *youpaiplyrieView = [[YOUPAILZMusicLyrieView alloc] init];
- youpaiplyrieView.frame = CGRectMake(KScreenWidth - 68.0f - 8.0f, (KScreenHeight - 68.0f) / 2.0f, 68.0f, 68.0f);
- youpaiplyrieView.hidden = YES;
- [self.view addSubview:youpaiplyrieView];
- self.youpaiplyrieView = youpaiplyrieView;
-
- UIPanGestureRecognizer *panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(youpaifmusicHandlePan:)];
- [youpaiplyrieView addGestureRecognizer:panGestureRecognizer];
- UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(youpaifmusicHandleTap)];
- [youpaiplyrieView addGestureRecognizer:tapGestureRecognizer];
- }
- - (void)youpaifmusicHandlePan:(UIPanGestureRecognizer*)recognizer{
- CGPoint translation = [recognizer translationInView:self.view];
- if(recognizer.state == UIViewAnimatingPositionStart){
- self.youpaipmusicPlayerViewY = self.youpaiplyrieView.mj_y;
- }else if (recognizer.state == UIGestureRecognizerStateChanged) {
- self.youpaiplyrieView.mj_y = self.youpaipmusicPlayerViewY + translation.y;
- }else if(recognizer.state == UIGestureRecognizerStateEnded || recognizer.state == UIGestureRecognizerStateCancelled) {
-
- [UIView animateWithDuration:0.25f animations:^{
- if (self.youpaiplyrieView.mj_y < NavBarHeight) {
- self.youpaiplyrieView.mj_y = NavBarHeight;
- }else if (self.youpaiplyrieView.mj_y > KScreenHeight - TabbarHeight - self.youpaiplyrieView.mj_h){
- self.youpaiplyrieView.mj_y = KScreenHeight - TabbarHeight - self.youpaiplyrieView.mj_h;
- }
- }];
- }
- }
- - (void)youpaifmusicHandleTap{
- [self youpaifbackgoundMusic];
- }
- /// 上麦处理按钮事件
- - (void)youpaifapplySeatButtonClick{
-
- }
- /// 初始化声网SDK
- - (void)youpaifinitializeAgoraEngine{
- [[YOUPAILZChatRoomManager shareManager] youpaifinitializeAgoraEngine];
- }
- - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
- [self.youpaipkeyboardView resignFirstResponder];
- self.youpaipkeyboardView.hidden = YES;
- }
- /// 关闭按钮事件
- - (void)youpaifcloseBtnClick{
- [self.navigationController popViewControllerAnimated:YES];
- }
- /// 点击公告事件
- - (void)youpaifnoticeBtnClick{
- if (self.youpaipchatroomModel.youpaiptalk_notice.length == 0) {
- return;
- }
- @weakify(self);
- self.youpaipnoticePopupMenu = [YBPopupMenu showRelyOnView:self.youpaipnoticeBtn titles:@[@"",@""] icons:@[@"",@""] menuWidth:KScreenWidth - 32.0f otherSettings:^(YBPopupMenu *popupMenu) {
- @strongify(self)
- popupMenu.delegate = self;
- popupMenu.borderWidth = 0.5f;
- popupMenu.borderColor = HexColorFromRGB(0x4F4B5B);
- popupMenu.backColor = HexColorFromRGB(0x2A2935);
- }];
-
- self.youpaipnoticePopupMenu.mj_h = 41.0f + [self.youpaipchatroomModel.youpaiptalk_notice heightForFont:LCFont(13.0f) width:KScreenWidth - 32.0f - 34.0f] + 40.0f + 10.0f;
- }
- - (void)youpaifnoticePopupMenuDismiss{
- [self.youpaipnoticePopupMenu dismiss];
- }
- // 展示个人信息
- - (void)youpaifshowUserInfoWithUserId:(NSString *)userId{
- if (self.isLoadingUserInfo) {
- return;
- }
- self.isLoadingUserInfo = YES;
- @weakify(self);
- [LCHttpHelper requestWithURLString:UserShowPage parameters:@{@"user_id":userId,@"no_visitor":@"1"} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- @strongify(self);
- self.isLoadingUserInfo = NO;
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- YOUPAILCUserShowModel *showModel = [YOUPAILCUserShowModel mj_objectWithKeyValues:[dict objectForKey:@"data"]];
- [self youpaifshowUserInfoWithModel:showModel];
- }
-
- } failure:^(NSError *error) {
- @strongify(self);
- self.isLoadingUserInfo = NO;
- }];
- }
- - (void)youpaifshowUserInfoWithModel:(YOUPAILCUserShowModel *)showModel{
-
- @weakify(self);
- YOUPAILZLiveUserInfoWindow *vc = [[YOUPAILZLiveUserInfoWindow alloc] initWithModel:showModel isAnchor:NO isManage:NO];
- vc.isTouchDismiss = YES;
- // 个人中心
- [vc setYoupaipuserShowBlock:^(YOUPAILCUserShowModel * _Nonnull model) {
- @strongify(self);
- YOUPAILZUserShowVC *vc = [[YOUPAILZUserShowVC alloc] init];
- vc.youpaipuserId = model.youpaipinfo.youpaipuserid;
- [self.navigationController pushViewController:vc animated:YES];
- }];
- // 举报
- [vc setYoupaipreportBlock:^(YOUPAILCUserShowModel * _Nonnull model) {
- @strongify(self);
- ZCAlertAction *action = [ZCAlertAction actionWithTitle:@"举报" andblock:^{//举报
- @strongify(self);
- YOUPAILCReportVC* report = [[YOUPAILCReportVC alloc]init];
- report.youpaipreport_uid = model.youpaipinfo.youpaipuserid;
- report.youpaiptype = 5;
- [self.navigationController pushViewController:report animated:YES];
- }];
- ZCAlertAction *action1 = [ZCAlertAction actionWithTitle:@"拉黑" andblock:^{//举报
- @strongify(self);
- [self youpaifshowAddBlackWithUserId:model.youpaipinfo.youpaipuserid];
- }];
- ZCAlertSheetView* alertSheet = [[ZCAlertSheetView alloc]initWithTitle:nil andShowCancelButton:YES andAction:@[action,action1]];
- alertSheet.alertWindow.hidden = NO;
- [alertSheet show];
-
- }];
- // 礼物
- [vc setYoupaipgiftBlock:^(YOUPAILCUserShowModel * _Nonnull model) {
- @strongify(self);
- NSString *to_uid = model.youpaipinfo.youpaipuserid;
- YOUPAILZCommonGiftView *view = [YOUPAILZCommonGiftView new];
- view.isTouchDismiss = YES;
- view.youpaipcountDown = 3;
- view.youpaipisAnchor = NO;
- [view setYoupaiplzgiftblock:^(YOUPAILCGiftModel * _Nonnull model, NSInteger count,NSString*categoryID) {
- @strongify(self);
- [LCHttpHelper requestWithURLString:TalkSendGift parameters:@{@"to_uid":to_uid,@"gift_id":model.youpaipid,@"num":@(count),@"room_id":self.youpaipchatroomModel.youpaiproom_id,@"gift_type_id":categoryID} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- [ZCHUDHelper showTitle:@"礼物赠送成功"];
- }
- } failure:^(NSError *error) {
- }];
- }];
- // 广告
- [view setYoupaiptouchAdvertBlock:^(YOUPAILCBannerModel * _Nonnull bannerModel) {
- @strongify(self);
- if (bannerModel.youpaiplink_type==1) {
- ZCBaseWebVC* baseWeb = [[ZCBaseWebVC alloc]init];
- baseWeb.contentUrl = bannerModel.youpaiplink_url;
- [self.navigationController pushViewController:baseWeb animated:YES];
- }else if (bannerModel.youpaiplink_type==2||bannerModel.youpaiplink_type==3){
- [self youpaifpageToStr:bannerModel.youpaiplink_url];
- }
- }];
-
- [view setJumToWalletBlock1:^{
- @strongify(self);
- // YOUPAIHRRechargePayWindow *payWindow = [YOUPAIHRRechargePayWindow new];
- // payWindow.isTouchDismiss = NO;
- // [self TFPresentVC:payWindow completion:^{
- //
- // }];
- YMAccountBalanceViewModel *accountBalanceVM = [[YMAccountBalanceViewModel alloc]initWithParams:@{
- ParamsId:@([[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id intValue])
- }];
- YMAccountBalanceRechargePopupView *customView = [[YMAccountBalanceRechargePopupView alloc]init];
- [customView ym_bindViewModel:accountBalanceVM];
- YMPopupView *popupView = [YMPopupView initWithCustomView:customView parentView:nil popStyle:YMPopupStyleSmoothFromBottom dismissStyle:YMDismissStyleSmoothToBottom];
- popupView.priority = 999;
- popupView.cornerRadius = adapt(10);
- popupView.rectCorners = UIRectCornerTopLeft|UIRectCornerTopRight;
- popupView.positionStyle = YMPositionStyleBottom;
- popupView.isClickBgDismiss = YES;
- popupView.isHideBg = NO;
- popupView.bgAlpha = 0.5;
- [popupView pop];
-
- @weakify(popupView)
- customView.dismissBlock = ^{
- @strongify(popupView)
- [popupView dismissWithStyle:YMDismissStyleSmoothToBottom duration:2.0];
- };
- }];
- [self TFPresentVC:view completion:^{
- }];
-
-
- }];
- // 守护
- [vc setYoupaipguardBlock:^(YOUPAILCUserShowModel * _Nonnull model) {
- @strongify(self);
- [LCHttpHelper requestWithURLString:UserShowPage parameters:@{@"user_id":[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id,@"no_visitor":@"1"} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- @strongify(self);
- YOUPAILCUserShowModel *showModel = [YOUPAILCUserShowModel mj_objectWithKeyValues:[dict objectForKey:@"data"]];
- YOUPAILPGuardHerVC *VC= [[YOUPAILPGuardHerVC alloc]init];
- VC.youpaipdelegate = self;
- VC.youpaipuser_id = model.youpaipinfo.youpaipuserid;
- VC.youpaiproomid = self.youpaipchatroomModel.youpaiproom_id;
- VC.vWidth = KScreenWidth-54;
- VC.vHeight = ((KScreenWidth-54)*165)/321.0+261.5;
- VC.youpaipinfoModel = showModel.youpaipguard;
- VC.youpaipisChatRoom = YES;
- VC.isTouchDismiss = YES;
- if(VC.youpaipinfoModel!=nil)
- [self TFPresentVC:VC completion:^{
- }];
- }else{
- [ZCHUDHelper showTitle:[dict objectForKey:@"message"]];
- }
- } failure:^(NSError *error) {
- [ZCHUDHelper showTitle:error.localizedDescription];
- }];
- }];
- // 私信
- [vc setYoupaipsiXinBlock:^(YOUPAILCUserShowModel * _Nonnull model) {
- @strongify(self);
- [self goChatPageWithUserId:model.youpaipinfo.youpaipuserid];
- }];
- // [vc setManageBlock:^(YOUPAILCUserShowModel * _Nonnull model, BOOL isAnchor) {
- //// @strongify(self);
- //// [self youpaifshowliveMembersManageWithModel:model isAnchor:isAnchor];
- // }];
- [self TFPresentVC:vc completion:^{}];
- }
- - (void)goChatPageWithUserId:(NSString *)userId{
- @weakify(self);
- // [LCHttpHelper requestWithURLString:IsChat parameters:@{@"user_id":userId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- // NSDictionary* dict = (NSDictionary*)responseObject;
- // NSInteger code = [[dict objectForKey:@"code"] integerValue];
- // if (code==0) {//成功
- // NSInteger is_chat = [[[dict objectForKey:@"data"] objectForKey:@"is_chat"] integerValue];
- // NSString *msg = [[dict objectForKey:@"data"] objectForKey:@"msg"];
- // @strongify(self);
- // if (is_chat == 0) { /// 0不可以 1可以私信
- // LZAlertAction *cancelAction = [LZAlertAction actionWithTitle:@"再想想" handler:^(LZAlertAction *action) {
- //
- // }];
- // cancelAction.cornerRadius = 5.0f;
- // cancelAction.bgColor = HexColorFromRGB(0x9F9DA5);
- // LZAlertAction *confimAction = [LZAlertAction actionWithTitle:@"去充值" handler:^(LZAlertAction *action) {
- // @strongify(self);
- // YOUPAIHRRechargePayWindow *payWindow = [YOUPAIHRRechargePayWindow new];
- // payWindow.isTouchDismiss = NO;
- // [self.navigationController TFPresentVC:payWindow completion:^{
- //
- // }];
- // }];
- // confimAction.cornerRadius = 5.0f;
- // confimAction.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 105.0f) / 2.0f, 48.0f) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:GradientLeftToRight]];
- // LZAlertWindow *alert = [LZAlertWindow alertWithTitle:@"提示" content:msg action:@[cancelAction,confimAction]];
- // alert.contentTextAlignment = NSTextAlignmentCenter;
- // [self TFPresentVC:alert completion:^{}];
- // }else{
- NIMSession *session = [NIMSession session:userId type:NIMSessionTypeP2P];
- if (session) {
- [ZCHUDHelper show];
- [[[NIMSDK sharedSDK] userManager] fetchUserInfos:@[session.sessionId] completion:^(NSArray<NIMUser *> * _Nullable users, NSError * _Nullable error) {
- @strongify(self);
- [ZCHUDHelper dismiss];
- YOUPAILCIMSessionVC *vc = [[YOUPAILCIMSessionVC alloc] initWithSession:session];
- [self.navigationController pushViewController:vc animated:YES];
- }];
- }
- // }
- // }
- // } failure:^(NSError *error) {
- // }];
- }
- /// 拉黑弹框
- - (void)youpaifshowAddBlackWithUserId:(NSString *)userId{
- @weakify(self);
- LZAlertAction *cancelAction = [LZAlertAction actionWithTitle:@"取消" handler:^(LZAlertAction *action) {
-
- }];
- cancelAction.cornerRadius = 24.0f;
- cancelAction.bgColor = HexColorFromRGB(0x9F9DA5);
- LZAlertAction *confimAction = [LZAlertAction actionWithTitle:@"确定" handler:^(LZAlertAction *action) {
- @strongify(self);
- [LCCommonHttp blackUserId:userId];
- }];
- confimAction.cornerRadius = 24.0f;
- confimAction.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 105.0f) / 2.0f, 48.0f) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:GradientLeftToRight]];
- LZAlertWindow *alert = [LZAlertWindow alertWithTitle:@"提示" content:@"拉黑后,你将不再收到对方的消息,并且你们互相看不到对方的动态更新。可以在“设置-黑名单”中解除。" action:@[cancelAction,confimAction]];
- alert.contentTextAlignment = NSTextAlignmentCenter;
- [self TFPresentVC:alert completion:^{}];
- }
- - (void)youpaifaddGuardSuccess{
-
- }
- // 展示选择座位
- - (void)youpaifshowSelectedSeatWindowWithUserId:(NSString *)userId youpaipisInviation:(BOOL)youpaipisInviation{
-
- }
- /// 处理点击用户操作
- - (void)youpaifhandleUserOperationWithUserId:(NSString *)userId{
-
- }
- #pragma mark - YBPopupMenuDelegate
- - (UITableViewCell *)ybPopupMenu:(YBPopupMenu *)ybPopupMenu cellForRowAtIndex:(NSInteger)index{
- if (index == 0) {
- NSString *cellID = @"YOUPAILZChatRoomNoticeTitleCell";
- YOUPAILZChatRoomNoticeTitleCell *cell = [ybPopupMenu.tableView dequeueReusableCellWithIdentifier:cellID];
- if (cell == nil) {
- cell = [[YOUPAILZChatRoomNoticeTitleCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
- }
- cell.youpaiptitleL.text = @"房间公告";
- return cell;
- }else{
- NSString *cellID = @"YOUPAILZChatRoomNoticeContentCell";
- YOUPAILZChatRoomNoticeContentCell *cell = [ybPopupMenu.tableView dequeueReusableCellWithIdentifier:cellID];
- if (cell == nil) {
- cell = [[YOUPAILZChatRoomNoticeContentCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
- }
- cell.youpaipcontentL.text = self.youpaipchatroomModel.youpaiptalk_notice;
- return cell;
- }
- }
- - (CGFloat)ybPopupMenu:(YBPopupMenu *)ybPopupMenu heightForRowAtIndex:(NSInteger)index{
- if (index == 0) {
- return 41.0f;
- }else{
- return [self.youpaipchatroomModel.youpaiptalk_notice heightForFont:LCFont(13.0f) width:KScreenWidth - 32.0f - 34.0f] + 40.0f;
- }
- }
- #pragma mark - UICollectionViewDataSource
- - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
- return self.youpaipchatroomModel.youpaipnormalSeats.count;
- }
- - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
- YOUPAILZChatRoomOthearSeatCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass(YOUPAILZChatRoomOthearSeatCell.class) forIndexPath:indexPath];
- [cell youpaifreloadWithModel:self.youpaipchatroomModel.youpaipnormalSeats[indexPath.item]];
- return cell;
- }
- #pragma mark - UICollectionViewDelegate
- - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
- [self youpaifotherSeatClickWithIndex:indexPath.item];
- [self.youpaipkeyboardView resignFirstResponder];
- self.youpaipkeyboardView.hidden = YES;
- }
- #pragma mark - UITableViewDataSource
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- return self.youpaipmessages.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
-
- NSString *cellID = @"YOUPAILZLiveChatMessageCell";
- YOUPAILZLiveChatMessageCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
- if (cell == nil) {
- cell = [[YOUPAILZLiveChatMessageCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- if ([self.youpaipmessages[indexPath.row] isKindOfClass:NIMMessage.class]) {
- NIMMessage *message = self.youpaipmessages[indexPath.row];
- [cell youpaifreloadWithModel:message font:LCFont14 indexPath:indexPath];
- }else if ([self.youpaipmessages[indexPath.row] isKindOfClass:YOUPAILZChatRoomGiftAttachment.class]){
- YOUPAILZChatRoomGiftAttachment *attachment = self.youpaipmessages[indexPath.row];
- [cell youpaifreloadWithAttachment:attachment font:LCFont14 indexPath:indexPath];
- }
-
- @weakify(self);
- [cell setShowUserInfoBlock:^(NSIndexPath * _Nonnull indexPath1) {
- @strongify(self);
- if ([self.youpaipmessages[indexPath1.row] isKindOfClass:NIMMessage.class]) {
- NIMMessage *message = self.youpaipmessages[indexPath1.row];
-
- if (message.session.sessionType == NIMSessionTypeChatroom
- && message.messageType == NIMMessageTypeNotification){ /// 如果是聊天室并且消息类型为通知类型
- NIMNotificationObject *object = message.messageObject;
- if (![object.content isKindOfClass:[NIMUnsupportedNotificationContent class]]) {
- NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)object.content;
- NSString *fromId = nil;
- for (NIMChatroomNotificationMember *memebr in content.targets) {
- fromId = memebr.userId;
- }
- if (content.eventType == NIMChatroomEventTypeEnter) { /// 有成员加入聊天室
- fromId = message.from;
- }else if(content.eventType == NIMChatroomEventTypeExit){ /// 有成员离开聊天室
- fromId = message.from;
- }else if(content.eventType == NIMChatroomEventTypeKicked){ /// 聊天室成员被踢
- fromId = message.from;
- }
- [self youpaifhandleUserOperationWithUserId:fromId];
- }
- }else{
- [self youpaifhandleUserOperationWithUserId:message.from];
- }
- }else if ([self.youpaipmessages[indexPath1.row] isKindOfClass:YOUPAILZChatRoomGiftAttachment.class]){
- YOUPAILZChatRoomGiftAttachment *attachment = self.youpaipmessages[indexPath1.row];
- [self youpaifhandleUserOperationWithUserId:[NSString stringWithFormat:@"%@",@(attachment.from_uid)]];
- }
-
- }];
- // [cell setReplyBlock:^(NSIndexPath * _Nonnull indexPath) {
- // @strongify(self);
- // NSString *nick = [NIMKitUtil showNick:message.from inMessage:message];
- // self.sendMessageTF.text = [NSString stringWithFormat:@"@%@ ",nick];
- // [self youpaifsendMessageBecomeFirstResponder];
- // }];
- return cell;
- }
- #pragma mark - UITableViewDelegate
- - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
- return CGFLOAT_MIN;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
- return CGFLOAT_MIN;
- }
- //- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
- // UIView *v = [[UIView alloc] initWithFrame:CGRectMake(.0f, 0.0f, 276.0f, [self.liveModel youpaifnoticeTextHeight])];
- // v.transform = CGAffineTransformMakeRotation(M_PI);
- // UIView *bgV = [[UIView alloc] initWithFrame:CGRectMake(5.0f, 0, 266.0f, [self.liveModel youpaifnoticeTextHeight])];
- // bgV.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3f];
- // bgV.layer.cornerRadius = 10.0f;
- // bgV.clipsToBounds = YES;
- // UILabel *textL = [[UILabel alloc] initWithFrame:CGRectMake(15.0f, 10.0f, 236.0f, bgV.mj_h - 20.0f)];
- // NSMutableAttributedString * attributedString1 = [[NSMutableAttributedString alloc] initWithString:self.liveModel.notice_text];
- // NSMutableParagraphStyle * paragraphStyle1 = [[NSMutableParagraphStyle alloc] init];
- // paragraphStyle1.alignment=NSTextAlignmentJustified;
- // NSDictionary * dic =@{
- // NSParagraphStyleAttributeName:paragraphStyle1,
- // NSUnderlineStyleAttributeName:[NSNumber numberWithInteger:NSUnderlineStyleNone],
- // };
- // [attributedString1 setAttributes:dic range:NSMakeRange(0, attributedString1.length)];
- // textL.attributedText = attributedString1;
- // textL.numberOfLines = 0;
- // textL.textColor = HexColorFromRGB(0xFFA68B);
- // textL.font = self.liveModel.isMaxFont ? self.liveModel.maxFont : self.liveModel.minFont;
- // [bgV addSubview:textL];
- // [v addSubview:bgV];
- // return v;
- //}
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- // NIMMessage *message = self.messages[indexPath.row];
- // if ([message isKindOfClass:[YOUPAILZLiveModel class]]) {
- // [self youpaifshowUserInfoWithUserId:self.liveModel.user_info.user_id];
- // }else{
- // [self youpaifshowUserInfoWithUserId:message.from];
- // }
- }
- - (NSMutableArray *)youpaipmessages{
- if (!_youpaipmessages) {
- _youpaipmessages = [NSMutableArray array];
- }
- return _youpaipmessages;
- }
- - (YOUPAILZChatRoomMoreModel *)youpaipmoreModel{
- if (!_youpaipmoreModel) {
- _youpaipmoreModel = [[YOUPAILZChatRoomMoreModel alloc] init];
- }
- return _youpaipmoreModel;
- }
- @end
|