hot fix:修正部分类型礼物连击后送礼异常问题

This commit is contained in:
eggmanQQQ
2024-09-20 10:46:04 +08:00
parent 280a0c7c43
commit 25356a93ba
5 changed files with 45 additions and 14 deletions

View File

@@ -35,6 +35,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)registerActions:(void(^ _Nullable)(ComboActionType type))action; - (void)registerActions:(void(^ _Nullable)(ComboActionType type))action;
- (void)enableToCombo:(BOOL)enable;
- (void)saveSendGiftTo:(NSArray *)UIDs; - (void)saveSendGiftTo:(NSArray *)UIDs;
- (void)saveGiftSourceType:(GiftSourceType)type; - (void)saveGiftSourceType:(GiftSourceType)type;
- (void)saveSendGiftInfo:(GiftInfoModel *)model; - (void)saveSendGiftInfo:(GiftInfoModel *)model;
@@ -48,6 +50,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)resetCombo; - (void)resetCombo;
- (void)sendGift; - (void)sendGift;
- (void)forceRemove; - (void)forceRemove;
- (BOOL)loadEnable;
// 第一个 combo 由 send gift view 发起,需要手动 combo + 1 // 第一个 combo 由 send gift view 发起,需要手动 combo + 1
- (NSInteger)loadComboCountFromSendGiftView; - (NSInteger)loadComboCountFromSendGiftView;

View File

@@ -20,6 +20,8 @@
@interface GiftComboManager () @interface GiftComboManager ()
@property (nonatomic, assign) BOOL enableCombo;
// GiftReceiveInfoModel NSDictionary // GiftReceiveInfoModel NSDictionary
@property (nonatomic, strong) NSMutableArray *giftComboQueue; @property (nonatomic, strong) NSMutableArray *giftComboQueue;
@@ -96,11 +98,10 @@
- (void)resetCombo { - (void)resetCombo {
_combo = 1; _combo = 1;
_errorMessage = @""; _errorMessage = @"";
if (self.actionCallback) { if (self.actionCallback && self.enableCombo) {
self.actionCallback(ComboAction_ShowPanel); self.actionCallback(ComboAction_ShowPanel);
self.isCombing = YES;
} }
self.isCombing = YES;
} }
- (void)registerActions:(void (^)(ComboActionType))action { - (void)registerActions:(void (^)(ComboActionType))action {
@@ -115,6 +116,11 @@
} }
- (NSInteger)loadComboCountFromSendGiftView { - (NSInteger)loadComboCountFromSendGiftView {
if (!self.enableCombo) {
return 0;
}
NSInteger temp = self.combo; NSInteger temp = self.combo;
self.combo += 1; self.combo += 1;
return temp; return temp;
@@ -322,6 +328,15 @@
} }
#pragma mark - Gift meta data #pragma mark - Gift meta data
- (void)enableToCombo:(BOOL)enable {
self.enableCombo = enable;
}
- (BOOL)loadEnable {
return self.enableCombo;
}
- (void)saveSendGiftTo:(NSArray *)UIDs - (void)saveSendGiftTo:(NSArray *)UIDs
{ {
_sendGiftToUIDs = UIDs; _sendGiftToUIDs = UIDs;
@@ -435,9 +450,12 @@
attachment.first = CustomMessageType_Gift; attachment.first = CustomMessageType_Gift;
attachment.second = Custom_Message_Sub_Gift_Send; attachment.second = Custom_Message_Sub_Gift_Send;
NSDictionary *targetUsers = ((NSArray *)[data objectForKey:@"targetUsers"]).firstObject; NSDictionary *targetUsers = ((NSArray *)[data objectForKey:@"targetUsers"]).firstObject;
NSString *avatar = [targetUsers valueForKeyPath:@"avatar"];
[data setObject:[targetUsers valueForKeyPath:@"uid"] forKey:@"targetUid"]; [data setObject:[targetUsers valueForKeyPath:@"uid"] forKey:@"targetUid"];
[data setObject:[targetUsers valueForKeyPath:@"nick"] forKey:@"targetNick"]; [data setObject:[targetUsers valueForKeyPath:@"nick"] forKey:@"targetNick"];
[data setObject:[targetUsers valueForKeyPath:@"avatar"] forKey:@"targetAvatar"]; if (avatar.length > 0) {
[data setObject:avatar forKey:@"targetAvatar"];
}
attachment.data = data; attachment.data = data;
} }
break; break;

View File

