房间设置开启排麦关闭排麦
This commit is contained in:
@@ -203,6 +203,11 @@
|
||||
E83DB487274670DA00D8CBD1 /* XPRoomGiftBroadCastModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E83DB486274670DA00D8CBD1 /* XPRoomGiftBroadCastModel.m */; };
|
||||
E8412F9627795E34006E1101 /* XPRoomInviteFansView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8412F9527795E34006E1101 /* XPRoomInviteFansView.m */; };
|
||||
E8412F9927799249006E1101 /* InviteFansModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8412F9827799249006E1101 /* InviteFansModel.m */; };
|
||||
E8412FA22779BE8F006E1101 /* XPRoomSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8412FA12779BE8F006E1101 /* XPRoomSettingViewController.m */; };
|
||||
E8412FA62779BED1006E1101 /* XPRoomSettingTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8412FA52779BED1006E1101 /* XPRoomSettingTableViewCell.m */; };
|
||||
E8412FA92779C2ED006E1101 /* XPRoomSettingItemModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8412FA82779C2ED006E1101 /* XPRoomSettingItemModel.m */; };
|
||||
E8412FB02779CB4D006E1101 /* XPRoomSettingPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8412FAF2779CB4D006E1101 /* XPRoomSettingPresenter.m */; };
|
||||
E8412FB32779E285006E1101 /* Api+RoomSetting.m in Sources */ = {isa = PBXBuildFile; fileRef = E8412FB22779E285006E1101 /* Api+RoomSetting.m */; };
|
||||
E84150B827747B8B00A7F548 /* XPFirstRechargeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E84150B727747B8B00A7F548 /* XPFirstRechargeViewController.m */; };
|
||||
E84150BB27747BAF00A7F548 /* XPFirstRechargePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E84150BA27747BAF00A7F548 /* XPFirstRechargePresenter.m */; };
|
||||
E84150BF27747BD300A7F548 /* Api+FirstRecharge.m in Sources */ = {isa = PBXBuildFile; fileRef = E84150BE27747BD300A7F548 /* Api+FirstRecharge.m */; };
|
||||
@@ -792,6 +797,17 @@
|
||||
E8412F9527795E34006E1101 /* XPRoomInviteFansView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomInviteFansView.m; sourceTree = "<group>"; };
|
||||
E8412F9727799249006E1101 /* InviteFansModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InviteFansModel.h; sourceTree = "<group>"; };
|
||||
E8412F9827799249006E1101 /* InviteFansModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InviteFansModel.m; sourceTree = "<group>"; };
|
||||
E8412FA02779BE8F006E1101 /* XPRoomSettingViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomSettingViewController.h; sourceTree = "<group>"; };
|
||||
E8412FA12779BE8F006E1101 /* XPRoomSettingViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomSettingViewController.m; sourceTree = "<group>"; };
|
||||
E8412FA42779BED1006E1101 /* XPRoomSettingTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomSettingTableViewCell.h; sourceTree = "<group>"; };
|
||||
E8412FA52779BED1006E1101 /* XPRoomSettingTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomSettingTableViewCell.m; sourceTree = "<group>"; };
|
||||
E8412FA72779C2ED006E1101 /* XPRoomSettingItemModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomSettingItemModel.h; sourceTree = "<group>"; };
|
||||
E8412FA82779C2ED006E1101 /* XPRoomSettingItemModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomSettingItemModel.m; sourceTree = "<group>"; };
|
||||
E8412FAD2779CB2D006E1101 /* XPRoomSettingProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomSettingProtocol.h; sourceTree = "<group>"; };
|
||||
E8412FAE2779CB4D006E1101 /* XPRoomSettingPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomSettingPresenter.h; sourceTree = "<group>"; };
|
||||
E8412FAF2779CB4D006E1101 /* XPRoomSettingPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomSettingPresenter.m; sourceTree = "<group>"; };
|
||||
E8412FB12779E285006E1101 /* Api+RoomSetting.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+RoomSetting.h"; sourceTree = "<group>"; };
|
||||
E8412FB22779E285006E1101 /* Api+RoomSetting.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+RoomSetting.m"; sourceTree = "<group>"; };
|
||||
E84150B627747B8B00A7F548 /* XPFirstRechargeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPFirstRechargeViewController.h; sourceTree = "<group>"; };
|
||||
E84150B727747B8B00A7F548 /* XPFirstRechargeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPFirstRechargeViewController.m; sourceTree = "<group>"; };
|
||||
E84150B927747BAF00A7F548 /* XPFirstRechargePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPFirstRechargePresenter.h; sourceTree = "<group>"; };
|
||||
@@ -2254,6 +2270,72 @@
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E8412F9A2779BAC2006E1101 /* Setting */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E8412F9F2779BB03006E1101 /* Model */,
|
||||
E8412F9E2779BAF9006E1101 /* Api */,
|
||||
E8412F9D2779BAF2006E1101 /* View */,
|
||||
E8412F9C2779BAE6006E1101 /* Presenter */,
|
||||
E8412F9B2779BAD5006E1101 /* Protocol */,
|
||||
);
|
||||
path = Setting;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E8412F9B2779BAD5006E1101 /* Protocol */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E8412FAD2779CB2D006E1101 /* XPRoomSettingProtocol.h */,
|
||||
);
|
||||
path = Protocol;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E8412F9C2779BAE6006E1101 /* Presenter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E8412FAE2779CB4D006E1101 /* XPRoomSettingPresenter.h */,
|
||||
E8412FAF2779CB4D006E1101 /* XPRoomSettingPresenter.m */,
|
||||
);
|
||||
path = Presenter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E8412F9D2779BAF2006E1101 /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E8412FA32779BE9B006E1101 /* Cell */,
|
||||
E8412FA02779BE8F006E1101 /* XPRoomSettingViewController.h */,
|
||||
E8412FA12779BE8F006E1101 /* XPRoomSettingViewController.m */,
|
||||
);
|
||||
path = View;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E8412F9E2779BAF9006E1101 /* Api */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E8412FB12779E285006E1101 /* Api+RoomSetting.h */,
|
||||
E8412FB22779E285006E1101 /* Api+RoomSetting.m */,
|
||||
);
|
||||
path = Api;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E8412F9F2779BB03006E1101 /* Model */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E8412FA72779C2ED006E1101 /* XPRoomSettingItemModel.h */,
|
||||
E8412FA82779C2ED006E1101 /* XPRoomSettingItemModel.m */,
|
||||
);
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E8412FA32779BE9B006E1101 /* Cell */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E8412FA42779BED1006E1101 /* XPRoomSettingTableViewCell.h */,
|
||||
E8412FA52779BED1006E1101 /* XPRoomSettingTableViewCell.m */,
|
||||
);
|
||||
path = Cell;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E84150B027747A7400A7F548 /* FirstRecharge */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -2794,6 +2876,7 @@
|
||||
E8AEAED8271413530017FCE0 /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E8412F9A2779BAC2006E1101 /* Setting */,
|
||||
E84150B027747A7400A7F548 /* FirstRecharge */,
|
||||
E81C1B1327705EF00020D1E4 /* ArrangeMic */,
|
||||
E8A1E4462761F8EA00B294CA /* CandyTree */,
|
||||
@@ -3505,6 +3588,7 @@
|
||||
E8A1E44E2761F98600B294CA /* XPCandyTreeViewController.m in Sources */,
|
||||
E8AC723726F49982007D6E91 /* XPMineNotificaProtocol.h in Sources */,
|
||||
E896EFAC2771AEFE00AD2CC1 /* XPMineFriendTableViewCell.m in Sources */,
|
||||
E8412FA22779BE8F006E1101 /* XPRoomSettingViewController.m in Sources */,
|
||||
E89D60BD271D647A001F8895 /* XPRoomPresenter.m in Sources */,
|
||||
E80DE4072775665000BE5BCB /* XPFirstRechargeCollectionViewCell.m in Sources */,
|
||||
E8C6FFD72754BC61004DC9F0 /* XPHomeNavView.m in Sources */,
|
||||
@@ -3530,6 +3614,8 @@
|
||||
E8A03DE22762FA000098D9EA /* XPCandyTreeMoreView.m in Sources */,
|
||||
E8B825CA26EA1231009E8E9F /* LoginVerifCodeViewController.m in Sources */,
|
||||
189DD76226E60DDC00AB55B1 /* Api+Login.m in Sources */,
|
||||
E8412FA62779BED1006E1101 /* XPRoomSettingTableViewCell.m in Sources */,
|
||||
E8252FFB27688F0E002B3164 /* XPRoomRankViewController.m in Sources */,
|
||||
9B7D80502753AA9D003DAC0C /* UITableView+NIMScrollToBottom.m in Sources */,
|
||||
18E7B22626E8CDCF0064BC9B /* XplanFlutterBoostDelegate.m in Sources */,
|
||||
E8EEB8F326FC2050007C6EBA /* SDWaitingView.m in Sources */,
|
||||
@@ -3575,6 +3661,7 @@
|
||||
E84B0E3F2727EDF6008818C6 /* XPRoomMessageTableViewCell.m in Sources */,
|
||||
E82325FC274E4735003A3332 /* XPUserCardItemModel.m in Sources */,
|
||||
E80DE4102775C34E00BE5BCB /* XPFirstRechargeSuccessView.m in Sources */,
|
||||
E8412FB32779E285006E1101 /* Api+RoomSetting.m in Sources */,
|
||||
E8EEB8F226FC2050007C6EBA /* SDPhotoBrowser.m in Sources */,
|
||||
E81C27AB26EF2D920031E639 /* ThirdUserInfo.m in Sources */,
|
||||
E8788950273A699900BF1D57 /* ThemeColor+SendGift.m in Sources */,
|
||||
@@ -3635,6 +3722,7 @@
|
||||
E82325F2274E2DE6003A3332 /* XPUserCardViewController.m in Sources */,
|
||||
E8E70D8626F2F55C00F03460 /* XPMineAccountView.m in Sources */,
|
||||
E8C6FFCA27548120004DC9F0 /* XPHomePresenter.m in Sources */,
|
||||
E8412FB02779CB4D006E1101 /* XPRoomSettingPresenter.m in Sources */,
|
||||
E878893C273A54C300BF1D57 /* Api+Gift.m in Sources */,
|
||||
E81C279026EB314D0031E639 /* LoginForgetEditView.m in Sources */,
|
||||
E8DEC9A82764A68B0078CB70 /* Api+MoreMenu.m in Sources */,
|
||||
@@ -3818,6 +3906,7 @@
|
||||
E81C1B2C27706E5C0020D1E4 /* ArrangeMicModel.m in Sources */,
|
||||
E8788948273A55D000BF1D57 /* XPGiftBarView.m in Sources */,
|
||||
9BAA5FF0277A23F4007453F3 /* XPPermissionsViewController.m in Sources */,
|
||||
E8412FA92779C2ED006E1101 /* XPRoomSettingItemModel.m in Sources */,
|
||||
189DD58F26DF97E700AB55B1 /* LoginPresenter.m in Sources */,
|
||||
E896EFB22771C93B00AD2CC1 /* XPMineFriendNumberView.m in Sources */,
|
||||
E89DA67227008D59008483C1 /* WalletInfoModel.m in Sources */,
|
||||
|
6
xplan-ios/Assets.xcassets/Room/Setting/Contents.json
Normal file
6
xplan-ios/Assets.xcassets/Room/Setting/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
22
xplan-ios/Assets.xcassets/Room/Setting/room_setting_arrow.imageset/Contents.json
vendored
Normal file
22
xplan-ios/Assets.xcassets/Room/Setting/room_setting_arrow.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_setting_arrow@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_setting_arrow@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Room/Setting/room_setting_arrow.imageset/room_setting_arrow@2x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/Room/Setting/room_setting_arrow.imageset/room_setting_arrow@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 141 B |
BIN
xplan-ios/Assets.xcassets/Room/Setting/room_setting_arrow.imageset/room_setting_arrow@3x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/Room/Setting/room_setting_arrow.imageset/room_setting_arrow@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 236 B |
@@ -30,6 +30,12 @@ typedef NS_ENUM(NSInteger, RoomModeType){
|
||||
RoomModeType_Open_AcrossRoomPK_mode = 7,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, PermitRoomType) {
|
||||
PermitRoomType_Licnese = 1,//牌照
|
||||
PermitRoomType_YoungerStar = 3,//新秀
|
||||
PermitRoomType_Other//其他
|
||||
};
|
||||
|
||||
@interface CandyTreeSwitchModel : NSObject
|
||||
///幸运许愿池开关
|
||||
@property(nonatomic, assign) BOOL openBoxSwitch;
|
||||
@@ -66,7 +72,7 @@ typedef NS_ENUM(NSInteger, RoomModeType){
|
||||
@property (nonatomic , assign) NSInteger onlineNum;
|
||||
@property (nonatomic , assign) BOOL isCloseScreen;
|
||||
@property (nonatomic , assign) BOOL exceptionClose;
|
||||
@property (nonatomic , assign) NSInteger isPermitRoom;
|
||||
@property (nonatomic , assign) PermitRoomType isPermitRoom;
|
||||
@property (nonatomic , assign) NSInteger abChannelType;
|
||||
@property (nonatomic , assign) BOOL hasAnimationEffect;
|
||||
@property (nonatomic , assign) GenderType gender;
|
||||
|
@@ -104,7 +104,7 @@
|
||||
}
|
||||
break;
|
||||
case XPRoomMenuItemType_More: {
|
||||
XPRoomMoreMenuViewController * moreMenuVC = [[XPRoomMoreMenuViewController alloc] initRoomInfo:self.delegate.getRoomInfo];
|
||||
XPRoomMoreMenuViewController * moreMenuVC = [[XPRoomMoreMenuViewController alloc] initRoomInfo:self.delegate.getRoomInfo currentNav:self.delegate.getCurrentNav];
|
||||
[self.delegate.getCurrentNav presentViewController:moreMenuVC animated:YES completion:nil];
|
||||
}
|
||||
break;
|
||||
|
@@ -10,7 +10,7 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPRoomMoreMenuViewController : MvpViewController
|
||||
- (instancetype)initRoomInfo:(RoomInfoModel *)roomInfo;
|
||||
- (instancetype)initRoomInfo:(RoomInfoModel *)roomInfo currentNav:(UINavigationController *)currentNav;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -19,6 +19,7 @@
|
||||
///View
|
||||
#import "XPRoomMoreMenuCollectionViewCell.h"
|
||||
#import "XPRoomInviteFansView.h"
|
||||
#import "XPRoomSettingViewController.h"
|
||||
///P
|
||||
#import "XPMoreMenuPresenter.h"
|
||||
#import "XPMoreMenuProtocol.h"
|
||||
@@ -32,13 +33,16 @@
|
||||
@property (nonatomic,strong) NSArray<XPRoomMoreItemModel *> *datasource;
|
||||
///房间信息
|
||||
@property (nonatomic,strong) RoomInfoModel *roomInfo;
|
||||
///
|
||||
@property (nonatomic,weak) UINavigationController *currentNav;
|
||||
@end
|
||||
|
||||
@implementation XPRoomMoreMenuViewController
|
||||
|
||||
- (instancetype)initRoomInfo:(RoomInfoModel *)roomInfo {
|
||||
- (instancetype)initRoomInfo:(RoomInfoModel *)roomInfo currentNav:(UINavigationController *)currentNav{
|
||||
if (self = [super init]) {
|
||||
self.roomInfo = roomInfo;
|
||||
self.currentNav = currentNav;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -189,6 +193,13 @@
|
||||
[TTPopup popupView:inviteFansView style:TTPopupStyleActionSheet];
|
||||
}
|
||||
break;
|
||||
case RoomMoreMenuType_Room_Setting:
|
||||
{
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
XPRoomSettingViewController * roomsettingVC = [[XPRoomSettingViewController alloc] init];
|
||||
roomsettingVC.roomInfo = self.roomInfo;
|
||||
[self.currentNav pushViewController:roomsettingVC animated:YES];
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
45
xplan-ios/Main/Room/View/Setting/Api/Api+RoomSetting.h
Normal file
45
xplan-ios/Main/Room/View/Setting/Api/Api+RoomSetting.h
Normal file
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// Api+RoomSetting.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/12/27.
|
||||
//
|
||||
|
||||
#import "Api.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface Api (RoomSetting)
|
||||
|
||||
/// 获取房间信息
|
||||
/// @param complection 完成
|
||||
/// @param uid 用户的uid
|
||||
/// @param intoUid 自己的Uid 判断当前进房用户是否是平台超管 判断进房用户是否开启青少年
|
||||
+ (void)getRoomInfo:(HttpRequestHelperCompletion)complection uid:(NSString *)uid intoUid:(NSString *)intoUid;
|
||||
|
||||
/// 开启房间排麦
|
||||
/// @param completion 完成
|
||||
/// @param roomUid 房间的uid
|
||||
/// @param operUid 操作者的uid
|
||||
+ (void)openRoomArrangeMic:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid operUid:(NSString *)operUid;
|
||||
|
||||
/// 关闭房间排麦
|
||||
/// @param completion 完成
|
||||
/// @param roomUid 房间的uid
|
||||
/// @param operUid 操作者的uid
|
||||
+ (void)closeRoomArrangeMic:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid operUid:(NSString *)operUid;
|
||||
|
||||
/// 开启房间离开模式
|
||||
/// @param completion 完成
|
||||
/// @param roomUid 房间的uid
|
||||
/// @param uid 操作者的uid
|
||||
+ (void)openRoomLeaveMode:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid uid:(NSString *)uid;
|
||||
|
||||
/// 关闭房间离开模式
|
||||
/// @param completion 完成
|
||||
/// @param roomUid 房间的uid
|
||||
/// @param uid 操作者的uid
|
||||
+ (void)closeRoomLeaveMode:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid uid:(NSString *)uid;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
53
xplan-ios/Main/Room/View/Setting/Api/Api+RoomSetting.m
Normal file
53
xplan-ios/Main/Room/View/Setting/Api/Api+RoomSetting.m
Normal file
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// Api+RoomSetting.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/12/27.
|
||||
//
|
||||
|
||||
#import "Api+RoomSetting.h"
|
||||
|
||||
@implementation Api (RoomSetting)
|
||||
|
||||
/// 获取房间信息
|
||||
/// @param complection 完成
|
||||
/// @param uid 用户的uid
|
||||
/// @param intoUid 自己的Uid 判断当前进房用户是否是平台超管 判断进房用户是否开启青少年
|
||||
+ (void)getRoomInfo:(HttpRequestHelperCompletion)complection uid:(NSString *)uid intoUid:(NSString *)intoUid {
|
||||
[self makeRequest:@"room/get" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, uid, intoUid, nil];
|
||||
}
|
||||
|
||||
/// 开启房间排麦
|
||||
/// @param completion 完成
|
||||
/// @param roomUid 房间的uid
|
||||
/// @param operUid 操作者的uid
|
||||
+ (void)openRoomArrangeMic:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid operUid:(NSString *)operUid {
|
||||
[self makeRequest:@"room/queue/enable" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUid, operUid, nil];
|
||||
}
|
||||
|
||||
/// 关闭房间排麦
|
||||
/// @param completion 完成
|
||||
/// @param roomUid 房间的uid
|
||||
/// @param operUid 操作者的uid
|
||||
+ (void)closeRoomArrangeMic:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid operUid:(NSString *)operUid {
|
||||
[self makeRequest:@"room/queue/enable" method:HttpRequestHelperMethodDELETE completion:completion, __FUNCTION__, roomUid, operUid, nil];
|
||||
}
|
||||
|
||||
/// 开启房间离开模式
|
||||
/// @param completion 完成
|
||||
/// @param roomUid 房间的uid
|
||||
/// @param uid 操作者的uid
|
||||
+ (void)openRoomLeaveMode:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid uid:(NSString *)uid {
|
||||
[self makeRequest:@"room/leave/mode/open" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUid, uid, nil];
|
||||
}
|
||||
|
||||
/// 关闭房间离开模式
|
||||
/// @param completion 完成
|
||||
/// @param roomUid 房间的uid
|
||||
/// @param uid 操作者的uid
|
||||
+ (void)closeRoomLeaveMode:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid uid:(NSString *)uid {
|
||||
[self makeRequest:@"room/leave/mode/close" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUid, uid, nil];
|
||||
}
|
||||
|
||||
|
||||
@end
|
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// XPRoomSettingItemModel.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/12/27.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSInteger, RoomSettingItemType) {
|
||||
///房间标题
|
||||
RoomSettingItemType_Title = 1,
|
||||
///房间上锁
|
||||
RoomSettingItemType_Lock,
|
||||
///房间标签
|
||||
RoomSettingItemType_Tag,
|
||||
///管理员
|
||||
RoomSettingItemType_Manager_List,
|
||||
///黑名单
|
||||
RoomSettingItemType_Black_List,
|
||||
///礼物特效
|
||||
RoomSettingItemType_Gift_Effect,
|
||||
///公屏显示
|
||||
RoomSettingItemType_Message_Screen,
|
||||
///排麦
|
||||
RoomSettingItemType_Arrange_Mic,
|
||||
///排麦
|
||||
RoomSettingItemType_Leave_Model,
|
||||
};
|
||||
|
||||
@interface XPRoomSettingItemModel : NSObject
|
||||
///标题
|
||||
@property (nonatomic,copy)NSString *title;
|
||||
///副标题
|
||||
@property (nonatomic,copy) NSString *subTitle;
|
||||
///开启的状态
|
||||
@property (nonatomic,assign) BOOL switchState;
|
||||
///类型
|
||||
@property (nonatomic,assign) RoomSettingItemType type;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// XPRoomSettingItemModel.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/12/27.
|
||||
//
|
||||
|
||||
#import "XPRoomSettingItemModel.h"
|
||||
|
||||
@implementation XPRoomSettingItemModel
|
||||
|
||||
@end
|
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// XPRoomSettingPresenter.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/12/27.
|
||||
//
|
||||
|
||||
#import "BaseMvpPresenter.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class RoomInfoModel;
|
||||
@interface XPRoomSettingPresenter : BaseMvpPresenter
|
||||
///根据房间信息获取房间设置列表
|
||||
- (void)getRoomSettingList:(RoomInfoModel *)roomInfo;
|
||||
|
||||
///获取房间信息
|
||||
- (void)getRoomInfo:(NSString *)roomUid;
|
||||
|
||||
/// 开启排麦
|
||||
/// @param roomUid 房主的uid
|
||||
- (void)openRoomArrangeMic:(NSString *)roomUid;
|
||||
|
||||
/// 关闭排麦
|
||||
/// @param roomUid 房主的uid
|
||||
- (void)closeRoomArrangeMic:(NSString *)roomUid;
|
||||
|
||||
/// 关闭离开模式
|
||||
/// @param roomUid 房主的uid
|
||||
- (void)closeRoomLeaveMode:(NSString *)roomUid;
|
||||
|
||||
/// 开启离开模式
|
||||
/// @param roomUid 房主的uid
|
||||
- (void)openRoomLeaveMode:(NSString *)roomUid;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,148 @@
|
||||
//
|
||||
// XPRoomSettingPresenter.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/12/27.
|
||||
//
|
||||
|
||||
#import "XPRoomSettingPresenter.h"
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
///Tool
|
||||
#import "AccountInfoStorage.h"
|
||||
#import "Api+RoomSetting.h"
|
||||
///Model
|
||||
#import "RoomInfoModel.h"
|
||||
#import "XPRoomSettingItemModel.h"
|
||||
///P
|
||||
#import "XPRoomSettingProtocol.h"
|
||||
|
||||
@implementation XPRoomSettingPresenter
|
||||
|
||||
- (void)getRoomSettingList:(RoomInfoModel *)roomInfo {
|
||||
XPRoomSettingItemModel * titleItem = [[XPRoomSettingItemModel alloc] init];
|
||||
titleItem.title = @"房间名";
|
||||
titleItem.subTitle = roomInfo.title;
|
||||
titleItem.type = RoomSettingItemType_Title;
|
||||
|
||||
XPRoomSettingItemModel * lockItem = [[XPRoomSettingItemModel alloc] init];
|
||||
lockItem.title = @"房间上锁";
|
||||
lockItem.switchState = roomInfo.roomPwd.length > 0;
|
||||
lockItem.type = RoomSettingItemType_Lock;
|
||||
|
||||
XPRoomSettingItemModel *tagItem = [[XPRoomSettingItemModel alloc] init];
|
||||
tagItem.title = @"房间标签";
|
||||
tagItem.subTitle = roomInfo.roomTag;
|
||||
tagItem.type = RoomSettingItemType_Tag;
|
||||
|
||||
XPRoomSettingItemModel * managerItem = [[XPRoomSettingItemModel alloc] init];
|
||||
managerItem.title = @"管理员";
|
||||
managerItem.type = RoomSettingItemType_Manager_List;
|
||||
|
||||
XPRoomSettingItemModel * blackItem = [[XPRoomSettingItemModel alloc] init];
|
||||
blackItem.title = @"黑名单";
|
||||
blackItem.type = RoomSettingItemType_Black_List;
|
||||
|
||||
XPRoomSettingItemModel * giftEffectItem = [[XPRoomSettingItemModel alloc] init];
|
||||
giftEffectItem.title = @"房间礼物特效";
|
||||
giftEffectItem.switchState = roomInfo.hasAnimationEffect;
|
||||
giftEffectItem.type = RoomSettingItemType_Gift_Effect;
|
||||
|
||||
XPRoomSettingItemModel * messageScreedItem = [[XPRoomSettingItemModel alloc] init];
|
||||
messageScreedItem.title = @"房间公屏";
|
||||
messageScreedItem.switchState = roomInfo.isCloseScreen;
|
||||
messageScreedItem.type = RoomSettingItemType_Message_Screen;
|
||||
|
||||
XPRoomSettingItemModel * arrangeMicItem = [[XPRoomSettingItemModel alloc] init];
|
||||
arrangeMicItem.title = @"排麦模式";
|
||||
arrangeMicItem.switchState = roomInfo.roomModeType == RoomModeType_Open_Micro_Mode;
|
||||
arrangeMicItem.type = RoomSettingItemType_Arrange_Mic;
|
||||
|
||||
XPRoomSettingItemModel * leaveItem = [[XPRoomSettingItemModel alloc] init];
|
||||
leaveItem.title = @"离开模式";
|
||||
leaveItem.switchState = roomInfo.leaveMode;
|
||||
leaveItem.type = RoomSettingItemType_Leave_Model;
|
||||
|
||||
NSString * roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
///获取房间角色
|
||||
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
||||
request.roomId = roomId;
|
||||
request.userIds = @[uid];
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
||||
NSArray * array;
|
||||
if (error == nil) {
|
||||
NIMChatroomMember * member = members.firstObject;
|
||||
if (member.type == NIMChatroomMemberTypeCreator) {
|
||||
if (roomInfo.isPermitRoom == PermitRoomType_Licnese) {
|
||||
array = @[
|
||||
@[titleItem, lockItem],
|
||||
@[tagItem],
|
||||
@[managerItem, blackItem, giftEffectItem, messageScreedItem, arrangeMicItem, leaveItem]
|
||||
];
|
||||
} else {
|
||||
array = @[
|
||||
@[titleItem, lockItem],
|
||||
@[tagItem],
|
||||
@[managerItem, blackItem, giftEffectItem, messageScreedItem, arrangeMicItem]
|
||||
];
|
||||
}
|
||||
} else if(member.type == NIMTeamInviteModeManager) {
|
||||
array = @[
|
||||
@[titleItem, lockItem],
|
||||
@[tagItem],
|
||||
@[blackItem, giftEffectItem, messageScreedItem, arrangeMicItem]
|
||||
];
|
||||
}
|
||||
[[self getView] getRoomSettingListSuccess:array];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// 获取房间信息
|
||||
/// @param roomUid 房主的uid
|
||||
- (void)getRoomInfo:(NSString *)roomUid {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
[Api getRoomInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
RoomInfoModel * roomInfo = [RoomInfoModel modelWithDictionary:data.data];
|
||||
[[self getView] getRoomInfoSuccess:roomInfo];
|
||||
}] uid:roomUid intoUid:uid];
|
||||
}
|
||||
/// 开启排麦
|
||||
/// @param roomUid 房主的uid
|
||||
- (void)openRoomArrangeMic:(NSString *)roomUid {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
[Api openRoomArrangeMic:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] openRoomArrangeMicSuccess];
|
||||
}] roomUid:roomUid operUid:uid];
|
||||
}
|
||||
|
||||
/// 关闭排麦
|
||||
/// @param roomUid 房主的uid
|
||||
- (void)closeRoomArrangeMic:(NSString *)roomUid {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
[Api closeRoomArrangeMic:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] closeRoomArrangeMicSuccess];
|
||||
}] roomUid:roomUid operUid:uid];
|
||||
}
|
||||
|
||||
/// 开启离开模式
|
||||
/// @param roomUid 房主的uid
|
||||
- (void)openRoomLeaveMode:(NSString *)roomUid {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
[Api openRoomLeaveMode:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] openRoomArrangeMicSuccess];
|
||||
}] roomUid:roomUid uid:uid];
|
||||
}
|
||||
|
||||
/// 关闭离开模式
|
||||
/// @param roomUid 房主的uid
|
||||
- (void)closeRoomLeaveMode:(NSString *)roomUid {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
[Api closeRoomLeaveMode:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] closeRoomArrangeMicSuccess];
|
||||
}] roomUid:roomUid uid:uid];
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// XPRoomSettingProtocol.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/12/27.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol XPRoomSettingProtocol <NSObject>
|
||||
|
||||
///房间设置的列表数据
|
||||
- (void)getRoomSettingListSuccess:(NSArray *)list;
|
||||
///获取房间信息成功
|
||||
- (void)getRoomInfoSuccess:(RoomInfoModel *)roomInfo;
|
||||
///开启排麦成功
|
||||
- (void)openRoomArrangeMicSuccess;
|
||||
///关闭排麦成功
|
||||
- (void)closeRoomArrangeMicSuccess;
|
||||
|
||||
///开启离线成功
|
||||
- (void)openRoomLeaveModeSuccess;
|
||||
///关闭离线成功
|
||||
- (void)closeRoomLeaveModeSuccess;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// XPRoomSettingTableViewCell.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/12/27.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class XPRoomSettingItemModel;
|
||||
@protocol XPRoomSettingTableViewCellDelegate <NSObject>
|
||||
|
||||
///改变了switch的状态
|
||||
- (void)didChangeSwitch:(UISwitch *)switchView itemModel:(XPRoomSettingItemModel *)itemModel;
|
||||
|
||||
@end
|
||||
@interface XPRoomSettingTableViewCell : UITableViewCell
|
||||
|
||||
///显示
|
||||
@property (nonatomic,strong) XPRoomSettingItemModel *itemModel;
|
||||
///代理
|
||||
@property (nonatomic,weak) id<XPRoomSettingTableViewCellDelegate> delegate;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,153 @@
|
||||
//
|
||||
// XPRoomSettingTableViewCell.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/12/27.
|
||||
//
|
||||
|
||||
#import "XPRoomSettingTableViewCell.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor+Room.h"
|
||||
///Model
|
||||
#import "XPRoomSettingItemModel.h"
|
||||
|
||||
@interface XPRoomSettingTableViewCell ()
|
||||
///显示标题
|
||||
@property (nonatomic,strong) UILabel *titleLabel;
|
||||
///容器
|
||||
@property (nonatomic,strong) UIStackView *stackView;
|
||||
///副标题
|
||||
@property (nonatomic,strong) UILabel *subTitleLabel;
|
||||
///开关
|
||||
@property (nonatomic,strong) UISwitch *switchView;
|
||||
///箭头
|
||||
@property (nonatomic,strong) UIImageView *arrowImageView;
|
||||
///分割线
|
||||
@property (nonatomic,strong) UIView * lineView;
|
||||
@end
|
||||
|
||||
@implementation XPRoomSettingTableViewCell
|
||||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.backgroundColor = [ThemeColor appCellBackgroundColor];
|
||||
[self.contentView addSubview:self.titleLabel];
|
||||
[self.contentView addSubview:self.stackView];
|
||||
[self.contentView addSubview:self.lineView];
|
||||
|
||||
[self.stackView addArrangedSubview:self.subTitleLabel];
|
||||
[self.stackView addArrangedSubview:self.switchView];
|
||||
[self.stackView addArrangedSubview:self.arrowImageView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.contentView).offset(15);
|
||||
make.centerY.mas_equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(self.contentView).offset(-15);
|
||||
make.centerY.mas_equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.contentView).inset(15);
|
||||
make.bottom.mas_equalTo(0);
|
||||
make.height.mas_equalTo(0.5);
|
||||
}];
|
||||
}
|
||||
#pragma mark - Event Response
|
||||
- (void)switchDidChange:(UISwitch *)swtich {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didChangeSwitch:itemModel:)]) {
|
||||
[self.delegate didChangeSwitch:swtich itemModel:self.itemModel];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setItemModel:(XPRoomSettingItemModel *)itemModel {
|
||||
_itemModel = itemModel;
|
||||
self.titleLabel.text = _itemModel.title;
|
||||
if (_itemModel.type == RoomSettingItemType_Title || _itemModel.type == RoomSettingItemType_Tag || _itemModel.type == RoomSettingItemType_Black_List || _itemModel.type == RoomSettingItemType_Manager_List ) {
|
||||
self.switchView.hidden = YES;
|
||||
self.arrowImageView.hidden = NO;
|
||||
self.subTitleLabel.hidden = NO;
|
||||
self.subTitleLabel.text = _itemModel.subTitle.length > 0 ? _itemModel.subTitle : @"";
|
||||
} else {
|
||||
self.switchView.hidden = NO;
|
||||
self.arrowImageView.hidden = YES;
|
||||
self.subTitleLabel.hidden = YES;
|
||||
self.switchView.on = _itemModel.switchState;
|
||||
}
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (_titleLabel == nil) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.textColor = [ThemeColor mainTextColor];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:15];
|
||||
[_titleLabel setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
|
||||
- (UIStackView *)stackView {
|
||||
if (!_stackView) {
|
||||
_stackView = [[UIStackView alloc] init];
|
||||
_stackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_stackView.distribution = UIStackViewDistributionFill;
|
||||
_stackView.alignment = UIStackViewAlignmentCenter;
|
||||
_stackView.spacing = 8;
|
||||
}
|
||||
return _stackView;
|
||||
}
|
||||
|
||||
- (UIImageView *)arrowImageView {
|
||||
if (_arrowImageView == nil) {
|
||||
_arrowImageView = [[UIImageView alloc] init];
|
||||
_arrowImageView.image = [UIImage imageNamed:@"room_setting_arrow"];
|
||||
[_arrowImageView setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
|
||||
[_arrowImageView setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical];
|
||||
}
|
||||
return _arrowImageView;
|
||||
}
|
||||
|
||||
- (UIView *)lineView {
|
||||
if (!_lineView) {
|
||||
_lineView = [[UIView alloc] init];
|
||||
_lineView.backgroundColor = [ThemeColor dividerColor];
|
||||
}
|
||||
return _lineView;
|
||||
}
|
||||
|
||||
- (UISwitch *)switchView {
|
||||
if (!_switchView) {
|
||||
_switchView = [[UISwitch alloc] init];
|
||||
_switchView.onTintColor = [ThemeColor appEmphasizeColor];
|
||||
_switchView.tintColor = [ThemeColor appMainColor];
|
||||
_switchView.backgroundColor = [UIColor clearColor];
|
||||
[_switchView addTarget:self action:@selector(switchDidChange:) forControlEvents:UIControlEventValueChanged];
|
||||
}
|
||||
return _switchView;
|
||||
}
|
||||
|
||||
- (UILabel *)subTitleLabel {
|
||||
if (_subTitleLabel == nil) {
|
||||
_subTitleLabel = [[UILabel alloc] init];
|
||||
_subTitleLabel.textColor = [ThemeColor secondTextColor];
|
||||
_subTitleLabel.font = [UIFont systemFontOfSize:12];
|
||||
}
|
||||
return _subTitleLabel;
|
||||
}
|
||||
|
||||
|
||||
@end
|
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// XPRoomSettingViewController.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/12/27.
|
||||
//
|
||||
|
||||
#import "MvpViewController.h"
|
||||
#import "RoomHostDelegate.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class RoomInfoModel;
|
||||
@interface XPRoomSettingViewController : MvpViewController
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
|
||||
///房间信息
|
||||
@property (nonatomic,strong) RoomInfoModel *roomInfo;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,191 @@
|
||||
//
|
||||
// XPRoomSettingViewController.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/12/27.
|
||||
//
|
||||
|
||||
#import "XPRoomSettingViewController.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor+Room.h"
|
||||
#import "XPMacro.h"
|
||||
#import "TTPopup.h"
|
||||
///Model
|
||||
#import "RoomInfoModel.h"
|
||||
#import "XPRoomSettingItemModel.h"
|
||||
///View
|
||||
#import "XPRoomSettingTableViewCell.h"
|
||||
///P
|
||||
#import "XPRoomSettingPresenter.h"
|
||||
#import "XPRoomSettingProtocol.h"
|
||||
|
||||
@interface XPRoomSettingViewController ()<UITableViewDelegate, UITableViewDataSource, XPRoomSettingProtocol, XPRoomSettingTableViewCellDelegate>
|
||||
///列表
|
||||
@property (nonatomic,strong) UITableView *tableView;
|
||||
///数据源
|
||||
@property (nonatomic,strong) NSArray<NSArray *> *datasource;
|
||||
///代理
|
||||
@property (nonatomic,weak) id<RoomHostDelegate> hostDelegate;
|
||||
@end
|
||||
|
||||
@implementation XPRoomSettingViewController
|
||||
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
|
||||
if (self = [super init]) {
|
||||
self.hostDelegate = delegate;
|
||||
self.roomInfo = self.hostDelegate.getRoomInfo;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (XPRoomSettingPresenter *)createPresenter {
|
||||
return [[XPRoomSettingPresenter alloc] init];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid];
|
||||
[self.presenter getRoomInfo:roomUid];
|
||||
[self.presenter getRoomSettingList:self.roomInfo];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.title = @"房间设置";
|
||||
[self.view addSubview:self.tableView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.view);
|
||||
}];
|
||||
}
|
||||
#pragma mark - UITableViewDelegate And UITableViewDataSource
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||
return self.datasource.count;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return self.datasource[section].count;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
XPRoomSettingTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPRoomSettingTableViewCell class])];
|
||||
if (cell == nil) {
|
||||
cell = [[XPRoomSettingTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPRoomSettingTableViewCell class])];
|
||||
}
|
||||
cell.delegate = self;
|
||||
cell.itemModel = [[self.datasource objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return 50;
|
||||
}
|
||||
|
||||
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
|
||||
UIView * view = [[UIView alloc] init];
|
||||
view.frame = CGRectMake(0, 0, KScreenWidth, 10);
|
||||
view.backgroundColor = [UIColor clearColor];
|
||||
return view;
|
||||
}
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
|
||||
return 10;
|
||||
}
|
||||
|
||||
#pragma mark - XPRoomSettingTableViewCellDelegate
|
||||
- (void)didChangeSwitch:(UISwitch *)switchView itemModel:(XPRoomSettingItemModel *)itemModel {
|
||||
BOOL isOn = switchView.on;
|
||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid];
|
||||
switch (itemModel.type) {
|
||||
case RoomSettingItemType_Arrange_Mic:
|
||||
{
|
||||
if (self.roomInfo.roomModeType == RoomModeType_Open_Blind) return;
|
||||
NSString *msg;
|
||||
if (isOn) {
|
||||
msg = @"开启排麦模式要排队才能上麦,确定开启吗?";
|
||||
} else {
|
||||
msg = @"关闭排麦模式后会清空排麦列表哦,确定关闭吗?";
|
||||
}
|
||||
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
||||
config.title = @"提示";
|
||||
config.message = msg;
|
||||
config.shouldDismissOnBackgroundTouch = NO;
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
if (isOn) {
|
||||
[self.presenter openRoomArrangeMic:roomUid];
|
||||
}else {
|
||||
[self.presenter closeRoomArrangeMic:roomUid];
|
||||
}
|
||||
} cancelHandler:^{
|
||||
}];
|
||||
|
||||
}
|
||||
break;
|
||||
case RoomSettingItemType_Leave_Model:
|
||||
{
|
||||
if (!isOn) {
|
||||
[self.presenter closeRoomLeaveMode:roomUid];
|
||||
return;
|
||||
}
|
||||
|
||||
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
||||
config.message = @"开启离开模式后,房主会固定显示在房主位,确认开启吗?";
|
||||
config.shouldDismissOnBackgroundTouch = NO;
|
||||
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
//TODO: 判断麦位
|
||||
|
||||
} cancelHandler:^{
|
||||
}];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPRoomSettingProtocol
|
||||
- (void)getRoomSettingListSuccess:(NSArray *)list {
|
||||
self.datasource = list;
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
- (void)getRoomInfoSuccess:(RoomInfoModel *)roomInfo {
|
||||
self.roomInfo = roomInfo;
|
||||
[self.presenter getRoomSettingList:roomInfo];
|
||||
}
|
||||
|
||||
- (void)openRoomArrangeMicSuccess {
|
||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid];
|
||||
[self.presenter getRoomInfo:roomUid];
|
||||
}
|
||||
|
||||
- (void)closeRoomArrangeMicSuccess {
|
||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid];
|
||||
[self.presenter getRoomInfo:roomUid];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UITableView *)tableView {
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
[_tableView registerClass:[XPRoomSettingTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPRoomSettingTableViewCell class])];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
|
||||
@end
|
Reference in New Issue
Block a user