进入房间请求接口完善逻辑

This commit is contained in:
fengshuo
2021-10-19 18:30:03 +08:00
parent 9327830ad9
commit 92883d25d4
15 changed files with 276 additions and 146 deletions

View File

@@ -149,10 +149,10 @@
E88B5CBD26FB3BDF00DA9178 /* XPTeenagerAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88B5CBC26FB3BDF00DA9178 /* XPTeenagerAlertView.m */; };
E88B5CC126FB407B00DA9178 /* XPMineUserInfoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E88B5CC026FB407B00DA9178 /* XPMineUserInfoViewController.m */; };
E88B5CC526FB42B000DA9178 /* XPMineUserInfoHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88B5CC426FB42B000DA9178 /* XPMineUserInfoHeaderView.m */; };
E88F5EB0271ECEF000FF9B33 /* XPRoomViewController+RoomInfoContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88F5EAE271ECEF000FF9B33 /* XPRoomViewController+RoomInfoContainerView.m */; };
E89D60BA271D643A001F8895 /* Api+Room.m in Sources */ = {isa = PBXBuildFile; fileRef = E89D60B9271D643A001F8895 /* Api+Room.m */; };
E89D60BD271D647A001F8895 /* XPRoomPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E89D60BC271D647A001F8895 /* XPRoomPresenter.m */; };
E89D60C1271D64B9001F8895 /* RoomInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E89D60C0271D64B9001F8895 /* RoomInfoModel.m */; };
E89D60C4271D7AAD001F8895 /* XPRoomModuleHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = E89D60C3271D7AAD001F8895 /* XPRoomModuleHelper.m */; };
E89DA66427005932008483C1 /* XPIAPHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = E89DA66327005932008483C1 /* XPIAPHelper.m */; };
E89DA66727006443008483C1 /* RechargeStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = E89DA66627006443008483C1 /* RechargeStorage.m */; };
E89DA67227008D59008483C1 /* WalletInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E89DA67127008D59008483C1 /* WalletInfoModel.m */; };
@@ -503,6 +503,8 @@
E88B5CC026FB407B00DA9178 /* XPMineUserInfoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineUserInfoViewController.m; sourceTree = "<group>"; };
E88B5CC326FB42B000DA9178 /* XPMineUserInfoHeaderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineUserInfoHeaderView.h; sourceTree = "<group>"; };
E88B5CC426FB42B000DA9178 /* XPMineUserInfoHeaderView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineUserInfoHeaderView.m; sourceTree = "<group>"; };
E88F5EAE271ECEF000FF9B33 /* XPRoomViewController+RoomInfoContainerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "XPRoomViewController+RoomInfoContainerView.m"; sourceTree = "<group>"; };
E88F5EAF271ECEF000FF9B33 /* XPRoomViewController+RoomInfoContainerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "XPRoomViewController+RoomInfoContainerView.h"; sourceTree = "<group>"; };
E89D60B8271D643A001F8895 /* Api+Room.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+Room.h"; sourceTree = "<group>"; };
E89D60B9271D643A001F8895 /* Api+Room.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+Room.m"; sourceTree = "<group>"; };
E89D60BB271D647A001F8895 /* XPRoomPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomPresenter.h; sourceTree = "<group>"; };
@@ -510,8 +512,6 @@
E89D60BE271D648D001F8895 /* XPRoomProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomProtocol.h; sourceTree = "<group>"; };
E89D60BF271D64B9001F8895 /* RoomInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RoomInfoModel.h; sourceTree = "<group>"; };
E89D60C0271D64B9001F8895 /* RoomInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RoomInfoModel.m; sourceTree = "<group>"; };
E89D60C2271D7AAD001F8895 /* XPRoomModuleHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomModuleHelper.h; sourceTree = "<group>"; };
E89D60C3271D7AAD001F8895 /* XPRoomModuleHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomModuleHelper.m; sourceTree = "<group>"; };
E89DA66227005931008483C1 /* XPIAPHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPIAPHelper.h; sourceTree = "<group>"; };
E89DA66327005932008483C1 /* XPIAPHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPIAPHelper.m; sourceTree = "<group>"; };
E89DA66527006443008483C1 /* RechargeStorage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RechargeStorage.h; sourceTree = "<group>"; };
@@ -1424,6 +1424,15 @@
path = MineInfo;
sourceTree = "<group>";
};
E88F5EAA271ECCDC00FF9B33 /* Category */ = {
isa = PBXGroup;
children = (
E88F5EAF271ECEF000FF9B33 /* XPRoomViewController+RoomInfoContainerView.h */,
E88F5EAE271ECEF000FF9B33 /* XPRoomViewController+RoomInfoContainerView.m */,
);
path = Category;
sourceTree = "<group>";
};
E89D60B7271D6417001F8895 /* Model */ = {
isa = PBXGroup;
children = (
@@ -1479,6 +1488,7 @@
E8AEAED8271413530017FCE0 /* View */ = {
isa = PBXGroup;
children = (
E88F5EAA271ECCDC00FF9B33 /* Category */,
E8AEAED4271412EC0017FCE0 /* XPRoomViewController.h */,
E8AEAED5271412EC0017FCE0 /* XPRoomViewController.m */,
E8AEAEE527141ACC0017FCE0 /* ActivityContainerView */,
@@ -1487,8 +1497,6 @@
E8AEAEE627141ACC0017FCE0 /* MessageContainerView */,
E8AEAEEA27141ACC0017FCE0 /* PositionContainerView */,
E8AEAEE827141ACC0017FCE0 /* RoomInfoContainerView */,
E89D60C2271D7AAD001F8895 /* XPRoomModuleHelper.h */,
E89D60C3271D7AAD001F8895 /* XPRoomModuleHelper.m */,
);
path = View;
sourceTree = "<group>";
@@ -2051,6 +2059,7 @@
E8E70D7726F2F15100F03460 /* XPMineViewController.m in Sources */,
E8AC722C26F49580007D6E91 /* XPMineNotificaViewController.m in Sources */,
189DD52E26DE255300AB55B1 /* AppDelegate.m in Sources */,
E88F5EB0271ECEF000FF9B33 /* XPRoomViewController+RoomInfoContainerView.m in Sources */,
E86596542701A55500846EBD /* StatisticsServiceHelper.m in Sources */,
E8E70D8C26F2F5A500F03460 /* XPMineMatchCollectionViewCell.m in Sources */,
186A534A26FC6ED900D67B2C /* TTActionSheetConfig.m in Sources */,
@@ -2064,7 +2073,6 @@
E88B5CAD26FB16A800DA9178 /* XPMineTeenagerDesView.m in Sources */,
E824545126F5CE6E00BE8163 /* XPMineModifPayPwdPresenter.m in Sources */,
E8EEB90F26FC6AB8007C6EBA /* XPMineUserInfoEditPresenter.m in Sources */,
E89D60C4271D7AAD001F8895 /* XPRoomModuleHelper.m in Sources */,
E8AC723A26F49AAE007D6E91 /* XPMineNotifyStatus.m in Sources */,
18E7B33226F317A20064BC9B /* XPWebViewController.m in Sources */,
E8AEAEF927141CA30017FCE0 /* XPRoomInfoContainerView.m in Sources */,

View File

@@ -30,7 +30,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic , assign) NSInteger fansNum;
@property (nonatomic , assign) BOOL isBindBankCard;
@property (nonatomic , assign) BOOL hasRegPacket;
@property (nonatomic , assign) BOOL isCertified;
@property (nonatomic , assign) GenderType gender;
@property (nonatomic , assign) NSInteger platformRole;
@property (nonatomic , assign) NSInteger uid;
@@ -51,6 +50,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,copy) NSString *userDesc;
///出生日期
@property (nonatomic,assign) long birth;
///是否实名认证
@property (nonatomic,assign) BOOL isCertified;
@end
NS_ASSUME_NONNULL_END

View File

@@ -33,7 +33,6 @@
#warning todo
#import "BaseNavigationController.h"
#import "XPRoomViewController.h"
#import "XPRoomModuleHelper.h"
@interface XPMineViewController ()<UITableViewDelegate, UITableViewDataSource, XPMineProtocol, XPMineMatchTableViewCellDelegate, XPMineHeadViewDelegate>
@@ -132,13 +131,14 @@
case XPMineItemType_Account:
{
#warning to do
[[XPRoomModuleHelper shareHelper] enterRoomVCWithRoomUid:[NSString stringWithFormat:@"%ld", self.userInfo.uid] viewController:self];
return;
XPRoomViewController * roomVC = [[XPRoomViewController alloc] init];
roomVC.roomUid = [NSString stringWithFormat:@"%ld", self.userInfo.uid];
BaseNavigationController * nav = [[BaseNavigationController alloc] initWithRootViewController:roomVC];
nav.modalPresentationStyle = UIModalPresentationFullScreen;
[self.navigationController presentViewController:nav animated:YES completion:nil];
[self presentViewController:nav animated:YES completion:nil];
return;
}
break;

View File

@@ -58,6 +58,8 @@ typedef NS_ENUM(NSInteger, RoomType) {
@property (nonatomic , assign) NSInteger closeScreenFlag;
@property (nonatomic , assign) NSInteger operatorStatus;
@property (nonatomic , assign) BOOL isRoomFans;
///房间密码
@property(nonatomic, copy) NSString *roomPwd;
@end
NS_ASSUME_NONNULL_END

View File

@@ -6,18 +6,30 @@
//
#import "BaseMvpPresenter.h"
#import "RoomInfoModel.h"
NS_ASSUME_NONNULL_BEGIN
@class UserInfoModel, RoomInfoModel;
@interface XPRoomPresenter : BaseMvpPresenter
/// 获取用户信息
/// @param success 成功
- (void)getUserInfoSuccess:(void(^)(UserInfoModel * info))success;
- (void)getUserInfoWithUid:(NSString *)uid;
/// 获取进入的那个房间信息
/// @param uid 进入的房间的uid
/// @param success 成功
- (void)getRoomInfoWithUid:(NSString *)uid success:(void(^)(RoomInfoModel *roomInfo))success;
- (void)getRoomInfoWithUid:(NSString *)uid;
/// 开启用户自己的房间
/// @param title 房间标题
/// @param type 房间类型
/// @param roomPwd 房间密码
/// @param roomDesc 房间介绍
/// @param backPic 房间背景
- (void)openUserRoomWithTitle:(NSString *)title
type:(RoomType)type
roomPwd:(NSString *)roomPwd
roomDesc:(NSString *)roomDesc
backPic:(NSString *)backPic;
@end
NS_ASSUME_NONNULL_END

View File

@@ -8,38 +8,36 @@
#import "XPRoomPresenter.h"
///API
#import "Api+Room.h"
#import "RoomInfoModel.h"
#import "UserInfoModel.h"
///Tool
#import "AccountInfoStorage.h"
///P
#import "XPRoomProtocol.h"
@implementation XPRoomPresenter
///
/// @param success
- (void)getUserInfoSuccess:(void(^)(UserInfoModel * info))success {
NSString * uid = [AccountInfoStorage instance].getUid;
- (void)getUserInfoWithUid:(NSString *)uid {
[Api getUserInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
UserInfoModel * infoModel = [UserInfoModel modelWithJSON:data.data];
if (infoModel && success) {
success(infoModel);
}
[[self getView] getUserInfoSuccess:infoModel];
} fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView] getUserInfoFail];
}] uid:uid];
}
///
/// @param uid uid
/// @param success
- (void)getRoomInfoWithUid:(NSString *)uid success:(void(^)(RoomInfoModel *roomInfo))success {
- (void)getRoomInfoWithUid:(NSString *)uid {
NSString * intoUid = [AccountInfoStorage instance].getUid;
[Api getRoomInfoWithComplection:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
RoomInfoModel * model = [RoomInfoModel modelWithJSON:data.data];
if (model && success) {
success(model);
}
} showLoading:YES] uid:uid intoUid:intoUid];
[[self getView] getRoomInfoSuccess:model];
} fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView] getRoomInfoFail];
}] uid:uid intoUid:intoUid];
}
@@ -69,7 +67,10 @@
}
[Api openRoomWithComplection:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
#warning to do s1
RoomInfoModel * infoModel = [RoomInfoModel modelWithJSON:data.data];
[[self getView] openRoomSuccess:infoModel];
} fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView] openRoomFail];
}] title:title type:type roomPwd:roomPwd roomDesc:roomDesc backPic:backPic uid:uid ticket:ticket];
}

