feat: 修正发送礼物的处理

This commit is contained in:
edwinQQQ
2024-12-02 19:33:20 +08:00
parent 4d6e71450a
commit c49517dd94
4 changed files with 23 additions and 15 deletions

View File

@@ -315,8 +315,17 @@ PIUniversalBannerViewDelegate>
receiveInfo.nick = [attachment.data objectForKey:@"sendUserNick"]; receiveInfo.nick = [attachment.data objectForKey:@"sendUserNick"];
receiveInfo.uid = [[attachment.data objectForKey:@"sendUserUid"] stringValue]; receiveInfo.uid = [[attachment.data objectForKey:@"sendUserUid"] stringValue];
} else if (attachment.second == Custom_Message_Sub_Gift_Send) { } else if (attachment.second == Custom_Message_Sub_Gift_Send) {
receiveInfo.targetUsers = @[]; if (receiveInfo.targetUsers.count == 0) {
NSLog(@"******************* %@", receiveInfo.targetAvatar); GiftReceiveUserInfoModel *model = [[GiftReceiveUserInfoModel alloc] init];
model.nick = receiveInfo.targetNick;
model.avatar = receiveInfo.targetAvatar;
model.uid = receiveInfo.uid.integerValue;
receiveInfo.targetUsers = @[model];
}
if (receiveInfo.targetUids.count == 0) {
receiveInfo.targetUids = @[@(receiveInfo.uid.integerValue)];
}
} }
if (!_embeddedTargetDatas) { if (!_embeddedTargetDatas) {

View File

@@ -23,8 +23,8 @@ NS_ASSUME_NONNULL_BEGIN
///cell的高度 ///cell的高度
@property (nonatomic,assign) CGFloat rowHeight; @property (nonatomic,assign) CGFloat rowHeight;
@property (nonatomic,assign) CGFloat textWidth; @property (nonatomic,assign) CGFloat textWidth;
@property(nonatomic, strong) YYTextLayout *textLayout; //@property(nonatomic, strong) YYTextLayout *textLayout;
@property(nonatomic, strong) NSMutableArray *extraSizeArray; //@property(nonatomic, strong) NSMutableArray *extraSizeArray;
///文本内容的 ///文本内容的
@property (nonatomic,assign) CGFloat contentLeftMargin; @property (nonatomic,assign) CGFloat contentLeftMargin;
///文本右边的间隙 ///文本右边的间隙

View File

@@ -26,10 +26,9 @@
- (instancetype)init { - (instancetype)init {
if (self = [super init]) { if (self = [super init]) {
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapSpace)]; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapSpace)];
[self addGestureRecognizer:tap]; [self addGestureRecognizer:tap];
[self setupUI]; [self setupUI];
[self setupTimer]; [self setupTimer];
[self updateCount]; [self updateCount];
@@ -104,10 +103,10 @@
} }
- (void)handleTap { - (void)handleTap {
dispatch_async(dispatch_get_main_queue(), ^{ // dispatch_async(dispatch_get_main_queue(), ^{
// 1521 3 // 1521 3
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}); // });
[[GiftComboManager sharedManager] sendGift]; [[GiftComboManager sharedManager] sendGift];
[self.playImageView startAnimation]; [self.playImageView startAnimation];
@@ -128,9 +127,6 @@
if (!_container) { if (!_container) {
_container = [[UIView alloc] init]; _container = [[UIView alloc] init];
_container.backgroundColor = [UIColor clearColor]; _container.backgroundColor = [UIColor clearColor];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap)];
[_container addGestureRecognizer:tap];
} }
return _container; return _container;
} }
@@ -141,6 +137,7 @@
font:kFontSemibold(30) font:kFontSemibold(30)
textColor:UIColorFromRGB(0xFFE07B)]; textColor:UIColorFromRGB(0xFFE07B)];
_comboCountLabel.transform = isMSRTL() ? CGAffineTransformMakeRotation(M_PI_4) : CGAffineTransformMakeRotation(-M_PI_4); _comboCountLabel.transform = isMSRTL() ? CGAffineTransformMakeRotation(M_PI_4) : CGAffineTransformMakeRotation(-M_PI_4);
_comboCountLabel.userInteractionEnabled = YES;
} }
return _comboCountLabel; return _comboCountLabel;
} }
@@ -158,7 +155,9 @@
- (CountdownRingView *)countdownRingView { - (CountdownRingView *)countdownRingView {
if (!_countdownRingView) { if (!_countdownRingView) {
_countdownRingView = [[CountdownRingView alloc] initWithFrame:CGRectMake(0, 0, kGetScaleWidth(90), kGetScaleWidth(90)) _countdownRingView = [[CountdownRingView alloc] initWithFrame:CGRectMake(0, 0, kGetScaleWidth(90), kGetScaleWidth(90))
duration:5]; duration:555];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap)];
[_countdownRingView addGestureRecognizer:tap];
} }
return _countdownRingView; return _countdownRingView;
} }

View File

@@ -353,11 +353,11 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
@kStrongify(self); @kStrongify(self);
AttachmentModel *attachment = [[AttachmentModel alloc] init]; AttachmentModel *attachment = [[AttachmentModel alloc] init];
attachment.first = CustomMessageType_Gift; attachment.first = CustomMessageType_Gift;
attachment.second = Custom_Message_Sub_Gift_Send; attachment.second = Custom_Message_Sub_Gift_EmbeddedStyle;
[data setObject:[[obj objectForKey:@"uid"] stringValue] forKey:@"targetUid"]; [data setObject:[[obj objectForKey:@"uid"] stringValue] forKey:@"targetUid"];
[data setObject:[obj objectForKey:@"nick"] forKey:@"targetNick"]; [data setObject:[obj objectForKey:@"nick"] forKey:@"targetNick"];
[data setObject:[obj objectForKey:@"avatar"] forKey:@"targetAvatar"]; [data setObject:[obj objectForKey:@"avatar"] forKey:@"targetAvatar"];
[data removeObjectForKey:@"targetUsers"]; // [data removeObjectForKey:@"targetUsers"];
attachment.data = data; attachment.data = data;
[self sendCustomMessage:attachment]; [self sendCustomMessage:attachment];
}); });
@@ -927,13 +927,13 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
dispatch_after(delayTime, dispatch_get_main_queue(), ^{ dispatch_after(delayTime, dispatch_get_main_queue(), ^{
@kStrongify(self); @kStrongify(self);
if (self) { if (self) {
[self sendCustomMessage:receiveInfo oringinDic:originDic];
[[GiftComboManager sharedManager] resetCombo]; [[GiftComboManager sharedManager] resetCombo];
@kWeakify(self); @kWeakify(self);
[[GiftComboManager sharedManager] setHandleComboSuccess:^(GiftReceiveInfoModel * _Nonnull receiveModel, NSMutableDictionary * _Nonnull originDic) { [[GiftComboManager sharedManager] setHandleComboSuccess:^(GiftReceiveInfoModel * _Nonnull receiveModel, NSMutableDictionary * _Nonnull originDic) {
@kStrongify(self); @kStrongify(self);
[self sendCustomMessage:receiveInfo oringinDic:originDic.copy]; [self sendCustomMessage:receiveInfo oringinDic:originDic.copy];
}]; }];
[self sendCustomMessage:receiveInfo oringinDic:originDic];
} }
}); });