聊天大厅接口对接
This commit is contained in:
@@ -15,8 +15,12 @@
|
||||
#import "SessionListViewController.h"
|
||||
#import "XPMineFriendViewController.h"
|
||||
#import "XPMineFansViewController.h"
|
||||
|
||||
@interface XPSessionMainViewController ()<JXCategoryViewDelegate,JXPagerViewDelegate,JXPagerMainTableViewGestureDelegate>
|
||||
#import "MSSessionScrollingView.h"
|
||||
#import "MSSessionScrollingItemView.h"
|
||||
#import "MessagePresenter.h"
|
||||
#import "MessageProtocol.h"
|
||||
#import "MSSessionPublicChatHallVC.h"
|
||||
@interface XPSessionMainViewController ()<JXCategoryViewDelegate,JXPagerViewDelegate,JXPagerMainTableViewGestureDelegate,MSSessionScrollingViewDelegate>
|
||||
@property (nonatomic, strong) JXCategoryTitleView *titleView;
|
||||
@property (nonatomic, strong) JXCategoryIndicatorImageView *lineView;
|
||||
@property (nonatomic, strong) JXPagerView *pagingView;
|
||||
@@ -33,16 +37,23 @@
|
||||
@property (nonatomic,strong) XPMineFansViewController *fansVC;
|
||||
///清除已读
|
||||
@property (nonatomic,strong) UIButton * allCleanBtn;
|
||||
|
||||
@property(nonatomic,strong) MSSessionScrollingView *scrollingView;
|
||||
@property(nonatomic,strong) UIImageView *bgImageView;
|
||||
@property(nonatomic,strong) UILabel *textView;
|
||||
@end
|
||||
|
||||
@implementation XPSessionMainViewController
|
||||
- (MessagePresenter *)createPresenter {
|
||||
return [[MessagePresenter alloc] init];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[self getDataList];
|
||||
|
||||
}
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
@@ -50,28 +61,59 @@
|
||||
-(void)dealloc{
|
||||
[[NSNotificationCenter defaultCenter]removeObserver:self];
|
||||
}
|
||||
-(void)getDataList{
|
||||
[self.presenter getPublicChatHallList];
|
||||
}
|
||||
-(void)getPublicChatHallListSuccess:(NSArray<MSSessionScrollingModel *> *)list{
|
||||
NSMutableArray *l = [NSMutableArray new];
|
||||
for (MSSessionScrollingModel *obj in list) {
|
||||
obj.beginTime = 3;
|
||||
obj.endTime = 8;
|
||||
}
|
||||
self.scrollingView.modelList = [[NSMutableArray alloc]initWithArray:list];
|
||||
}
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(getTabBarItemBadge:) name:@"kGetTabBarItemBadge" object:nil];
|
||||
self.view.backgroundColor = [UIColor clearColor];
|
||||
self.headView = [UIView new];
|
||||
|
||||
[self.view addSubview:self.headBgImageView];
|
||||
[self.view addSubview:self.pagingView];
|
||||
[self.view addSubview:self.allCleanBtn];
|
||||
|
||||
[self.view addSubview:self.bgImageView];
|
||||
[self.bgImageView addSubview:self.textView];
|
||||
[self.bgImageView addSubview:self.scrollingView];
|
||||
}
|
||||
- (void)initSubViewConstraints {
|
||||
[self.headBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.top.trailing.equalTo(self.view);
|
||||
make.height.mas_equalTo(196);
|
||||
}];
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kStatusBarHeight);
|
||||
make.height.mas_equalTo(kGetScaleWidth(99));
|
||||
make.leading.trailing.equalTo(self.view);
|
||||
}];
|
||||
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kGetScaleWidth(13));
|
||||
make.centerX.equalTo(self.bgImageView);
|
||||
}];
|
||||
[self.scrollingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(0);
|
||||
make.top.mas_equalTo(kGetScaleWidth(35));
|
||||
make.trailing.mas_equalTo(-kGetScaleWidth(0));
|
||||
make.bottom.mas_equalTo(kGetScaleWidth(10));
|
||||
}];
|
||||
|
||||
[self.pagingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.leading.trailing.equalTo(self.view);
|
||||
make.leading.trailing.equalTo(self.view);
|
||||
make.bottom.mas_equalTo(-1);
|
||||
make.top.equalTo(self.bgImageView.mas_bottom).mas_offset(-50);
|
||||
}];
|
||||
[self.allCleanBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(30);
|
||||
make.top.mas_equalTo(67);
|
||||
make.top.mas_equalTo(67+kGetScaleWidth(115));
|
||||
make.trailing.mas_equalTo(-15);
|
||||
}];
|
||||
|
||||
@@ -141,6 +183,25 @@
|
||||
- (void)allReadButtonClick:(UIButton *)sender {
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kAllReadAction" object:nil];
|
||||
}
|
||||
#pragma mark- MSSessionScrollingViewDelegate
|
||||
- (UIView *)MSSessionScrollingView:(MSSessionScrollingView *)view scrollingWithModel:(MSSessionScrollingModel*)model{
|
||||
MSSessionScrollingItemView *scrollingView = [[MSSessionScrollingItemView alloc]initWithFrame:CGRectMake(0, 0, model.width + kGetScaleWidth(32.5), kGetScaleWidth(27))];
|
||||
scrollingView.model = model;
|
||||
|
||||
return scrollingView;
|
||||
}
|
||||
- (void)MSSessionScrollingView:(MSSessionScrollingView *)view didClickView:(UIView *)scrollingView atPoint:(CGPoint)point{
|
||||
|
||||
}
|
||||
-(void)clickPublicChatHallAction{
|
||||
MSSessionPublicChatHallVC *vc =[MSSessionPublicChatHallVC new];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
-(NSTimeInterval)curTime {
|
||||
static double time = 0;
|
||||
time += 0.1 ;
|
||||
return time;
|
||||
}
|
||||
#pragma mark -懒加载
|
||||
- (JXCategoryTitleView *)titleView {
|
||||
if (!_titleView) {
|
||||
@@ -236,6 +297,29 @@
|
||||
}
|
||||
return _allCleanBtn;
|
||||
}
|
||||
- (MSSessionScrollingView *)scrollingView{
|
||||
if(!_scrollingView){
|
||||
_scrollingView = [[MSSessionScrollingView alloc]initWithFrame:CGRectZero];
|
||||
_scrollingView.delegate = self;
|
||||
}
|
||||
return _scrollingView;
|
||||
}
|
||||
- (UIImageView *)bgImageView{
|
||||
if(!_bgImageView){
|
||||
_bgImageView = [UIImageView new];
|
||||
_bgImageView.userInteractionEnabled = YES;
|
||||
_bgImageView.image = kImage(@"ms_public_chat_hall_head_enter_bg");
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickPublicChatHallAction)];
|
||||
[_bgImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _bgImageView;
|
||||
}
|
||||
- (UILabel *)textView{
|
||||
if(!_textView){
|
||||
_textView = [UILabel labelInitWithText:YMLocalizedString(@"MSSessionPublicChatHallVC0") font:kFontBold(17) textColor:UIColorFromRGB(0xFFDDA2)];
|
||||
}
|
||||
return _textView;
|
||||
}
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
|
Reference in New Issue
Block a user