View File

@@ -8,9 +8,19 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class RoomInfoModel,UserInfoModel;
@protocol XPRoomProtocol <NSObject>
///获取用户信息成功
- (void)getUserInfoSuccess:(UserInfoModel *)userInfo;
- (void)getUserInfoFail;
///获取房间信息成功
- (void)getRoomInfoSuccess:(RoomInfoModel *)roomInfo;
- (void)getRoomInfoFail;
///开启房间成功
- (void)openRoomSuccess:(RoomInfoModel *)roomInfo;
- (void)openRoomFail;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,16 @@
//
// XPRoomViewController+RoomInfo.h
// xplan-ios
//
// Created by 冯硕 on 2021/10/19.
//
#import "XPRoomViewController.h"
#import "XPRoomInfoContainerView.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPRoomViewController (RoomInfoContainerView)<XPRoomInfoContainerViewDelegate>
- (void)configRoomInfoContainerViewWithRoomInfo:(RoomInfoModel *)roomInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,30 @@
//
// XPRoomViewController+RoomInfo.m
// xplan-ios
//
// Created by on 2021/10/19.
//
#import "XPRoomViewController+RoomInfoContainerView.h"
@implementation XPRoomViewController (RoomInfoContainerView)
- (void)configRoomInfoContainerViewWithRoomInfo:(RoomInfoModel *)roomInfo {
self.roomInfoContainerView.roomInfo = roomInfo;
}
#pragma mark - XPRoomInfoContainerView
- (void)xpRoomInfoContainerView:(XPRoomInfoContainerView *)view didClickBackButton:(UIButton *)sender {
[self disMissRoomVC];
}
- (void)xpRoomInfoContainerView:(XPRoomInfoContainerView *)view didClickSettingButton:(UIButton *)sender {
}
#pragma mark - Private Method
@end

