// // MOLiveUserInfoView.m // MiMoLive // // Created by SuperC on 2023/11/27. // #import "MOLiveUserInfoView.h" #import "MOUserListData.h" #import "MOImageTitleAlertView.h" #import "MOChooseTimeAlertView.h" #import "MOReportSomeOneView.h" #import "MOLiveCell.h" #import "MOFanClubNameplateView.h" #import #import "MOAddBlackAlertView.h" #import "MOTopsUserView.h"//贡献榜view @interface MOLiveUserInfoView () @property (weak, nonatomic) IBOutlet UIImageView *headImg; @property (weak, nonatomic) IBOutlet UIImageView *headBgImgView; /** svga 播放 管理类 */ @property (nonatomic, strong) MOSVGACustomPlayer *aPlayer; @property (nonatomic, strong) SVGAParser *aParser; @property (weak, nonatomic) IBOutlet UIImageView *topBgImgView; @property (weak, nonatomic) IBOutlet UIView *bgImgBgView; @property (weak, nonatomic) IBOutlet UIImageView *bgImgView; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *bgImgViewHeight; @property (weak, nonatomic) IBOutlet UIImageView *cardFrameBgImg; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *cardBgHeight; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *cardBgTop; @property (weak, nonatomic) IBOutlet BigBtn *reportBtn; @property (weak, nonatomic) IBOutlet BigBtn *adminBtn; @property (weak, nonatomic) IBOutlet MOShimmerLabel *nickNameLab; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *nickNameWidth; @property (weak, nonatomic) IBOutlet UIImageView *genderImg; @property (weak, nonatomic) IBOutlet UIButton *idBtn; @property (nonatomic, strong) MOStarNumView *startView; @property (weak, nonatomic) IBOutlet UIImageView *locationImgView; @property (weak, nonatomic) IBOutlet UILabel *locationLab; @property (weak, nonatomic) IBOutlet UIImageView *fanClubMedalImgView; @property (weak, nonatomic) IBOutlet UILabel *introduLab; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *introduLabTop; @property (weak, nonatomic) IBOutlet UIStackView *numStackView; @property (weak, nonatomic) IBOutlet UILabel *numFocusLab; @property (weak, nonatomic) IBOutlet UILabel *tipFocusLab; @property (weak, nonatomic) IBOutlet UILabel *numFanLab; @property (weak, nonatomic) IBOutlet UILabel *tipFanLab; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *stackViewTop; @property (weak, nonatomic) IBOutlet UIView *familyBgView; @property (weak, nonatomic) IBOutlet UIImageView *familyBgImg; @property (weak, nonatomic) IBOutlet UILabel *familyTitleLab; @property (weak, nonatomic) IBOutlet UILabel *familyContentLab; @property (weak, nonatomic) IBOutlet UILabel *familyNoTip; @property (weak, nonatomic) IBOutlet UIView *familyImgView; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *familyImgWidth; @property (weak, nonatomic) IBOutlet UIImageView *familyImgBg; @property (weak, nonatomic) IBOutlet UILabel *familyImgTitleLab; @property (weak, nonatomic) IBOutlet UIImageView *familyImgIcon; @property (weak, nonatomic) IBOutlet UIView *contributionBgView; @property (weak, nonatomic) IBOutlet UIImageView *contributionBgImg; @property (weak, nonatomic) IBOutlet UILabel *contributionTitleLab; @property (weak, nonatomic) IBOutlet UILabel *contributionNoTip; /** 铭牌 */ @property (nonatomic, strong) MOFanClubNameplateView *nameplateView; @property (weak, nonatomic) IBOutlet UIView *fanClubBgView; @property (weak, nonatomic) IBOutlet UIImageView *fanClubBgImg; @property (weak, nonatomic) IBOutlet UILabel *fanClubTitleLab; @property (weak, nonatomic) IBOutlet UILabel *fanClubContentLab; @property (weak, nonatomic) IBOutlet UILabel *fanClubNoTip; @property (weak, nonatomic) IBOutlet UIButton *fanClubBtn; @property (weak, nonatomic) IBOutlet UIView *bgView; @property (weak, nonatomic) IBOutlet UIStackView *menuStackView; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *menuStackViewBottom; @property (weak, nonatomic) IBOutlet BigBtn *followBtn; @property (weak, nonatomic) IBOutlet UIButton *atBtn; @property (weak, nonatomic) IBOutlet BigBtn *chatBtn; @property (weak, nonatomic) IBOutlet UIView *inviteBgView; @property (weak, nonatomic) IBOutlet UIButton *inviteBtn; @property (weak, nonatomic) IBOutlet UIButton *followBtnTwo; @property (weak, nonatomic) IBOutlet UIView *manageVoiceView; @property (weak, nonatomic) IBOutlet UIView *selectBtnBgView; @property (weak, nonatomic) IBOutlet UIView *selectBtnView; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *selectBtnCenterX; @property (weak, nonatomic) IBOutlet UIButton *voiceTypeBtn; @property (weak, nonatomic) IBOutlet UIButton *videoTypeBtn; @property (weak, nonatomic) IBOutlet UIButton *voiceBtn; @property (weak, nonatomic) IBOutlet UIButton *hangUpBtn; @property (nonatomic, strong) MOReportSomeOneView *reportView; @property (nonatomic, strong) UIImageView *vipImgView; @property (nonatomic, strong) MOBaseLevelView *levelImgView; @property (nonatomic, strong) UIImageView *videoImgView; @property (nonatomic, strong) UIImageView *audioImgView; @property (nonatomic, strong) MOFansLevelView *fansLevelView; /** 勋章View */ @property (nonatomic, strong) MOMsgContentTextView *medalView; @property (nonatomic, strong) MOMsgContentTextView *infoImgView; /** 状态 */ @property (nonatomic, strong) MOStatusButton *statusBtn; @property (weak, nonatomic) IBOutlet UIButton *headBtn; @property (nonatomic, assign) BOOL isShowReport; @property (nonatomic, strong) MOTopsUserView *topsView; @property (nonatomic, strong) NSArray *outcomeArr; @property (nonatomic, strong) MOLiveGoBtnView *liveGoBtnView;//去对方直播间View @end @implementation MOLiveUserInfoView + (instancetype)moLiveUserInfoView{ return [[[NSBundle mainBundle] loadNibNamed:@"MOLiveUserInfoView" owner:self options:nil] firstObject]; } - (void)awakeFromNib{ [super awakeFromNib]; CGFloat height = SCREENWIDTH * 125 / 750; self.cardBgHeight.constant = height; self.cardBgTop.constant = - SCREENWIDTH * 432.0 / 1125.0; self.bgView.layer.cornerRadius = 16.0; self.bgView.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner; self.headImg.layer.cornerRadius = 90.0 / 2.0; self.headImg.layer.masksToBounds = YES; self.numStackView.layer.cornerRadius = 10.0; self.numStackView.layer.masksToBounds = YES; self.familyBgView.layer.cornerRadius = 14.0; self.familyBgView.layer.masksToBounds = YES; self.fanClubBgView.layer.cornerRadius = 14.0; self.fanClubBgView.layer.masksToBounds = YES; self.contributionBgView.layer.cornerRadius = 14.0; self.contributionBgView.layer.masksToBounds = YES; self.idBtn.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft; self.familyImgView.layer.cornerRadius = 20.0 / 2.0; self.familyImgView.layer.masksToBounds = YES; self.bgImgBgView.layer.cornerRadius = 16.0; self.bgImgBgView.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner; self.bgImgBgView.layer.masksToBounds = YES; self.bgImgBgView.backgroundColor = [MOTools colorWithHexString:@"#FAFBFF"]; self.bgImgViewHeight.constant = kScaleWidth(375.0); [self.bgImgView setImage:[UIImage imageNamed:@"v_2_user_bg"]]; self.bgImgView.clipsToBounds = YES; [self.followBtn setTitleColor:[MOTools colorWithHexString:@"#4363FF"] forState:UIControlStateNormal]; [self.followBtn setTitle:NSLocalString(@"mimo_2_live_user_follow") forState:UIControlStateNormal]; [self.followBtn setFont:[MOTextTools poppinsMediumFont:16.0]]; [self.atBtn setFont:[MOTextTools poppinsMediumFont:16.0]]; [self.chatBtn setFont:[MOTextTools poppinsMediumFont:16.0]]; [self.chatBtn setTitle:NSLocalString(@"mimo_2_live_user_chat") forState:UIControlStateNormal]; NSArray *fanColorArr = @[[MOTools colorWithHexString:@"#FF4DA6" alpha:1.0],[MOTools colorWithHexString:@"#FF84D2" alpha:1.0]]; UIImage *fanImage = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, 112, 62.0) Colors:fanColorArr GradientType:1]; [self.fanClubBgImg setImage:fanImage]; NSArray *familyColorArr = @[[MOTools colorWithHexString:@"#A759FF" alpha:1.0],[MOTools colorWithHexString:@"#D392FF" alpha:1.0]]; UIImage *familyImage = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, 112, 62.0) Colors:familyColorArr GradientType:1]; [self.familyBgImg setImage:familyImage]; NSArray *contriColorArr = @[[MOTools colorWithHexString:@"#4363FF" alpha:1.0],[MOTools colorWithHexString:@"#789CFF" alpha:1.0]]; UIImage *contriImage = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, 112, 62.0) Colors:contriColorArr GradientType:1]; [self.contributionBgImg setImage:contriImage]; NSArray *topColorArr = @[[MOTools colorWithHexString:@"#E8DFFF" alpha:1.0],[MOTools colorWithHexString:@"#E9E6FF" alpha:1.0],[MOTools colorWithHexString:@"#F0DEFF" alpha:1.0],[MOTools colorWithHexString:@"#EFDEFF" alpha:1.0]]; UIImage *topImage = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, 96.0, 96.0) Colors:topColorArr GradientType:1]; [self.topBgImgView setImage:topImage]; self.topBgImgView.layer.cornerRadius = 96.0 / 2.0; self.topBgImgView.layer.masksToBounds = YES; UIImage *inviteNormalImg = [MOTools createImageWithColor:[MOTools colorWithHexString:@"#17CBEA" alpha:1.0]]; UIImage *inviteGrayImg = [MOTools createImageWithColor:[UIColor grayColor]]; [self.inviteBtn setBackgroundImage:inviteNormalImg forState:UIControlStateNormal]; [self.inviteBtn setBackgroundImage:inviteGrayImg forState:UIControlStateSelected]; self.inviteBtn.selected = NO; self.inviteBtn.layer.cornerRadius = 36.0 / 2.0; self.inviteBtn.layer.masksToBounds = YES; [self.followBtnTwo setImage:[UIImage imageNamed:@"icon_live_user_jia"] forState:UIControlStateNormal]; [self.followBtnTwo setImage:[UIImage imageNamed:@"icon_live_user_jian"] forState:UIControlStateSelected]; self.inviteBgView.hidden = YES; self.viewType = MOLiveUserInfoViewTypeNormal; [self.bgView addSubview:self.aPlayer]; [self.aPlayer mas_makeConstraints:^(MASConstraintMaker *make) { make.height.width.equalTo(@130.0); make.centerX.equalTo(self.headImg.mas_centerX); make.centerY.equalTo(self.headImg.mas_centerY); }]; [self.fanClubBgView insertSubview:self.nameplateView belowSubview:self.fanClubBtn]; [self.nameplateView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(self.fanClubNoTip.mas_centerY); make.left.equalTo(self.fanClubBgView).mas_offset(12.0); make.height.equalTo(@15.0); make.width.equalTo(@60.0); }]; [self.bgView addSubview:self.levelImgView]; [self.levelImgView mas_makeConstraints:^(MASConstraintMaker *make) { make.width.equalTo(@(MOLevelNormalWidth)); make.height.equalTo(@(MOLevelNormalHeight)); make.top.equalTo(self.nickNameLab.mas_bottom).offset(12.0); make.centerX.equalTo(self.bgView).offset(0); }]; [self.bgView addSubview:self.vipImgView]; [self.vipImgView mas_makeConstraints:^(MASConstraintMaker *make) { make.width.equalTo(@25.0); make.height.equalTo(@21.0); make.right.equalTo(self.levelImgView.mas_left).offset(-5.0); make.centerY.equalTo(self.levelImgView.mas_centerY); }]; [self.bgView addSubview:self.audioImgView]; [self.audioImgView mas_makeConstraints:^(MASConstraintMaker *make) { make.width.height.equalTo(@15.0); make.left.equalTo(self.levelImgView.mas_right).offset(5.0); make.centerY.equalTo(self.levelImgView.mas_centerY); }]; [self.bgView addSubview:self.videoImgView]; [self.videoImgView mas_makeConstraints:^(MASConstraintMaker *make) { make.width.height.equalTo(@15.0); make.left.equalTo(self.levelImgView.mas_right).offset(5.0); make.centerY.equalTo(self.levelImgView.mas_centerY); }]; [self.bgView addSubview:self.fansLevelView]; [self.fansLevelView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(self.levelImgView.mas_centerY); make.left.equalTo(self.audioImgView.mas_right).offset(5.0); make.width.equalTo(@50.0); make.height.equalTo(@20.0); }]; [self.bgView addSubview:self.infoImgView]; [self.infoImgView mas_makeConstraints:^(MASConstraintMaker *make) { make.height.equalTo(@20.0); make.centerY.equalTo(self.levelImgView.mas_centerY); make.left.equalTo(self.bgView).offset(20.0); make.right.equalTo(self.bgView).offset(-20.0); }]; [self.bgView addSubview:self.statusBtn]; [self.statusBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(self.levelImgView.mas_centerY); make.left.equalTo(self.audioImgView.mas_right).offset(5.0); make.width.equalTo(@50.0); make.height.equalTo(@19.0); }]; self.statusBtn.layer.cornerRadius = 19.0 / 2.0; self.statusBtn.layer.masksToBounds = YES; [self.contributionBgView addSubview:self.topsView]; [self.topsView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.contributionNoTip.mas_left).offset(0.0); make.height.equalTo(@(MOTopsUserViewHeight)); make.width.equalTo(@(MOTopsUserViewWidth)); make.centerY.equalTo(self.contributionNoTip.mas_centerY); }]; self.topsView.hidden = YES; self.selectBtnBgView.layer.cornerRadius = 40.0 / 2.0; self.selectBtnBgView.layer.masksToBounds = YES; self.selectBtnView.layer.cornerRadius = 34.0 / 2.0; self.selectBtnView.layer.masksToBounds = YES; self.manageVoiceView.hidden = YES; self.startView.viewHeight = MOStarNumViewNormalHeight; CGFloat startWidth = [self.startView getTheViewWidth]; [self.bgView addSubview:self.startView]; [self.startView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(self.idBtn.mas_centerY); make.right.equalTo(self.idBtn.mas_right); make.height.equalTo(@(MOStarNumViewNormalHeight)); make.width.equalTo(@(startWidth)); }]; [self.bgView addSubview:self.medalView]; [self.medalView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(self.fanClubMedalImgView.mas_centerY); make.left.equalTo(self.bgView).offset(30.0); make.right.equalTo(self.bgView).offset(-30.0); make.height.equalTo(@48.0); }]; self.nickNameLab.font = [MOTextTools poppinsBoldFont:18.0]; self.fanClubTitleLab.font = [MOTextTools poppinsSemiBoldFont:13.0]; self.familyTitleLab.font = [MOTextTools poppinsSemiBoldFont:13.0]; self.contributionTitleLab.font = [MOTextTools poppinsSemiBoldFont:13.0]; self.numFanLab.font = [MOTextTools poppinsRegularFont:13.0]; self.tipFanLab.font = [MOTextTools poppinsRegularFont:13.0]; self.numFocusLab.font = [MOTextTools poppinsRegularFont:13.0]; self.tipFocusLab.font = [MOTextTools poppinsRegularFont:13.0]; [self.inviteBtn setFont: [MOTextTools getTheFontWithSize:15.0 AndFontName:kNormalContentFontStr]]; [self.idBtn setFont:[MOTextTools poppinsRegularFont:13.0]]; self.locationLab.font = [MOTextTools regularFont:13.0]; self.fanClubNoTip.font = [MOTextTools poppinsRegularFont:12.0]; self.familyNoTip.font = [MOTextTools poppinsRegularFont:12.0]; self.contributionNoTip.font = [MOTextTools poppinsRegularFont:12.0]; self.tipFanLab.text = NSLocalString(@"mimo_2_user_info_fans"); self.tipFocusLab.text = NSLocalString(@"mimo_2_user_info_follow"); [self.bgView addSubview:self.liveGoBtnView]; [self.liveGoBtnView mas_makeConstraints:^(MASConstraintMaker *make) { make.width.equalTo(@65.0); make.height.equalTo(@24.0); make.trailing.equalTo(self.bgView).offset(-12.0); make.centerY.equalTo(self.adminBtn); }]; self.liveGoBtnView.hidden = YES; } - (void)getUserInfo{ if(self.userId.length == 0 || self.roomId.length == 0){ return; } WEAKSELF NSDictionary *dict = @{@"roomId":self.roomId, @"userId":self.userId}; [kHttpManager toGetTheUserInfoInLiveRoomWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) { if(kCode_Success){ // MOLogV(@"%@",[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:data options:0 error:nil] encoding:NSUTF8StringEncoding]); MOUserBase *baseModel = [MOUserBase modelObjectWithDictionary:data[@"data"]]; weakSelf.userModel = baseModel; } else{ kShowNetError(data) } }]; } - (void)getUserContributionData{ if(self.userId.length == 0){ return; } NSDictionary *dict = @{@"id":self.userId}; WEAKSELF [kHttpManager toGetUserOutcomeTopsWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) { if(kCode_Success){ MOLogV(@"%@",[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:data options:0 error:nil] encoding:NSUTF8StringEncoding]); MOUserListData *baseModel = [MOUserListData modelObjectWithDictionary:data[@"data"]]; weakSelf.outcomeArr = [baseModel.userBase copy]; [weakSelf updateTheContriView]; } else{ MOLogV(@"getUserContributionData 接口报错了"); } }]; } - (void)updateTheContriView{ if(self.outcomeArr.count > 0){ self.topsView.hidden = NO; self.contributionNoTip.hidden = YES; self.topsView.dataArr = self.outcomeArr; CGFloat baseWidth = MOTopsUserViewWidth / 3.0; CGFloat num = self.outcomeArr.count; if(num > 3){ num = 3; } CGFloat width = baseWidth * num; [self.topsView mas_updateConstraints:^(MASConstraintMaker *make) { make.width.equalTo(@(width)); }]; } else{ self.topsView.hidden = YES; self.contributionNoTip.hidden = NO; } } #pragma mark - Set - (void)setIsManager:(BOOL)isManager{ _isManager = isManager; if(isManager){ self.viewType = MOLiveUserInfoViewTypeManager; } } - (void)setIsCreatLive:(BOOL)isCreatLive{ _isCreatLive = isCreatLive; if(isCreatLive){ self.viewType = MOLiveUserInfoViewTypeAnchor; } } - (void)setUserModel:(MOUserBase *)userModel{ _userModel = userModel; self.genderImg.hidden = NO; if([self.userId isEqualToString:GetUserId]){ self.reportBtn.hidden = YES; self.adminBtn.hidden = YES; } else{ self.reportBtn.hidden = NO; self.adminBtn.hidden = NO; } [self.headImg sd_setImageWithURL:[NSURL URLWithString:userModel.userProfile.avatar] placeholderImage:[UIImage imageNamed:@"icon_mine_placeHolder"]]; [self.cardFrameBgImg sd_setImageWithURL:[NSURL URLWithString:userModel.userProfile.adornment.cardFrameRes]]; WEAKSELF [self.cardFrameBgImg sd_setImageWithURL:[NSURL URLWithString:userModel.userProfile.adornment.cardFrameRes] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { if(image){ CGFloat theImageHeight = 120.0; if(image.size.width > 0){ theImageHeight = image.size.height * SCREENWIDTH / image.size.width; } weakSelf.cardBgHeight.constant = theImageHeight; } }]; if(userModel.remark.length > 0){ self.nickNameLab.text = userModel.remark; } else{ self.nickNameLab.text = userModel.userProfile.nickname; } CGFloat nameWidth = [MOTools getWidthWithString:self.nickNameLab.text font:[MOTextTools poppinsBoldFont:18.0]] + 5.0; if(nameWidth > 200.0){ nameWidth = 200; } self.nickNameWidth.constant = nameWidth; if(userModel.userProfile.gender == 1){ [self.genderImg setImage:[UIImage imageNamed:@"icon_contact_man"]]; } else if (userModel.userProfile.gender == 2){ [self.genderImg setImage:[UIImage imageNamed:@"icon_contact_woman"]]; } else{ self.genderImg.hidden = YES; } NSMutableAttributedString *infoImgAttri = [[NSMutableAttributedString alloc] initWithString:@" "]; self.vipImgView.hidden = YES; if(userModel.vipType == 0){ //非会员 ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init]; config.shimmerStyle = ShimmerStyleNone; self.nickNameLab.textColor = [MOTools colorWithHexString:@"#000000" alpha:1.0]; [self.nickNameLab startShimmerWithConfig:config]; } else{ self.vipImgView.hidden = NO; UIImage *placeImg = [UIImage imageNamed:@"v_2_vip_1_282"]; MOBaseVips *vipObject = [[MOSvgaSourceManage shareManager] toGetTheVipObjectWith:userModel.vipType]; if(vipObject.thumbnail.length > 0){ [self.vipImgView sd_setImageWithURL:[NSURL URLWithString:vipObject.thumbnail] placeholderImage:placeImg]; } else{ [self.vipImgView setImage:placeImg]; } infoImgAttri = [MOTextTools toAddVipInfoWith:infoImgAttri And:userModel.vipType]; } self.levelImgView.levelNum = userModel.level; if(userModel.level >= 100){ [self.levelImgView mas_updateConstraints:^(MASConstraintMaker *make) { make.width.equalTo(@(MOLevelMaxWidth)); }]; } infoImgAttri = [MOTextTools toAddLevelInfoWith:infoImgAttri And:userModel.level]; CGFloat audioLeftSpac = 5.0; if(userModel.anchorType == 1){ self.videoImgView.hidden = NO; self.audioImgView.hidden = YES; infoImgAttri = [self toAddTheIconWith:infoImgAttri AndNewImg:[UIImage imageNamed:@"icon_mine_video"]]; } else if (userModel.anchorType == 2){ self.videoImgView.hidden = YES; self.audioImgView.hidden = NO; infoImgAttri = [self toAddTheIconWith:infoImgAttri AndNewImg:[UIImage imageNamed:@"icon_mine_audio"]]; } else if (userModel.anchorType == 3){ self.videoImgView.hidden = NO; self.audioImgView.hidden = NO; infoImgAttri = [self toAddTheIconWith:infoImgAttri AndNewImg:[UIImage imageNamed:@"icon_mine_video"]]; infoImgAttri = [self toAddTheIconWith:infoImgAttri AndNewImg:[UIImage imageNamed:@"icon_mine_audio"]]; audioLeftSpac = 25.0; } else{ self.videoImgView.hidden = YES; self.audioImgView.hidden = YES; } infoImgAttri = [self toAddStatusWith:infoImgAttri TheUserModel:userModel]; NSMutableParagraphStyle *infoStyle = [[NSMutableParagraphStyle alloc] init]; infoStyle.alignment = NSTextAlignmentCenter; // 设置居中对齐 [infoImgAttri addAttribute:NSParagraphStyleAttributeName value:infoStyle range:NSMakeRange(0, infoImgAttri.length)]; self.infoImgView.attributedText = infoImgAttri; self.videoImgView.hidden = YES; self.audioImgView.hidden = YES; self.levelImgView.hidden = YES; self.vipImgView.hidden = YES; [self.audioImgView mas_updateConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.levelImgView.mas_right).offset(audioLeftSpac); }]; CGFloat maxWidth = (SCREENWIDTH - 12.0 * 2.0 - 8.0 * 2.0) / 3.0 - 12.0 * 2; self.introduLabTop.constant = 13.0; CGFloat statusBtnLeftSpacing = 5.0; CGFloat levelImgCenterOff = 0.0; self.fansLevelView.hidden = YES; if(userModel.userAnchorClub.nameplate.length > 0){ CGFloat fansTitleWidth = [MOTools getWidthWithString:userModel.userAnchorClub.nameplate font:[UIFont systemFontOfSize:10.0]] + 10.0 + 26.0; self.nameplateView.grade = userModel.userAnchorClub.level; self.nameplateView.titleLab.text = userModel.userAnchorClub.nameplate; CGFloat gradeWidth = [self.nameplateView getNameplateWidth]; if(gradeWidth >= maxWidth){ gradeWidth = maxWidth; } if(gradeWidth < 54.0){ gradeWidth = 54; } [self.nameplateView mas_updateConstraints:^(MASConstraintMaker *make) { make.width.equalTo(@(gradeWidth)); }]; self.nameplateView.hidden = NO; if(userModel.userAnchorClub.level >= 30){ UIImage *fanClubMedalImg = [MOTextTools getTheFanClubMedalWith:userModel.userAnchorClub.level]; [self.fanClubMedalImgView setImage:fanClubMedalImg]; self.fanClubMedalImgView.hidden = NO; self.stackViewTop.constant = 60.0; } else{ self.fanClubMedalImgView.hidden = YES; self.stackViewTop.constant = 20.0; } } else{ self.fanClubMedalImgView.hidden = YES; self.stackViewTop.constant = 20.0; self.nameplateView.hidden = YES; } //是否有 勋章 BOOL isHaveMedalView = NO; if(userModel.userAnchorClub.level >= 30 || userModel.userProfile.medalList.count > 0){ isHaveMedalView = YES; self.fanClubMedalImgView.hidden = YES; self.stackViewTop.constant = 60.0; } else{ self.fanClubMedalImgView.hidden = YES; self.stackViewTop.constant = 20.0; } self.statusBtn.hidden = YES; if(userModel.liveBadge.type == 1){ [self.statusBtn sd_setImageWithURL:[NSURL URLWithString:userModel.liveBadge.icon] forState:UIControlStateNormal]; [self.statusBtn setTitle:userModel.liveBadge.name forState:UIControlStateNormal]; [self.statusBtn sd_setBackgroundImageWithURL:[NSURL URLWithString:@""] forState:UIControlStateNormal]; if(userModel.liveBadge.bgColor.length > 0){ self.statusBtn.backgroundColor = [MOTools colorWithHexString:userModel.liveBadge.bgColor alpha:1.0]; } else{ self.statusBtn.backgroundColor = [MOTools colorWithHexString:@"#120817" alpha:0.6]; } CGFloat statusBtnWidth = [MOTools getWidthWithString:userModel.liveBadge.name font:[MOTextTools getTheFontWithSize:StatusFont AndFontName:kNormalContentFontStr]] + 10.0 + 30.0; CGFloat maxWidth = SCREENWIDTH - 15.0 * 2 - 30.0 - 100.0; if(statusBtnWidth > maxWidth){ statusBtnWidth = maxWidth; } [self.statusBtn mas_updateConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.audioImgView.mas_right).offset(statusBtnLeftSpacing); make.width.equalTo(@(statusBtnWidth)); }]; levelImgCenterOff = levelImgCenterOff + statusBtnWidth / 2.0; } else if (userModel.liveBadge.type == 2){ self.statusBtn.backgroundColor = [UIColor clearColor]; [self.statusBtn sd_setBackgroundImageWithURL:[NSURL URLWithString:userModel.liveBadge.bgImg] forState:UIControlStateNormal]; [self.statusBtn setTitle:@"" forState:UIControlStateNormal]; [self.statusBtn sd_setImageWithURL:[NSURL URLWithString:userModel.liveBadge.icon] forState:UIControlStateNormal]; [self.statusBtn mas_updateConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.audioImgView.mas_right).offset(statusBtnLeftSpacing); make.width.equalTo(@(90.0)); }]; levelImgCenterOff = levelImgCenterOff + 90.0 / 2.0; } else{ self.statusBtn.hidden = YES; levelImgCenterOff = 0.0; } if(isHaveMedalView){ //勋章 NSMutableArray *medalNumArr = [NSMutableArray array]; NSInteger medalMaxNum = 0; if(userModel.userProfile.medalList.count > 5){ medalMaxNum = 5; } else{ medalMaxNum = userModel.userProfile.medalList.count; } for (int x = 0; x < medalMaxNum; x ++) { MOMedalResources *medalObject = userModel.userProfile.medalList[x]; [medalNumArr addObject:@(medalObject.code)]; } NSMutableAttributedString *medalStr = [[NSMutableAttributedString alloc] initWithString:@" "]; if(userModel.userProfile.medalList.count > 0){ medalStr = [MOTextTools toCreateMedalInfoWithMedalListAnd:medalNumArr AndMedalWidth:48.0 AndUserBigImage:YES AndSpaingStr:@" "]; } if(userModel.userAnchorClub.level >= 30){ medalStr = [self toAddTheFanClubIconWith:medalStr AndFanClubLevel:userModel.userAnchorClub.level]; } // 创建段落样式 NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; paragraphStyle.alignment = NSTextAlignmentCenter; // 设置居中对齐 [medalStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, medalStr.length)]; self.medalView.attributedText = medalStr; } [self.levelImgView mas_updateConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.bgView).offset(-levelImgCenterOff); }]; if(userModel.userProfile.mysterious){//神秘人 [self.idBtn setTitle:@"ID 99999999" forState:UIControlStateNormal]; self.idBtn.hidden = NO; self.startView.hidden = YES; } else{ [self.idBtn setTitle:[NSString stringWithFormat:@"ID %@",userModel.userProfile.userNo] forState:UIControlStateNormal]; self.startView.idNumStr = [NSString stringWithFormat:@"%@",userModel.userProfile.userNo]; self.startView.levelNum = (NSInteger)userModel.userProfile.beautifulLevel; if(userModel.userProfile.beautifulLevel == 0){ self.idBtn.hidden = NO; self.startView.hidden = YES; } else{ self.idBtn.hidden = YES; self.startView.hidden = NO; } self.followBtn.hidden = NO; } MOCountryList *countryModel; if(userModel.userProfile.country.length != 0){ countryModel = (MOCountryList *)[[MODataCache sharedYYCache] objectForKey:[NSString stringWithFormat:@"%@_%@",kCountryArrInfo,userModel.userProfile.country]]; } if(countryModel){ self.locationLab.text = countryModel.name; [self.locationImgView sd_setImageWithURL:[NSURL URLWithString:countryModel.icon]]; } else{ self.locationLab.text = userModel.userProfile.country; } self.introduLab.text = userModel.userProfile.intro; if(userModel.userProfile.mysterious){ self.followBtn.selected = NO; [self showFollowUI:NO]; self.numFocusLab.text = @"999"; self.numFanLab.text = @"999"; } else{ self.followBtn.selected = userModel.follow; [self showFollowUI:userModel.follow]; self.numFocusLab.text = [NSString stringWithFormat:@"%.f",userModel.follows]; self.numFanLab.text = [NSString stringWithFormat:@"%.f",userModel.fans]; } self.followBtnTwo.selected = userModel.follow; if(self.multiple){ [self updataMutipleView]; } NSString *contentStr = userModel.userFamily.name; if(contentStr.length > 0){ self.familyImgTitleLab.text = contentStr; CGFloat width = [MOTools getWidthWithString:contentStr font:[UIFont systemFontOfSize:10.0]] + 10.0 + 26.0; if(width >= maxWidth){ width = maxWidth; } if(width < 54.0){ width = 54; } self.familyImgWidth.constant = width; } else{ self.familyImgWidth.constant = 80.0; } NSInteger familyLevel = userModel.userFamily.level; if(familyLevel == 0){ familyLevel = 1; } if(familyLevel > 6){ familyLevel = 6; } UIImage *familyImg = [UIImage imageNamed:[NSString stringWithFormat:@"icon_family_level_%zd",familyLevel]]; [self.familyImgIcon setImage:familyImg]; if(familyLevel <= 4){ self.familyImgView.backgroundColor = [MOTools colorWithHexString:@"#F4A563" alpha:1.0]; self.familyImgBg.hidden = YES; } else{ [self.familyImgBg setImage:[UIImage imageNamed:@"icon_family_level_5_bg"]]; self.familyImgBg.hidden = NO; self.familyImgView.backgroundColor = [UIColor clearColor];; } self.familyImgView.hidden = NO; if(contentStr.length == 0){ self.familyImgView.hidden = YES; } if(userModel.userFamily.id.length == 0){ } else{ self.familyNoTip.text = userModel.userFamily.name; self.familyNoTip.hidden = YES; } self.fanClubNoTip.hidden = NO; if(userModel.userAnchorClub.id.length == 0){ } else{ self.fanClubNoTip.text = userModel.userAnchorClub.clubName; self.fanClubNoTip.hidden = YES; } if(userModel.userProfile.adornment.headgearRes.length > 0){ if(userModel.userProfile.adornment.headgearType == 2){ self.headBgImgView.hidden = YES; self.aPlayer.hidden = NO; [self.aPlayer clear]; WEAKSELF [self.aParser parseWithURL:[NSURL URLWithString:userModel.userProfile.adornment.headgearRes] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) { if (videoItem) { weakSelf.aPlayer.videoItem = videoItem; [weakSelf.aPlayer startAnimation]; } } failureBlock:^(NSError * _Nullable error) { MOLogV(@"播放失败~~~~~~~~"); }]; } else if (userModel.userProfile.adornment.headgearType == 0 || userModel.userProfile.adornment.headgearType == 1){ self.headBgImgView.hidden = NO; self.aPlayer.hidden = YES; [self.headBgImgView sd_setImageWithURL:[NSURL URLWithString:userModel.userProfile.adornment.headgearRes]]; } } else{ self.headBgImgView.hidden = YES; self.aPlayer.hidden = YES; } } - (void)showFollowUI:(BOOL)follow { if (follow) { [self.followBtn setTitleColor:[MOTools colorWithHexString:@"#878A99" alpha:0.5] forState:UIControlStateNormal]; [self.followBtn setTitle:NSLocalString(@"mimo_2_live_user_follow_no") forState:UIControlStateNormal]; } else { [self.followBtn setTitleColor:[MOTools colorWithHexString:@"#4363FF"] forState:UIControlStateNormal]; [self.followBtn setTitle:NSLocalString(@"mimo_2_live_user_follow") forState:UIControlStateNormal]; } } - (NSMutableAttributedString *)toAddStatusWith:(NSMutableAttributedString *)contentStr TheUserModel:(MOUserBase *)userModel{ [contentStr appendAttributedString:[[NSAttributedString alloc] initWithString:@" "]]; if(userModel.liveBadge.type == 1){ CGFloat statusBtnWidth = [MOTools getWidthWithString:userModel.liveBadge.name font:[MOTextTools getTheFontWithSize:StatusFont AndFontName:kNormalContentFontStr]] + 10.0 + 30.0; UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, statusBtnWidth, 19.0)]; MOStatusButton *statusBtn = [MOStatusButton buttonWithType:UIButtonTypeCustom]; statusBtn.frame = CGRectMake(0.0, 0.0, statusBtnWidth, 19.0); statusBtn.userInteractionEnabled = NO; statusBtn.titleLabel.font = [MOTextTools getTheFontWithSize:StatusFont AndFontName:kNormalContentFontStr]; [statusBtn sd_setImageWithURL:[NSURL URLWithString:userModel.liveBadge.icon] forState:UIControlStateNormal]; [statusBtn setTitle:userModel.liveBadge.name forState:UIControlStateNormal]; [statusBtn sd_setBackgroundImageWithURL:[NSURL URLWithString:@""] forState:UIControlStateNormal]; statusBtn.layer.cornerRadius = 5.0; statusBtn.layer.masksToBounds = YES; statusBtn.imageView.contentMode = UIViewContentModeScaleAspectFit; statusBtn.contentMode = UIViewContentModeScaleAspectFill; if(userModel.liveBadge.bgColor.length > 0){ statusBtn.backgroundColor = [MOTools colorWithHexString:userModel.liveBadge.bgColor alpha:1.0]; } else{ statusBtn.backgroundColor = [MOTools colorWithHexString:@"#120817" alpha:0.6]; } [bgView addSubview:statusBtn]; NSMutableAttributedString *medalImgAttri = [NSMutableAttributedString attachmentStringWithContent:bgView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(statusBtnWidth, 19.0) alignToFont:MOTextLabelFont alignment:YYTextVerticalAlignmentCenter]; [medalImgAttri appendAttributedString:[[NSAttributedString alloc] initWithString:@" "]]; [contentStr appendAttributedString:[medalImgAttri copy]]; } else if (userModel.liveBadge.type == 2){ UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 90.0, 19.0)]; MOStatusButton *statusBtn = [MOStatusButton buttonWithType:UIButtonTypeCustom]; statusBtn.frame = CGRectMake(0.0, 0.0, 90.0, 19.0); statusBtn.userInteractionEnabled = NO; statusBtn.backgroundColor = [UIColor clearColor]; [statusBtn sd_setBackgroundImageWithURL:[NSURL URLWithString:userModel.liveBadge.bgImg] forState:UIControlStateNormal]; [statusBtn setTitle:@"" forState:UIControlStateNormal]; [statusBtn sd_setImageWithURL:[NSURL URLWithString:userModel.liveBadge.icon] forState:UIControlStateNormal]; [bgView addSubview:statusBtn]; NSMutableAttributedString *medalImgAttri = [NSMutableAttributedString attachmentStringWithContent:bgView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(90.0, 19.0) alignToFont:MOTextLabelFont alignment:YYTextVerticalAlignmentCenter]; [medalImgAttri appendAttributedString:[[NSAttributedString alloc] initWithString:@" "]]; [contentStr appendAttributedString:[medalImgAttri copy]]; } return contentStr; } - (NSMutableAttributedString *)toAddTheFanClubIconWith:(NSMutableAttributedString *)contentStr AndFanClubLevel:(CGFloat)fanClubLevel{ UIImage *fanClubMedalImg = [MOTextTools getTheFanClubMedalWith:fanClubLevel]; UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 48.0, 48.0)]; bgView.backgroundColor = [UIColor clearColor]; UIImageView *medalImg = [[UIImageView alloc] init]; medalImg.frame = CGRectMake(0.0, 0.0, 48.0, 48.0); medalImg.contentMode = UIViewContentModeScaleAspectFit; [medalImg setImage:fanClubMedalImg]; [bgView addSubview:medalImg]; NSMutableAttributedString *medalImgAttri = [NSMutableAttributedString attachmentStringWithContent:bgView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(48.0, 48.0) alignToFont:MOTextLabelFont alignment:YYTextVerticalAlignmentCenter]; [medalImgAttri appendAttributedString:[[NSAttributedString alloc] initWithString:@" "]]; [contentStr appendAttributedString:[medalImgAttri copy]]; return contentStr; } - (NSMutableAttributedString *)toAddTheIconWith:(NSMutableAttributedString *)contentStr AndNewImg:(UIImage *)theImg{ UIImage *fanClubMedalImg = theImg; UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 22.0, 16.0)]; bgView.backgroundColor = [UIColor clearColor]; UIImageView *medalImg = [[UIImageView alloc] init]; medalImg.frame = CGRectMake(0.0, 1.0, 22.0, 16.0); medalImg.contentMode = UIViewContentModeScaleAspectFit; [medalImg setImage:fanClubMedalImg]; [bgView addSubview:medalImg]; NSMutableAttributedString *medalImgAttri = [NSMutableAttributedString attachmentStringWithContent:bgView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(22.0, 16.0) alignToFont:MOTextLabelFont alignment:YYTextVerticalAlignmentCenter]; [medalImgAttri appendAttributedString:[[NSAttributedString alloc] initWithString:@" "]]; [contentStr appendAttributedString:[medalImgAttri copy]]; return contentStr; } - (void)updataMutipleView{ BOOL isHaveTheUser = NO; MOLinkMic *theLinkMic; for (MOLinkMic *object in self.linkMics) { if([object.profile.id isEqualToString:self.userModel.userProfile.id]){ isHaveTheUser = YES; theLinkMic = object; break; } } if(self.isCreatLive || self.isManager){ if(isHaveTheUser){ //多人操作 self.manageVoiceView.hidden = NO; self.inviteBgView.hidden = YES; self.menuStackView.hidden = NO; if(theLinkMic.video2){ self.selectBtnCenterX.constant = 30.0; } else{ self.selectBtnCenterX.constant = -30.0; } self.voiceBtn.selected = !theLinkMic.audio2; self.inviteBgView.hidden = YES; self.menuStackViewBottom.constant = 5.0; } else{ if([self.anchorProfile.id isEqualToString:self.userModel.userProfile.id]){ //主播 self.inviteBgView.hidden = YES; self.manageVoiceView.hidden = YES; self.menuStackView.hidden = NO; self.menuStackViewBottom.constant = 40.0; } else{ //邀请 self.inviteBgView.hidden = NO; self.menuStackView.hidden = YES; self.manageVoiceView.hidden = YES; self.menuStackViewBottom.constant = 40.0; } } } else{ self.inviteBgView.hidden = YES; self.manageVoiceView.hidden = YES; self.menuStackView.hidden = NO; self.menuStackViewBottom.constant = 40.0; } } + (CGFloat)theViewHeight{ return 445.0; } - (IBAction)dismissBtnClick:(id)sender { [self dismissLiveUserInfoView]; } - (IBAction)reportBtnClick:(id)sender { if([self.userId isEqualToString:GetUserId]){ [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_cannot_to_yourself")]; return; } //举报按钮点击事件 self.reportBtnBlock ? self.reportBtnBlock() : nil; [self showReportView]; } - (void)showReportView{ WEAKSELF self.isShowReport = YES; [self addSubview:self.reportView]; [self.reportView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self).offset(0); make.width.equalTo(@(SCREENWIDTH)); make.height.equalTo(@445.0); make.bottom.equalTo(self); }]; self.reportView.userId = self.userId; [self.reportView showReportSomeOneView]; self.reportView.dismissReportViewBlock = ^{ weakSelf.isShowReport = NO; }; } - (IBAction)editBtnClick:(id)sender { if([self.userId isEqualToString:GetUserId]){ [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_cannot_to_yourself")]; return; } [self showAlertView]; //编辑按钮点击事件 self.editBtnBlock ? self.editBtnBlock() : nil; } - (void)showAlertView{ NSMutableArray *dataArr = [NSMutableArray array]; if(self.viewType == MOLiveUserInfoViewTypeAnchor){ if(self.userModel.manage){ NSDictionary *adminDict = @{@"title":NSLocalString(@"mimo_room_manager_cancel")}; [dataArr addObject:adminDict]; } else{ NSDictionary *adminDict = @{@"title":NSLocalString(@"mimo_room_manager_add")}; [dataArr addObject:adminDict]; } if(self.userModel.blacklist){ NSDictionary *blackDict = @{@"title":NSLocalString(@"mimo_blacklist_remove")}; [dataArr addObject:blackDict]; } else{ NSDictionary *blackDict = @{@"title":NSLocalString(@"mimo_blacklist_add")}; [dataArr addObject:blackDict]; } if(self.userModel.silence){ NSDictionary *silenceDict = @{@"title":NSLocalString(@"mimo_room_silence_cancel")}; [dataArr addObject:silenceDict]; } else{ NSDictionary *silenceDict = @{@"title":NSLocalString(@"mimo_room_silence_add")}; [dataArr addObject:silenceDict]; } NSDictionary *kickDict = @{@"title":NSLocalString(@"mimo_room_user_kick")}; [dataArr addObject:kickDict]; } else if (self.viewType == MOLiveUserInfoViewTypeManager){ if(self.userModel.blacklist){ NSDictionary *blackDict = @{@"title":NSLocalString(@"mimo_blacklist_remove")}; [dataArr addObject:blackDict]; } else{ NSDictionary *blackDict = @{@"title":NSLocalString(@"mimo_blacklist_add")}; [dataArr addObject:blackDict]; } if(self.userModel.manage){ } else { if(self.userModel.silence){ NSDictionary *silenceDict = @{@"title":NSLocalString(@"mimo_room_silence_cancel")}; [dataArr addObject:silenceDict]; } else{ NSDictionary *silenceDict = @{@"title":NSLocalString(@"mimo_room_silence_add")}; [dataArr addObject:silenceDict]; } NSDictionary *kickDict = @{@"title":NSLocalString(@"mimo_room_user_kick")}; [dataArr addObject:kickDict]; } } else{ if(self.userModel.blacklist){ NSDictionary *blackDict = @{@"title":NSLocalString(@"mimo_blacklist_remove")}; [dataArr addObject:blackDict]; } else{ NSDictionary *blackDict = @{@"title":NSLocalString(@"mimo_blacklist_add")}; [dataArr addObject:blackDict]; } } MOImageTitleAlertView *alertView = [[MOImageTitleAlertView alloc] initForOperateSuccessWithFrame:CGRectMake(0.0, 0.0, SCREENWIDTH, SCREENHEIGHT) ViewType:MOOnlyTextCellType DataArray:dataArr]; WEAKSELF alertView.cellClickBlock = ^(NSInteger index) { if(weakSelf.viewType == MOLiveUserInfoViewTypeAnchor){ //主播 if(index == 0){ //管理员 if(self.userModel.manage){ //取消管理员 [weakSelf toSetOrDeleteManagerWith:NO]; } else{ //增加管理员 [weakSelf toSetOrDeleteManagerWith:YES]; } } else if (index == 1){ //黑名单 if(self.userModel.blacklist){ [weakSelf toDeleteBlackList]; } else{ [weakSelf showBlackConfirmAlertView]; } } else if (index == 2){ //禁言 if(self.userModel.silence){ [weakSelf toSetOrDeleteSilenceWith:NO]; } else{ [weakSelf toSetOrDeleteSilenceWith:YES]; } } else{ //踢出房间 [weakSelf toShowKickView]; } } else if (weakSelf.viewType == MOLiveUserInfoViewTypeManager){ //管理员 if(index == 0){ //黑名单 if(self.userModel.blacklist){ [weakSelf toDeleteBlackList]; } else{ [weakSelf showBlackConfirmAlertView]; } } else if (index == 1){ //禁言 if(self.userModel.silence){ [weakSelf toSetOrDeleteSilenceWith:NO]; } else{ [weakSelf toSetOrDeleteSilenceWith:YES]; } } else { //踢出房间 [weakSelf toShowKickView]; } } else{ //普通用户 if(index == 0){ //Blacklist if(self.userModel.blacklist){ [weakSelf toDeleteBlackList]; } else{ [weakSelf showBlackConfirmAlertView]; } } } }; [alertView show]; } - (void)toShowKickView{ // NSArray *dataArr = @[@"30Min",@"24H",@"3Day",@"7Day"]; NSArray *dataArr = @[@"30Min",@"24H"]; WEAKSELF MOChooseTimeAlertView *view = [MOChooseTimeAlertView moChooseTimeAlertView]; view.topTipText = [NSString stringWithFormat:NSLocalString(@"mimo_room_kick_tip1"),self.userModel.userProfile.nickname]; view.bottomTipText = NSLocalString(@"mimo_room_kick_tip2"); view.dataArr = dataArr; [view showChooseTimeAlertView]; view.confirmBtnBlock = ^(NSInteger index) { [weakSelf toKickSomeOneWith:index]; }; } - (void)toKickSomeOneWith:(NSInteger)index{ if(self.roomId.length == 0){ return; } NSString *userId = self.userId; if(userId.length == 0){ return; } WEAKSELF //时长(1=30分钟,2=24小时,3=3天,4=7天) NSDictionary *dict = @{@"kickType":@(index + 1), @"roomId":self.roomId, @"userId":self.userId}; [kHttpManager theManageToKickOutSomeOneWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) { if(kCode_Success){ [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_success")]; MORtmEntity *entity = [MORtmEntity prepareRtmAboutKickSomeOneWith:weakSelf.userId AndRoomId:weakSelf.roomId]; NSString *entityJsomString = entity.modelToJSONString; [[MOAgoraRTMManager shareManager] toSendRtmGroupMsg:entityJsomString andBlock:^(BOOL isSuccess) { if(isSuccess){ } }]; [weakSelf dismissLiveUserInfoView]; } else{ MOLogV(@"toAddSilenceListWith 接口报错了"); kShowNetError(data) } }]; } - (void)toSetOrDeleteSilenceWith:(BOOL)status{ if(self.roomId.length == 0){ return; } if(self.userId == 0){ return; } WEAKSELF if(status == YES){ NSArray *dataArr = @[@"30Min",@"24H",@"3Day",@"7Day"]; MOChooseTimeAlertView *view = [MOChooseTimeAlertView moChooseTimeAlertView]; view.topTipText = [NSString stringWithFormat:NSLocalString(@"mimo_room_silence_tip1"),self.userModel.userProfile.nickname]; view.bottomTipText = NSLocalString(@"mimo_room_silence_tip2"); view.dataArr = dataArr; [view showChooseTimeAlertView]; view.confirmBtnBlock = ^(NSInteger index) { [weakSelf toAddSilenceListWith:index]; }; } else{ NSDictionary *dict = @{@"silence":@(NO), @"roomId":self.roomId, @"userId":self.userId}; [kHttpManager toSetLiveSilenceWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) { if(kCode_Success){ [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_success")]; MORtmEntity *entity = [MORtmEntity prepareRtmAboutSilenceSomeOneWith:weakSelf.userId AndRoomId:weakSelf.roomId And:NO]; NSString *entityJsomString = entity.modelToJSONString; [[MOAgoraRTMManager shareManager] toSendRtmGroupMsg:entityJsomString andBlock:^(BOOL isSuccess) { if(isSuccess){ } }]; weakSelf.silenceChangeBlock ? weakSelf.silenceChangeBlock(weakSelf.userModel.userProfile.nickname,NO) : nil; [weakSelf dismissLiveUserInfoView]; } else{ MOLogV(@"toAddSilenceListWith 接口报错了"); kShowNetError(data) } }]; } } - (void)toAddSilenceListWith:(NSInteger)index{ if(self.roomId.length == 0){ return; } NSString *userId = self.userId; if(userId.length == 0){ return; } WEAKSELF //时长(1=30分钟,2=24小时,3=3天,4=7天) NSDictionary *dict = @{@"silenceType":@(index + 1), @"silence":@(YES), @"roomId":self.roomId, @"userId":self.userId}; [kHttpManager toSetLiveSilenceWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) { if(kCode_Success){ [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_success")]; weakSelf.silenceChangeBlock ? weakSelf.silenceChangeBlock(weakSelf.userModel.userProfile.nickname,YES) : nil; MORtmEntity *entity = [MORtmEntity prepareRtmAboutSilenceSomeOneWith:weakSelf.userId AndRoomId:weakSelf.roomId And:YES]; NSString *entityJsomString = entity.modelToJSONString; [[MOAgoraRTMManager shareManager] toSendRtmGroupMsg:entityJsomString andBlock:^(BOOL isSuccess) { if(isSuccess){ } }]; [weakSelf dismissLiveUserInfoView]; } else{ MOLogV(@"toAddSilenceListWith 接口报错了"); kShowNetError(data) } }]; } - (void)toSetOrDeleteManagerWith:(BOOL)status{ if(self.roomId.length == 0){ return; } if(self.userId == 0){ return; } WEAKSELF NSDictionary *dict = @{@"roomId":self.roomId, @"userIds":@[self.userId], @"add":@(status)}; [kHttpManager toSetLiveManagerWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) { if(kCode_Success){ [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_success")]; MORtmEntity *entity = [MORtmEntity prepareRtmAboutManageSomeOneWith:weakSelf.userId AndRoomId:weakSelf.roomId And:status]; NSString *entityJsomString = entity.modelToJSONString; [[MOAgoraRTMManager shareManager] toSendRtmGroupMsg:entityJsomString andBlock:^(BOOL isSuccess) { if(isSuccess){ } }]; if(status){ //发送房间提示 MORtmEntity *entity = [MORtmEntity prepareRoomTipTwoMessage:1 AndUserName:weakSelf.userModel.userProfile.nickname AndRoomId:weakSelf.roomId AndTipNormalNum:0]; NSString *entityJsomString = entity.modelToJSONString; [[MOAgoraRTMManager shareManager] toSendRtmGroupMsg:entityJsomString andBlock:^(BOOL isSuccess) { if(isSuccess){ } }]; weakSelf.needShowMsgBlock ? weakSelf.needShowMsgBlock(entity) : nil; } [weakSelf dismissLiveUserInfoView]; } else{ MOLogV(@"toSetOrDeleteManagerWith 接口报错了"); kShowNetError(data) } }]; } - (void)showBlackConfirmAlertView{ // NSArray *dataArr = @[@"30Min",@"24H",@"3Day",@"7Day",@"forever"]; // // WEAKSELF // MOChooseTimeAlertView *view = [MOChooseTimeAlertView moChooseTimeAlertView]; // view.topTipText = [NSString stringWithFormat:NSLocalString(@"mimo_blacklist_set_time"),self.userModel.userProfile.nickname]; // view.bottomTipText = NSLocalString(@"mimo_blacklist_set_black_result"); // view.dataArr = dataArr; // [view showChooseTimeAlertView]; // view.confirmBtnBlock = ^(NSInteger index) { // [weakSelf toAddBlackListWith:index]; // }; MOAddBlackAlertView *alertView = [[MOAddBlackAlertView alloc] init]; WEAKSELF alertView.addBlackConfirmBlock = ^(NSInteger timeIndex) { [weakSelf toAddBlackListWith:timeIndex]; }; [alertView show]; } - (void)toDeleteBlackList{ NSString *userId = self.userId; if(userId.length == 0){ return; } WEAKSELF NSDictionary *dict = @{@"duration":@(5), @"target":userId}; [kHttpManager toRemoveBlockWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) { if(kCode_Success){ MOLogV(@"%@",[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:data options:0 error:nil] encoding:NSUTF8StringEncoding]); [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_success")]; [weakSelf dismissLiveUserInfoView]; } else{ MOLogV(@"toDeleteBlackList 接口报错了"); kShowNetError(data) } }]; } - (void)toAddBlackListWith:(NSInteger)index{ NSString *userId = self.userId; if(userId.length == 0){ return; } WEAKSELF //时长(1=30分钟,2=24小时,3=3天,4=7天,5=永久) ps:新增黑名单时,字段非空 NSDictionary *dict = @{@"duration":@(index), @"target":userId}; [kHttpManager toAddSomeOneForBlockWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) { if(kCode_Success){ [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_success")]; //主播或者管理员拉黑别人, 是有踢人消息发送的 if(weakSelf.viewType == MOLiveUserInfoViewTypeManager || weakSelf.viewType == MOLiveUserInfoViewTypeAnchor){ if(weakSelf.viewType == MOLiveUserInfoViewTypeManager && weakSelf.userModel.manage){ //如果自己是管理员, 而这个人也是管理员, 则不发送踢人消息 } else{ MORtmEntity *entity = [MORtmEntity prepareRtmAboutKickSomeOneWith:weakSelf.userId AndRoomId:weakSelf.roomId]; NSString *entityJsomString = entity.modelToJSONString; [[MOAgoraRTMManager shareManager] toSendRtmGroupMsg:entityJsomString andBlock:^(BOOL isSuccess) { if(isSuccess){ } }]; } } [weakSelf dismissLiveUserInfoView]; } else{ kShowNetError(data) } }]; } - (IBAction)familyBtnClick:(id)sender { //家族按钮点击 self.familyBtnBlock ? self.familyBtnBlock() : nil; } - (IBAction)fanClubBtnClick:(id)sender { //粉丝团按钮点击 self.fanClubBtnBlock ? self.fanClubBtnBlock() : nil; } - (IBAction)contributionBtnClick:(id)sender { //贡献榜按钮点击 } - (IBAction)headBtnClick:(id)sender { BOOL isMySterious = GetIsMysterious; if(self.userModel.userProfile.mysterious || isMySterious){//神秘人 [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_2_vip_mystery_man_tip_1")]; return; } self.headBtnBlock ? self.headBtnBlock(self.userModel) : nil; [self dismissLiveUserInfoView]; } - (IBAction)focusBtnClick:(UIButton *)sender { BOOL isMySterious = GetIsMysterious; if(self.userModel.userProfile.mysterious || isMySterious){//神秘人 [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_2_vip_mystery_man_tip_1")]; return; } if([self.userId isEqualToString:GetUserId]){ [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_cannot_to_yourself")]; return; } if(sender == self.followBtn){ if(self.followBtn.selected){ WEAKSELF MOTitleNormalAlertView *alertView = [[MOTitleNormalAlertView alloc] init]; alertView.titleLabel.text = NSLocalString(@"mimo_alert_normal_tip"); alertView.subTitleLabel.text = NSLocalString(@"mimo_un_follow_tip"); [alertView.cancelBtn setTitle:NSLocalString(@"mimo_Cancel") forState:UIControlStateNormal]; [alertView.confirmBtn setTitle:NSLocalString(@"mimo_TipConfirm") forState:UIControlStateNormal]; alertView.confirmBlock = ^{ //已关注 - 触发取关 [weakSelf toFollowSomeOneWith:2]; }; [alertView show]; } else{ //未关注 - 触发关注 [self toFollowSomeOneWith:1]; } } else{ if(self.followBtnTwo.selected){ WEAKSELF MOTitleNormalAlertView *alertView = [[MOTitleNormalAlertView alloc] init]; alertView.titleLabel.text = NSLocalString(@"mimo_alert_normal_tip"); alertView.subTitleLabel.text = NSLocalString(@"mimo_un_follow_tip"); [alertView.cancelBtn setTitle:NSLocalString(@"mimo_Cancel") forState:UIControlStateNormal]; [alertView.confirmBtn setTitle:NSLocalString(@"mimo_TipConfirm") forState:UIControlStateNormal]; alertView.confirmBlock = ^{ //已关注 - 触发取关 [weakSelf toFollowSomeOneWith:2]; }; [alertView show]; } else{ //未关注 - 触发关注 [self toFollowSomeOneWith:1]; } } //关注按钮点击 self.focusBtnBlock ? self.focusBtnBlock() : nil; } //类型(1=关注,2=取关) - (void)toFollowSomeOneWith:(NSInteger)type{ if(self.userId.length == 0){ return; } if([self.userId isEqualToString:GetUserId]){ [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_cannot_to_yourself")]; return; } NSArray *targetArr = @[self.userId]; NSDictionary *dict; if(self.roomId.length == 0){ dict = @{@"type":@(type), @"target":targetArr}; } else{ dict = @{@"type":@(type), @"roomId":self.roomId, @"target":targetArr}; } WEAKSELF [kHttpManager toSubmitForFollowWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) { if(kCode_Success){ MOLogV(@"%@",[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:data options:0 error:nil] encoding:NSUTF8StringEncoding]); BOOL isFollow = (type == 1) ? YES : NO; weakSelf.userModel.follow = isFollow; weakSelf.followBtn.selected = isFollow; [weakSelf showFollowUI:isFollow]; weakSelf.followBtnTwo.selected = isFollow; weakSelf.followChangeBlock ? weakSelf.followChangeBlock(weakSelf.userModel) : nil; if(isFollow){ [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_Tip_Follow_Success")]; SendNotification(@"kNotification_FollowSuccess") } else{ [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_Tip_Unsullowed_Success")]; } } else{ kShowNetError(data) } }]; } - (IBAction)giftBtnClick:(id)sender { if([self.userId isEqualToString:GetUserId]){ [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_cannot_to_yourself")]; return; } //礼物按钮点击 self.giftBtnBlock ? self.giftBtnBlock() : nil; } - (IBAction)aiteBtnClick:(id)sender { if([self.userId isEqualToString:GetUserId]){ [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_cannot_to_yourself")]; return; } self.aiteActionBlock ? self.aiteActionBlock(self.userModel) : nil; [self dismissLiveUserInfoView]; } - (IBAction)chatBtnClick:(id)sender { if([self.userId isEqualToString:GetUserId]){ [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_cannot_to_yourself")]; return; } if(self.userModel.userProfile.id.length == 0){ return; } BOOL isMySterious = GetIsMysterious; if(self.userModel.userProfile.mysterious || isMySterious){//神秘人 [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_2_vip_mystery_man_tip_1")]; return; } //聊天按钮点击 self.chatBtnBlock ? self.chatBtnBlock(self.userModel) : nil; [self dismissLiveUserInfoView]; } - (IBAction)copyUserIdBtnClick:(id)sender { return; UIPasteboard *pab = [UIPasteboard generalPasteboard]; [pab setString:self.userModel.userProfile.userNo]; if (pab == nil) { [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_money_Failed")]; } else { [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_copy_tip")]; } } - (IBAction)inviteBtnClick:(id)sender { WEAKSELF if(self.userId.length == 0 || self.roomId.length == 0){ return; } if([self.userId isEqualToString:GetUserId]){ [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_cannot_to_yourself")]; return; } if(self.inviteBtn.selected){ return; } NSDictionary *dict = @{@"roomId":self.roomId, @"userId":self.userId}; [kHttpManager toGetTheUserLinkStrWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) { if(kCode_Success){ MOLogV(@"%@",[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:data options:0 error:nil] encoding:NSUTF8StringEncoding]); weakSelf.inviteBtn.selected = YES; NSString *linkStr = [MODataManager objectOrNilForKey:@"result" fromDictionary:data[@"data"]]; if(linkStr.length > 0){ MOUserProfile *profile = [[MOUserProfile alloc] init]; profile.id = weakSelf.userId; MOLinkMic *linkMic = [[MOLinkMic alloc] init]; linkMic.profile = profile; linkMic.invite = linkStr; linkMic.camera = weakSelf.camera; MORtmEntity *entity = [MORtmEntity prepareRtmManageAgreeLianMaiMessageAndLinkMicType:3 AndStatus:6 AndRoomId:weakSelf.roomId AndMOLinkMic:linkMic AndSeatNum:1]; NSString *entityJsomString = entity.modelToJSONString; [[MOAgoraRTMManager shareManager] toSendRtmGroupMsg:entityJsomString andBlock:^(BOOL isSuccess) { if(isSuccess){ } }]; } } else{ MOLogV(@"toGetTheUserLinkStrWithParams 接口报错了"); kShowNetError(data) } }]; } - (IBAction)voiceTypeChangeBtnClick:(UIButton *)sender { WEAKSELF if(sender == self.voiceTypeBtn){ //音频模式 NSInteger seatNum = [self getTheUserSeatNum]; [self toSwitchTheVoiceTypeWith:seatNum Type:1 Lock:YES andBlock:^(BOOL isSuccess) { if(isSuccess){ weakSelf.selectBtnCenterX.constant = -28.0; [UIView animateWithDuration:0.3 animations:^{ [weakSelf layoutIfNeeded]; }]; } }]; } else{ //视频模式 NSInteger seatNum = [self getTheUserSeatNum]; [self toSwitchTheVoiceTypeWith:seatNum Type:1 Lock:NO andBlock:^(BOOL isSuccess) { if(isSuccess){ weakSelf.selectBtnCenterX.constant = 28.0; [UIView animateWithDuration:0.3 animations:^{ [weakSelf layoutIfNeeded]; }]; } }]; } } - (NSInteger)getTheUserSeatNum{ NSInteger seatNum = 1; BOOL isHave = NO; for (MOLinkMic *object in self.linkMics) { if([object.profile.id isEqualToString:self.userId]){ isHave = YES; break; } seatNum ++; } if(isHave){ return seatNum; } else{ return 0; } } //type麦位类型(1=视频,2=音频,3=麦位) //lock锁定状态(true=锁定,false=解锁) - (void)toSwitchTheVoiceTypeWith:(NSInteger)positions Type:(NSInteger)type Lock:(BOOL)lock andBlock:(void (^)(BOOL isSuccess))block{ WEAKSELF if(positions == 0){ //麦位无此用户 return; } if(self.roomId.length == 0){ return; } NSDictionary *dict = @{@"roomId":self.roomId, @"positions":@[@(positions)], @"type":@(type), @"lock":@(lock)}; [kHttpManager toSwitchTheLinkMicDataWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) { if(kCode_Success){ MOLogV(@"%@",[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:data options:0 error:nil] encoding:NSUTF8StringEncoding]); MORoomStatus *roomStatusData = [MORoomStatus modelObjectWithDictionary:data[@"data"]]; weakSelf.roomStatusChangeBlock ? weakSelf.roomStatusChangeBlock(roomStatusData) : nil; block(YES); } else{ MOLogV(@"toSwitchTheLinkMicDataWithParams 接口报错了"); kShowNetError(data) block(NO); } }]; } - (IBAction)closeOrOpenTheVoiceBtnClick:(id)sender { WEAKSELF if(self.voiceBtn.selected){ //开麦 NSInteger seatNum = [self getTheUserSeatNum]; [self toSwitchTheVoiceTypeWith:seatNum Type:2 Lock:NO andBlock:^(BOOL isSuccess) { if(isSuccess){ weakSelf.voiceBtn.selected = NO; } }]; } else{ //闭麦 NSInteger seatNum = [self getTheUserSeatNum]; [self toSwitchTheVoiceTypeWith:seatNum Type:2 Lock:YES andBlock:^(BOOL isSuccess) { if(isSuccess){ weakSelf.voiceBtn.selected = YES; } }]; } } - (IBAction)hangUpBtnClick:(id)sender { //挂断 WEAKSELF NSString *roomId = self.roomId; NSString *targetUserId = self.userId; NSInteger seatNum = [self getTheUserSeatNum]; MOLinkMic *linkMic; for (MOLinkMic *object in self.linkMics) { if([object.profile.id isEqualToString:self.userId]){ linkMic = [object copy]; break; } } if(!linkMic){ //连麦列表中没有这个人 return; } if(roomId.length == 0 || targetUserId.length == 0){ return; } NSDictionary *dict = @{@"roomId":roomId, @"userId":targetUserId}; [kHttpManager theManageToRemoveLinkMicWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) { if(kCode_Success){ MOLogV(@"%@",[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:data options:0 error:nil] encoding:NSUTF8StringEncoding]); //发送挂断连麦Rtm MORtmEntity *entity = [MORtmEntity prepareRtmManageAgreeLianMaiMessageAndLinkMicType:3 AndStatus:4 AndRoomId:weakSelf.roomId AndMOLinkMic:linkMic AndSeatNum:seatNum]; NSString *entityJsomString = entity.modelToJSONString; [[MOAgoraRTMManager shareManager] toSendRtmGroupMsg:entityJsomString andBlock:^(BOOL isSuccess) { if(isSuccess){ } }]; weakSelf.hangUpBlock ? weakSelf.hangUpBlock(linkMic) : nil; [weakSelf dismissLiveUserInfoView]; } else{ kShowNetError(data) } }]; } - (void)showLiveUserInfoView{ self.frame = CGRectMake(0, 0, SCREENWIDTH, SCREENHEIGHT); CGRect actionViewRect = self.bgView.frame; actionViewRect.origin.y = SCREENHEIGHT; self.bgView.frame = actionViewRect; WEAKSELF [UIView animateWithDuration:0.3 animations:^{ CGRect actionViewRect = weakSelf.bgView.frame; actionViewRect.origin.y = SCREENHEIGHT - [MOLiveUserInfoView theViewHeight]; weakSelf.bgView.frame = actionViewRect; }]; [self getUserContributionData];//请求贡献榜数据 //不能滑动 SendNotification(@"MOShowLivePagesVCCannotScroll") [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardHideOrShow:) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardHideOrShow:) name:UIKeyboardWillHideNotification object:nil]; //如果不是当前直播间 if(self.isNoCurrentRoom){ self.viewType = MOLiveUserInfoViewTypeNormal; } if(self.isOtherAnchorView){ self.adminBtn.hidden = YES; if(!self.isCreateOpen){ self.liveGoBtnView.hidden = NO; } } } - (void)dismissLiveUserInfoView{ [[NSNotificationCenter defaultCenter] removeObserver:self]; //完成下移动画 WEAKSELF [UIView animateWithDuration:0.3 animations:^ { CGRect actionSheetViewRect = weakSelf.bgView.frame; actionSheetViewRect.origin.y = SCREENHEIGHT; weakSelf.bgView.frame = actionSheetViewRect; } completion:^(BOOL finished) { [self removeFromSuperview]; if (self.dismissViewBlock) { self.dismissViewBlock(self.userId); } }]; //可以滑动 SendNotification(@"MOShowLivePagesVCCanScroll") } #pragma mark - MsgSendView - (void)keyboardHideOrShow:(NSNotification *)notification{ WEAKSELF NSString *notificationName = notification.name; if ([notificationName isEqualToString:UIKeyboardWillShowNotification] == YES) { //展示 CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; [UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:1 initialSpringVelocity:1 options:UIViewAnimationOptionCurveLinear animations:^ { if(weakSelf.isShowReport){ [weakSelf.reportView mas_updateConstraints:^(MASConstraintMaker *make) { make.bottom.equalTo(self).offset(-keyboardFrame.size.height); }]; [weakSelf layoutIfNeeded]; } } completion:^(BOOL finished) { }]; } else if ([notificationName isEqualToString:UIKeyboardWillHideNotification] == YES){ //隐藏 [UIView animateWithDuration:0.2 animations:^ { if(weakSelf.isShowReport){ [weakSelf.reportView mas_updateConstraints:^(MASConstraintMaker *make) { make.bottom.equalTo(self).offset(0); }]; [weakSelf layoutIfNeeded]; } }]; } } - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { if (self.clipsToBounds || self.hidden || (self.alpha == 0.f)) { return nil; } UIView *result = [super hitTest:point withEvent:event]; // 把这个坐标从tabbar的坐标系转为subview的坐标系 CGPoint subPoint = [self.headBtn convertPoint:point fromView:self]; if([self.headBtn pointInside:subPoint withEvent:event]){ return self.headBtn; } // 如果事件发生在tabbar里面直接返回 return result; } - (MOReportSomeOneView *)reportView{ if(!_reportView){ _reportView = [MOReportSomeOneView moReportSomeOneView]; } return _reportView; } - (MOSVGACustomPlayer *)aPlayer{ if (_aPlayer == nil) { _aPlayer = [[MOSVGACustomPlayer alloc] init]; _aPlayer.contentMode = UIViewContentModeScaleAspectFill; _aPlayer.loops = 0; _aPlayer.clearsAfterStop = NO; } return _aPlayer; } - (SVGAParser *)aParser{ if (_aParser == nil) { _aParser = [[SVGAParser alloc] init]; } return _aParser; } - (UIImageView *)vipImgView{ if(!_vipImgView){ _vipImgView = [[UIImageView alloc] init]; _vipImgView.contentMode = UIViewContentModeScaleAspectFit; } return _vipImgView; } - (MOBaseLevelView *)levelImgView{ if(!_levelImgView){ _levelImgView = [[MOBaseLevelView alloc] init]; } return _levelImgView; } - (UIImageView *)videoImgView{ if(!_videoImgView){ _videoImgView = [[UIImageView alloc] init]; [_videoImgView setImage:[UIImage imageNamed:@"icon_mine_video"]]; } return _videoImgView; } - (UIImageView *)audioImgView{ if(!_audioImgView){ _audioImgView = [[UIImageView alloc] init]; [_audioImgView setImage:[UIImage imageNamed:@"icon_mine_audio"]]; } return _audioImgView; } - (MOFansLevelView *)fansLevelView{ if(!_fansLevelView){ _fansLevelView = [MOFansLevelView moFansLevelView]; } return _fansLevelView; } - (MOStatusButton *)statusBtn { if (!_statusBtn) { _statusBtn = [MOStatusButton buttonWithType:UIButtonTypeCustom]; _statusBtn.frame = CGRectMake(0, 0, 100, 19.0); _statusBtn.backgroundColor = [MOTools colorWithHexString:@"#120817" alpha:0.6]; _statusBtn.titleLabel.lineBreakMode = NSLineBreakByTruncatingTail; _statusBtn.userInteractionEnabled = NO; [_statusBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; _statusBtn.titleLabel.font = [MOTextTools getTheFontWithSize:StatusFont AndFontName:kNormalContentFontStr]; _statusBtn.imageView.contentMode = UIViewContentModeScaleAspectFit; _statusBtn.contentMode = UIViewContentModeScaleAspectFill; } return _statusBtn; } - (MOFanClubNameplateView *)nameplateView{ if(!_nameplateView){ _nameplateView = [[MOFanClubNameplateView alloc] init]; } return _nameplateView; } - (MOStarNumView *)startView{ if(!_startView){ _startView = [[MOStarNumView alloc] init]; } return _startView; } - (MOMsgContentTextView *)infoImgView{ if(!_infoImgView){ _infoImgView = [MOMsgContentTextView new]; _infoImgView.backgroundColor = [UIColor clearColor]; _infoImgView.textContainerInset = UIEdgeInsetsMake(0, 0, 0, 0);//UITextView原本文字距离左右有间距,设置负数消除边距 _infoImgView.editable = NO; _infoImgView.scrollEnabled = NO;//防止滑出屏幕又滑入时有时单行文字消失 _infoImgView.userInteractionEnabled = NO; _infoImgView.textColor = [MOTools colorWithHexString:@"#FFFFFF" alpha:1.0]; _infoImgView.textAlignment = NSTextAlignmentCenter; } return _infoImgView; } - (MOMsgContentTextView *)medalView{ if(!_medalView){ _medalView = [MOMsgContentTextView new]; _medalView.backgroundColor = [UIColor clearColor]; _medalView.textContainerInset = UIEdgeInsetsMake(0, 0, 0, 5);//UITextView原本文字距离左右有间距,设置负数消除边距 _medalView.editable = NO; _medalView.scrollEnabled = NO;//防止滑出屏幕又滑入时有时单行文字消失 _medalView.userInteractionEnabled = NO; _medalView.textColor = [MOTools colorWithHexString:@"#FFFFFF" alpha:1.0]; _medalView.textAlignment = NSTextAlignmentCenter; } return _medalView; } - (MOTopsUserView *)topsView{ if(!_topsView){ _topsView = [MOTopsUserView moTopsUserView]; } return _topsView; } - (MOLiveGoBtnView *)liveGoBtnView{ if(!_liveGoBtnView){ WEAKSELF _liveGoBtnView = [[MOLiveGoBtnView alloc] init]; _liveGoBtnView.btnClickBlock = ^{ weakSelf.liveGoBtnClickBlock ? weakSelf.liveGoBtnClickBlock() : nil; [weakSelf dismissLiveUserInfoView]; }; } return _liveGoBtnView; } @end