fix: 修正线上问题

This commit is contained in:
edwinQQQ
2024-12-11 10:48:01 +08:00
parent 57735e37c4
commit 68370912b2
17 changed files with 268 additions and 311 deletions

View File

@@ -741,7 +741,7 @@ typedef NS_ENUM(NSUInteger, CustomMessageTypeCustomRoomBackground) {
@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 second;
@property(nonatomic,assign) BOOL isBroadcast;

View File

@@ -20,7 +20,7 @@ typedef NS_ENUM(NSInteger, XPMineSettingItemType){
XPMineSettingItemType_Permission,///关于我们
XPMineSettingItemType_Helper,///帮助
XPMineSettingItemType_Feedback,//我要反馈
XPMineSettingItemType_Clear_Memory,///清缓存
XPMineSettingItemType_Clear_Memory,///清缓存
XPMineSettingItemType_About_Us,///关于我们
XPMineSettingItemType_CheckUpdate,///检查更新
XPMineSettingItemType_Delete_Account,///注销账号

View File

@@ -46,12 +46,14 @@
} showLoading:YES]];
}
-(void)confirmExchangeDiamondWithGoldNum:(NSString *)goldNum diamondNum:(NSString *)diamondNum currency:(NSString *)currency{
@kWeakify(self);
[Api confirmExchangeDiamond:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
[[self getView]confirmExchangeDiamondSuccessWithDiamondNum:diamondNum goldNum:goldNum];
} fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView]confirmExchangeDiamondFail];
@kStrongify(self);
[[self getView] confirmExchangeDiamondFail];
} showLoading:YES errorToast:YES] goldNum:goldNum diamondNum:diamondNum currency:currency];
}
-(void)getGoldDetailsDataWithStartTime:(NSString *)startTime endTime:(NSString *)endTime{

View File

@@ -27,15 +27,17 @@
_containerView = containerView;
_giftQueue = [NSMutableArray array];
_animationHelper = [[GiftAnimationHelper alloc] init];
_animationInterval = 0.25;
_comboAnimationDelay = 0.25;
_standardAnimationDelay = 0.5;
_animationInterval = 0.2;
_comboAnimationDelay = 0.2;
_standardAnimationDelay = 0.3;
}
return self;
}
- (void)startGiftQueue {
if (self.giftTimer) return;
if (self.giftTimer) {
return;
}
dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0,
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0));
@@ -43,16 +45,16 @@
dispatch_source_set_timer(timer,
DISPATCH_TIME_NOW,
self.animationInterval * NSEC_PER_SEC,
0);
0.01 * NSEC_PER_SEC);
@kWeakify(self);
dispatch_source_set_event_handler(timer, ^{
dispatch_async(dispatch_get_main_queue(), ^{
@kStrongify(self);
[self processNextGift];
});
@kStrongify(self);
[self processNextGift];
});
[self processNextGift];
dispatch_resume(timer);
self.giftTimer = timer;
}
@@ -155,7 +157,13 @@
- (void)stopGiftQueue {
if (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 {
CGFloat x = 0;
if (isMSRTL()) {
return CGPointMake(kGetScaleWidth(86),
[UIScreen mainScreen].bounds.size.height - kSafeAreaTopHeight - kGetScaleWidth(140));
x = kGetScaleWidth(90);
} 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,
[UIScreen mainScreen].bounds.size.height - kSafeAreaBottomHeight - kGetScaleWidth(140));
KScreenHeight - kSafeAreaBottomHeight - kGetScaleWidth(140));
}
@end

View File

