Files
peko-ios/YuMi/Modules/YMRoom/View/RoomHeaderView/RoomHeaderView.m

592 lines
24 KiB
Mathematica
Raw Normal View History

2023-07-14 18:50:55 +08:00
//
2023-09-22 17:43:21 +08:00
// XPRoomInfoView.m
// xplan-ios
2023-07-14 18:50:55 +08:00
//
2023-09-22 17:43:21 +08:00
// Created by on 2021/10/11.
2023-07-14 18:50:55 +08:00
//
#import "RoomHeaderView.h"
///Third
#import <NIMSDK/NIMSDK.h>
#import <Masonry/Masonry.h>
2023-10-28 04:46:10 +08:00
2023-07-14 18:50:55 +08:00
#import "TTPopup.h"
#import <FFPopup/FFPopup.h>
2023-09-22 17:43:21 +08:00
#import "HttpRequestHelper.h"
2023-07-14 18:50:55 +08:00
///Tool
#import "UIImage+Utils.h"
#import "UIButton+EnlargeTouchArea.h"
#import "ThemeColor+Room.h"
#import "TTPopup.h"
#import "AccountInfoStorage.h"
#import "HttpRequestHelper.h"
#import "Api+Room.h"
#import "XCCurrentVCStackManager.h"
///Model
#import "RoomInfoModel.h"
#import "UserInfoModel.h"
#import "AttachMentModel.h"
#import "MicroQueueModel.h"
#import "XPRoomRecommendModel.h"
///View
#import "XPShareView.h"
#import "XPRoomTopicAlertView.h"
2023-07-14 18:50:55 +08:00
#import "XPRoomRecommendView.h"
///VC
#import "XPWebViewcontroller.h"
#import "XPRoomOnLineViewController.h"
#import "XPRoomViewController.h"
#import "XPRoomTypeSelectionViewController.h"
#import "XPRoomTopicViewController.h"
2023-07-14 18:50:55 +08:00
@interface RoomHeaderView ()<XCShareViewDelegate, XPRoomRecommendViewDelegate>
///
@property (nonatomic,strong) UIStackView *nickStackView;
///
@property (nonatomic,strong) UIStackView *titleStackView;
2024-05-21 14:17:30 +08:00
@property(nonatomic,strong) NetImageView *avatarView;
2023-07-14 18:50:55 +08:00
///
@property (nonatomic,strong) MarqueeLabel *titleLabel;
///
@property (nonatomic,strong) UIImageView *giftEffectImageView;
///
@property (nonatomic,strong) UIImageView *lockRoomImageView;
///
@property (nonatomic,strong) UIStackView *onlineStackView;
///id线
@property (nonatomic,strong) YYLabel *idLabel;
///
@property (nonatomic,strong) UIButton *collectButton;
2023-09-22 17:43:21 +08:00
///
@property (nonatomic,strong) UIButton *shareButton;
2023-07-14 18:50:55 +08:00
///
@property (nonatomic,strong) UIButton *settingButton;
///
@property (nonatomic, strong) UIButton *topicButton;
2023-09-22 17:43:21 +08:00
///
2023-07-14 18:50:55 +08:00
@property (nonatomic, weak) id<RoomHostDelegate> hostDelegate;
///
@property (nonatomic, strong) XPRoomRecommendView *recommendRoomView;
2023-09-22 17:43:21 +08:00
///
@property (nonatomic,strong) UIButton *backBtn;
2023-07-14 18:50:55 +08:00
///
@property (nonatomic, assign) BOOL hadShowCollectInScreen;
@end
@implementation RoomHeaderView
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
2023-09-22 17:43:21 +08:00
self = [super init];
if (self) {
2023-07-14 18:50:55 +08:00
_hostDelegate = delegate;
2023-09-22 17:43:21 +08:00
[self initSubViews];
[self initSubViewConstraints];
}
return self;
2023-07-14 18:50:55 +08:00
}
#pragma mark - Event Response
- (void)backButtonAction:(UIButton *)sender {
[self.hostDelegate miniRoom];
}
- (void)shareButtonAction:(UIButton *)sender{
2023-09-22 17:43:21 +08:00
[self showSharePanel];
2023-07-14 18:50:55 +08:00
}
- (void)settingButtonAction:(UIButton *)sender {
self.recommendRoomView.frame = CGRectMake(KScreenWidth, 0, 250, KScreenHeight);
FFPopup *popup = [FFPopup popupWithContentView:self.recommendRoomView];
2024-04-12 17:52:35 +08:00
popup.showType = isMSRTL() ? FFPopupShowType_SlideInFromLeft:FFPopupShowType_SlideInFromRight;
popup.dismissType = isMSRTL() ? FFPopupDismissType_SlideOutToLeft : FFPopupDismissType_SlideOutToRight;
2023-07-14 18:50:55 +08:00
popup.maskType = FFPopupMaskType_Dimmed;
popup.dimmedMaskAlpha = 0.0;
popup.shouldDismissOnBackgroundTouch = YES;
2024-04-12 17:52:35 +08:00
FFPopupHorizontalLayout horizontalLayout = isMSRTL() ? FFPopupHorizontalLayout_Left : FFPopupHorizontalLayout_Right;
2023-07-14 18:50:55 +08:00
FFPopupVerticalLayout verticalLayout = FFPopupVerticalLayout_Center;
[popup showWithLayout:FFPopupLayoutMake(horizontalLayout, verticalLayout) duration:0.0];
@kWeakify(self);
2023-07-14 18:50:55 +08:00
popup.didFinishDismissingBlock = ^{
@kStrongify(self);
2023-07-14 18:50:55 +08:00
[self.recommendRoomView removeFromSuperview];
};
popup.didFinishShowingBlock = ^{
};
[Api reqeustRecommendRoom:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
2023-07-14 18:50:55 +08:00
if (code == 200) {
NSArray *array = [XPRoomRecommendModel modelsWithArray:data.data];
self.recommendRoomView.roomList = [NSMutableArray arrayWithArray:array];
}
} roomId:[NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.roomId]];
}
- (void)topicButtonAction:(UIButton *)sender {
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
request.roomId = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.roomId];
request.userIds = @[[AccountInfoStorage instance].getUid];
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request
completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
if (error== nil) {
NIMChatroomMember* member = members.firstObject;
RoomInfoModel * roomInfo= self.hostDelegate.getRoomInfo;
if (member.type == NIMChatroomMemberTypeCreator || member.type == NIMChatroomMemberTypeManager) {
XPRoomTopicViewController * editTopicVC = [[XPRoomTopicViewController alloc] init];
editTopicVC.roomInfo = roomInfo;
[self.hostDelegate.getCurrentNav pushViewController:editTopicVC animated:YES];
} else {
TTPopupService * config = [[TTPopupService alloc] init];
XPRoomTopicAlertView * alertView = [[XPRoomTopicAlertView alloc] init];
alertView.title = roomInfo.roomDesc;
alertView.message = roomInfo.introduction;
config.contentView = alertView;
[TTPopup popupWithConfig:config];
}
}
}];
}
2024-05-21 14:17:30 +08:00
2023-07-14 18:50:55 +08:00
#pragma mark - Private Method
- (void)initSubViews {
2024-05-21 14:17:30 +08:00
[self addSubview:self.avatarView];
2023-09-22 17:43:21 +08:00
[self addSubview:self.nickStackView];
[self addSubview:self.collectButton];
2024-04-17 16:02:42 +08:00
2023-09-22 17:43:21 +08:00
[self addSubview:self.shareButton];
[self addSubview:self.settingButton];
[self addSubview:self.topicButton];
2023-09-22 17:43:21 +08:00
[self addSubview:self.backBtn];
[self.nickStackView addArrangedSubview:self.titleStackView];
[self.nickStackView addArrangedSubview:self.onlineStackView];
2024-05-21 14:17:30 +08:00
2023-09-22 17:43:21 +08:00
[self.onlineStackView addArrangedSubview:self.idLabel];
[self.titleStackView addArrangedSubview:self.titleLabel];
[self.titleStackView addArrangedSubview:self.giftEffectImageView];
[self.titleStackView addArrangedSubview:self.lockRoomImageView];
2023-07-14 18:50:55 +08:00
}
- (void)initSubViewConstraints {
2023-09-22 17:43:21 +08:00
//
[self.settingButton mas_makeConstraints:^(MASConstraintMaker *make) {
2024-04-11 17:05:27 +08:00
make.trailing.mas_equalTo(-15);
2023-09-22 17:43:21 +08:00
make.bottom.mas_equalTo(-11);
make.width.height.mas_equalTo(22);
}];
[self.topicButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.mas_equalTo(-45);
make.bottom.mas_equalTo(-11);
make.width.height.mas_equalTo(22);
}];
2023-09-22 17:43:21 +08:00
[self.shareButton mas_makeConstraints:^(MASConstraintMaker *make) {
2024-04-11 17:05:27 +08:00
make.trailing.equalTo(self.settingButton.mas_leading).offset(-15);
2023-07-14 18:50:55 +08:00
make.centerY.mas_equalTo(self.settingButton);
2023-09-22 17:43:21 +08:00
make.width.height.mas_equalTo(22);
2023-07-14 18:50:55 +08:00
}];
2024-04-18 18:37:21 +08:00
2023-09-22 17:43:21 +08:00
[self.collectButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.settingButton);
2024-05-21 14:17:30 +08:00
make.leading.equalTo(self.titleStackView.mas_trailing).mas_offset(5);
2024-04-17 16:02:42 +08:00
make.size.mas_equalTo(CGSizeMake(20, 20));
2023-09-22 17:43:21 +08:00
}];
2024-04-17 16:02:42 +08:00
2024-05-21 14:17:30 +08:00
[self.avatarView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self).offset(35);
make.width.height.mas_equalTo(31);
make.centerY.mas_equalTo(self.settingButton);
}];
2023-09-22 17:43:21 +08:00
[self.nickStackView mas_makeConstraints:^(MASConstraintMaker *make) {
2023-07-14 18:50:55 +08:00
make.centerY.mas_equalTo(self.settingButton);
2024-05-21 14:17:30 +08:00
make.leading.equalTo(self.avatarView.mas_trailing).mas_offset(6);
}];
[self.titleStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_greaterThanOrEqualTo(50);
2023-09-22 17:43:21 +08:00
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_lessThanOrEqualTo(100);
2024-05-21 14:17:30 +08:00
make.height.mas_equalTo(12);
2023-09-22 17:43:21 +08:00
}];
2024-05-21 14:17:30 +08:00
2023-07-14 18:50:55 +08:00
[self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) {
2024-05-21 14:17:30 +08:00
make.height.mas_equalTo(7);
2023-07-14 18:50:55 +08:00
}];
2023-09-22 17:43:21 +08:00
[self.giftEffectImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(10,10));
}];
[self.lockRoomImageView mas_makeConstraints:^(MASConstraintMaker *make) {
2024-05-21 14:17:30 +08:00
make.size.mas_equalTo(CGSizeMake(20,20));
2023-09-22 17:43:21 +08:00
}];
[self.backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(15);
make.height.width.mas_equalTo(20);
make.centerY.mas_equalTo(self.settingButton);
2023-09-22 17:43:21 +08:00
}];
2023-07-14 18:50:55 +08:00
}
#pragma mark - RoomGuestDelegate
- (void)onRoomEntered {
2023-09-22 17:43:21 +08:00
RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo;
2024-05-21 14:17:30 +08:00
self.idLabel.text = [NSString stringWithFormat:@"ID%ld",(long)roomInfo.erbanNo];
self.avatarView.imageUrl = roomInfo.avatar;
2023-09-22 17:43:21 +08:00
if (roomInfo) {
self.titleLabel.text = roomInfo.title;
self.giftEffectImageView.hidden = roomInfo.hasAnimationEffect;
if (roomInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {
self.collectButton.hidden = YES;
} else {
2024-04-17 16:02:42 +08:00
self.collectButton.hidden = NO;
self.collectButton.selected = roomInfo.isRoomFans;
2023-09-22 17:43:21 +08:00
}
self.lockRoomImageView.hidden = roomInfo.roomPwd.length <= 0;
}
// self.topicButton.hidden = roomInfo.type == RoomType_Anchor;
2023-07-14 18:50:55 +08:00
}
- (void)onRoomUpdate {
2023-09-22 17:43:21 +08:00
RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo;
self.titleLabel.text = roomInfo.title;
2024-05-21 14:17:30 +08:00
self.avatarView.imageUrl = roomInfo.avatar;
self.idLabel.text = [NSString stringWithFormat:@"ID%ld",(long)roomInfo.erbanNo];
2023-09-22 17:43:21 +08:00
self.giftEffectImageView.hidden = roomInfo.hasAnimationEffect;
if (roomInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {
self.collectButton.hidden = YES;
} else {
2024-04-17 16:02:42 +08:00
self.collectButton.hidden = NO;
// self.collectButton.selected = roomInfo.isRoomFans;
2023-09-22 17:43:21 +08:00
}
self.lockRoomImageView.hidden = roomInfo.roomPwd.length <= 0;
self.topicButton.hidden = roomInfo.type == RoomType_Anchor;
2023-07-14 18:50:55 +08:00
}
#pragma mark - Event Response
- (void)showSharePanel {
2023-09-22 17:43:21 +08:00
XPShareItem *cycle = [XPShareItem itemWitTag:XPShareItemTagFaceBook title:@"FaceBook" imageName:@"share_fb" disableImageName:@"share_fb"];
XPShareItem *wechat = [XPShareItem itemWitTag:XPShareItemTagLine title:@"Line" imageName:@"share_line" disableImageName:@"share_line"];
XPShareItem *qq = [XPShareItem itemWitTag:XPShareItemTagCopyLink title:YMLocalizedString(@"RoomHeaderView3") imageName:@"share_copy_link" disableImageName:@"share_copy_link"];
NSArray * items = @[wechat,cycle, qq];
RoomInfoModel * roomInfo = [self.hostDelegate getRoomInfo];
XPShareInfoModel * shareInfo = [[XPShareInfoModel alloc] init];
shareInfo.shareTitle = YMLocalizedString(@"RoomHeaderView4");
shareInfo.shareContent = YMLocalizedString(@"RoomHeaderView5");
shareInfo.shareImageUrl = [self.hostDelegate getRoomInfo].avatar;
shareInfo.type = ShareType_Room;
shareInfo.roomUid = roomInfo.uid;
NSString * uid = [AccountInfoStorage instance].getUid;
2023-11-09 15:26:14 +08:00
NSString * urlString = [NSString stringWithFormat:@"%@/%@?shareUid=%@&uid=%ld&room_name=%@&room_id=%ld&room_avatar=%@&share_name=%@",[HttpRequestHelper getHostUrl],URLWithType(kShareRoomURL),uid,roomInfo.uid,roomInfo.title,roomInfo.erbanNo,roomInfo.avatar,roomInfo.nick];
2023-09-26 17:57:39 +08:00
2023-09-22 17:43:21 +08:00
shareInfo.shareUrl = urlString;
CGFloat margin = 15;
CGSize itemSize = CGSizeMake((KScreenWidth-2*margin)/4, 65);
XPShareView *shareView = [[XPShareView alloc] initWithItems:items itemSize:itemSize shareInfo:shareInfo];
shareView.delegate = self;
[TTPopup popupView:shareView style:TTPopupStyleActionSheet];
2023-07-14 18:50:55 +08:00
}
///
- (void)saveShare:(XPShareInfoModel *)shareInfo {
2023-09-22 17:43:21 +08:00
NSMutableDictionary *params = [NSMutableDictionary dictionary];
NSString *uid = [AccountInfoStorage instance].getUid;
NSString *ticket = [AccountInfoStorage instance].getTicket;
[params setObject:uid forKey:@"uid"];
[params setObject:@(shareInfo.shareType) forKey:@"shareType"];
[params setObject:ticket forKey:@"ticket"];
[params setObject:@(shareInfo.type) forKey:@"sharePageId"];
if (shareInfo.shareUrl.length > 0) {
[params setObject:shareInfo.shareUrl forKey:@"shareUrl"];
}
if (shareInfo.roomUid > 0) {
[params setObject:@(shareInfo.roomUid) forKey:@"targetUid"];
}
[HttpRequestHelper POST:@"usershare/save" params:params success:^(BaseModel * _Nonnull data) {
2023-10-27 16:17:05 +08:00
NSLog(@"%@",data);
2023-09-22 17:43:21 +08:00
} failure:^(NSInteger resCode, NSString * _Nonnull message) {
}];
2023-07-14 18:50:55 +08:00
}
- (void)collectButtonAction:(UIButton *)sender {
2023-09-22 17:43:21 +08:00
2024-04-17 16:02:42 +08:00
NSString * type = self.collectButton.selected ? @"2" : @"1";
2023-09-22 17:43:21 +08:00
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
@kWeakify(self);
2023-09-22 17:43:21 +08:00
[Api collectRoom:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
2023-09-22 17:43:21 +08:00
if (code == 200) {
2024-04-17 16:02:42 +08:00
self.collectButton.selected = !self.collectButton.selected;
2023-09-22 17:43:21 +08:00
if ([type isEqualToString:@"1"]) {///
[XNDJTDDLoadingTool showSuccessWithMessage:YMLocalizedString(@"RoomHeaderView6")];
2023-07-14 18:50:55 +08:00
if (self.hadShowCollectInScreen) {
return;
}
self.hadShowCollectInScreen = YES;
2023-09-22 17:43:21 +08:00
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
[dic setValue:[AccountInfoStorage instance].getUid forKey:@"uid"];
[dic setValue:self.hostDelegate.getUserInfo.nick forKey:@"nick"];
[dic setValue:[NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid] forKey:@"targetUid"];
[dic setValue:self.hostDelegate.getRoomInfo.nick forKey:@"targetNick"];
NSDictionary * data = @{@"data":dic};
AttachmentModel *attachment = [[AttachmentModel alloc]init];
attachment.first = CustomMessageType_Collection_Room;
attachment.second = Custom_Message_Sub_Collect_Room_Tips;
attachment.data = data;
NIMMessage *message = [[NIMMessage alloc]init];
NIMCustomObject *object = [[NIMCustomObject alloc] init];
object.attachment = attachment;
message.messageObject = object;
NSString *sessionId = [NSString stringWithFormat:@"%ld",self.hostDelegate.getRoomInfo.roomId];
//
NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom];
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
}
} else {
[XNDJTDDLoadingTool showErrorWithMessage:msg];
}
2024-05-21 14:17:30 +08:00
} roomUid:roomUid uid:uid type:type roomUids:nil];
2023-07-14 18:50:55 +08:00
}
#pragma mark - XCShareViewDelegate
- (void)shareView:(XPShareView *)shareView shareFail:(NSString *)message {
2023-09-22 17:43:21 +08:00
[TTPopup dismiss];
[XNDJTDDLoadingTool showErrorWithMessage:message];
2023-07-14 18:50:55 +08:00
}
- (void)shareView:(XPShareView *)shareView didSuccess:(XPShareInfoModel *)shareInfo{
2023-09-22 17:43:21 +08:00
[TTPopup dismiss];
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"RoomHeaderView7")];
AttachmentModel * attachMent = [[AttachmentModel alloc] init];
attachMent.first = CustomMessageType_Room_Tip;
attachMent.second = Custom_Message_Sub_Room_Tip_ShareRoom;
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
NSString * uid = [AccountInfoStorage instance].getUid;
[dic setValue:uid forKey:@"uid"];
NSMutableDictionary * userDic = [NSMutableDictionary dictionary];
UserInfoModel * userInfo = [self.hostDelegate getUserInfo];
RoomInfoModel * roomInfo = [self.hostDelegate getRoomInfo];
[userDic setValue:roomInfo.nick.length > 0 ? roomInfo.nick : @"" forKey:@"targetNick"];
[userDic setValue:@(roomInfo.uid) forKey:@"targetUid"];
[userDic setValue:userInfo.nick.length > 0 ? userInfo.nick : @"" forKey:@"nick"];
[dic setValue:userDic forKey:@"data"];
attachMent.data = dic;
NSString *sessionID = [NSString stringWithFormat:@"%ld", [self.hostDelegate getRoomInfo].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];
///
[self saveShare:shareInfo];
2023-07-14 18:50:55 +08:00
}
- (void)shareViewDidClickCancel:(XPShareView *)shareView {
2023-09-22 17:43:21 +08:00
[TTPopup dismiss];
2023-07-14 18:50:55 +08:00
}
#pragma mark - XPRoomRecommendViewDelegate
- (void)xPRoomRecommendViewReport {
2023-09-22 17:43:21 +08:00
TTActionSheetConfig *action = [TTActionSheetConfig normalTitle:YMLocalizedString(@"RoomHeaderView10") clickAction:^{
[FFPopup dismissPopupForView:self.recommendRoomView animated:NO];
[self.hostDelegate requesstShieldingAction];
}];
TTActionSheetConfig *action1 = [TTActionSheetConfig normalTitle:YMLocalizedString(@"RoomHeaderView12") clickAction:^{
[FFPopup dismissPopupForView:self.recommendRoomView animated:NO];
XPWebViewController * webVC = [[XPWebViewController alloc] init];
NSString *urlstr = [NSString stringWithFormat:@"%@?reportUid=%ld&source=ROOM", URLWithType(kReportRoomURL),self.hostDelegate.getRoomInfo.uid];
webVC.url = urlstr;
[[self.hostDelegate getCurrentNav] pushViewController:webVC animated:YES];
}];
[TTPopup actionSheetWithItems:@[action,action1]];
2023-07-14 18:50:55 +08:00
}
- (void)xPRoomRecommendViewMiniRoom {
[FFPopup dismissPopupForView:self.recommendRoomView animated:NO];
[self.hostDelegate miniRoom];
}
- (void)xPRoomRecommendViewExitRoom {
[FFPopup dismissPopupForView:self.recommendRoomView animated:NO];
[self.hostDelegate exitRoom];
}
- (void)xPRoomRecommendViewJumpToRoom:(NSString *)roomUid {
[FFPopup dismissPopupForView:self.recommendRoomView animated:NO];
[self.hostDelegate exitRoom];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[XPRoomViewController openRoom:roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
});
}
#pragma mark - Getters And Setters
2023-09-22 17:43:21 +08:00
- (UIButton *)shareButton {
if(!_shareButton){
_shareButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_shareButton setImage:[UIImage imageNamed:@"room_info_share"] forState:UIControlStateNormal];
[_shareButton addTarget:self action:@selector(shareButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[_shareButton setEnlargeEdgeWithTop:8 right:8 bottom:8 left:8];
2024-04-17 16:02:42 +08:00
_shareButton.hidden = YES;
2023-07-14 18:50:55 +08:00
}
2023-09-22 17:43:21 +08:00
return _shareButton;
2023-07-14 18:50:55 +08:00
}
- (UIButton *)settingButton {
2023-09-22 17:43:21 +08:00
if (!_settingButton) {
_settingButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_settingButton setImage:[UIImage imageNamed:@"room_info_setting"] forState:UIControlStateNormal];
[_settingButton addTarget:self action:@selector(settingButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[_settingButton setEnlargeEdgeWithTop:8 right:8 bottom:8 left:8];
}
return _settingButton;
2023-07-14 18:50:55 +08:00
}
- (UIButton *)topicButton {
if (!_topicButton) {
_topicButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_topicButton setImage:[UIImage imageNamed:@"room_header_topic_icon"] forState:UIControlStateNormal];
[_topicButton addTarget:self action:@selector(topicButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[_topicButton setEnlargeEdgeWithTop:8 right:8 bottom:8 left:8];
}
return _topicButton;
}
2023-07-14 18:50:55 +08:00
- (UIButton *)collectButton {
2023-09-22 17:43:21 +08:00
if (!_collectButton) {
_collectButton = [UIButton buttonWithType:UIButtonTypeCustom];
2024-04-17 16:02:42 +08:00
[_collectButton setImage:kImage(@"ms_room_top_no_collect") forState:UIControlStateNormal];
[_collectButton setImage:kImage(@"ms_room_top_collect") forState:UIControlStateSelected];
2023-09-22 17:43:21 +08:00
_collectButton.hidden = YES;
2024-04-17 16:02:42 +08:00
[_collectButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
2023-09-22 17:43:21 +08:00
[_collectButton addTarget:self action:@selector(collectButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _collectButton;
}
2024-04-17 16:02:42 +08:00
2023-07-14 18:50:55 +08:00
- (UIStackView *)nickStackView {
2023-09-22 17:43:21 +08:00
if (!_nickStackView) {
_nickStackView = [[UIStackView alloc] init];
_nickStackView.axis = UILayoutConstraintAxisVertical;
_nickStackView.distribution = UIStackViewDistributionFill;
_nickStackView.alignment = UIStackViewAlignmentLeading;
2024-05-21 14:17:30 +08:00
_nickStackView.spacing = 4;
2023-09-22 17:43:21 +08:00
}
return _nickStackView;
2023-07-14 18:50:55 +08:00
}
- (UIStackView *)titleStackView {
2023-09-22 17:43:21 +08:00
if (!_titleStackView) {
_titleStackView = [[UIStackView alloc] init];
_titleStackView.axis = UILayoutConstraintAxisHorizontal;
_titleStackView.distribution = UIStackViewDistributionFill;
_titleStackView.alignment = UIStackViewAlignmentCenter;
_titleStackView.spacing = 5;
}
return _titleStackView;
2023-07-14 18:50:55 +08:00
}
- (MarqueeLabel *)titleLabel{
2023-09-22 17:43:21 +08:00
if (!_titleLabel) {
_titleLabel = [[MarqueeLabel alloc] init];
_titleLabel.scrollDuration = 8.0;
_titleLabel.fadeLength = 6.0f;
2024-05-21 14:17:30 +08:00
_titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightBold];
_titleLabel.textColor = UIColorFromRGB(0xEFEBF3);
2023-07-14 18:50:55 +08:00
_titleLabel.userInteractionEnabled = YES;
2023-09-22 17:43:21 +08:00
}
return _titleLabel;
2023-07-14 18:50:55 +08:00
}
- (UIImageView *)giftEffectImageView {
2023-09-22 17:43:21 +08:00
if (!_giftEffectImageView) {
_giftEffectImageView = [[UIImageView alloc] init];
_giftEffectImageView.userInteractionEnabled = YES;
_giftEffectImageView.image = [UIImage imageNamed:@"room_info_gift_effect"];
2024-05-21 14:17:30 +08:00
_giftEffectImageView.hidden = YES;
2023-09-22 17:43:21 +08:00
}
return _giftEffectImageView;
2023-07-14 18:50:55 +08:00
}
- (UIImageView *)lockRoomImageView {
2023-09-22 17:43:21 +08:00
if (!_lockRoomImageView) {
_lockRoomImageView = [[UIImageView alloc] init];
_lockRoomImageView.userInteractionEnabled = YES;
_lockRoomImageView.image = [UIImage imageNamed:@"room_info_lock_room"];
_lockRoomImageView.hidden = YES;
}
return _lockRoomImageView;
2023-07-14 18:50:55 +08:00
}
- (UIStackView *)onlineStackView {
2023-09-22 17:43:21 +08:00
if (!_onlineStackView) {
_onlineStackView = [[UIStackView alloc] init];
_onlineStackView.axis = UILayoutConstraintAxisHorizontal;
_onlineStackView.distribution = UIStackViewDistributionFill;
_onlineStackView.alignment = UIStackViewAlignmentCenter;
_onlineStackView.spacing = 2;
2024-05-21 14:17:30 +08:00
2023-09-22 17:43:21 +08:00
}
return _onlineStackView;
2023-07-14 18:50:55 +08:00
}
2024-05-21 14:17:30 +08:00
2023-07-14 18:50:55 +08:00
- (YYLabel *)idLabel {
2023-09-22 17:43:21 +08:00
if (!_idLabel) {
_idLabel = [[YYLabel alloc] init];
2024-05-21 14:17:30 +08:00
_idLabel.textColor = [UIColor whiteColor];
_idLabel.font = [UIFont systemFontOfSize:9 weight:UIFontWeightBold];
2023-09-22 17:43:21 +08:00
}
return _idLabel;
2023-07-14 18:50:55 +08:00
}
- (XPRoomRecommendView *)recommendRoomView {
if (!_recommendRoomView) {
_recommendRoomView = [[XPRoomRecommendView alloc] init];
self.recommendRoomView.delegate = self;
}
return _recommendRoomView;
}
2023-09-22 17:43:21 +08:00
- (UIButton *)backBtn{
if (!_backBtn){
_backBtn = [UIButton new];
[_backBtn setBackgroundImage:[[UIImage imageNamed:@"common_nav_back_white"] ms_SetImageForRTL] forState:UIControlStateNormal];
2023-09-22 17:43:21 +08:00
[_backBtn addTarget:self action:@selector(backButtonAction:) forControlEvents:UIControlEventTouchUpInside];
// [_backBtn setCornerWithLeftTopCorner:10 rightTopCorner:10 bottomLeftCorner:10 bottomRightCorner:10 size:CGSizeMake(20,20)];
[_backBtn setEnlargeEdgeWithTop:5 right:5 bottom:5 left:5];
2023-09-22 17:43:21 +08:00
}
return _backBtn;
}
2024-05-21 14:17:30 +08:00
- (NetImageView *)avatarView{
if(!_avatarView){
NetImageConfig *config = [NetImageConfig new];
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_avatarView = [[NetImageView alloc]initWithConfig:config];
_avatarView.layer.cornerRadius = 31/2;
_avatarView.layer.masksToBounds = YES;
_avatarView.layer.borderWidth = 1;
_avatarView.layer.borderColor = [UIColor whiteColor].CGColor;
}
return _avatarView;
}
2023-07-14 18:50:55 +08:00
@end