feat: 修正最后验收问题

This commit is contained in:
edwinQQQ
2025-01-22 21:22:58 +08:00
parent f963f0ed81
commit d958a3ca36
93 changed files with 1644 additions and 1818 deletions

View File

@@ -7,6 +7,7 @@
#import "GameUniversalBannerView.h"
#import <POP.h>
#import <SVGA.h>
#import "AttachmentModel.h"
#import "PIUniversalBannerModel.h"
@@ -45,26 +46,74 @@
bannerView.gameID = model.skipContent;
[superView addSubview:bannerView];
// TODO: pop
[bannerView addNotification];
@kWeakify(bannerView);
[UIView animateWithDuration:0.25 animations:^{
bannerView.center = CGPointMake(superView.center.x, height/2 + 0);
} completion:^(BOOL finished) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
bannerView.frame = CGRectMake(-KScreenWidth, 0, width, height);
} completion:^(BOOL finished) {
[bannerView popEnterAnimation:^(BOOL finished) {
if (finished) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
@kStrongify(bannerView);
[bannerView removeFromSuperview];
if (bannerView.completeDisplay) {
bannerView.completeDisplay();
}
}];
});
[bannerView popLeaveAnimation:^(bool finished) {
if (bannerView.completeDisplay) {
bannerView.completeDisplay();
}
[bannerView removeFromSuperview];
}];
});
}
}];
}
- (void)addNotification {
@kWeakify(self);
[[NSNotificationCenter defaultCenter] addObserverForName:@"SwipeOutBanner"
object:nil
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification * _Nonnull notification) {
@kStrongify(self);
[self dismissBanner];
}];
}
- (void)dismissBanner {
[self pop_removeAllAnimations]; //
[self popLeaveAnimation:^(bool finished) {
if (self.completeDisplay) {
self.completeDisplay();
}
[self removeFromSuperview];
}];
}
- (void)popEnterAnimation:(void(^)(BOOL finished))finish {
NSInteger height = kGetScaleWidth(70);
POPSpringAnimation *enterAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewFrame];
enterAnimation.toValue = [NSValue valueWithCGRect:CGRectMake(0, 0, KScreenWidth, height)];
enterAnimation.springBounciness = 10; //
enterAnimation.springSpeed = 12; //
enterAnimation.completionBlock = ^(POPAnimation *anim, BOOL finished) {
if (finish) {
finish(finished);
}
};
[self pop_addAnimation:enterAnimation forKey:@"enterAnimation"];
}
- (void)popLeaveAnimation:(void(^)(bool finished))finish {
NSInteger height = kGetScaleWidth(70);
POPBasicAnimation *exitAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewFrame];
exitAnimation.toValue = [NSValue valueWithCGRect:CGRectMake(-KScreenWidth, 0, KScreenWidth, height)];
exitAnimation.duration = 0.25; //
exitAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
exitAnimation.completionBlock = ^(POPAnimation *anim, BOOL finished) {
if (finish) {
finish(finished);
}
};
[self pop_addAnimation:exitAnimation forKey:@"exitAnimation"];
}
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self addSubview:self.bgSVGA];