@@ -22,8 +22,9 @@ typedef NS_ENUM(NSUInteger, GiftType) {
GiftType_Anchor = 11, //个播礼物 GiftType_Anchor = 11, //个播礼物
GiftType_Punish = 12, //惩罚礼物 GiftType_Punish = 12, //惩罚礼物
GiftType_Twelve_Star = 13, //星座礼物 GiftType_Twelve_Star = 13, //星座礼物
GiftType_super = 16, //超级礼物 GiftType_super = 16, //幸运礼物
GiftType_Country = 17, //国家礼物 GiftType_Country = 17, //国家礼物
GiftType_Lucky24 = 18, //幸运24
}; };
//礼物类型 //礼物类型

View File

@@ -188,7 +188,8 @@
} }
} }
break; break;
case GiftType_super:{ case GiftType_super:
case GiftType_Lucky24:{
return self.superLuckyVC; return self.superLuckyVC;
} }
break; break;
@@ -211,7 +212,7 @@
return i; return i;
} else if (tabGiftType == GiftType_Lucky && self.segmentType == GiftSegmentType_Lucky) { } else if (tabGiftType == GiftType_Lucky && self.segmentType == GiftSegmentType_Lucky) {
return i; return i;
} else if (tabGiftType == GiftType_super && self.segmentType == GiftSegmentType_SuperLucky) { } else if ((tabGiftType == GiftType_super || tabGiftType == GiftType_Lucky24) && self.segmentType == GiftSegmentType_SuperLucky) {
return i; return i;
} else if (tabGiftType == GiftType_WeekStar && self.segmentType == GiftSegmentType_WeekStar) { } else if (tabGiftType == GiftType_WeekStar && self.segmentType == GiftSegmentType_WeekStar) {
return i; return i;

View File

@@ -467,15 +467,21 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
} }
/// / /// /
- (void)readyForCombo:(XPGiftCountModel *)giftCount { - (void)readyForCombo:(XPGiftCountModel *)giftCount
if (self.segmentType == GiftSegmentType_Pack || gift:(GiftInfoModel *)giftInfo {
self.segmentType == GiftSegmentType_Lucky) { if (self.segmentType == GiftSegmentType_Pack) {
[[GiftComboManager sharedManager] enableToCombo:NO];
return; return;
} }
NSString *sessionID = self.usingplaceType == SendGiftType_User ? [NSString stringWithFormat:@"%ld", self.userArray.firstObject.uid] : [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].roomId]; if (giftInfo.giftType != GiftType_Game && giftInfo.giftType != GiftType_super && giftInfo.giftType != GiftType_Lucky24) {
[[GiftComboManager sharedManager] enableToCombo:NO];
return;
}
GiftInfoModel *giftInfo = self.giftInfoView.lastSelectGift; [[GiftComboManager sharedManager] enableToCombo:YES];
NSString *sessionID = self.usingplaceType == SendGiftType_User ? [NSString stringWithFormat:@"%ld", self.userArray.firstObject.uid] : [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].roomId];
[[GiftComboManager sharedManager] saveSendGiftTo:[self.userView getSelectUserList]]; [[GiftComboManager sharedManager] saveSendGiftTo:[self.userView getSelectUserList]];
[[GiftComboManager sharedManager] saveGiftSourceType:giftInfo.sourceType]; [[GiftComboManager sharedManager] saveGiftSourceType:giftInfo.sourceType];
[[GiftComboManager sharedManager] saveSendGiftInfo:giftInfo]; [[GiftComboManager sharedManager] saveSendGiftInfo:giftInfo];
@@ -491,11 +497,13 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
- (void)xPGiftBarView:(XPGiftBarView *)view didClickSendGift:(XPGiftCountModel *)giftCount { - (void)xPGiftBarView:(XPGiftBarView *)view didClickSendGift:(XPGiftCountModel *)giftCount {
/// ///
NSArray * uids = [self.userView getSelectUserList]; NSArray * uids = [self.userView getSelectUserList];
GiftInfoModel * giftInfo = self.giftInfoView.lastSelectGift; GiftInfoModel *giftInfo = self.giftInfoView.lastSelectGift;
if (self.usingplaceType == SendGiftType_Room) { if (self.usingplaceType == SendGiftType_Room) {
if (uids.count > 0) { if (uids.count > 0) {
[self readyForCombo:giftCount];
[self readyForCombo:giftCount
gift:giftInfo];
/// ///
NSString * uidString = [self dealSendGiftUids:uids]; NSString * uidString = [self dealSendGiftUids:uids];