@@ -79,7 +79,6 @@
#import "GameUniversalBannerView.h"
#import "RoomHighValueGiftBannerAnimation.h"
#import "GiftAnimationHelper.h"
#import "GiftAnimationManager.h"
@interface XPRoomAnimationView ()<
@@ -124,13 +123,7 @@ GiftAnimationDelegate>
/// 6s
@property (nonatomic,strong)dispatch_source_t giftEffectTimer;
#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,assign) BOOL isLargeGiftAnimating;
@@ -218,7 +211,6 @@ GiftAnimationDelegate>
[self initSubViews];
[self initSubViewConstraints];
self.giftAnimationHelper = [[GiftAnimationHelper alloc] init];
self.giftAnimationManager = [[GiftAnimationManager alloc] initWithContainerView:self.lowLevelView];
self.giftAnimationManager.delegate = self;
@@ -309,6 +301,7 @@ GiftAnimationDelegate>
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
if (attachment.first == CustomMessageType_Gift) {
GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
[receiveInfo giftDataAlignment];
if (attachment.second == Custom_Message_Sub_Gift_EmbeddedStyle) {
if (receiveInfo.giftVo) {
@@ -338,14 +331,9 @@ GiftAnimationDelegate>
receiveInfo.isLuckyBagGift = attachment.second == Custom_Message_Sub_Gift_LuckySend;
receiveInfo.isBatch = (attachment.second == Custom_Message_Sub_AllBatchSend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend);
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) {
[self receiveGiftHandleSendGiftAnimation:attachment];
if (!self.delegate.getRoomInfo.hasAnimationEffect) {return;}
if (receiveInfo.viewUrl.length > 0) {
[self playLuckyGiftEffectWithVapUrl:receiveInfo.viewUrl];
@@ -360,23 +348,21 @@ GiftAnimationDelegate>
[self receiveGift:receiveInfo];
});
} 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;
}
[self receiveGiftHandleSendGiftAnimation:attachment];
[self receiveGift:receiveInfo];
}
} else if (attachment.first == CustomMessageType_AllMicroSend) { //
GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
[receiveInfo giftDataAlignment];
receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend);
receiveInfo.isComboBatch = attachment.second == Custom_Message_Sub_AllMicroSend;
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) {
[self receiveGiftHandleSendGiftAnimation:attachment];
if (!self.delegate.getRoomInfo.hasAnimationEffect) {return;}
if (receiveInfo.viewUrl.length > 0) {
[self playLuckyGiftEffectWithVapUrl:receiveInfo.viewUrl];
@@ -391,6 +377,7 @@ GiftAnimationDelegate>
[self receiveGift:receiveInfo];
});
} else {
[self receiveGiftHandleSendGiftAnimation:attachment];
[self receiveGift:receiveInfo];
}
} else if (attachment.first == CustomMessageType_LuckyBag ) {//
@@ -1670,10 +1657,7 @@ GiftAnimationDelegate>
receiveInfo.gift = giftInfo;
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.giftQueue addObject:receiveInfo];
// if (self.giftTimer == nil && self.giftQueue > 0) {
// [self startGiftQueueTimer];
// }
}
#pragma mark -
@@ -1702,33 +1686,8 @@ GiftAnimationDelegate>
receiveInfo.gift = giftInfo;
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.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
- (CGPoint)animationPointAtStageViewByUid:(NSString *)uid {
@@ -2878,13 +2837,6 @@ GiftAnimationDelegate>
return _highLevleView;
}
//- (NSMutableArray<GiftReceiveInfoModel *> *)giftQueue {
// if (!_giftQueue) {
// _giftQueue = [NSMutableArray array];
// }
// return _giftQueue;
//}
- (NSMutableArray<NSDictionary *> *)carEffectQueue {
if (_carEffectQueue == nil) {
_carEffectQueue = [NSMutableArray array];

View File

@@ -296,10 +296,14 @@
//
dispatch_source_set_event_handler(self.timer, ^{
[self processGiftComboQueue];
[self processRequestQueue];
[self processGiftComboQueue];
});
// ****
[self processRequestQueue];
[self processGiftComboQueue];
//
dispatch_resume(self.timer);
}
@@ -308,8 +312,15 @@
- (void)stopProcessingQueue {
if (self.timer) {
if (self.requestQueue.count == 0 && self.giftComboQueue.count == 0) {
//
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];
} else {
//
[self stopProcessingQueue];
}
}
@@ -348,7 +358,6 @@
[self handleSendGift:dic];
[self.requestQueue removeObject:dic];
} else {
//
[self stopProcessingQueue];
}
}

View File

@@ -132,7 +132,7 @@ typedef NS_ENUM(NSUInteger, RoomSendGiftType) {
@property (nonatomic, strong) i18nGiftNameMap *i18nGiftNameMap;
@property(nonatomic, assign) NSInteger showAvatarType; // 是否需要塞头像0-否1-送礼者2-收礼者3-左送右收
@property(nonatomic, assign) BOOL notifyFull; // 该礼物动画是否全房间播放
@property(nonatomic, assign) NSInteger notifyFull; // 该礼物动画是否全房间播放
@end

View File

@@ -143,6 +143,8 @@ NS_ASSUME_NONNULL_BEGIN
- (NSInteger)receiveUserCount;
- (void)giftDataAlignment;
@end
NS_ASSUME_NONNULL_END

View File

@@ -80,4 +80,28 @@
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

View File

@@ -115,7 +115,7 @@
[self.giftNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
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) {
@@ -278,6 +278,7 @@
_giftNameLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightSemibold];
_giftNameLabel.textAlignment = NSTextAlignmentCenter;
_giftNameLabel.textColor = [DJDKMIMOMColor mainTextColor];
_giftNameLabel.numberOfLines = 0;
}
return _giftNameLabel;
}

