排麦的UI

This commit is contained in:
fengshuo
2021-12-20 19:23:00 +08:00
parent da56e1cae9
commit c4b58a33c4
26 changed files with 1187 additions and 3 deletions

View File

@@ -127,6 +127,13 @@
E81366F826F0C12A0076364C /* LoginFullInfoProtocol.h in Sources */ = {isa = PBXBuildFile; fileRef = E81366F726F0C0F60076364C /* LoginFullInfoProtocol.h */; };
E81366FC26F0D2980076364C /* UIButton+EnlargeTouchArea.m in Sources */ = {isa = PBXBuildFile; fileRef = E81366FA26F0D2980076364C /* UIButton+EnlargeTouchArea.m */; };
E816C11527608A7500C84014 /* XPRoomMiniManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E816C11427608A7500C84014 /* XPRoomMiniManager.m */; };
E81C1B1C27705F6B0020D1E4 /* XPArrangeMicPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E81C1B1B27705F6B0020D1E4 /* XPArrangeMicPresenter.m */; };
E81C1B1F27705F7A0020D1E4 /* XPArrangeMicViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E81C1B1E27705F7A0020D1E4 /* XPArrangeMicViewController.m */; };
E81C1B2227705F950020D1E4 /* Api+ArrangeMic.m in Sources */ = {isa = PBXBuildFile; fileRef = E81C1B2127705F950020D1E4 /* Api+ArrangeMic.m */; };
E81C1B262770663B0020D1E4 /* XPArrangeMicTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E81C1B252770663B0020D1E4 /* XPArrangeMicTableViewCell.m */; };
E81C1B29277069DD0020D1E4 /* XPArrangeMicEmptyTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E81C1B28277069DD0020D1E4 /* XPArrangeMicEmptyTableViewCell.m */; };
E81C1B2C27706E5C0020D1E4 /* ArrangeMicModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E81C1B2B27706E5C0020D1E4 /* ArrangeMicModel.m */; };
E81C1B2F277071670020D1E4 /* XPArrangeMicInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E81C1B2E277071670020D1E4 /* XPArrangeMicInfoModel.m */; };
E81C278C26EAFAF60031E639 /* Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = E81C278926EAFAF60031E639 /* Base64.m */; };
E81C278D26EAFAF60031E639 /* DESEncrypt.m in Sources */ = {isa = PBXBuildFile; fileRef = E81C278B26EAFAF60031E639 /* DESEncrypt.m */; };
E81C279026EB314D0031E639 /* LoginForgetEditView.m in Sources */ = {isa = PBXBuildFile; fileRef = E81C278F26EB314D0031E639 /* LoginForgetEditView.m */; };
@@ -611,6 +618,21 @@
E81366FB26F0D2980076364C /* UIButton+EnlargeTouchArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIButton+EnlargeTouchArea.h"; sourceTree = "<group>"; };
E816C11327608A7500C84014 /* XPRoomMiniManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMiniManager.h; sourceTree = "<group>"; };
E816C11427608A7500C84014 /* XPRoomMiniManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMiniManager.m; sourceTree = "<group>"; };
E81C1B1927705F4B0020D1E4 /* XPArrangeMicProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPArrangeMicProtocol.h; sourceTree = "<group>"; };
E81C1B1A27705F6B0020D1E4 /* XPArrangeMicPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPArrangeMicPresenter.h; sourceTree = "<group>"; };
E81C1B1B27705F6B0020D1E4 /* XPArrangeMicPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPArrangeMicPresenter.m; sourceTree = "<group>"; };
E81C1B1D27705F7A0020D1E4 /* XPArrangeMicViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPArrangeMicViewController.h; sourceTree = "<group>"; };
E81C1B1E27705F7A0020D1E4 /* XPArrangeMicViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPArrangeMicViewController.m; sourceTree = "<group>"; };
E81C1B2027705F950020D1E4 /* Api+ArrangeMic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+ArrangeMic.h"; sourceTree = "<group>"; };
E81C1B2127705F950020D1E4 /* Api+ArrangeMic.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+ArrangeMic.m"; sourceTree = "<group>"; };
E81C1B242770663B0020D1E4 /* XPArrangeMicTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPArrangeMicTableViewCell.h; sourceTree = "<group>"; };
E81C1B252770663B0020D1E4 /* XPArrangeMicTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPArrangeMicTableViewCell.m; sourceTree = "<group>"; };
E81C1B27277069DD0020D1E4 /* XPArrangeMicEmptyTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPArrangeMicEmptyTableViewCell.h; sourceTree = "<group>"; };
E81C1B28277069DD0020D1E4 /* XPArrangeMicEmptyTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPArrangeMicEmptyTableViewCell.m; sourceTree = "<group>"; };
E81C1B2A27706E5C0020D1E4 /* ArrangeMicModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ArrangeMicModel.h; sourceTree = "<group>"; };
E81C1B2B27706E5C0020D1E4 /* ArrangeMicModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ArrangeMicModel.m; sourceTree = "<group>"; };
E81C1B2D277071670020D1E4 /* XPArrangeMicInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPArrangeMicInfoModel.h; sourceTree = "<group>"; };
E81C1B2E277071670020D1E4 /* XPArrangeMicInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPArrangeMicInfoModel.m; sourceTree = "<group>"; };
E81C278826EAFAF60031E639 /* DESEncrypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DESEncrypt.h; sourceTree = "<group>"; };
E81C278926EAFAF60031E639 /* Base64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Base64.m; sourceTree = "<group>"; };
E81C278A26EAFAF60031E639 /* Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Base64.h; sourceTree = "<group>"; };
@@ -1835,6 +1857,76 @@
path = UIButton;
sourceTree = "<group>";
};
E81C1B1327705EF00020D1E4 /* ArrangeMic */ = {
isa = PBXGroup;
children = (
E81C1B1827705F2B0020D1E4 /* Model */,
E81C1B1727705F1F0020D1E4 /* Api */,
E81C1B1627705F190020D1E4 /* View */,
E81C1B1527705F130020D1E4 /* Presenter */,
E81C1B1427705F0A0020D1E4 /* Protocol */,
);
path = ArrangeMic;
sourceTree = "<group>";
};
E81C1B1427705F0A0020D1E4 /* Protocol */ = {
isa = PBXGroup;
children = (
E81C1B1927705F4B0020D1E4 /* XPArrangeMicProtocol.h */,
);
path = Protocol;
sourceTree = "<group>";
};
E81C1B1527705F130020D1E4 /* Presenter */ = {
isa = PBXGroup;
children = (
E81C1B1A27705F6B0020D1E4 /* XPArrangeMicPresenter.h */,
E81C1B1B27705F6B0020D1E4 /* XPArrangeMicPresenter.m */,
);
path = Presenter;
sourceTree = "<group>";
};
E81C1B1627705F190020D1E4 /* View */ = {
isa = PBXGroup;
children = (
E81C1B23277065F70020D1E4 /* Cell */,
E81C1B1D27705F7A0020D1E4 /* XPArrangeMicViewController.h */,
E81C1B1E27705F7A0020D1E4 /* XPArrangeMicViewController.m */,
);
path = View;
sourceTree = "<group>";
};
E81C1B1727705F1F0020D1E4 /* Api */ = {
isa = PBXGroup;
children = (
E81C1B2027705F950020D1E4 /* Api+ArrangeMic.h */,
E81C1B2127705F950020D1E4 /* Api+ArrangeMic.m */,
);
path = Api;
sourceTree = "<group>";
};
E81C1B1827705F2B0020D1E4 /* Model */ = {
isa = PBXGroup;
children = (
E81C1B2A27706E5C0020D1E4 /* ArrangeMicModel.h */,
E81C1B2B27706E5C0020D1E4 /* ArrangeMicModel.m */,
E81C1B2D277071670020D1E4 /* XPArrangeMicInfoModel.h */,
E81C1B2E277071670020D1E4 /* XPArrangeMicInfoModel.m */,
);
path = Model;
sourceTree = "<group>";
};
E81C1B23277065F70020D1E4 /* Cell */ = {
isa = PBXGroup;
children = (
E81C1B242770663B0020D1E4 /* XPArrangeMicTableViewCell.h */,
E81C1B252770663B0020D1E4 /* XPArrangeMicTableViewCell.m */,
E81C1B27277069DD0020D1E4 /* XPArrangeMicEmptyTableViewCell.h */,
E81C1B28277069DD0020D1E4 /* XPArrangeMicEmptyTableViewCell.m */,
);
path = Cell;
sourceTree = "<group>";
};
E81C278726EAFABF0031E639 /* Security */ = {
isa = PBXGroup;
children = (
@@ -2522,6 +2614,8 @@
E8AEAED8271413530017FCE0 /* View */ = {
isa = PBXGroup;
children = (
E81C1B1327705EF00020D1E4 /* ArrangeMic */,
E8252FEF27688808002B3164 /* RoomRank */,
E8A1E4462761F8EA00B294CA /* CandyTree */,
E8DEC9962764A51F0078CB70 /* MoreView */,
E838D99D275E1B6C0079E0B5 /* AnimationView */,
@@ -3232,6 +3326,7 @@
E8C6FFD42754AA87004DC9F0 /* XPNoteView.m in Sources */,
E82325F9274E2E42003A3332 /* Api+UserCard.m in Sources */,
E82109B026F1D83500FC3319 /* LoginBindPhonePresent.m in Sources */,
E81C1B1F27705F7A0020D1E4 /* XPArrangeMicViewController.m in Sources */,
E8B825C726EA0D9A009E8E9F /* LoginVerifCodeProtocol.h in Sources */,
E824544E26F5BC1A00BE8163 /* XPMineModifPayPwdView.m in Sources */,
E8A03DE22762FA000098D9EA /* XPCandyTreeMoreView.m in Sources */,
@@ -3257,6 +3352,7 @@
E87A26FD27587E17002DDC7A /* HomeTagModel.m in Sources */,
E8E70D8926F2F58F00F03460 /* XPMineMatchTableViewCell.m in Sources */,
E88B5CA826FB089C00DA9178 /* XPMineTeenagePwdViewController.m in Sources */,
E81C1B2F277071670020D1E4 /* XPArrangeMicInfoModel.m in Sources */,
E81C279626EB39CC0031E639 /* LoginForgetPasswordPresent.m in Sources */,
18EE3FF42750FA3700A452BF /* UIView+NIM.m in Sources */,
E8A03DFF27635F960098D9EA /* XPRoomCandyGiftView.m in Sources */,
@@ -3272,6 +3368,7 @@
E8EEB91D26FC9D58007C6EBA /* XPMineUserInfoDateView.m in Sources */,
E82325E9274CE56A003A3332 /* XPShareItem.m in Sources */,
E890BC0D273D09A50007C46B /* XPGiftCountView.m in Sources */,
E81C1B262770663B0020D1E4 /* XPArrangeMicTableViewCell.m in Sources */,
E8AC722F26F49610007D6E91 /* XPMineNotificationItemModel.m in Sources */,
E8E70D7A26F2F16600F03460 /* XPMinePresent.m in Sources */,
E8A1E45B27620F4900B294CA /* XPRoomHalfWebView.m in Sources */,
@@ -3321,6 +3418,7 @@
1808073027315E8E001FD836 /* NetImageView.m in Sources */,
18486235271EB794005FC5DC /* AgoraRtcImpl.m in Sources */,
E8A1E454276208E500B294CA /* CandyTreeInfoModel.m in Sources */,
E81C1B1C27705F6B0020D1E4 /* XPArrangeMicPresenter.m in Sources */,
184862CE27213FD7005FC5DC /* ZegoRtcImpl.m in Sources */,
9B0E1C5926E77022005D4442 /* BaseNavigationController.m in Sources */,
E8C6FFD027548256004DC9F0 /* XPHomeListCollectionViewCell.m in Sources */,
@@ -3404,6 +3502,7 @@
18F404BB2760982000A6C548 /* ChatLimitModel.m in Sources */,
189DD56526DE465A00AB55B1 /* LoginViewController.m in Sources */,
E824544B26F5BBB800BE8163 /* XPMineModifPayPwdViewController.m in Sources */,
E81C1B2227705F950020D1E4 /* Api+ArrangeMic.m in Sources */,
E8A1E4512762082A00B294CA /* Api+CandyTree.m in Sources */,
E839533C276A0CCD00CF2F24 /* XPMineCarTableViewCell.m in Sources */,
E8EEB8FE26FC2DF8007C6EBA /* XPMineUserInfoCustomNavView.m in Sources */,
@@ -3415,6 +3514,7 @@
E8AC723A26F49AAE007D6E91 /* XPMineNotifyStatus.m in Sources */,
18E7B33226F317A20064BC9B /* XPWebViewController.m in Sources */,
E8AEAEF927141CA30017FCE0 /* RoomHeaderView.m in Sources */,
E81C1B29277069DD0020D1E4 /* XPArrangeMicEmptyTableViewCell.m in Sources */,
E8AC721C26F4720B007D6E91 /* XPMineSettingPresent.m in Sources */,
E88B5CA526FB088600DA9178 /* XPMineTeenagerViewController.m in Sources */,
E8AEAEF027141C430017FCE0 /* XPRoomMenuContainerView.m in Sources */,
@@ -3499,6 +3599,7 @@
189DD53F26DE255600AB55B1 /* main.m in Sources */,
E8A03DF927634A590098D9EA /* CandyTreeResultModel.m in Sources */,
E872308D26E89DAA00B90D4F /* LoginInputView.m in Sources */,
E81C1B2C27706E5C0020D1E4 /* ArrangeMicModel.m in Sources */,
E8788948273A55D000BF1D57 /* XPGiftBarView.m in Sources */,
9BAA5FF0277A23F4007453F3 /* XPPermissionsViewController.m in Sources */,
189DD58F26DF97E700AB55B1 /* LoginPresenter.m in Sources */,

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_menu_arrange_mic@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_menu_arrange_mic@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 966 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_menu_arrange_mic_new@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_menu_arrange_mic_new@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -28,6 +28,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) {
CustomMessageType_Secretary = 19,
///糖果树
CustomMessageType_Candy_Tree = 26,
///排麦
CustomMessageType_Arrange_Mic = 30,
///房间礼物值
CustomMessageType_Room_GiftValue = 42,
///福袋消息
@@ -113,6 +115,23 @@ typedef NS_ENUM(NSUInteger, CustomMessageSubCandyTree) {
//暴击的没用 不写了
};
///first = CustomMessageType_Arrange_Mic
typedef NS_ENUM(NSUInteger, CustomNotiHeaderArrangeMic) {
///队列从无人排麦到有人排麦
Custom_Message_Sub_Arrange_Mic_Non_Empty= 301,
///队列从有人排麦到无人排麦
Custom_Message_Sub_Arrange_Mic_Empty= 302,
///开启排麦
Custom_Message_Sub_Arrange_Mic_Mode_Open= 303,
///关闭排麦
Custom_Message_Sub_Arrange_Mic_Mode_Close= 304,
///将坑位设置成自由麦
Custom_Message_Sub_Arrange_Mic_Free_Mic_Open= 305,
///将坑位设置为排麦
Custom_Message_Sub_Arrange_Mic_Free_Mic_Close= 306,
};
///first = CustomMessageType_Room_GiftValue
typedef NS_ENUM(NSUInteger, CustomMessageSubRoomGiftValue) {
///礼物值同步

View File

@@ -0,0 +1,37 @@
//
// Api+ArrangeMic.h
// xplan-ios
//
// Created by 冯硕 on 2021/12/20.
//
#import "Api.h"
NS_ASSUME_NONNULL_BEGIN
@interface Api (ArrangeMic)
/// 获取房间排麦列表
/// @param completion 完成
/// @param roomUid 房间的uid
/// @param operUid 操作者的uid
/// @param page 当前的页数
/// @param pageSize 一页多少个
+ (void)getRoomArrangeMicList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid operUid:(NSString *)operUid page:(NSString *)page pageSize:(NSString *)pageSize;
/// 申请排麦
/// @param completion 完成
/// @param roomUid 房主的uid
/// @param operUid 操作者的uid
/// @param groupType 类型
+ (void)applyArrangeMic:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid operUid:(NSString *)operUid groupType:(NSString *)groupType;
/// 取消排麦
/// @param completion 完成
/// @param roomUid 房主的uid
/// @param operUid 操作者的uid
/// @param groupType 类型
+ (void)cancelArrangeMic:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid operUid:(NSString *)operUid groupType:(NSString *)groupType;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,42 @@
//
// Api+ArrangeMic.m
// xplan-ios
//
// Created by on 2021/12/20.
//
#import "Api+ArrangeMic.h"
@implementation Api (ArrangeMic)
///
/// @param completion
/// @param roomUid uid
/// @param operUid uid
/// @param page
/// @param pageSize
+ (void)getRoomArrangeMicList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid operUid:(NSString *)operUid page:(NSString *)page pageSize:(NSString *)pageSize {
[self makeRequest:@"room/queue/list" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, roomUid, operUid,page, pageSize, nil];
}
///
/// @param completion
/// @param roomUid uid
/// @param operUid uid
/// @param groupType
+ (void)applyArrangeMic:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid operUid:(NSString *)operUid groupType:(NSString *)groupType {
[self makeRequest:@"room/queue" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUid, operUid, groupType, nil];
}
///
/// @param completion
/// @param roomUid uid
/// @param operUid uid
/// @param groupType
+ (void)cancelArrangeMic:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid operUid:(NSString *)operUid groupType:(NSString *)groupType {
[self makeRequest:@"room/queue" method:HttpRequestHelperMethodDELETE completion:completion, __FUNCTION__, roomUid, operUid, groupType, nil];
}
@end

View File

@@ -0,0 +1,35 @@
//
// ArrangeMicModel.h
// xplan-ios
//
// Created by 冯硕 on 2021/12/20.
//
#import <Foundation/Foundation.h>
#import "XPEnum.h"
NS_ASSUME_NONNULL_BEGIN
@class ArrangeMicUserModel;
@interface ArrangeMicModel : NSObject
///参与排麦人数
@property (nonatomic, strong) NSString * count;
///我的排麦位置
@property (nonatomic, strong) NSString * myPos;
///排麦的人
@property (nonatomic,copy) NSArray<ArrangeMicUserModel *> *queue;
@end
@interface ArrangeMicUserModel : NSObject
///uid
@property (nonatomic,copy) NSString * uid;
///性别
@property (nonatomic,assign) GenderType gender;
///头像
@property (nonatomic,copy) NSString *avatar;
///名字
@property (nonatomic,copy) NSString *nick;
///当前的编号
@property (nonatomic,assign) NSInteger number;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,23 @@
//
// ArrangeMicModel.m
// xplan-ios
//
// Created by on 2021/12/20.
//
#import "ArrangeMicModel.h"
@implementation ArrangeMicModel
+ (NSDictionary *)objectClassInArray {
return @{@"queue":ArrangeMicUserModel.class};
}
@end
@implementation ArrangeMicUserModel
@end

View File

@@ -0,0 +1,24 @@
//
// XPArrangeMicInfoModel.h
// xplan-ios
//
// Created by 冯硕 on 2021/12/20.
//
#import <Foundation/Foundation.h>
#import "MicroQueueModel.h"
#import "MicroStateModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPArrangeMicInfoModel : NSObject
///房间id
@property (nonatomic,copy) NSString *roomId;
///房主的uid
@property (nonatomic,copy) NSString *roomUid;
///需要抱上麦的
@property (nonatomic, strong) NSMutableDictionary<NSString *, MicroQueueModel *> *micQueue;
///用户类型
@property (nonatomic,assign) BOOL isManager;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// XPArrangeMicInfoModel.m
// xplan-ios
//
// Created by on 2021/12/20.
//
#import "XPArrangeMicInfoModel.h"
@implementation XPArrangeMicInfoModel
@end

View File

@@ -0,0 +1,28 @@
//
// XPArrangeMicPresenter.h
// xplan-ios
//
// Created by 冯硕 on 2021/12/20.
//
#import "BaseMvpPresenter.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPArrangeMicPresenter : BaseMvpPresenter
/// 获取房间排麦列表
/// @param roomUid 房主的uid
/// @param page 当前的页数
/// @param pageSize 一页的个数
/// @param state 顶部刷新还是尾部刷新
- (void)getRoomArrangeMicList:(NSString *)roomUid page:(int)page pageSize:(int)pageSize state:(int)state;
/// 申请排麦
/// @param roomUid 房主的uid
- (void)applyRoomArrangeMic:(NSString *)roomUid;
/// 取消申请排麦
/// @param roomUid 房主的uid
- (void)cancelRoomArrangeMic:(NSString *)roomUid;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,50 @@
//
// XPArrangeMicPresenter.m
// xplan-ios
//
// Created by on 2021/12/20.
//
#import "XPArrangeMicPresenter.h"
#import "Api+ArrangeMic.h"
#import "AccountInfoStorage.h"
#import "ArrangeMicModel.h"
#import "XPArrangeMicProtocol.h"
@implementation XPArrangeMicPresenter
///
/// @param roomUid uid
/// @param page
/// @param pageSize
/// @param state
- (void)getRoomArrangeMicList:(NSString *)roomUid page:(int)page pageSize:(int)pageSize state:(int)state {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * pageStr = [NSString stringWithFormat:@"%d", page];
NSString * pageSizeStr = [NSString stringWithFormat:@"%d", pageSize];
[Api getRoomArrangeMicList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
ArrangeMicModel * model = [ArrangeMicModel modelWithDictionary:data.data];
[[self getView] getRoomArrangeMicListSuccess:model state:state];
} showLoading:YES] roomUid:roomUid operUid:uid page:pageStr pageSize:pageSizeStr];
}
///
/// @param roomUid uid
- (void)applyRoomArrangeMic:(NSString *)roomUid {
NSString * uid = [AccountInfoStorage instance].getUid;
[Api applyArrangeMic:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] applyArrangeMicSuccess];
} showLoading:YES] roomUid:roomUid operUid:uid groupType:@"0"];
}
///
/// @param roomUid uid
- (void)cancelRoomArrangeMic:(NSString *)roomUid {
NSString * uid = [AccountInfoStorage instance].getUid;
[Api cancelArrangeMic:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] cancelArrangeMicSuccess];
} showLoading:YES] roomUid:roomUid operUid:uid groupType:@"0"];
}
@end