View File

@@ -8,10 +8,21 @@
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class RoomInfoModel;
@class RoomInfoModel,XPRoomInfoContainerView;
@protocol XPRoomInfoContainerViewDelegate <NSObject>
///点击了返回按钮
- (void)xpRoomInfoContainerView:(XPRoomInfoContainerView *)view didClickBackButton:(UIButton *)sender;
///点击了设置按钮
- (void)xpRoomInfoContainerView:(XPRoomInfoContainerView *)view didClickSettingButton:(UIButton *)sender;
@end
@interface XPRoomInfoContainerView : UIView
///
///房间信息
@property (nonatomic,strong) RoomInfoModel *roomInfo;
///代理
@property (nonatomic,weak) id<XPRoomInfoContainerViewDelegate> delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -56,7 +56,9 @@
#pragma mark - Response
- (void)backButtonAction:(UIButton *)sender {
if (self.delegate && [self.delegate respondsToSelector:@selector(xpRoomInfoContainerView:didClickBackButton:)]) {
[self.delegate xpRoomInfoContainerView:self didClickBackButton:sender];
}
}
- (void)shareButtonAction:(UIButton *)sender{
@@ -64,7 +66,9 @@
}
- (void)settingButtonAction:(UIButton *)sender {
if (self.delegate && [self.delegate respondsToSelector:@selector(xpRoomInfoContainerView:didClickSettingButton:)]) {
[self.delegate xpRoomInfoContainerView:self didClickSettingButton:sender];
}
}

