XYChatRoomInfoManager.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. //
  2. // XYChatRoomInfoManager.h
  3. // Starbuds
  4. //
  5. // Created by 翟玉磊 on 2020/7/8.
  6. // Copyright © 2020 翟玉磊. All rights reserved.
  7. // 管理聊天室内部信息 聊天室内接口请求和数据逻辑
  8. #import <Foundation/Foundation.h>
  9. #import "XYChatRoomInfoModel.h"
  10. #import "XYChatRoomMenuItemModel.h"
  11. #import "XYLiveRoomActivityInfo.h"
  12. #import "XYLiveRoomVCInfo.h"
  13. #import "XYChatRoomMVPModel.h"
  14. #import "XYPKProceedInfo.h"
  15. NS_ASSUME_NONNULL_BEGIN
  16. @class XYChatRoomBattleRoomInModel, XYChatRoomKFBattleRoomInModel, XYChatRoomAuctionRankItemModel, XYChatRoomAuctionInfoModel;
  17. @protocol XYChatRoomInfoManagerDelegate <NSObject>
  18. @end
  19. @interface XYChatRoomInfoManager : NSObject
  20. @property (nonatomic, strong) XYLiveRoomVCInfo *liveRoomVcInfo;
  21. @property (nonatomic, weak) id<XYChatRoomInfoManagerDelegate>delegate;
  22. @property (nonatomic, strong) XYChatRoomInfoModel *roomInfoModel;
  23. /// 麦位数组
  24. @property (nonatomic, strong) NSMutableArray <XYChatRoomSeatsModel *>*seatsArray;
  25. /// 当前麦位用户数组 根据麦位信息进行更新 XYChatRoomSeatsUserModel
  26. @property (nonatomic, strong) NSMutableArray *seatUserArray;
  27. /// rtc的认证信息
  28. @property (nonatomic, strong) XYChatRoomRTCAuthInfoModel *rtcAuthInfo;
  29. /// 当前用户房间角色 1.观众 2房管 3支持人 4房主 5超管
  30. @property (nonatomic, assign) XYVoiceRoomRole role;
  31. /// 相亲模式下当前相亲进程
  32. @property (nonatomic, assign) XYVoiceRoomLoveStage stage;
  33. /// 房间是否收藏
  34. @property (nonatomic, assign) BOOL isFav;
  35. /// 当前麦序队列用户数量
  36. @property (nonatomic, assign) NSInteger queueUsersCount;
  37. /// 当前用户是否加入了麦序队列
  38. @property (nonatomic, assign) BOOL isJoinQueue;
  39. /// 菜单model数组
  40. @property (nonatomic, strong) NSMutableArray *menuItemModelArray;
  41. /// 当前用户是否上麦
  42. @property (nonatomic, assign) BOOL isCurrentOnMicrophone;
  43. /// 当前用户是否在主持人麦
  44. @property (nonatomic, assign) BOOL isCurrentHost;
  45. @property (nonatomic, copy) dispatch_block_t currentHostStateUpdateBlock;
  46. /// 是否关闭听筒 默认是NO 不关闭
  47. @property (nonatomic, assign) BOOL receiverSwitches;
  48. /// 音频输出为听筒还是扬声器 默认是YES 扬声器
  49. @property (nonatomic, assign) BOOL enableSpeakerphone;
  50. @property (nonatomic, strong) NSMutableArray *personDetailItemTitleArray;
  51. /// 房间贡献榜数组
  52. @property (nonatomic, strong) NSMutableArray *diamondRankArray;
  53. /// 所有活动的数组
  54. @property (nonatomic, strong) NSMutableArray <XYLiveRoomActivityInfo *>*allActivityArrs;
  55. /// 昨日榜单MVP model
  56. @property (nonatomic, strong) XYChatRoomMVPModel *roomYesterdayMVPModel;
  57. @property (nonatomic, copy) void(^reloadChatRoomGiftSelectBlock)(BOOL success);
  58. /// 个人资料卡用户信息
  59. @property (nonatomic, strong) XYUserModel *__nullable personDetailUserInfo;
  60. /// 消息体用户信息
  61. @property (nonatomic, strong) NSDictionary *profile;
  62. /// 服务器时间戳
  63. @property (nonatomic, copy) NSString *timestamp;
  64. /// 是否开启了小时榜
  65. @property (nonatomic, assign) BOOL hourRankEnabled;
  66. /// 小时榜排名
  67. @property (nonatomic, assign) NSInteger hoursRankIndex;
  68. @property (nonatomic, strong) NSArray *hoursDataSource;
  69. @property (nonatomic, copy) NSString *hoursRankUrl;
  70. /// 个播主播是否在线 1在线 0离线,没有为0
  71. @property (nonatomic, assign) BOOL isSingleRtcAnchorOnline;
  72. /// 个播场次ID
  73. @property (nonatomic, copy) NSString *singleRtcHisId;
  74. /// 开播状态 除了个播房都使用次状态判断是否开播
  75. @property (nonatomic, assign) BOOL isLive;
  76. /// 更新心动值显示开关 返回对应的菜单model
  77. - (id)updateCardiacValueSwitch:(BOOL)scoreEnabled;
  78. /// 更新自由上麦开关状态 返回对应的菜单model
  79. - (id)updateRoomMicFreeSwitch:(BOOL)roomMicFree;
  80. /// 更新房间密码锁开关状态 返回对应的菜单model
  81. - (id)updateRoomLockSwitch:(BOOL)needPass;
  82. /// 更新公屏开关状态 返回对应的菜单model
  83. - (id)updateClearChatEnabledSwitch:(BOOL)chatEnabled;
  84. // 更新菜单数组
  85. - (NSArray *)updateMenuData;
  86. // 获取直播间信息
  87. - (void)getRoomInfoRequestCompleted:(void(^)(NSError *error))completed;
  88. /// 更新麦位信息
  89. - (void)getSeatsInfoRequestCompleted:(void(^)(NSError *error))completed;
  90. /// 获取麦序队列数量和判断出自己是否加入麦序队列
  91. - (void)getQueueUsersRequestCompleted:(void(^)(NSError *error))completed;
  92. /// 获取拍卖麦序队列数量和判断出自己是否加入麦序队列
  93. - (void)getAcutionQueueUsersRequestCompleted:(void(^)(NSError *error))completed;
  94. /// 获取排行榜信息
  95. - (void)getDiamondRankWeekCompleted:(void(^)(NSError *error))completed;
  96. /// 获取空缺的普通麦位号 -1说明没有空缺的普通麦位
  97. - (NSInteger)getNoUserGeneralSeatNo;
  98. // 获取聊天室活动
  99. - (void)getActivityRequestCompleted:(void(^)(NSError *error))completed;
  100. // 获取昨日榜单MVP
  101. - (void)getYesterdayDiamondRankMVPCompleted:(void(^)(NSError *error))completed;
  102. /// 判断用户是否有权限
  103. - (BOOL)isLimitUser;
  104. /// 获取指定用户资料的操作功能项
  105. - (NSArray *)getUserFunctionTitleWithUserId:(NSString *)userId andHideFunction:(BOOL )hideFunction;
  106. /// 判断这个用户是否在麦上
  107. /// @param userId 指定的用户id
  108. - (BOOL)judgeUserIsOnMicrophoneWithUserId:(NSString *)userId;
  109. /// 根据uid获取麦位model 不在麦上则返回nil
  110. /// @param userId 指定的用户id
  111. - (XYChatRoomSeatsModel *)getUserSeatModelWithUserId:(NSString *)userId;
  112. /// 获取主持人麦位model
  113. - (XYChatRoomSeatsModel *)getHostSeatModel;
  114. /// 根据菜单类型获取指定类型的菜单model
  115. /// @param type 需要的类型
  116. - (XYChatRoomMenuItemModel *)getMenuModelWithMenuType:(XYChatRoomMenuType)type;
  117. /// 获取左右边心动值最大的麦位 -1则是没有人
  118. /// @param isLeft YES左边 NO右边
  119. - (NSInteger)getLoveHatSeatNoWithLeft:(BOOL)isLeft;
  120. /// 进入关闭状态 默认是NO 当点击关闭房间的时候会变成YES 目前在关闭房间下麦的时候使用:不处理消息、不刷新定时器
  121. @property (nonatomic, assign) BOOL enterClosedState;
  122. //根据用户id获取当前麦位
  123. - (int )getMicIndex:(NSString *)userId;
  124. //根据麦为获取用户id
  125. - (NSString *)getUserIdByMicIndex:(NSInteger )micIndex;
  126. // 获取当前房间小时榜排名
  127. - (void)getRtcHourRankCompleted:(void(^)(NSError *error))completed;
  128. - (void)clear;
  129. #pragma mark — ----房间PK
  130. /// 房间内是否启用 PK 功能,未启用不显示 PK 相关的入口
  131. @property (nonatomic, assign) BOOL battleEnabled;
  132. /// 当前房间内 PK 详情 为 null 表示当前无进行中 PK
  133. @property (nonatomic, strong) XYChatRoomBattleRoomInModel *battleRoomIn;
  134. /// 房间内pk状态
  135. @property (nonatomic, assign) BOOL pkState;
  136. /// 解析获取用户完整信息
  137. /// @param dataDict 消息数据
  138. /// @param result 1左方 2右方
  139. - (void)parsePkRank:(NSDictionary *)dataDict result:(void(^)(int result))result;
  140. /// pk左边用户缓存数组
  141. @property (nonatomic, strong) NSMutableArray<XYPKProceedInfo *> *pkUserLeftCacheArrs;
  142. /// pk右边用户缓存数组
  143. @property (nonatomic, strong) NSMutableArray<XYPKProceedInfo *> *pkUserRightCacheArrs;
  144. /// pk左边排名数组
  145. @property (nonatomic, strong) NSMutableArray<XYPKProceedInfo *> *pkLeftVips;
  146. /// pk右边排名数组
  147. @property (nonatomic, strong) NSMutableArray<XYPKProceedInfo *> *pkRightVips;
  148. #pragma mark — ----房间PK
  149. #pragma mark — ----跨房Pk(相关属性方法用KF开头)
  150. /// 是否启用 跨房Pk功能,未启用不显示 跨房Pk相关的入口
  151. @property (nonatomic, assign) BOOL KFBattleEnabled;
  152. /// 跨房Pk状态 是否正在PK
  153. @property (nonatomic, assign) BOOL KFPkState;
  154. /// 跨房Pk匹配次数
  155. @property (nonatomic, assign) NSInteger KFPkMatchNumber;
  156. /// 跨房PK匹配状态
  157. @property (nonatomic, assign) XYVoiceRoomKFPKMatchState KFPKMatchState;
  158. /// 跨房PK信息
  159. @property (nonatomic, strong) XYChatRoomKFBattleRoomInModel *battleRoomCross;
  160. #pragma mark — ----跨房Pk
  161. #pragma mark — ----拍卖房
  162. /// 当前用户是否加入了拍卖麦序队列
  163. @property (nonatomic, assign) BOOL isJoinAuctionQueue;
  164. /// 当前拍卖麦序队列用户数量
  165. @property (nonatomic, assign) NSInteger auctionQueueUsersCount;
  166. /// 是否正在拍卖
  167. @property (nonatomic, assign) BOOL isAuctioning;
  168. /// 拍卖贡献榜(前三名)
  169. @property (nonatomic, strong) NSMutableArray<XYChatRoomAuctionRankItemModel *> *auctionRankArray;
  170. /// 拍卖位用户信息 nil这说明拍卖位没人
  171. @property (nonatomic, strong) XYChatRoomSeatsUserModel *auctionSeatUserModel;
  172. /// 拍卖信息
  173. @property (nonatomic, strong) XYChatRoomAuctionInfoModel *auctionInfoModel;
  174. @end
  175. @interface XYChatRoomBattleRoomInModel : NSObject
  176. @property (nonatomic, copy) NSString *roomId;
  177. @property (nonatomic, assign) NSInteger leftCampScore;
  178. @property (nonatomic, assign) NSInteger rightCampScore;
  179. /// 20 进行中 301已结束
  180. @property (nonatomic, assign) NSInteger battleStatus;
  181. @property (nonatomic, assign) NSInteger battleResult;
  182. @property (nonatomic, copy) NSString *battleId;
  183. @property (nonatomic, copy) NSString *topic;
  184. @property (nonatomic, copy) NSString *duration;
  185. @property (nonatomic, copy) NSString *createTime;
  186. @property (nonatomic, copy) NSString *finishTime;
  187. @end
  188. @interface XYChatRoomKFBattleRoomInModel : NSObject
  189. @property (nonatomic, copy) NSString *roomId;
  190. @property (nonatomic, copy) NSString *roomName;
  191. @property (nonatomic, copy) NSString *roomCover;
  192. @property (nonatomic, copy) NSString *targetRoomId;
  193. @property (nonatomic, copy) NSString *targetRoomCover;
  194. @property (nonatomic, copy) NSString *targetRoomName;
  195. @property (nonatomic, copy) NSString *battleId;
  196. @property (nonatomic, copy) NSString *topic;
  197. @property (nonatomic, copy) NSString *duration;
  198. @property (nonatomic, copy) NSString *createTime;
  199. @property (nonatomic, copy) NSString *finishTime;
  200. /// 客场静音状态 1开启收听 0关闭收听
  201. @property (nonatomic, assign) BOOL enableListen;
  202. /// 20 进行中 301已结束
  203. @property (nonatomic, assign) NSInteger battleStatus;
  204. @property (nonatomic, assign) NSInteger battleResult;
  205. @end
  206. @interface XYChatRoomAuctionInfoModel : NSObject
  207. @property (nonatomic, copy) NSString *roomId;
  208. /// 被拍卖用户id
  209. @property (nonatomic, copy) NSString *bidUserId;
  210. @property (nonatomic, copy) NSString *bidUserName;
  211. @property (nonatomic, copy) NSString *bidUserAvatar;
  212. /// 拍卖物品id
  213. @property (nonatomic, copy) NSString *bidItemId;
  214. /// 拍卖物品名称
  215. @property (nonatomic, copy) NSString *bidItemName;
  216. /// 拍卖时长(单位:天)
  217. @property (nonatomic, assign) NSInteger bidDuration;
  218. /// 起拍礼物id
  219. @property (nonatomic, copy) NSString *startingGiftId;
  220. /// 起拍礼物名称
  221. @property (nonatomic, copy) NSString *startingGiftName;
  222. /// 起拍礼物图标
  223. @property (nonatomic, copy) NSString *startingGiftIcon;
  224. /// 起拍礼物价格
  225. @property (nonatomic, copy) NSString *startingGiftPrice;
  226. /// 竞拍用户id
  227. @property (nonatomic, copy) NSString *winUserId;
  228. @property (nonatomic, copy) NSString *winUserName;
  229. @property (nonatomic, copy) NSString *winUserAvatar;
  230. /// 竞拍结果 1:中标、2:流拍
  231. @property (nonatomic, assign) NSInteger status;
  232. @property (nonatomic, copy) NSString *timestamp;
  233. @end
  234. NS_ASSUME_NONNULL_END