diff --git a/YuMi.xcodeproj/project.pbxproj b/YuMi.xcodeproj/project.pbxproj index 791a0e64..00d829c8 100644 --- a/YuMi.xcodeproj/project.pbxproj +++ b/YuMi.xcodeproj/project.pbxproj @@ -214,7 +214,6 @@ 234F44E32B3EA4F900E2B532 /* PILineManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 234F44E22B3EA4F900E2B532 /* PILineManager.swift */; }; 2357145A2BE8BC6C004C81D6 /* MSSessionPublicChatHallVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 235714592BE8BC6C004C81D6 /* MSSessionPublicChatHallVC.m */; }; 235714602BE8BD5C004C81D6 /* MSSessionScrollingModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 2357145F2BE8BD5C004C81D6 /* MSSessionScrollingModel.m */; }; - 235714642BE8BEA0004C81D6 /* CALayer+Animation.m in Sources */ = {isa = PBXBuildFile; fileRef = 235714632BE8BEA0004C81D6 /* CALayer+Animation.m */; }; 235714672BE8C009004C81D6 /* MSSessionScrollingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 235714662BE8C009004C81D6 /* MSSessionScrollingView.m */; }; 2357146B2BEA0110004C81D6 /* MSSessionPublicChatHallTopModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 2357146A2BEA0110004C81D6 /* MSSessionPublicChatHallTopModel.m */; }; 2357146E2BEB816B004C81D6 /* MSSessionPublicChatHallHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2357146D2BEB816B004C81D6 /* MSSessionPublicChatHallHeadView.m */; }; @@ -231,6 +230,8 @@ 235714952BEDF517004C81D6 /* MsRoomMessagChatHallView.m in Sources */ = {isa = PBXBuildFile; fileRef = 235714942BEDF517004C81D6 /* MsRoomMessagChatHallView.m */; }; 235714982BEDF54E004C81D6 /* MsRoomMessageMainView.m in Sources */ = {isa = PBXBuildFile; fileRef = 235714972BEDF54E004C81D6 /* MsRoomMessageMainView.m */; }; 2357149B2BEE2AD1004C81D6 /* MsRoomMessagChatHallCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2357149A2BEE2AD1004C81D6 /* MsRoomMessagChatHallCell.m */; }; + 2357149E2BEF0F6D004C81D6 /* MSSessionScrollingItemCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2357149D2BEF0F6D004C81D6 /* MSSessionScrollingItemCell.m */; }; + 235714A12BEF510B004C81D6 /* MSSessionScrollingItemFlowLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 235714A02BEF510B004C81D6 /* MSSessionScrollingItemFlowLayout.m */; }; 235A451A2B04A352009753F5 /* PIRoomActivityWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 235A45192B04A352009753F5 /* PIRoomActivityWebView.m */; }; 235A451D2B04A452009753F5 /* PIRoomActivityWebCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 235A451C2B04A452009753F5 /* PIRoomActivityWebCell.m */; }; 235A45232B04BEB6009753F5 /* PIBaseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 235A45222B04BEB6009753F5 /* PIBaseModel.m */; }; @@ -1947,11 +1948,8 @@ 235714592BE8BC6C004C81D6 /* MSSessionPublicChatHallVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSSessionPublicChatHallVC.m; sourceTree = ""; }; 2357145E2BE8BD5C004C81D6 /* MSSessionScrollingModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionScrollingModel.h; sourceTree = ""; }; 2357145F2BE8BD5C004C81D6 /* MSSessionScrollingModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSSessionScrollingModel.m; sourceTree = ""; }; - 235714622BE8BEA0004C81D6 /* CALayer+Animation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CALayer+Animation.h"; sourceTree = ""; }; - 235714632BE8BEA0004C81D6 /* CALayer+Animation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "CALayer+Animation.m"; sourceTree = ""; }; 235714652BE8C009004C81D6 /* MSSessionScrollingView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionScrollingView.h; sourceTree = ""; }; 235714662BE8C009004C81D6 /* MSSessionScrollingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSSessionScrollingView.m; sourceTree = ""; }; - 235714682BE8C055004C81D6 /* MSSessionScrollingProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionScrollingProtocol.h; sourceTree = ""; }; 235714692BEA0110004C81D6 /* MSSessionPublicChatHallTopModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionPublicChatHallTopModel.h; sourceTree = ""; }; 2357146A2BEA0110004C81D6 /* MSSessionPublicChatHallTopModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSSessionPublicChatHallTopModel.m; sourceTree = ""; }; 2357146C2BEB816B004C81D6 /* MSSessionPublicChatHallHeadView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionPublicChatHallHeadView.h; sourceTree = ""; }; @@ -1982,6 +1980,10 @@ 235714972BEDF54E004C81D6 /* MsRoomMessageMainView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MsRoomMessageMainView.m; sourceTree = ""; }; 235714992BEE2AD1004C81D6 /* MsRoomMessagChatHallCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MsRoomMessagChatHallCell.h; sourceTree = ""; }; 2357149A2BEE2AD1004C81D6 /* MsRoomMessagChatHallCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MsRoomMessagChatHallCell.m; sourceTree = ""; }; + 2357149C2BEF0F6D004C81D6 /* MSSessionScrollingItemCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionScrollingItemCell.h; sourceTree = ""; }; + 2357149D2BEF0F6D004C81D6 /* MSSessionScrollingItemCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSSessionScrollingItemCell.m; sourceTree = ""; }; + 2357149F2BEF510B004C81D6 /* MSSessionScrollingItemFlowLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionScrollingItemFlowLayout.h; sourceTree = ""; }; + 235714A02BEF510B004C81D6 /* MSSessionScrollingItemFlowLayout.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSSessionScrollingItemFlowLayout.m; sourceTree = ""; }; 235A45182B04A352009753F5 /* PIRoomActivityWebView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIRoomActivityWebView.h; sourceTree = ""; }; 235A45192B04A352009753F5 /* PIRoomActivityWebView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PIRoomActivityWebView.m; sourceTree = ""; }; 235A451B2B04A452009753F5 /* PIRoomActivityWebCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIRoomActivityWebCell.h; sourceTree = ""; }; @@ -4980,7 +4982,6 @@ 189DD5A726DFA09700AB55B1 /* Tools */ = { isa = PBXGroup; children = ( - 235714612BE8BE88004C81D6 /* CALayer */, 234F44E12B3EA4DC00E2B532 /* YMLine */, 23CEFC082AFB8FC100576D89 /* sdkContent */, 23FF255C2ABA8EEE0064E904 /* PIIAPTool */, @@ -5227,7 +5228,6 @@ isa = PBXGroup; children = ( 18F404C6276099DF00A6C548 /* MessageProtocol.h */, - 235714682BE8C055004C81D6 /* MSSessionScrollingProtocol.h */, ); path = Protocol; sourceTree = ""; @@ -5592,15 +5592,6 @@ path = YMLine; sourceTree = ""; }; - 235714612BE8BE88004C81D6 /* CALayer */ = { - isa = PBXGroup; - children = ( - 235714622BE8BEA0004C81D6 /* CALayer+Animation.h */, - 235714632BE8BEA0004C81D6 /* CALayer+Animation.m */, - ); - path = CALayer; - sourceTree = ""; - }; 236B2E1B2AA0786E003967A8 /* Library */ = { isa = PBXGroup; children = ( @@ -9579,6 +9570,10 @@ E885D5382977D10E004DC088 /* SessionSettingUserView.m */, 235714652BE8C009004C81D6 /* MSSessionScrollingView.h */, 235714662BE8C009004C81D6 /* MSSessionScrollingView.m */, + 2357149C2BEF0F6D004C81D6 /* MSSessionScrollingItemCell.h */, + 2357149D2BEF0F6D004C81D6 /* MSSessionScrollingItemCell.m */, + 2357149F2BEF510B004C81D6 /* MSSessionScrollingItemFlowLayout.h */, + 235714A02BEF510B004C81D6 /* MSSessionScrollingItemFlowLayout.m */, 2357146F2BEB97BD004C81D6 /* MSSessionScrollingItemView.h */, 235714702BEB97BD004C81D6 /* MSSessionScrollingItemView.m */, 2357146C2BEB816B004C81D6 /* MSSessionPublicChatHallHeadView.h */, @@ -11284,6 +11279,7 @@ E81DCCCD282B63B40039E5C5 /* XPMonentsViewController.m in Sources */, 237700FD2BCD254000D661F1 /* MSBaseTextField.m in Sources */, 237700E62BC7E81F00D661F1 /* UITextField+MSRTL.m in Sources */, + 2357149E2BEF0F6D004C81D6 /* MSSessionScrollingItemCell.m in Sources */, E86507EB281A88A9006951B0 /* MessageContentSkillCardView.m in Sources */, E8B825CA26EA1231009E8E9F /* LoginVerifCodeViewController.m in Sources */, 189DD76226E60DDC00AB55B1 /* Api+Login.m in Sources */, @@ -12090,7 +12086,6 @@ 238B37C92AC55A2C00BFC9D5 /* XPTreasureFairyStoreResultSmallView.m in Sources */, E8C1CD7027D894B800376F83 /* RoomFaceTitleItemModel.m in Sources */, E85E7B4B2A4EB0D300B6D00A /* XPMineGuildManagerSetViewController.m in Sources */, - 235714642BE8BEA0004C81D6 /* CALayer+Animation.m in Sources */, 189DD73D26E21C3F00AB55B1 /* YYUtility+Device.m in Sources */, 187EEEDC26E89B32002833B2 /* BaseModel.m in Sources */, 23CEFC682AFCCE7700576D89 /* PIGiftInfoSegmentedView.m in Sources */, @@ -12346,6 +12341,7 @@ 149839C7299E0B9F00F82CBF /* XPMomentListCollectionViewCell.m in Sources */, 236BA4982BB6AFED00C7C73A /* PINoblePrivilegeEmptyCell.m in Sources */, E88C729C2828F37D0047FB2B /* XPRoomMusicLibraryEmptyTableViewCell.m in Sources */, + 235714A12BEF510B004C81D6 /* MSSessionScrollingItemFlowLayout.m in Sources */, E85E7B0A2A4EB0D200B6D00A /* XPGuildManagerPerPresenter.m in Sources */, 235714922BEDC9B1004C81D6 /* MSSessionPublicChatHalImageModel.m in Sources */, 9B85F3562806DD8A006EDF51 /* XPAnchorPKFinishView.m in Sources */, diff --git a/YuMi/Modules/YMMessage/Model/MSSessionPublicChatHallTopModel.h b/YuMi/Modules/YMMessage/Model/MSSessionPublicChatHallTopModel.h index b60b5f2d..56864b56 100644 --- a/YuMi/Modules/YMMessage/Model/MSSessionPublicChatHallTopModel.h +++ b/YuMi/Modules/YMMessage/Model/MSSessionPublicChatHallTopModel.h @@ -14,10 +14,11 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic,copy) NSString *content; @property(nonatomic,assign) BOOL isTop; @property(nonatomic,copy) NSString *partitionId; -@property(nonatomic,assign) NSString *recordStatus; @property(nonatomic,copy) NSString *nick; @property(nonatomic,assign) NSInteger endTime; @property(nonatomic,assign) NSInteger startTime; +//0 有效 1 过期 +@property(nonatomic,assign) int recordStatus; @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMMessage/Model/MSSessionScrollingModel.h b/YuMi/Modules/YMMessage/Model/MSSessionScrollingModel.h index 7d641f6b..c5dfad79 100644 --- a/YuMi/Modules/YMMessage/Model/MSSessionScrollingModel.h +++ b/YuMi/Modules/YMMessage/Model/MSSessionScrollingModel.h @@ -6,10 +6,10 @@ // #import "PIBaseModel.h" -#import "MSSessionScrollingProtocol.h" + NS_ASSUME_NONNULL_BEGIN -@interface MSSessionScrollingModel : PIBaseModel +@interface MSSessionScrollingModel : PIBaseModel @property (nonatomic,assign)NSTimeInterval beginTime; @property (nonatomic,assign)NSTimeInterval endTime; @property (nonatomic,copy)NSString *content; @@ -22,6 +22,7 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic,copy) NSString *toNick; @property(nonatomic,copy) NSString *toUid; @property(nonatomic,assign) CGFloat width; +@property(nonatomic,strong) NSMutableAttributedString * attribute; @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMMessage/Protocol/MSSessionScrollingProtocol.h b/YuMi/Modules/YMMessage/Protocol/MSSessionScrollingProtocol.h deleted file mode 100644 index b1b0f1c7..00000000 --- a/YuMi/Modules/YMMessage/Protocol/MSSessionScrollingProtocol.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// MSSessionScrollingProtocol.h -// YuMi -// -// Created by duoban on 2024/5/6. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol MSSessionScrollingProtocol -@required -@property (nonatomic,readonly)NSTimeInterval beginTime; -@property (nonatomic,readonly)NSTimeInterval endTime; -@end - -NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMMessage/View/Session/MSSessionPublicChatHallVC.m b/YuMi/Modules/YMMessage/View/Session/MSSessionPublicChatHallVC.m index b6159db6..7d3c8bbe 100644 --- a/YuMi/Modules/YMMessage/View/Session/MSSessionPublicChatHallVC.m +++ b/YuMi/Modules/YMMessage/View/Session/MSSessionPublicChatHallVC.m @@ -184,7 +184,10 @@ NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; AttachmentModel *attachment = (AttachmentModel *)obj.attachment; if (attachment.first == CustomMessageType_Chat_Hall_Headlinesn && attachment.second == Custom_Message_Sub_Chat_Hall_Headlinesn) { - isCanAdd = YES; + MSSessionPublicChatHallTopModel *topModel = [MSSessionPublicChatHallTopModel modelWithDictionary:attachment.data]; + if(topModel.recordStatus == 0){ + isCanAdd = YES; + } } } break; @@ -339,9 +342,7 @@ } - (void)getPublicChatHallTopTextSuccess:(MSSessionPublicChatHallTopModel *)model{ self.headView.topModel = model; - if(model != nil){ - [self setTime:model]; - } + } ///获取用户信息成功 @@ -423,7 +424,9 @@ }]; return; } + dispatch_async(dispatch_get_main_queue(), ^{///回到主线程 + [self hideHUD]; if (self.messages.count > kRoomMessageMaxLength) { NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)]; NSArray *needRemoveMsgArray = [self.messages objectsAtIndexes:set]; @@ -557,7 +560,6 @@ if(!messages.count){ return; } - NIMMessage *message = messages.firstObject; if (self.messages.count > kRoomMessageMaxLength) { NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)]; NSArray *needRemoveMsgArray = [self.messages objectsAtIndexes:set]; diff --git a/YuMi/Modules/YMMessage/View/Session/View/MSSessionPublicChatHallHeadView.m b/YuMi/Modules/YMMessage/View/Session/View/MSSessionPublicChatHallHeadView.m index 35f4eb8d..066fbf5b 100644 --- a/YuMi/Modules/YMMessage/View/Session/View/MSSessionPublicChatHallHeadView.m +++ b/YuMi/Modules/YMMessage/View/Session/View/MSSessionPublicChatHallHeadView.m @@ -30,9 +30,8 @@ } -(void)setTopModel:(MSSessionPublicChatHallTopModel *)topModel{ _topModel = topModel; - if(_topModel == nil){ + if(_topModel.recordStatus == 1 || _topModel == nil){ self.contentView.hidden = YES; - self.addIocnView.hidden = NO; self.textView.hidden = NO; _bgImageView.image = kImage(@"ms_public_chat_hall_head_bg"); diff --git a/YuMi/Modules/YMMessage/View/Session/View/MSSessionReleaseHeadlinesPayView.h b/YuMi/Modules/YMMessage/View/Session/View/MSSessionReleaseHeadlinesPayView.h index 1860d137..b4115a51 100644 --- a/YuMi/Modules/YMMessage/View/Session/View/MSSessionReleaseHeadlinesPayView.h +++ b/YuMi/Modules/YMMessage/View/Session/View/MSSessionReleaseHeadlinesPayView.h @@ -18,6 +18,7 @@ NS_ASSUME_NONNULL_BEGIN @interface MSSessionReleaseHeadlinesPayView : UIView @property(nonatomic,copy) NSString *releaseCoins; @property(nonatomic,copy) NSString *coins; +@property(nonatomic,assign) BOOL isRoom; @property(nonatomic,weak) iddelegate; @end diff --git a/YuMi/Modules/YMMessage/View/Session/View/MSSessionReleaseHeadlinesPayView.m b/YuMi/Modules/YMMessage/View/Session/View/MSSessionReleaseHeadlinesPayView.m index a3f8880b..e250f73d 100644 --- a/YuMi/Modules/YMMessage/View/Session/View/MSSessionReleaseHeadlinesPayView.m +++ b/YuMi/Modules/YMMessage/View/Session/View/MSSessionReleaseHeadlinesPayView.m @@ -36,6 +36,10 @@ [self.bgView addSubview:self.payBtn]; } -(void)backAction{ + if(self.isRoom){ + [self.superview removeFromSuperview]; + return; + } [self removeFromSuperview]; } -(void)installConstraints{ @@ -72,10 +76,15 @@ }]; } -(void)payBtnAction{ - [self removeFromSuperview]; if(self.delegate && [self.delegate respondsToSelector:@selector(payReleaseHeadlines)]){ [self.delegate payReleaseHeadlines]; } + if(self.isRoom){ + [self.superview removeFromSuperview]; + return; + } + [self removeFromSuperview]; + } -(void)setReleaseCoins:(NSString *)releaseCoins{ _releaseCoins = releaseCoins; diff --git a/YuMi/Modules/YMMessage/View/Session/View/MSSessionReleaseHeadlinesView.h b/YuMi/Modules/YMMessage/View/Session/View/MSSessionReleaseHeadlinesView.h index ef40d9fe..caa5be6f 100644 --- a/YuMi/Modules/YMMessage/View/Session/View/MSSessionReleaseHeadlinesView.h +++ b/YuMi/Modules/YMMessage/View/Session/View/MSSessionReleaseHeadlinesView.h @@ -18,6 +18,7 @@ NS_ASSUME_NONNULL_BEGIN @interface MSSessionReleaseHeadlinesView : UIView +@property(nonatomic,copy) NSString *sendText; @property(nonatomic,copy) NSString *golds; @property(nonatomic,copy) NSString *myCoins; @property(nonatomic,weak) iddelegate; diff --git a/YuMi/Modules/YMMessage/View/Session/View/MSSessionReleaseHeadlinesView.m b/YuMi/Modules/YMMessage/View/Session/View/MSSessionReleaseHeadlinesView.m index 4d284569..5f83f59b 100644 --- a/YuMi/Modules/YMMessage/View/Session/View/MSSessionReleaseHeadlinesView.m +++ b/YuMi/Modules/YMMessage/View/Session/View/MSSessionReleaseHeadlinesView.m @@ -66,16 +66,38 @@ -(void)loadDataForRoom{ self.isRoom = YES; [self getCoinsData]; + MSSessionReleaseHeadlinesPayView *payView = [[MSSessionReleaseHeadlinesPayView alloc]initWithFrame:CGRectZero]; + payView.tag = 100001; + payView.isRoom = YES; + payView.delegate = self; + [self addSubview:payView]; + [payView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self); + }]; + self.bgView.hidden = YES; + +} +-(void)setSendText:(NSString *)sendText{ + _sendText = sendText; + _textView.text = _sendText; } -(void)getCoinsData{ + + [XNDJTDDLoadingTool showLoadingInView:kWindow]; [Api requestRecordIncome:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + + [XNDJTDDLoadingTool hideHUDInView:kWindow]; if(code == 200){ XPIncomeRecordModel *model = [XPIncomeRecordModel modelWithDictionary:data.data]; self.myCoins = @(model.diamonds).stringValue; + MSSessionReleaseHeadlinesPayView *payView = [self viewWithTag:100001]; + payView.coins = self.myCoins; } }]; [Api getPublicChatHallTopTextPayMoney:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { self.golds = [NSString stringWithFormat:@"%@",data.data]; + MSSessionReleaseHeadlinesPayView *payView = [self viewWithTag:100001]; + payView.releaseCoins = self.golds; }]; } -(void)releaseBtnAction{ @@ -88,6 +110,7 @@ payView.releaseCoins = self.golds; payView.coins = self.myCoins; payView.delegate = self; + [self addSubview:payView]; [payView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(self); diff --git a/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingItemCell.h b/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingItemCell.h new file mode 100644 index 00000000..142d9235 --- /dev/null +++ b/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingItemCell.h @@ -0,0 +1,16 @@ +// +// MSSessionScrollingItemCell.h +// YuMi +// +// Created by duoban on 2024/5/11. +// + +#import +#import "MSSessionScrollingModel.h" +NS_ASSUME_NONNULL_BEGIN + +@interface MSSessionScrollingItemCell : UICollectionViewCell +@property(nonatomic,strong) MSSessionScrollingModel *model; +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingItemCell.m b/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingItemCell.m new file mode 100644 index 00000000..eeceab45 --- /dev/null +++ b/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingItemCell.m @@ -0,0 +1,41 @@ +// +// MSSessionScrollingItemCell.m +// YuMi +// +// Created by duoban on 2024/5/11. +// + +#import "MSSessionScrollingItemCell.h" +#import "MSSessionScrollingItemView.h" +@interface MSSessionScrollingItemCell() +@property(nonatomic,strong) MSSessionScrollingItemView *itemView; +@end +@implementation MSSessionScrollingItemCell +-(instancetype)initWithFrame:(CGRect)frame{ + self = [super initWithFrame:frame]; + if(self){ + [self installUI]; + [self installConstraints]; + } + return self; +} +-(void)installUI{ + [self.contentView addSubview:self.itemView]; +} +-(void)installConstraints{ + [self.itemView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self.contentView); + }]; +} +- (void)setModel:(MSSessionScrollingModel *)model{ + _model = model; + _itemView.model = _model; +} +#pragma mark - 懒加载 +- (MSSessionScrollingItemView *)itemView{ + if(!_itemView){ + _itemView = [[MSSessionScrollingItemView alloc]initWithFrame:CGRectZero]; + } + return _itemView; +} +@end diff --git a/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingItemFlowLayout.h b/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingItemFlowLayout.h new file mode 100644 index 00000000..fbec8674 --- /dev/null +++ b/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingItemFlowLayout.h @@ -0,0 +1,64 @@ +// +// MSSessionScrollingItemFlowLayout.h +// YuMi +// +// Created by duoban on 2024/5/11. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef enum : NSUInteger { + MSDirectionTypeHorizontalType, + MSDirectionTypeVerticalType, + +} MSDirectionType; + + +@interface MSSessionScrollingItemFlowLayout : MSBaseRTLFlowLayout +/** + * 行高(水平瀑布流时),默认为100 + */ +@property (nonatomic, assign) CGFloat rowHeight; +/** + * 单元格宽度(垂直瀑布流时) + */ +@property (nonatomic, assign, readonly) CGFloat itemWidth; +/** + * 列数 : 默认为3 + */ +@property (nonatomic, assign) NSInteger numberOfColumns; + +/** + * 内边距 : 每一列之间的间距 (top, left, bottom, right)默认为{10, 10, 10, 10}; + */ +@property (nonatomic, assign) UIEdgeInsets insets; + +/** + * 每一行之间的间距 : 默认为10 + */ +@property (nonatomic, assign) CGFloat rowGap; + +/** + * 每一列之间的间距 : 默认为10 + */ +@property (nonatomic, assign) CGFloat columnGap; + +/** + * 高度数组 : 存储所有item的高度 + */ +@property (nonatomic, strong) NSArray *itemHeights; + +/** + * 宽度数组 : 存储所有item的宽度 + */ +@property (nonatomic, strong) NSArray *itemWidths; + +/** + * 瀑布流类型 : 分为水平瀑布流 和 垂直瀑布流 + */ +@property (nonatomic, assign) MSDirectionType type; +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingItemFlowLayout.m b/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingItemFlowLayout.m new file mode 100644 index 00000000..975f6263 --- /dev/null +++ b/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingItemFlowLayout.m @@ -0,0 +1,138 @@ +// +// MSSessionScrollingItemFlowLayout.m +// YuMi +// +// Created by duoban on 2024/5/11. +// + +#import "MSSessionScrollingItemFlowLayout.h" +@interface MSSessionScrollingItemFlowLayout() +@property (nonatomic, strong) NSMutableArray *itemAttributes; // 存放每个cell的布局属性 + +// 垂直瀑布流相关属性 +@property (nonatomic, strong) NSMutableArray *columnsHeights; // 每一列的高度(count=多少列) +@property (nonatomic, assign) CGFloat maxHeight; // 最长列的高度(最大高度) +@property (nonatomic, assign) CGFloat minHeight; // 最短列的高度(最低高度) +@property (nonatomic, assign) NSInteger minIndex; // 最短列的下标 +@property (nonatomic, assign) NSInteger maxIndex; // 最长列的下标 + +// 水平瀑布流相关属性 +@property (nonatomic, strong) NSMutableArray *columnsWidths; // 每一行的宽度(count不确定) +@property (nonatomic, assign) NSInteger tempItemX; // 临时x : 用来计算每个cell的x值 +@property (nonatomic, assign) NSInteger maxRowIndex; //最大行 +@end +@implementation MSSessionScrollingItemFlowLayout +// +#pragma mark -- 系统内部方法 +/** + * 重写父类布局 + */ +- (void)prepareLayout { + + [super prepareLayout]; + // (水平瀑布流时)重置最大行 + if ((self.type == MSDirectionTypeHorizontalType)) { + self.maxRowIndex = 0; + } + + if (self.type == MSDirectionTypeVerticalType) { + // (垂直瀑布流时)重置每一列的高度 + [self.columnsHeights removeAllObjects]; + for (NSUInteger i = 0; i < self.numberOfColumns; i++) { + [self.columnsHeights addObject:@(self.insets.top)]; + } + } + + // 计算所有cell的布局属性 + [self.itemAttributes removeAllObjects]; + NSUInteger itemCount = [self.collectionView numberOfItemsInSection:0]; + self.tempItemX = self.insets.left; + for (NSUInteger i = 0; i < itemCount; ++i) { + NSIndexPath *indexPath = [NSIndexPath indexPathForItem:i inSection:0]; + if (self.type == MSDirectionTypeVerticalType) { + [self setVerticalFrame:indexPath]; + }else if ((self.type == MSDirectionTypeHorizontalType)){ + [self setHorizontalFrame:indexPath]; + } + } +} + +/** + * 水平瀑布:设置每一个attrs的frame,并加入数组中 + */ +- (void)setHorizontalFrame:(NSIndexPath *)indexPath { + UICollectionViewLayoutAttributes *attrs = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath]; + CGFloat w = [self.itemWidths[indexPath.item] floatValue]; + CGFloat width = w + self.columnGap; + CGFloat h = (self.rowHeight == 0) ? 100 : self.rowHeight; + + /** + * 如果当前的x值+当前cell的宽度 超出了 屏幕宽度,那么就要换行了。 + * 换行操作 : 最大行+1,tempItemX重置为10(self.insets.left)。 + */ + if (self.tempItemX + w > [UIScreen mainScreen].bounds.size.width) { + self.maxRowIndex++; + self.tempItemX = self.insets.left; + } + CGFloat x = self.tempItemX; + CGFloat y = self.insets.top + self.maxRowIndex * (h + self.rowGap); + attrs.frame = CGRectMake(x, y, w, h); + + /** + * 注:1.cell的宽度和高度算起来比较简单 : 宽度由外部传进来,高度固定为rowHeight(默认为100)。 + * 2.cell的x : 通过tempItemX算好了。 + * 3.cell的y : minHeight最短列的高度,也就是最低高度,作为当前cell的起始y,当然要加上行之间的间隙。 + */ + + NSLog(@"%@",NSStringFromCGRect(attrs.frame)); + [self.itemAttributes addObject:attrs]; + self.tempItemX += width; +} + +/** + * 垂直瀑布:设置每一个attrs的frame,并加入数组中 + */ +- (void)setVerticalFrame:(NSIndexPath *)indexPath { + UICollectionViewLayoutAttributes *attrs = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath]; + + // cell的frame + CGFloat w = self.itemWidth; + CGFloat h = [self.itemHeights[indexPath.item] floatValue]; + CGFloat x = self.insets.left + self.minIndex * (w + self.columnGap); + CGFloat y = self.minHeight + self.rowGap; + attrs.frame = CGRectMake(x, y, w, h); + + /** + * 注:1.cell的宽度和高度算起来比较简单 : 宽度固定(itemWidth已经算好),高度由外部传进来 + * 2.cell的x : minIndex最短列作为当前列。 + * 3.cell的y : minHeight最短列的高度,也就是最低高度,作为当前cell的起始y,当然要加上行之间的间隙。 + */ + + // 更新数组中的最大高度 + self.columnsHeights[self.minIndex] = @(CGRectGetMaxY(attrs.frame)); + NSLog(@"%@",NSStringFromCGRect(attrs.frame)); + [self.itemAttributes addObject:attrs]; +} + +/** + * 返回collectionView的尺寸 + */ +- (CGSize)collectionViewContentSize { + CGFloat height; + if (self.type == MSDirectionTypeHorizontalType) { + CGFloat rowHeight = (self.rowHeight == 0) ? 100 : self.rowHeight; + height = self.insets.top + (self.maxRowIndex+1) * (rowHeight + self.rowGap); + }else { + height = self.maxHeight; + } + return CGSizeMake(self.collectionView.frame.size.width, height); +} + +/** + * 所有元素(比如cell、补充控件、装饰控件)的布局属性 + */ +- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect +{ + return self.itemAttributes; +} +@end diff --git a/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingItemView.m b/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingItemView.m index 52d22c7a..1bfd6f8a 100644 --- a/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingItemView.m +++ b/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingItemView.m @@ -6,9 +6,10 @@ // #import "MSSessionScrollingItemView.h" + @interface MSSessionScrollingItemView() @property(nonatomic,strong) NetImageView *avatarVeiw; -@property(nonatomic,strong) UILabel *textView; +@property(nonatomic,strong) YYLabel *textView; @end @implementation MSSessionScrollingItemView @@ -23,7 +24,8 @@ -(void)setModel:(MSSessionScrollingModel *)model{ _model = model; _avatarVeiw.imageUrl = _model.fromAvatar; - _textView.text = _model.content; + _textView.attributedText = _model.attribute; + } -(void)installUI{ [self addSubview:self.avatarVeiw]; @@ -37,7 +39,6 @@ [self.textView mas_makeConstraints:^(MASConstraintMaker *make) { make.leading.equalTo(self.avatarVeiw.mas_trailing).mas_offset(kGetScaleWidth(5.5)); make.trailing.mas_equalTo(-kGetScaleWidth(0)); - make.height.mas_equalTo(kGetScaleWidth(11.5)); make.centerY.equalTo(self.avatarVeiw); }]; @@ -53,9 +54,9 @@ } return _avatarVeiw; } -- (UILabel *)textView{ +- (YYLabel *)textView{ if(!_textView){ - _textView = [UILabel labelInitWithText:@"" font:kFontMedium(12) textColor:UIColorFromRGB(0xFFFCED)]; + _textView = [YYLabel new]; } return _textView; } diff --git a/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingView.h b/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingView.h index 93edf132..04015332 100644 --- a/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingView.h +++ b/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingView.h @@ -6,22 +6,15 @@ // #import -#import "MSSessionScrollingProtocol.h" + NS_ASSUME_NONNULL_BEGIN -@class MSSessionScrollingView; -@protocol MSSessionScrollingViewDelegate -@property (nonatomic,readonly)NSTimeInterval curTime; -- (UIView *)MSSessionScrollingView:(MSSessionScrollingView *)view scrollingWithModel:(id)model; -- (void)MSSessionScrollingView:(MSSessionScrollingView *)view didClickView:(UIView *__nullable)scrollingView atPoint:(CGPoint)point; - -@end @interface MSSessionScrollingView : UIView -@property(nonatomic,weak) iddelegate; -@property (nonatomic,strong) NSMutableArray > *modelList; + +@property (nonatomic,strong) NSMutableArray *modelList; @property (nonatomic, assign)BOOL isPause; @property (nonatomic, assign)BOOL isChange; diff --git a/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingView.m b/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingView.m index a8c0ed3e..2f31203c 100644 --- a/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingView.m +++ b/YuMi/Modules/YMMessage/View/Session/View/MSSessionScrollingView.m @@ -6,18 +6,20 @@ // #import "MSSessionScrollingView.h" -#import "CALayer+Animation.h" +#import "MSSessionScrollingItemCell.h" +#import "MSSessionScrollingModel.h" +static const CGFloat ktimerSec = 0.01; -static const CGFloat ktimerSec = 0.1; -static const CGFloat kDandaoCount = 3; -@interface MSSessionScrollingView() +@interface MSSessionScrollingView() @property (nonatomic,weak)NSTimer *timer; -@property (nonatomic,strong)NSMutableArray *waitTimeList; -@property (nonatomic,strong)NSMutableArray *leftTimeList; -@property (nonatomic,strong)NSMutableArray *scrollingList; +@property(nonatomic,strong) UIImageView *bgImageView; +@property(nonatomic,strong) UILabel *textView; +///列表 +@property (nonatomic, strong) UICollectionView *collectionView; + @end @implementation MSSessionScrollingView @@ -30,185 +32,144 @@ static const CGFloat kDandaoCount = 3; return self; } -(void)installUI{ - - + [self addSubview:self.bgImageView]; + [self.bgImageView addSubview:self.textView]; + [self addSubview:self.collectionView]; } -(void)installConstraints{ - + [self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self); + }]; + [self.textView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(kGetScaleWidth(25.5)); + make.centerX.equalTo(self.bgImageView); + }]; + [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.trailing.equalTo(self).inset(kGetScaleWidth(3)); + make.top.mas_equalTo(kGetScaleWidth(48)); + make.bottom.mas_equalTo(-kGetScaleWidth(3)); + }]; } +#pragma mark - UICollectionViewDataSource + + +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { + return self.modelList.count+1; +} + +- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { + if(indexPath.row == 0){ + UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([UICollectionViewCell class]) forIndexPath:indexPath]; + return cell; + } + MSSessionScrollingItemCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([MSSessionScrollingItemCell class]) forIndexPath:indexPath]; + cell.model = [self.modelList safeObjectAtIndex1:indexPath.row-1]; + return cell; +} + +- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{ + return UIEdgeInsetsMake(0, 0, 0, 0);; +} + +- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { + if(indexPath.row == 0){ + + return CGSizeMake(KScreenWidth, kGetScaleWidth(80)); + } + MSSessionScrollingModel *model = [self.modelList safeObjectAtIndex1:indexPath.row-1]; + return CGSizeMake(model.width + kGetScaleWidth(32.5), kGetScaleWidth(27)); +} - (void)ms_ClickView:(UITapGestureRecognizer *)tap { - if ([self.delegate respondsToSelector:@selector(MSSessionScrollingView:didClickView:atPoint:)]) { - [self.delegate MSSessionScrollingView:self didClickView:nil atPoint:CGPointMake(0, 0)]; - } + +} +- (void)setModelList:(NSMutableArray *)modelList{ + _modelList = modelList; + @kWeakify(self); + _timer = [NSTimer timerWithTimeInterval:ktimerSec repeats:YES block:^(NSTimer * _Nonnull timer) { + @kStrongify(self); + self.collectionView.contentOffset = CGPointMake(self.collectionView.contentOffset.x + 0.5, 0); + CGFloat width = self.collectionView.contentSize.width + 5; + if(self.collectionView.contentOffset.x > width){ + self.collectionView.contentOffset = CGPointMake(0, 0); + } + }]; + [[NSRunLoop currentRunLoop]addTimer:_timer forMode:NSRunLoopCommonModes]; + [self.collectionView reloadData]; } - #pragma mark -- 生命周期方法 -- (void)didMoveToSuperview { - [super didMoveToSuperview]; - [self timer]; - self.layer.masksToBounds = YES; -} + -(void)dealloc { - [self.timer invalidate]; - self.timer = nil; + if(self.timer != nil){ + [self.timer invalidate]; + self.timer = nil; + } + } #pragma mark -- 接口 /// 暂停 - (void)pauseAnimation { _isPause = YES; - [[self.scrollingList valueForKeyPath:@"layer"] makeObjectsPerformSelector:@selector(ms_pauseAnimate)]; - [self.timer invalidate]; - self.timer = nil; + + if(self.timer != nil){ + [self.timer invalidate]; + self.timer = nil; + } } /// 继续 - (void)resumeAnimation{ _isPause = NO; - [[self.scrollingList valueForKeyPath:@"layer"] makeObjectsPerformSelector:@selector(ms_resumeAnimate)]; - - [self timer]; + @kWeakify(self); + _timer = [NSTimer timerWithTimeInterval:ktimerSec repeats:YES block:^(NSTimer * _Nonnull timer) { + @kStrongify(self); + self.collectionView.contentOffset = CGPointMake(self.collectionView.contentOffset.x + 0.5, 0); + CGFloat width = self.collectionView.contentSize.width + 5; + if(self.collectionView.contentOffset.x > width){ + self.collectionView.contentOffset = CGPointMake(0, 0); + } + }]; + [[NSRunLoop currentRunLoop]addTimer:_timer forMode:NSRunLoopCommonModes]; } #pragma mark -- 私有方法 -- (void)checkAndBiu { - if (_isPause) { - return; - } - // 实时更新弹道记录的时间信息 - for (int i = 0; i < kDandaoCount; i++) { - double waitValue = [self.waitTimeList[i] doubleValue] - ktimerSec; - if (waitValue <= 0.0) { - waitValue = 0.0; - } - self.waitTimeList[i] = @(waitValue); - - double leftValue = [self.leftTimeList[i] doubleValue] - ktimerSec; - if (leftValue <= 0.0) { - leftValue = 0.0; - } - self.leftTimeList[i] = @(leftValue); - } - - - [self.modelList sortUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) { - if (obj1.beginTime < obj2.beginTime) { - return NSOrderedAscending; - } - return NSOrderedDescending; //降序 - }]; - // 检测模型数组里面所有的模型,是否可以发射 如果可以,直接发射 - NSMutableArray *deleteModelArr = [NSMutableArray array]; - for (id model in self.modelList) { - //1.检测开始时间是否有到达 - NSTimeInterval beginTime = model.beginTime; - NSTimeInterval curTime = self.delegate.curTime; - if (beginTime > curTime) { - break; - } - //2.检测碰撞 - BOOL result = [self checkBoomAndBiuWith:model]; - if (result) { - [deleteModelArr addObject:model]; - } - } - [self.modelList removeObjectsInArray:deleteModelArr]; -} -#pragma mark -- 检测碰撞 -- (BOOL)checkBoomAndBiuWith:(id)model { - - CGFloat danmakuH = self.frame.size.height / kDandaoCount + 10; - // 遍历所有的弹道,在每个弹道里面,进行检测(检测开始碰撞 检测结束碰撞) - for (int i = 0 ; i < kDandaoCount; i++) { - //1.获取该弹道的绝对等待时间 - NSTimeInterval waitTime = [self.waitTimeList[i] doubleValue]; - if (waitTime > 0.0) { - continue; - } - //2.绝对等待时间没有 暂时可以发射 需要判断 是否与前一个弹幕视图产生碰撞 - UIView * danmakuView = [self.delegate MSSessionScrollingView:self scrollingWithModel:model]; - NSTimeInterval leftTime = [self.leftTimeList[i] doubleValue]; - // 速度 = (弹幕视图的宽度 + 弹幕背景的宽度)/endTime - double speed = ( danmakuView.frame.size.width + self.frame.size.width) / model.endTime; - double distance = leftTime * speed; - if (distance > self.frame.size.width) { - continue; - } - if(danmakuH * (i+1) + 5> self.frame.size.height){ - continue; - } - - [self.scrollingList addObject:danmakuView]; - - //重置数据 - // 距离/秒 = 速度v - self.waitTimeList[i] = @(danmakuView.frame.size.width / speed); - self.leftTimeList[i] = @(model.endTime); - - //3.弹幕肯定可以发射 - //3.1 先把弹幕视图,加到弹幕背景里面 - CGRect frame = danmakuView.frame; - frame.origin = CGPointMake(self.frame.size.width, danmakuH * i); - danmakuView.frame = frame; - [self addSubview:danmakuView]; - [UIView animateWithDuration:model.endTime delay:0 options:UIViewAnimationOptionCurveLinear animations:^{ - CGRect frame = danmakuView.frame; - frame.origin.x = - danmakuView.frame.size.width; - danmakuView.frame = frame; - } completion:^(BOOL finished) { - [danmakuView removeFromSuperview]; - [self.scrollingList removeObject:danmakuView]; - }]; - - return YES; - } - - return NO; -} #pragma mark --set get -- (NSMutableArray *)modelList { - if (!_modelList) { - _modelList = [NSMutableArray array]; - } - return _modelList; -} --(NSTimer *)timer { - if (!_timer) { - NSTimer *timer = [NSTimer timerWithTimeInterval:ktimerSec repeats:YES block:^(NSTimer * _Nonnull timer) { - [self checkAndBiu]; - }]; - [[NSRunLoop currentRunLoop]addTimer:timer forMode:NSRunLoopCommonModes]; - _timer = timer; - } - return _timer; -} -- (NSMutableArray *)waitTimeList { - if (!_waitTimeList) { - _waitTimeList = [NSMutableArray arrayWithCapacity:kDandaoCount]; - for (int i = 0; i < kDandaoCount; i ++) { - _waitTimeList[i] = @0.0; - } - } - return _waitTimeList; -} -- (NSMutableArray *)leftTimeList { - if (!_leftTimeList) { - _leftTimeList = [NSMutableArray arrayWithCapacity:kDandaoCount]; - for (int i = 0; i < kDandaoCount; i ++) { - _leftTimeList[i] = @0.0; - } - } - return _leftTimeList; -} -- (NSMutableArray *)scrollingList { - if (!_scrollingList) { - _scrollingList = [NSMutableArray array]; - } - return _scrollingList; -} + +- (UIImageView *)bgImageView{ + if(!_bgImageView){ + _bgImageView = [UIImageView new]; + _bgImageView.userInteractionEnabled = YES; + _bgImageView.image = kImage(@"ms_public_chat_hall_head_enter_bg"); + } + return _bgImageView; +} +- (UILabel *)textView{ + if(!_textView){ + _textView = [UILabel labelInitWithText:YMLocalizedString(@"MSSessionPublicChatHallVC0") font:kFontBold(17) textColor:UIColorFromRGB(0xFFDDA2)]; + } + return _textView; +} +- (UICollectionView *)collectionView { + if (!_collectionView) { + MSBaseRTLFlowLayout *layout = [[MSBaseRTLFlowLayout alloc] init]; + layout.minimumLineSpacing = 2; + layout.minimumInteritemSpacing = 10; + layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; + _collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; + _collectionView.scrollEnabled = NO; + _collectionView.delegate = self; + _collectionView.dataSource = self; + _collectionView.backgroundColor = [UIColor clearColor]; + _collectionView.showsVerticalScrollIndicator = NO; + _collectionView.showsHorizontalScrollIndicator = NO; + [_collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([UICollectionViewCell class])]; + [_collectionView registerClass:[MSSessionScrollingItemCell class] forCellWithReuseIdentifier:NSStringFromClass([MSSessionScrollingItemCell class])]; + } + return _collectionView; +} @end diff --git a/YuMi/Modules/YMMessage/View/Session/XPSessionMainViewController.m b/YuMi/Modules/YMMessage/View/Session/XPSessionMainViewController.m index de30cf74..c0467e30 100644 --- a/YuMi/Modules/YMMessage/View/Session/XPSessionMainViewController.m +++ b/YuMi/Modules/YMMessage/View/Session/XPSessionMainViewController.m @@ -10,6 +10,7 @@ #import #import #import +#import "QEmotionHelper.h" ///vc #import "XPMineAttentionViewController.h" #import "SessionListViewController.h" @@ -20,7 +21,7 @@ #import "MessagePresenter.h" #import "MessageProtocol.h" #import "MSSessionPublicChatHallVC.h" -@interface XPSessionMainViewController () +@interface XPSessionMainViewController () @property (nonatomic, strong) JXCategoryTitleView *titleView; @property (nonatomic, strong) JXCategoryIndicatorImageView *lineView; @property (nonatomic, strong) JXPagerView *pagingView; @@ -38,8 +39,8 @@ ///清除已读 @property (nonatomic,strong) UIButton * allCleanBtn; @property(nonatomic,strong) MSSessionScrollingView *scrollingView; -@property(nonatomic,strong) UIImageView *bgImageView; -@property(nonatomic,strong) UILabel *textView; +@property(nonatomic,strong) UIButton *clickBnt; + @end @implementation XPSessionMainViewController @@ -65,11 +66,18 @@ [self.presenter getPublicChatHallList]; } -(void)getPublicChatHallListSuccess:(NSArray *)list{ - NSMutableArray *l = [NSMutableArray new]; - for (MSSessionScrollingModel *obj in list) { - obj.beginTime = 3; - obj.endTime = 8; + for (MSSessionScrollingModel *model in list) { + CGSize dstRect = CGSizeMake(model.width, MAXFLOAT); + QEmotionHelper *faceManager = [QEmotionHelper sharedEmotionHelper]; + NSMutableAttributedString * attribute = [faceManager attributedStringByText:model.content font:kFontMedium(12)]; + [attribute addAttributes:@{NSForegroundColorAttributeName: UIColorFromRGB(0xFFFCED)} range:[attribute.string rangeOfString:attribute.string]]; + YYTextContainer *container = [YYTextContainer containerWithSize:dstRect]; + container.maximumNumberOfRows = 1; + YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:attribute]; + model.width = layout.textBoundingSize.width; + model.attribute = attribute; } + self.scrollingView.modelList = [[NSMutableArray alloc]initWithArray:list]; } #pragma mark - Private Method @@ -81,35 +89,28 @@ [self.view addSubview:self.headBgImageView]; [self.view addSubview:self.pagingView]; [self.view addSubview:self.allCleanBtn]; - [self.view addSubview:self.bgImageView]; - [self.bgImageView addSubview:self.textView]; - [self.bgImageView addSubview:self.scrollingView]; +; + [self.view addSubview:self.scrollingView]; + [self.scrollingView addSubview:self.clickBnt]; } - (void)initSubViewConstraints { [self.headBgImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.leading.top.trailing.equalTo(self.view); make.height.mas_equalTo(196); }]; - [self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) { + [self.scrollingView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(kStatusBarHeight); make.height.mas_equalTo(kGetScaleWidth(112)); make.leading.trailing.equalTo(self.view); }]; - [self.textView mas_makeConstraints:^(MASConstraintMaker *make) { - make.top.mas_equalTo(kGetScaleWidth(25.5)); - make.centerX.equalTo(self.bgImageView); - }]; - [self.scrollingView mas_makeConstraints:^(MASConstraintMaker *make) { - make.leading.mas_equalTo(0); - make.top.mas_equalTo(kGetScaleWidth(48)); - make.trailing.mas_equalTo(-kGetScaleWidth(0)); - make.bottom.mas_equalTo(kGetScaleWidth(8)); + [self.clickBnt mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self.scrollingView); }]; [self.pagingView mas_makeConstraints:^(MASConstraintMaker *make) { make.leading.trailing.equalTo(self.view); make.bottom.mas_equalTo(-1); - make.top.equalTo(self.bgImageView.mas_bottom).mas_offset(-50); + make.top.equalTo(self.scrollingView.mas_bottom).mas_offset(-50); }]; [self.allCleanBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.width.height.mas_equalTo(30); @@ -183,16 +184,7 @@ - (void)allReadButtonClick:(UIButton *)sender { [[NSNotificationCenter defaultCenter]postNotificationName:@"kAllReadAction" object:nil]; } -#pragma mark- MSSessionScrollingViewDelegate -- (UIView *)MSSessionScrollingView:(MSSessionScrollingView *)view scrollingWithModel:(MSSessionScrollingModel*)model{ - MSSessionScrollingItemView *scrollingView = [[MSSessionScrollingItemView alloc]initWithFrame:CGRectMake(0, 0, model.width + kGetScaleWidth(32.5), kGetScaleWidth(27))]; - scrollingView.model = model; - return scrollingView; -} -- (void)MSSessionScrollingView:(MSSessionScrollingView *)view didClickView:(UIView *)scrollingView atPoint:(CGPoint)point{ - -} -(void)clickPublicChatHallAction{ MSSessionPublicChatHallVC *vc =[MSSessionPublicChatHallVC new]; [self.navigationController pushViewController:vc animated:YES]; @@ -300,25 +292,16 @@ - (MSSessionScrollingView *)scrollingView{ if(!_scrollingView){ _scrollingView = [[MSSessionScrollingView alloc]initWithFrame:CGRectZero]; - _scrollingView.delegate = self; + } return _scrollingView; } -- (UIImageView *)bgImageView{ - if(!_bgImageView){ - _bgImageView = [UIImageView new]; - _bgImageView.userInteractionEnabled = YES; - _bgImageView.image = kImage(@"ms_public_chat_hall_head_enter_bg"); - UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickPublicChatHallAction)]; - [_bgImageView addGestureRecognizer:tap]; +- (UIButton *)clickBnt{ + if(!_clickBnt){ + _clickBnt = [UIButton new]; + [_clickBnt addTarget:self action:@selector(clickPublicChatHallAction) forControlEvents:UIControlEventTouchUpInside]; } - return _bgImageView; -} -- (UILabel *)textView{ - if(!_textView){ - _textView = [UILabel labelInitWithText:YMLocalizedString(@"MSSessionPublicChatHallVC0") font:kFontBold(17) textColor:UIColorFromRGB(0xFFDDA2)]; - } - return _textView; + return _clickBnt; } /* #pragma mark - Navigation diff --git a/YuMi/Modules/YMRoom/Presenter/XPRoomPresenter.m b/YuMi/Modules/YMRoom/Presenter/XPRoomPresenter.m index 5ac1afd3..3af1738a 100644 --- a/YuMi/Modules/YMRoom/Presenter/XPRoomPresenter.m +++ b/YuMi/Modules/YMRoom/Presenter/XPRoomPresenter.m @@ -104,7 +104,6 @@ NSMutableDictionary *ext = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary forKey:[NSString stringWithFormat:@"%ld", userInfo.uid]]; request.roomExt = [ext toJSONString]; - [[NIMSDK sharedSDK].chatroomManager enterChatroom:request completion:^(NSError * _Nullable error, NIMChatroom * _Nullable chatroom, NIMChatroomMember * _Nullable me) { if (error) { [[self getView] enterRoomFail:error.code]; @@ -117,7 +116,7 @@ publicChatRoomRequest.roomId = publicChatRoomId; NSMutableDictionary *publicChatRoomExt = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary forKey:publicChatRoomId]; - request.roomExt = [publicChatRoomExt toJSONString]; + publicChatRoomRequest.roomExt = [publicChatRoomExt toJSONString]; [[NIMSDK sharedSDK].chatroomManager enterChatroom:publicChatRoomRequest completion:^(NSError * _Nullable error, NIMChatroom * _Nullable chatroom, NIMChatroomMember * _Nullable me) { NSLog(@"111"); diff --git a/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomSendTextView.m b/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomSendTextView.m index 5a002752..4752f6b2 100644 --- a/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomSendTextView.m +++ b/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomSendTextView.m @@ -132,8 +132,17 @@ }]; } -(void)showSendheadlineBtnAction{ + if(self.editTextFiled.text.length == 0){ + [XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"MSSessionReleaseHeadlinesView0")]; + return; + } + if(self.editTextFiled.text.length > 100){ + [XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"MSSessionReleaseHeadlinesView0")]; + return; + } [self.editTextFiled resignFirstResponder]; - [[NSNotificationCenter defaultCenter]postNotificationName:@"kShowSendheadlineView" object:nil]; + [[NSNotificationCenter defaultCenter]postNotificationName:@"kShowSendheadlineView" object:self.editTextFiled.text]; + self.editTextFiled.text = @""; } - (void)keyboardWillShow:(NSNotification *)notification { [self.superview bringSubviewToFront:self]; @@ -160,6 +169,7 @@ //键盘隐藏 - (void)keyboardWillHidden:(NSNotification *)notification { + NSDictionary *info = [notification userInfo]; CGFloat duration = [[info objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue]; [UIView animateWithDuration:duration animations:^{ @@ -172,6 +182,7 @@ } -(void)textFieldEditChanged:(NSNotification *)notification{ + UITextField *textField = (UITextField *)notification.object; NSString *toBeString = textField.text; NSString *lang = [textField.textInputMode primaryLanguage]; @@ -205,7 +216,9 @@ } } } + self.inputMessage = textField.text; + if (self.inputMessage.length > 0) { self.sendButton.enabled = YES; } else { @@ -225,6 +238,28 @@ if (textView == nil) { textView = [[XPRoomSendTextView alloc] initWithDelegate:delegate]; [view addSubview:textView]; + }else{ + UIButton *headlineBtn = [textView viewWithTag:100]; + UIButton *sendButton = [textView viewWithTag:101]; + if(delegate.getPublicScreenType == 0){ + headlineBtn.hidden = YES; + [sendButton mas_remakeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(58); + make.height.mas_equalTo(29); + make.trailing.mas_equalTo(-15); + make.centerY.equalTo(textView); + }]; + + }else{ + [sendButton mas_remakeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(58); + make.height.mas_equalTo(29); + make.trailing.mas_equalTo(-53); + make.centerY.equalTo(textView); + }]; + headlineBtn.hidden = NO; + } + } textView.hidden = NO; @@ -247,7 +282,6 @@ #pragma mark - Private Method - (void)initSubViews { self.backgroundColor = UIColorFromRGB(0x260159); - [self addSubview:self.bgEditTextFiled]; [self.bgEditTextFiled addSubview:self.editTextFiled]; [self addSubview:self.sendButton]; @@ -255,19 +289,16 @@ } - (void)initSubViewConstraints { - - [self.headlineBtn mas_makeConstraints:^(MASConstraintMaker *make) { - make.width.mas_equalTo(50); - make.height.mas_equalTo(45); - make.trailing.mas_equalTo(0); - make.centerY.equalTo(self); - }]; - [self.sendButton mas_makeConstraints:^(MASConstraintMaker *make) { - make.width.mas_equalTo(58); - make.height.mas_equalTo(29); - make.trailing.mas_equalTo(-53); - make.centerY.equalTo(self); - }]; + + + [self.headlineBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(50); + make.height.mas_equalTo(45); + make.trailing.mas_equalTo(0); + make.centerY.equalTo(self); + }]; + + [self.bgEditTextFiled mas_makeConstraints:^(MASConstraintMaker *make) { make.leading.mas_equalTo(6); make.height.mas_equalTo(36); @@ -277,11 +308,27 @@ }]; [self.editTextFiled mas_makeConstraints:^(MASConstraintMaker *make) { make.leading.mas_equalTo(20); - make.trailing.mas_equalTo(-kGetScaleWidth(-20)); + make.trailing.mas_equalTo(-kGetScaleWidth(20)); make.top.bottom.mas_equalTo(0); }]; - + if(self.delegate.getPublicScreenType == 0){ + self.headlineBtn.hidden = YES; + [self.sendButton mas_remakeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(58); + make.height.mas_equalTo(29); + make.trailing.mas_equalTo(-15); + make.centerY.equalTo(self); + }]; + return; + } + [self.sendButton mas_remakeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(58); + make.height.mas_equalTo(29); + make.trailing.mas_equalTo(-53); + make.centerY.equalTo(self); + }]; + self.headlineBtn.hidden = NO; } - (void)addNotification { @@ -295,7 +342,7 @@ if(text.length > 0){ self.sendButton.enabled = YES; } - + } #pragma mark - Getters And Setters - (MSBaseTextField *)editTextFiled{ @@ -323,6 +370,7 @@ _sendButton.layer.cornerRadius = 7.5; _sendButton.layer.masksToBounds = YES; [_sendButton addTarget:self action:@selector(sendButtonDidClick:) forControlEvents:UIControlEventTouchUpInside]; + _sendButton.tag = 101; } return _sendButton; } @@ -347,6 +395,7 @@ _headlineBtn = [UIButton new]; [_headlineBtn setBackgroundImage:[UIImage getLanguageImage:@"ms_room_message_send_headline_icon"] forState:UIControlStateNormal]; [_headlineBtn addTarget:self action:@selector(showSendheadlineBtnAction) forControlEvents:UIControlEventTouchUpInside]; + _headlineBtn.tag = 100; } return _headlineBtn; } diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessagChatHallView.m b/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessagChatHallView.m index 2f1b1904..c9c14118 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessagChatHallView.m +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessagChatHallView.m @@ -176,6 +176,29 @@ NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) { AttachmentModel *attachment = (AttachmentModel *)obj.attachment; + if(attachment.first == CustomMessageType_Chat_Hall_Headlinesn && attachment.second == Custom_Message_Sub_Chat_Hall_Headlinesn){ + MSSessionPublicChatHallTopModel *topModel = [MSSessionPublicChatHallTopModel modelWithDictionary:attachment.data]; + if(topModel.recordStatus == 1){ + self.titleView.text = topModel.content; + [self.headerView mas_remakeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(self).offset(15); + make.top.trailing.mas_equalTo(self); + make.height.mas_equalTo(0); + + }]; + }else{ + self.titleView.text = topModel.content; + [self.headerView mas_remakeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(self).offset(15); + make.top.trailing.mas_equalTo(self); + make.height.mas_greaterThanOrEqualTo(0); + + }]; + } + if(topModel.recordStatus == 1){ + return NO; + } + } return [[[self supportMessageDic] objectForKey:@(attachment.first)] containsObject:@(attachment.second)]; } return NO; @@ -215,29 +238,6 @@ self.isMiniEnter = NO; if ([self isCanDisplayMessage:message]) { NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; - AttachmentModel *attachment = (AttachmentModel *)obj.attachment; - if(attachment.first == CustomMessageType_Chat_Hall_Headlinesn && attachment.second == Custom_Message_Sub_Chat_Hall_Headlinesn){ - MSSessionPublicChatHallTopModel *topModel = [MSSessionPublicChatHallTopModel modelWithDictionary:attachment.data]; - if(topModel == nil){ - self.titleView.text = topModel.content; - [self.headerView mas_remakeConstraints:^(MASConstraintMaker *make) { - make.leading.mas_equalTo(self).offset(15); - make.top.trailing.mas_equalTo(self); - make.height.mas_equalTo(0); - - }]; - }else{ - self.titleView.text = topModel.content; - [self.headerView mas_remakeConstraints:^(MASConstraintMaker *make) { - make.leading.mas_equalTo(self).offset(15); - make.top.trailing.mas_equalTo(self); - make.height.mas_greaterThanOrEqualTo(0); - - }]; - } - - - } [self addRoomMessage:message]; } } @@ -289,7 +289,7 @@ self.isLoadHistoryMessage = NO; return; } - [self handleFetchHistoryMessage:message]; + [self handleFetchHistoryMessage]; } else { self.isLoadHistoryMessage = NO; } @@ -297,7 +297,7 @@ } } -- (void)handleFetchHistoryMessage:(NIMMessage *)message { +- (void)handleFetchHistoryMessage{ UserInfoModel *infoModel = self.hostDelegate.getUserInfo; NSString *publicChatRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[infoModel.partitionId]]; @@ -411,7 +411,8 @@ - (void)onRoomMiniEntered { self.isMiniEnter = YES; - self.isLoadHistoryMessage = NO; + [self handleFetchHistoryMessage]; + self.headerView.backgroundColor = UIColorRGBAlpha(0x593722, 0.4); } diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessageMainView.m b/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessageMainView.m index e1076497..017401d0 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessageMainView.m +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessageMainView.m @@ -45,7 +45,7 @@ -(void)installConstraints{ [self.titleView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.leading.mas_equalTo(kGetScaleWidth(0)); - make.width.mas_equalTo(150); + make.width.mas_equalTo(isMSZH() ? 150 : 200); make.height.mas_equalTo(kGetScaleWidth(30)); }]; diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m b/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m index 40c3dbd1..10efa1d6 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m @@ -54,6 +54,7 @@ #import "XPTreasureFairyViewController.h" #import "PIGeneralPublicScreenModel.h" #import "MSSessionPublicChatHallTopModel.h" +#import "QEmotionHelper.h" @implementation XPRoomMessageParser @@ -201,6 +202,7 @@ if(getNick == nil && model.nick != nil){ getNick = model.nick; } + NSString * nick = [NSString stringWithFormat:@"%@:", getNick]; if ([message.from isEqualToString:uid]) { nick = YMLocalizedString(@"XPRoomMessageParser0"); @@ -240,22 +242,28 @@ } } - [attribute appendAttributedString:[self createTextAttribute:nick color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]]; [attribute appendAttributedString:[self createSapceAttribute:2]]; id nickNameNifo = message.remoteExt[@"atNames"]; NSMutableAttributedString *msgStr; if (message.text) { - msgStr = [[NSMutableAttributedString alloc] initWithString:message.text]; - [msgStr addAttribute:NSForegroundColorAttributeName - value:[DJDKMIMOMColor messageTextColor] - range:NSMakeRange(0, msgStr.length)]; - if ([nickNameNifo isKindOfClass:[NSArray class]]) { - for (NSString *nick in nickNameNifo) { - NSRange range = [message.text rangeOfString:nick]; - if (range.length) { - [msgStr yy_setTextHighlightRange:range color:UIColorFromRGB(0xFD85C9) backgroundColor:[UIColor clearColor] userInfo:nil]; + if(model.nick != nick){ + QEmotionHelper *faceManager = [QEmotionHelper sharedEmotionHelper]; + msgStr = [faceManager attributedStringByText:message.text font:[UIFont systemFontOfSize:kRoomMessageDefalutFont]]; + [msgStr addAttributes:@{NSForegroundColorAttributeName: [DJDKMIMOMColor messageTextColor]} range:[msgStr.string rangeOfString:msgStr.string]]; + + }else{ + msgStr = [[NSMutableAttributedString alloc] initWithString:message.text]; + [msgStr addAttribute:NSForegroundColorAttributeName + value:[DJDKMIMOMColor messageTextColor] + range:NSMakeRange(0, msgStr.length)]; + if ([nickNameNifo isKindOfClass:[NSArray class]]) { + for (NSString *nick in nickNameNifo) { + NSRange range = [message.text rangeOfString:nick]; + if (range.length) { + [msgStr yy_setTextHighlightRange:range color:UIColorFromRGB(0xFD85C9) backgroundColor:[UIColor clearColor] userInfo:nil]; + } } } } diff --git a/YuMi/Modules/YMRoom/View/RoomPK/View/SubViews/XPRoomPKUserView.h b/YuMi/Modules/YMRoom/View/RoomPK/View/SubViews/XPRoomPKUserView.h index 2db49b99..cb5dc33f 100644 --- a/YuMi/Modules/YMRoom/View/RoomPK/View/SubViews/XPRoomPKUserView.h +++ b/YuMi/Modules/YMRoom/View/RoomPK/View/SubViews/XPRoomPKUserView.h @@ -15,6 +15,7 @@ typedef NS_ENUM(NSInteger,RoomPKUserViewType) { @class RoomPKChooseUserModel; @interface XPRoomPKUserView : UIView +@property(nonatomic,assign) NSInteger index; @property (nonatomic,assign) RoomPKUserViewType type; ///用户信息 @property (nonatomic,strong, nullable) RoomPKChooseUserModel *userInfo; diff --git a/YuMi/Modules/YMRoom/View/RoomPK/View/SubViews/XPRoomPKUserView.m b/YuMi/Modules/YMRoom/View/RoomPK/View/SubViews/XPRoomPKUserView.m index 5496c022..4a2bc697 100644 --- a/YuMi/Modules/YMRoom/View/RoomPK/View/SubViews/XPRoomPKUserView.m +++ b/YuMi/Modules/YMRoom/View/RoomPK/View/SubViews/XPRoomPKUserView.m @@ -73,10 +73,13 @@ self.avatarImageView.image = [UIImage imageNamed:@"room_pk_position_blue_bg"]; [self.nickButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x3571FE), UIColorFromRGB(0x7994FC)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal]; } - [self.nickButton setTitle:YMLocalizedString(@"XPRoomPKUserView0") forState:UIControlStateNormal]; + [self.nickButton setTitle:[NSString stringWithFormat:@"%ld",_index] forState:UIControlStateNormal]; } } - +-(void)setIndex:(NSInteger)index{ + _index = index; + [self.nickButton setTitle:[NSString stringWithFormat:@"%ld",_index] forState:UIControlStateNormal]; +} - (void)setType:(RoomPKUserViewType)type { _type = type; switch (_type) { diff --git a/YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKViewController.m b/YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKViewController.m index 51ec4e8d..ff4d10bd 100644 --- a/YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKViewController.m +++ b/YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKViewController.m @@ -169,6 +169,7 @@ [redArray addObject:redView]; redView.type = RoomPKUserViewType_Red; UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(redDidTapRecognizer:)]; + redView.index = i + 1; [redView addGestureRecognizer:tap]; [self.userContainerView addSubview:redView]; [redView mas_makeConstraints:^(MASConstraintMaker *make) { @@ -186,6 +187,7 @@ blueView.type = RoomPKUserViewType_Blue; UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(blueDidTapRecognizer:)]; [blueView addGestureRecognizer:tap]; + blueView.index = i + 1; [self.userContainerView addSubview:blueView]; [blueView mas_makeConstraints:^(MASConstraintMaker *make) { make.size.mas_equalTo(CGSizeMake(itemWidth, itemHeight)); diff --git a/YuMi/Modules/YMRoom/View/XPRoomViewController.m b/YuMi/Modules/YMRoom/View/XPRoomViewController.m index 218a217a..ec7fefb1 100644 --- a/YuMi/Modules/YMRoom/View/XPRoomViewController.m +++ b/YuMi/Modules/YMRoom/View/XPRoomViewController.m @@ -315,15 +315,18 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出 [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(showRoomFirstChargeWindowFormNot:) name:kShowFirstRechargeView object:nil]; [XPSkillCardPlayerManager shareInstance].isInRoom = YES; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(openRedPacketNotification:) name:@"kOpenRedPacketNotification" object:nil]; - [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(showSendheadlineView) name:@"kShowSendheadlineView" object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(showSendheadlineView:) name:@"kShowSendheadlineView" object:nil]; } --(void)showSendheadlineView{ +-(void)showSendheadlineView:(NSNotification *)not{ + MSSessionReleaseHeadlinesView *releaseView = [[MSSessionReleaseHeadlinesView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)]; + releaseView.sendText = not.object; [releaseView loadDataForRoom]; releaseView.delegate = self; - [TTPopup popupView:releaseView style:TTPopupStyleAlert]; + releaseView.backgroundColor = [UIColor clearColor]; + [self.view addSubview:releaseView]; } #pragma makr- MSSessionReleaseHeadlinesViewDelegate -(void)releaseHeadlinesWithText:(NSString *)text{ diff --git a/YuMi/ar.lproj/Localizable.strings b/YuMi/ar.lproj/Localizable.strings index 53bfcdba..1e325b2c 100644 --- a/YuMi/ar.lproj/Localizable.strings +++ b/YuMi/ar.lproj/Localizable.strings @@ -1523,7 +1523,7 @@ ineHeadView12" = "الحمل"; "XPRoomPKTypeTableViewCell0" = "نمط PK"; "XPRoomPKTypeTableViewCell1" = "PK حسب الفريق"; -"XPRoomPKVoteTableViewCell0" = "نوع التصويت في PK"; +"XPRoomPKVoteTableViewCell0" = "نوع التصويت "; "XPRoomPKVoteTableViewCell1" = "حسب قيمة الهدايا"; "XPRoomPKVoteTableViewCell2" = "حسب عدد الأشخاص الذين قدموا الهدايا"; diff --git a/YuMi/main.m b/YuMi/main.m index 0a3eae3d..ea73a6b7 100644 --- a/YuMi/main.m +++ b/YuMi/main.m @@ -14,5 +14,6 @@ int main(int argc, char * argv[]) { // Setup code that might create autoreleased objects goes here. appDelegateClassName = NSStringFromClass([AppDelegate class]); } + return UIApplicationMain(argc, argv, nil, appDelegateClassName); }