View File

@@ -1,19 +0,0 @@
//
// XPRoomModuleHelper.h
// xplan-ios
//
// Created by 冯硕 on 2021/10/18.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPRoomModuleHelper : NSObject
+ (instancetype)shareHelper;
///进入房间
- (void)enterRoomVCWithRoomUid:(NSString *)roomUid viewController:(UIViewController *)viewController;
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,83 +0,0 @@
//
// XPRoomModuleHelper.m
// xplan-ios
//
// Created by on 2021/10/18.
//
#import "XPRoomModuleHelper.h"
#import <ReactiveObjC/ReactiveObjC.h>
///Model
#import "RoomInfoModel.h"
///P
#import "XPRoomPresenter.h"
///VC
#import "XPRoomViewController.h"
#import "BaseNavigationController.h"
@interface XPRoomModuleHelper ()
///
@property (nonatomic,assign) BOOL isEntering;
///
@property (nonatomic,strong) XPRoomPresenter *roomPresenter;
@end
@implementation XPRoomModuleHelper
+ (instancetype)shareHelper {
static dispatch_once_t onceToken;
static XPRoomModuleHelper * helper;
dispatch_once(&onceToken, ^{
helper = [[XPRoomModuleHelper alloc] init];
});
return helper;
}
- (void)enterRoomVCWithRoomUid:(NSString *)roomUid viewController:(nonnull UIViewController *)viewController{
if (viewController == nil || roomUid <= 0) {
return;
}
@weakify(self);
[self.roomPresenter getRoomInfoWithUid:roomUid success:^(RoomInfoModel * _Nonnull roomInfo) {
roomInfo.valid = YES;
@strongify(self);
if (roomInfo.valid) {
self.isEntering = YES;
[self presenterRoomVCWithRoomInfo:roomInfo viewController:viewController];
} else {
#warning to do -
}
}];
}
- (void)presenterRoomVCWithRoomInfo:(RoomInfoModel *)roomInfo viewController:(nonnull UIViewController *)viewController {
if (roomInfo == nil) {
return;
}
if (self.isEntering) {
#warning to do - toast
return;
}
#warning to do -
XPRoomViewController * roomVC = [[XPRoomViewController alloc] init];
roomVC.roomInfo = roomInfo;
BaseNavigationController * nav = [[BaseNavigationController alloc] initWithRootViewController:roomVC];
nav.modalPresentationStyle = UIModalPresentationFullScreen;
[viewController presentViewController:nav animated:YES completion:^{
self.isEntering = NO;
}];
}
- (XPRoomPresenter *)roomPresenter {
if (!_roomPresenter) {
_roomPresenter = [[XPRoomPresenter alloc] init];
}
return _roomPresenter;
}
@end

