From c90c726b53243de5f188e8499b9b3f3d75daf06a Mon Sep 17 00:00:00 2001 From: liyuhua <15626451870@163.com> Date: Mon, 25 Mar 2024 23:18:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=BA=97=E5=8C=85=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E6=AD=A4commit=E7=BD=AE=E9=A1=B6=202.6.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YuMi.xcodeproj/project.pbxproj | 4 +-- YuMi/CustomUI/UIImageView/NetImageView.h | 3 ++- YuMi/CustomUI/UIImageView/NetImageView.m | 25 +++++++++++++++---- YuMi/Global/YUMIMacroUitls.h | 2 +- .../Model/PIUniversalBannerModel.h | 1 + .../AnimationView/PIUniversalBannerView.m | 22 ++++++++++++---- .../View/AnimationView/XPRoomAnimationView.m | 23 ++++++++--------- .../View/XPNetImageYYLabel.m | 16 ++++++++---- .../View/RoomPK/View/XPRoomPKProgressView.m | 10 ++++++-- .../View/PIFullScreenBannerAnimation.m | 18 ++++++------- 10 files changed, 81 insertions(+), 43 deletions(-) diff --git a/YuMi.xcodeproj/project.pbxproj b/YuMi.xcodeproj/project.pbxproj index 73b96114..023ebe7e 100644 --- a/YuMi.xcodeproj/project.pbxproj +++ b/YuMi.xcodeproj/project.pbxproj @@ -12207,7 +12207,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 20.20.14; + MARKETING_VERSION = 20.20.15; PRODUCT_BUNDLE_IDENTIFIER = com.peko.enterprise.ios; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -12243,7 +12243,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 20.20.14; + MARKETING_VERSION = 20.20.15; PRODUCT_BUNDLE_IDENTIFIER = com.peko.enterprise.ios; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/YuMi/CustomUI/UIImageView/NetImageView.h b/YuMi/CustomUI/UIImageView/NetImageView.h index dc5aa79e..4675f9c8 100644 --- a/YuMi/CustomUI/UIImageView/NetImageView.h +++ b/YuMi/CustomUI/UIImageView/NetImageView.h @@ -12,6 +12,7 @@ NS_ASSUME_NONNULL_BEGIN typedef void(^LoadCompletion)(UIImage *_Nullable image, NSURL * url); +typedef void(^LoadFail)(NSError *error); typedef NS_ENUM(NSInteger, NetImageState){ NetImageStateUnload = 1, @@ -30,7 +31,7 @@ typedef NS_ENUM(NSInteger, NetImageState){ - (void)loadImage:(LoadCompletion _Nullable)completion; - (void)loadImageWithUrl:(NSString * _Nonnull)imageUrl completion:(LoadCompletion _Nullable)completion; - +- (void)loadImageWithUrl:(NSString * _Nonnull)imageUrl completion:(LoadCompletion)completion fail:(LoadFail)fail; @end NS_ASSUME_NONNULL_END diff --git a/YuMi/CustomUI/UIImageView/NetImageView.m b/YuMi/CustomUI/UIImageView/NetImageView.m index 36a9462c..48746315 100644 --- a/YuMi/CustomUI/UIImageView/NetImageView.m +++ b/YuMi/CustomUI/UIImageView/NetImageView.m @@ -64,9 +64,6 @@ [self sd_setImageWithURL:[NSURL URLWithString:_innerConfigedUrl] placeholderImage:self.config.placeHolder options:SDWebImageRetryFailed completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { if (error) { self.state = NetImageStateUnload; - if (completion) { - completion(nil, imageURL); - }; } else { self.state = NetImageStateLoaded; if (completion) { @@ -75,12 +72,30 @@ } }]; } - +- (void)loadImage:(LoadCompletion)completion fail:(LoadFail)fail{ + self.state = NetImageStateLoading; + [self sd_setImageWithURL:[NSURL URLWithString:_innerConfigedUrl] placeholderImage:self.config.placeHolder options:SDWebImageRetryFailed completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { + if (error) { + self.state = NetImageStateUnload; + if (fail){ + fail(error); + } + } else { + self.state = NetImageStateLoaded; + if (completion) { + completion(image, imageURL); + }; + } + }]; +} - (void)loadImageWithUrl:(NSString * _Nonnull)imageUrl completion:(LoadCompletion)completion { [self initImageUrl:imageUrl]; [self loadImage:completion]; } - +- (void)loadImageWithUrl:(NSString * _Nonnull)imageUrl completion:(LoadCompletion)completion fail:(LoadFail)fail{ + [self initImageUrl:imageUrl]; + [self loadImage:completion fail:fail]; +} - (NetImageConfig *)config { if (!_config) { _config = [[NetImageConfig alloc] init]; diff --git a/YuMi/Global/YUMIMacroUitls.h b/YuMi/Global/YUMIMacroUitls.h index 61739d0a..24949272 100644 --- a/YuMi/Global/YUMIMacroUitls.h +++ b/YuMi/Global/YUMIMacroUitls.h @@ -49,7 +49,7 @@ isPhoneXSeries = [[UIApplication sharedApplication] delegate].window.safeAreaIns ///内置版本号 -#define PI_App_Version @"2.6.4" +#define PI_App_Version @"2.6.5" ///渠道 #define PI_App_Source @"appstore" //#define PI_App_Source @"pi_tf" diff --git a/YuMi/Modules/YMRoom/View/AnimationView/Model/PIUniversalBannerModel.h b/YuMi/Modules/YMRoom/View/AnimationView/Model/PIUniversalBannerModel.h index 3d1a0dfc..2ead5027 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/Model/PIUniversalBannerModel.h +++ b/YuMi/Modules/YMRoom/View/AnimationView/Model/PIUniversalBannerModel.h @@ -23,6 +23,7 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic,assign) CGFloat resourceHeight; @property(nonatomic,strong) SVGAVideoEntity *videoItem; @property(nonatomic,strong) UIImage *image; +@property(nonatomic,assign) CGFloat resourceTop; @end diff --git a/YuMi/Modules/YMRoom/View/AnimationView/PIUniversalBannerView.m b/YuMi/Modules/YMRoom/View/AnimationView/PIUniversalBannerView.m index 2dc21d77..0188b968 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/PIUniversalBannerView.m +++ b/YuMi/Modules/YMRoom/View/AnimationView/PIUniversalBannerView.m @@ -18,6 +18,7 @@ @property (nonatomic,strong) UILabel *titleView; @property (nonatomic,strong) UIButton *clickBtn; @property(nonatomic,strong) SVGAVideoEntity *videoItem; + @end @implementation PIUniversalBannerView @@ -62,15 +63,21 @@ if(textDic.allKeys.count == 0)return ; NSString *title = textDic[@"zh-CHT"] == nil ? textDic[textDic.allKeys.firstObject] : textDic[@"zh-CHT"]; if(title.length == 0)return; + [title stringByReplacingOccurrencesOfString:@"\n" withString:@""]; + + CGFloat font = _isSvga == YES ? _model.fontSize / 2 : _model.fontSize; + NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:font],NSForegroundColorAttributeName:[DJDKMIMOMColor colorWithHexString:_model.textColor]}]; - NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:_model.fontSize],NSForegroundColorAttributeName:[DJDKMIMOMColor colorWithHexString:_model.textColor]}]; for (PIUniversalBannerItemModel *model in _model.contents) { if([model.type isEqualToString:@"TEXT"]){ NSDictionary *subTextDic = model.text; if(subTextDic.allKeys.count > 0){ NSString *subText = subTextDic[@"zh-CHT"] == nil ? subTextDic[subTextDic.allKeys.firstObject] : subTextDic[@"zh-CHT"]; - NSAttributedString *attText = [[NSAttributedString alloc]initWithString:subText attributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor colorWithHexString:model.textColor]}]; - [attribute replaceCharactersInRange:[attribute.string rangeOfString:[NSString stringWithFormat:@"{%@}",model.key]] withAttributedString:attText]; + NSAttributedString *attText = [[NSAttributedString alloc]initWithString:subText attributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor colorWithHexString:model.textColor],NSFontAttributeName:[UIFont systemFontOfSize:font]}]; + if ([attribute.string containsString:[NSString stringWithFormat:@"{%@}",model.key]]){ + [attribute replaceCharactersInRange:[attribute.string rangeOfString:[NSString stringWithFormat:@"{%@}",model.key]] withAttributedString:attText]; + } + } } @@ -79,12 +86,17 @@ if(_isSvga == YES){ self.bgImageView.hidden = YES; self.svgaView.hidden = NO; - self.titleView.hidden = YES; + self.titleView.hidden = NO; self.svgaView.loops = 1; + self.titleView.attributedText = attribute; self.svgaView.clearsAfterStop = NO; self.svgaView.videoItem = _model.videoItem; - [self.svgaView setAttributedText:attribute forKey:_model.svgaTextKey]; +// [self.svgaView setAttributedText:attribute forKey:_model.svgaTextKey]; [self.svgaView startAnimation]; + [self.titleView mas_updateConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(-kGetScaleWidth(self.model.resourceTop)); + make.leading.trailing.equalTo(self).inset(kGetScaleWidth(70)); + }]; }else{ self.bgImageView.hidden = NO; self.bgImageView.image = _model.image; diff --git a/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.m b/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.m index 1b93acfa..a47d0752 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.m +++ b/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.m @@ -409,13 +409,13 @@ PIUniversalBannerModel *model = [PIUniversalBannerModel modelWithDictionary:attacment.data]; BOOL isSvga = [model.resourceType isEqualToString:@"SVGA"]; - __block PIUniversalBannerView *bannerView; + __block PIUniversalBannerView *bannerView; if (isSvga == YES) { SVGAParser *parser = [SVGAParser new]; [parser parseWithURL:[NSURL URLWithString:model.resourceContent] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { model.videoItem = videoItem; - bannerView = [[PIUniversalBannerView alloc]initWithFrame:CGRectMake(0, top, model.resourceWidth, model.resourceHeight) ]; + bannerView = [[PIUniversalBannerView alloc]initWithFrame:CGRectMake(KScreenWidth, top, kGetScaleWidth(model.resourceWidth), kGetScaleWidth(model.resourceHeight)) ]; [self showGeneralFloatingScreenView:bannerView model:model]; } failureBlock:^(NSError * _Nonnull error) { [bannerView removeFromSuperview]; @@ -428,16 +428,7 @@ }else{ NetImageView *imageView = [NetImageView new]; [imageView loadImageWithUrl:model.resourceContent completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) { - if (image == nil){ - - [bannerView removeFromSuperview]; - self.isPlayOfB = NO; - if(self.animationListB.count > 0){ - [self.animationListB removeObjectAtIndex:0]; - } - [self playAnimationWithModel]; - return; - } + model.image = image; CGFloat width = image.size.width <= 0 ? kGetScaleWidth(60) : image.size.width; CGFloat height = image.size.height ; @@ -445,7 +436,15 @@ bannerView = [[PIUniversalBannerView alloc]initWithFrame:CGRectMake(0, top, KScreenWidth, getHeigth) ]; [self showGeneralFloatingScreenView:bannerView model:model]; + }fail:^(NSError * _Nonnull error) { + [bannerView removeFromSuperview]; + self.isPlayOfB = NO; + if(self.animationListB.count > 0){ + [self.animationListB removeObjectAtIndex:0]; + } + [self playAnimationWithModel]; }]; + } } diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/View/XPNetImageYYLabel.m b/YuMi/Modules/YMRoom/View/MessageContainerView/View/XPNetImageYYLabel.m index d18c6154..0189fa10 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/View/XPNetImageYYLabel.m +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/View/XPNetImageYYLabel.m @@ -39,12 +39,18 @@ } - (NSMutableAttributedString*)updateNetImageAttribute:(NetImageView*)imageView attributes:(NSMutableAttributedString*)attributes range:(NSRange)range{ - UIImage* image = imageView.image; - CGFloat scale = image.size.width / image.size.height; - // 目前是根据原高度(imageView.bounds.size.height)等比例缩放图片。 - CGSize size = CGSizeMake(imageView.bounds.size.height * scale, imageView.bounds.size.height); - imageView.bounds = CGRectMake(0, 0, size.width, size.height); + UIImage* image = imageView.image; + CGSize size; + if (image != nil){ + CGFloat scale = image.size.width / image.size.height; + // 目前是根据原高度(imageView.bounds.size.height)等比例缩放图片。 + size = CGSizeMake(imageView.bounds.size.height * scale, imageView.bounds.size.height); + imageView.bounds = CGRectMake(0, 0, size.width, size.height); + }else{ + size = CGSizeMake(16, 16); + imageView.bounds = CGRectMake(0, 0, 16, 16); + } NSMutableAttributedString * replaceAttr = [NSMutableAttributedString yy_attachmentStringWithContent:imageView contentMode:UIViewContentModeScaleAspectFit attachmentSize:size alignToFont:[UIFont systemFontOfSize:15.0] alignment:YYTextVerticalAlignmentCenter]; [attributes replaceCharactersInRange:range withAttributedString:replaceAttr]; return attributes; diff --git a/YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKProgressView.m b/YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKProgressView.m index ba8bbb2e..4a15f13b 100644 --- a/YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKProgressView.m +++ b/YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKProgressView.m @@ -219,9 +219,15 @@ } } if (self.roomPKInfo.voteMode == RoomPKVoteModeType_NumberPerson) { // 按送礼人数计算 - [self canculeRoomPKSendGiftNumPerson:targetUids sendUid:giftReceiveInfo.uid]; + if (giftInfo.giftType != GiftType_super){ + [self canculeRoomPKSendGiftNumPerson:targetUids sendUid:giftReceiveInfo.uid]; + } + } else { - [self canculeRoomGiftValueReceiveInfo:targetUids giftPrice:giftInfo.goldPrice * giftReceiveInfo.giftNum]; + if (giftInfo.giftType != GiftType_super){ + [self canculeRoomGiftValueReceiveInfo:targetUids giftPrice:giftInfo.goldPrice * giftReceiveInfo.giftNum]; + } + } } } diff --git a/YuMi/Modules/YMTabbar/View/PIFullScreenBannerAnimation.m b/YuMi/Modules/YMTabbar/View/PIFullScreenBannerAnimation.m index e8f400ae..d632ada0 100644 --- a/YuMi/Modules/YMTabbar/View/PIFullScreenBannerAnimation.m +++ b/YuMi/Modules/YMTabbar/View/PIFullScreenBannerAnimation.m @@ -252,7 +252,7 @@ SVGAParser *parser = [SVGAParser new]; [parser parseWithURL:[NSURL URLWithString:model.resourceContent] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { model.videoItem = videoItem; - bannerView = [[PIUniversalBannerView alloc]initWithFrame:CGRectMake(0, top, model.resourceWidth, model.resourceHeight) ]; + bannerView = [[PIUniversalBannerView alloc]initWithFrame:CGRectMake(0, top, kGetScaleWidth(model.resourceWidth), kGetScaleWidth(model.resourceHeight)) ]; [self showGeneralFloatingScreenView:bannerView model:model]; } failureBlock:^(NSError * _Nonnull error) { [bannerView removeFromSuperview]; @@ -266,22 +266,20 @@ }else{ NetImageView *imageView = [NetImageView new]; [imageView loadImageWithUrl:model.resourceContent completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) { - if (image == nil){ - [bannerView removeFromSuperview]; - self.isPlayOfB = NO; - if(self.animationListB.count > 0){ - [self.animationListB removeObjectAtIndex:0]; - } - [self playAnimationWithModel]; - return; - } model.image = image; CGFloat width = image.size.width <= 0 ? kGetScaleWidth(60) : image.size.width; CGFloat height = image.size.height ; CGFloat getHeigth = KScreenWidth * height / width; bannerView = [[PIUniversalBannerView alloc]initWithFrame:CGRectMake(KScreenWidth, top, KScreenWidth, getHeigth) ]; [self showGeneralFloatingScreenView:bannerView model:model]; + } fail:^(NSError * _Nonnull error) { + self.isPlayOfB = NO; + if(self.animationListB.count > 0){ + [self.animationListB removeObjectAtIndex:0]; + } + [self playAnimationWithModel]; }]; + } }