| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- //
- // MOInviteTableViewCell.m
- // MiMoLive
- //
- // Created by SuperC on 2024/8/8.
- //
- #import "MOInviteTableViewCell.h"
- @implementation MOInviteTableViewCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
-
- self.backgroundColor = [UIColor clearColor];
- self.selectionStyle = UITableViewCellSelectionStyleNone;
-
- // [self.inviteBtn setTitle:NSLocalString(@"mimo_voice_invite_invited") forState:UIControlStateSelected];
-
- self.headImgView.layer.cornerRadius = 46.0 / 2.0;
- self.headImgView.layer.masksToBounds = YES;
-
- [self.contentView addSubview:self.headImgView];
- [self.headImgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.headImgView);
- make.centerY.equalTo(self.headImgView);
- make.width.height.equalTo(@46.0);
- }];
- self.headBgView.headImgWidth = 46.0;
-
- self.startView.viewHeight = MOStarNumViewNormalHeight;
- CGFloat startWidth = [self.startView getTheViewWidth];
- [self.contentView addSubview:self.startView];
- [self.startView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.idLab.mas_centerY).offset(-3);
- make.left.equalTo(self.idLab.mas_left).offset(-10.0);
- make.height.equalTo(@(MOStarNumViewNormalHeight));
- make.width.equalTo(@(startWidth));
- }];
-
- [self.inviteBtn setFont:[MOTextTools getTheFontWithSize:14.0 AndFontName:kNormalContentFontStr]];
- self.nameLab.font = [MOTextTools getTheFontWithSize:14.0 AndFontName:kNormalContentFontStr];
- self.idLab.font = [MOTextTools getTheFontWithSize:14.0 AndFontName:kNormalContentFontStr];
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- - (void)setCellModel:(MOPkUserList *)cellModel{
- _cellModel = cellModel;
-
- [self.headImgView sd_setImageWithURL:[NSURL URLWithString:cellModel.userProfile.avatar] placeholderImage:[UIImage imageNamed:@"icon_mine_placeHolder"]];
- self.nameLab.text = cellModel.userProfile.nickname;
-
- self.idLab.text = [NSString stringWithFormat:@"ID %@",cellModel.userProfile.userNo];
- self.startView.idNumStr = [NSString stringWithFormat:@"%@",cellModel.userProfile.userNo];
- self.startView.levelNum = (NSInteger)cellModel.userProfile.beautifulLevel;
-
- if(cellModel.userProfile.beautifulLevel == 0){
- self.idLab.hidden = NO;
- self.startView.hidden = YES;
- }
- else{
- self.idLab.hidden = YES;
- self.startView.hidden = NO;
- }
-
- if(cellModel.isSelect){
- self.inviteBtn.selected = YES;
- }
- else{
- self.inviteBtn.selected = NO;
- }
-
- if(cellModel.userProfile.adornment.headgearRes.length > 0){
- self.headBgView.hidden = NO;
- self.headBgView.isLiving = NO;
- self.headBgView.effectType = cellModel.userProfile.adornment.headgearType;
- self.headBgView.imgUrlStr = cellModel.userProfile.adornment.headgearRes;
- }
- else{
- self.headBgView.hidden = YES;
- }
- }
- - (IBAction)inviteBtnClick:(id)sender {
- //邀请上麦的RTM
-
- if(self.inviteBtn.selected == YES){
- return;
- }
-
- self.inviteActionBlock ? self.inviteActionBlock(self.cellModel) : nil;
-
- MOUserProfile *profile = [[MOUserProfile alloc] init];
- profile.id = self.cellModel.userProfile.id;
-
- MOLinkMic *linkMic = [[MOLinkMic alloc] init];
- linkMic.profile = profile;
- linkMic.invite = self.cellModel.invite;
- linkMic.camera = self.camera;
-
- MORtmEntity *entity = [MORtmEntity prepareRtmManageAgreeLianMaiMessageAndLinkMicType:3 AndStatus:6 AndRoomId:self.roomId AndMOLinkMic:linkMic AndSeatNum:1];
- NSString *entityJsomString = entity.modelToJSONString;
-
- [[MOAgoraRTMManager shareManager] toSendRtmGroupMsg:entityJsomString andBlock:^(BOOL isSuccess) {
- if(isSuccess){
- [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_voice_hud_normal_tip_host_11")];
- }
- }];
- }
- - (MOHeadCustomView *)headBgView{
- if(!_headBgView){
- _headBgView = [[MOHeadCustomView alloc] init];
- }
- return _headBgView;
- }
- - (MOStarNumView *)startView{
- if(!_startView){
- _startView = [[MOStarNumView alloc] init];
- }
- return _startView;
- }
- @end
|