View File

@@ -8,12 +8,30 @@
#import "MvpViewController.h"
NS_ASSUME_NONNULL_BEGIN
@class RoomInfoModel;
@class XPRoomBackContainerView,XPRoomInfoContainerView,XPRoomMessageContainerView,XPRoomMenuContainerView,XPRoomActivityContainerView, XPRoomPositionContainView, RoomInfoModel;
@interface XPRoomViewController : MvpViewController
///房间信息
@property (nonatomic,strong) RoomInfoModel *roomInfo;
///房间的Uid
@property (nonatomic,copy) NSString * roomUid;
///背景
@property (nonatomic,strong, readonly) XPRoomBackContainerView *backContainerView;
///房间信息
@property (nonatomic,strong, readonly) XPRoomInfoContainerView *roomInfoContainerView;
///坑位信息
@property (nonatomic,strong, readonly) XPRoomPositionContainView *positionContainerView;
///公屏
@property (nonatomic,strong, readonly) XPRoomMessageContainerView *messageContainerView;
///底部操作栏
@property (nonatomic,strong, readonly) XPRoomMenuContainerView *menuContainerView;
///活动
@property (nonatomic,strong, readonly) XPRoomActivityContainerView *activityContainerView;
///房间信息
@property (nonatomic,strong, readonly) RoomInfoModel *roomInfo;
///dismissVC
- (void)disMissRoomVC;
@end
NS_ASSUME_NONNULL_END

View File

