1611 lines
63 KiB
Objective-C
1611 lines
63 KiB
Objective-C
//
|
|
// XPUserCardViewController.m
|
|
// xplan-ios
|
|
//
|
|
// Created by 冯硕 on 2021/11/24.
|
|
//
|
|
|
|
#import "XPUserCardViewController.h"
|
|
///Third
|
|
#import <SVGA.h>
|
|
#import <Masonry/Masonry.h>
|
|
#import <YYImage/YYAnimatedImageView.h>
|
|
///Tool
|
|
#import "YUMIMacroUitls.h"
|
|
#import "ThemeColor+UserCard.h"
|
|
#import "TTPopup.h"
|
|
#import "YUMIHtmlUrl.h"
|
|
#import "AccountInfoStorage.h"
|
|
#import "SpriteSheetImageManager.h"
|
|
#import "UIImage+Utils.h"
|
|
#import "XCCurrentVCStackManager.h"
|
|
///Model
|
|
#import "UserInfoModel.h"
|
|
#import "XPUserCardItemModel.h"
|
|
#import "RoomInfoModel.h"
|
|
#import "AttachmentModel.h"
|
|
#import "XPKickUserModel.h"
|
|
#import "XPUserCardMicroItemModel.h"
|
|
#import "MicroQueueModel.h"
|
|
#import "MicroStateModel.h"
|
|
///View
|
|
#import "XPSendGiftView.h"
|
|
#import "NetImageView.h"
|
|
#import "XPUserCardItemCollectionViewCell.h"
|
|
#import "XPUserCardSkillCardView.h"
|
|
#import "XPRoomSendTextView.h"
|
|
#import "XPRoomHalfMessageView.h"
|
|
///P
|
|
#import "XPUserCardPresenter.h"
|
|
#import "XPUserCardProtocol.h"
|
|
///VC
|
|
#import "XPWebViewController.h"
|
|
#import "XPMineUserInfoViewController.h"
|
|
#import "SessionViewController.h"
|
|
|
|
#import <QGVAPWrapView.h>
|
|
#import "XPRoomGiftAnimationParser.h"
|
|
|
|
@interface XPUserCardViewController ()<UICollectionViewDelegate, UICollectionViewDataSource,XPUserCardProtocol>
|
|
///上面点击的view
|
|
@property (nonatomic,strong) UIView *topTapView;
|
|
///下面点击的view
|
|
@property (nonatomic,strong) UIView *bottomTapView;
|
|
///背景
|
|
@property (nonatomic,strong) UIView *backView;
|
|
///最外层的容器
|
|
@property (nonatomic,strong) UIStackView *stackView;
|
|
///展示用户的信息
|
|
@property (nonatomic,strong) UIView * userInfoView;
|
|
///VIP资料卡头饰
|
|
@property (nonatomic, strong) NetImageView *nobleImageView;
|
|
@property (nonatomic, strong) VAPView *vapView;
|
|
@property (nonatomic, strong) XPRoomGiftAnimationParser *vapParser;
|
|
///模糊效果
|
|
@property (strong, nonatomic) UIVisualEffectView *effectView;
|
|
///头像背景
|
|
@property (nonatomic,strong) NetImageView *backImageView;
|
|
///头饰
|
|
@property (nonatomic,strong) YYAnimatedImageView *headWearImageView;
|
|
@property (nonatomic,strong) SVGAImageView *headWearSVGAImageView;
|
|
///头饰播放
|
|
@property (nonatomic, strong) SpriteSheetImageManager *manager;
|
|
///头像
|
|
@property (nonatomic,strong) NetImageView *avatarImageView;
|
|
///名字
|
|
@property (nonatomic,strong) UILabel *nickLabel;
|
|
///性别
|
|
@property (nonatomic,strong) UIImageView *sexImageView;
|
|
///新用户
|
|
@property (nonatomic,strong) UIImageView *newUserImageView;
|
|
///官方的
|
|
@property (nonatomic,strong) UIImageView *officialImageView;
|
|
///魅力等级 等级 铭牌
|
|
@property (nonatomic,strong) UIStackView *tagStackView;
|
|
///魅力等级
|
|
@property (nonatomic,strong) NetImageView *charmImageView;
|
|
///VIPicon
|
|
@property (nonatomic, strong) NetImageView *nobleIconImageView;
|
|
///等级
|
|
@property (nonatomic,strong) NetImageView *experImageView;
|
|
///铭牌的容器
|
|
@property (nonatomic,strong) UIView * namePlateView;
|
|
///铭牌图片
|
|
@property (nonatomic,strong) NetImageView *nameplateImageView;
|
|
///铭牌文字
|
|
@property (nonatomic,strong) UILabel *nameplateLabel;
|
|
|
|
///VIP铭牌图片
|
|
@property (nonatomic,strong) NetImageView *vipPlateImageView;
|
|
|
|
///ID
|
|
@property (nonatomic,strong) UILabel *idLabel;
|
|
@property (nonatomic, strong) UIButton *copyIDButton;
|
|
|
|
///举报
|
|
@property (nonatomic,strong) UIButton *reportButton;
|
|
///关闭
|
|
@property (nonatomic,strong) UIButton *closeButton;
|
|
///列表
|
|
@property (nonatomic,strong) UICollectionView *collectionView;
|
|
///技能卡列表
|
|
@property (nonatomic, strong) XPUserCardSkillCardView *skillCardView;
|
|
///分割线
|
|
@property (nonatomic,strong) UIView * sepLineView;
|
|
///操作的容器
|
|
@property (nonatomic,strong) UIStackView *operaStackView;
|
|
///选择心动
|
|
@property (nonatomic,strong) UIButton *pickHeartButton;
|
|
///选择心动的容器
|
|
@property (nonatomic,strong) UIView * pickHeartView;
|
|
///展示用户的uid
|
|
@property (nonatomic,strong) XPUserCardInfoModel *cardInfo;
|
|
///数据源
|
|
@property (nonatomic,copy) NSArray<XPUserCardItemModel *> *datasource;
|
|
|
|
///目标用户的信息
|
|
@property (nonatomic,strong) UserInfoModel *targetUserInfo;
|
|
|
|
@end
|
|
|
|
@implementation XPUserCardViewController
|
|
|
|
- (instancetype)initWithUser:(XPUserCardInfoModel *)cardInfo {
|
|
if (self = [super init]) {
|
|
self.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
self.cardInfo = cardInfo;
|
|
}
|
|
return self;
|
|
}
|
|
|
|
#pragma mark - Life Style
|
|
- (XPUserCardPresenter *)createPresenter {
|
|
return [[XPUserCardPresenter alloc] init];
|
|
}
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
[self initHttp];
|
|
[self initSubViews];
|
|
[self initSubViewConstraints];
|
|
[self initEvent];
|
|
}
|
|
|
|
#pragma mark - Private Method
|
|
- (void)initSubViews {
|
|
self.view.backgroundColor = [UIColor clearColor];
|
|
///设置颜色 stackView 设置背景色 会失败
|
|
[self.view addSubview:self.topTapView];
|
|
[self.view addSubview:self.backView];
|
|
[self.view addSubview:self.bottomTapView];
|
|
|
|
[self.backView addSubview:self.stackView];
|
|
[self.view addSubview:self.nobleImageView];
|
|
[self.view addSubview:self.vapView];
|
|
|
|
[self.stackView addArrangedSubview:self.userInfoView];
|
|
[self.stackView addArrangedSubview:self.skillCardView];
|
|
[self.stackView addArrangedSubview:self.collectionView];
|
|
[self.stackView addArrangedSubview:self.sepLineView];
|
|
[self.stackView addArrangedSubview:self.operaStackView];
|
|
[self.stackView addArrangedSubview:self.pickHeartView];
|
|
///用户信息
|
|
[self.userInfoView addSubview:self.backImageView];
|
|
[self.userInfoView addSubview:self.effectView];
|
|
[self.userInfoView addSubview:self.avatarImageView];
|
|
[self.userInfoView addSubview:self.headWearImageView];
|
|
[self.userInfoView addSubview:self.headWearSVGAImageView];
|
|
[self.userInfoView addSubview:self.nobleIconImageView];
|
|
[self.userInfoView addSubview:self.nickLabel];
|
|
[self.userInfoView addSubview:self.sexImageView];
|
|
[self.userInfoView addSubview:self.tagStackView];
|
|
[self.userInfoView addSubview:self.idLabel];
|
|
[self.userInfoView addSubview:self.copyIDButton];
|
|
[self.userInfoView addSubview:self.reportButton];
|
|
[self.userInfoView addSubview:self.closeButton];
|
|
///用户信息中的标签
|
|
[self.tagStackView addArrangedSubview:self.newUserImageView];
|
|
[self.tagStackView addArrangedSubview:self.officialImageView];
|
|
[self.tagStackView addArrangedSubview:self.experImageView];
|
|
[self.tagStackView addArrangedSubview:self.charmImageView];
|
|
[self.tagStackView addArrangedSubview:self.vipPlateImageView];
|
|
[self.tagStackView addArrangedSubview:self.namePlateView];
|
|
///铭牌
|
|
[self.namePlateView addSubview:self.nameplateImageView];
|
|
[self.namePlateView addSubview:self.nameplateLabel];
|
|
|
|
[self.pickHeartView addSubview:self.pickHeartButton];
|
|
[self configRoomDatingPickHeart];
|
|
}
|
|
|
|
- (void)initSubViewConstraints {
|
|
[self.topTapView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.leading.trailing.mas_equalTo(self.view);
|
|
make.bottom.mas_equalTo(self.backView.mas_top);
|
|
}];
|
|
|
|
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.leading.trailing.mas_equalTo(self.view).inset(45);
|
|
make.centerY.mas_equalTo(self.view);
|
|
make.bottom.mas_equalTo(self.stackView.mas_bottom);
|
|
}];
|
|
|
|
[self.bottomTapView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.bottom.leading.trailing.mas_equalTo(self.view);
|
|
make.top.mas_equalTo(self.backView.mas_bottom);
|
|
}];
|
|
|
|
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.mas_equalTo(KScreenWidth - 90);
|
|
make.top.centerX.mas_equalTo(self.backView);
|
|
}];
|
|
|
|
[self.userInfoView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.mas_equalTo(self.stackView);
|
|
make.height.mas_equalTo(110);
|
|
}];
|
|
CGFloat nobleMargin = (KScreenWidth - 45) * 45.0 / (KScreenWidth - 90);
|
|
[self.nobleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.height.mas_equalTo(180);
|
|
make.top.mas_equalTo(self.backView).mas_offset(-70);
|
|
make.trailing.mas_equalTo(self.backView).offset(nobleMargin*0.5);
|
|
make.leading.mas_equalTo(self.backView).mas_offset(-nobleMargin*0.5);
|
|
}];
|
|
[self.vapView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.edges.mas_equalTo(self.nobleImageView);
|
|
}];
|
|
[self.skillCardView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.mas_equalTo(self.userInfoView);
|
|
make.height.mas_equalTo(0);
|
|
}];
|
|
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.mas_equalTo(self.userInfoView);
|
|
make.height.mas_equalTo(0);
|
|
}];
|
|
|
|
[self.sepLineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.size.mas_equalTo(CGSizeMake(KScreenWidth - 45 * 2 - 10 * 2, 1));
|
|
}];
|
|
|
|
[self.operaStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.mas_equalTo(self.userInfoView);
|
|
make.height.mas_equalTo(40);
|
|
}];
|
|
///用户信息的子view
|
|
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.leading.trailing.mas_equalTo(self.userInfoView);
|
|
make.height.mas_equalTo(110);
|
|
}];
|
|
|
|
[self.effectView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.edges.mas_equalTo(self.userInfoView);
|
|
}];
|
|
|
|
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.size.mas_equalTo(CGSizeMake(50, 50));
|
|
make.leading.mas_equalTo(self.userInfoView).offset(15);
|
|
make.top.mas_equalTo(self.userInfoView).offset(30);
|
|
}];
|
|
|
|
[self.headWearImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.center.mas_equalTo(self.avatarImageView);
|
|
make.width.mas_equalTo(self.avatarImageView.mas_width).multipliedBy(1.31);
|
|
make.height.mas_equalTo(self.headWearImageView.mas_width);
|
|
}];
|
|
|
|
[self.headWearSVGAImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.center.mas_equalTo(self.avatarImageView);
|
|
make.width.mas_equalTo(self.avatarImageView.mas_width).multipliedBy(1.31);
|
|
make.height.mas_equalTo(self.headWearImageView.mas_width);
|
|
}];
|
|
|
|
[self.nobleIconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.leading.mas_equalTo(self.headWearImageView.mas_trailing).offset(5);
|
|
make.centerY.mas_equalTo(self.nickLabel);
|
|
make.height.mas_equalTo(20);
|
|
make.width.mas_equalTo(0);
|
|
}];
|
|
|
|
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.trailing.lessThanOrEqualTo(self.userInfoView.mas_trailing).offset(-16);
|
|
make.size.mas_equalTo(CGSizeMake(14, 14));
|
|
make.centerY.mas_equalTo(self.nickLabel);
|
|
}];
|
|
|
|
[self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.mas_equalTo(self.avatarImageView);
|
|
make.leading.mas_equalTo(self.nobleIconImageView.mas_trailing);
|
|
make.trailing.equalTo(self.sexImageView.mas_leading).offset(-8);
|
|
}];
|
|
|
|
[self.tagStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.leading.mas_equalTo(self.nobleIconImageView);
|
|
make.top.mas_equalTo(self.nobleIconImageView.mas_bottom).offset(3);
|
|
make.height.mas_equalTo(20);
|
|
}];
|
|
|
|
[self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.leading.mas_equalTo(self.nobleIconImageView);
|
|
make.top.mas_equalTo(self.tagStackView.mas_bottom).offset(3);
|
|
}];
|
|
|
|
[self.copyIDButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.leading.mas_equalTo(self.idLabel.mas_trailing).offset(2);
|
|
make.centerY.mas_equalTo(self.idLabel);
|
|
make.size.mas_equalTo(CGSizeMake(14, 14));
|
|
}];
|
|
|
|
[self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.size.mas_equalTo(CGSizeMake(22, 22));
|
|
make.top.mas_equalTo(self.userInfoView).offset(5);
|
|
make.trailing.mas_equalTo(self.userInfoView).offset(-6);
|
|
}];
|
|
|
|
[self.reportButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerY.mas_equalTo(self.closeButton);
|
|
make.trailing.mas_equalTo(self.closeButton.mas_leading).offset(-5);
|
|
}];
|
|
|
|
[self.experImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.mas_equalTo(34);
|
|
}];
|
|
|
|
[self.charmImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.mas_equalTo(34);
|
|
}];
|
|
|
|
[self.newUserImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.height.mas_equalTo(15);
|
|
}];
|
|
|
|
[self.officialImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.height.mas_equalTo(20);
|
|
}];
|
|
|
|
[self.namePlateView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.height.mas_equalTo(20);
|
|
make.width.mas_equalTo(self.nameplateImageView.mas_width);
|
|
}];
|
|
|
|
[self.vipPlateImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.height.mas_equalTo(20);
|
|
make.width.mas_equalTo(60);
|
|
}];
|
|
|
|
[self.nameplateImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.height.mas_equalTo(20);
|
|
make.width.mas_equalTo(60);
|
|
make.leading.top.mas_equalTo(self.namePlateView);
|
|
}];
|
|
|
|
[self.nameplateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.bottom.mas_equalTo(self.nameplateImageView);
|
|
make.trailing.mas_equalTo(self.namePlateView).offset(-2);
|
|
}];
|
|
|
|
[self.pickHeartView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.mas_equalTo(200);
|
|
make.height.mas_equalTo(40);
|
|
}];
|
|
|
|
[self.pickHeartButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.leading.trailing.centerY.mas_equalTo(self.pickHeartView);
|
|
make.height.mas_equalTo(30);
|
|
}];
|
|
}
|
|
|
|
- (void)initEvent {
|
|
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(disMisssVc:)];
|
|
[self.topTapView addGestureRecognizer:tap];
|
|
UITapGestureRecognizer * bottomTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(disMisssVc:)];
|
|
[self.bottomTapView addGestureRecognizer:bottomTap];
|
|
|
|
UITapGestureRecognizer * userInfoTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gotoUserInfoVC:)];
|
|
[self.avatarImageView addGestureRecognizer:userInfoTap];
|
|
}
|
|
|
|
- (void)initHttp {
|
|
[self.presenter getUserInfo:self.cardInfo.uid];
|
|
[self.presenter getFunctionItemsByUserInfo:self.cardInfo];
|
|
|
|
}
|
|
|
|
- (void)configRoomDatingPickHeart {
|
|
self.pickHeartView.hidden = YES;
|
|
if (self.cardInfo.roomInfo.roomModeType == RoomModeType_Open_Blind && self.cardInfo.roomInfo.blindDateState == RoomPlayDateingType_Pick && [AccountInfoStorage instance].getUid.integerValue != self.cardInfo.uid.integerValue) {
|
|
__block MicroQueueModel * selfMicqueue;
|
|
__block MicroQueueModel * targetMicqueue;
|
|
[self.cardInfo.micQueue.allValues enumerateObjectsUsingBlock:^(MicroQueueModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
if (obj.userInfo && obj.userInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {
|
|
selfMicqueue = obj;
|
|
} else if(obj.userInfo && obj.userInfo.uid == self.cardInfo.uid.integerValue) {
|
|
targetMicqueue = obj;
|
|
}
|
|
}];
|
|
if (selfMicqueue.userInfo && selfMicqueue.userInfo.uid > 0 && !selfMicqueue.userInfo.hasSelectUser && selfMicqueue.microState.position != -1 && targetMicqueue.microState.position != -1) {
|
|
self.pickHeartView.hidden = NO;
|
|
}
|
|
}
|
|
}
|
|
|
|
- (void)updateCollectionHeight:(NSArray *)array {
|
|
if (array.count > 0) {
|
|
CGFloat collectionHeight = 16 + 10;
|
|
NSInteger page = array.count / 4;
|
|
if (page > 0) {
|
|
if (array.count % 4 ==0) {
|
|
collectionHeight += (page * 60 + (page-1) * 16);
|
|
} else {
|
|
collectionHeight += ((page + 1) * 60 + page * 16);
|
|
}
|
|
} else {
|
|
collectionHeight += 60;
|
|
}
|
|
[self.collectionView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
make.height.mas_equalTo(collectionHeight);
|
|
}];
|
|
}
|
|
}
|
|
|
|
///拉黑/踢出房间 发送自定义消息
|
|
- (void)sendCustomMessageKickOrBlackUser:(int)first second:(int)second {
|
|
RoomInfoModel * roomInfo = self.cardInfo.roomInfo;
|
|
XPKickUserModel *notifyModel = [[XPKickUserModel alloc] init];
|
|
notifyModel.handleNick = self.cardInfo.nick;
|
|
notifyModel.handleUid = [AccountInfoStorage instance].getUid.integerValue;
|
|
notifyModel.targetUid = self.cardInfo.uid.integerValue;
|
|
notifyModel.targetNick = self.targetUserInfo.nick;
|
|
notifyModel.uid = self.cardInfo.uid.integerValue;
|
|
AttachmentModel *attachment = [[AttachmentModel alloc] init];
|
|
attachment.first = first;
|
|
attachment.second = second;
|
|
attachment.data = [notifyModel model2dictionary];
|
|
NSString * sessionId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
|
|
|
|
NIMMessage *message = [[NIMMessage alloc]init];
|
|
NIMCustomObject *object = [[NIMCustomObject alloc] init];
|
|
object.attachment = attachment;
|
|
message.messageObject = object;
|
|
//构造会话
|
|
NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom];
|
|
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
|
|
}
|
|
|
|
- (NSArray<XPGiftUserInfoModel *> *)configGiftUsers:(NSMutableDictionary<NSString *,MicroQueueModel *> *)queue {
|
|
NSMutableArray * array = [NSMutableArray array];
|
|
BOOL receiveIsOnMic = NO;
|
|
for (MicroQueueModel * microModel in queue.allValues) {
|
|
if (microModel.userInfo && microModel.userInfo.uid >0) {
|
|
UserInfoModel * userInfo = microModel.userInfo;
|
|
if (userInfo.uid == self.cardInfo.uid.integerValue) {
|
|
receiveIsOnMic = YES;
|
|
}
|
|
}
|
|
}
|
|
if (receiveIsOnMic) {
|
|
for (MicroQueueModel * microModel in queue.allValues) {
|
|
if (microModel.userInfo && microModel.userInfo.uid >0) {
|
|
UserInfoModel * userInfo = microModel.userInfo;
|
|
XPGiftUserInfoModel * userModel = [[XPGiftUserInfoModel alloc] init];
|
|
userModel.avatar = userInfo.avatar;
|
|
userModel.vipMic = userInfo.vipMic;
|
|
userModel.position = [NSString stringWithFormat:@"%d", microModel.microState.position];
|
|
userModel.uid = userInfo.uid;
|
|
if (userInfo.uid == self.cardInfo.uid.integerValue) {
|
|
userModel.isSelect = YES;
|
|
}
|
|
if (self.cardInfo.roomInfo.type == RoomType_Anchor && microModel.microState.position == -1) {///个播房一直为离开模式,不需要添加房主位
|
|
continue;
|
|
}
|
|
[array addObject:userModel];
|
|
}
|
|
}
|
|
|
|
RoomInfoModel * roomInfo = self.cardInfo.roomInfo;
|
|
if (roomInfo.leaveMode) {
|
|
XPGiftUserInfoModel * userModel = [[XPGiftUserInfoModel alloc] init];
|
|
userModel.avatar = roomInfo.avatar;
|
|
userModel.position = @"-1";
|
|
userModel.uid = self.cardInfo.uid.integerValue;
|
|
if (roomInfo.uid == self.cardInfo.uid.integerValue) {
|
|
userModel.isSelect = YES;
|
|
}
|
|
[array addObject:userModel];
|
|
} else if (roomInfo.type == RoomType_Anchor) {
|
|
BOOL hadContainerOwner = NO;
|
|
for (UserInfoModel *userModel in array) {
|
|
if (userModel.uid == roomInfo.uid) {
|
|
hadContainerOwner = YES;
|
|
break;
|
|
}
|
|
}
|
|
if (!hadContainerOwner) {
|
|
XPGiftUserInfoModel * userModel = [[XPGiftUserInfoModel alloc] init];
|
|
userModel.avatar = roomInfo.avatar;
|
|
userModel.position = @"-1";
|
|
userModel.uid = self.cardInfo.uid.integerValue;
|
|
if (roomInfo.uid == self.cardInfo.uid.integerValue) {
|
|
userModel.isSelect = YES;
|
|
}
|
|
[array addObject:userModel];
|
|
}
|
|
}
|
|
} else {
|
|
XPGiftUserInfoModel * userModel = [[XPGiftUserInfoModel alloc] init];
|
|
userModel.avatar = self.targetUserInfo.avatar;
|
|
userModel.nick = self.targetUserInfo.nick;
|
|
userModel.uid = self.cardInfo.uid.integerValue;
|
|
userModel.isSelect = YES;
|
|
[array addObject:userModel];
|
|
}
|
|
return array;
|
|
}
|
|
|
|
//自己是否在游戏中
|
|
- (BOOL)isInSudGame:(NSString *)uid {
|
|
BOOL isGamePlaying = NO;
|
|
if (self.cardInfo.roomInfo.type == RoomType_MiniGame) {
|
|
for (int i = -1; i<5; i++) {
|
|
NSMutableDictionary * micQueue = self.cardInfo.micQueue;
|
|
MicroQueueModel *micSequence = [micQueue objectForKey:[NSString stringWithFormat:@"%d", i]];
|
|
if (micSequence == nil || micSequence.userInfo == nil) {
|
|
continue;
|
|
}
|
|
if (micSequence.userInfo.uid == uid.integerValue && micSequence.userInfo.gameStatus == LittleGamePlayStatus_Plying) {
|
|
isGamePlaying = YES;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return isGamePlaying;
|
|
}
|
|
|
|
|
|
#pragma mark - XPUserCardProtocol
|
|
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo {
|
|
self.targetUserInfo = userInfo;
|
|
self.avatarImageView.imageUrl = userInfo.avatar;
|
|
self.nobleImageView.imageUrl = userInfo.userInfoCardPic;
|
|
|
|
if (userInfo.userVipInfoVO.vipLevel>0 && userInfo.userVipInfoVO.userCardBG.length > 0) {
|
|
self.backImageView.imageUrl = [userInfo.userVipInfoVO.userCardBG stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
|
self.effectView.hidden = YES;
|
|
self.backImageView.clipsToBounds = NO;
|
|
[self.backImageView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
make.height.mas_equalTo(180);
|
|
}];
|
|
self.idLabel.textColor = UIColorFromRGB(0x313131);
|
|
} else {
|
|
self.backImageView.layer.masksToBounds = YES;
|
|
self.backImageView.layer.cornerRadius = 25;
|
|
self.backImageView.imageUrl = userInfo.avatar;
|
|
self.idLabel.textColor = [DJDKMIMOMColor textThirdColor];
|
|
}
|
|
|
|
NSString *resourcePath = [userInfo.userInfoCardPic stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
|
if (resourcePath.length > 0) {
|
|
NSString *encodingUrl = [resourcePath stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"`#%^{}\"[]|\\<> "].invertedSet];
|
|
@kWeakify(self);
|
|
[self.vapParser parseWithURL:[encodingUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]] completionBlock:^(NSString * _Nullable videoUrl) {
|
|
@kStrongify(self);
|
|
if (videoUrl.length) {
|
|
[self.vapView setMute:YES];
|
|
[self.vapView playHWDMP4:videoUrl repeatCount:-1 delegate:nil];
|
|
}
|
|
} failureBlock:^(NSError * _Nullable error) {
|
|
}];
|
|
}
|
|
|
|
self.nobleIconImageView.imageUrl = userInfo.userVipInfoVO.vipIcon;
|
|
if (userInfo.userVipInfoVO && userInfo.userVipInfoVO.vipIcon) {//VIPicon
|
|
[self.nobleIconImageView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
make.width.mas_equalTo(30);
|
|
}];
|
|
}
|
|
NSString * nick = userInfo.nick;
|
|
// if (nick.length > 20) {
|
|
// nick = [NSString stringWithFormat:@"%@…", [nick substringToIndex:20]];
|
|
// }
|
|
self.nickLabel.text = nick.length > 0 ? nick : @"";
|
|
self.sexImageView.image = userInfo.gender == GenderType_Female ? [UIImage imageNamed:@"common_female"] : [UIImage imageNamed:@"common_male"];
|
|
self.officialImageView.hidden = userInfo.defUser != UserLevelType_Offical;
|
|
self.newUserImageView.hidden = !userInfo.newUser;
|
|
if (userInfo.newUser) {
|
|
if (userInfo.fromSayHelloChannel) {
|
|
self.newUserImageView.image = [UIImage imageNamed:@"room_new_user_greet_new"];
|
|
} else {
|
|
self.newUserImageView.image = [UIImage getLanguageImage:@"common_new_user"];
|
|
}
|
|
}
|
|
if (userInfo.userLevelVo.experUrl) {
|
|
self.experImageView.imageUrl = userInfo.userLevelVo.experUrl;
|
|
}
|
|
self.experImageView.hidden = userInfo.userLevelVo.experUrl.length <= 0;
|
|
|
|
if (userInfo.userLevelVo.charmUrl) {
|
|
self.charmImageView.imageUrl = userInfo.userLevelVo.charmUrl;
|
|
}
|
|
self.charmImageView.hidden = userInfo.userLevelVo.charmUrl.length <= 0;
|
|
|
|
if (userInfo.userVipInfoVO.nameplateUrl.length > 0) {
|
|
self.vipPlateImageView.hidden = NO;
|
|
self.vipPlateImageView.imageUrl = userInfo.userVipInfoVO.nameplateUrl;
|
|
} else {
|
|
self.vipPlateImageView.hidden = YES;
|
|
}
|
|
|
|
if (userInfo.nameplateWord.length>0 && userInfo.nameplatePic.length>0) {
|
|
self.nameplateImageView.imageUrl = userInfo.nameplatePic;
|
|
self.nameplateLabel.text = userInfo.nameplateWord;
|
|
self.namePlateView.hidden = NO;
|
|
} else {
|
|
self.namePlateView.hidden = YES;
|
|
}
|
|
|
|
NSString *text = [NSString stringWithFormat:YMLocalizedString(@"XPUserCardViewController0"), userInfo.erbanNo];
|
|
self.idLabel.text = text;
|
|
|
|
NSString * headwearUrl= userInfo.headwearEffect.length > 0 ? userInfo.headwearEffect : userInfo.headwearPic;
|
|
self.headWearImageView.hidden = headwearUrl.length <= 0;
|
|
self.headWearSVGAImageView.hidden = headwearUrl.length <= 0;
|
|
if (headwearUrl.length > 0) {
|
|
if ([userInfo isHeadWearSVGA]) {
|
|
[self.headWearSVGAImageView setImageName:headwearUrl];
|
|
} else {
|
|
NSURL *url = [NSURL URLWithString:headwearUrl];
|
|
@kWeakify(self);
|
|
[self.manager loadSpriteSheetImageWithURL:url completionBlock:^(YYSpriteSheetImage * _Nullable sprit) {
|
|
@kStrongify(self);
|
|
self.headWearImageView.image = sprit;
|
|
} failureBlock:^(NSError * _Nullable error) {
|
|
}];
|
|
}
|
|
}
|
|
if (userInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {
|
|
self.reportButton.hidden = YES;
|
|
} else {
|
|
self.reportButton.hidden = NO;
|
|
}
|
|
if (userInfo.absCardPics.count) {
|
|
[self.skillCardView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
make.height.mas_equalTo(30);
|
|
}];
|
|
}
|
|
|
|
self.skillCardView.dataArray = userInfo.absCardPics;
|
|
}
|
|
|
|
- (void)onGetFunctionArraySccess:(NSArray<XPUserCardItemModel *> *)array {
|
|
if (array.count <= 0) {
|
|
[self.presenter getMicroFunctionItemsByUserInfo:self.cardInfo];
|
|
return;
|
|
}
|
|
self.datasource = array;
|
|
[self.presenter getMicroFunctionItemsByUserInfo:self.cardInfo];
|
|
|
|
}
|
|
-(void)onGetFollowDataSccess{
|
|
[self.collectionView reloadData];
|
|
}
|
|
- (void)onGetMicroFunctionArraySuccess:(NSArray<XPUserCardMicroItemModel *> *)array {
|
|
if (array.count <= 0) {
|
|
if (self.datasource.count > 0){
|
|
self.collectionView.hidden = NO;
|
|
[self.collectionView reloadData];
|
|
[self updateCollectionHeight:self.datasource];
|
|
}
|
|
|
|
return;}
|
|
|
|
// self.operaStackView.hidden = NO;
|
|
// self.sepLineView.hidden = NO;
|
|
NSMutableArray *list = [[NSMutableArray alloc]initWithArray:self.datasource];
|
|
NSString * myUid = [AccountInfoStorage instance].getUid;
|
|
if([myUid isEqualToString:self.cardInfo.uid] ){
|
|
|
|
XPUserCardItemModel *cardModel = [XPUserCardItemModel new];
|
|
cardModel.type = UserCardMicroType_Send_Gift;
|
|
cardModel.title = YMLocalizedString(@"XPUserCardPresenter13");
|
|
cardModel.imageName = @"usercard_sendgift_normal";
|
|
cardModel.selectImageName = @"usercard_sendgift_normal";
|
|
[list insertObject:cardModel atIndex:0];
|
|
|
|
}
|
|
for (XPUserCardMicroItemModel * model in array) {
|
|
XPUserCardItemModel *cardModel = [XPUserCardItemModel new];
|
|
cardModel.uid = model.uid;
|
|
cardModel.type = model.type;
|
|
cardModel.title = model.title;
|
|
cardModel.status = model.status;
|
|
cardModel.imageName = model.iconImage;
|
|
[list addObject:cardModel];
|
|
// UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
// [button setTitle:model.title forState:UIControlStateNormal];
|
|
// button.titleLabel.font = [UIFont systemFontOfSize:13];
|
|
// button.tag = model.type;
|
|
// button.selected = model.status;
|
|
// [button setTitleColor:[DJDKMIMOMColor userMicroTitleColor] forState:UIControlStateNormal];
|
|
// [button addTarget:self action:@selector(microButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
// [self.operaStackView addArrangedSubview:button];
|
|
// if([model.title isEqualToString:YMLocalizedString(@"XPUserCardPresenter12")]){
|
|
// [button mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
// make.width.mas_greaterThanOrEqualTo(30);
|
|
// }];
|
|
// }
|
|
}
|
|
self.datasource = list;
|
|
self.collectionView.hidden = NO;
|
|
[self.collectionView reloadData];
|
|
[self updateCollectionHeight:self.datasource];
|
|
}
|
|
|
|
- (void)attentionUserSuccess:(XPUserCardItemModel *)item {
|
|
///其实这个遍历 有没有都行 只是为了预防 在vc中修改了数据源中的item 还是判断一下吧
|
|
[self.datasource enumerateObjectsUsingBlock:^(XPUserCardItemModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
if (item.type == obj.type) {
|
|
obj.isSelect = item.isSelect;
|
|
*stop = YES;
|
|
}
|
|
}];
|
|
[self.collectionView reloadData];
|
|
}
|
|
|
|
- (void)makeKickUserFinish:(NSError *)error {
|
|
if (error == nil && self.targetUserInfo) {
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
[self sendCustomMessageKickOrBlackUser:CustomMessageType_Kick_User second:Custom_Message_Sub_Kick_BeKicked];
|
|
} else if (error.code == 404) {
|
|
[self showErrorToast:YMLocalizedString(@"XPUserCardViewController1")];
|
|
}
|
|
}
|
|
|
|
- (void)superAdminKickUserFinish:(NSError *)error {
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
}
|
|
|
|
- (void)markUserManagerFinish:(XPUserCardItemModel *)item error:(NSError *)error {
|
|
if (error == nil) {
|
|
[self.datasource enumerateObjectsUsingBlock:^(XPUserCardItemModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
if (item.type == obj.type) {
|
|
obj.isSelect = item.isSelect;
|
|
*stop = YES;
|
|
}
|
|
}];
|
|
[self.collectionView reloadData];
|
|
}
|
|
}
|
|
|
|
- (void)makeUserBlackFinish:(NSError *)error {
|
|
if (error == nil && self.targetUserInfo) {
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
if (self.cardInfo.position.length > 0) {
|
|
NIMChatroomQueueRemoveRequest *request = [[NIMChatroomQueueRemoveRequest alloc]init];
|
|
request.key = self.cardInfo.position;
|
|
request.roomId = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.roomId];
|
|
[[NIMSDK sharedSDK].chatroomManager removeChatroomQueueObject:request completion:^(NSError * _Nullable error, NSDictionary<NSString *,NSString *> * _Nullable element) {
|
|
if (error == nil ) {
|
|
}
|
|
}];
|
|
}
|
|
[self sendCustomMessageKickOrBlackUser:CustomMessageType_Kick_User second:Custom_Message_Sub_Kick_BlackList];
|
|
} else if (error.code == 417) {
|
|
[self showErrorToast:YMLocalizedString(@"XPUserCardViewController2")];
|
|
}
|
|
}
|
|
|
|
- (void)lockMicroSusccess {
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
}
|
|
|
|
- (void)muteMicroSusccess {
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
}
|
|
|
|
- (void)kickDownMicroSuccess {
|
|
if (self.cardInfo.uid.integerValue != [AccountInfoStorage instance].getUid.integerValue) {
|
|
[self sendCustomMessageKickOrBlackUser:CustomMessageType_Queue second:Custom_Message_Sub_Queue_Kick];
|
|
}
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
}
|
|
|
|
- (void)upMicroSuccess {
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
}
|
|
|
|
- (void)cleanUserGiftValueSuccess:(NSDictionary *)dic {
|
|
[self showSuccessToast:YMLocalizedString(@"XPUserCardViewController3")];
|
|
NIMMessage * message = [[NIMMessage alloc] init];
|
|
AttachmentModel * attachMent = [[AttachmentModel alloc] init];
|
|
attachMent.first = CustomMessageType_Room_GiftValue;
|
|
attachMent.second = Custom_Message_Sub_Room_GiftValue_Sync;
|
|
attachMent.data = dic;
|
|
NIMCustomObject *object = [[NIMCustomObject alloc] init];
|
|
object.attachment = attachMent;
|
|
message.messageObject = object;
|
|
//构造会话
|
|
NSString * sessionId = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.roomId];
|
|
NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom];
|
|
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
}
|
|
|
|
- (void)roomDatingPickHeartUserSuccess {
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
}
|
|
|
|
- (void)superAdminHandleUserSuccess:(NSString *)opt {
|
|
[self showSuccessToast:YMLocalizedString(@"XPUserCardViewController4")];
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
if ([opt isEqualToString:@"-1"]) {///拉黑
|
|
if (self.cardInfo.position.length > 0) {
|
|
NIMChatroomQueueRemoveRequest *request = [[NIMChatroomQueueRemoveRequest alloc]init];
|
|
request.key = self.cardInfo.position;
|
|
request.roomId = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.roomId];
|
|
[[NIMSDK sharedSDK].chatroomManager removeChatroomQueueObject:request completion:^(NSError * _Nullable error, NSDictionary<NSString *,NSString *> * _Nullable element) {
|
|
if (error == nil ) {
|
|
}
|
|
}];
|
|
}
|
|
[self sendCustomMessageKickOrBlackUser:CustomMessageType_Kick_User second:Custom_Message_Sub_Kick_BlackList];
|
|
}
|
|
}
|
|
|
|
- (BOOL)shouldHideSendGiftItem {
|
|
return self.shouldHideSendGiftItem;
|
|
}
|
|
|
|
#pragma mark - UICollectionViewDelegate
|
|
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
|
return self.datasource.count;
|
|
}
|
|
|
|
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
|
|
///自己是公会超管
|
|
BOOL meIsSuperAdmin = NO;
|
|
for (GuildSuperAdminInfoModel *managerInfo in self.cardInfo.superMangerList) {
|
|
if ([managerInfo.uid isEqualToString:[AccountInfoStorage instance].getUid]) {
|
|
meIsSuperAdmin = YES;
|
|
}
|
|
}
|
|
|
|
if (self.datasource.count > 0) {
|
|
XPUserCardItemModel * model = [self.datasource xpSafeObjectAtIndex:indexPath.item];
|
|
NSString * roomId = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.roomId];;
|
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.uid];;
|
|
switch (model.type) {
|
|
case UserCardMicroType_UpDown: {
|
|
// VIP 防 T 权限
|
|
if (self.targetUserInfo.userVipInfoVO.preventKick &&
|
|
self.targetUserInfo.uid != [AccountInfoStorage instance].getUid.integerValue) {
|
|
NSString *message = [NSString stringWithFormat:YMLocalizedString(@"UserCard_1.0.17_0"), @(self.targetUserInfo.userVipInfoVO.vipLevel)];
|
|
[XNDJTDDLoadingTool showErrorWithMessage:message];
|
|
return;
|
|
}
|
|
if (model.status) {
|
|
if ([self isInSudGame:self.cardInfo.uid]) {
|
|
if (self.cardInfo.uid.integerValue == [AccountInfoStorage instance].getUid.integerValue) {
|
|
[self showErrorToast:YMLocalizedString(@"XPUserCardViewController18")];
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
} else {
|
|
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
|
config.message = YMLocalizedString(@"XPUserCardViewController19");
|
|
[TTPopup alertWithConfig:config confirmHandler:^{
|
|
[self.presenter kickDownMicro:self.cardInfo.position roomId:roomId];
|
|
} cancelHandler:^{
|
|
}];
|
|
}
|
|
return;
|
|
}else {
|
|
[self.presenter kickDownMicro:self.cardInfo.position roomId:roomId];
|
|
}
|
|
} else {
|
|
self.operaStackView.hidden = YES;
|
|
int micCount = self.cardInfo.roomInfo.type == RoomType_Anchor ? 4 : self.cardInfo.roomInfo.type == RoomType_MiniGame ? 6 : 9;
|
|
[self.presenter getRoomMicroItems:micCount cardInfo:self.cardInfo];
|
|
}
|
|
}
|
|
break;
|
|
case UserCardMicroType_Lock:
|
|
[self.presenter microLock:roomUid state:model.status position:self.cardInfo.position];
|
|
break;
|
|
case UserCardMicroType_Mute:
|
|
[self.presenter microMute:roomUid state:model.status position:self.cardInfo.position];
|
|
break;
|
|
case UserCardMicroType_Clean_Gift_Value:
|
|
[self.presenter cleanUserGiftValue:roomUid micUid:self.cardInfo.uid];
|
|
break;
|
|
case UserCardMicroType_Send_Gift:
|
|
{
|
|
[self dismissViewControllerAnimated:NO completion:nil];
|
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.uid];
|
|
XPSendGiftView * giftView = [[XPSendGiftView alloc] initWithType:SendGiftType_Room uid:roomUid];
|
|
giftView.delegate = self.cardInfo.delegate;
|
|
NSArray *users = [self configGiftUsers:self.cardInfo.delegate.getMicroQueue];
|
|
[giftView configGiftUsers:users];
|
|
[self.presentingViewController presentViewController:giftView animated:YES completion:nil];
|
|
break;
|
|
}
|
|
case UserCardItemType_Chat:
|
|
{
|
|
if(self.delegate && [self.delegate respondsToSelector:@selector(clickChatAction)]){
|
|
[self.delegate clickChatAction];
|
|
}
|
|
[self dismissViewControllerAnimated:YES completion:^{
|
|
UIViewController * controller = (UIViewController *)self.cardInfo.delegate;
|
|
XPRoomHalfMessageView *halfMessageView = [[XPRoomHalfMessageView alloc] initWithFrame:CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight) controller:controller];
|
|
halfMessageView.chatUserId = self.cardInfo.uid;
|
|
[controller.view addSubview:halfMessageView];
|
|
[UIView animateWithDuration:.35 animations:^{
|
|
CGRect rect = halfMessageView.frame;
|
|
rect.origin.y = 0;
|
|
halfMessageView.frame = rect;
|
|
}];
|
|
}];
|
|
|
|
}
|
|
break;
|
|
case UserCardItemType_Gift:
|
|
{
|
|
[self dismissViewControllerAnimated:NO completion:nil];
|
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.uid];
|
|
XPSendGiftView * giftView = [[XPSendGiftView alloc] initWithType:SendGiftType_Room uid:roomUid];
|
|
giftView.delegate = self.cardInfo.delegate;
|
|
NSArray *users = [self configGiftUsers:self.cardInfo.delegate.getMicroQueue];
|
|
[giftView configGiftUsers:users];
|
|
[self.presentingViewController presentViewController:giftView animated:YES completion:nil];
|
|
}
|
|
break;
|
|
case UserCardItemType_Attention:
|
|
[self.presenter attentionUser:self.cardInfo.uid status:!model.isSelect];
|
|
break;
|
|
case UserCardItemType_KickOut:
|
|
{
|
|
// 1、判断是否为防被踢用户
|
|
if (self.targetUserInfo.userVipInfoVO.preventKick &&
|
|
self.targetUserInfo.uid != [AccountInfoStorage instance].getUid.integerValue) {
|
|
//2、判断是否为管理员操作
|
|
// if (self.cardInfo.roomInfo.uid != [AccountInfoStorage instance].getUid.integerValue) {
|
|
// [self showErrorToast:[NSString stringWithFormat:YMLocalizedString(@"XPUserCardViewController5"), self.targetUserInfo.userVipInfoVO.vipName]];
|
|
// } else {//房主操作
|
|
NSString *message = [NSString stringWithFormat:YMLocalizedString(@"UserCard_1.0.17_0"), @(self.targetUserInfo.userVipInfoVO.vipLevel)];
|
|
[TTPopup alertWithMessage:message confirmHandler:^{
|
|
|
|
} cancelHandler:^{
|
|
}];
|
|
// TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
|
// config.title = @"";
|
|
// config.message = message;
|
|
// [TTPopup alertWithConfig:config confirmHandler:^{
|
|
// if ([self isInSudGame:self.cardInfo.uid]) {
|
|
// NSString *message = YMLocalizedString(@"XPUserCardViewController7");
|
|
// TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
|
// config.title = @"";
|
|
// config.message = message;
|
|
// [TTPopup alertWithConfig:config confirmHandler:^{
|
|
// [self.presenter makeKickUser:self.cardInfo.uid roomId:roomId];
|
|
// } cancelHandler:^{
|
|
// }];
|
|
// } else {
|
|
// [self.presenter makeKickUser:self.cardInfo.uid roomId:roomId];
|
|
// }
|
|
// } cancelHandler:^{
|
|
// }];
|
|
// }
|
|
return;
|
|
}
|
|
if ([self isInSudGame:self.cardInfo.uid]) {
|
|
NSString *message = YMLocalizedString(@"XPUserCardViewController8");
|
|
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
|
config.title = @"";
|
|
config.message = message;
|
|
[TTPopup alertWithConfig:config confirmHandler:^{
|
|
if (meIsSuperAdmin) {
|
|
[self.presenter superAdminKickUser:self.targetUserInfo.nick cardInfo:self.cardInfo];
|
|
} else {
|
|
[self.presenter makeKickUser:self.cardInfo.uid roomId:roomId];
|
|
}
|
|
} cancelHandler:^{
|
|
}];
|
|
} else {
|
|
NSString *message = [NSString stringWithFormat:YMLocalizedString(@"XPUserCardViewController9"),self.targetUserInfo.nick];
|
|
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
|
config.title = YMLocalizedString(@"XPUserCardViewController10");
|
|
config.message = message;
|
|
[TTPopup alertWithConfig:config confirmHandler:^{
|
|
if (meIsSuperAdmin) {
|
|
[self.presenter superAdminKickUser:self.targetUserInfo.nick cardInfo:self.cardInfo];
|
|
} else {
|
|
[self.presenter makeKickUser:self.cardInfo.uid roomId:roomId];
|
|
}
|
|
} cancelHandler:^{
|
|
}];
|
|
}
|
|
}
|
|
break;
|
|
case UserCardItemType_Black:
|
|
{
|
|
// 1、判断是否为防被踢用户
|
|
if (self.targetUserInfo.userVipInfoVO.preventKick &&
|
|
self.targetUserInfo.uid != [AccountInfoStorage instance].getUid.integerValue) {
|
|
NSString *message = [NSString stringWithFormat:YMLocalizedString(@"UserCard_1.0.17_0"), @(self.targetUserInfo.userVipInfoVO.vipLevel)];
|
|
[TTPopup alertWithMessage:message confirmHandler:^{
|
|
|
|
} cancelHandler:^{
|
|
}];
|
|
// //2、判断是否为管理员操作
|
|
// if (self.cardInfo.roomInfo.uid != [AccountInfoStorage instance].getUid.integerValue) {
|
|
// [self showErrorToast:[NSString stringWithFormat:YMLocalizedString(@"XPUserCardViewController11"), self.targetUserInfo.userVipInfoVO.vipName]];
|
|
// } else {//房主操作
|
|
// NSString *message = [NSString stringWithFormat:YMLocalizedString(@"XPUserCardViewController12"), self.targetUserInfo.userVipInfoVO.vipName];
|
|
// TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
|
// config.title = @"";
|
|
// config.message = message;
|
|
// [TTPopup alertWithConfig:config confirmHandler:^{
|
|
// if ([self isInSudGame:self.cardInfo.uid]) {
|
|
// NSString *message = YMLocalizedString(@"XPUserCardViewController13");
|
|
// TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
|
// config.title = @"";
|
|
// config.message = message;
|
|
// [TTPopup alertWithConfig:config confirmHandler:^{
|
|
// [self.presenter makeUserBlack:self.cardInfo.uid roomId:roomId];
|
|
// } cancelHandler:^{
|
|
// }];
|
|
// } else {
|
|
// [self.presenter makeUserBlack:self.cardInfo.uid roomId:roomId];
|
|
// }
|
|
// } cancelHandler:^{
|
|
// }];
|
|
// }
|
|
return;
|
|
}
|
|
if ([self isInSudGame:self.cardInfo.uid]) {
|
|
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
|
config.title = @"";
|
|
config.message = [NSString stringWithFormat: YMLocalizedString(@"XPUserCardViewController14"), self.targetUserInfo.nick];
|
|
[TTPopup alertWithConfig:config confirmHandler:^{
|
|
if (meIsSuperAdmin) {
|
|
[self.presenter superAdminHandleUser:self.cardInfo.uid opt:@"-1" roomUid:roomUid isSet:YES];
|
|
} else {
|
|
[self.presenter makeUserBlack:self.cardInfo.uid roomId:roomId];
|
|
}
|
|
} cancelHandler:^{
|
|
}];
|
|
} else {
|
|
NSString *title = [NSString stringWithFormat:YMLocalizedString(@"XPUserCardViewController15"),self.targetUserInfo.nick];
|
|
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
|
config.title = title;
|
|
config.message = YMLocalizedString(@"XPUserCardViewController16");
|
|
[TTPopup alertWithConfig:config confirmHandler:^{
|
|
if (meIsSuperAdmin) {
|
|
[self.presenter superAdminHandleUser:self.cardInfo.uid opt:@"-1" roomUid:roomUid isSet:YES];
|
|
}else {
|
|
[self.presenter makeUserBlack:self.cardInfo.uid roomId:roomId];
|
|
}
|
|
} cancelHandler:^{
|
|
}];
|
|
}
|
|
}
|
|
break;
|
|
case UserCardItemType_Manager:
|
|
{
|
|
if (meIsSuperAdmin) {
|
|
[self.presenter superAdminHandleUser:self.cardInfo.uid opt:@"1" roomUid:roomUid isSet:!model.isSelect];
|
|
} else {
|
|
[self.presenter makeUserManager:self.cardInfo.uid roomId:roomId enable:!model.isSelect];
|
|
}
|
|
}
|
|
break;
|
|
case UserCardItemType_Invite_Micro:
|
|
{
|
|
if ([AccountInfoStorage instance].getUid.integerValue == self.targetUserInfo.uid) {
|
|
[self.presenter upMicro:roomId position:model.position userInfo:self.targetUserInfo];
|
|
} else {
|
|
if (self.cardInfo.roomInfo.leaveMode && [model.position isEqualToString:@"-1"]) {
|
|
return;
|
|
}
|
|
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
|
|
[dic setValue:@(model.position.integerValue) forKey:@"micPosition"];
|
|
[dic setValue:@(self.targetUserInfo.uid) forKey:@"uid"];
|
|
AttachmentModel *attachement = [[AttachmentModel alloc]init];
|
|
attachement.first = CustomMessageType_Queue;
|
|
attachement.second = Custom_Message_Sub_Queue_Invite;
|
|
attachement.data = dic;
|
|
|
|
NIMMessage *message = [[NIMMessage alloc]init];
|
|
NIMCustomObject *object = [[NIMCustomObject alloc] init];
|
|
object.attachment = attachement;
|
|
message.messageObject = object;
|
|
//构造会话
|
|
NIMSession *session = [NIMSession session:roomId type:NIMSessionTypeChatroom];
|
|
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
}
|
|
}
|
|
break;
|
|
case UserCardItemType_AtUser:
|
|
{
|
|
if(self.delegate && [self.delegate respondsToSelector:@selector(clickChatAction)]){
|
|
[self.delegate clickChatAction];
|
|
}
|
|
if (self.cardInfo.roomInfo.isCloseScreen) {
|
|
[self showErrorToast:YMLocalizedString(@"XPUserCardViewController17")];
|
|
return;
|
|
}
|
|
[self dismissViewControllerAnimated:NO completion:^{
|
|
UIViewController *vc = self.cardInfo.delegate.getCurrentNav.viewControllers[0];
|
|
[XPRoomSendTextView showTextView:vc.view delegate:self.cardInfo.delegate atUid:self.cardInfo.uid atNick:self.targetUserInfo.nick];
|
|
}];
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
#pragma mark - UICollectionViewDataSource
|
|
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
XPUserCardItemCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPUserCardItemCollectionViewCell class]) forIndexPath:indexPath];
|
|
cell.itemModel = [self.datasource xpSafeObjectAtIndex:indexPath.item];
|
|
return cell;
|
|
}
|
|
|
|
#pragma mark - Event Response
|
|
- (void)microButtonAction:(UIButton *)sender {
|
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.uid];;
|
|
NSString * roomId = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.roomId];;
|
|
switch (sender.tag) {
|
|
case UserCardMicroType_UpDown:
|
|
{
|
|
if (sender.selected) {
|
|
if ([self isInSudGame:self.cardInfo.uid]) {
|
|
if (self.cardInfo.uid.integerValue == [AccountInfoStorage instance].getUid.integerValue) {
|
|
[self showErrorToast:YMLocalizedString(@"XPUserCardViewController18")];
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
} else {
|
|
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
|
config.message = YMLocalizedString(@"XPUserCardViewController19");
|
|
[TTPopup alertWithConfig:config confirmHandler:^{
|
|
[self.presenter kickDownMicro:self.cardInfo.position roomId:roomId];
|
|
} cancelHandler:^{
|
|
}];
|
|
}
|
|
|
|
return;
|
|
}else {
|
|
[self.presenter kickDownMicro:self.cardInfo.position roomId:roomId];
|
|
}
|
|
} else {
|
|
self.operaStackView.hidden = YES;
|
|
int micCount = self.cardInfo.roomInfo.type == RoomType_Anchor ? 4 : self.cardInfo.roomInfo.type == RoomType_MiniGame ? 6 : 9;
|
|
[self.presenter getRoomMicroItems:micCount cardInfo:self.cardInfo];
|
|
}
|
|
}
|
|
break;
|
|
case UserCardMicroType_Lock:
|
|
[self.presenter microLock:roomUid state:sender.selected position:self.cardInfo.position];
|
|
break;
|
|
case UserCardMicroType_Mute:
|
|
[self.presenter microMute:roomUid state:sender.selected position:self.cardInfo.position];
|
|
break;
|
|
case UserCardMicroType_Clean_Gift_Value:
|
|
[self.presenter cleanUserGiftValue:roomUid micUid:self.cardInfo.uid];
|
|
break;
|
|
case UserCardMicroType_Send_Gift:
|
|
{
|
|
[self dismissViewControllerAnimated:NO completion:nil];
|
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.uid];
|
|
XPSendGiftView * giftView = [[XPSendGiftView alloc] initWithType:SendGiftType_Room uid:roomUid];
|
|
giftView.delegate = self.cardInfo.delegate;
|
|
NSArray *users = [self configGiftUsers:self.cardInfo.delegate.getMicroQueue];
|
|
[giftView configGiftUsers:users];
|
|
[self.presentingViewController presentViewController:giftView animated:YES completion:nil];
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
///复制id
|
|
-(void)copyNameAction{
|
|
[XNDJTDDLoadingTool showSuccessWithMessage:YMLocalizedString(@"XPUserCardViewController24")];
|
|
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
|
pasteboard.string = [NSString stringWithFormat:@"%ld",self.targetUserInfo.erbanNo];
|
|
}
|
|
|
|
- (void)reportButtonAction:(UIButton *)sender {
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
XPWebViewController *vc = [[XPWebViewController alloc] initWithRoomUID:@(self.cardInfo.roomInfo.uid).stringValue];
|
|
NSString *urlstr = [NSString stringWithFormat:@"%@?reportUid=%@&source=USERCARD",URLWithType(kReportRoomURL),self.cardInfo.uid];
|
|
vc.url = urlstr;
|
|
[(UINavigationController *)self.presentingViewController pushViewController:vc animated:YES];
|
|
}
|
|
|
|
- (void)closeButtonAction:(UIButton *)sender {
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
}
|
|
|
|
- (void)disMisssVc:(UITapGestureRecognizer *)tap {
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
}
|
|
|
|
- (void)gotoUserInfoVC:(UITapGestureRecognizer *)tap {
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init];
|
|
userInfoVC.uid = self.cardInfo.uid.integerValue;
|
|
[((UINavigationController *)self.presentingViewController) pushViewController:userInfoVC animated:YES];
|
|
}
|
|
|
|
- (void)pickHeartButtonAction:(UIButton *)sender {
|
|
if (self.cardInfo.position.length > 0) {
|
|
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
|
config.title = [NSString stringWithFormat:YMLocalizedString(@"XPUserCardViewController20"), (self.cardInfo.position.intValue + 1)];
|
|
config.message = YMLocalizedString(@"XPUserCardViewController21");
|
|
config.messageColor = UIColorFromRGB(0xFE5D7F);
|
|
config.messageFont = [UIFont systemFontOfSize:14];
|
|
[TTPopup alertWithConfig:config confirmHandler:^{
|
|
[self.presenter pickHeartUser:[NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.uid] chosenUserId:self.cardInfo.uid];
|
|
} cancelHandler:^{
|
|
|
|
}];
|
|
}
|
|
}
|
|
|
|
#pragma mark - Getters And Setters
|
|
|
|
- (UIView *)topTapView {
|
|
if (!_topTapView) {
|
|
_topTapView = [[UIView alloc] init];
|
|
_topTapView.backgroundColor = [UIColor clearColor];
|
|
}
|
|
return _topTapView;
|
|
}
|
|
- (UIView *)bottomTapView {
|
|
if (!_bottomTapView) {
|
|
_bottomTapView = [[UIView alloc] init];
|
|
_bottomTapView.backgroundColor = [UIColor clearColor];
|
|
}
|
|
return _bottomTapView;
|
|
}
|
|
|
|
- (UIView *)backView {
|
|
if (!_backView) {
|
|
_backView = [[UIView alloc] init];
|
|
_backView.backgroundColor = [UIColor whiteColor];
|
|
_backView.layer.masksToBounds = YES;
|
|
_backView.layer.cornerRadius = 12;
|
|
}
|
|
return _backView;
|
|
}
|
|
|
|
- (UIStackView *)stackView {
|
|
if (!_stackView) {
|
|
_stackView = [[UIStackView alloc] init];
|
|
_stackView.axis = UILayoutConstraintAxisVertical;
|
|
_stackView.distribution = UIStackViewDistributionFill;
|
|
_stackView.alignment = UIStackViewAlignmentCenter;
|
|
_stackView.spacing = 0;
|
|
}
|
|
return _stackView;
|
|
}
|
|
|
|
- (UIView *)userInfoView {
|
|
if (!_userInfoView) {
|
|
_userInfoView = [[UIView alloc] init];
|
|
_userInfoView.backgroundColor = [UIColor clearColor];
|
|
}
|
|
return _userInfoView;
|
|
}
|
|
|
|
- (UIVisualEffectView *)effectView {
|
|
if (!_effectView) {
|
|
UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
|
|
_effectView = [[UIVisualEffectView alloc]initWithEffect:effect];
|
|
}
|
|
return _effectView;
|
|
}
|
|
|
|
- (NetImageView *)backImageView {
|
|
if (!_backImageView) {
|
|
_backImageView = [[NetImageView alloc] init];
|
|
_backImageView.userInteractionEnabled = YES;
|
|
_backImageView.contentMode = UIViewContentModeScaleAspectFill;
|
|
_backImageView.image = [UIImageConstant defaultAvatarPlaceholder];
|
|
}
|
|
return _backImageView;
|
|
}
|
|
|
|
- (NetImageView *)nobleImageView {
|
|
if (!_nobleImageView) {
|
|
_nobleImageView = [[NetImageView alloc] init];
|
|
_nobleImageView.contentMode = UIViewContentModeScaleToFill;
|
|
_nobleImageView.layer.masksToBounds = YES;
|
|
}
|
|
return _nobleImageView;
|
|
}
|
|
|
|
- (UIButton *)reportButton {
|
|
if (!_reportButton) {
|
|
_reportButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
[_reportButton setTitle:YMLocalizedString(@"XPUserCardViewController22") forState:UIControlStateNormal];
|
|
[_reportButton setTitleColor:[DJDKMIMOMColor userNickColor] forState:UIControlStateNormal];
|
|
_reportButton.titleLabel.font = [UIFont systemFontOfSize:12];
|
|
[_reportButton addTarget:self action:@selector(reportButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
}
|
|
return _reportButton;
|
|
}
|
|
|
|
- (UIButton *)closeButton {
|
|
if (!_closeButton) {
|
|
_closeButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
[_closeButton setImage:[UIImage imageNamed:@"usercard_close"] forState:UIControlStateNormal];
|
|
[_closeButton setImage:[UIImage imageNamed:@"usercard_close"] forState:UIControlStateSelected];
|
|
[_closeButton addTarget:self action:@selector(closeButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
}
|
|
return _closeButton;
|
|
}
|
|
|
|
- (NetImageView *)avatarImageView {
|
|
if (!_avatarImageView) {
|
|
NetImageConfig * config = [[NetImageConfig alloc] init];
|
|
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
|
config.imageType = ImageTypeUserIcon;
|
|
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
|
|
_avatarImageView.userInteractionEnabled = YES;
|
|
_avatarImageView.layer.masksToBounds = YES;
|
|
_avatarImageView.layer.cornerRadius = 25;
|
|
_avatarImageView.contentMode = UIViewContentModeScaleAspectFill;
|
|
}
|
|
return _avatarImageView;
|
|
}
|
|
|
|
- (UILabel *)nickLabel {
|
|
if (!_nickLabel) {
|
|
_nickLabel = [[UILabel alloc] init];
|
|
_nickLabel.font = [UIFont systemFontOfSize:15];
|
|
// _nickLabel.minimumScaleFactor = 0.7;
|
|
_nickLabel.lineBreakMode = NSLineBreakByTruncatingTail;
|
|
_nickLabel.textColor = [DJDKMIMOMColor userNickColor];
|
|
}
|
|
return _nickLabel;
|
|
}
|
|
|
|
- (UIImageView *)sexImageView {
|
|
if (!_sexImageView) {
|
|
_sexImageView = [[UIImageView alloc] init];
|
|
_sexImageView.userInteractionEnabled = YES;
|
|
}
|
|
return _sexImageView;
|
|
}
|
|
|
|
- (UIStackView *)tagStackView {
|
|
if (!_tagStackView) {
|
|
_tagStackView = [[UIStackView alloc] init];
|
|
_tagStackView.axis = UILayoutConstraintAxisHorizontal;
|
|
_tagStackView.distribution = UIStackViewDistributionFill;
|
|
_tagStackView.alignment = UIStackViewAlignmentCenter;
|
|
_tagStackView.spacing = 2;
|
|
}
|
|
return _tagStackView;
|
|
}
|
|
- (NetImageView *)experImageView {
|
|
if (!_experImageView) {
|
|
NetImageConfig * config = [[NetImageConfig alloc] init];
|
|
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
|
config.imageType = ImageTypeUserCardLevel;
|
|
_experImageView = [[NetImageView alloc] initWithConfig:config];
|
|
_experImageView.userInteractionEnabled = YES;
|
|
_experImageView.hidden = YES;
|
|
_experImageView.contentMode = UIViewContentModeScaleAspectFit;
|
|
}
|
|
return _experImageView;
|
|
}
|
|
|
|
- (NetImageView *)charmImageView {
|
|
if (!_charmImageView) {
|
|
NetImageConfig * config = [[NetImageConfig alloc] init];
|
|
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
|
config.imageType = ImageTypeUserCardLevel;
|
|
_charmImageView = [[NetImageView alloc] initWithConfig:config];
|
|
_charmImageView.userInteractionEnabled = YES;
|
|
_charmImageView.hidden = YES;
|
|
_charmImageView.contentMode = UIViewContentModeScaleAspectFit;
|
|
}
|
|
return _charmImageView;
|
|
}
|
|
|
|
- (NetImageView *)nobleIconImageView {
|
|
if (!_nobleIconImageView) {
|
|
NetImageConfig * config = [[NetImageConfig alloc] init];
|
|
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
|
config.imageType = ImageTypeUserCardLevel;
|
|
_nobleIconImageView = [[NetImageView alloc] initWithConfig:config];
|
|
_nobleIconImageView.contentMode = UIViewContentModeScaleAspectFit;
|
|
}
|
|
return _nobleIconImageView;
|
|
}
|
|
|
|
- (UIView *)namePlateView {
|
|
if (!_namePlateView) {
|
|
_namePlateView = [[UIView alloc] init];
|
|
_namePlateView.backgroundColor = [UIColor clearColor];
|
|
_namePlateView.hidden = YES;
|
|
}
|
|
return _namePlateView;
|
|
}
|
|
|
|
- (NetImageView *)nameplateImageView {
|
|
if (!_nameplateImageView) {
|
|
NetImageConfig * config = [[NetImageConfig alloc] init];
|
|
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
|
config.imageType = ImageTypeUserCardLevel;
|
|
_nameplateImageView = [[NetImageView alloc] initWithConfig:config];
|
|
_nameplateImageView.userInteractionEnabled = YES;
|
|
_nameplateImageView.contentMode = UIViewContentModeScaleAspectFit;
|
|
}
|
|
return _nameplateImageView;
|
|
}
|
|
|
|
- (NetImageView *)vipPlateImageView {
|
|
if (!_vipPlateImageView) {
|
|
NetImageConfig * config = [[NetImageConfig alloc] init];
|
|
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
|
config.imageType = ImageTypeUserCardLevel;
|
|
_vipPlateImageView = [[NetImageView alloc] initWithConfig:config];
|
|
_vipPlateImageView.userInteractionEnabled = YES;
|
|
_vipPlateImageView.contentMode = UIViewContentModeScaleAspectFit;
|
|
}
|
|
return _vipPlateImageView;
|
|
}
|
|
|
|
- (UILabel *)nameplateLabel {
|
|
if (!_nameplateLabel) {
|
|
_nameplateLabel = [[UILabel alloc] init];
|
|
_nameplateLabel.font = [UIFont systemFontOfSize:10];
|
|
_nameplateLabel.textAlignment = NSTextAlignmentCenter;
|
|
_nameplateLabel.textColor = [DJDKMIMOMColor userNickColor];
|
|
}
|
|
return _nameplateLabel;
|
|
}
|
|
|
|
- (UIImageView *)newUserImageView {
|
|
if (!_newUserImageView) {
|
|
_newUserImageView = [[UIImageView alloc] init];
|
|
_newUserImageView.userInteractionEnabled = YES;
|
|
_newUserImageView.image = [UIImage getLanguageImage:@"common_new_user"];
|
|
_newUserImageView.hidden = YES;
|
|
}
|
|
return _newUserImageView;
|
|
}
|
|
|
|
- (UIImageView *)officialImageView {
|
|
if (!_officialImageView) {
|
|
_officialImageView = [[UIImageView alloc] init];
|
|
_officialImageView.userInteractionEnabled = YES;
|
|
_officialImageView.image = [UIImage imageNamed:@"common_offical"];
|
|
_officialImageView.hidden = YES;
|
|
}
|
|
return _officialImageView;
|
|
}
|
|
|
|
- (UILabel *)idLabel {
|
|
if (!_idLabel) {
|
|
_idLabel = [[UILabel alloc] init];
|
|
_idLabel.font = [UIFont systemFontOfSize:10];
|
|
_idLabel.textColor = UIColorFromRGB(0x313131);
|
|
_idLabel.userInteractionEnabled = YES;
|
|
UITapGestureRecognizer *longPress = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(copyNameAction)];
|
|
|
|
[_idLabel addGestureRecognizer:longPress];
|
|
|
|
}
|
|
return _idLabel;
|
|
}
|
|
|
|
- (XPUserCardSkillCardView *)skillCardView {
|
|
if (!_skillCardView) {
|
|
_skillCardView = [[XPUserCardSkillCardView alloc] init];
|
|
}
|
|
return _skillCardView;
|
|
}
|
|
|
|
- (UICollectionView *)collectionView{
|
|
if (!_collectionView) {
|
|
MSBaseRTLFlowLayout *layout = [[MSBaseRTLFlowLayout alloc] init];
|
|
layout.itemSize = CGSizeMake((KScreenWidth - 45 * 2)/ 4, 55);
|
|
layout.minimumLineSpacing = 16;
|
|
layout.minimumInteritemSpacing = 0;
|
|
layout.sectionInset = UIEdgeInsetsMake(16, 0, 10, 0);
|
|
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
|
_collectionView.dataSource = self;
|
|
_collectionView.delegate = self;
|
|
_collectionView.hidden = YES;
|
|
_collectionView.backgroundColor = [UIColor clearColor];
|
|
[_collectionView registerClass:[XPUserCardItemCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPUserCardItemCollectionViewCell class])];
|
|
}
|
|
return _collectionView;
|
|
}
|
|
|
|
- (UIView *)sepLineView {
|
|
if (!_sepLineView) {
|
|
_sepLineView = [[UIView alloc] init];
|
|
_sepLineView.backgroundColor = [DJDKMIMOMColor userDividerColor];
|
|
_sepLineView.hidden = YES;
|
|
}
|
|
return _sepLineView;
|
|
}
|
|
|
|
- (UIStackView *)operaStackView {
|
|
if (!_operaStackView) {
|
|
_operaStackView = [[UIStackView alloc] init];
|
|
_operaStackView.axis = UILayoutConstraintAxisHorizontal;
|
|
_operaStackView.distribution = UIStackViewDistributionFillProportionally;
|
|
_operaStackView.alignment = UIStackViewAlignmentFill;
|
|
_operaStackView.spacing = 0;
|
|
_operaStackView.hidden = YES;
|
|
}
|
|
return _operaStackView;
|
|
}
|
|
|
|
- (SpriteSheetImageManager *)manager {
|
|
if (!_manager) {
|
|
_manager = [[SpriteSheetImageManager alloc] init];
|
|
}
|
|
return _manager;
|
|
}
|
|
|
|
- (YYAnimatedImageView *)headWearImageView {
|
|
if (!_headWearImageView) {
|
|
_headWearImageView = [[YYAnimatedImageView alloc] init];
|
|
_headWearImageView.backgroundColor = [UIColor clearColor];
|
|
_headWearImageView.contentMode = UIViewContentModeScaleAspectFit;
|
|
}
|
|
return _headWearImageView;
|
|
}
|
|
|
|
- (SVGAImageView *)headWearSVGAImageView {
|
|
if (!_headWearSVGAImageView) {
|
|
_headWearSVGAImageView = [[SVGAImageView alloc]init];
|
|
_headWearSVGAImageView.backgroundColor = [UIColor clearColor];
|
|
_headWearSVGAImageView.frame = CGRectZero;
|
|
_headWearSVGAImageView.userInteractionEnabled = NO;
|
|
_headWearSVGAImageView.autoPlay = YES;
|
|
}
|
|
return _headWearSVGAImageView;
|
|
}
|
|
|
|
- (UIView *)pickHeartView {
|
|
if (!_pickHeartView) {
|
|
_pickHeartView = [[UIView alloc] init];
|
|
_pickHeartView.backgroundColor = [UIColor clearColor];
|
|
_pickHeartView.hidden = YES;
|
|
}
|
|
return _pickHeartView;
|
|
}
|
|
|
|
- (UIButton *)pickHeartButton {
|
|
if (!_pickHeartButton) {
|
|
_pickHeartButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
[_pickHeartButton setTitle:YMLocalizedString(@"XPUserCardViewController23") forState:UIControlStateNormal];
|
|
[_pickHeartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
_pickHeartButton.titleLabel.font = [UIFont systemFontOfSize:13];
|
|
[_pickHeartButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFA7186), UIColorFromRGB(0xFA4972)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
|
_pickHeartButton.layer.masksToBounds = YES;
|
|
_pickHeartButton.layer.cornerRadius = 15;
|
|
[_pickHeartButton addTarget:self action:@selector(pickHeartButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
}
|
|
return _pickHeartButton;
|
|
}
|
|
|
|
- (VAPView *)vapView {
|
|
if (!_vapView) {
|
|
_vapView = [[VAPView alloc] init];
|
|
_vapView.contentMode = UIViewContentModeScaleAspectFill;
|
|
_vapView.userInteractionEnabled = NO;
|
|
}
|
|
return _vapView;
|
|
}
|
|
|
|
- (XPRoomGiftAnimationParser *)vapParser {
|
|
if (!_vapParser) {
|
|
_vapParser = [[XPRoomGiftAnimationParser alloc] init];
|
|
_vapView.userInteractionEnabled = NO;
|
|
}
|
|
return _vapParser;
|
|
}
|
|
|
|
- (UIButton *)copyIDButton {
|
|
if (!_copyIDButton) {
|
|
UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
[b setImage:kImage(@"user_card_copy") forState:UIControlStateNormal];
|
|
[b addTarget:self
|
|
action:@selector(copyNameAction)
|
|
forControlEvents:UIControlEventTouchUpInside];
|
|
_copyIDButton = b;
|
|
}
|
|
|
|
return _copyIDButton;
|
|
}
|
|
|
|
@end
|