View File

@@ -17,8 +17,6 @@
@property (nonatomic, strong) UIView *container;
@property (nonatomic, strong) UILabel *comboCountLabel;
@property(nonatomic, strong) UILabel *comboGoldLabel;
@property(nonatomic, strong) UILabel *updateGoldLabel;
@property(nonatomic, strong) UILabel *winPriceGoldLabel;
@property (nonatomic, strong) SVGAImageView *playImageView;
@property (nonatomic, strong) SVGAVideoEntity *svgaVideoEntity;
@property (nonatomic, strong) CountdownRingView *countdownRingView;
@@ -26,7 +24,10 @@
@property(nonatomic, strong) NSMutableArray *updateGoldQueue;
@property(nonatomic, assign) BOOL isAnimatingUpdateGold;
@property(nonatomic, strong) UIImpactFeedbackGenerator *f;
@property(nonatomic, strong) UIImpactFeedbackGenerator *feedbackGenerator;
@property (nonatomic, strong) dispatch_queue_t animationQueue; // 线
@end
@@ -42,7 +43,7 @@
- (instancetype)init {
if (self = [super init]) {
self.f = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleHeavy];
self.feedbackGenerator = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleHeavy];
self.updateGoldQueue = @[].mutableCopy;
[self setupNotification];
@@ -54,51 +55,56 @@
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 setupTimer];
[self updateCount];
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);
}];
[self setupSVGAParser];
}
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 {
[[NSNotificationCenter defaultCenter] addObserverForName:@"receiveLuckGiftWinning"
object:nil
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification * _Nonnull notification) {
if ([notification.object isKindOfClass:[NSString class]]) {
NSString *coin = (NSString *)notification.object;
if (![NSString isEmpty:coin]) {
[self updateCurrentGold:coin.doubleValue giftPrice:0 isFromWinning:YES];
}
[self handleStringNotification:notification.object];
} else if ([notification.object isKindOfClass:[NSDictionary class]]) {
NSDictionary *dic = (NSDictionary *)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];
[self handleDictionaryNotification:notification.object];
}
}];
}
- (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 {
NSString *countStr = [NSString stringWithFormat:@"x%ld", [[GiftComboManager sharedManager] loadComboCount]];
NSShadow *shadow = [[NSShadow alloc] init];
@@ -172,18 +178,6 @@
make.centerY.mas_equalTo(self.comboGoldLabel);
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 {
@@ -215,7 +209,7 @@
// 1521 3
// AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
// AudioServicesPlaySystemSound(SystemSoundID(kSystemSoundID_Vibrate));
[self.f impactOccurred];
[self.feedbackGenerator impactOccurred];
[[GiftComboManager sharedManager] sendGift];
[self.playImageView startAnimation];
@@ -238,155 +232,89 @@
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 {
// 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;
if (isFromWinning) {
[self.updateGoldQueue insertObject:goldString atIndex:0];
[self insertToGoldQueue:goldString];
[self processNextUpdateGold];
} else {
[self.updateGoldQueue addObject:goldString];
[self addToGoldQueue:goldString];
self.comboGoldLabel.text = @(gold).stringValue;
if (!self.isAnimatingUpdateGold) {
[self 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) {
self.isAnimatingUpdateGold = NO;
return;
}
NSString *goldString = [self.updateGoldQueue xpSafeObjectAtIndex:0];
[self.updateGoldQueue removeObjectAtIndex:0];
NSString *goldString = [self removeFromGoldQueue];
self.isAnimatingUpdateGold = YES;
BOOL isWinning = [goldString containsString:@"+"]; //
UILabel *targetLabel = isWinning ? [self winPriceGoldLabel] : [self updateGoldLabel];
// [self addSubview:targetLabel];
// [targetLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//// make.trailing.mas_equalTo(self.comboGoldLabel);
//// make.bottom.trailing.mas_equalTo(self.comboGoldLabel);
// make.leading.mas_equalTo(44);
// make.bottom.mas_equalTo(-44);
// }];
CGFloat offset = isWinning ? -80 : -40;
targetLabel.textAlignment = NSTextAlignmentNatural;
if (isWinning) {
[self updateWinPriceGoldLabelWithText:goldString label:targetLabel];
} else {
[self updateGoldLabelWithText:goldString label:targetLabel];
}
[self addSubview:targetLabel];
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 {
label.text = text;
- (void)showGoldAnimationOnLabel:(UILabel *)label offset:(CGFloat)offset isForWinPrice:(BOOL)isForWin{
label.alpha = 0;
[UIView animateWithDuration:0.2 animations:^{
[label mas_updateConstraints:^(MASConstraintMaker *make) {
// make.bottom.mas_equalTo(-44 + offset);
make.bottom.mas_equalTo(self.comboGoldLabel.mas_bottom).offset(offset);
}];
label.alpha = 1;
[self layoutIfNeeded];
} 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];
}];
}
label.transform = CGAffineTransformTranslate(CGAffineTransformIdentity, 0, offset);
label.alpha = 1;
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.2 delay:isForWin ? 1.5 : 0.4 options:UIViewAnimationOptionCurveLinear animations:^{
// label.transform = CGAffineTransformIdentity;
label.alpha = 0;
} completion:^(BOOL finished) {
- (void)showGoldUpdateAnimation {
self.updateGoldLabel.alpha = 0;
[UIView animateWithDuration:0.1 animations:^{
[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];
}];
}];
}];
self.isAnimatingUpdateGold = NO;
[self processNextUpdateGold];
}];
}
#pragma mark -
@@ -427,19 +355,40 @@
}
- (UILabel *)updateGoldLabel {
// return [UILabel labelInitWithText:@"" font:kFontSemibold(24) textColor:UIColorFromRGB(0xffd54c)];;
if (!_updateGoldLabel) {
_updateGoldLabel = [UILabel labelInitWithText:@"" font:kFontSemibold(24) textColor:UIColorFromRGB(0xffd54c)];
}
return _updateGoldLabel;
return [UILabel labelInitWithText:@"" font:kFontSemibold(24) textColor:UIColorFromRGB(0xffd54c)];
}
- (UILabel *)winPriceGoldLabel {
// return [UILabel labelInitWithText:@"" font:kFontSemibold(24) textColor:UIColorFromRGB(0xBC36FF)];
if (!_winPriceGoldLabel) {
_winPriceGoldLabel = [UILabel labelInitWithText:@"" font:kFontSemibold(24) textColor:UIColorFromRGB(0xBC36FF)];
}
return _winPriceGoldLabel;
return [UILabel labelInitWithText:@"" font:kFontSemibold(24) textColor:UIColorFromRGB(0xBC36FF)];
}
- (void)updateGoldLabelWithText:(NSString *)text label:(UILabel *)label {
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 {

View File

@@ -308,7 +308,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
oringinDic:data
isToOne:NO];
} else {
[self sendGiftToAllMessage:data];
[self sendGiftToMultipleMessage:data isAll:YES];
}
}
} else if (receiveModel.roomSendGiftType == RoomSendGiftType_MutableOnMic) { //
@@ -324,7 +324,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
oringinDic:data
isToOne:NO];
} else {
[self sendGiftToMultipleMessage:data];
[self sendGiftToMultipleMessage:data isAll:NO];
}
}
} else if (receiveModel.roomSendGiftType == RoomSendGiftType_ToOne) { //
@@ -382,23 +382,24 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
[self sendCustomMessage:attachment];
}
- (void)sendGiftToMultipleMessage:(NSMutableDictionary *)data {
- (void)sendGiftToMultipleMessage:(NSMutableDictionary *)data isAll:(BOOL)isALl{
AttachmentModel *attachment = [[AttachmentModel alloc] init];
attachment.first = CustomMessageType_AllMicroSend;
attachment.second = 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;
attachment.second = isALl ? Custom_Message_Sub_AllMicroSend : Custom_Message_Sub_AllBatchSend;
[data setObject:[data valueForKeyPath:@"targetUsers.uid"] forKey:@"targetUids"];
attachment.data = data;
[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
data:(NSMutableDictionary *)data
firstType:(NSUInteger)first
@@ -932,15 +933,18 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
dispatch_after(delayTime, dispatch_get_main_queue(), ^{
@kStrongify(self);
if (self) {
[self sendCustomMessage:receiveInfo oringinDic:originDic];
if ([GiftComboManager sharedManager].enableCombo) {
[[GiftComboManager sharedManager] resetCombo];
[self sendCustomMessage:receiveInfo oringinDic:originDic];
[self.comboView setupCurrentGold:receiveInfo.userPurse.diamonds.doubleValue];
@kWeakify(self);
[[GiftComboManager sharedManager] setHandleComboSuccess:^(GiftReceiveInfoModel * _Nonnull receiveModel, NSMutableDictionary * _Nonnull originDic) {
@kStrongify(self);
[self sendCustomMessage:receiveInfo oringinDic:originDic.copy];
}];
} else {
[self sendCustomMessage:receiveInfo oringinDic:originDic];
}
}
});

View File

@@ -28,7 +28,7 @@ static NSString * kUpdateVersionNum = @"kUpdateVersionNum";
- (void)autoLogin {
AccountModel *accountModel = [[AccountInfoStorage instance] getCurrentAccountInfo];
if (accountModel == nil || accountModel.uid == nil || accountModel.access_token == nil) {
[[self getView] tokenInvalid];
[self tokenInvalid];
return;
}
if ([[AccountInfoStorage instance] getTicket].length > 0) {
@@ -53,7 +53,7 @@ static NSString * kUpdateVersionNum = @"kUpdateVersionNum";
- (void)loginNIM {
AccountModel *accountModel = [[AccountInfoStorage instance] getCurrentAccountInfo];
if (accountModel == nil) {
[[self getView] tokenInvalid];
[self tokenInvalid];
return;
}
if (![NIMSDK sharedSDK].loginManager.isLogined) {

View File

@@ -20,6 +20,7 @@ typedef void(^HttpFail)(NSInteger code, NSString * _Nullable msg);
- (id)getView;
- (void)detatchView;
- (void)logout;
- (void)tokenInvalid;
- (HttpRequestHelperCompletion)createHttpCompletion:(HttpSuccess _Nonnull)success;
- (HttpRequestHelperCompletion)createHttpCompletion:(HttpSuccess _Nonnull)success showLoading:(BOOL)loading;
- (HttpRequestHelperCompletion)createHttpCompletion:(HttpSuccess _Nonnull)success errorToast:(BOOL)toast;

View File

@@ -9,6 +9,9 @@
#import "AccountInfoStorage.h"
#import <NIMSDK/NIMSDK.h>
#import "ClientConfig.h"
#import "XPLoginViewController.h"
#import "BaseNavigationController.h"
@interface BaseMvpPresenter()
@property (nonatomic, weak) id view;
@@ -33,7 +36,7 @@
[[NIMSDK sharedSDK].loginManager logout:nil];
}
// 2.
[[self getView] tokenInvalid];
[self tokenInvalid];
// ///
// [[ClientConfig shareConfig] resetHeartBratTimer];
}
@@ -85,7 +88,7 @@
return;
case 407:
case 408:
[[self getView] accountBanned:data];
[self accountBanned:data];
return;
case 1415: //
[[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

View File

@@ -11,17 +11,15 @@
NS_ASSUME_NONNULL_BEGIN
@class BaseModel;
@protocol BaseMvpProtocol <NSObject, BaseViewControllerProtocol>
@optional
- (void)tokenInvalid;
- (void)completeUserInfo;
- (void)accountCanceled:(NSDictionary *)data;
///实名认证弹窗
- (void)showRealNameAuthenticationTipsAlertView;
///封禁账号
- (void)accountBanned:(BaseModel *)data;
@end
NS_ASSUME_NONNULL_END

View File

@@ -53,20 +53,6 @@
}
#else
#endif
}
- (void)tokenInvalid {
XPLoginViewController *loginVC = [[XPLoginViewController alloc] init];
BaseNavigationController * nav = [[BaseNavigationController alloc] initWithRootViewController:loginVC];
nav.modalPresentationStyle = UIModalPresentationFullScreen;
kWindow.rootViewController = nav;
}
- (void)accountCanceled:(NSDictionary *)data {
@@ -116,23 +102,23 @@
}];
}
///
- (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)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:^{
//
// }];
//}
@end