fix: 修正线上问题
This commit is contained in:
@@ -741,7 +741,7 @@ typedef NS_ENUM(NSUInteger, CustomMessageTypeCustomRoomBackground) {
|
|||||||
|
|
||||||
@interface AttachmentModel : PIBaseModel<NIMCustomAttachment>
|
@interface AttachmentModel : PIBaseModel<NIMCustomAttachment>
|
||||||
|
|
||||||
@property (nonatomic, strong) id data;
|
@property (nonatomic, strong) id data; // Must be NSMutable Type
|
||||||
@property (nonatomic,assign) int first;
|
@property (nonatomic,assign) int first;
|
||||||
@property (nonatomic,assign) int second;
|
@property (nonatomic,assign) int second;
|
||||||
@property(nonatomic,assign) BOOL isBroadcast;
|
@property(nonatomic,assign) BOOL isBroadcast;
|
||||||
|
@@ -20,7 +20,7 @@ typedef NS_ENUM(NSInteger, XPMineSettingItemType){
|
|||||||
XPMineSettingItemType_Permission,///关于我们
|
XPMineSettingItemType_Permission,///关于我们
|
||||||
XPMineSettingItemType_Helper,///帮助
|
XPMineSettingItemType_Helper,///帮助
|
||||||
XPMineSettingItemType_Feedback,//我要反馈
|
XPMineSettingItemType_Feedback,//我要反馈
|
||||||
XPMineSettingItemType_Clear_Memory,///清楚缓存
|
XPMineSettingItemType_Clear_Memory,///清除缓存
|
||||||
XPMineSettingItemType_About_Us,///关于我们
|
XPMineSettingItemType_About_Us,///关于我们
|
||||||
XPMineSettingItemType_CheckUpdate,///检查更新
|
XPMineSettingItemType_CheckUpdate,///检查更新
|
||||||
XPMineSettingItemType_Delete_Account,///注销账号
|
XPMineSettingItemType_Delete_Account,///注销账号
|
||||||
|
@@ -46,12 +46,14 @@
|
|||||||
} showLoading:YES]];
|
} showLoading:YES]];
|
||||||
}
|
}
|
||||||
-(void)confirmExchangeDiamondWithGoldNum:(NSString *)goldNum diamondNum:(NSString *)diamondNum currency:(NSString *)currency{
|
-(void)confirmExchangeDiamondWithGoldNum:(NSString *)goldNum diamondNum:(NSString *)diamondNum currency:(NSString *)currency{
|
||||||
|
@kWeakify(self);
|
||||||
[Api confirmExchangeDiamond:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
[Api confirmExchangeDiamond:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||||
|
@kStrongify(self);
|
||||||
[[self getView]confirmExchangeDiamondSuccessWithDiamondNum:diamondNum goldNum:goldNum];
|
[[self getView]confirmExchangeDiamondSuccessWithDiamondNum:diamondNum goldNum:goldNum];
|
||||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||||
[[self getView]confirmExchangeDiamondFail];
|
@kStrongify(self);
|
||||||
|
[[self getView] confirmExchangeDiamondFail];
|
||||||
} showLoading:YES errorToast:YES] goldNum:goldNum diamondNum:diamondNum currency:currency];
|
} showLoading:YES errorToast:YES] goldNum:goldNum diamondNum:diamondNum currency:currency];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)getGoldDetailsDataWithStartTime:(NSString *)startTime endTime:(NSString *)endTime{
|
-(void)getGoldDetailsDataWithStartTime:(NSString *)startTime endTime:(NSString *)endTime{
|
||||||
|
@@ -27,15 +27,17 @@
|
|||||||
_containerView = containerView;
|
_containerView = containerView;
|
||||||
_giftQueue = [NSMutableArray array];
|
_giftQueue = [NSMutableArray array];
|
||||||
_animationHelper = [[GiftAnimationHelper alloc] init];
|
_animationHelper = [[GiftAnimationHelper alloc] init];
|
||||||
_animationInterval = 0.25;
|
_animationInterval = 0.2;
|
||||||
_comboAnimationDelay = 0.25;
|
_comboAnimationDelay = 0.2;
|
||||||
_standardAnimationDelay = 0.5;
|
_standardAnimationDelay = 0.3;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)startGiftQueue {
|
- (void)startGiftQueue {
|
||||||
if (self.giftTimer) return;
|
if (self.giftTimer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0,
|
dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0,
|
||||||
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0));
|
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0));
|
||||||
@@ -43,16 +45,16 @@
|
|||||||
dispatch_source_set_timer(timer,
|
dispatch_source_set_timer(timer,
|
||||||
DISPATCH_TIME_NOW,
|
DISPATCH_TIME_NOW,
|
||||||
self.animationInterval * NSEC_PER_SEC,
|
self.animationInterval * NSEC_PER_SEC,
|
||||||
0);
|
0.01 * NSEC_PER_SEC);
|
||||||
|
|
||||||
@kWeakify(self);
|
@kWeakify(self);
|
||||||
dispatch_source_set_event_handler(timer, ^{
|
dispatch_source_set_event_handler(timer, ^{
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
@kStrongify(self);
|
||||||
@kStrongify(self);
|
[self processNextGift];
|
||||||
[self processNextGift];
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
[self processNextGift];
|
||||||
|
|
||||||
dispatch_resume(timer);
|
dispatch_resume(timer);
|
||||||
self.giftTimer = timer;
|
self.giftTimer = timer;
|
||||||
}
|
}
|
||||||
@@ -155,7 +157,13 @@
|
|||||||
- (void)stopGiftQueue {
|
- (void)stopGiftQueue {
|
||||||
if (self.giftTimer) {
|
if (self.giftTimer) {
|
||||||
dispatch_source_cancel(self.giftTimer);
|
dispatch_source_cancel(self.giftTimer);
|
||||||
self.giftTimer = nil;
|
// 取消定时器
|
||||||
|
dispatch_source_cancel(self.giftTimer);
|
||||||
|
|
||||||
|
// 设置取消回调,在资源完全释放后将 timer 置为 nil
|
||||||
|
dispatch_source_set_cancel_handler(self.giftTimer, ^{
|
||||||
|
self.giftTimer = nil;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,17 +187,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (CGPoint)comboAnimationStartPoint {
|
- (CGPoint)comboAnimationStartPoint {
|
||||||
|
CGFloat x = 0;
|
||||||
if (isMSRTL()) {
|
if (isMSRTL()) {
|
||||||
return CGPointMake(kGetScaleWidth(86),
|
x = kGetScaleWidth(90);
|
||||||
[UIScreen mainScreen].bounds.size.height - kSafeAreaTopHeight - kGetScaleWidth(140));
|
} else {
|
||||||
|
x = KScreenWidth - kGetScaleWidth(90);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGFloat x = KScreenWidth <= 375 ?
|
|
||||||
[UIScreen mainScreen].bounds.size.width - kGetScaleWidth(86) :
|
|
||||||
[UIScreen mainScreen].bounds.size.width - kGetScaleWidth(120);
|
|
||||||
|
|
||||||
return CGPointMake(x,
|
return CGPointMake(x,
|
||||||
[UIScreen mainScreen].bounds.size.height - kSafeAreaBottomHeight - kGetScaleWidth(140));
|
KScreenHeight - kSafeAreaBottomHeight - kGetScaleWidth(140));
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -79,7 +79,6 @@
|
|||||||
#import "GameUniversalBannerView.h"
|
#import "GameUniversalBannerView.h"
|
||||||
#import "RoomHighValueGiftBannerAnimation.h"
|
#import "RoomHighValueGiftBannerAnimation.h"
|
||||||
|
|
||||||
#import "GiftAnimationHelper.h"
|
|
||||||
#import "GiftAnimationManager.h"
|
#import "GiftAnimationManager.h"
|
||||||
|
|
||||||
@interface XPRoomAnimationView ()<
|
@interface XPRoomAnimationView ()<
|
||||||
@@ -124,13 +123,7 @@ GiftAnimationDelegate>
|
|||||||
///礼物定时器 6s刷新一次
|
///礼物定时器 6s刷新一次
|
||||||
@property (nonatomic,strong)dispatch_source_t giftEffectTimer;
|
@property (nonatomic,strong)dispatch_source_t giftEffectTimer;
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - 送礼物的动画的
|
#pragma mark - 送礼物的动画的
|
||||||
///礼物的队列
|
|
||||||
//@property (nonatomic,strong) NSMutableArray<GiftReceiveInfoModel *> *giftQueue;
|
|
||||||
/////定时器
|
|
||||||
//@property (nonatomic ,strong)dispatch_source_t giftTimer;
|
|
||||||
@property(nonatomic, strong) GiftAnimationHelper *giftAnimationHelper;
|
|
||||||
@property(nonatomic, strong) GiftAnimationManager *giftAnimationManager;
|
@property(nonatomic, strong) GiftAnimationManager *giftAnimationManager;
|
||||||
///大礼物是否正在播放
|
///大礼物是否正在播放
|
||||||
@property (nonatomic,assign) BOOL isLargeGiftAnimating;
|
@property (nonatomic,assign) BOOL isLargeGiftAnimating;
|
||||||
@@ -218,7 +211,6 @@ GiftAnimationDelegate>
|
|||||||
[self initSubViews];
|
[self initSubViews];
|
||||||
[self initSubViewConstraints];
|
[self initSubViewConstraints];
|
||||||
|
|
||||||
self.giftAnimationHelper = [[GiftAnimationHelper alloc] init];
|
|
||||||
self.giftAnimationManager = [[GiftAnimationManager alloc] initWithContainerView:self.lowLevelView];
|
self.giftAnimationManager = [[GiftAnimationManager alloc] initWithContainerView:self.lowLevelView];
|
||||||
self.giftAnimationManager.delegate = self;
|
self.giftAnimationManager.delegate = self;
|
||||||
|
|
||||||
@@ -309,6 +301,7 @@ GiftAnimationDelegate>
|
|||||||
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
||||||
if (attachment.first == CustomMessageType_Gift) {
|
if (attachment.first == CustomMessageType_Gift) {
|
||||||
GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
|
GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
|
||||||
|
[receiveInfo giftDataAlignment];
|
||||||
|
|
||||||
if (attachment.second == Custom_Message_Sub_Gift_EmbeddedStyle) {
|
if (attachment.second == Custom_Message_Sub_Gift_EmbeddedStyle) {
|
||||||
if (receiveInfo.giftVo) {
|
if (receiveInfo.giftVo) {
|
||||||
@@ -338,14 +331,9 @@ GiftAnimationDelegate>
|
|||||||
receiveInfo.isLuckyBagGift = attachment.second == Custom_Message_Sub_Gift_LuckySend;
|
receiveInfo.isLuckyBagGift = attachment.second == Custom_Message_Sub_Gift_LuckySend;
|
||||||
receiveInfo.isBatch = (attachment.second == Custom_Message_Sub_AllBatchSend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend);
|
receiveInfo.isBatch = (attachment.second == Custom_Message_Sub_AllBatchSend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend);
|
||||||
receiveInfo.isComboBatch = attachment.second == Custom_Message_Sub_AllMicroSend;
|
receiveInfo.isComboBatch = attachment.second == Custom_Message_Sub_AllMicroSend;
|
||||||
|
|
||||||
if (receiveInfo.gift.notifyFull && attachment.second == Custom_Message_Sub_Gift_Send) {
|
|
||||||
// return;
|
|
||||||
} else {
|
|
||||||
[self receiveGiftHandleSendGiftAnimation:attachment];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (receiveInfo.isLuckyBagGift) {
|
if (receiveInfo.isLuckyBagGift) {
|
||||||
|
[self receiveGiftHandleSendGiftAnimation:attachment];
|
||||||
if (!self.delegate.getRoomInfo.hasAnimationEffect) {return;}
|
if (!self.delegate.getRoomInfo.hasAnimationEffect) {return;}
|
||||||
if (receiveInfo.viewUrl.length > 0) {
|
if (receiveInfo.viewUrl.length > 0) {
|
||||||
[self playLuckyGiftEffectWithVapUrl:receiveInfo.viewUrl];
|
[self playLuckyGiftEffectWithVapUrl:receiveInfo.viewUrl];
|
||||||
@@ -360,23 +348,21 @@ GiftAnimationDelegate>
|
|||||||
[self receiveGift:receiveInfo];
|
[self receiveGift:receiveInfo];
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (receiveInfo.gift.notifyFull && attachment.second == Custom_Message_Sub_Gift_Send) {
|
if (receiveInfo.gift.notifyFull == 1 && attachment.second == Custom_Message_Sub_Gift_Send) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
[self receiveGiftHandleSendGiftAnimation:attachment];
|
||||||
[self receiveGift:receiveInfo];
|
[self receiveGift:receiveInfo];
|
||||||
}
|
}
|
||||||
} else if (attachment.first == CustomMessageType_AllMicroSend) { //发送全麦礼物 或者多人礼物
|
} else if (attachment.first == CustomMessageType_AllMicroSend) { //发送全麦礼物 或者多人礼物
|
||||||
GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
|
GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
|
||||||
|
[receiveInfo giftDataAlignment];
|
||||||
receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend);
|
receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend);
|
||||||
receiveInfo.isComboBatch = attachment.second == Custom_Message_Sub_AllMicroSend;
|
receiveInfo.isComboBatch = attachment.second == Custom_Message_Sub_AllMicroSend;
|
||||||
receiveInfo.isBatch = (attachment.second == Custom_Message_Sub_AllBatchSend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend);
|
receiveInfo.isBatch = (attachment.second == Custom_Message_Sub_AllBatchSend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend);
|
||||||
|
|
||||||
if (receiveInfo.gift.notifyFull) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
[self receiveGiftHandleSendGiftAnimation:attachment];
|
|
||||||
if (receiveInfo.isLuckyBagGift) {
|
if (receiveInfo.isLuckyBagGift) {
|
||||||
|
[self receiveGiftHandleSendGiftAnimation:attachment];
|
||||||
if (!self.delegate.getRoomInfo.hasAnimationEffect) {return;}
|
if (!self.delegate.getRoomInfo.hasAnimationEffect) {return;}
|
||||||
if (receiveInfo.viewUrl.length > 0) {
|
if (receiveInfo.viewUrl.length > 0) {
|
||||||
[self playLuckyGiftEffectWithVapUrl:receiveInfo.viewUrl];
|
[self playLuckyGiftEffectWithVapUrl:receiveInfo.viewUrl];
|
||||||
@@ -391,6 +377,7 @@ GiftAnimationDelegate>
|
|||||||
[self receiveGift:receiveInfo];
|
[self receiveGift:receiveInfo];
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
[self receiveGiftHandleSendGiftAnimation:attachment];
|
||||||
[self receiveGift:receiveInfo];
|
[self receiveGift:receiveInfo];
|
||||||
}
|
}
|
||||||
} else if (attachment.first == CustomMessageType_LuckyBag ) {//福袋消息厅内展示
|
} else if (attachment.first == CustomMessageType_LuckyBag ) {//福袋消息厅内展示
|
||||||
@@ -1670,10 +1657,7 @@ GiftAnimationDelegate>
|
|||||||
receiveInfo.gift = giftInfo;
|
receiveInfo.gift = giftInfo;
|
||||||
receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend || attachment.second == Custom_Message_Sub_Gift_LuckySend);
|
receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend || attachment.second == Custom_Message_Sub_Gift_LuckySend);
|
||||||
[self.giftAnimationManager enqueueGift:receiveInfo];
|
[self.giftAnimationManager enqueueGift:receiveInfo];
|
||||||
// [self.giftQueue addObject:receiveInfo];
|
|
||||||
// if (self.giftTimer == nil && self.giftQueue > 0) {
|
|
||||||
// [self startGiftQueueTimer];
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 收到礼物展示动画
|
#pragma mark - 收到礼物展示动画
|
||||||
@@ -1702,33 +1686,8 @@ GiftAnimationDelegate>
|
|||||||
receiveInfo.gift = giftInfo;
|
receiveInfo.gift = giftInfo;
|
||||||
receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend || attachment.second == Custom_Message_Sub_Gift_LuckySend);
|
receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend || attachment.second == Custom_Message_Sub_Gift_LuckySend);
|
||||||
[self.giftAnimationManager enqueueGift:receiveInfo];
|
[self.giftAnimationManager enqueueGift:receiveInfo];
|
||||||
// [self.giftQueue addObject:receiveInfo];
|
|
||||||
// if (self.giftTimer == nil && self.giftQueue > 0) {
|
|
||||||
// [self startGiftQueueTimer];
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
//扫描礼物队列
|
}
|
||||||
//- (void)startGiftQueueTimer {
|
|
||||||
// static NSTimeInterval period = 0.5; //设置时间间隔一个礼物动画的时间
|
|
||||||
// dispatch_source_t _timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(0, 0));
|
|
||||||
// dispatch_source_set_timer(_timer, DISPATCH_TIME_NOW, period * NSEC_PER_SEC, 0 * NSEC_PER_SEC);
|
|
||||||
// dispatch_source_set_event_handler(_timer, ^{
|
|
||||||
// dispatch_async(dispatch_get_main_queue(), ^{
|
|
||||||
// if (self.giftQueue.count) {
|
|
||||||
// GiftReceiveInfoModel * receiveInfo = self.giftQueue.firstObject;
|
|
||||||
//// [self handoutGiftDistributeAnimation:receiveInfo];
|
|
||||||
// [self.giftAnimationManager enqueueGift:receiveInfo];
|
|
||||||
// [self.giftQueue removeObject:receiveInfo];
|
|
||||||
// }else {
|
|
||||||
// dispatch_source_cancel(_timer);
|
|
||||||
// self.giftTimer = nil;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// dispatch_resume(_timer);
|
|
||||||
// self.giftTimer = _timer;
|
|
||||||
//}
|
|
||||||
|
|
||||||
#pragma mark - GiftAnimationManagerDelegate
|
#pragma mark - GiftAnimationManagerDelegate
|
||||||
- (CGPoint)animationPointAtStageViewByUid:(NSString *)uid {
|
- (CGPoint)animationPointAtStageViewByUid:(NSString *)uid {
|
||||||
@@ -2878,13 +2837,6 @@ GiftAnimationDelegate>
|
|||||||
return _highLevleView;
|
return _highLevleView;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- (NSMutableArray<GiftReceiveInfoModel *> *)giftQueue {
|
|
||||||
// if (!_giftQueue) {
|
|
||||||
// _giftQueue = [NSMutableArray array];
|
|
||||||
// }
|
|
||||||
// return _giftQueue;
|
|
||||||
//}
|
|
||||||
|
|
||||||
- (NSMutableArray<NSDictionary *> *)carEffectQueue {
|
- (NSMutableArray<NSDictionary *> *)carEffectQueue {
|
||||||
if (_carEffectQueue == nil) {
|
if (_carEffectQueue == nil) {
|
||||||
_carEffectQueue = [NSMutableArray array];
|
_carEffectQueue = [NSMutableArray array];
|
||||||
|
@@ -296,10 +296,14 @@
|
|||||||
|
|
||||||
// 定时器触发的事件处理
|
// 定时器触发的事件处理
|
||||||
dispatch_source_set_event_handler(self.timer, ^{
|
dispatch_source_set_event_handler(self.timer, ^{
|
||||||
[self processGiftComboQueue];
|
|
||||||
[self processRequestQueue];
|
[self processRequestQueue];
|
||||||
|
[self processGiftComboQueue];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// **立即执行一次处理方法**
|
||||||
|
[self processRequestQueue];
|
||||||
|
[self processGiftComboQueue];
|
||||||
|
|
||||||
// 启动定时器
|
// 启动定时器
|
||||||
dispatch_resume(self.timer);
|
dispatch_resume(self.timer);
|
||||||
}
|
}
|
||||||
@@ -308,8 +312,15 @@
|
|||||||
- (void)stopProcessingQueue {
|
- (void)stopProcessingQueue {
|
||||||
if (self.timer) {
|
if (self.timer) {
|
||||||
if (self.requestQueue.count == 0 && self.giftComboQueue.count == 0) {
|
if (self.requestQueue.count == 0 && self.giftComboQueue.count == 0) {
|
||||||
|
// 取消定时器
|
||||||
dispatch_source_cancel(self.timer);
|
dispatch_source_cancel(self.timer);
|
||||||
self.timer = nil;
|
|
||||||
|
// 设置取消回调,在资源完全释放后将 timer 置为 nil
|
||||||
|
@kWeakify(self);
|
||||||
|
dispatch_source_set_cancel_handler(self.timer, ^{
|
||||||
|
@kStrongify(self);
|
||||||
|
self.timer = nil;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -325,7 +336,6 @@
|
|||||||
// 处理逻辑
|
// 处理逻辑
|
||||||
[self processGiftComboWith:attachment];
|
[self processGiftComboWith:attachment];
|
||||||
} else {
|
} else {
|
||||||
// 如果队列为空,停止定时器
|
|
||||||
[self stopProcessingQueue];
|
[self stopProcessingQueue];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -348,7 +358,6 @@
|
|||||||
[self handleSendGift:dic];
|
[self handleSendGift:dic];
|
||||||
[self.requestQueue removeObject:dic];
|
[self.requestQueue removeObject:dic];
|
||||||
} else {
|
} else {
|
||||||
// 如果队列为空,停止定时器
|
|
||||||
[self stopProcessingQueue];
|
[self stopProcessingQueue];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -132,7 +132,7 @@ typedef NS_ENUM(NSUInteger, RoomSendGiftType) {
|
|||||||
@property (nonatomic, strong) i18nGiftNameMap *i18nGiftNameMap;
|
@property (nonatomic, strong) i18nGiftNameMap *i18nGiftNameMap;
|
||||||
|
|
||||||
@property(nonatomic, assign) NSInteger showAvatarType; // 是否需要塞头像,0-否,1-送礼者,2-收礼者,3-左送右收
|
@property(nonatomic, assign) NSInteger showAvatarType; // 是否需要塞头像,0-否,1-送礼者,2-收礼者,3-左送右收
|
||||||
@property(nonatomic, assign) BOOL notifyFull; // 该礼物动画是否全房间播放
|
@property(nonatomic, assign) NSInteger notifyFull; // 该礼物动画是否全房间播放
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@@ -143,6 +143,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
- (NSInteger)receiveUserCount;
|
- (NSInteger)receiveUserCount;
|
||||||
|
|
||||||
|
- (void)giftDataAlignment;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -80,4 +80,28 @@
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)giftDataAlignment {
|
||||||
|
if (!_gift) {
|
||||||
|
if (_giftVo) {
|
||||||
|
_gift = _giftVo;
|
||||||
|
} else if (_giftInfo) {
|
||||||
|
_gift = _giftInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!_giftVo) {
|
||||||
|
if (_gift) {
|
||||||
|
_giftVo = _gift;
|
||||||
|
} else if (_giftInfo) {
|
||||||
|
_giftVo = _giftInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!_giftInfo) {
|
||||||
|
if (_giftVo) {
|
||||||
|
_giftInfo = _giftVo;
|
||||||
|
} else if (_gift) {
|
||||||
|
_giftInfo = _gift;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -115,7 +115,7 @@
|
|||||||
|
|
||||||
[self.giftNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.giftNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.top.mas_equalTo(self.giftImageView.mas_bottom).offset(3);
|
make.top.mas_equalTo(self.giftImageView.mas_bottom).offset(3);
|
||||||
make.centerX.mas_equalTo(self.giftImageView);
|
make.leading.trailing.mas_equalTo(self.contentView).inset(2);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self.priceStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.priceStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
@@ -278,6 +278,7 @@
|
|||||||
_giftNameLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightSemibold];
|
_giftNameLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightSemibold];
|
||||||
_giftNameLabel.textAlignment = NSTextAlignmentCenter;
|
_giftNameLabel.textAlignment = NSTextAlignmentCenter;
|
||||||
_giftNameLabel.textColor = [DJDKMIMOMColor mainTextColor];
|
_giftNameLabel.textColor = [DJDKMIMOMColor mainTextColor];
|
||||||
|
_giftNameLabel.numberOfLines = 0;
|
||||||
}
|
}
|
||||||
return _giftNameLabel;
|
return _giftNameLabel;
|
||||||
}
|
}
|
||||||
|
@@ -17,8 +17,6 @@
|
|||||||
@property (nonatomic, strong) UIView *container;
|
@property (nonatomic, strong) UIView *container;
|
||||||
@property (nonatomic, strong) UILabel *comboCountLabel;
|
@property (nonatomic, strong) UILabel *comboCountLabel;
|
||||||
@property(nonatomic, strong) UILabel *comboGoldLabel;
|
@property(nonatomic, strong) UILabel *comboGoldLabel;
|
||||||
@property(nonatomic, strong) UILabel *updateGoldLabel;
|
|
||||||
@property(nonatomic, strong) UILabel *winPriceGoldLabel;
|
|
||||||
@property (nonatomic, strong) SVGAImageView *playImageView;
|
@property (nonatomic, strong) SVGAImageView *playImageView;
|
||||||
@property (nonatomic, strong) SVGAVideoEntity *svgaVideoEntity;
|
@property (nonatomic, strong) SVGAVideoEntity *svgaVideoEntity;
|
||||||
@property (nonatomic, strong) CountdownRingView *countdownRingView;
|
@property (nonatomic, strong) CountdownRingView *countdownRingView;
|
||||||
@@ -26,7 +24,10 @@
|
|||||||
@property(nonatomic, strong) NSMutableArray *updateGoldQueue;
|
@property(nonatomic, strong) NSMutableArray *updateGoldQueue;
|
||||||
@property(nonatomic, assign) BOOL isAnimatingUpdateGold;
|
@property(nonatomic, assign) BOOL isAnimatingUpdateGold;
|
||||||
|
|
||||||
@property(nonatomic, strong) UIImpactFeedbackGenerator *f;
|
@property(nonatomic, strong) UIImpactFeedbackGenerator *feedbackGenerator;
|
||||||
|
|
||||||
|
@property (nonatomic, strong) dispatch_queue_t animationQueue; // 串行队列,确保线程安全
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@
|
|||||||
|
|
||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
self.f = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleHeavy];
|
self.feedbackGenerator = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleHeavy];
|
||||||
self.updateGoldQueue = @[].mutableCopy;
|
self.updateGoldQueue = @[].mutableCopy;
|
||||||
[self setupNotification];
|
[self setupNotification];
|
||||||
|
|
||||||
@@ -54,51 +55,56 @@
|
|||||||
make.height.mas_equalTo(self.mas_height).multipliedBy(0.75);
|
make.height.mas_equalTo(self.mas_height).multipliedBy(0.75);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
// UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapSpace)];
|
|
||||||
// tap.delegate = self;
|
|
||||||
// [self addGestureRecognizer:tap];
|
|
||||||
|
|
||||||
[self setupUI];
|
[self setupUI];
|
||||||
[self setupTimer];
|
[self setupTimer];
|
||||||
[self updateCount];
|
[self updateCount];
|
||||||
|
[self setupSVGAParser];
|
||||||
SVGAParser *_parser = [SVGAParser new];
|
|
||||||
@kWeakify(self);
|
|
||||||
[_parser parseWithNamed:@"Combo_Boom"
|
|
||||||
inBundle:nil
|
|
||||||
completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
|
|
||||||
@kStrongify(self);
|
|
||||||
self.svgaVideoEntity = videoItem;
|
|
||||||
self.playImageView.loops = 1;
|
|
||||||
self.playImageView.clearsAfterStop = NO;
|
|
||||||
self.playImageView.videoItem = videoItem;
|
|
||||||
} failureBlock:^(NSError * _Nullable error) {
|
|
||||||
NSLog(@"%@", error);
|
|
||||||
}];
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setupSVGAParser {
|
||||||
|
SVGAParser *parser = [SVGAParser new];
|
||||||
|
@kWeakify(self);
|
||||||
|
[parser parseWithNamed:@"Combo_Boom"
|
||||||
|
inBundle:nil
|
||||||
|
completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
|
||||||
|
@kStrongify(self);
|
||||||
|
self.svgaVideoEntity = videoItem;
|
||||||
|
self.playImageView.loops = 1;
|
||||||
|
self.playImageView.clearsAfterStop = NO;
|
||||||
|
self.playImageView.videoItem = videoItem;
|
||||||
|
} failureBlock:^(NSError * _Nullable error) {
|
||||||
|
NSLog(@"%@", error);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setupNotification {
|
- (void)setupNotification {
|
||||||
[[NSNotificationCenter defaultCenter] addObserverForName:@"receiveLuckGiftWinning"
|
[[NSNotificationCenter defaultCenter] addObserverForName:@"receiveLuckGiftWinning"
|
||||||
object:nil
|
object:nil
|
||||||
queue:[NSOperationQueue mainQueue]
|
queue:[NSOperationQueue mainQueue]
|
||||||
usingBlock:^(NSNotification * _Nonnull notification) {
|
usingBlock:^(NSNotification * _Nonnull notification) {
|
||||||
if ([notification.object isKindOfClass:[NSString class]]) {
|
if ([notification.object isKindOfClass:[NSString class]]) {
|
||||||
NSString *coin = (NSString *)notification.object;
|
[self handleStringNotification:notification.object];
|
||||||
if (![NSString isEmpty:coin]) {
|
|
||||||
[self updateCurrentGold:coin.doubleValue giftPrice:0 isFromWinning:YES];
|
|
||||||
}
|
|
||||||
} else if ([notification.object isKindOfClass:[NSDictionary class]]) {
|
} else if ([notification.object isKindOfClass:[NSDictionary class]]) {
|
||||||
NSDictionary *dic = (NSDictionary *)notification.object;
|
[self handleDictionaryNotification:notification.object];
|
||||||
double coin = [[dic objectForKey:@"CurrentGold"] doubleValue];
|
|
||||||
double price = [[dic objectForKey:@"Price"] doubleValue];
|
|
||||||
BOOL isFromWinning = [[dic objectForKey:@"isFromWinning"] boolValue];
|
|
||||||
[self updateCurrentGold:coin giftPrice:price isFromWinning:isFromWinning];
|
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)handleStringNotification:(NSString *)coin {
|
||||||
|
if (![NSString isEmpty:coin]) {
|
||||||
|
[self updateCurrentGold:coin.doubleValue giftPrice:0 isFromWinning:YES];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)handleDictionaryNotification:(NSDictionary *)dic {
|
||||||
|
double coin = [[dic objectForKey:@"CurrentGold"] doubleValue];
|
||||||
|
double price = [[dic objectForKey:@"Price"] doubleValue];
|
||||||
|
BOOL isFromWinning = [[dic objectForKey:@"isFromWinning"] boolValue];
|
||||||
|
[self updateCurrentGold:coin giftPrice:price isFromWinning:isFromWinning];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)updateCount {
|
- (void)updateCount {
|
||||||
NSString *countStr = [NSString stringWithFormat:@"x%ld", [[GiftComboManager sharedManager] loadComboCount]];
|
NSString *countStr = [NSString stringWithFormat:@"x%ld", [[GiftComboManager sharedManager] loadComboCount]];
|
||||||
NSShadow *shadow = [[NSShadow alloc] init];
|
NSShadow *shadow = [[NSShadow alloc] init];
|
||||||
@@ -172,18 +178,6 @@
|
|||||||
make.centerY.mas_equalTo(self.comboGoldLabel);
|
make.centerY.mas_equalTo(self.comboGoldLabel);
|
||||||
make.height.mas_equalTo(36);
|
make.height.mas_equalTo(36);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self addSubview:self.updateGoldLabel];
|
|
||||||
[self.updateGoldLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
||||||
make.trailing.mas_equalTo(self.comboGoldLabel);
|
|
||||||
make.bottom.mas_equalTo(self.comboGoldLabel);
|
|
||||||
}];
|
|
||||||
|
|
||||||
[self addSubview:self.winPriceGoldLabel];
|
|
||||||
[self.winPriceGoldLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
||||||
make.trailing.mas_equalTo(self.comboGoldLabel);
|
|
||||||
make.bottom.mas_equalTo(self.comboGoldLabel);
|
|
||||||
}];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setupTimer {
|
- (void)setupTimer {
|
||||||
@@ -215,7 +209,7 @@
|
|||||||
// 1521 连续震动 3 次
|
// 1521 连续震动 3 次
|
||||||
// AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
|
// AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
|
||||||
// AudioServicesPlaySystemSound(SystemSoundID(kSystemSoundID_Vibrate));
|
// AudioServicesPlaySystemSound(SystemSoundID(kSystemSoundID_Vibrate));
|
||||||
[self.f impactOccurred];
|
[self.feedbackGenerator impactOccurred];
|
||||||
|
|
||||||
[[GiftComboManager sharedManager] sendGift];
|
[[GiftComboManager sharedManager] sendGift];
|
||||||
[self.playImageView startAnimation];
|
[self.playImageView startAnimation];
|
||||||
@@ -238,155 +232,89 @@
|
|||||||
self.comboGoldLabel.text = @(gold).stringValue;
|
self.comboGoldLabel.text = @(gold).stringValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)addToGoldQueue:(NSString *)goldString {
|
||||||
|
@synchronized (self.updateGoldQueue) {
|
||||||
|
[self.updateGoldQueue addObject:goldString];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)insertToGoldQueue:(NSString *)goldString {
|
||||||
|
@synchronized (self.updateGoldQueue) {
|
||||||
|
[self.updateGoldQueue insertObject:goldString atIndex:0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)removeFromGoldQueue {
|
||||||
|
@synchronized (self.updateGoldQueue) {
|
||||||
|
if (self.updateGoldQueue.count > 0) {
|
||||||
|
NSString *goldString = [self.updateGoldQueue firstObject];
|
||||||
|
[self.updateGoldQueue removeObjectAtIndex:0];
|
||||||
|
return goldString;
|
||||||
|
}
|
||||||
|
return @"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void)updateCurrentGold:(double)gold giftPrice:(double)price isFromWinning:(BOOL)isFromWinning {
|
- (void)updateCurrentGold:(double)gold giftPrice:(double)price isFromWinning:(BOOL)isFromWinning {
|
||||||
// if (isFromWinning) {
|
|
||||||
// [self.updateGoldQueue insertObject:[NSString stringWithFormat:@"+ %@", @(gold)] atIndex:0];
|
|
||||||
// [self processNextUpdateGold];
|
|
||||||
// } else {
|
|
||||||
// [self.updateGoldQueue addObject:@(-price).stringValue];
|
|
||||||
// self.comboGoldLabel.text = @(gold).stringValue;
|
|
||||||
// if (!self.isAnimatingUpdateGold) {
|
|
||||||
// [self processNextUpdateGold];
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
NSString *goldString = isFromWinning ? [NSString stringWithFormat:@"+ %@", @(gold)] : @(-price).stringValue;
|
NSString *goldString = isFromWinning ? [NSString stringWithFormat:@"+ %@", @(gold)] : @(-price).stringValue;
|
||||||
if (isFromWinning) {
|
if (isFromWinning) {
|
||||||
[self.updateGoldQueue insertObject:goldString atIndex:0];
|
[self insertToGoldQueue:goldString];
|
||||||
[self processNextUpdateGold];
|
[self processNextUpdateGold];
|
||||||
} else {
|
} else {
|
||||||
[self.updateGoldQueue addObject:goldString];
|
[self addToGoldQueue:goldString];
|
||||||
self.comboGoldLabel.text = @(gold).stringValue;
|
self.comboGoldLabel.text = @(gold).stringValue;
|
||||||
|
|
||||||
if (!self.isAnimatingUpdateGold) {
|
if (!self.isAnimatingUpdateGold) {
|
||||||
[self processNextUpdateGold];
|
[self processNextUpdateGold];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)processNextUpdateGold {
|
- (void)processNextUpdateGold {
|
||||||
// if (self.updateGoldQueue.count == 0) {
|
|
||||||
// self.isAnimatingUpdateGold = NO;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// NSNumber *goldNum = [self.updateGoldQueue xpSafeObjectAtIndex:0];
|
|
||||||
// [self.updateGoldQueue removeObjectAtIndex:0];
|
|
||||||
//
|
|
||||||
// self.isAnimatingUpdateGold = YES;
|
|
||||||
//
|
|
||||||
// if (goldNum.integerValue < 0) {
|
|
||||||
// self.updateGoldLabel.text = goldNum.stringValue;
|
|
||||||
// [self showGoldUpdateAnimation];
|
|
||||||
// } else {
|
|
||||||
// self.winPriceGoldLabel.text = goldNum.stringValue;
|
|
||||||
// [self showGoldWinPriceAnimation];
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (self.updateGoldQueue.count == 0) {
|
if (self.updateGoldQueue.count == 0) {
|
||||||
self.isAnimatingUpdateGold = NO;
|
self.isAnimatingUpdateGold = NO;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *goldString = [self.updateGoldQueue xpSafeObjectAtIndex:0];
|
NSString *goldString = [self removeFromGoldQueue];
|
||||||
[self.updateGoldQueue removeObjectAtIndex:0];
|
|
||||||
|
|
||||||
self.isAnimatingUpdateGold = YES;
|
self.isAnimatingUpdateGold = YES;
|
||||||
|
|
||||||
BOOL isWinning = [goldString containsString:@"+"]; // 区分正负值
|
BOOL isWinning = [goldString containsString:@"+"]; // 区分正负值
|
||||||
UILabel *targetLabel = isWinning ? [self winPriceGoldLabel] : [self updateGoldLabel];
|
UILabel *targetLabel = isWinning ? [self winPriceGoldLabel] : [self updateGoldLabel];
|
||||||
// [self addSubview:targetLabel];
|
targetLabel.textAlignment = NSTextAlignmentNatural;
|
||||||
// [targetLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
if (isWinning) {
|
||||||
//// make.trailing.mas_equalTo(self.comboGoldLabel);
|
[self updateWinPriceGoldLabelWithText:goldString label:targetLabel];
|
||||||
//// make.bottom.trailing.mas_equalTo(self.comboGoldLabel);
|
} else {
|
||||||
// make.leading.mas_equalTo(44);
|
[self updateGoldLabelWithText:goldString label:targetLabel];
|
||||||
// make.bottom.mas_equalTo(-44);
|
}
|
||||||
// }];
|
[self addSubview:targetLabel];
|
||||||
CGFloat offset = isWinning ? -80 : -40;
|
if (isMSRTL()) {
|
||||||
|
targetLabel.frame = CGRectMake(KScreenWidth - 60 - 120, KScreenHeight - 60, 120, 30);
|
||||||
|
} else {
|
||||||
|
targetLabel.frame = CGRectMake(60, KScreenHeight - 60, 120, 30);
|
||||||
|
}
|
||||||
|
CGFloat offset = isWinning ? -80 : -50;
|
||||||
|
|
||||||
[self showGoldAnimationOnLabel:targetLabel withText:goldString offset:offset];
|
[self showGoldAnimationOnLabel:targetLabel offset:offset isForWinPrice:isWinning];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showGoldAnimationOnLabel:(UILabel *)label withText:(NSString *)text offset:(CGFloat)offset {
|
- (void)showGoldAnimationOnLabel:(UILabel *)label offset:(CGFloat)offset isForWinPrice:(BOOL)isForWin{
|
||||||
label.text = text;
|
|
||||||
label.alpha = 0;
|
label.alpha = 0;
|
||||||
|
|
||||||
[UIView animateWithDuration:0.2 animations:^{
|
[UIView animateWithDuration:0.2 animations:^{
|
||||||
[label mas_updateConstraints:^(MASConstraintMaker *make) {
|
label.transform = CGAffineTransformTranslate(CGAffineTransformIdentity, 0, offset);
|
||||||
// make.bottom.mas_equalTo(-44 + offset);
|
label.alpha = 1;
|
||||||
make.bottom.mas_equalTo(self.comboGoldLabel.mas_bottom).offset(offset);
|
} completion:^(BOOL finished) {
|
||||||
}];
|
[UIView animateWithDuration:0.2 delay:isForWin ? 1.5 : 0.4 options:UIViewAnimationOptionCurveLinear animations:^{
|
||||||
label.alpha = 1;
|
// label.transform = CGAffineTransformIdentity;
|
||||||
[self layoutIfNeeded];
|
label.alpha = 0;
|
||||||
} completion:^(BOOL finished) {
|
} completion:^(BOOL finished) {
|
||||||
[UIView animateWithDuration:0.0
|
|
||||||
delay:0.2
|
|
||||||
options:UIViewAnimationOptionCurveLinear
|
|
||||||
animations:^{
|
|
||||||
[label mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
||||||
make.bottom.mas_equalTo(self.comboGoldLabel.mas_bottom).offset(0);
|
|
||||||
}];
|
|
||||||
label.alpha = 0;
|
|
||||||
// [self layoutIfNeeded];
|
|
||||||
} completion:^(BOOL finished) {
|
|
||||||
// [label removeFromSuperview];
|
|
||||||
self.isAnimatingUpdateGold = NO;
|
|
||||||
[self processNextUpdateGold];
|
|
||||||
}];
|
|
||||||
// self.isAnimatingUpdateGold = NO;
|
|
||||||
// [self processNextUpdateGold];
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)showGoldUpdateAnimation {
|
}];
|
||||||
self.updateGoldLabel.alpha = 0;
|
self.isAnimatingUpdateGold = NO;
|
||||||
[UIView animateWithDuration:0.1 animations:^{
|
[self processNextUpdateGold];
|
||||||
[self.updateGoldLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
}];
|
||||||
make.bottom.mas_equalTo(self.comboGoldLabel.mas_bottom).offset(-40);;
|
|
||||||
}];
|
|
||||||
self.updateGoldLabel.alpha = 1;
|
|
||||||
[self layoutIfNeeded];
|
|
||||||
} completion:^(BOOL finished) {
|
|
||||||
[UIView animateWithDuration:0.0
|
|
||||||
delay:0.15
|
|
||||||
options:UIViewAnimationOptionCurveLinear
|
|
||||||
animations:^{
|
|
||||||
[self.updateGoldLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
||||||
make.bottom.mas_equalTo(self.comboGoldLabel.mas_bottom).offset(0);
|
|
||||||
}];
|
|
||||||
self.updateGoldLabel.alpha = 0;
|
|
||||||
[self layoutIfNeeded];
|
|
||||||
} completion:^(BOOL finished) {
|
|
||||||
self.isAnimatingUpdateGold = NO;
|
|
||||||
[self processNextUpdateGold];
|
|
||||||
}];
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)showGoldWinPriceAnimation {
|
|
||||||
self.winPriceGoldLabel.alpha = 0;
|
|
||||||
[UIView animateWithDuration:0.1 animations:^{
|
|
||||||
[self.winPriceGoldLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
||||||
make.bottom.mas_equalTo(self.comboGoldLabel.mas_bottom).offset(-60);
|
|
||||||
}];
|
|
||||||
self.winPriceGoldLabel.alpha = 1;
|
|
||||||
[self layoutIfNeeded];
|
|
||||||
} completion:^(BOOL finished) {
|
|
||||||
[UIView animateWithDuration:0.0
|
|
||||||
delay:0.15
|
|
||||||
options:UIViewAnimationOptionCurveLinear
|
|
||||||
animations:^{
|
|
||||||
[self.winPriceGoldLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
||||||
make.bottom.mas_equalTo(self.comboGoldLabel.mas_bottom).offset(0);
|
|
||||||
}];
|
|
||||||
self.winPriceGoldLabel.alpha = 0;
|
|
||||||
[self layoutIfNeeded];
|
|
||||||
} completion:^(BOOL finished) {
|
|
||||||
self.isAnimatingUpdateGold = NO;
|
|
||||||
[self processNextUpdateGold];
|
|
||||||
}];
|
|
||||||
}];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
@@ -427,19 +355,40 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (UILabel *)updateGoldLabel {
|
- (UILabel *)updateGoldLabel {
|
||||||
// return [UILabel labelInitWithText:@"" font:kFontSemibold(24) textColor:UIColorFromRGB(0xffd54c)];;
|
return [UILabel labelInitWithText:@"" font:kFontSemibold(24) textColor:UIColorFromRGB(0xffd54c)];
|
||||||
if (!_updateGoldLabel) {
|
|
||||||
_updateGoldLabel = [UILabel labelInitWithText:@"" font:kFontSemibold(24) textColor:UIColorFromRGB(0xffd54c)];
|
|
||||||
}
|
|
||||||
return _updateGoldLabel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UILabel *)winPriceGoldLabel {
|
- (UILabel *)winPriceGoldLabel {
|
||||||
// return [UILabel labelInitWithText:@"" font:kFontSemibold(24) textColor:UIColorFromRGB(0xBC36FF)];
|
return [UILabel labelInitWithText:@"" font:kFontSemibold(24) textColor:UIColorFromRGB(0xBC36FF)];
|
||||||
if (!_winPriceGoldLabel) {
|
}
|
||||||
_winPriceGoldLabel = [UILabel labelInitWithText:@"" font:kFontSemibold(24) textColor:UIColorFromRGB(0xBC36FF)];
|
|
||||||
}
|
- (void)updateGoldLabelWithText:(NSString *)text label:(UILabel *)label {
|
||||||
return _winPriceGoldLabel;
|
label.attributedText = [self attributedStringWithText:text
|
||||||
|
font:[UIFont boldSystemFontOfSize:24]
|
||||||
|
textColor:UIColorFromRGB(0xffd54c)
|
||||||
|
shadowColor:[UIColor colorWithWhite:1 alpha:0.4]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)updateWinPriceGoldLabelWithText:(NSString *)text label:(UILabel *)label {
|
||||||
|
label.attributedText = [self attributedStringWithText:text
|
||||||
|
font:[UIFont boldSystemFontOfSize:26]
|
||||||
|
textColor:UIColorFromRGB(0xBC36FF)
|
||||||
|
shadowColor:[UIColor colorWithWhite:1 alpha:0.8]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSAttributedString *)attributedStringWithText:(NSString *)text font:(UIFont *)font textColor:(UIColor *)color shadowColor:(UIColor *)shadowColor {
|
||||||
|
NSShadow *shadow = [[NSShadow alloc] init];
|
||||||
|
shadow.shadowBlurRadius = 4.0; // 亮边模糊程度
|
||||||
|
shadow.shadowColor = shadowColor; // 亮边颜色
|
||||||
|
shadow.shadowOffset = CGSizeZero; // 亮边偏移
|
||||||
|
|
||||||
|
NSDictionary *attributes = @{
|
||||||
|
NSFontAttributeName: font,
|
||||||
|
NSForegroundColorAttributeName: color,
|
||||||
|
NSShadowAttributeName: shadow
|
||||||
|
};
|
||||||
|
|
||||||
|
return [[NSAttributedString alloc] initWithString:text attributes:attributes];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (SVGAImageView *)playImageView {
|
- (SVGAImageView *)playImageView {
|
||||||
|
@@ -308,7 +308,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
|
|||||||
oringinDic:data
|
oringinDic:data
|
||||||
isToOne:NO];
|
isToOne:NO];
|
||||||
} else {
|
} else {
|
||||||
[self sendGiftToAllMessage:data];
|
[self sendGiftToMultipleMessage:data isAll:YES];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (receiveModel.roomSendGiftType == RoomSendGiftType_MutableOnMic) { // 多人非全麦
|
} else if (receiveModel.roomSendGiftType == RoomSendGiftType_MutableOnMic) { // 多人非全麦
|
||||||
@@ -324,7 +324,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
|
|||||||
oringinDic:data
|
oringinDic:data
|
||||||
isToOne:NO];
|
isToOne:NO];
|
||||||
} else {
|
} else {
|
||||||
[self sendGiftToMultipleMessage:data];
|
[self sendGiftToMultipleMessage:data isAll:NO];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (receiveModel.roomSendGiftType == RoomSendGiftType_ToOne) { // 单人
|
} else if (receiveModel.roomSendGiftType == RoomSendGiftType_ToOne) { // 单人
|
||||||
@@ -382,23 +382,24 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
|
|||||||
[self sendCustomMessage:attachment];
|
[self sendCustomMessage:attachment];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)sendGiftToMultipleMessage:(NSMutableDictionary *)data {
|
- (void)sendGiftToMultipleMessage:(NSMutableDictionary *)data isAll:(BOOL)isALl{
|
||||||
AttachmentModel *attachment = [[AttachmentModel alloc] init];
|
AttachmentModel *attachment = [[AttachmentModel alloc] init];
|
||||||
attachment.first = CustomMessageType_AllMicroSend;
|
attachment.first = CustomMessageType_AllMicroSend;
|
||||||
attachment.second = Custom_Message_Sub_AllBatchSend;
|
attachment.second = isALl ? Custom_Message_Sub_AllMicroSend : Custom_Message_Sub_AllBatchSend;
|
||||||
attachment.data = data.copy;
|
|
||||||
[self sendCustomMessage:attachment];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)sendGiftToAllMessage:(NSMutableDictionary *)data {
|
|
||||||
AttachmentModel * attachment = [[AttachmentModel alloc] init];
|
|
||||||
attachment.first = CustomMessageType_AllMicroSend;
|
|
||||||
attachment.second = Custom_Message_Sub_AllMicroSend;
|
|
||||||
[data setObject:[data valueForKeyPath:@"targetUsers.uid"] forKey:@"targetUids"];
|
[data setObject:[data valueForKeyPath:@"targetUsers.uid"] forKey:@"targetUids"];
|
||||||
attachment.data = data;
|
attachment.data = data;
|
||||||
[self sendCustomMessage:attachment];
|
[self sendCustomMessage:attachment];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- (void)sendGiftToAllMessage:(NSMutableDictionary *)data {
|
||||||
|
// AttachmentModel * attachment = [[AttachmentModel alloc] init];
|
||||||
|
// attachment.first = CustomMessageType_AllMicroSend;
|
||||||
|
// attachment.second = Custom_Message_Sub_AllMicroSend;
|
||||||
|
// [data setObject:[data valueForKeyPath:@"targetUsers.uid"] forKey:@"targetUids"];
|
||||||
|
// attachment.data = data;
|
||||||
|
// [self sendCustomMessage:attachment];
|
||||||
|
//}
|
||||||
|
|
||||||
- (void)sendLuckyBagGifts:(GiftReceiveInfoModel *)receiveModel
|
- (void)sendLuckyBagGifts:(GiftReceiveInfoModel *)receiveModel
|
||||||
data:(NSMutableDictionary *)data
|
data:(NSMutableDictionary *)data
|
||||||
firstType:(NSUInteger)first
|
firstType:(NSUInteger)first
|
||||||
@@ -932,15 +933,18 @@ 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];
|
|
||||||
if ([GiftComboManager sharedManager].enableCombo) {
|
if ([GiftComboManager sharedManager].enableCombo) {
|
||||||
[[GiftComboManager sharedManager] resetCombo];
|
[[GiftComboManager sharedManager] resetCombo];
|
||||||
|
[self sendCustomMessage:receiveInfo oringinDic:originDic];
|
||||||
[self.comboView setupCurrentGold:receiveInfo.userPurse.diamonds.doubleValue];
|
[self.comboView setupCurrentGold:receiveInfo.userPurse.diamonds.doubleValue];
|
||||||
@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];
|
||||||
}];
|
}];
|
||||||
|
} else {
|
||||||
|
[self sendCustomMessage:receiveInfo oringinDic:originDic];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -28,7 +28,7 @@ static NSString * kUpdateVersionNum = @"kUpdateVersionNum";
|
|||||||
- (void)autoLogin {
|
- (void)autoLogin {
|
||||||
AccountModel *accountModel = [[AccountInfoStorage instance] getCurrentAccountInfo];
|
AccountModel *accountModel = [[AccountInfoStorage instance] getCurrentAccountInfo];
|
||||||
if (accountModel == nil || accountModel.uid == nil || accountModel.access_token == nil) {
|
if (accountModel == nil || accountModel.uid == nil || accountModel.access_token == nil) {
|
||||||
[[self getView] tokenInvalid];
|
[self tokenInvalid];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ([[AccountInfoStorage instance] getTicket].length > 0) {
|
if ([[AccountInfoStorage instance] getTicket].length > 0) {
|
||||||
@@ -53,7 +53,7 @@ static NSString * kUpdateVersionNum = @"kUpdateVersionNum";
|
|||||||
- (void)loginNIM {
|
- (void)loginNIM {
|
||||||
AccountModel *accountModel = [[AccountInfoStorage instance] getCurrentAccountInfo];
|
AccountModel *accountModel = [[AccountInfoStorage instance] getCurrentAccountInfo];
|
||||||
if (accountModel == nil) {
|
if (accountModel == nil) {
|
||||||
[[self getView] tokenInvalid];
|
[self tokenInvalid];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (![NIMSDK sharedSDK].loginManager.isLogined) {
|
if (![NIMSDK sharedSDK].loginManager.isLogined) {
|
||||||
|
@@ -20,6 +20,7 @@ typedef void(^HttpFail)(NSInteger code, NSString * _Nullable msg);
|
|||||||
- (id)getView;
|
- (id)getView;
|
||||||
- (void)detatchView;
|
- (void)detatchView;
|
||||||
- (void)logout;
|
- (void)logout;
|
||||||
|
- (void)tokenInvalid;
|
||||||
- (HttpRequestHelperCompletion)createHttpCompletion:(HttpSuccess _Nonnull)success;
|
- (HttpRequestHelperCompletion)createHttpCompletion:(HttpSuccess _Nonnull)success;
|
||||||
- (HttpRequestHelperCompletion)createHttpCompletion:(HttpSuccess _Nonnull)success showLoading:(BOOL)loading;
|
- (HttpRequestHelperCompletion)createHttpCompletion:(HttpSuccess _Nonnull)success showLoading:(BOOL)loading;
|
||||||
- (HttpRequestHelperCompletion)createHttpCompletion:(HttpSuccess _Nonnull)success errorToast:(BOOL)toast;
|
- (HttpRequestHelperCompletion)createHttpCompletion:(HttpSuccess _Nonnull)success errorToast:(BOOL)toast;
|
||||||
|
@@ -9,6 +9,9 @@
|
|||||||
#import "AccountInfoStorage.h"
|
#import "AccountInfoStorage.h"
|
||||||
#import <NIMSDK/NIMSDK.h>
|
#import <NIMSDK/NIMSDK.h>
|
||||||
#import "ClientConfig.h"
|
#import "ClientConfig.h"
|
||||||
|
#import "XPLoginViewController.h"
|
||||||
|
#import "BaseNavigationController.h"
|
||||||
|
|
||||||
@interface BaseMvpPresenter()
|
@interface BaseMvpPresenter()
|
||||||
|
|
||||||
@property (nonatomic, weak) id view;
|
@property (nonatomic, weak) id view;
|
||||||
@@ -33,7 +36,7 @@
|
|||||||
[[NIMSDK sharedSDK].loginManager logout:nil];
|
[[NIMSDK sharedSDK].loginManager logout:nil];
|
||||||
}
|
}
|
||||||
// 2. 跳登录页面
|
// 2. 跳登录页面
|
||||||
[[self getView] tokenInvalid];
|
[self tokenInvalid];
|
||||||
// ///关闭心跳
|
// ///关闭心跳
|
||||||
// [[ClientConfig shareConfig] resetHeartBratTimer];
|
// [[ClientConfig shareConfig] resetHeartBratTimer];
|
||||||
}
|
}
|
||||||
@@ -85,7 +88,7 @@
|
|||||||
return;
|
return;
|
||||||
case 407:
|
case 407:
|
||||||
case 408:
|
case 408:
|
||||||
[[self getView] accountBanned:data];
|
[self accountBanned:data];
|
||||||
return;
|
return;
|
||||||
case 1415: // 未完善用户信息
|
case 1415: // 未完善用户信息
|
||||||
[[self getView] completeUserInfo];
|
[[self getView] completeUserInfo];
|
||||||
@@ -125,4 +128,25 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)accountBanned:(BaseModel *)data {
|
||||||
|
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
||||||
|
config.title = YMLocalizedString(@"MvpViewController6");
|
||||||
|
NSString *dateDes = [PLTimeUtil getDateWithYYMMDD:data.date];
|
||||||
|
NSString * title = [NSString stringWithFormat:YMLocalizedString(@"MvpViewController7"), data.reason,dateDes];
|
||||||
|
TTAlertMessageAttributedConfig * inviteAlertConfig = [[TTAlertMessageAttributedConfig alloc] init];
|
||||||
|
inviteAlertConfig.text = dateDes;
|
||||||
|
inviteAlertConfig.color = [DJDKMIMOMColor appMainColor];
|
||||||
|
inviteAlertConfig.font = [UIFont systemFontOfSize:15];
|
||||||
|
config.message = title;
|
||||||
|
config.messageAttributedConfig = @[inviteAlertConfig];
|
||||||
|
[TTPopup alertWithConfig:config confirmHandler:^{ } cancelHandler:^{ }];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)tokenInvalid {
|
||||||
|
XPLoginViewController *loginVC = [[XPLoginViewController alloc] init];
|
||||||
|
BaseNavigationController * nav = [[BaseNavigationController alloc] initWithRootViewController:loginVC];
|
||||||
|
nav.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||||
|
kWindow.rootViewController = nav;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -11,17 +11,15 @@
|
|||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
@class BaseModel;
|
@class BaseModel;
|
||||||
@protocol BaseMvpProtocol <NSObject, BaseViewControllerProtocol>
|
@protocol BaseMvpProtocol <NSObject, BaseViewControllerProtocol>
|
||||||
|
|
||||||
@optional
|
@optional
|
||||||
- (void)tokenInvalid;
|
|
||||||
- (void)completeUserInfo;
|
- (void)completeUserInfo;
|
||||||
- (void)accountCanceled:(NSDictionary *)data;
|
- (void)accountCanceled:(NSDictionary *)data;
|
||||||
|
|
||||||
///实名认证弹窗
|
///实名认证弹窗
|
||||||
- (void)showRealNameAuthenticationTipsAlertView;
|
- (void)showRealNameAuthenticationTipsAlertView;
|
||||||
|
|
||||||
///封禁账号
|
|
||||||
- (void)accountBanned:(BaseModel *)data;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -53,20 +53,6 @@
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)tokenInvalid {
|
|
||||||
|
|
||||||
|
|
||||||
XPLoginViewController *loginVC = [[XPLoginViewController alloc] init];
|
|
||||||
BaseNavigationController * nav = [[BaseNavigationController alloc] initWithRootViewController:loginVC];
|
|
||||||
nav.modalPresentationStyle = UIModalPresentationFullScreen;
|
|
||||||
kWindow.rootViewController = nav;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)accountCanceled:(NSDictionary *)data {
|
- (void)accountCanceled:(NSDictionary *)data {
|
||||||
@@ -116,23 +102,23 @@
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
///封禁账号
|
/////封禁账号
|
||||||
- (void)accountBanned:(BaseModel *)data {
|
//- (void)accountBanned:(BaseModel *)data {
|
||||||
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
// TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
||||||
config.title = YMLocalizedString(@"MvpViewController6");
|
// config.title = YMLocalizedString(@"MvpViewController6");
|
||||||
NSString *dateDes = [PLTimeUtil getDateWithYYMMDD:data.date];
|
// NSString *dateDes = [PLTimeUtil getDateWithYYMMDD:data.date];
|
||||||
NSString * title = [NSString stringWithFormat:YMLocalizedString(@"MvpViewController7"), data.reason,dateDes];
|
// NSString * title = [NSString stringWithFormat:YMLocalizedString(@"MvpViewController7"), data.reason,dateDes];
|
||||||
TTAlertMessageAttributedConfig * inviteAlertConfig = [[TTAlertMessageAttributedConfig alloc] init];
|
// TTAlertMessageAttributedConfig * inviteAlertConfig = [[TTAlertMessageAttributedConfig alloc] init];
|
||||||
inviteAlertConfig.text = dateDes;
|
// inviteAlertConfig.text = dateDes;
|
||||||
inviteAlertConfig.color = [DJDKMIMOMColor appMainColor];
|
// inviteAlertConfig.color = [DJDKMIMOMColor appMainColor];
|
||||||
inviteAlertConfig.font = [UIFont systemFontOfSize:15];
|
// inviteAlertConfig.font = [UIFont systemFontOfSize:15];
|
||||||
config.message = title;
|
// config.message = title;
|
||||||
config.messageAttributedConfig = @[inviteAlertConfig];
|
// config.messageAttributedConfig = @[inviteAlertConfig];
|
||||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
// [TTPopup alertWithConfig:config confirmHandler:^{
|
||||||
|
//
|
||||||
} cancelHandler:^{
|
// } cancelHandler:^{
|
||||||
|
//
|
||||||
}];
|
// }];
|
||||||
}
|
//}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
Reference in New Issue
Block a user