修复bug
This commit is contained in:
@@ -44,13 +44,12 @@
|
||||
///P
|
||||
#import "MessagePresenter.h"
|
||||
#import "MessageProtocol.h"
|
||||
#import <SDCycleScrollView.h>
|
||||
#import "XPSessionMessageGameCell.h"
|
||||
#import "XPSessionMessageGamePageControl.h"
|
||||
#import "XPMinePlaceOrderView.h"
|
||||
|
||||
#import "XPSessionMessageGameInfoView.h"
|
||||
#import "XPMineNewRechargeViewController.h"
|
||||
@interface SessionViewController ()<MessageProtocol, UITableViewDelegate, UITableViewDataSource, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMMediaManagerDelegate, MessageCellDelegate, SessionToolbarViewDelegate, TZImagePickerControllerDelegate, SessionNavViewDelegate, SessionRiskViewDelegate,SDCycleScrollViewDelegate,XPSessionMessageGameCellDelegate,XPMinePlaceOrderViewDelegate,XPMineGameOrderDetailsViewDelegate>
|
||||
@interface SessionViewController ()<MessageProtocol, UITableViewDelegate, UITableViewDataSource, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMMediaManagerDelegate, MessageCellDelegate, SessionToolbarViewDelegate, TZImagePickerControllerDelegate, SessionNavViewDelegate, SessionRiskViewDelegate,XPSessionMessageGameCellDelegate,XPMinePlaceOrderViewDelegate,XPMineGameOrderDetailsViewDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,XPSessionMessageGameInfoViewDelegate>
|
||||
|
||||
@property (nonatomic, strong) NIMSession * session;
|
||||
@property (nonatomic, strong) NSMutableArray<NIMMessage *> * messages;
|
||||
@@ -66,8 +65,9 @@
|
||||
@property (nonatomic,strong) NIMMessage *lastMessage;
|
||||
///私聊风险提示
|
||||
@property (nonatomic,strong) SessionRiskView *riskAlertView;
|
||||
///轮播
|
||||
@property (nonatomic, strong) SDCycleScrollView *pi_BannerView;
|
||||
///游戏点单轮播
|
||||
@property(nonatomic,strong) UICollectionView *collectionView;
|
||||
|
||||
@property(nonatomic,strong) XPSessionMessageGamePageControl *pageControl;
|
||||
|
||||
@property (nonatomic, strong) UIStackView *stackView;
|
||||
@@ -106,15 +106,17 @@
|
||||
[super viewDidLoad];
|
||||
[self initViews];
|
||||
[self initLayout];
|
||||
|
||||
|
||||
[IQKeyboardManager sharedManager].enable = NO;
|
||||
[IQKeyboardManager sharedManager].enableAutoToolbar = NO;
|
||||
[self initHeaderAndFooterRrfresh];
|
||||
[[NIMSDK sharedSDK].chatManager addDelegate:self];
|
||||
[[NIMSDK sharedSDK].conversationManager addDelegate:self];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(getAttentionUserNotification) name:@"kAttentionUserNotification" object:nil];
|
||||
}
|
||||
-(void)getAttentionUserNotification{
|
||||
[self.presenter getChatLimitReceiverUid:self.session.sessionId];
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
[self.presenter getFansLike:self.session.sessionId];
|
||||
@@ -174,7 +176,7 @@
|
||||
[self.view addSubview:self.sessionTableView];
|
||||
[self.view addSubview:self.toolbarView];
|
||||
if (self.openType != SessionListOpenTypeRoom) {
|
||||
[self.stackView addArrangedSubview:self.pi_BannerView];
|
||||
[self.stackView addArrangedSubview:self.collectionView];
|
||||
[self.stackView addArrangedSubview:self.pageControl];
|
||||
}
|
||||
|
||||
@@ -189,7 +191,7 @@
|
||||
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self.view);
|
||||
make.top.equalTo(self.self.sessionNavView.mas_bottom);
|
||||
|
||||
|
||||
}];
|
||||
[self.riskAlertView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.view);
|
||||
@@ -206,15 +208,15 @@
|
||||
make.bottom.mas_equalTo(self.view);
|
||||
}];
|
||||
if (self.openType != SessionListOpenTypeRoom) {
|
||||
[self.pi_BannerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.view);
|
||||
make.height.mas_equalTo(kGetScaleWidth(76));
|
||||
}];
|
||||
[self.pageControl mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.view);
|
||||
make.height.mas_equalTo(kGetScaleWidth(4));
|
||||
}];
|
||||
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.view);
|
||||
make.height.mas_equalTo(kGetScaleWidth(76));
|
||||
}];
|
||||
[self.pageControl mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.view);
|
||||
make.height.mas_equalTo(kGetScaleWidth(4));
|
||||
}];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,7 +240,7 @@
|
||||
[self getUserWallet];
|
||||
}
|
||||
-(void)getUserWallet{
|
||||
|
||||
|
||||
[Api getUserWalletInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if(code == 200){
|
||||
WalletInfoModel * model = [WalletInfoModel modelWithDictionary:data.data];
|
||||
@@ -298,23 +300,24 @@
|
||||
gameInfo.tags = tagList;
|
||||
}
|
||||
self.gameArray = [NSMutableArray arrayWithArray:list];
|
||||
|
||||
if(self.isShowfollowInRoomView == YES){
|
||||
|
||||
if(self.isShowfollowInRoomView == YES && list.count == 0){
|
||||
UserGameInfoVo *gameModel = [UserGameInfoVo new];
|
||||
gameModel.gameName = @"跟随房间";
|
||||
[self.gameArray addObject:gameModel];
|
||||
[gameTextArray addObject:gameModel.gameName];
|
||||
self.collectionView.hidden = NO;
|
||||
[self.collectionView reloadData];
|
||||
return;
|
||||
}
|
||||
if(gameTextArray.count > 0){
|
||||
|
||||
self.pi_BannerView.hidden = NO;
|
||||
self.collectionView.hidden = NO;
|
||||
self.pageControl.hidden = NO;
|
||||
self.pi_BannerView.imageURLStringsGroup = gameTextArray;
|
||||
self.pageControl.pageList = gameTextArray;
|
||||
self.pageControl.curPage = 0;
|
||||
[self.pi_BannerView autoScroll];
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
- (void)onGetLimitChat:(ChatLimitModel *)chatLimit {
|
||||
BOOL chatDisabled ;
|
||||
@@ -330,6 +333,7 @@
|
||||
} else {
|
||||
self.sessionTableView.tableHeaderView = nil;
|
||||
}
|
||||
self.toolbarView.model = chatLimit.model;
|
||||
self.toolbarView.sendDisabled = chatDisabled;
|
||||
}
|
||||
|
||||
@@ -387,25 +391,75 @@
|
||||
[[self getKeyWindowNav] pushViewController:infoVC animated:YES];
|
||||
}
|
||||
}
|
||||
#pragma mark - SDCycleScrollViewDelegate
|
||||
- (Class)customCollectionViewCellClassForCycleScrollView:(SDCycleScrollView *)view {
|
||||
return XPSessionMessageGameCell.class;
|
||||
#pragma mark - UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.gameArray.count;
|
||||
}
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
|
||||
return CGSizeMake(KScreenWidth, kGetScaleWidth(76));;
|
||||
}
|
||||
|
||||
- (void)setupCustomCell:(UICollectionViewCell *)cell forIndex:(NSInteger)index cycleScrollView:(SDCycleScrollView *)view {
|
||||
XPSessionMessageGameCell *myCell = (XPSessionMessageGameCell *)cell;
|
||||
UserGameInfoVo *gameInfo = [self.gameArray safeObjectAtIndex1:index];
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section{
|
||||
UserGameInfoVo *gameInfo = [self.gameArray safeObjectAtIndex1:0];
|
||||
|
||||
if([gameInfo.gameName isEqualToString:@"跟随房间"]){
|
||||
return CGSizeMake(0, 0);
|
||||
}
|
||||
return CGSizeMake(kGetScaleWidth(102), kGetScaleWidth(76));
|
||||
}
|
||||
|
||||
-(UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
|
||||
|
||||
{
|
||||
|
||||
UICollectionReusableView *reusableView = nil;
|
||||
|
||||
UserGameInfoVo *gameInfo = [self.gameArray safeObjectAtIndex1:indexPath.row];
|
||||
|
||||
if([gameInfo.gameName isEqualToString:@"跟随房间"]){
|
||||
return reusableView;
|
||||
}
|
||||
|
||||
if (kind ==UICollectionElementKindSectionFooter){
|
||||
|
||||
XPSessionMessageGameInfoView *footerV = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:NSStringFromClass([XPSessionMessageGameInfoView class]) forIndexPath:indexPath];
|
||||
footerV.headUrl = self.userInfo.avatar;
|
||||
footerV.delegate = self;
|
||||
reusableView = footerV;
|
||||
|
||||
}
|
||||
|
||||
return reusableView;
|
||||
|
||||
}
|
||||
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
XPSessionMessageGameCell *myCell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPSessionMessageGameCell class]) forIndexPath:indexPath];
|
||||
UserGameInfoVo *gameInfo = [self.gameArray safeObjectAtIndex1:indexPath.row];
|
||||
if([gameInfo.gameName isEqualToString:@"跟随房间"]){
|
||||
myCell.userInfo = self.userInfo;
|
||||
}else{
|
||||
myCell.gameInfo = gameInfo;
|
||||
}
|
||||
myCell.delegate = self;
|
||||
|
||||
return myCell;
|
||||
}
|
||||
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
|
||||
if(self.collectionView == scrollView){
|
||||
CGFloat width = KScreenWidth - kGetScaleWidth(16);
|
||||
int x = (int)(scrollView.contentOffset.x / width);
|
||||
if(x < self.gameArray.count){
|
||||
self.pageControl.curPage = x;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didScrollToIndex:(NSInteger)index{
|
||||
self.pageControl.curPage = index;
|
||||
#pragma mark - XPSessionMessageGameInfoView
|
||||
- (void)clicTokMineUserInfo{
|
||||
XPMineUserInfoViewController * infoVC = [[XPMineUserInfoViewController alloc] init];
|
||||
infoVC.uid = self.userInfo.uid;
|
||||
[self.getKeyWindowNav pushViewController:infoVC animated:YES];
|
||||
}
|
||||
#pragma mark - SessionNavViewDelegate
|
||||
- (void)sessionNavView:(SessionNavView *)view didClickLike:(UIButton *)sender {
|
||||
@@ -461,7 +515,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -644,6 +698,11 @@
|
||||
orderVeiw.delegate = self;
|
||||
[self.view addSubview:orderVeiw];
|
||||
}
|
||||
- (void)xpSessionMessageGameCell:(XPSessionMessageGameCell *)cell chooseGame:(nonnull NSString *)uid{
|
||||
XPMineUserInfoViewController * infoVC = [[XPMineUserInfoViewController alloc] initWithChooseGame];
|
||||
infoVC.uid = self.userInfo.uid;
|
||||
[[self getKeyWindowNav] pushViewController:infoVC animated:YES];
|
||||
}
|
||||
#pragma mark - XPMinePlaceOrderViewDelegate
|
||||
///发起邀请
|
||||
-(void)initiateInvitationWithGameInfo:(UserGameInfoVo *)gameInfo count:(NSString *)count{
|
||||
@@ -657,7 +716,7 @@
|
||||
[self showErrorToast:msg];
|
||||
} gameId:gameInfo.gameId gameUid:gameInfo.uid inning:count uid:[AccountInfoStorage instance].getUid];
|
||||
|
||||
|
||||
|
||||
}
|
||||
///充值
|
||||
-(void)payHandleWithShowView:(BOOL)isShow{
|
||||
@@ -810,6 +869,7 @@
|
||||
if (!_toolbarView) {
|
||||
_toolbarView = [[SessionToolbarView alloc] init];
|
||||
_toolbarView.delegate = self;
|
||||
_toolbarView.sendDisabled = YES;
|
||||
}
|
||||
return _toolbarView;
|
||||
}
|
||||
@@ -829,18 +889,26 @@
|
||||
}
|
||||
return _riskAlertView;
|
||||
}
|
||||
- (SDCycleScrollView *)pi_BannerView {
|
||||
if (!_pi_BannerView) {
|
||||
_pi_BannerView = [[SDCycleScrollView alloc] init];
|
||||
_pi_BannerView.backgroundColor = [UIColor clearColor];
|
||||
_pi_BannerView.layer.masksToBounds = YES;
|
||||
_pi_BannerView.delegate = self;
|
||||
_pi_BannerView.showPageControl = NO;
|
||||
_pi_BannerView.autoScrollTimeInterval = 5;
|
||||
_pi_BannerView.hidden = YES;
|
||||
- (UICollectionView *)collectionView{
|
||||
if (!_collectionView) {
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
layout.minimumLineSpacing = 0;
|
||||
layout.minimumInteritemSpacing = 0;
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.delegate = self;
|
||||
_collectionView.pagingEnabled = YES;
|
||||
_collectionView.hidden = YES;
|
||||
_collectionView.backgroundColor = [UIColor clearColor];
|
||||
_collectionView.showsHorizontalScrollIndicator = NO;
|
||||
[_collectionView registerClass:[XPSessionMessageGameCell class] forCellWithReuseIdentifier:NSStringFromClass([XPSessionMessageGameCell class])];
|
||||
[_collectionView registerClass:[XPSessionMessageGameInfoView class] forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:NSStringFromClass([XPSessionMessageGameInfoView class])];
|
||||
}
|
||||
return _pi_BannerView;
|
||||
return _collectionView;
|
||||
}
|
||||
|
||||
- (XPSessionMessageGamePageControl *)pageControl{
|
||||
if(!_pageControl){
|
||||
_pageControl = [[XPSessionMessageGamePageControl alloc]initWithFrame:CGRectZero];
|
||||
|
Reference in New Issue
Block a user