View File

@@ -0,0 +1,22 @@
//
// XPArrangeMicProtocol.h
// xplan-ios
//
// Created by 冯硕 on 2021/12/20.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class ArrangeMicModel;
@protocol XPArrangeMicProtocol <NSObject>
///获取排麦列表
- (void)getRoomArrangeMicListSuccess:(ArrangeMicModel *)listModel state:(int)state;
///申请排麦成功
- (void)applyArrangeMicSuccess;
///取消排麦成功
- (void)cancelArrangeMicSuccess;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,17 @@
//
// XPArrangeMicEmptyTableViewCell.h
// xplan-ios
//
// Created by 冯硕 on 2021/12/20.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPArrangeMicEmptyTableViewCell : UITableViewCell
///空白的文案
@property (nonatomic,copy) NSString *emptyTitle;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,80 @@
//
// XPArrangeMicEmptyTableViewCell.m
// xplan-ios
//
// Created by on 2021/12/20.
//
#import "XPArrangeMicEmptyTableViewCell.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "UIImageConstant.h"
@interface XPArrangeMicEmptyTableViewCell ()
@property (nonatomic,strong) UIImageView *emptyImageView;
@property (nonatomic,strong) UILabel *titleLabel;
@end
@implementation XPArrangeMicEmptyTableViewCell
- (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.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.emptyImageView];
[self.contentView addSubview:self.titleLabel];
}
- (void)initSubViewConstraints {
[self.emptyImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.contentView);
make.top.mas_equalTo(self.contentView).offset(50);
make.size.mas_equalTo(CGSizeMake(100, 100));
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.emptyImageView.mas_bottom).offset(20);
make.left.right.mas_equalTo(self.contentView);
}];
}
#pragma mark - Getters And Setters
- (void)setEmptyTitle:(NSString *)emptyTitle {
_emptyTitle = emptyTitle;
if (_emptyTitle.length > 0) {
self.titleLabel.text = _emptyTitle;
}
}
- (UIImageView *)emptyImageView {
if (!_emptyImageView) {
_emptyImageView = [[UIImageView alloc] init];
_emptyImageView.userInteractionEnabled = YES;
_emptyImageView.image = [UIImageConstant defalutEmptyPlaceholder];
_emptyImageView.layer.masksToBounds = YES;
_emptyImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _emptyImageView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.text = @"暂无数据";
_titleLabel.numberOfLines = 2;
_titleLabel.font = [UIFont systemFontOfSize:16];
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.textColor = [ThemeColor secondTextColor];
}
return _titleLabel;
}
@end

