From 09cbeb72a691bc500279103dc4a134bce27d9aa3 Mon Sep 17 00:00:00 2001 From: liyuhua <15626451870@163.com> Date: Tue, 29 Aug 2023 17:54:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xplan-ios.xcodeproj/project.pbxproj | 12 +-- .../Tool/SDPhotoBrowser/SDBrowserImageView.h | 4 +- .../Base/Tool/SDPhotoBrowser/SDPhotoBrowser.m | 42 ++++++++-- .../UI/UIButton/UIButton+EnlargeTouchArea.h | 4 + .../UI/UIButton/UIButton+EnlargeTouchArea.m | 77 +++++++++++++++++++ .../Main/Home/View/XPPartyViewController.m | 5 ++ .../Main/Message/Presenter/MessagePresenter.m | 1 + xplan-ios/Main/Message/View/NIMMessageUtils.m | 4 + .../View/Session/SessionViewController.m | 30 ++++++-- .../Main/Mine/Presenter/XPMineFansPresenter.m | 1 + .../Mine/Presenter/XPMineUserInfoPresenter.m | 1 + .../SubViews/XPMineGameOrderDetailsView.h | 1 + .../SubViews/XPMineGameOrderDetailsView.m | 28 ++++--- .../View/SubViews/XPMineGameOrderItemCell.m | 4 +- .../GameOrder/View/XPMineGameOrderItemVC.h | 2 +- .../GameOrder/View/XPMineGameOrderItemVC.m | 7 +- .../View/GameOrder/View/XPMineGameOrderVC.m | 4 +- .../MineInfo/XPMineUserInfoViewController.m | 2 +- .../SubViews/MineInfo/XPMinePlaceOrderView.m | 1 + .../SubViews/MineInfo/XPMineUserGameCell.m | 1 + .../Main/Mine/View/SubViews/XPMineHeadView.m | 2 +- .../View/SubViews/XPAnchorPkPanelView.m | 1 + .../AnchorView/XPRoomAnchorInfoCardView.m | 1 + .../XPRoomGameInviteBannerView.m | 1 - .../MenuContainerView/XPRoomSendTextView.m | 4 +- .../UserCard/Presenter/XPUserCardPresenter.m | 1 + 26 files changed, 202 insertions(+), 39 deletions(-) diff --git a/xplan-ios.xcodeproj/project.pbxproj b/xplan-ios.xcodeproj/project.pbxproj index 5b048ce4..f708ceea 100644 --- a/xplan-ios.xcodeproj/project.pbxproj +++ b/xplan-ios.xcodeproj/project.pbxproj @@ -9718,13 +9718,13 @@ E8EEB8EA26FC2050007C6EBA /* SDPhotoBrowser */ = { isa = PBXGroup; children = ( - E8EEB8EB26FC2050007C6EBA /* SDPhotoBrowserConfig.h */, - E8EEB8EC26FC2050007C6EBA /* SDPhotoBrowser.m */, - E8EEB8ED26FC2050007C6EBA /* SDWaitingView.m */, - E8EEB8EE26FC2050007C6EBA /* SDBrowserImageView.m */, - E8EEB8EF26FC2050007C6EBA /* SDWaitingView.h */, - E8EEB8F026FC2050007C6EBA /* SDPhotoBrowser.h */, E8EEB8F126FC2050007C6EBA /* SDBrowserImageView.h */, + E8EEB8EE26FC2050007C6EBA /* SDBrowserImageView.m */, + E8EEB8F026FC2050007C6EBA /* SDPhotoBrowser.h */, + E8EEB8EC26FC2050007C6EBA /* SDPhotoBrowser.m */, + E8EEB8EB26FC2050007C6EBA /* SDPhotoBrowserConfig.h */, + E8EEB8EF26FC2050007C6EBA /* SDWaitingView.h */, + E8EEB8ED26FC2050007C6EBA /* SDWaitingView.m */, ); path = SDPhotoBrowser; sourceTree = ""; diff --git a/xplan-ios/Base/Tool/SDPhotoBrowser/SDBrowserImageView.h b/xplan-ios/Base/Tool/SDPhotoBrowser/SDBrowserImageView.h index ec33ceca..6ebd9cc5 100755 --- a/xplan-ios/Base/Tool/SDPhotoBrowser/SDBrowserImageView.h +++ b/xplan-ios/Base/Tool/SDPhotoBrowser/SDBrowserImageView.h @@ -8,9 +8,9 @@ #import #import "SDWaitingView.h" +#import - -@interface SDBrowserImageView : UIImageView +@interface SDBrowserImageView : FLAnimatedImageView @property (nonatomic, assign) CGFloat progress; @property (nonatomic, assign, readonly) BOOL isScaled; diff --git a/xplan-ios/Base/Tool/SDPhotoBrowser/SDPhotoBrowser.m b/xplan-ios/Base/Tool/SDPhotoBrowser/SDPhotoBrowser.m index ae0a7e52..1beafda3 100755 --- a/xplan-ios/Base/Tool/SDPhotoBrowser/SDPhotoBrowser.m +++ b/xplan-ios/Base/Tool/SDPhotoBrowser/SDPhotoBrowser.m @@ -9,7 +9,10 @@ #import "SDPhotoBrowser.h" #import "UIImageView+WebCache.h" #import "SDBrowserImageView.h" - +#import +#import +#import +#import #define iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO) //判断是否iPhoneX #define iPhoneX_NavSafeArea ([[UIScreen mainScreen] bounds].size.height >= 812.0 ? 24 : 0) // 如果是iphoneX 顶部安全区域 24 @@ -95,9 +98,18 @@ - (void)saveImage { int index = _scrollView.contentOffset.x / _scrollView.bounds.size.width; - UIImageView *currentImageView = _scrollView.subviews[index]; - - UIImageWriteToSavedPhotosAlbum(currentImageView.image, self, @selector(image:didFinishSavingWithError:contextInfo:), NULL); + FLAnimatedImageView *currentImageView = _scrollView.subviews[index]; + BOOL isGif = [UIImage isGifWithImageData:currentImageView.animatedImage.data]; + if(isGif){ + ALAssetsLibrary *library = [[ALAssetsLibrary alloc]init]; + NSDictionary *metadate = @{@"UTI":(__bridge NSString *)kUTTypeGIF}; +  [library writeImageDataToSavedPhotosAlbum:currentImageView.animatedImage.data metadata:nil completionBlock:^(NSURL *assetURL, NSError *error) { + [self saveImageFinishWithError:error]; + }]; + }else{ + UIImageWriteToSavedPhotosAlbum(currentImageView.image, self, @selector(image:didFinishSavingWithError:contextInfo:), NULL); + } + if (_indicatorView == nil) { _indicatorView = [[UIActivityIndicatorView alloc] init]; @@ -108,7 +120,27 @@ [_indicatorView startAnimating]; } - +-(void)saveImageFinishWithError:(NSError *)error{ + [_indicatorView stopAnimating]; + + UILabel *label = [[UILabel alloc] init]; + label.textColor = [UIColor whiteColor]; + label.backgroundColor = [UIColor colorWithRed:0.1f green:0.1f blue:0.1f alpha:0.90f]; + label.layer.cornerRadius = 5; + label.clipsToBounds = YES; + label.bounds = CGRectMake(0, 0, 150, 30); + label.center = self.center; + label.textAlignment = NSTextAlignmentCenter; + label.font = [UIFont boldSystemFontOfSize:17]; + [[UIApplication sharedApplication].keyWindow addSubview:label]; + [[UIApplication sharedApplication].keyWindow bringSubviewToFront:label]; + if (error) { + label.text = SDPhotoBrowserSaveImageFailText; + } else { + label.text = SDPhotoBrowserSaveImageSuccessText; + } + [label performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1.0]; +} - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo; { [_indicatorView stopAnimating]; diff --git a/xplan-ios/Base/UI/UIButton/UIButton+EnlargeTouchArea.h b/xplan-ios/Base/UI/UIButton/UIButton+EnlargeTouchArea.h index 5c8b8fcb..3db38b29 100644 --- a/xplan-ios/Base/UI/UIButton/UIButton+EnlargeTouchArea.h +++ b/xplan-ios/Base/UI/UIButton/UIButton+EnlargeTouchArea.h @@ -9,6 +9,7 @@ #import @interface UIButton (EnlargeTouchArea) +@property (nonatomic, assign) NSTimeInterval yn_acceptEventInterval; // 重复点击的间隔 //图片frmae @property (strong, nonatomic) NSValue *imageFrame; @@ -33,4 +34,7 @@ */ - (void)enlargeTouchArea:(UIEdgeInsets)insets; + ++(UIButton *)buttonInitWithText:(NSString *)text font:(UIFont *)font textColor:(UIColor *)textColor image:(UIImage *)image bgImage:(UIImage *)bgImage; + @end diff --git a/xplan-ios/Base/UI/UIButton/UIButton+EnlargeTouchArea.m b/xplan-ios/Base/UI/UIButton/UIButton+EnlargeTouchArea.m index ae8c2217..9155e4dd 100644 --- a/xplan-ios/Base/UI/UIButton/UIButton+EnlargeTouchArea.m +++ b/xplan-ios/Base/UI/UIButton/UIButton+EnlargeTouchArea.m @@ -9,8 +9,18 @@ #import "UIButton+EnlargeTouchArea.h" #import +#define defaultInterval 0.0003 //默认时间间隔,不能太长,以免影响系统拍照等功能 +@interface UIButton () +/** + * bool YES 忽略点击事件 NO 允许点击事件 + */ +@property (nonatomic, assign) BOOL isIgnoreEvent; +@end + @implementation UIButton (EnlargeTouchArea) +static const char *UIControl_acceptEventInterval = "UIControl_acceptEventInterval"; +static const char *UIControl_enventIsIgnoreEvent = "UIControl_enventIsIgnoreEvent"; //定义常量 必须是C语言字符串 static const char *imageFrameStr = "imageFrame"; @@ -26,9 +36,54 @@ static const char *titleFrameStr = "titleFrame"; Method newTitleMethod = class_getInstanceMethod(self, @selector(new_titleRectForContentRect:)); Method oldTitleMethod = class_getInstanceMethod(self, @selector(titleRectForContentRect:)); method_exchangeImplementations(newTitleMethod, oldTitleMethod); + + + //根据selector查找Method + SEL selA = @selector(sendAction:to:forEvent:); + SEL selB = @selector(new_sendAction:to:forEvent:); + Method methodA = class_getInstanceMethod(self,selA); + Method methodB = class_getInstanceMethod(self, selB); + //添加自定义方法 + BOOL isAdd = class_addMethod(self, selA, method_getImplementation(methodB), method_getTypeEncoding(methodB)); + + if (isAdd) {//添加成功->替换 + class_replaceMethod(self, selB, method_getImplementation(methodA), method_getTypeEncoding(methodA)); + }else{//添加不成功->交换 + //添加失败了 说明本类中有methodB的实现,此时只需要将methodA和methodB的IMP互换一下即可。 + method_exchangeImplementations(methodA, methodB); + } + }); } +- (void)new_sendAction:(SEL)action to:(id)target forEvent:(UIEvent *)event { + self.yn_acceptEventInterval = self.yn_acceptEventInterval == 0 ? defaultInterval : self.yn_acceptEventInterval; + if (self.isIgnoreEvent){//默认可以响应点击事件 + return; + } + if (self.yn_acceptEventInterval > 0){//第一次点击,设定eventTimeInterval后,可以响应点击事件 + [self performSelector:@selector(setNoIgnoreEvent) withObject:nil afterDelay:self.yn_acceptEventInterval]; + } + self.isIgnoreEvent = YES;//设置不可以响应点击事件 + [self new_sendAction:action to:target forEvent:event]; +} +// runtime 动态绑定 属性 +- (BOOL)isIgnoreEvent{ + return [objc_getAssociatedObject(self, UIControl_enventIsIgnoreEvent) boolValue]; +} +-(void)setNoIgnoreEvent{ + self.isIgnoreEvent = NO; +} +- (void)setIsIgnoreEvent:(BOOL)isIgnoreEvent { + objc_setAssociatedObject(self, UIControl_enventIsIgnoreEvent, @(isIgnoreEvent), OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +-(void)setYn_acceptEventInterval:(NSTimeInterval)yn_acceptEventInterval{ + objc_setAssociatedObject(self, UIControl_acceptEventInterval, @(yn_acceptEventInterval), OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} +-(NSTimeInterval)yn_acceptEventInterval{ + return [objc_getAssociatedObject(self, UIControl_acceptEventInterval) doubleValue]; +} - (void)setImageFrame:(NSValue *)imageFrame{ objc_setAssociatedObject(self, imageFrameStr, imageFrame, OBJC_ASSOCIATION_RETAIN); } @@ -111,5 +166,27 @@ static char leftNameKey; } return CGRectContainsPoint(rect, point) ? self : nil; } ++(UIButton *)buttonInitWithText:(NSString *)text font:(UIFont *)font textColor:(UIColor *)textColor image:(UIImage *)image bgImage:(UIImage *)bgImage{ + UIButton *button = [[UIButton alloc]initWithFrame:CGRectZero]; + if(text.length > 0){ + [button setTitle:text forState:UIControlStateNormal]; + } + if(font != nil){ + button.titleLabel.font = font; + } + + if(textColor != nil){ + [button setTitleColor:textColor forState:UIControlStateNormal]; + } + + if (image != nil){ + [button setImage:image forState:UIControlStateNormal]; + } + if(bgImage != nil){ + [button setBackgroundImage:bgImage forState:UIControlStateNormal]; + } + + return button; +} @end diff --git a/xplan-ios/Main/Home/View/XPPartyViewController.m b/xplan-ios/Main/Home/View/XPPartyViewController.m index d970d7b9..2cf8b3d4 100644 --- a/xplan-ios/Main/Home/View/XPPartyViewController.m +++ b/xplan-ios/Main/Home/View/XPPartyViewController.m @@ -130,9 +130,12 @@ for (HomePlayRoomModel *model in array) { if (model.isBanner) { self.headerView.bannerList = model.bannerVoList; + break; } } + [self hideHUD]; + [self.pagingView reloadData]; }else{ } @@ -202,10 +205,12 @@ #pragma mark - JXCategoryViewDelegate - (NSUInteger)tableHeaderViewHeightInPagerView:(JXPagerView *)pagerView { + if(self.headerView.bannerList.count == 0)return 0; return [XPPartyHeaderView getPartyHeaderViewHeight]; } - (UIView *)tableHeaderViewInPagerView:(JXPagerView *)pagerView { + return self.headerView; } diff --git a/xplan-ios/Main/Message/Presenter/MessagePresenter.m b/xplan-ios/Main/Message/Presenter/MessagePresenter.m index 5d59ff3f..d73faf9b 100644 --- a/xplan-ios/Main/Message/Presenter/MessagePresenter.m +++ b/xplan-ios/Main/Message/Presenter/MessagePresenter.m @@ -49,6 +49,7 @@ NSString * type = @"1"; [Api attentionCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) { [[self getView] attentionUserSuccess:targetUid]; + [[NSNotificationCenter defaultCenter]postNotificationName:@"kAttentionUserNotification" object:nil]; } showLoading:YES] uid:uid likedUid:targetUid ticket:ticket type:type]; } ///用户的游戏配置信息 diff --git a/xplan-ios/Main/Message/View/NIMMessageUtils.m b/xplan-ios/Main/Message/View/NIMMessageUtils.m index 1dca8af3..0198b73a 100644 --- a/xplan-ios/Main/Message/View/NIMMessageUtils.m +++ b/xplan-ios/Main/Message/View/NIMMessageUtils.m @@ -7,6 +7,7 @@ #import "NIMMessageUtils.h" #import "AttachmentModel.h" +#import "UserGameInfoVo.h" @implementation NIMMessageUtils @@ -66,6 +67,9 @@ return @"[分享了一条动态]"; } else if(attachment.first == CustomMessageType_RedPacket && attachment.second == Custom_Message_Sub_AllDiamandRedPacket) { return @"[你收到一个全服红包]"; + }else if(attachment.first == CustomMessageType_Initiat_Invitation && attachment.second == Custom_Message_Sub_Initiat_Invitation_Initiating_User) { + UserGameInfoVo *gameInfo = [UserGameInfoVo modelWithDictionary:attachment.data]; + return [gameInfo.fromUid isEqualToString:[AccountInfoStorage instance].getUid] ? @"你发送一条开黑邀请":@"你收到一条开黑邀请"; } else { text = @"[消息]"; } diff --git a/xplan-ios/Main/Message/View/Session/SessionViewController.m b/xplan-ios/Main/Message/View/Session/SessionViewController.m index 76a03ae5..9e1ec03e 100644 --- a/xplan-ios/Main/Message/View/Session/SessionViewController.m +++ b/xplan-ios/Main/Message/View/Session/SessionViewController.m @@ -65,6 +65,8 @@ @property (nonatomic,strong) NIMMessage *lastMessage; ///私聊风险提示 @property (nonatomic,strong) SessionRiskView *riskAlertView; +///占位图 +@property(nonatomic,strong) UIView *emptyVeiw; ///游戏点单轮播 @property(nonatomic,strong) UICollectionView *collectionView; @@ -116,6 +118,14 @@ } -(void)getAttentionUserNotification{ [self.presenter getChatLimitReceiverUid:self.session.sessionId]; + if ([self showChatRiskView:self.userInfo]) { + self.riskAlertView.warning = self.userInfo.banAccount ? @" 温馨提醒:当前对方账号存在异常,请谨慎来往!" : @"温馨提示:对方和您非好友关系,请注意隐私安全!"; + self.riskAlertView.hidden = NO; + self.emptyVeiw.hidden = YES; + }else{ + self.riskAlertView.hidden = YES; + self.emptyVeiw.hidden = NO; + } } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; @@ -172,6 +182,7 @@ self.sessionNavView.isInRoom = self.openType == SessionListOpenTypeRoom; [self.view addSubview:self.sessionNavView]; [self.view addSubview:self.stackView]; + [self.stackView addArrangedSubview:self.emptyVeiw]; [self.stackView addArrangedSubview:self.riskAlertView]; [self.view addSubview:self.sessionTableView]; [self.view addSubview:self.toolbarView]; @@ -308,6 +319,7 @@ [gameTextArray addObject:gameModel.gameName]; self.collectionView.hidden = NO; [self.collectionView reloadData]; + [self.sessionTableView nim_scrollToBottom:YES]; return; } if(gameTextArray.count > 0){ @@ -316,6 +328,7 @@ self.pageControl.pageList = gameTextArray; self.pageControl.curPage = 0; [self.collectionView reloadData]; + [self.sessionTableView nim_scrollToBottom:YES]; } } @@ -557,13 +570,12 @@ AttachmentModel * attachment = obj.attachment; if(attachment.first == CustomMessageType_Initiat_Invitation && attachment.second == Custom_Message_Sub_Initiat_Invitation_Initiating_User){ UserGameInfoVo *gameInfo = [UserGameInfoVo modelWithDictionary:attachment.data]; - if([gameInfo.toUid isEqualToString:[AccountInfoStorage instance].getUid]){ - return; - } - XPMineGameOrderDetailsView *orderView = [[XPMineGameOrderDetailsView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)]; + + XPMineGameOrderDetailsView *orderView = [[XPMineGameOrderDetailsView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight) type:[gameInfo.toUid isEqualToString:[AccountInfoStorage instance].getUid] ? 1 : 0]; orderView.gameInfo = gameInfo; orderView.isFormChat = YES; orderView.delegate = self; + [self.view addSubview:orderView]; } @@ -835,6 +847,7 @@ - (void)sessionRiskViewCloseButtonClick:(SessionRiskView *)view { [[SessionRiskCache shareCache] saveCloseRisk:self.session.sessionId]; self.riskAlertView.hidden = YES; + self.emptyVeiw.hidden = NO; } @@ -926,5 +939,12 @@ } return _stackView; } - +- (UIView *)emptyVeiw{ + if(!_emptyVeiw){ + _emptyVeiw = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, kGetScaleWidth(10))]; + _emptyVeiw.hidden = YES; + _emptyVeiw.backgroundColor = [UIColor clearColor]; + } + return _emptyVeiw; +} @end diff --git a/xplan-ios/Main/Mine/Presenter/XPMineFansPresenter.m b/xplan-ios/Main/Mine/Presenter/XPMineFansPresenter.m index badb6847..ffab934b 100644 --- a/xplan-ios/Main/Mine/Presenter/XPMineFansPresenter.m +++ b/xplan-ios/Main/Mine/Presenter/XPMineFansPresenter.m @@ -37,6 +37,7 @@ NSString * type = @"1"; [Api attentionCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) { [[self getView] attentionFansSuccess]; + [[NSNotificationCenter defaultCenter]postNotificationName:@"kAttentionUserNotification" object:nil]; }] uid:uid likedUid:targetUid ticket:ticket type:type]; } diff --git a/xplan-ios/Main/Mine/Presenter/XPMineUserInfoPresenter.m b/xplan-ios/Main/Mine/Presenter/XPMineUserInfoPresenter.m index 86d89f4b..3ab65753 100644 --- a/xplan-ios/Main/Mine/Presenter/XPMineUserInfoPresenter.m +++ b/xplan-ios/Main/Mine/Presenter/XPMineUserInfoPresenter.m @@ -56,6 +56,7 @@ NSString * type = state ? @"1" : @"2"; [Api attentionCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) { [[self getView] attentionUserSuccess:state]; + [[NSNotificationCenter defaultCenter]postNotificationName:@"kAttentionUserNotification" object:nil]; }] uid:uid likedUid:targetUid ticket:ticket type:type]; } diff --git a/xplan-ios/Main/Mine/View/GameOrder/View/SubViews/XPMineGameOrderDetailsView.h b/xplan-ios/Main/Mine/View/GameOrder/View/SubViews/XPMineGameOrderDetailsView.h index 1eeeb181..e4980b01 100644 --- a/xplan-ios/Main/Mine/View/GameOrder/View/SubViews/XPMineGameOrderDetailsView.h +++ b/xplan-ios/Main/Mine/View/GameOrder/View/SubViews/XPMineGameOrderDetailsView.h @@ -22,6 +22,7 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic,weak) iddelegate; @property(nonatomic,strong) UserGameInfoVo *gameInfo; @property(nonatomic,assign) BOOL isFormChat; +-(instancetype)initWithFrame:(CGRect)frame type:(int)type; @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Mine/View/GameOrder/View/SubViews/XPMineGameOrderDetailsView.m b/xplan-ios/Main/Mine/View/GameOrder/View/SubViews/XPMineGameOrderDetailsView.m index a9b5e889..d0ff4143 100644 --- a/xplan-ios/Main/Mine/View/GameOrder/View/SubViews/XPMineGameOrderDetailsView.m +++ b/xplan-ios/Main/Mine/View/GameOrder/View/SubViews/XPMineGameOrderDetailsView.m @@ -34,14 +34,15 @@ ///再次邀请 @property(nonatomic,strong) UIButton *inviteBnt; - +@property(nonatomic,assign) int type; @end @implementation XPMineGameOrderDetailsView --(instancetype)initWithFrame:(CGRect)frame{ +-(instancetype)initWithFrame:(CGRect)frame type:(int)type{ self = [super initWithFrame:frame]; if(self){ + self.type = type; [self installUI]; [self installConstraints]; } @@ -67,10 +68,19 @@ [self.closeView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(self); }]; - [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) { - make.bottom.leading.trailing.equalTo(self); - make.height.mas_equalTo(kGetScaleWidth(298)); - }]; + if(self.type == 1){ + self.inviteBnt.hidden = YES; + [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.leading.trailing.equalTo(self); + make.height.mas_equalTo(kGetScaleWidth(234)); + }]; + }else{ + [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.leading.trailing.equalTo(self); + make.height.mas_equalTo(kGetScaleWidth(298)); + }]; + } + [self.headView mas_makeConstraints:^(MASConstraintMaker *make) { make.width.height.mas_equalTo(kGetScaleWidth(52)); make.leading.top.mas_equalTo(kGetScaleWidth(20)); @@ -157,8 +167,8 @@ } - (void)setGameInfo:(UserGameInfoVo *)gameInfo{ _gameInfo = gameInfo; - _nameView.text = _gameInfo.toNick; - _headView.imageUrl = _gameInfo.toAvatar; + _nameView.text = _type == 1 ?_gameInfo.fromNick : _gameInfo.toNick; + _headView.imageUrl = _type == 1 ? _gameInfo.fromAvatar : _gameInfo.toAvatar;; _gameIcomView.imageUrl = _gameInfo.gameLogo.length > 0 ? _gameInfo.gameLogo : _gameInfo.logo; _gameNumView.text = [NSString stringWithFormat:@"%@ 局",_gameInfo.inning]; _gameNameView.text = _gameInfo.gameName; @@ -175,7 +185,6 @@ _priceView.textAlignment = NSTextAlignmentRight; _priceView.attributedText = textAtt; - NSMutableAttributedString *tiemAtt = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"邀请时间:%@ ",_gameInfo.orderTime] attributes:@{NSFontAttributeName:kFontRegular(12),NSForegroundColorAttributeName:UIColorFromRGB(0x696D7A)}]; [tiemAtt addAttributes:@{NSFontAttributeName:kFontRegular(12),NSForegroundColorAttributeName:UIColorFromRGB(0xA2A7B8)} range:[textAtt.string rangeOfString:@"邀请时间:"]]; _timeView.attributedText = tiemAtt; @@ -190,6 +199,7 @@ [orderAtt insertAttributedString:[NSMutableAttributedString attributedStringWithAttachment:orderAttachment] atIndex:[NSString stringWithFormat:@"订单编号:%@ ",_gameInfo.orderNo].length]; _orderNumView.attributedText = orderAtt; } + #pragma mark - 懒加载 - (UIButton *)closeView{ if(!_closeView){ diff --git a/xplan-ios/Main/Mine/View/GameOrder/View/SubViews/XPMineGameOrderItemCell.m b/xplan-ios/Main/Mine/View/GameOrder/View/SubViews/XPMineGameOrderItemCell.m index f2445286..e4f51cd2 100644 --- a/xplan-ios/Main/Mine/View/GameOrder/View/SubViews/XPMineGameOrderItemCell.m +++ b/xplan-ios/Main/Mine/View/GameOrder/View/SubViews/XPMineGameOrderItemCell.m @@ -94,8 +94,8 @@ _gameInfo = gameInfo; _gameIcomView.imageUrl = _gameInfo.gameLogo.length > 0 ? _gameInfo.gameLogo : _gameInfo.logo; _gameNameVeiw.text = _gameInfo.gameName; - _headView.imageUrl = [_type isEqualToString:@"0"] ? _gameInfo.fromAvatar : _gameInfo.toAvatar; - _nameView.text = [_type isEqualToString:@"0"] ?_gameInfo.fromNick : _gameInfo.toNick; + _headView.imageUrl = [_type isEqualToString:@"1"] ? _gameInfo.fromAvatar : _gameInfo.toAvatar; + _nameView.text = [_type isEqualToString:@"1"] ?_gameInfo.fromNick : _gameInfo.toNick; _numView.text = [NSString stringWithFormat:@"%@ 局",_gameInfo.inning]; } #pragma mark - 懒加载 diff --git a/xplan-ios/Main/Mine/View/GameOrder/View/XPMineGameOrderItemVC.h b/xplan-ios/Main/Mine/View/GameOrder/View/XPMineGameOrderItemVC.h index 3835d23e..dde71682 100644 --- a/xplan-ios/Main/Mine/View/GameOrder/View/XPMineGameOrderItemVC.h +++ b/xplan-ios/Main/Mine/View/GameOrder/View/XPMineGameOrderItemVC.h @@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN @protocol XPMineGameOrderItemVCDelegate --(void)showGameOrderDetailsViewWithGameInfo:(UserGameInfoVo *)gameInfo; +-(void)showGameOrderDetailsViewWithGameInfo:(UserGameInfoVo *)gameInfo type:(int)type; @end diff --git a/xplan-ios/Main/Mine/View/GameOrder/View/XPMineGameOrderItemVC.m b/xplan-ios/Main/Mine/View/GameOrder/View/XPMineGameOrderItemVC.m index 8c1395d5..8bd4f4bc 100644 --- a/xplan-ios/Main/Mine/View/GameOrder/View/XPMineGameOrderItemVC.m +++ b/xplan-ios/Main/Mine/View/GameOrder/View/XPMineGameOrderItemVC.m @@ -96,14 +96,15 @@ return cell; } XPMineGameOrderItemCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineGameOrderItemCell class]) forIndexPath:indexPath]; + cell.type = self.type; cell.gameInfo = [self.orderList safeObjectAtIndex1:indexPath.row]; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ - if(self.type.integerValue == 1)return; - if(self.delegate && [self.delegate respondsToSelector:@selector(showGameOrderDetailsViewWithGameInfo:)]){ - [self.delegate showGameOrderDetailsViewWithGameInfo:[self.orderList safeObjectAtIndex1:indexPath.row]]; + + if(self.delegate && [self.delegate respondsToSelector:@selector(showGameOrderDetailsViewWithGameInfo:type:)]){ + [self.delegate showGameOrderDetailsViewWithGameInfo:[self.orderList safeObjectAtIndex1:indexPath.row]type:self.type.intValue]; } diff --git a/xplan-ios/Main/Mine/View/GameOrder/View/XPMineGameOrderVC.m b/xplan-ios/Main/Mine/View/GameOrder/View/XPMineGameOrderVC.m index f963bc92..d9fd37de 100644 --- a/xplan-ios/Main/Mine/View/GameOrder/View/XPMineGameOrderVC.m +++ b/xplan-ios/Main/Mine/View/GameOrder/View/XPMineGameOrderVC.m @@ -108,8 +108,8 @@ [self.navigationController popViewControllerAnimated:YES]; } #pragma mark - XPMineGameOrderItemVCDelegate --(void)showGameOrderDetailsViewWithGameInfo:(UserGameInfoVo *)gameInfo{ - XPMineGameOrderDetailsView *detailsView = [[XPMineGameOrderDetailsView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)]; +-(void)showGameOrderDetailsViewWithGameInfo:(UserGameInfoVo *)gameInfo type:(int)type{ + XPMineGameOrderDetailsView *detailsView = [[XPMineGameOrderDetailsView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight) type:type]; detailsView.gameInfo = gameInfo; detailsView.delegate = self; [self.view addSubview:detailsView]; diff --git a/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoViewController.m b/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoViewController.m index 8c91ec63..0d744da8 100644 --- a/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoViewController.m +++ b/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoViewController.m @@ -431,7 +431,7 @@ self.attentionButton.layer.borderColor = UIColor.clearColor.CGColor; } - [[NSNotificationCenter defaultCenter]postNotificationName:@"kAttentionUserNotification" object:nil]; + self.headView.attentionButton.selected = status; if (self.headView.attentionButton.selected) { diff --git a/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMinePlaceOrderView.m b/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMinePlaceOrderView.m index d06bec97..7db50638 100644 --- a/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMinePlaceOrderView.m +++ b/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMinePlaceOrderView.m @@ -518,6 +518,7 @@ _payBtn.titleLabel.font = kFontMedium(14); _payBtn.layer.cornerRadius = kGetScaleWidth(40)/2; _payBtn.layer.masksToBounds = YES; + _payBtn.yn_acceptEventInterval = 1; [_payBtn addTarget:self action:@selector(invitatioAction) forControlEvents:UIControlEventTouchUpInside]; } return _payBtn; diff --git a/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserGameCell.m b/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserGameCell.m index dc5b1904..98951eea 100644 --- a/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserGameCell.m +++ b/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserGameCell.m @@ -244,6 +244,7 @@ [payTitleBnt setTitle:@"咨询下单" forState:UIControlStateNormal]; payTitleBnt.titleLabel.font = kFontMedium(12); [payTitleBnt addTarget:self action:@selector(consultingOrderAction) forControlEvents:UIControlEventTouchUpInside]; + payTitleBnt.yn_acceptEventInterval = 1; _payTitleBnt = payTitleBnt; } return _payTitleBnt; diff --git a/xplan-ios/Main/Mine/View/SubViews/XPMineHeadView.m b/xplan-ios/Main/Mine/View/SubViews/XPMineHeadView.m index 4cc2c57a..3e49999b 100644 --- a/xplan-ios/Main/Mine/View/SubViews/XPMineHeadView.m +++ b/xplan-ios/Main/Mine/View/SubViews/XPMineHeadView.m @@ -473,7 +473,7 @@ } else { NSURL *imgUrl = [NSURL URLWithString:imageName]; UIImage *myImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:imgUrl]]; - CGFloat scale = myImage.size.width / myImage.size.height; + CGFloat scale = myImage.size.width / (myImage.size.height > 0 ? myImage.size.height : 1); if (scale == 0) { imageView.bounds = CGRectMake(0, 0, 51, 17); }else { diff --git a/xplan-ios/Main/Room/View/AnchorPK/View/SubViews/XPAnchorPkPanelView.m b/xplan-ios/Main/Room/View/AnchorPK/View/SubViews/XPAnchorPkPanelView.m index 1e90c70d..d1d73917 100644 --- a/xplan-ios/Main/Room/View/AnchorPK/View/SubViews/XPAnchorPkPanelView.m +++ b/xplan-ios/Main/Room/View/AnchorPK/View/SubViews/XPAnchorPkPanelView.m @@ -401,6 +401,7 @@ NSString * ticket = [[AccountInfoStorage instance] getTicket]; [Api attentionCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { if (code == 200) { + [[NSNotificationCenter defaultCenter]postNotificationName:@"kAttentionUserNotification" object:nil]; self.attentionButton.hidden = YES; [XCHUDTool showErrorWithMessage:@"关注成功"]; if (self.delegate && [self.delegate respondsToSelector:@selector(xPAnchorPKPanelViewAttentionSuccess)]) { diff --git a/xplan-ios/Main/Room/View/AnchorView/XPRoomAnchorInfoCardView.m b/xplan-ios/Main/Room/View/AnchorView/XPRoomAnchorInfoCardView.m index ef358d98..199291b1 100644 --- a/xplan-ios/Main/Room/View/AnchorView/XPRoomAnchorInfoCardView.m +++ b/xplan-ios/Main/Room/View/AnchorView/XPRoomAnchorInfoCardView.m @@ -113,6 +113,7 @@ NSString * type = @"1"; [Api attentionCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { if (code == 200) { + [[NSNotificationCenter defaultCenter]postNotificationName:@"kAttentionUserNotification" object:nil]; [self.followBtn setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor cancelButtonGradientStartColor], [ThemeColor cancelButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal]; [self.followBtn setTitle:@"已关注" forState:UIControlStateNormal]; [self.followBtn setTitleColor:[ThemeColor cancelButtonTextColor] forState:UIControlStateNormal]; diff --git a/xplan-ios/Main/Room/View/AnimationView/XPRoomGameInviteBannerView.m b/xplan-ios/Main/Room/View/AnimationView/XPRoomGameInviteBannerView.m index bc55e558..d40ae43a 100644 --- a/xplan-ios/Main/Room/View/AnimationView/XPRoomGameInviteBannerView.m +++ b/xplan-ios/Main/Room/View/AnimationView/XPRoomGameInviteBannerView.m @@ -123,7 +123,6 @@ _nameView.text = _gameInfo.fromNick; _gameIcomView.imageUrl = _gameInfo.gameLogo.length > 0 ? _gameInfo.gameLogo : _gameInfo.logo; _gameTypeView.text = _gameInfo.gameName; - _gameTypeView.text = @"拖泥带水清晨"; NSMutableAttributedString *textAtt = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"邀请你玩 %@ 局",_gameInfo.inning] attributes:@{NSFontAttributeName:kFontRegular(12),NSForegroundColorAttributeName:[UIColor whiteColor]}]; [textAtt addAttributes:@{NSFontAttributeName:kFontBold(12),NSForegroundColorAttributeName:[UIColor whiteColor]} range:[textAtt.string rangeOfString:_gameInfo.inning]]; _inviteView.attributedText = textAtt; diff --git a/xplan-ios/Main/Room/View/MenuContainerView/XPRoomSendTextView.m b/xplan-ios/Main/Room/View/MenuContainerView/XPRoomSendTextView.m index edba7f0b..d8f1ae85 100644 --- a/xplan-ios/Main/Room/View/MenuContainerView/XPRoomSendTextView.m +++ b/xplan-ios/Main/Room/View/MenuContainerView/XPRoomSendTextView.m @@ -211,7 +211,9 @@ } textView.hidden = NO; - + if(textView.superview == nil ){ + [view addSubview:textView]; + } [textView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.bottom.mas_equalTo(view); make.height.mas_equalTo(40); diff --git a/xplan-ios/Main/Room/View/UserCard/Presenter/XPUserCardPresenter.m b/xplan-ios/Main/Room/View/UserCard/Presenter/XPUserCardPresenter.m index 9ac6bdd5..7d6a9583 100644 --- a/xplan-ios/Main/Room/View/UserCard/Presenter/XPUserCardPresenter.m +++ b/xplan-ios/Main/Room/View/UserCard/Presenter/XPUserCardPresenter.m @@ -401,6 +401,7 @@ [Api attentionCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) { self.attentionItem.isSelect = status; [[self getView] attentionUserSuccess:self.attentionItem]; + [[NSNotificationCenter defaultCenter]postNotificationName:@"kAttentionUserNotification" object:nil]; }] uid:uid likedUid:targetUid ticket:ticket type:type]; }