boom 重构暂存
This commit is contained in:
@@ -540,6 +540,7 @@
|
||||
4CD6FF662D673A5C00262AB7 /* AgentMessageModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD6FF652D673A5C00262AB7 /* AgentMessageModel.m */; };
|
||||
4CD6FF692D673F7F00262AB7 /* AgentMessageTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD6FF682D673F7F00262AB7 /* AgentMessageTableViewCell.m */; };
|
||||
4CE3A9462D22754C003F0796 /* RechargeUserModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE3A9452D22754C003F0796 /* RechargeUserModel.m */; };
|
||||
4CE746C32D9290430094E496 /* RoomBoomManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE746C22D9290430094E496 /* RoomBoomManager.m */; };
|
||||
4CEB9EA72D09643E00443480 /* UserRoomCardViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEB9EA62D09643E00443480 /* UserRoomCardViewController.m */; };
|
||||
4CEB9EAA2D097E8400443480 /* MoliAvatar.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEB9EA92D097E8400443480 /* MoliAvatar.m */; };
|
||||
4CEB9EAD2D09AA0400443480 /* SexAgeLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEB9EAC2D09AA0400443480 /* SexAgeLabel.m */; };
|
||||
@@ -620,7 +621,6 @@
|
||||
54CE5EF92CCA4A2600A67898 /* LocationModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 54CE5EF82CCA4A2600A67898 /* LocationModel.m */; };
|
||||
54E4D5302C9048E1009E1FEA /* LuckyGiftWinningFlagView.m in Sources */ = {isa = PBXBuildFile; fileRef = 54E4D52F2C9048E1009E1FEA /* LuckyGiftWinningFlagView.m */; };
|
||||
54E4D5332C90658C009E1FEA /* LuckyGiftWinningBannerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 54E4D5322C90658C009E1FEA /* LuckyGiftWinningBannerView.m */; };
|
||||
54E82E9F2CA6876300C931D9 /* RoomBoomManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 54E82E9E2CA6876300C931D9 /* RoomBoomManager.m */; };
|
||||
54E82EA22CA6886700C931D9 /* RoomBoomBannerAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 54E82EA12CA6886700C931D9 /* RoomBoomBannerAnimation.m */; };
|
||||
54E82EA52CA693FA00C931D9 /* RoomBoomExplosionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 54E82EA42CA693FA00C931D9 /* RoomBoomExplosionView.m */; };
|
||||
54E82EA82CA6940900C931D9 /* RoomBoomResultView.m in Sources */ = {isa = PBXBuildFile; fileRef = 54E82EA72CA6940900C931D9 /* RoomBoomResultView.m */; };
|
||||
@@ -2703,6 +2703,8 @@
|
||||
4CD6FF682D673F7F00262AB7 /* AgentMessageTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AgentMessageTableViewCell.m; sourceTree = "<group>"; };
|
||||
4CE3A9442D22754C003F0796 /* RechargeUserModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RechargeUserModel.h; sourceTree = "<group>"; };
|
||||
4CE3A9452D22754C003F0796 /* RechargeUserModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RechargeUserModel.m; sourceTree = "<group>"; };
|
||||
4CE746C12D9290430094E496 /* RoomBoomManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RoomBoomManager.h; sourceTree = "<group>"; };
|
||||
4CE746C22D9290430094E496 /* RoomBoomManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RoomBoomManager.m; sourceTree = "<group>"; };
|
||||
4CEB9EA52D09643E00443480 /* UserRoomCardViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UserRoomCardViewController.h; sourceTree = "<group>"; };
|
||||
4CEB9EA62D09643E00443480 /* UserRoomCardViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UserRoomCardViewController.m; sourceTree = "<group>"; };
|
||||
4CEB9EA82D097E8400443480 /* MoliAvatar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MoliAvatar.h; sourceTree = "<group>"; };
|
||||
@@ -2849,8 +2851,6 @@
|
||||
54E4D52F2C9048E1009E1FEA /* LuckyGiftWinningFlagView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LuckyGiftWinningFlagView.m; sourceTree = "<group>"; };
|
||||
54E4D5312C90658C009E1FEA /* LuckyGiftWinningBannerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LuckyGiftWinningBannerView.h; sourceTree = "<group>"; };
|
||||
54E4D5322C90658C009E1FEA /* LuckyGiftWinningBannerView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LuckyGiftWinningBannerView.m; sourceTree = "<group>"; };
|
||||
54E82E9D2CA6876300C931D9 /* RoomBoomManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RoomBoomManager.h; sourceTree = "<group>"; };
|
||||
54E82E9E2CA6876300C931D9 /* RoomBoomManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RoomBoomManager.m; sourceTree = "<group>"; };
|
||||
54E82EA02CA6886700C931D9 /* RoomBoomBannerAnimation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RoomBoomBannerAnimation.h; sourceTree = "<group>"; };
|
||||
54E82EA12CA6886700C931D9 /* RoomBoomBannerAnimation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RoomBoomBannerAnimation.m; sourceTree = "<group>"; };
|
||||
54E82EA32CA693FA00C931D9 /* RoomBoomExplosionView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RoomBoomExplosionView.h; sourceTree = "<group>"; };
|
||||
@@ -6859,8 +6859,8 @@
|
||||
54E82E9C2CA684CB00C931D9 /* Boom */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
54E82E9D2CA6876300C931D9 /* RoomBoomManager.h */,
|
||||
54E82E9E2CA6876300C931D9 /* RoomBoomManager.m */,
|
||||
4CE746C12D9290430094E496 /* RoomBoomManager.h */,
|
||||
4CE746C22D9290430094E496 /* RoomBoomManager.m */,
|
||||
54E82EA02CA6886700C931D9 /* RoomBoomBannerAnimation.h */,
|
||||
54E82EA12CA6886700C931D9 /* RoomBoomBannerAnimation.m */,
|
||||
54E82EA32CA693FA00C931D9 /* RoomBoomExplosionView.h */,
|
||||
@@ -12858,7 +12858,6 @@
|
||||
E8F6135F291E274E00E12650 /* NSArray+Safe.m in Sources */,
|
||||
4C44BD5D2D151B5C00F321FA /* RoomSideMenu.m in Sources */,
|
||||
E87E62622A3F568A002F68C9 /* XPNewHomeNavView.m in Sources */,
|
||||
54E82E9F2CA6876300C931D9 /* RoomBoomManager.m in Sources */,
|
||||
18E7B33226F317A20064BC9B /* XPWebViewController.m in Sources */,
|
||||
E8AEAEF927141CA30017FCE0 /* RoomHeaderView.m in Sources */,
|
||||
545831A32C2AF01100364026 /* FifteenMicStageView.m in Sources */,
|
||||
@@ -13256,6 +13255,7 @@
|
||||
E8664EE627E482EF000171BA /* RoomPKTeamModel.m in Sources */,
|
||||
9BAA5FF0277A23F4007453F3 /* XPPermissionsViewController.m in Sources */,
|
||||
E85E7BA02A4EC99300B6D00A /* XPMineGiveDiamondDetailsModel.m in Sources */,
|
||||
4CE746C32D9290430094E496 /* RoomBoomManager.m in Sources */,
|
||||
E89DCF5A28FFF1AD001647EC /* XPWishGiftSectionView.m in Sources */,
|
||||
E81A654C28351D9900F55894 /* XPMonentsTopicCollectionViewCell.m in Sources */,
|
||||
E85E7B9F2A4EC99300B6D00A /* XPMineGiveDiamondPresenter.m in Sources */,
|
||||
|
@@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)uploadAvatarV2:(NSString *)avatarPath needPay:(BOOL)needPay;
|
||||
|
||||
- (void)checkMoney:(void(^)(NSInteger currentMoney))success failure:(void(^)(NSString *message))failure;
|
||||
- (void)checkMoney:(void(^)(NSString *currentMoney))success failure:(void(^)(NSString *message))failure;
|
||||
|
||||
@end
|
||||
|
||||
|
@@ -53,7 +53,7 @@
|
||||
}] uid:uid];
|
||||
}
|
||||
|
||||
- (void)checkMoney:(void(^)(NSInteger currentMoney))success failure:(void(^)(NSString *message))failure {
|
||||
- (void)checkMoney:(void(^)(NSString *currentMoney))success failure:(void(^)(NSString *message))failure {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSString * ticket = [[AccountInfoStorage instance] getTicket];
|
||||
[Api getUserWalletInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
|
@@ -152,8 +152,8 @@ TZImagePickerControllerDelegate>
|
||||
[TTPopup alertWithConfig:config
|
||||
confirmHandler:^{
|
||||
@kStrongify(self);
|
||||
[self.presenter checkMoney:^(NSInteger currentMoney){
|
||||
if (currentMoney < self.userInfo.uploadGifAvatarPrice) {
|
||||
[self.presenter checkMoney:^(NSString *currentMoney){
|
||||
if (currentMoney.integerValue < self.userInfo.uploadGifAvatarPrice) {
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPTreasureFairyViewController5")];
|
||||
} else {
|
||||
[self displayGifPhotoBroswer];
|
||||
|
@@ -0,0 +1,15 @@
|
||||
#import "RoomBoomManager_v2.h"
|
||||
#import "RoomBoomEvent.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface RoomBoomManager_v2 (EventHandling)
|
||||
|
||||
- (void)handleBoomEvent:(RoomBoomEvent *)event;
|
||||
- (void)handleGiftEvent:(RoomBoomEvent *)event;
|
||||
- (void)handleBannerEvent:(RoomBoomEvent *)event;
|
||||
- (void)handleEventError:(NSError *)error forEvent:(RoomBoomEvent *)event;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,130 @@
|
||||
#import "RoomBoomManager_v2+EventHandling.h"
|
||||
#import "RoomBoomManager_v2+Private.h"
|
||||
#import "RoomBoomEventQueue.h"
|
||||
|
||||
@implementation RoomBoomManager_v2 (EventHandling)
|
||||
|
||||
#pragma mark - Event Processing
|
||||
|
||||
- (void)handleBoomEvent:(RoomBoomEvent *)event {
|
||||
if (!event) return;
|
||||
|
||||
@synchronized (self) {
|
||||
if (self.currentState != BoomStateIdle) {
|
||||
// 如果当前正在处理其他事件,将事件加入队列
|
||||
RoomBoomEventQueue *queue = self.eventQueues[@(BoomEventTypeBoom)];
|
||||
[queue enqueueEvent:event];
|
||||
return;
|
||||
}
|
||||
|
||||
self.currentState = BoomStateBooming;
|
||||
|
||||
// 通知所有监听器
|
||||
@synchronized (self.explosionListeners) {
|
||||
for (NSDictionary *dic in self.explosionListeners) {
|
||||
BoomEventBlock listener = [dic allValues].firstObject;
|
||||
if (listener) {
|
||||
listener(event.eventData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)handleGiftEvent:(RoomBoomEvent *)event {
|
||||
if (!event) return;
|
||||
|
||||
@synchronized (self) {
|
||||
if (self.currentState != BoomStateIdle) {
|
||||
// 如果当前正在处理其他事件,将事件加入队列
|
||||
RoomBoomEventQueue *queue = self.eventQueues[@(BoomEventTypeGift)];
|
||||
[queue enqueueEvent:event];
|
||||
return;
|
||||
}
|
||||
|
||||
self.currentState = BoomStateGifting;
|
||||
|
||||
// 通知所有监听器
|
||||
@synchronized (self.boomGiftsListeners) {
|
||||
for (NSDictionary *dic in self.boomGiftsListeners) {
|
||||
BoomEventBlock listener = [dic allValues].firstObject;
|
||||
if (listener) {
|
||||
listener(event.eventData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)handleBannerEvent:(RoomBoomEvent *)event {
|
||||
if (!event) return;
|
||||
|
||||
@synchronized (self) {
|
||||
if (self.currentState != BoomStateIdle) {
|
||||
// 如果当前正在处理其他事件,将事件加入队列
|
||||
RoomBoomEventQueue *queue = self.eventQueues[@(BoomEventTypeBanner)];
|
||||
[queue enqueueEvent:event];
|
||||
return;
|
||||
}
|
||||
|
||||
self.currentState = BoomStateBannering;
|
||||
|
||||
// 通知所有监听器
|
||||
@synchronized (self.bannerListeners) {
|
||||
for (NSDictionary *dic in self.bannerListeners) {
|
||||
BoomEventBlock listener = [dic allValues].firstObject;
|
||||
if (listener) {
|
||||
listener(event.eventData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)handleEventError:(NSError *)error forEvent:(RoomBoomEvent *)event {
|
||||
if (!error || !event) return;
|
||||
|
||||
// 记录错误日志
|
||||
NSLog(@"Error handling event: %@, error: %@", event, error);
|
||||
|
||||
// 重置状态
|
||||
@synchronized (self) {
|
||||
self.currentState = BoomStateIdle;
|
||||
|
||||
// 清理相关队列
|
||||
RoomBoomEventQueue *queue = self.eventQueues[@(event.type)];
|
||||
[queue clear];
|
||||
}
|
||||
|
||||
// 可以在这里添加错误恢复逻辑
|
||||
// TODO: 添加错误恢复机制
|
||||
}
|
||||
|
||||
#pragma mark - Helper Methods
|
||||
|
||||
- (void)processNextEventInQueue:(BoomEventType)type {
|
||||
RoomBoomEventQueue *queue = self.eventQueues[@(type)];
|
||||
if (!queue) return;
|
||||
|
||||
@synchronized (self) {
|
||||
if (self.currentState == BoomStateIdle) {
|
||||
[queue processNextEvent];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)resetStateForEventType:(BoomEventType)type {
|
||||
@synchronized (self) {
|
||||
if (self.currentState == BoomStateBooming && type == BoomEventTypeBoom) {
|
||||
self.currentState = BoomStateIdle;
|
||||
} else if (self.currentState == BoomStateGifting && type == BoomEventTypeGift) {
|
||||
self.currentState = BoomStateIdle;
|
||||
} else if (self.currentState == BoomStateBannering && type == BoomEventTypeBanner) {
|
||||
self.currentState = BoomStateIdle;
|
||||
}
|
||||
|
||||
[self processNextEventInQueue:type];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,10 @@
|
||||
#import "RoomBoomManager_v2.h"
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface RoomBoomManager_v2 (NIMDelegate) <NIMChatManagerDelegate, NIMBroadcastManagerDelegate>
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,103 @@
|
||||
#import "RoomBoomManager_v2+NIMDelegate.h"
|
||||
#import "RoomBoomManager_v2+Private.h"
|
||||
#import "RoomBoomManager_v2+EventHandling.h"
|
||||
#import "RoomBoomEvent.h"
|
||||
#import "AttachmentModel.h"
|
||||
#import "BoomInfoModel.h"
|
||||
#import "XPSkillCardPlayerManager.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
|
||||
@implementation RoomBoomManager_v2 (NIMDelegate)
|
||||
|
||||
#pragma mark - NIMChatManagerDelegate
|
||||
|
||||
- (void)onRecvMessages:(NSArray *)messages {
|
||||
for (NIMMessage *message in messages) {
|
||||
if (message.messageType == NIMMessageTypeCustom) {
|
||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
|
||||
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
||||
if (attachment.first == CustomMessageType_RoomBoom) {
|
||||
[self handleNIMAttachment:attachment];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - NIMBroadcastManagerDelegate
|
||||
|
||||
- (void)onReceiveBroadcastMessage:(NIMBroadcastMessage *)broadcastMessage {
|
||||
if ([AccountInfoStorage instance].getUid.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (broadcastMessage.content) {
|
||||
NSDictionary *msgDictionary = [broadcastMessage.content toJSONObject];
|
||||
AttachmentModel *attachment = [AttachmentModel modelWithJSON:msgDictionary[@"body"]];
|
||||
NSString *partitionId = [NSString stringWithFormat:@"%@", attachment.data[@"partitionId"]];
|
||||
|
||||
if (![partitionId isEqualToString:self.userInfo.partitionId]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (attachment.first == CustomMessageType_RoomBoom) {
|
||||
[self handleNIMAttachment:attachment];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Private Methods
|
||||
|
||||
- (void)handleNIMAttachment:(AttachmentModel *)attachment {
|
||||
if (!attachment) return;
|
||||
|
||||
RoomBoomEvent *event;
|
||||
|
||||
switch (attachment.second) {
|
||||
case Custom_Message_Room_Boom_EXP: {
|
||||
// 经验值更新事件
|
||||
BoomDetailModel *boomDetail = [BoomDetailModel modelWithJSON:attachment.data];
|
||||
event = [RoomBoomEvent eventWithData:boomDetail
|
||||
type:BoomEventTypeBoom
|
||||
priority:BoomEventPriorityNormal];
|
||||
[self handleBoomEvent:event];
|
||||
break;
|
||||
}
|
||||
|
||||
case Custom_Message_Room_Boom_LevelUp: {
|
||||
// 升级事件
|
||||
if ([[XPSkillCardPlayerManager shareInstance] isInRoomVC]) {
|
||||
// 爆炸效果事件
|
||||
event = [RoomBoomEvent eventWithData:attachment
|
||||
type:BoomEventTypeBoom
|
||||
priority:BoomEventPriorityHigh];
|
||||
[self handleBoomEvent:event];
|
||||
|
||||
// 横幅事件
|
||||
event = [RoomBoomEvent eventWithData:attachment
|
||||
type:BoomEventTypeBanner
|
||||
priority:BoomEventPriorityNormal];
|
||||
[self handleBannerEvent:event];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"UpdateWhenBoomExplosion"
|
||||
object:nil];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case Custom_Message_Room_Boom_Award: {
|
||||
// 礼物事件
|
||||
event = [RoomBoomEvent eventWithData:attachment
|
||||
type:BoomEventTypeGift
|
||||
priority:BoomEventPriorityNormal];
|
||||
[self handleGiftEvent:event];
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,19 @@
|
||||
#import "RoomBoomManager_v2.h"
|
||||
#import "BoomInfoModel.h"
|
||||
#import "UserInfoModel.h"
|
||||
#import "RoomBoomEventQueue.h"
|
||||
|
||||
@interface RoomBoomManager_v2 ()
|
||||
|
||||
@property (nonatomic, strong) NSMutableDictionary<NSNumber *, RoomBoomEventQueue *> *eventQueues;
|
||||
@property (nonatomic, assign) BoomState currentState;
|
||||
@property (nonatomic, strong) UserInfoModel *userInfo;
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray <NSDictionary *> *bannerListeners;
|
||||
@property (nonatomic, strong) NSMutableArray <NSDictionary *> *explosionListeners;
|
||||
@property (nonatomic, strong) NSMutableArray <NSDictionary *> *enterRoomExplosionListeners;
|
||||
@property (nonatomic, strong) NSMutableArray <NSDictionary *> *progressUpdateListeners;
|
||||
@property (nonatomic, strong) NSMutableArray <NSDictionary *> *boomGiftsListeners;
|
||||
@property (nonatomic, strong) NSMutableArray <NSDictionary *> *boomDetailArray;
|
||||
|
||||
@end
|
60
YuMi/Modules/YMRoom/Features/Boom/Core/RoomBoomManager_v2.h
Normal file
60
YuMi/Modules/YMRoom/Features/Boom/Core/RoomBoomManager_v2.h
Normal file
@@ -0,0 +1,60 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
@class UserInfoModel;
|
||||
@class BoomDetailModel;
|
||||
@class BoomInfoModel;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
// 事件类型定义
|
||||
typedef NS_ENUM(NSInteger, BoomEventType) {
|
||||
BoomEventTypeBoom,
|
||||
BoomEventTypeGift,
|
||||
BoomEventTypeBanner
|
||||
};
|
||||
|
||||
// 状态定义
|
||||
typedef NS_ENUM(NSInteger, BoomState) {
|
||||
BoomStateIdle,
|
||||
BoomStateBooming,
|
||||
BoomStateGifting,
|
||||
BoomStateBannering
|
||||
};
|
||||
|
||||
// 事件优先级
|
||||
typedef NS_ENUM(NSInteger, BoomEventPriority) {
|
||||
BoomEventPriorityHigh,
|
||||
BoomEventPriorityNormal,
|
||||
BoomEventPriorityLow
|
||||
};
|
||||
|
||||
// 回调block定义
|
||||
typedef void(^BoomEventBlock)(id _Nullable event);
|
||||
|
||||
@interface RoomBoomManager_v2 : NSObject
|
||||
|
||||
+ (instancetype)sharedManager;
|
||||
|
||||
// 用户信息相关
|
||||
- (void)saveUserInfo:(UserInfoModel *)userInfo;
|
||||
- (void)leaveRoom;
|
||||
|
||||
// Boom 详情相关
|
||||
- (NSArray *)loadBoomDetails;
|
||||
- (void)updateBoomDetailArray:(NSArray <BoomDetailModel *> *)array;
|
||||
- (void)updateBoomDetail:(BoomDetailModel *)boomDetail;
|
||||
- (void)cleanBoomDetail;
|
||||
|
||||
// 事件监听注册
|
||||
- (void)registerBoomBanner:(BoomEventBlock)block target:(id)target;
|
||||
- (void)registerBoomExplosion:(BoomEventBlock)block target:(id)target;
|
||||
- (void)registerBoomEnterRoomExplosion:(BoomEventBlock)block target:(id)target;
|
||||
- (void)registerBoomProgressUpdate:(BoomEventBlock)block target:(id)target;
|
||||
- (void)registerBoomGiftDisplay:(BoomEventBlock)block target:(id)target;
|
||||
- (void)removeEventListenerForTarget:(id)target;
|
||||
|
||||
// 事件接收
|
||||
- (void)receiveEnterRoomBoom:(BoomInfoModel *)model;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
210
YuMi/Modules/YMRoom/Features/Boom/Core/RoomBoomManager_v2.m
Normal file
210
YuMi/Modules/YMRoom/Features/Boom/Core/RoomBoomManager_v2.m
Normal file
@@ -0,0 +1,210 @@
|
||||
#import "RoomBoomManager_v2.h"
|
||||
#import "RoomBoomManager_v2+Private.h"
|
||||
#import "RoomBoomManager_v2+EventHandling.h"
|
||||
#import "RoomBoomEvent.h"
|
||||
#import "RoomBoomEventQueue.h"
|
||||
#import "BoomInfoModel.h"
|
||||
#import "UserInfoModel.h"
|
||||
#import "AttachmentModel.h"
|
||||
#import "XPSkillCardPlayerManager.h"
|
||||
|
||||
@implementation RoomBoomManager_v2
|
||||
|
||||
#pragma mark - Lifecycle
|
||||
|
||||
+ (instancetype)sharedManager {
|
||||
static RoomBoomManager_v2 *instance;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
instance = [[self alloc] init];
|
||||
[[NIMSDK sharedSDK].chatManager addDelegate:instance];
|
||||
[[NIMSDK sharedSDK].broadcastManager addDelegate:instance];
|
||||
});
|
||||
return instance;
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
[self setupEventQueues];
|
||||
[self setupListeners];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[[NIMSDK sharedSDK].chatManager removeDelegate:self];
|
||||
[[NIMSDK sharedSDK].broadcastManager removeDelegate:self];
|
||||
}
|
||||
|
||||
#pragma mark - Setup
|
||||
|
||||
- (void)setupEventQueues {
|
||||
_eventQueues = [NSMutableDictionary dictionary];
|
||||
|
||||
// 设置Boom事件队列
|
||||
RoomBoomEventQueue *boomQueue = [[RoomBoomEventQueue alloc] init];
|
||||
boomQueue.processBlock = ^(id event) {
|
||||
if ([event isKindOfClass:[RoomBoomEvent class]]) {
|
||||
[self handleBoomEvent:event];
|
||||
}
|
||||
};
|
||||
_eventQueues[@(BoomEventTypeBoom)] = boomQueue;
|
||||
|
||||
// 设置Gift事件队列
|
||||
RoomBoomEventQueue *giftQueue = [[RoomBoomEventQueue alloc] init];
|
||||
giftQueue.processBlock = ^(id event) {
|
||||
if ([event isKindOfClass:[RoomBoomEvent class]]) {
|
||||
[self handleGiftEvent:event];
|
||||
}
|
||||
};
|
||||
_eventQueues[@(BoomEventTypeGift)] = giftQueue;
|
||||
|
||||
// 设置Banner事件队列
|
||||
RoomBoomEventQueue *bannerQueue = [[RoomBoomEventQueue alloc] init];
|
||||
bannerQueue.processBlock = ^(id event) {
|
||||
if ([event isKindOfClass:[RoomBoomEvent class]]) {
|
||||
[self handleBannerEvent:event];
|
||||
}
|
||||
};
|
||||
_eventQueues[@(BoomEventTypeBanner)] = bannerQueue;
|
||||
}
|
||||
|
||||
- (void)setupListeners {
|
||||
_bannerListeners = [NSMutableArray array];
|
||||
_explosionListeners = [NSMutableArray array];
|
||||
_enterRoomExplosionListeners = [NSMutableArray array];
|
||||
_progressUpdateListeners = [NSMutableArray array];
|
||||
_boomGiftsListeners = [NSMutableArray array];
|
||||
// _boomDetailArray = [NSMutableArray array];
|
||||
}
|
||||
|
||||
#pragma mark - Public Methods
|
||||
|
||||
- (void)saveUserInfo:(UserInfoModel *)userInfo {
|
||||
_userInfo = userInfo;
|
||||
}
|
||||
|
||||
- (void)leaveRoom {
|
||||
@synchronized (self) {
|
||||
[self.eventQueues enumerateKeysAndObjectsUsingBlock:^(NSNumber *key, RoomBoomEventQueue *queue, BOOL *stop) {
|
||||
[queue clear];
|
||||
}];
|
||||
self.currentState = BoomStateIdle;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray *)loadBoomDetails {
|
||||
return [self.boomDetailArray copy];
|
||||
}
|
||||
|
||||
- (void)updateBoomDetailArray:(NSArray<BoomDetailModel *> *)array {
|
||||
if (!array) return;
|
||||
self.boomDetailArray = [array mutableCopy];
|
||||
}
|
||||
|
||||
- (void)updateBoomDetail:(BoomDetailModel *)boomDetail {
|
||||
if (!boomDetail) return;
|
||||
|
||||
for (NSInteger i = 0; i < self.boomDetailArray.count; i++) {
|
||||
BoomDetailModel *detail = self.boomDetailArray[i];
|
||||
if (detail.level == boomDetail.level) {
|
||||
self.boomDetailArray[i] = boomDetail;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)cleanBoomDetail {
|
||||
[self.boomDetailArray removeAllObjects];
|
||||
}
|
||||
|
||||
#pragma mark - Event Registration
|
||||
|
||||
- (void)registerBoomBanner:(BoomEventBlock)block target:(id)target {
|
||||
if (!block || !target) return;
|
||||
@synchronized (self.bannerListeners) {
|
||||
[self.bannerListeners addObject:@{NSStringFromClass([target class]): block}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)registerBoomExplosion:(BoomEventBlock)block target:(id)target {
|
||||
if (!block || !target) return;
|
||||
@synchronized (self.explosionListeners) {
|
||||
[self.explosionListeners addObject:@{NSStringFromClass([target class]): block}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)registerBoomEnterRoomExplosion:(BoomEventBlock)block target:(id)target {
|
||||
if (!block || !target) return;
|
||||
@synchronized (self.enterRoomExplosionListeners) {
|
||||
[self.enterRoomExplosionListeners addObject:@{NSStringFromClass([target class]): block}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)registerBoomProgressUpdate:(BoomEventBlock)block target:(id)target {
|
||||
if (!block || !target) return;
|
||||
@synchronized (self.progressUpdateListeners) {
|
||||
[self.progressUpdateListeners addObject:@{NSStringFromClass([target class]): block}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)registerBoomGiftDisplay:(BoomEventBlock)block target:(id)target {
|
||||
if (!block || !target) return;
|
||||
@synchronized (self.boomGiftsListeners) {
|
||||
[self.boomGiftsListeners addObject:@{NSStringFromClass([target class]): block}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeEventListenerForTarget:(id)target {
|
||||
if (!target) return;
|
||||
|
||||
NSString *targetClass = NSStringFromClass([target class]);
|
||||
|
||||
@synchronized (self) {
|
||||
// 从所有监听器数组中移除目标
|
||||
NSArray *listenerArrays = @[
|
||||
self.bannerListeners,
|
||||
self.explosionListeners,
|
||||
self.enterRoomExplosionListeners,
|
||||
self.progressUpdateListeners,
|
||||
self.boomGiftsListeners
|
||||
];
|
||||
|
||||
for (NSMutableArray *listeners in listenerArrays) {
|
||||
@synchronized (listeners) {
|
||||
NSInteger index = [listeners indexOfObjectPassingTest:^BOOL(NSDictionary *obj, NSUInteger idx, BOOL *stop) {
|
||||
return [[obj allKeys] containsObject:targetClass];
|
||||
}];
|
||||
|
||||
if (index != NSNotFound) {
|
||||
[listeners removeObjectAtIndex:index];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Room Boom Events
|
||||
|
||||
- (void)receiveEnterRoomBoom:(BoomInfoModel *)model {
|
||||
if (!model) return;
|
||||
|
||||
// 创建并处理进入房间的爆炸事件
|
||||
RoomBoomEvent *event = [RoomBoomEvent eventWithData:model
|
||||
type:BoomEventTypeBoom
|
||||
priority:BoomEventPriorityHigh];
|
||||
[self handleBoomEvent:event];
|
||||
|
||||
// 通知所有进入房间爆炸效果监听器
|
||||
@synchronized (self.enterRoomExplosionListeners) {
|
||||
for (NSDictionary *dic in self.enterRoomExplosionListeners) {
|
||||
BoomEventBlock listener = [dic allValues].firstObject;
|
||||
if (listener) {
|
||||
listener(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
19
YuMi/Modules/YMRoom/Features/Boom/Models/RoomBoomEvent.h
Normal file
19
YuMi/Modules/YMRoom/Features/Boom/Models/RoomBoomEvent.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "RoomBoomManager_v2.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface RoomBoomEvent : NSObject
|
||||
|
||||
@property (nonatomic, strong) id eventData;
|
||||
@property (nonatomic, assign) BoomEventType type;
|
||||
@property (nonatomic, assign) BoomEventPriority priority;
|
||||
@property (nonatomic, assign) NSTimeInterval timestamp;
|
||||
|
||||
+ (instancetype)eventWithData:(id)data
|
||||
type:(BoomEventType)type
|
||||
priority:(BoomEventPriority)priority;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
26
YuMi/Modules/YMRoom/Features/Boom/Models/RoomBoomEvent.m
Normal file
26
YuMi/Modules/YMRoom/Features/Boom/Models/RoomBoomEvent.m
Normal file
@@ -0,0 +1,26 @@
|
||||
#import "RoomBoomEvent.h"
|
||||
|
||||
@implementation RoomBoomEvent
|
||||
|
||||
+ (instancetype)eventWithData:(id)data
|
||||
type:(BoomEventType)type
|
||||
priority:(BoomEventPriority)priority {
|
||||
RoomBoomEvent *event = [[RoomBoomEvent alloc] init];
|
||||
event.eventData = data;
|
||||
event.type = type;
|
||||
event.priority = priority;
|
||||
event.timestamp = [[NSDate date] timeIntervalSince1970];
|
||||
return event;
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
return [NSString stringWithFormat:@"<%@: %p> type: %ld, priority: %ld, timestamp: %f, data: %@",
|
||||
NSStringFromClass([self class]),
|
||||
self,
|
||||
(long)self.type,
|
||||
(long)self.priority,
|
||||
self.timestamp,
|
||||
self.eventData];
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,17 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface RoomBoomEventQueue : NSObject
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray *events;
|
||||
@property (nonatomic, assign) BOOL isProcessing;
|
||||
@property (nonatomic, copy) void(^processBlock)(id event);
|
||||
|
||||
- (void)enqueueEvent:(id)event;
|
||||
- (void)processNextEvent;
|
||||
- (void)clear;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,60 @@
|
||||
#import "RoomBoomEventQueue.h"
|
||||
#import "RoomBoomEvent.h"
|
||||
|
||||
@implementation RoomBoomEventQueue
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_events = [[NSMutableArray alloc] init];
|
||||
_isProcessing = NO;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)enqueueEvent:(id)event {
|
||||
@synchronized (self.events) {
|
||||
[self.events addObject:event];
|
||||
|
||||
// 如果当前没有在处理事件,则开始处理
|
||||
if (!self.isProcessing) {
|
||||
[self processNextEvent];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)processNextEvent {
|
||||
@synchronized (self.events) {
|
||||
if (self.events.count == 0) {
|
||||
self.isProcessing = NO;
|
||||
return;
|
||||
}
|
||||
|
||||
self.isProcessing = YES;
|
||||
id event = self.events.firstObject;
|
||||
[self.events removeObjectAtIndex:0];
|
||||
|
||||
if (self.processBlock) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
self.processBlock(event);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)clear {
|
||||
@synchronized (self.events) {
|
||||
[self.events removeAllObjects];
|
||||
self.isProcessing = NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
return [NSString stringWithFormat:@"<%@: %p> events count: %lu, isProcessing: %@",
|
||||
NSStringFromClass([self class]),
|
||||
self,
|
||||
(unsigned long)self.events.count,
|
||||
self.isProcessing ? @"YES" : @"NO"];
|
||||
}
|
||||
|
||||
@end
|
@@ -15,7 +15,7 @@
|
||||
@interface RoomBoomManager () <NIMChatManagerDelegate, NIMBroadcastManagerDelegate>
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray <NSDictionary *> *bannerListeners;
|
||||
@property (nonatomic, strong) NSMutableArray <NSDictionary *> *ExplosionListeners;
|
||||
@property (nonatomic, strong) NSMutableArray <NSDictionary *> *explosionListeners;
|
||||
@property (nonatomic, strong) NSMutableArray <NSDictionary *> *enterRoomExplosionListeners;
|
||||
@property (nonatomic, strong) NSMutableArray <NSDictionary *> *progressUpdateListeners;
|
||||
@property (nonatomic, strong) NSMutableArray <NSDictionary *> *boomGiftsListeners;
|
||||
@@ -41,24 +41,27 @@
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
instance = [[self alloc] init];
|
||||
instance.bannerListeners = @[].mutableCopy;
|
||||
instance.ExplosionListeners = @[].mutableCopy;
|
||||
instance.enterRoomExplosionListeners = @[].mutableCopy;
|
||||
instance.progressUpdateListeners = @[].mutableCopy;
|
||||
instance.boomGiftsListeners = @[].mutableCopy;
|
||||
|
||||
instance.boomDetailArray = @[].mutableCopy;
|
||||
|
||||
instance.boomEventsQueue = @[].mutableCopy;
|
||||
instance.giftEventsQueue = @[].mutableCopy;
|
||||
instance.bannerEventsQueue = @[].mutableCopy;
|
||||
|
||||
|
||||
[[NIMSDK sharedSDK].chatManager addDelegate:instance];
|
||||
[[NIMSDK sharedSDK].broadcastManager addDelegate:instance];
|
||||
|
||||
[instance initArrays];
|
||||
});
|
||||
return instance;
|
||||
}
|
||||
|
||||
- (void)initArrays {
|
||||
_bannerListeners = [[NSMutableArray alloc] init];
|
||||
_explosionListeners = [[NSMutableArray alloc] init];
|
||||
_enterRoomExplosionListeners = [[NSMutableArray alloc] init];
|
||||
_progressUpdateListeners = [[NSMutableArray alloc] init];
|
||||
_boomGiftsListeners = [[NSMutableArray alloc] init];
|
||||
_boomDetailArray = [[NSMutableArray alloc] init];
|
||||
_boomEventsQueue = [[NSMutableArray alloc] init];
|
||||
_giftEventsQueue = [[NSMutableArray alloc] init];
|
||||
_bannerEventsQueue = [[NSMutableArray alloc] init];
|
||||
}
|
||||
|
||||
- (void)saveUserInfo:(UserInfoModel *)userInfo {
|
||||
_userInfo = userInfo;
|
||||
}
|
||||
@@ -102,8 +105,8 @@
|
||||
}
|
||||
|
||||
- (void)registerBoomExplosion:(BoomEventBlock)block target:(id)target {
|
||||
@synchronized (self.ExplosionListeners) {
|
||||
[self.ExplosionListeners addObject:@{NSStringFromClass([target class]) : block}];
|
||||
@synchronized (self.explosionListeners) {
|
||||
[self.explosionListeners addObject:@{NSStringFromClass([target class]) : block}];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,11 +209,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
@synchronized (self.ExplosionListeners) {
|
||||
@synchronized (self.explosionListeners) {
|
||||
NSString *key = NSStringFromClass([target class]);
|
||||
for (NSDictionary *dic in self.ExplosionListeners) {
|
||||
for (NSDictionary *dic in self.explosionListeners) {
|
||||
if ([[dic allKeys] containsObject:key]) {
|
||||
[self.ExplosionListeners removeObject:dic];
|
||||
[self.explosionListeners removeObject:dic];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -255,28 +258,22 @@
|
||||
- (void)receiveNIMResponse:(AttachmentModel *)attachment {
|
||||
switch (attachment.second) {
|
||||
case Custom_Message_Room_Boom_EXP: {
|
||||
NSLog(@" 火箭 -------- 631 : %@", attachment.data);
|
||||
BoomDetailModel *boomDetail = [BoomDetailModel modelWithJSON:attachment.data];
|
||||
[self handleProgressUpdate:boomDetail];
|
||||
}
|
||||
break;
|
||||
case Custom_Message_Room_Boom_LevelUp: {
|
||||
NSLog(@" 火箭 -------- 632 : %@", attachment.data);
|
||||
|
||||
if ([[XPSkillCardPlayerManager shareInstance] isInRoomVC]) {
|
||||
[self.boomEventsQueue addObject:attachment];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"UpdateWhenBoomExplosion" object:nil];
|
||||
}
|
||||
[self.bannerEventsQueue addObject:attachment];
|
||||
|
||||
[self sortDataSource];
|
||||
|
||||
[self checkAndStartBoomEvent];
|
||||
[self checkAndStartBannerEvent];
|
||||
}
|
||||
break;
|
||||
case Custom_Message_Room_Boom_Award:
|
||||
NSLog(@" 火箭 -------- 633 : %@", attachment.data);
|
||||
[self.giftEventsQueue addObject:attachment];
|
||||
break;
|
||||
default:
|
||||
@@ -284,10 +281,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)sortDataSource {
|
||||
// TODO: boom 和 banner 有新数据时要重新排序
|
||||
}
|
||||
|
||||
- (void)handleProgressUpdate:(BoomDetailModel *)model {
|
||||
[self updateBoomDetail:model];
|
||||
|
||||
@@ -302,8 +295,8 @@
|
||||
}
|
||||
|
||||
- (void)handleExplosionUpdate:(id)model {
|
||||
@synchronized (self.ExplosionListeners) {
|
||||
for (NSDictionary *dic in self.ExplosionListeners) {
|
||||
@synchronized (self.explosionListeners) {
|
||||
for (NSDictionary *dic in self.explosionListeners) {
|
||||
BoomEventBlock listener = [dic allValues].firstObject;
|
||||
if (listener) {
|
||||
listener(model);
|
||||
|
@@ -472,14 +472,6 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
|
||||
|
||||
- (void)sortBannerQueue {
|
||||
#if DEBUG
|
||||
AttachmentModel *attachmentModel = [self.roomBannertModelsQueueV2 xpSafeObjectAtIndex:0];
|
||||
if (attachmentModel) {
|
||||
NSLog(@"内容:%@ | %@", [attachmentModel.data objectForKey:@"roomUid"], [attachmentModel.data objectForKey:@"uidList"]);
|
||||
}
|
||||
#endif
|
||||
// TODO: 用户本人飘屏>房间内其他人飘屏>房间外飘屏
|
||||
// MARK: 不一定能确定是 本人 触发的飘屏,飘屏的 ID 不一定存在。
|
||||
RoomInfoModel *roomInfo = self.hostDelegate.getRoomInfo;
|
||||
NSString *currentRoomUid = @(roomInfo.uid).stringValue;
|
||||
NSString *currentUid = [AccountInfoStorage instance].getUid;
|
||||
@@ -487,15 +479,15 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
|
||||
// 检查 obj1 的属性
|
||||
NSArray *obj1UidList = [obj1.data valueForKey:@"uidList"];
|
||||
NSString *obj1RoomUid = [obj1.data valueForKey:@"roomUid"];
|
||||
NSNumber *obj1RoomUid = [obj1.data valueForKey:@"roomUid"];
|
||||
BOOL obj1IsCurrentUser = obj1UidList && [obj1UidList containsObject:currentUid];
|
||||
BOOL obj1IsCurrentRoom = obj1RoomUid && [obj1RoomUid isEqualToString:currentRoomUid];
|
||||
BOOL obj1IsCurrentRoom = obj1RoomUid && [obj1RoomUid.stringValue isEqualToString:currentRoomUid];
|
||||
|
||||
// 检查 obj2 的属性
|
||||
NSArray *obj2UidList = [obj2.data valueForKey:@"uidList"];
|
||||
NSString *obj2RoomUid = [obj2.data valueForKey:@"roomUid"];
|
||||
NSNumber *obj2RoomUid = [obj2.data valueForKey:@"roomUid"];
|
||||
BOOL obj2IsCurrentUser = obj2UidList && [obj2UidList containsObject:currentUid];
|
||||
BOOL obj2IsCurrentRoom = obj2RoomUid && [obj2RoomUid isEqualToString:currentRoomUid];
|
||||
BOOL obj2IsCurrentRoom = obj2RoomUid && [obj2RoomUid.stringValue isEqualToString:currentRoomUid];
|
||||
|
||||
if (obj1IsCurrentUser && !obj2IsCurrentUser) {
|
||||
return NSOrderedAscending;
|
||||
|
@@ -379,12 +379,14 @@ XPCandyTreeInsufficientBalanceViewDelegate>
|
||||
@kWeakify(self);
|
||||
[[RoomBoomManager sharedManager] registerBoomExplosion:^(id _Nonnull sth) {
|
||||
@kStrongify(self);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[RoomBoomExplosionView display:self.view with:sth complete:^{
|
||||
|
||||
}];
|
||||
});
|
||||
[self.presenter getBoomDetail:self.roomUid];
|
||||
|
||||
if (![sth isKindOfClass:[NSArray class]]) {
|
||||
return;
|
||||
}
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[RoomBoomExplosionView display:self.view with:sth complete:^{ }];
|
||||
});
|
||||
} target:self];
|
||||
|
||||
[[RoomBoomManager sharedManager] registerBoomGiftDisplay:^(id _Nonnull sth) {
|
||||
@@ -396,6 +398,9 @@ XPCandyTreeInsufficientBalanceViewDelegate>
|
||||
|
||||
[[RoomBoomManager sharedManager] registerBoomEnterRoomExplosion:^(id _Nonnull sth) {
|
||||
@kStrongify(self);
|
||||
if (![sth isKindOfClass:[NSArray class]]) {
|
||||
return;
|
||||
}
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[RoomBoomExplosionView display:self.view with:sth complete:^{
|
||||
|
||||
|
Reference in New Issue
Block a user