View File

@@ -0,0 +1,26 @@
//
// XPArrangeMicTableViewCell.h
// xplan-ios
//
// Created by 冯硕 on 2021/12/20.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class XPArrangeMicTableViewCell, ArrangeMicUserModel;
@protocol XPArrangeMicTableViewCellDelegate <NSObject>
- (void)xPArrangeMicTableViewCell:(XPArrangeMicTableViewCell *)view inviteUser:(NSString *)uid;
@end
@interface XPArrangeMicTableViewCell : UITableViewCell
///是否是管理
@property (nonatomic,assign) BOOL isManager;
///代理
@property (nonatomic,weak) id<XPArrangeMicTableViewCellDelegate> delegate;
///用户信息
@property (nonatomic,strong) ArrangeMicUserModel *userInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,155 @@
//
// XPArrangeMicTableViewCell.m
// xplan-ios
//
// Created by on 2021/12/20.
//
#import "XPArrangeMicTableViewCell.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "NetImageView.h"
#import "UIImage+Utils.h"
///Model
#import "ArrangeMicModel.h"
@interface XPArrangeMicTableViewCell()
///
@property (nonatomic, strong) UILabel * rankLabel;
///
@property (nonatomic, strong) NetImageView * avaratImageView;
///
@property (nonatomic, strong) UILabel * nameLabel;
///
@property (nonatomic,strong) UIImageView *sexImageView;
///
@property (nonatomic, strong) UIButton * arrangeMicButton;
@end
@implementation XPArrangeMicTableViewCell
#pragma mark - life cycle
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self initView];
[self initConstrations];
}
return self;
}
#pragma mark - private method
- (void)initView{
self.backgroundColor = [UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.rankLabel];
[self.contentView addSubview:self.avaratImageView];
[self.contentView addSubview:self.nameLabel];
[self.contentView addSubview:self.sexImageView];
[self.contentView addSubview:self.arrangeMicButton];
}
- (void)initConstrations{
[self.rankLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.contentView);
make.left.mas_equalTo(self.contentView).offset(15);
make.width.height.mas_equalTo(20);
}];
[self.avaratImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.width.mas_equalTo(46);
make.centerY.mas_equalTo(self.contentView);
make.left.mas_equalTo(self.rankLabel.mas_right).offset(13);
}];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.avaratImageView.mas_right).offset(10);
make.centerY.mas_equalTo(self.contentView);
}];
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(12, 12));
make.left.mas_equalTo(self.nameLabel.mas_right).offset(2);
make.centerY.mas_equalTo(self.nameLabel);
}];
[self.arrangeMicButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(69);
make.height.mas_equalTo(25);
make.right.mas_equalTo(self.contentView).offset(-15);
make.centerY.mas_equalTo(self.contentView);
}];
}
#pragma mark - Event Response
- (void)arrangeMicButtonAction:(UIButton *)sender {
if (self.isManager && self.delegate && [self.delegate respondsToSelector:@selector(xPArrangeMicTableViewCell:inviteUser:)]) {
[self.delegate xPArrangeMicTableViewCell:self inviteUser:self.userInfo.uid];
}
}
#pragma mark - setters and getters
- (void)setUserInfo:(ArrangeMicUserModel *)userInfo {
_userInfo = userInfo;
if (_userInfo) {
self.nameLabel.text= _userInfo.nick;
self.avaratImageView.imageUrl = _userInfo.avatar;
self.rankLabel.text = [NSString stringWithFormat:@"%ld", _userInfo.number];
if (self.isManager) {
[self.arrangeMicButton setTitle:@"抱上麦" forState:UIControlStateNormal];
[self.arrangeMicButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
[self.arrangeMicButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
}else {
[self.arrangeMicButton setTitle:@"排麦中" forState:UIControlStateNormal];
[self.arrangeMicButton setTitleColor:[ThemeColor disableButtonTextColor] forState:UIControlStateNormal];
[self.arrangeMicButton setBackgroundImage:[UIImage imageWithColor:[ThemeColor disableButtonColor]] forState:UIControlStateNormal];
}
}
}
- (UILabel *)rankLabel{
if (!_rankLabel) {
_rankLabel = [[UILabel alloc] init];
_rankLabel.textColor = [ThemeColor mainTextColor];
_rankLabel.font = [UIFont systemFontOfSize:13];
_rankLabel.backgroundColor = [ThemeColor appMainColor];
_rankLabel.textAlignment = NSTextAlignmentCenter;
_rankLabel.layer.masksToBounds = YES;
_rankLabel.layer.cornerRadius = 10;
}
return _rankLabel;
}
- (UILabel *)nameLabel{
if (!_nameLabel) {
_nameLabel = [[UILabel alloc] init];
_nameLabel.textColor = [ThemeColor mainTextColor];
_nameLabel.font = [UIFont systemFontOfSize:15];
_nameLabel.textAlignment = NSTextAlignmentLeft;
}
return _nameLabel;
}
- (UIButton *)arrangeMicButton{
if (!_arrangeMicButton) {
_arrangeMicButton = [UIButton buttonWithType:UIButtonTypeCustom];;
_arrangeMicButton.titleLabel.font = [UIFont systemFontOfSize:13];
_arrangeMicButton.layer.masksToBounds = YES;
_arrangeMicButton.layer.cornerRadius = 25/ 2;
[_arrangeMicButton addTarget:self action:@selector(arrangeMicButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _arrangeMicButton;
}
- (NetImageView *)avaratImageView{
if (!_avaratImageView) {
NetImageConfig * config = [[NetImageConfig alloc] init];
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
config.imageType = ImageTypeUserIcon;
_avaratImageView = [[NetImageView alloc] initWithConfig:config];
_avaratImageView.layer.masksToBounds = YES;
_avaratImageView.layer.cornerRadius = 23;
}
return _avaratImageView;
}
@end

View File

@@ -0,0 +1,18 @@
//
// XPArrangeMicViewController.h
// xplan-ios
//
// Created by 冯硕 on 2021/12/20.
//
#import "MvpViewController.h"
#import "XPArrangeMicInfoModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPArrangeMicViewController : MvpViewController
- (instancetype)initWithInfo:(XPArrangeMicInfoModel *)info;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,393 @@
//
// XPArrangeMicViewController.m
// xplan-ios
//
// Created by on 2021/12/20.
//
#import "XPArrangeMicViewController.h"
///Third
#import <Masonry/Masonry.h>
#import <MJRefresh/MJRefresh.h>
#import <NIMSDK/NIMSDK.h>
///Tool
#import "TTPopup.h"
#import "ThemeColor.h"
#import "XPMacro.h"
#import "UIImage+Utils.h"
///Model
#import "ArrangeMicModel.h"
#import "AttachmentModel.h"
///View
#import "XPArrangeMicEmptyTableViewCell.h"
#import "XPArrangeMicTableViewCell.h"
///P
#import "XPArrangeMicPresenter.h"
#import "XPArrangeMicProtocol.h"
@interface XPArrangeMicViewController ()<UITableViewDelegate, UITableViewDataSource, XPArrangeMicTableViewCellDelegate,XPArrangeMicProtocol,NIMChatManagerDelegate>
///
@property (nonatomic,strong) UIView * topView;
///
@property (nonatomic,strong) UIView * contentView;
///
@property (nonatomic,strong) UILabel *titleLabel;
///线
@property (nonatomic,strong) UIView * lineView;
///
@property (nonatomic,strong) UITableView *tableView;
///
@property (nonatomic,strong) UIButton *applyButton;
///
@property (nonatomic,strong) NSMutableArray<ArrangeMicUserModel *> *datasource;
///
@property (nonatomic,assign) int page;
///
@property (nonatomic,assign) BOOL hasNoMoreData;
///
@property (nonatomic,strong) XPArrangeMicInfoModel *userInfo;
///
@property (nonatomic,strong) ArrangeMicModel *arrangeMicInfo;
@end
@implementation XPArrangeMicViewController
- (void)dealloc {
[[NIMSDK sharedSDK].chatManager removeDelegate:self];
}
- (XPArrangeMicPresenter *)createPresenter {
return [[XPArrangeMicPresenter alloc] init];
}
- (instancetype)initWithInfo:(XPArrangeMicInfoModel *)info {
if (self = [super init]) {
self.modalPresentationStyle = UIModalPresentationOverFullScreen;
self.userInfo = info;
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
[[NIMSDK sharedSDK].chatManager addDelegate:self];
[self initHeaderAndFooterRrfresh];
[self initSubViews];
[self initSubViewConstraints];
[self configDefaultData];
[self headerRefresh];
}
#pragma mark -
- (void)initHeaderAndFooterRrfresh {
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
header.stateLabel.textColor = [ThemeColor secondTextColor];
header.lastUpdatedTimeLabel.textColor = [ThemeColor secondTextColor];
self.tableView.mj_header = header;
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
footer.stateLabel.textColor = [ThemeColor secondTextColor];
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
self.tableView.mj_footer = footer;
}
#pragma mark - fangfa
- (void)headerRefresh {
self.page = 1;
[self.presenter getRoomArrangeMicList:self.userInfo.roomUid page:self.page pageSize:20 state:0];
}
- (void)footerRefresh {
if (self.hasNoMoreData) {
[self showErrorToast:@"没有更多数据了"];
return;
}
self.page++;
[self.presenter getRoomArrangeMicList:self.userInfo.roomUid page:self.page pageSize:20 state:1];
}
#pragma mark - Private Method
- (void)configDefaultData {
if (self.userInfo.isManager) {
[self.applyButton setTitle:@"立即邀请" forState:UIControlStateNormal];
} else {
[self.applyButton setTitle:@"点击报名" forState:UIControlStateNormal];
}
}
- (void)initSubViews {
self.view.backgroundColor = [UIColor clearColor];
[self.view addSubview:self.topView];
[self.view addSubview:self.contentView];
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.lineView];
[self.contentView addSubview:self.tableView];
[self.contentView addSubview:self.applyButton];
}
- (void)initSubViewConstraints {
[self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.mas_equalTo(self.view);
make.bottom.mas_equalTo(self.contentView.mas_top);
}];
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.mas_equalTo(self.view);
make.height.mas_equalTo(450);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.mas_equalTo(self.contentView);
make.height.mas_equalTo(44);
}];
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.view);
make.top.mas_equalTo(self.titleLabel.mas_bottom);
make.height.mas_equalTo(1);
}];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.mas_equalTo(self.contentView);
make.top.mas_equalTo(self.lineView.mas_bottom);
}];
[self.applyButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.view).inset(45);
make.height.mas_equalTo(38);
make.bottom.mas_equalTo(self.view).offset(-kSafeAreaBottomHeight - 20);
}];
}
- (NSMutableAttributedString *)createArrangeMicNavTitleWith:(NSString *)count{
if (self.datasource.count == 0) {
if (self.userInfo.isManager) {
NSMutableAttributedString *attributString = [[NSMutableAttributedString alloc] initWithString:@"当前无人排麦" attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16], NSForegroundColorAttributeName:[ThemeColor mainTextColor]}];
return attributString;
}else{
NSMutableAttributedString *attributString = [[NSMutableAttributedString alloc] initWithString:@"报名才能排麦哦~" attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16], NSForegroundColorAttributeName:[ThemeColor mainTextColor]}];
return attributString;
}
}else{
if (self.userInfo.isManager) {
NSString * str = [NSString stringWithFormat:@"当前排麦的人数:%@", count];
NSMutableAttributedString *attributString = [[NSMutableAttributedString alloc] initWithString:str attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16], NSForegroundColorAttributeName:[ThemeColor mainTextColor]}];
[attributString addAttribute:NSForegroundColorAttributeName value:[ThemeColor appEmphasizeColor] range:[str rangeOfString:count]];
return attributString;
}else{
if ([count intValue] > 0) {
count = count.length > 0 ? count : @"0";
NSString * str = [NSString stringWithFormat:@"我在队列中排列位置:%ld", [count integerValue]];
NSMutableAttributedString *attributString = [[NSMutableAttributedString alloc] initWithString:str attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16], NSForegroundColorAttributeName:[ThemeColor mainTextColor]}];
[attributString addAttribute:NSForegroundColorAttributeName value:[ThemeColor appEmphasizeColor] range:[str rangeOfString:count]];
return attributString;
}else{
NSMutableAttributedString *attributString = [[NSMutableAttributedString alloc] initWithString:@"报名才能排麦哦~" attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16], NSForegroundColorAttributeName:[ThemeColor mainTextColor]}];
return attributString;
}
}
}
}
#pragma mark - NIMChatManagerDelegate
- (void)onRecvMessages:(NSArray<NIMMessage *> *)messages {
for (NIMMessage * message in messages) {
//
if (message.session.sessionType != NIMSessionTypeChatroom) {
continue;
}
//
if (![message.session.sessionId isEqualToString:self.userInfo.roomId]) {
continue;
}
if (message.messageType == NIMMessageTypeCustom) {
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
AttachmentModel * attachment = obj.attachment;
if (attachment.first == CustomMessageType_Arrange_Mic) {
switch (attachment.second) {
case Custom_Message_Sub_Arrange_Mic_Non_Empty:
case Custom_Message_Sub_Arrange_Mic_Empty:
[self headerRefresh];
break;
case Custom_Message_Sub_Arrange_Mic_Mode_Close:
[self dismissViewControllerAnimated:YES completion:nil];
break;
default:
break;
}
}
}
}
}
}
#pragma mark - XPArrangeMicProtocol
- (void)getRoomArrangeMicListSuccess:(ArrangeMicModel *)listModel state:(int)state{
self.arrangeMicInfo = listModel;
if (state == 0) {
[self.datasource removeAllObjects];
[self.tableView.mj_header endRefreshing];
} else {
[self.tableView.mj_footer endRefreshing];
}
if (listModel.queue.count > 0) {
self.hasNoMoreData = NO;
[self.datasource addObjectsFromArray:listModel.queue];
} else {
self.hasNoMoreData = YES;
[self.tableView.mj_footer endRefreshingWithNoMoreData];
}
[self.tableView reloadData];
if (!self.userInfo.isManager && listModel.myPos.integerValue > 0) {
[self.applyButton setTitle:@"取消报名" forState:UIControlStateNormal];
}
self.titleLabel.attributedText = [self createArrangeMicNavTitleWith:listModel.count];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
}
- (void)applyArrangeMicSuccess {
[self headerRefresh];
}
- (void)cancelArrangeMicSuccess {
[self headerRefresh];
}
#pragma mark - XPArrangeMicTableViewCellDelegate
- (void)xPArrangeMicTableViewCell:(XPArrangeMicTableViewCell *)view inviteUser:(NSString *)uid {
}
#pragma mark - UITableViewDelegate And UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.datasource.count > 0 ? self.datasource.count : 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
XPArrangeMicTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPArrangeMicTableViewCell class])];
if (cell == nil) {
cell = [[XPArrangeMicTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPArrangeMicTableViewCell class])];
}
ArrangeMicUserModel * userInfo = [self.datasource objectAtIndex:indexPath.row];
cell.isManager = self.userInfo.isManager;
userInfo.number = indexPath.row + 1;
cell.userInfo = userInfo;
return cell;
}
XPArrangeMicEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPArrangeMicEmptyTableViewCell class])];
if (cell == nil) {
cell = [[XPArrangeMicEmptyTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPArrangeMicEmptyTableViewCell class])];
}
cell.emptyTitle = self.userInfo.isManager ? @"冷冷清清的无人排麦哦~\n分享房间邀请好友加入一起嗨" : @"立即报名,你就是排麦第一人啦!";
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
#pragma mark - Event Response
- (void)applyButtonAction:(UIButton *)sender {
if (self.userInfo.isManager) {
//TODO:
} else {
if (self.arrangeMicInfo.myPos.integerValue > 0) {
[TTPopup alertWithMessage:@"取消报名后再次报名需要重新排麦哦!确认取消报名吗?" confirmHandler:^{
[self.presenter cancelRoomArrangeMic:self.userInfo.roomUid];
} cancelHandler:^{
}];
} else {
[self.presenter applyRoomArrangeMic:self.userInfo.roomUid];
}
}
}
- (void)disMissArrangeMicRecognizer {
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - Getters And Setters
- (UIView *)topView {
if (!_topView) {
_topView = [[UIView alloc] init];
_topView.backgroundColor = [UIColor clearColor];
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(disMissArrangeMicRecognizer)];
[_topView addGestureRecognizer:tap];
}
return _topView;
}
- (UIView *)contentView {
if (!_contentView) {
_contentView = [[UIView alloc] init];
_contentView.backgroundColor = [UIColor whiteColor];
CAShapeLayer * layer = [CAShapeLayer layer];
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, 450) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(12, 12)];
layer.path = path.CGPath;
_contentView.layer.mask = layer;
}
return _contentView;
}
- (UIButton *)applyButton{
if (!_applyButton) {
_applyButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_applyButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
[_applyButton setTitle:@"点击报名" forState:UIControlStateNormal];
_applyButton.titleLabel.font = [UIFont systemFontOfSize:16];
_applyButton.layer.masksToBounds = YES;
_applyButton.layer.cornerRadius = 38 / 2;
[_applyButton addTarget:self action:@selector(applyButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _applyButton;
}
- (UILabel *)titleLabel{
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
}
return _titleLabel;
}
- (UIView *)lineView{
if (!_lineView) {
_lineView = [[UIView alloc] init];
_lineView.backgroundColor = [ThemeColor dividerColor];
}
return _lineView;
}
- (UITableView *)tableView {
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.rowHeight = 65;
_tableView.tableFooterView = [UIView new];
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_tableView.backgroundColor = [UIColor clearColor];
if (@available(iOS 11.0, *)) {
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
[_tableView registerClass:[XPArrangeMicTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPArrangeMicTableViewCell class])];
[_tableView registerClass:[XPArrangeMicEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPArrangeMicEmptyTableViewCell class])];
}
return _tableView;
}
- (NSMutableArray<ArrangeMicUserModel *> *)datasource {
if (!_datasource) {
_datasource = [NSMutableArray array];
}
return _datasource;
}
@end

