2021-10-14 21:10:04 +08:00
|
|
|
//
|
|
|
|
// XPRoomActivityView.m
|
|
|
|
// xplan-ios
|
|
|
|
//
|
|
|
|
// Created by 冯硕 on 2021/10/12.
|
|
|
|
//
|
|
|
|
|
2021-10-18 19:10:13 +08:00
|
|
|
#import "XPRoomActivityContainerView.h"
|
2021-10-14 21:10:04 +08:00
|
|
|
///Third
|
|
|
|
#import <Masonry/Masonry.h>
|
|
|
|
#import <SDCycleScrollView/SDCycleScrollView.h>
|
2021-12-11 17:02:42 +08:00
|
|
|
///Tool
|
2022-01-06 18:16:05 +08:00
|
|
|
#import "AccountInfoStorage.h"
|
2021-12-14 15:53:47 +08:00
|
|
|
#import "Api+Room.h"
|
2021-12-11 17:02:42 +08:00
|
|
|
#import "ClientConfig.h"
|
|
|
|
#import "NetImageView.h"
|
2021-12-14 15:53:47 +08:00
|
|
|
#import "TTPopup.h"
|
2022-05-29 14:31:00 +08:00
|
|
|
#import "XCHUDTool.h"
|
2021-12-11 17:02:42 +08:00
|
|
|
///Model
|
|
|
|
#import "UserInfoModel.h"
|
|
|
|
#import "RoomInfoModel.h"
|
2021-12-14 15:53:47 +08:00
|
|
|
#import "ActivityInfoModel.h"
|
2021-12-24 18:01:30 +08:00
|
|
|
#import "AttachmentModel.h"
|
|
|
|
#import "FirstRechargeModel.h"
|
2021-12-09 20:58:54 +08:00
|
|
|
///View
|
2021-12-14 15:53:47 +08:00
|
|
|
#import "XPRoomHalfWebView.h"
|
2021-12-09 20:58:54 +08:00
|
|
|
#import "XPCandyTreeViewController.h"
|
2021-12-14 15:53:47 +08:00
|
|
|
#import "XPWebViewController.h"
|
|
|
|
#import "XPRoomViewController.h"
|
2021-12-24 16:36:17 +08:00
|
|
|
#import "XPFirstRechargeViewController.h"
|
2021-12-24 18:01:30 +08:00
|
|
|
#import "XPFirstRechargeSuccessView.h"
|
2022-01-06 18:16:05 +08:00
|
|
|
#import "XPArrangeMicViewController.h"
|
2022-08-12 18:58:10 +08:00
|
|
|
#import "XPSailingViewController.h"
|
2021-12-11 17:02:42 +08:00
|
|
|
|
2021-10-18 19:10:13 +08:00
|
|
|
@interface XPRoomActivityContainerView ()<SDCycleScrollViewDelegate>
|
2021-10-14 21:10:04 +08:00
|
|
|
///容器
|
|
|
|
@property (nonatomic,strong) UIStackView *stackView;
|
|
|
|
///轮播图
|
|
|
|
@property (nonatomic,strong) SDCycleScrollView *cycleScrollView;
|
|
|
|
///
|
|
|
|
@property (nonatomic,strong) UIView * placeHolderView;
|
2021-12-09 20:58:54 +08:00
|
|
|
///糖果树
|
2021-12-11 17:02:42 +08:00
|
|
|
@property (nonatomic,strong) NetImageView *candyTreeImageView;
|
2021-12-24 16:36:17 +08:00
|
|
|
///首充的
|
|
|
|
@property (nonatomic,strong) UIImageView *firstRechargeImageView;
|
2022-01-06 18:16:05 +08:00
|
|
|
///参加相亲
|
|
|
|
@property (nonatomic,strong) UIImageView *joinDatingView;
|
2021-12-09 20:58:54 +08:00
|
|
|
///host 代理
|
|
|
|
@property (nonatomic,weak) id<RoomHostDelegate>hostDelegate;
|
2021-12-14 15:53:47 +08:00
|
|
|
///房间活动的列表
|
2022-02-15 15:38:57 +08:00
|
|
|
@property (nonatomic,copy) NSMutableArray<ActivityInfoModel *> *activityList;
|
|
|
|
///活动的地址
|
|
|
|
@property (nonatomic,strong) NSMutableArray<NSString *> *imageUrlList;
|
2022-08-12 18:58:10 +08:00
|
|
|
///航海
|
|
|
|
@property (nonatomic,strong) UIImageView *sailingImageView;
|
2022-02-15 15:38:57 +08:00
|
|
|
///是否加载了活动
|
|
|
|
@property (nonatomic,assign) BOOL isLoadActivity;
|
2021-10-14 21:10:04 +08:00
|
|
|
@end
|
|
|
|
|
2021-10-18 19:10:13 +08:00
|
|
|
@implementation XPRoomActivityContainerView
|
2021-10-14 21:10:04 +08:00
|
|
|
|
2021-12-09 20:58:54 +08:00
|
|
|
- (instancetype)initWithdelegate:(id<RoomHostDelegate>)delegate {
|
|
|
|
self = [super init];
|
2021-10-14 21:10:04 +08:00
|
|
|
if (self) {
|
2021-12-09 20:58:54 +08:00
|
|
|
self.hostDelegate = delegate;
|
2021-10-14 21:10:04 +08:00
|
|
|
[self initSubViews];
|
|
|
|
[self initSubViewConstraints];
|
2021-12-14 15:53:47 +08:00
|
|
|
[self requestActivityList];
|
2021-12-11 17:02:42 +08:00
|
|
|
[self configCandyTree];
|
2021-10-14 21:10:04 +08:00
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - Private Method
|
|
|
|
- (void)initSubViews {
|
|
|
|
[self addSubview:self.stackView];
|
|
|
|
[self.stackView addArrangedSubview:self.cycleScrollView];
|
2022-01-06 18:16:05 +08:00
|
|
|
[self.stackView addArrangedSubview:self.placeHolderView];
|
2021-12-24 16:36:17 +08:00
|
|
|
[self.stackView addArrangedSubview:self.firstRechargeImageView];
|
2022-08-25 12:20:32 +08:00
|
|
|
[self.stackView addArrangedSubview:self.sailingImageView];
|
2021-12-09 20:58:54 +08:00
|
|
|
[self.stackView addArrangedSubview:self.candyTreeImageView];
|
2022-01-06 18:16:05 +08:00
|
|
|
[self.stackView addArrangedSubview:self.joinDatingView];
|
2021-10-14 21:10:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)initSubViewConstraints {
|
|
|
|
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.edges.mas_equalTo(self);
|
|
|
|
}];
|
|
|
|
|
|
|
|
[self.cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.size.mas_equalTo(CGSizeMake(65, 65));
|
|
|
|
}];
|
2022-08-12 18:58:10 +08:00
|
|
|
|
|
|
|
[self.sailingImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.size.mas_equalTo(CGSizeMake(65, 65));
|
|
|
|
}];
|
2021-12-09 20:58:54 +08:00
|
|
|
|
2021-12-24 16:36:17 +08:00
|
|
|
[self.firstRechargeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.size.mas_equalTo(CGSizeMake(65, 65));
|
|
|
|
}];
|
|
|
|
|
2021-12-09 20:58:54 +08:00
|
|
|
[self.candyTreeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.size.mas_equalTo(CGSizeMake(65, 65));
|
|
|
|
}];
|
2022-01-06 18:16:05 +08:00
|
|
|
|
|
|
|
[self.joinDatingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.height.mas_equalTo(35);
|
|
|
|
}];
|
|
|
|
|
2021-12-09 20:58:54 +08:00
|
|
|
}
|
|
|
|
|
2021-12-14 15:53:47 +08:00
|
|
|
- (void)requestActivityList {
|
|
|
|
NSString * roomId = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.roomId];
|
|
|
|
[Api roomActivityList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
2022-02-15 15:38:57 +08:00
|
|
|
self.isLoadActivity = YES;
|
2021-12-14 15:53:47 +08:00
|
|
|
if (code == 200) {
|
|
|
|
NSArray <ActivityInfoModel *>* array = [ActivityInfoModel modelsWithArray:data.data];
|
|
|
|
if (array.count <=0) return;
|
|
|
|
self.cycleScrollView.hidden = NO;
|
2022-02-15 15:38:57 +08:00
|
|
|
[self.activityList addObjectsFromArray:array];
|
2021-12-14 15:53:47 +08:00
|
|
|
NSMutableArray * picList = [NSMutableArray array];
|
|
|
|
[array enumerateObjectsUsingBlock:^(ActivityInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
|
if (obj.bannerPic.length > 0) {
|
|
|
|
[picList addObject:obj.bannerPic];
|
|
|
|
}
|
|
|
|
}];
|
2022-02-15 15:38:57 +08:00
|
|
|
self.imageUrlList = picList;
|
|
|
|
if (self.hostDelegate.getRoomInfo.type == RoomType_MiniGame) {
|
|
|
|
[self configLittleGameActivity];
|
2021-12-14 15:53:47 +08:00
|
|
|
} else {
|
2022-02-15 15:38:57 +08:00
|
|
|
self.cycleScrollView.imageURLStringsGroup = picList;
|
|
|
|
if (array.count > 1) {
|
|
|
|
[self.cycleScrollView setAutoScroll:YES];
|
|
|
|
self.cycleScrollView.autoScrollTimeInterval = 3;
|
|
|
|
} else {
|
|
|
|
[self.cycleScrollView setAutoScroll:NO];
|
|
|
|
}
|
2021-12-14 15:53:47 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} roomId:roomId type:@"2"];
|
|
|
|
}
|
|
|
|
|
2021-12-11 17:02:42 +08:00
|
|
|
- (void)configCandyTree {
|
|
|
|
UserInfoModel * userInfo = self.hostDelegate.getUserInfo;
|
|
|
|
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
|
|
|
|
if (userInfo.userLevelVo.experLevelSeq >= [ClientConfig shareConfig].openCandyTreeLimitLevel && [ClientConfig shareConfig].openCandyTree && roomInfo.boxSwitchVo.openBoxSwitch) {
|
|
|
|
self.candyTreeImageView.hidden = NO;
|
2022-08-05 18:08:26 +08:00
|
|
|
if (roomInfo.boxSwitchVo.openBoxIcon.length > 0) {
|
|
|
|
self.candyTreeImageView.imageUrl = roomInfo.boxSwitchVo.openBoxIcon;
|
|
|
|
} else {
|
|
|
|
self.candyTreeImageView.image = [UIImage imageNamed:@"openBoxIcon"];
|
|
|
|
}
|
2021-12-11 17:02:42 +08:00
|
|
|
} else {
|
|
|
|
self.candyTreeImageView.hidden = YES;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-15 15:38:57 +08:00
|
|
|
- (void)configLittleGameActivity {
|
|
|
|
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
|
|
|
|
UserInfoModel * userInfo = self.hostDelegate.getUserInfo;
|
|
|
|
BOOL hadContainCandy = NO;
|
|
|
|
for (ActivityInfoModel *activityInfo in self.activityList) {
|
|
|
|
if ([activityInfo.bannerName isEqualToString:@"糖果树"]) {
|
|
|
|
hadContainCandy = YES;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
///根据条件加入糖果树
|
|
|
|
if (userInfo.userLevelVo.experLevelSeq >= [ClientConfig shareConfig].openCandyTreeLimitLevel && [ClientConfig shareConfig].openCandyTree && roomInfo.boxSwitchVo.openBoxSwitch && !hadContainCandy) {
|
|
|
|
ActivityInfoModel * activityInfo = [[ActivityInfoModel alloc] init];
|
|
|
|
activityInfo.bannerPic = roomInfo.boxSwitchVo.openBoxIcon.length > 0 ? roomInfo.boxSwitchVo.openBoxIcon : @"openBoxIcon";
|
|
|
|
activityInfo.bannerName = @"糖果树";
|
|
|
|
[self.activityList insertObject:activityInfo atIndex:0];
|
|
|
|
[self.imageUrlList insertObject:activityInfo.bannerPic atIndex:0];
|
|
|
|
}
|
|
|
|
///是否包含首充
|
|
|
|
BOOL hadContainFirstRecharge = NO;
|
|
|
|
for (ActivityInfoModel *activityInfo in self.activityList) {
|
|
|
|
if ([activityInfo.bannerName isEqualToString:@"首充有礼"]) {
|
|
|
|
hadContainFirstRecharge = YES;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
///是否包含糖果树
|
|
|
|
BOOL hadContainCandy1 = NO;
|
|
|
|
for (ActivityInfoModel *activityInfo in self.activityList) {
|
|
|
|
if ([activityInfo.bannerName isEqualToString:@"糖果树"]) {
|
|
|
|
hadContainCandy1 = YES;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
///根据条件加入首充
|
|
|
|
if (userInfo.isFirstCharge && !hadContainFirstRecharge) {
|
|
|
|
ActivityInfoModel * activityInfo = [[ActivityInfoModel alloc] init];
|
|
|
|
activityInfo.bannerPic = @"room_first_recharge_enter";
|
|
|
|
activityInfo.bannerName = @"首充有礼";
|
|
|
|
if (hadContainCandy1) {
|
|
|
|
[self.activityList insertObject:activityInfo atIndex:0];
|
|
|
|
[self.imageUrlList insertObject:activityInfo.bannerPic atIndex:0];
|
|
|
|
} else {
|
|
|
|
[self.activityList insertObject:activityInfo atIndex:1];
|
|
|
|
[self.imageUrlList insertObject:activityInfo.bannerPic atIndex:1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (self.imageUrlList.count > 0) {
|
|
|
|
self.cycleScrollView.imageURLStringsGroup = self.imageUrlList;
|
|
|
|
[self.cycleScrollView setAutoScroll:YES];
|
|
|
|
self.cycleScrollView.autoScrollTimeInterval = 3;
|
|
|
|
}
|
2022-02-22 11:13:17 +08:00
|
|
|
}
|
|
|
|
|
2022-02-15 15:38:57 +08:00
|
|
|
- (void)dealRoomInfoChangeActivity {
|
|
|
|
__block ActivityInfoModel * firstRechargeActivity;
|
|
|
|
__block ActivityInfoModel * candyActivity;
|
|
|
|
[self.activityList enumerateObjectsUsingBlock:^(ActivityInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
|
if ([obj.bannerName isEqualToString:@"首充有礼"]) {
|
|
|
|
firstRechargeActivity = obj;
|
|
|
|
} else if([obj.bannerName isEqualToString:@"糖果树"]) {
|
|
|
|
candyActivity = obj;
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
|
|
|
|
if (firstRechargeActivity && [self.activityList containsObject:firstRechargeActivity]) {
|
|
|
|
NSInteger index = [self.activityList indexOfObject:firstRechargeActivity];
|
|
|
|
[self.imageUrlList removeObjectAtIndex:index];
|
|
|
|
[self.activityList removeObject:firstRechargeActivity];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (candyActivity && [self.activityList containsObject:candyActivity]) {
|
|
|
|
NSInteger index = [self.activityList indexOfObject:candyActivity];
|
|
|
|
[self.imageUrlList removeObjectAtIndex:index];
|
|
|
|
[self.activityList removeObject:candyActivity];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - RoomGuestDelegat
|
2021-12-11 17:02:42 +08:00
|
|
|
- (void)onRoomUpdate {
|
2022-01-06 18:16:05 +08:00
|
|
|
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
|
2022-02-15 15:38:57 +08:00
|
|
|
UserInfoModel * userInfo = self.hostDelegate.getUserInfo;
|
|
|
|
if (roomInfo.type == RoomType_MiniGame) {
|
|
|
|
self.firstRechargeImageView.hidden = YES;
|
|
|
|
self.candyTreeImageView.hidden = YES;
|
2022-08-19 17:42:14 +08:00
|
|
|
self.sailingImageView.hidden = YES;
|
2022-02-15 15:38:57 +08:00
|
|
|
if (self.isLoadActivity) {
|
|
|
|
[self configLittleGameActivity];
|
|
|
|
} else {
|
|
|
|
[self requestActivityList];
|
|
|
|
}
|
2022-01-06 18:16:05 +08:00
|
|
|
} else {
|
2022-02-15 15:38:57 +08:00
|
|
|
[self dealRoomInfoChangeActivity];
|
|
|
|
[self configCandyTree];
|
|
|
|
self.firstRechargeImageView.hidden = !userInfo.isFirstCharge;
|
2022-04-01 14:24:58 +08:00
|
|
|
if (roomInfo.roomModeType == RoomModeType_Open_Blind || roomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
|
|
|
if (roomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
|
|
|
self.joinDatingView.image = [UIImage imageNamed:@"room_pk_normal_member_enter"];
|
|
|
|
} else {
|
|
|
|
self.joinDatingView.image = [UIImage imageNamed:@"room_mode_dating_enter"];
|
|
|
|
}
|
2022-02-15 15:38:57 +08:00
|
|
|
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
|
|
|
request.roomId = [NSString stringWithFormat:@"%ld", roomInfo.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;
|
|
|
|
if (member.type == NIMTeamMemberTypeOwner || member.type == NIMTeamMemberTypeManager) {
|
|
|
|
self.joinDatingView.hidden = YES;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
self.joinDatingView.hidden = NO;
|
|
|
|
}];
|
|
|
|
} else {
|
|
|
|
self.joinDatingView.hidden = YES;
|
|
|
|
}
|
2022-08-19 17:42:14 +08:00
|
|
|
|
|
|
|
if ([ClientConfig shareConfig].configInfo.linearlyPoolOpenLevel <= self.hostDelegate.getUserInfo.userLevelVo.experLevelSeq) {
|
|
|
|
self.sailingImageView.hidden = NO;
|
|
|
|
} else {
|
|
|
|
self.sailingImageView.hidden = YES;
|
|
|
|
}
|
2022-01-06 18:16:05 +08:00
|
|
|
}
|
2021-12-11 17:02:42 +08:00
|
|
|
}
|
2021-12-24 18:01:30 +08:00
|
|
|
|
2022-02-15 15:38:57 +08:00
|
|
|
- (void)onRoomEntered {
|
|
|
|
[self onRoomUpdate];
|
|
|
|
}
|
|
|
|
|
2021-12-25 16:57:50 +08:00
|
|
|
- (void)handleNIMCustomMessage:(NIMMessage *)message {
|
|
|
|
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
|
|
|
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
|
|
|
|
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
|
|
|
if (attachment.first == CustomMessageType_First_Recharge_Reward && attachment.second == Custom_Message_Sub_Room_First_Recharge_Reward) {
|
|
|
|
FirstRechargeModel *model = [FirstRechargeModel modelWithJSON:attachment.data];
|
|
|
|
XPFirstRechargeSuccessView * firstRechargeView= [[XPFirstRechargeSuccessView alloc] init];
|
|
|
|
firstRechargeView.rechargeInfo = model;
|
|
|
|
[TTPopup popupView:firstRechargeView style:TTPopupStyleAlert];
|
|
|
|
}
|
2021-12-24 18:01:30 +08:00
|
|
|
}
|
|
|
|
}
|
2022-01-06 18:16:05 +08:00
|
|
|
|
|
|
|
- (void)handleNIMNotificationMessage:(NIMMessage *)message {
|
|
|
|
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
|
|
|
|
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
|
|
|
|
switch (content.eventType) {
|
|
|
|
case NIMChatroomEventTypeAddManager:
|
|
|
|
{
|
2022-04-01 14:24:58 +08:00
|
|
|
if (self.hostDelegate.getRoomInfo.roomModeType == RoomModeType_Open_Blind || self.hostDelegate.getRoomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
2022-01-06 18:16:05 +08:00
|
|
|
for (NIMChatroomNotificationMember * member in content.targets) {
|
|
|
|
if (member.userId.intValue == [AccountInfoStorage instance].getUid.integerValue) {
|
|
|
|
self.joinDatingView.hidden = YES;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NIMChatroomEventTypeRemoveManager:
|
|
|
|
{
|
2022-04-01 14:24:58 +08:00
|
|
|
if (self.hostDelegate.getRoomInfo.roomModeType == RoomModeType_Open_Blind || self.hostDelegate.getRoomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
2022-01-06 18:16:05 +08:00
|
|
|
for (NIMChatroomNotificationMember * member in content.targets) {
|
|
|
|
if (member.userId.intValue == [AccountInfoStorage instance].getUid.integerValue) {
|
|
|
|
self.joinDatingView.hidden = NO;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-14 15:53:47 +08:00
|
|
|
#pragma mark - SDCycleScrollViewDelegate
|
|
|
|
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
|
|
|
|
if (self.activityList.count > index) {
|
|
|
|
ActivityInfoModel * info = [self.activityList objectAtIndex:index];
|
2022-03-24 18:09:54 +08:00
|
|
|
if ([info.bannerName isEqualToString:@"糖果树"]) {
|
|
|
|
[self candyTreeTapRecognizer];
|
|
|
|
} else if([info.bannerName isEqualToString:@"首充有礼"]) {
|
|
|
|
[self firstRechargeTapRecognizer];
|
|
|
|
} else {
|
|
|
|
if (info.skipType == ActivitySkipType_Room) {
|
|
|
|
[self.hostDelegate exitRoom];
|
|
|
|
[XPRoomViewController openRoom:info.skipUri viewController:self.hostDelegate.getCurrentNav];
|
|
|
|
} else if(info.skipType == ActivitySkipType_Web) {
|
|
|
|
if (info.showType == ActivityShowType_Half) {
|
|
|
|
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
|
|
|
|
webView.roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
|
|
|
webView.url = info.skipUri;
|
|
|
|
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
XPWebViewController * webVC = [[XPWebViewController alloc] init];
|
|
|
|
webVC.roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
|
|
|
webVC.url = info.skipUri;
|
|
|
|
[self.hostDelegate.getCurrentNav pushViewController:webVC animated:YES];
|
2021-12-14 15:53:47 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-12-11 17:02:42 +08:00
|
|
|
|
2021-12-09 20:58:54 +08:00
|
|
|
#pragma mark - Event Response
|
|
|
|
- (void)candyTreeTapRecognizer {
|
2021-12-11 12:13:07 +08:00
|
|
|
XPCandyTreeViewController * candyTreeVC = [[XPCandyTreeViewController alloc] initWithDelegate:self.hostDelegate];
|
2021-12-09 20:58:54 +08:00
|
|
|
candyTreeVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
|
|
[self.hostDelegate.getCurrentNav presentViewController:candyTreeVC animated:YES completion:nil];
|
2021-10-14 21:10:04 +08:00
|
|
|
}
|
|
|
|
|
2021-12-24 16:36:17 +08:00
|
|
|
- (void)firstRechargeTapRecognizer {
|
|
|
|
XPFirstRechargeViewController * firstRechargeVC = [[XPFirstRechargeViewController alloc] initWithNavigation:self.hostDelegate.getCurrentNav];
|
|
|
|
[self.hostDelegate.getCurrentNav presentViewController:firstRechargeVC animated:YES completion:nil];
|
|
|
|
}
|
|
|
|
|
2022-01-06 18:16:05 +08:00
|
|
|
- (void)didTapJoinDatingRecognizer {
|
2022-05-29 14:31:00 +08:00
|
|
|
if (self.hostDelegate.getRoomInfo.roomModeType == RoomModeType_Open_PK_Mode && self.hostDelegate.isRoomPKPlaying) {
|
|
|
|
[XCHUDTool showErrorWithMessage:@"PK已开始暂时无法排麦"];
|
|
|
|
return;
|
|
|
|
}
|
2022-01-06 18:16:05 +08:00
|
|
|
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) {
|
|
|
|
NIMChatroomMember * member;
|
|
|
|
if (error == nil) {
|
|
|
|
member = members.firstObject;
|
|
|
|
}
|
|
|
|
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
|
|
|
|
XPArrangeMicInfoModel * info = [[XPArrangeMicInfoModel alloc] init];
|
|
|
|
info.roomUid = [NSString stringWithFormat:@"%ld", roomInfo.uid];
|
|
|
|
info.roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
|
|
|
|
info.nick = roomInfo.nick;
|
|
|
|
info.roomAvatar = roomInfo.avatar;
|
|
|
|
info.roomTitle = roomInfo.title;
|
|
|
|
info.micQueue = [self.hostDelegate getMicroQueue];
|
|
|
|
info.isManager = (member.type == NIMChatroomMemberTypeCreator || member.type == NIMChatroomMemberTypeManager);
|
2022-04-01 14:24:58 +08:00
|
|
|
info.type = roomInfo.roomModeType == RoomModeType_Open_Blind ? ArrangeMicType_Dating : roomInfo.roomModeType == RoomModeType_Open_PK_Mode ? ArrangeMicType_Room_PK : ArrangeMicType_Normal;
|
2022-01-06 18:16:05 +08:00
|
|
|
XPArrangeMicViewController * arrangeMicVC = [[XPArrangeMicViewController alloc] initWithInfo:info];
|
|
|
|
[self.hostDelegate.getCurrentNav presentViewController:arrangeMicVC animated:YES completion:nil];
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
2022-08-12 18:58:10 +08:00
|
|
|
- (void)sailTapRecognizer {
|
2022-08-19 17:42:14 +08:00
|
|
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
|
|
|
XPSailingViewController * sailingVC = [[XPSailingViewController alloc] initWithRoomUid:roomUid];
|
2022-08-12 18:58:10 +08:00
|
|
|
[self.hostDelegate.getCurrentNav presentViewController:sailingVC animated:YES completion:nil];
|
|
|
|
}
|
|
|
|
|
2021-10-14 21:10:04 +08:00
|
|
|
#pragma mark - Getters And Setters
|
|
|
|
- (SDCycleScrollView *)cycleScrollView {
|
|
|
|
if (!_cycleScrollView) {
|
|
|
|
_cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero delegate:self placeholderImage:nil];
|
|
|
|
_cycleScrollView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
|
|
|
|
_cycleScrollView.currentPageDotColor = [UIColor whiteColor];
|
|
|
|
_cycleScrollView.pageDotColor = [UIColor colorWithWhite:1 alpha:0.15];
|
|
|
|
_cycleScrollView.currentPageDotImage = [UIImage imageNamed:@"room_activity_banner_select"];
|
|
|
|
_cycleScrollView.pageDotImage = [UIImage imageNamed:@"room_activity_banner_normal"];
|
|
|
|
_cycleScrollView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.00];
|
|
|
|
_cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFit;
|
2021-12-24 18:01:30 +08:00
|
|
|
_cycleScrollView.pageControlBottomOffset = -10;
|
2021-12-09 20:58:54 +08:00
|
|
|
_cycleScrollView.hidden = YES;
|
2021-10-14 21:10:04 +08:00
|
|
|
}
|
|
|
|
return _cycleScrollView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UIView *)placeHolderView {
|
|
|
|
if (!_placeHolderView) {
|
|
|
|
_placeHolderView = [[UIView alloc] init];
|
|
|
|
_placeHolderView.backgroundColor = [UIColor clearColor];
|
|
|
|
[_placeHolderView setContentHuggingPriority:UILayoutPriorityDragThatCanResizeScene forAxis:UILayoutConstraintAxisHorizontal];
|
|
|
|
[_placeHolderView setContentCompressionResistancePriority:UILayoutPriorityFittingSizeLevel forAxis:UILayoutConstraintAxisHorizontal];
|
|
|
|
}
|
|
|
|
return _placeHolderView;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (UIStackView *)stackView {
|
|
|
|
if (!_stackView) {
|
|
|
|
_stackView = [[UIStackView alloc] init];
|
|
|
|
_stackView.axis = UILayoutConstraintAxisVertical;
|
|
|
|
_stackView.distribution = UIStackViewDistributionFill;
|
|
|
|
_stackView.alignment = UIStackViewAlignmentCenter;
|
2021-12-14 15:53:47 +08:00
|
|
|
_stackView.spacing = 5;
|
2021-10-14 21:10:04 +08:00
|
|
|
}
|
|
|
|
return _stackView;
|
|
|
|
}
|
|
|
|
|
2021-12-09 20:58:54 +08:00
|
|
|
- (UIImageView *)candyTreeImageView {
|
|
|
|
if (!_candyTreeImageView) {
|
2021-12-11 17:02:42 +08:00
|
|
|
NetImageConfig * config = [[NetImageConfig alloc] init];
|
|
|
|
config.placeHolder = [UIImage imageNamed:@"room_candy_tree_enter"];
|
|
|
|
config.imageType = ImageTypeUserIcon;
|
|
|
|
_candyTreeImageView = [[NetImageView alloc] initWithConfig:config];
|
2021-12-09 20:58:54 +08:00
|
|
|
_candyTreeImageView.userInteractionEnabled = YES;
|
2021-12-11 17:02:42 +08:00
|
|
|
_candyTreeImageView.hidden = YES;
|
2021-12-09 20:58:54 +08:00
|
|
|
_candyTreeImageView.image = [UIImage imageNamed:@"room_candy_tree_enter"];
|
|
|
|
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(candyTreeTapRecognizer)];
|
|
|
|
[_candyTreeImageView addGestureRecognizer:tap];
|
|
|
|
}
|
|
|
|
return _candyTreeImageView;
|
|
|
|
}
|
|
|
|
|
2021-12-24 16:36:17 +08:00
|
|
|
- (UIImageView *)firstRechargeImageView {
|
|
|
|
if (!_firstRechargeImageView) {
|
|
|
|
_firstRechargeImageView = [[UIImageView alloc] init];
|
|
|
|
_firstRechargeImageView.image = [UIImage imageNamed:@"room_first_recharge_enter"];
|
|
|
|
_firstRechargeImageView.userInteractionEnabled = YES;
|
|
|
|
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(firstRechargeTapRecognizer)];
|
|
|
|
[_firstRechargeImageView addGestureRecognizer:tap];
|
|
|
|
}
|
|
|
|
return _firstRechargeImageView;
|
|
|
|
}
|
|
|
|
|
2022-01-06 18:16:05 +08:00
|
|
|
- (UIImageView *)joinDatingView {
|
|
|
|
if (!_joinDatingView) {
|
|
|
|
_joinDatingView = [[UIImageView alloc] init];
|
|
|
|
_joinDatingView.image = [UIImage imageNamed:@"room_mode_dating_enter"];
|
|
|
|
_joinDatingView.userInteractionEnabled = YES;
|
|
|
|
_joinDatingView.hidden = YES;
|
|
|
|
_joinDatingView.contentMode = UIViewContentModeScaleAspectFit;
|
|
|
|
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapJoinDatingRecognizer)];
|
|
|
|
[_joinDatingView addGestureRecognizer:tap];
|
|
|
|
}
|
|
|
|
return _joinDatingView;
|
|
|
|
}
|
|
|
|
|
2022-02-15 15:38:57 +08:00
|
|
|
- (NSMutableArray<ActivityInfoModel *> *)activityList {
|
|
|
|
if (!_activityList) {
|
|
|
|
_activityList = [NSMutableArray array];
|
|
|
|
}
|
|
|
|
return _activityList;
|
|
|
|
}
|
|
|
|
|
2022-08-12 18:58:10 +08:00
|
|
|
- (UIImageView *)sailingImageView {
|
|
|
|
if (!_sailingImageView) {
|
|
|
|
_sailingImageView = [[UIImageView alloc] init];
|
2022-08-19 17:42:14 +08:00
|
|
|
_sailingImageView.image = [UIImage imageNamed:@"room_sailiing_enter"];
|
2022-08-12 18:58:10 +08:00
|
|
|
_sailingImageView.userInteractionEnabled = YES;
|
2022-08-19 19:07:43 +08:00
|
|
|
_sailingImageView.hidden = YES;
|
2022-08-12 18:58:10 +08:00
|
|
|
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(sailTapRecognizer)];
|
|
|
|
[_sailingImageView addGestureRecognizer:tap];
|
|
|
|
}
|
|
|
|
return _sailingImageView;
|
|
|
|
}
|
|
|
|
|
2021-10-14 21:10:04 +08:00
|
|
|
|
|
|
|
@end
|