增加RoomGuestDelegate和RoomHostDelegate

This commit is contained in:
zu
2021-10-27 23:05:03 +08:00
parent 525d8384fd
commit a03193fcaf
15 changed files with 146 additions and 216 deletions

View File

@@ -136,7 +136,6 @@
E84B0E422727EE0A008818C6 /* XPRoomMessageHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = E84B0E412727EE0A008818C6 /* XPRoomMessageHeaderView.m */; };
E84B0E462727EF9D008818C6 /* XPRoomMessageDisplayModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E84B0E452727EF9D008818C6 /* XPRoomMessageDisplayModel.m */; };
E84B0E4C27281530008818C6 /* XPRoomMessageAttributeHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = E84B0E4B27281530008818C6 /* XPRoomMessageAttributeHelper.m */; };
E85B02222722A3D900298C52 /* XPRoomPositionDelgate.h in Sources */ = {isa = PBXBuildFile; fileRef = E85B02212722A3C600298C52 /* XPRoomPositionDelgate.h */; };
E865963F27015A9C00846EBD /* XPMineUserTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = E865963E27015A9C00846EBD /* XPMineUserTableView.m */; };
E86596432701611A00846EBD /* UIImage+ImageEffects.m in Sources */ = {isa = PBXBuildFile; fileRef = E86596412701611A00846EBD /* UIImage+ImageEffects.m */; };
E86596462701612D00846EBD /* UIImageView+Vague.m in Sources */ = {isa = PBXBuildFile; fileRef = E86596452701612D00846EBD /* UIImageView+Vague.m */; };
@@ -169,7 +168,6 @@
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 */; };
@@ -200,7 +198,7 @@
E8AEAEED27141AE20017FCE0 /* XPRoomBackContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AEAEEC27141AE20017FCE0 /* XPRoomBackContainerView.m */; };
E8AEAEF027141C430017FCE0 /* XPRoomMenuContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AEAEEF27141C430017FCE0 /* XPRoomMenuContainerView.m */; };
E8AEAEF327141C7C0017FCE0 /* XPRoomMessageContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AEAEF227141C7C0017FCE0 /* XPRoomMessageContainerView.m */; };
E8AEAEF927141CA30017FCE0 /* XPRoomInfoContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AEAEF827141CA30017FCE0 /* XPRoomInfoContainerView.m */; };
E8AEAEF927141CA30017FCE0 /* RoomHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AEAEF827141CA30017FCE0 /* RoomHeaderView.m */; };
E8B825BF26E9E57D009E8E9F /* LoginTicketInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = E8B825BE26E9E57D009E8E9F /* LoginTicketInfo.m */; };
E8B825C226EA00DF009E8E9F /* LoginVerifCodePresent.m in Sources */ = {isa = PBXBuildFile; fileRef = E8B825C126EA00DF009E8E9F /* LoginVerifCodePresent.m */; };
E8B825C726EA0D9A009E8E9F /* LoginVerifCodeProtocol.h in Sources */ = {isa = PBXBuildFile; fileRef = E8B825C626EA0995009E8E9F /* LoginVerifCodeProtocol.h */; };
@@ -272,11 +270,12 @@
180806D627293794001FD836 /* NSObject+MJExtension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSObject+MJExtension.h"; sourceTree = "<group>"; };
180806D727293794001FD836 /* NSObject+MJExtension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSObject+MJExtension.m"; sourceTree = "<group>"; };
180806DA27297269001FD836 /* MicroViewProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MicroViewProtocol.h; sourceTree = "<group>"; };
180806F827298F9B001FD836 /* RoomGuestDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RoomGuestDelegate.h; sourceTree = "<group>"; };
181D7F192726CE2A00B7C059 /* StageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StageView.h; sourceTree = "<group>"; };
181D7F1A2726CE2A00B7C059 /* StageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StageView.m; sourceTree = "<group>"; };
181D7F1F2727D9DB00B7C059 /* SocialStageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SocialStageView.h; sourceTree = "<group>"; };
181D7F202727D9DB00B7C059 /* SocialStageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SocialStageView.m; sourceTree = "<group>"; };
181D7F222727DB1E00B7C059 /* RoomDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RoomDelegate.h; sourceTree = "<group>"; };
181D7F222727DB1E00B7C059 /* RoomHostDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RoomHostDelegate.h; sourceTree = "<group>"; };
18486211271EA9DA005FC5DC /* RtcManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RtcManager.h; sourceTree = "<group>"; };
18486212271EA9DA005FC5DC /* RtcManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RtcManager.m; sourceTree = "<group>"; };
18486214271EAA03005FC5DC /* RtcDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RtcDelegate.h; sourceTree = "<group>"; };
@@ -497,7 +496,6 @@
E84B0E4927280289008818C6 /* XPRoomMessageConstant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMessageConstant.h; sourceTree = "<group>"; };
E84B0E4A27281530008818C6 /* XPRoomMessageAttributeHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMessageAttributeHelper.h; sourceTree = "<group>"; };
E84B0E4B27281530008818C6 /* XPRoomMessageAttributeHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMessageAttributeHelper.m; sourceTree = "<group>"; };
E85B02212722A3C600298C52 /* XPRoomPositionDelgate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomPositionDelgate.h; sourceTree = "<group>"; };
E865963D27015A9C00846EBD /* XPMineUserTableView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineUserTableView.h; sourceTree = "<group>"; };
E865963E27015A9C00846EBD /* XPMineUserTableView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineUserTableView.m; sourceTree = "<group>"; };
E86596412701611A00846EBD /* UIImage+ImageEffects.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+ImageEffects.m"; sourceTree = "<group>"; };
@@ -555,8 +553,6 @@
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>"; };
@@ -615,8 +611,8 @@
E8AEAEEF27141C430017FCE0 /* XPRoomMenuContainerView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMenuContainerView.m; sourceTree = "<group>"; };
E8AEAEF127141C7C0017FCE0 /* XPRoomMessageContainerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMessageContainerView.h; sourceTree = "<group>"; };
E8AEAEF227141C7C0017FCE0 /* XPRoomMessageContainerView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMessageContainerView.m; sourceTree = "<group>"; };
E8AEAEF727141CA30017FCE0 /* XPRoomInfoContainerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomInfoContainerView.h; sourceTree = "<group>"; };
E8AEAEF827141CA30017FCE0 /* XPRoomInfoContainerView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomInfoContainerView.m; sourceTree = "<group>"; };
E8AEAEF727141CA30017FCE0 /* RoomHeaderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RoomHeaderView.h; sourceTree = "<group>"; };
E8AEAEF827141CA30017FCE0 /* RoomHeaderView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RoomHeaderView.m; sourceTree = "<group>"; };
E8B825BD26E9E57D009E8E9F /* LoginTicketInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginTicketInfo.h; sourceTree = "<group>"; };
E8B825BE26E9E57D009E8E9F /* LoginTicketInfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginTicketInfo.m; sourceTree = "<group>"; };
E8B825C026EA00DF009E8E9F /* LoginVerifCodePresent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginVerifCodePresent.h; sourceTree = "<group>"; };
@@ -1556,15 +1552,6 @@
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 = (
@@ -1599,11 +1586,11 @@
E8AEAED3271412D00017FCE0 /* Room */ = {
isa = PBXGroup;
children = (
E80487622717DDAE008595F2 /* Protocol */,
E80487612717DD92008595F2 /* Presenter */,
E80487602717DD89008595F2 /* Api */,
E804875F2717DD70008595F2 /* Model */,
E80487602717DD89008595F2 /* Api */,
E8AEAED8271413530017FCE0 /* View */,
E80487612717DD92008595F2 /* Presenter */,
E80487622717DDAE008595F2 /* Protocol */,
);
path = Room;
sourceTree = "<group>";
@@ -1611,16 +1598,16 @@
E8AEAED8271413530017FCE0 /* View */ = {
isa = PBXGroup;
children = (
E88F5EAA271ECCDC00FF9B33 /* Category */,
E8AEAED4271412EC0017FCE0 /* XPRoomViewController.h */,
E8AEAED5271412EC0017FCE0 /* XPRoomViewController.m */,
181D7F222727DB1E00B7C059 /* RoomDelegate.h */,
181D7F222727DB1E00B7C059 /* RoomHostDelegate.h */,
180806F827298F9B001FD836 /* RoomGuestDelegate.h */,
E8AEAEE827141ACC0017FCE0 /* RoomHeaderView */,
E8AEAEEA27141ACC0017FCE0 /* StageView */,
E8AEAEE627141ACC0017FCE0 /* MessageContainerView */,
E8AEAEE527141ACC0017FCE0 /* ActivityContainerView */,
E8AEAEE727141ACC0017FCE0 /* BaseUIContainerView */,
E8AEAEE927141ACC0017FCE0 /* MenuContainerView */,
E8AEAEE627141ACC0017FCE0 /* MessageContainerView */,
E8AEAEEA27141ACC0017FCE0 /* StageView */,
E8AEAEE827141ACC0017FCE0 /* RoomInfoContainerView */,
);
path = View;
sourceTree = "<group>";
@@ -1655,13 +1642,13 @@
path = BaseUIContainerView;
sourceTree = "<group>";
};
E8AEAEE827141ACC0017FCE0 /* RoomInfoContainerView */ = {
E8AEAEE827141ACC0017FCE0 /* RoomHeaderView */ = {
isa = PBXGroup;
children = (
E8AEAEF727141CA30017FCE0 /* XPRoomInfoContainerView.h */,
E8AEAEF827141CA30017FCE0 /* XPRoomInfoContainerView.m */,
E8AEAEF727141CA30017FCE0 /* RoomHeaderView.h */,
E8AEAEF827141CA30017FCE0 /* RoomHeaderView.m */,
);
path = RoomInfoContainerView;
path = RoomHeaderView;
sourceTree = "<group>";
};
E8AEAEE927141ACC0017FCE0 /* MenuContainerView */ = {
@@ -2201,7 +2188,6 @@
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 */,
E874B88F27216FFE003954B9 /* XPIMChatRoomMemberImpl.m in Sources */,
@@ -2219,7 +2205,7 @@
E8AC723A26F49AAE007D6E91 /* XPMineNotifyStatus.m in Sources */,
E874B8782721438E003954B9 /* XPImRoomImpl.m in Sources */,
18E7B33226F317A20064BC9B /* XPWebViewController.m in Sources */,
E8AEAEF927141CA30017FCE0 /* XPRoomInfoContainerView.m in Sources */,
E8AEAEF927141CA30017FCE0 /* RoomHeaderView.m in Sources */,
E8AC721C26F4720B007D6E91 /* XPMineSettingPresent.m in Sources */,
E88B5CA526FB088600DA9178 /* XPMineTeenagerViewController.m in Sources */,
E8AEAEF027141C430017FCE0 /* XPRoomMenuContainerView.m in Sources */,

View File

@@ -22,6 +22,7 @@
- (void) pushNativeRoute:(NSString *) pageName arguments:(NSDictionary *) arguments {
BOOL animated = arguments[@"animated"] ? [arguments[@"animated"] boolValue] : YES;
BOOL present = arguments[@"present"] ? [arguments[@"present"] boolValue] : NO;
BOOL isRoomVC = [pageName isEqualToString:YYFlutterPushNavitePageChatRoom];
UIViewController *controller;
controller = [self getNaviteClassNameWithPageName:pageName arguments:arguments];
UIViewController * currentVC = [[FlutterBoost instance] currentViewController];
@@ -30,10 +31,9 @@
}
if (controller) {
if(present){
[self.navigationController presentViewController:controller animated:animated completion:^{
}];
}else{
if(present || isRoomVC){
[self.navigationController presentViewController:controller animated:animated completion:nil];
} else {
[self.navigationController pushViewController:controller animated:animated];
}
} else {
@@ -74,10 +74,12 @@
if ([pageName isEqualToString:YYFlutterPushNavitePageCharge]) {
return [[NSClassFromString(@"XPMineRechargeViewController") alloc] init];
} else if ([pageName isEqualToString:YYFlutterPushNavitePageChatRoom]) {
XPRoomViewController* room = [[XPRoomViewController alloc]init];
room.roomUid = arguments[@"chatRoomID"];
room.roomUid = @"1004699";
return room;
XPRoomViewController* roomVC = [[XPRoomViewController alloc]init];
roomVC.roomUid = arguments[@"chatRoomID"];
roomVC.roomUid = @"1004699";
BaseNavigationController * baseNav = [[BaseNavigationController alloc] initWithRootViewController:roomVC];
baseNav.modalPresentationStyle = UIModalPresentationFullScreen;
return baseNav;
}
// if([pageName isEqualToString:YYFlutterPushNavitePageBindPaymentPwd]){
// return [[NSClassFromString(@"TTPayPwdViewController") alloc] init];;

View File

@@ -21,6 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)getRoomInfoWithUid:(NSString *)uid;
- (void)enterNIMRoom:(NSString *)roomId user:(UserInfoModel*)userInfo;
- (void)exitNIMRoom:(NSString *)roomId;
/// 开启用户自己的房间
/// @param title 房间标题

View File

@@ -66,6 +66,10 @@
}];
}
- (void)exitNIMRoom:(NSString *)roomId {
[[NIMSDK sharedSDK].chatroomManager exitChatroom:roomId completion:nil];
}
///
/// @param title
/// @param type

View File

@@ -1,16 +0,0 @@
//
// 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

@@ -1,57 +0,0 @@
//
// XPRoomViewController+RoomInfo.m
// xplan-ios
//
// Created by on 2021/10/19.
//
#import "XPRoomViewController+RoomInfoContainerView.h"
///Tool
#import "TTPopup.h"
#import "XPHtmlUrl.h"
#import "XPIMManager.h"
///Model
#import "RoomInfoModel.h"
///VC
#import "XPWebViewController.h"
@implementation XPRoomViewController (RoomInfoContainerView)
- (void)configRoomInfoContainerViewWithRoomInfo:(RoomInfoModel *)roomInfo {
self.roomInfoContainerView.roomInfo = roomInfo;
}
#pragma mark - XPRoomInfoContainerView
- (void)xpRoomInfoContainerView:(XPRoomInfoContainerView *)view didClickBackButton:(UIButton *)sender {
///S1 退
[[XPIMManager shareManager].chatRoomManager exitChatRoom];
}
- (void)xpRoomInfoContainerView:(XPRoomInfoContainerView *)view didClickSettingButton:(UIButton *)sender {
TTActionSheetConfig *exitRoom = [TTActionSheetConfig normalTitle:@"退出房间" clickAction:^{
[[XPIMManager shareManager].chatRoomManager exitChatRoom];
}];
TTActionSheetConfig *reportRoom = [TTActionSheetConfig normalTitle:@"举报房间" clickAction:^{
[self pushReportRoomWebVC];
}];
[TTPopup actionSheetWithItems:@[exitRoom, reportRoom]];
}
#pragma mark - Private Method
- (void)pushReportRoomWebVC {
XPWebViewController *vc = [[XPWebViewController alloc]init];
NSString *urlstr = [NSString stringWithFormat:@"%@?reportUid=%ld&source=ROOM",URLWithType(kReportRoomURL),self.roomInfo.uid];
vc.url = urlstr;
[self.navigationController pushViewController:vc animated:YES];
}
@end

View File

@@ -0,0 +1,22 @@
//
// RoomGuestDelegate.h
// xplan-ios
//
// Created by apple on 2021/10/27.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol RoomGuestDelegate <NSObject>
@optional
- (void)onRoomUpdate;
- (void)onUserUpdate;
- (void)onRoomEntered;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,20 @@
//
// XPRoomInfoView.h
// xplan-ios
//
// Created by 冯硕 on 2021/10/11.
//
#import <UIKit/UIKit.h>
#import "RoomHostDelegate.h"
#import "RoomGuestDelegate.h"
NS_ASSUME_NONNULL_BEGIN
@interface RoomHeaderView : UIView<RoomGuestDelegate>
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -5,7 +5,7 @@
// Created by on 2021/10/11.
//
#import "XPRoomInfoContainerView.h"
#import "RoomHeaderView.h"
///Third
#import <Masonry/Masonry.h>
#import <MarqueeLabel.h>
@@ -15,10 +15,11 @@
#import "UIButton+EnlargeTouchArea.h"
#import "XPMacro.h"
#import "ThemeColor.h"
#import "TTPopup.h"
///Model
#import "RoomInfoModel.h"
@interface XPRoomInfoContainerView ()
@interface RoomHeaderView ()
///
@property (nonatomic,strong) UIButton *backButton;
///
@@ -43,13 +44,17 @@
@property (nonatomic,strong) UIButton *shareButton;
///
@property (nonatomic,strong) UIButton *settingButton;
@property (nonatomic, strong) id<RoomHostDelegate> hostDelegate;
@end
@implementation XPRoomInfoContainerView
@implementation RoomHeaderView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
self = [super init];
if (self) {
_hostDelegate = delegate;
[self initSubViews];
[self initSubViewConstraints];
}
@@ -58,9 +63,7 @@
#pragma mark - Response
- (void)backButtonAction:(UIButton *)sender {
if (self.delegate && [self.delegate respondsToSelector:@selector(xpRoomInfoContainerView:didClickBackButton:)]) {
[self.delegate xpRoomInfoContainerView:self didClickBackButton:sender];
}
[self.hostDelegate exitRoom];
}
- (void)shareButtonAction:(UIButton *)sender{
@@ -68,14 +71,18 @@
}
- (void)settingButtonAction:(UIButton *)sender {
if (self.delegate && [self.delegate respondsToSelector:@selector(xpRoomInfoContainerView:didClickSettingButton:)]) {
[self.delegate xpRoomInfoContainerView:self didClickSettingButton:sender];
}
TTActionSheetConfig *exitRoom = [TTActionSheetConfig normalTitle:@"退出房间" clickAction:^{
[self.hostDelegate exitRoom];
}];
TTActionSheetConfig *reportRoom = [TTActionSheetConfig normalTitle:@"举报房间" clickAction:^{
}];
[TTPopup actionSheetWithItems:@[exitRoom, reportRoom]];
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.backButton];
[self addSubview:self.nickStackView];
@@ -135,15 +142,13 @@
}];
}
#pragma mark - Getters And Setters
- (void)setRoomInfo:(RoomInfoModel *)roomInfo {
_roomInfo = roomInfo;
if (_roomInfo) {
self.titleLabel.text = _roomInfo.title;
self.idLabel.text = [NSString stringWithFormat:@"音游号:%ld %ld人在线", (long)_roomInfo.erbanNo, (long)(_roomInfo.onlineNum > 0 ? _roomInfo.onlineNum : 0)];
self.giftEffectImageView.hidden = !_roomInfo.hasAnimationEffect;
}
- (void)onRoomUpdate {
RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo;
if (roomInfo) {
self.titleLabel.text = roomInfo.title;
self.idLabel.text = [NSString stringWithFormat:@"音游号:%ld %ld人在线", (long)roomInfo.erbanNo, (long)(roomInfo.onlineNum > 0 ? roomInfo.onlineNum : 0)];
self.giftEffectImageView.hidden = !roomInfo.hasAnimationEffect;
}
}
- (UIButton *)backButton{
@@ -177,7 +182,6 @@
return _settingButton;
}
- (UIButton *)collectButton {
if (!_collectButton) {
_collectButton = [UIButton buttonWithType:UIButtonTypeCustom];
@@ -216,7 +220,6 @@
return _titleStackView;
}
- (MarqueeLabel *)titleLabel{
if (!_titleLabel) {
_titleLabel = [[MarqueeLabel alloc] init];
@@ -277,6 +280,4 @@
return _idLabel;
}
@end

View File

@@ -12,10 +12,11 @@ NS_ASSUME_NONNULL_BEGIN
@class RoomInfoModel;
@class UserInfoModel;
@protocol RoomDelegate <NSObject>
@protocol RoomHostDelegate <NSObject>
- (RoomInfoModel*)getRoomInfo;
- (UserInfoModel*)getUserInfo;
- (void)exitRoom;
@end

View File

@@ -1,28 +0,0 @@
//
// XPRoomInfoView.h
// xplan-ios
//
// Created by 冯硕 on 2021/10/11.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@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

@@ -6,7 +6,8 @@
//
#import <UIKit/UIKit.h>
#import "RoomDelegate.h"
#import "RoomHostDelegate.h"
#import "RoomGuestDelegate.h"
#import "MicroViewProtocol.h"
NS_ASSUME_NONNULL_BEGIN
@@ -36,9 +37,9 @@ NS_ASSUME_NONNULL_BEGIN
- (void)didSelectAtIndex:(NSInteger)index;
@end
@interface StageView : UIView<StageViewDelegate>
@interface StageView : UIView<StageViewDelegate, RoomGuestDelegate>
@property (nonatomic, strong) id<RoomDelegate> hostDelegate;
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
@end

View File

@@ -32,13 +32,17 @@
@property (nonatomic, strong) NSMutableArray *microViews;
@property (nonatomic, strong) NSMutableDictionary<NSString *, MicroQueueModel *> *micQueue;
@property (nonatomic, strong) id<RoomHostDelegate> hostDelegate;
@end
@implementation StageView
- (instancetype)init {
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
self = [super init];
if (self) {
_hostDelegate = delegate;
NSInteger microCount = self.countOfMircoView;
for (int i = 0; i < microCount; i++) {
UIView* microView = [self microViewForIndex:i];
@@ -51,27 +55,15 @@
[self.microViews insertObject:microView atIndex:i];
}
}
[self microQueueUpdated];
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(self.hightForStageView);
}];
[self microQueueUpdated];
}
return self;
}
/**
* hostDelegate
*
*/
- (void)setHostDelegate:(id<RoomDelegate>)hostDelegate {
if (_hostDelegate) {
return;
}
_hostDelegate = hostDelegate;
[self initRtcRoom];
}
- (void)initRtcRoom {
RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo;
@@ -130,6 +122,11 @@
[[RtcManager instance] broadcast:selfOnMicro];
}
#pragma mark - RoomGuestDelegate
- (void)onRoomEntered {
[self initRtcRoom];
}
#pragma mark - RtcDelegate -
- (void)usersSpeaking:(NSMutableArray *)uids {
for (NSString* uid in uids) {

View File

@@ -8,7 +8,7 @@
#import "MvpViewController.h"
NS_ASSUME_NONNULL_BEGIN
@class XPRoomBackContainerView,XPRoomInfoContainerView,XPRoomMessageContainerView,XPRoomMenuContainerView,XPRoomActivityContainerView, XPRoomPositionContainView, RoomInfoModel, UserInfoModel, SocialStageView;
@class XPRoomBackContainerView,RoomHeaderView,XPRoomMessageContainerView,XPRoomMenuContainerView,XPRoomActivityContainerView, XPRoomPositionContainView, RoomInfoModel, UserInfoModel, SocialStageView;
@interface XPRoomViewController : MvpViewController
///房间的Uid
@@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
///背景
@property (nonatomic,strong, readonly) XPRoomBackContainerView *backContainerView;
///房间信息
@property (nonatomic,strong, readonly) XPRoomInfoContainerView *roomInfoContainerView;
@property (nonatomic,strong, readonly) RoomHeaderView *roomHeaderView;
///坑位信息
@property (nonatomic,strong, readonly) SocialStageView *stageView;
///公屏

View File

@@ -20,23 +20,23 @@
#import "XPRoomBackContainerView.h"
#import "XPRoomMenuContainerView.h"
#import "XPRoomMessageContainerView.h"
#import "XPRoomInfoContainerView.h"
#import "RoomHeaderView.h"
#import "SocialStageView.h"
///P
#import "XPRoomPresenter.h"
#import "XPRoomProtocol.h"
#import "XPIMRoomDelegate.h"
#import "RoomDelegate.h"
///Category
#import "XPRoomViewController+RoomInfoContainerView.h"
#import "RoomHostDelegate.h"
#import "RoomGuestDelegate.h"
#import "XPIMManager.h"
@interface XPRoomViewController ()<XPRoomProtocol, XPIMRoomDelegate, RoomDelegate>
@interface XPRoomViewController ()<XPRoomProtocol, XPIMRoomDelegate, RoomHostDelegate>
///
@property (nonatomic,strong) XPRoomBackContainerView *backContainerView;
///
@property (nonatomic,strong) XPRoomInfoContainerView *roomInfoContainerView;
@property (nonatomic,strong) RoomHeaderView *roomHeaderView;
///
@property (nonatomic,strong) SocialStageView *stageView;
///
@@ -88,7 +88,7 @@
- (void)initSubViews {
[self.view addSubview:self.backContainerView];
[self.view addSubview:self.roomInfoContainerView];
[self.view addSubview:self.roomHeaderView];
[self.view addSubview:self.stageView];
[self.view addSubview:self.messageContainerView];
[self.view addSubview:self.menuContainerView];
@@ -100,14 +100,14 @@
make.edges.mas_equalTo(self.view);
}];
[self.roomInfoContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
[self.roomHeaderView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.mas_equalTo(self.view);
make.height.mas_equalTo(kNavigationHeight);
}];
[self.stageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.view);
make.top.mas_equalTo(self.roomInfoContainerView.mas_bottom);
make.top.mas_equalTo(self.roomHeaderView.mas_bottom);
}];
[self.messageContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -138,7 +138,7 @@
[[XPIMManager shareManager].chatRoomManager setCurrentRoomInfo:roomInfo];
NSString * uid = [AccountInfoStorage instance].getUid;
if (roomInfo.valid) {
[self configRoomInfoContainerViewWithRoomInfo:roomInfo]; // S1
[self.roomHeaderView onRoomUpdate]; // S1
[self.presenter getUserInfoWithUid:uid];
} else {
if ([self.roomUid isEqualToString:uid]) {
@@ -160,28 +160,18 @@
- (void)openRoomSuccess:(RoomInfoModel *)roomInfo {
self.roomInfo = roomInfo;
[self configRoomInfoContainerViewWithRoomInfo:roomInfo];
[self.roomHeaderView onRoomUpdate];
[self.presenter enterNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId] user:self.userInfo];
}
- (void)enterRoomSuccess {
[self.stageView setHostDelegate:self];
[self.stageView onRoomEntered];
}
- (void)enterRoomFail {
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)onExitChatRoomSuccess {
///
[[RtcManager instance] exitRoom];
[[RtcManager instance] destory];
///
// [[XPIMManager shareManager].microQueueManager setCurrentUserInfo:nil];
[[XPIMManager shareManager].chatRoomManager removeDelegate:self];
[self enterRoomFail];
}
#pragma mark - RoomDelegate
- (RoomInfoModel *)getRoomInfo {
return self.roomInfo;
@@ -191,6 +181,13 @@
return self.userInfo;
}
- (void)exitRoom {
[self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]];
[[RtcManager instance] exitRoom];
[[RtcManager instance] destory];
[self dismissViewControllerAnimated:YES completion:nil];
}
- (XPRoomBackContainerView *)backContainerView {
if (!_backContainerView) {
_backContainerView = [[XPRoomBackContainerView alloc] init];
@@ -198,17 +195,16 @@
return _backContainerView;
}
- (XPRoomInfoContainerView *)roomInfoContainerView {
if (!_roomInfoContainerView) {
_roomInfoContainerView = [[XPRoomInfoContainerView alloc] init];
_roomInfoContainerView.delegate = self;
- (RoomHeaderView *)roomHeaderView {
if (!_roomHeaderView) {
_roomHeaderView = [[RoomHeaderView alloc] initWithDelegate:self];
}
return _roomInfoContainerView;
return _roomHeaderView;
}
- (SocialStageView *)stageView {
if (!_stageView) {
_stageView = [[SocialStageView alloc] init];
_stageView = [[SocialStageView alloc] initWithDelegate:self];
}
return _stageView;
}