| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194 |
- //
- // 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 <UIImageView+YYWebImage.h>
- #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
|