View File

@@ -16,6 +16,7 @@ typedef NS_ENUM(NSInteger, XPRoomMenuItemType) {
XPRoomMenuItemType_Face,///表情
XPRoomMenuItemType_Message,///房间私聊
XPRoomMenuItemType_More,///更多
XPRoomMenuItemType_ArrangeMic,///排麦
XPRoomMenuItemType_Gift,///礼物
};

View File

@@ -18,12 +18,13 @@
#import "UserInfoModel.h"
#import "MicroStateModel.h"
#import "RoomInfoModel.h"
#import "AttachmentModel.h"
///View
#import "XPRoomSendTextView.h"
#import "XPSendGiftView.h"
#import "SessionListViewController.h"
#import "XPRoomMoreMenuViewController.h"
#import "XPArrangeMicViewController.h"
@interface XPRoomMenuContainerView ()
///
@@ -42,6 +43,8 @@
@property (nonatomic,strong) UIButton *moreButton;
///
@property (nonatomic,strong) UIButton *giftButton;
///
@property (nonatomic,strong) UIButton *arrangeMicButton;
///
@property (nonatomic,strong) UIView * placeHolderView;
///
@@ -51,7 +54,6 @@
@implementation XPRoomMenuContainerView
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
self = [super init];
if (self) {
@@ -97,6 +99,25 @@
case XPRoomMenuItemType_More: {
XPRoomMoreMenuViewController * moreMenuVC = [[XPRoomMoreMenuViewController alloc] initRoomInfo:self.delegate.getRoomInfo];
[self.delegate.getCurrentNav presentViewController:moreMenuVC animated:YES completion:nil];
}
case XPRoomMenuItemType_ArrangeMic:{
self.arrangeMicButton.selected = NO;
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
request.userIds = @[[AccountInfoStorage instance].getUid];
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
NIMChatroomMember * member;
if (error == nil) {
member = members.firstObject;
}
XPArrangeMicInfoModel * info = [[XPArrangeMicInfoModel alloc] init];
info.roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
info.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
info.micQueue = [self.delegate getMicroQueue];
info.isManager = (member.type == NIMChatroomMemberTypeCreator || member.type == NIMChatroomMemberTypeManager);
XPArrangeMicViewController * arrangeMicVC = [[XPArrangeMicViewController alloc] initWithInfo:info];
[self.delegate.getCurrentNav presentViewController:arrangeMicVC animated:YES completion:nil];
}];
}
break;
default:
@@ -111,6 +132,7 @@
[self.stackView addArrangedSubview:self.micButton];
[self.stackView addArrangedSubview:self.voiceButton];
[self.stackView addArrangedSubview:self.faceButton];
[self.stackView addArrangedSubview:self.arrangeMicButton];
[self.stackView addArrangedSubview:self.messageButton];
[self.stackView addArrangedSubview:self.moreButton];
[self.stackView addArrangedSubview:self.placeHolderView];
@@ -179,8 +201,30 @@
}
- (void)onRoomUpdate {
self.moreButton.hidden = self.delegate.getRoomInfo.uid == [AccountInfoStorage instance].getUid.integerValue ? NO : YES;
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
self.moreButton.hidden = roomInfo.uid == [AccountInfoStorage instance].getUid.integerValue ? NO : YES;
self.arrangeMicButton.hidden = roomInfo.roomModeType != RoomModeType_Open_Micro_Mode;
}
- (void)handleNIMCustomMessage:(AttachmentModel *)attachment {
if (attachment.first == CustomMessageType_Arrange_Mic) {
if (attachment.second == Custom_Message_Sub_Arrange_Mic_Non_Empty || attachment.second == Custom_Message_Sub_Arrange_Mic_Empty) {
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
request.userIds = @[[AccountInfoStorage instance].getUid];
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
NIMChatroomMember * member;
if (error == nil) {
member = members.firstObject;
}
if (member.type == NIMChatroomMemberTypeCreator || member.type == NIMChatroomMemberTypeManager) {
self.arrangeMicButton.selected = attachment.second == Custom_Message_Sub_Arrange_Mic_Non_Empty;
};
}];
}
}
}
#pragma mark - Getters And Setters
- (UIButton *)inputButton {
if (!_inputButton) {
@@ -286,4 +330,16 @@
return _stackView;
}
- (UIButton *)arrangeMicButton {
if (!_arrangeMicButton) {
_arrangeMicButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_arrangeMicButton setImage:[UIImage imageNamed:@"room_menu_arrange_mic"] forState:UIControlStateNormal];
[_arrangeMicButton setImage:[UIImage imageNamed:@"room_menu_arrange_mic_new"] forState:UIControlStateSelected];
_arrangeMicButton.tag = XPRoomMenuItemType_ArrangeMic;
[_arrangeMicButton addTarget:self action:@selector(menuButtonAction:) forControlEvents:UIControlEventTouchUpInside];
_arrangeMicButton.hidden = YES;
}
return _arrangeMicButton;
}
@end

View File

@@ -313,6 +313,7 @@
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
[self.stageView handleNIMCustomMessage:obj.attachment];
[self.animationView handleNIMCustomMessage:obj.attachment];
[self.menuContainerView handleNIMCustomMessage:obj.attachment];
}
}
}