@@ -10,8 +10,10 @@
#import <Masonry/Masonry.h>
///Tool
#import "XPMacro.h"
#import "AccountInfoStorage.h"
///Model
#import "RoomInfoModel.h"
#import "UserInfoModel.h"
///View
#import "XPRoomActivityContainerView.h"
#import "XPRoomBackContainerView.h"
@@ -19,8 +21,13 @@
#import "XPRoomMessageContainerView.h"
#import "XPRoomPositionContainView.h"
#import "XPRoomInfoContainerView.h"
///P
#import "XPRoomPresenter.h"
#import "XPRoomProtocol.h"
///Category
#import "XPRoomViewController+RoomInfoContainerView.h"
@interface XPRoomViewController ()
@interface XPRoomViewController ()<XPRoomProtocol>
///
@property (nonatomic,strong) XPRoomBackContainerView *backContainerView;
///
@@ -33,10 +40,25 @@
@property (nonatomic,strong) XPRoomMenuContainerView *menuContainerView;
///
@property (nonatomic,strong) XPRoomActivityContainerView *activityContainerView;
///
@property (nonatomic,assign) BOOL isOpenRoom;
///
@property (nonatomic,strong) UserInfoModel *usereInfo;
///
@property (nonatomic,strong) RoomInfoModel *roomInfo;
@end
@implementation XPRoomViewController
- (void)dealloc {
#warning to do -
}
- (XPRoomPresenter *)createPresenter {
return [[XPRoomPresenter alloc] init];
}
- (BOOL)isHiddenNavBar {
return YES;
}
@@ -94,11 +116,106 @@
}];
}
///
- (void)requestRoomInfoSuccess:(RoomInfoModel *)roomInfo {
[self hideHUD];
self.roomInfo = roomInfo;
[self configRoomInfoContainerViewWithRoomInfo:roomInfo];
///
if (self.usereInfo == nil) {
[self.presenter getUserInfoWithUid:self.roomUid];
} else {
[self enterChatRoomWithUseInfo:self.usereInfo];
}
}
///dismissVC
- (void)disMissRoomVC {
if (self.presentingViewController) {
[self dismissViewControllerAnimated:YES completion:nil];
}
}
///
- (void)openRoomWithUserInfo {
NSString * title = [NSString stringWithFormat:@"%@的房间", self.usereInfo.nick];
[self.presenter openUserRoomWithTitle:title type:RoomType_Game roomPwd:@"" roomDesc:@"" backPic:@""];
}
- (void)enterChatRoomWithUseInfo:(UserInfoModel *)userInfo {
///
#warning to do -
}
#pragma mark - XPRoomProtocol
- (void)getRoomInfoSuccess:(RoomInfoModel *)roomInfo {
NSString * uid = [AccountInfoStorage instance].getUid;
if ([self.roomUid isEqualToString:uid]) {///
if (roomInfo == nil || roomInfo.valid) {
self.isOpenRoom = YES;
if (self.usereInfo) {
[self openRoomWithUserInfo];
} else {
[self.presenter getUserInfoWithUid:uid];
}
} else {
[self requestRoomInfoSuccess:roomInfo];
}
} else {///
if (roomInfo.valid) {
if (roomInfo.roomPwd.length > 0) {
[self hideHUD];
#warning to do -
} else {
[self requestRoomInfoSuccess:roomInfo];
}
} else {
#warning to do - 线
[self hideHUD];
}
}
}
- (void)getRoomInfoFail {
[self hideHUD];
[self disMissRoomVC];
}
- (void)getUserInfoSuccess:(UserInfoModel *)userInfo {
self.usereInfo = userInfo;
if (self.isOpenRoom) {
[self openRoomWithUserInfo];
} else {
if (self.roomInfo) {
[self enterChatRoomWithUseInfo:userInfo];
}
}
}
- (void)getUserInfoFail {
[self hideHUD];
[self disMissRoomVC];
}
- (void)openRoomSuccess:(RoomInfoModel *)roomInfo {
[self requestRoomInfoSuccess:roomInfo];
}
- (void)openRoomFail {
[self hideHUD];
[self disMissRoomVC];
}
#pragma mark - Getters And Setters
- (void)setRoomInfo:(RoomInfoModel *)roomInfo {
_roomInfo = roomInfo;
self.roomInfoContainerView.roomInfo = _roomInfo;
- (void)setRoomUid:(NSString *)roomUid {
_roomUid = roomUid;
if (_roomUid) {
[self showLoading];
///
[self.presenter getUserInfoWithUid:_roomUid];
///
[self.presenter getRoomInfoWithUid:_roomUid];
}
}
- (XPRoomBackContainerView *)backContainerView {
@@ -111,6 +228,7 @@
- (XPRoomInfoContainerView *)roomInfoContainerView {
if (!_roomInfoContainerView) {
_roomInfoContainerView = [[XPRoomInfoContainerView alloc] init];
_roomInfoContainerView.delegate = self;
}
return _roomInfoContainerView;
}
@@ -143,4 +261,5 @@
return _activityContainerView;
}
@end