房间公屏用模型
This commit is contained in:
@@ -669,6 +669,9 @@
|
|||||||
E8395339276A0CC100CF2F24 /* XPMineHeadwearTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8395338276A0CC100CF2F24 /* XPMineHeadwearTableViewCell.m */; };
|
E8395339276A0CC100CF2F24 /* XPMineHeadwearTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8395338276A0CC100CF2F24 /* XPMineHeadwearTableViewCell.m */; };
|
||||||
E839533C276A0CCD00CF2F24 /* XPMineCarTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E839533B276A0CCD00CF2F24 /* XPMineCarTableViewCell.m */; };
|
E839533C276A0CCD00CF2F24 /* XPMineCarTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E839533B276A0CCD00CF2F24 /* XPMineCarTableViewCell.m */; };
|
||||||
E839533F276A0CDB00CF2F24 /* XPMineNameplateTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E839533E276A0CDB00CF2F24 /* XPMineNameplateTableViewCell.m */; };
|
E839533F276A0CDB00CF2F24 /* XPMineNameplateTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E839533E276A0CDB00CF2F24 /* XPMineNameplateTableViewCell.m */; };
|
||||||
|
E83980662902728D0084BFC8 /* XPSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = E83980652902728D0084BFC8 /* XPSlider.m */; };
|
||||||
|
E839806829027D4A0084BFC8 /* room_wish_gift_sendCelebrate.svga in Resources */ = {isa = PBXBuildFile; fileRef = E839806729027D4A0084BFC8 /* room_wish_gift_sendCelebrate.svga */; };
|
||||||
|
E839806B290288660084BFC8 /* XPMessageInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E839806A290288660084BFC8 /* XPMessageInfoModel.m */; };
|
||||||
E83ABEF6280E9AD800322EE4 /* MessageContentUnSupportView.m in Sources */ = {isa = PBXBuildFile; fileRef = E83ABEF5280E9AD800322EE4 /* MessageContentUnSupportView.m */; };
|
E83ABEF6280E9AD800322EE4 /* MessageContentUnSupportView.m in Sources */ = {isa = PBXBuildFile; fileRef = E83ABEF5280E9AD800322EE4 /* MessageContentUnSupportView.m */; };
|
||||||
E83ABEF9280EAF3F00322EE4 /* MessageContentOpenLiveView.m in Sources */ = {isa = PBXBuildFile; fileRef = E83ABEF8280EAF3F00322EE4 /* MessageContentOpenLiveView.m */; };
|
E83ABEF9280EAF3F00322EE4 /* MessageContentOpenLiveView.m in Sources */ = {isa = PBXBuildFile; fileRef = E83ABEF8280EAF3F00322EE4 /* MessageContentOpenLiveView.m */; };
|
||||||
E83ABEFD280EB5E200322EE4 /* ContentOpenLiveInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E83ABEFC280EB5E200322EE4 /* ContentOpenLiveInfoModel.m */; };
|
E83ABEFD280EB5E200322EE4 /* ContentOpenLiveInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E83ABEFC280EB5E200322EE4 /* ContentOpenLiveInfoModel.m */; };
|
||||||
@@ -2380,6 +2383,11 @@
|
|||||||
E839533B276A0CCD00CF2F24 /* XPMineCarTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineCarTableViewCell.m; sourceTree = "<group>"; };
|
E839533B276A0CCD00CF2F24 /* XPMineCarTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineCarTableViewCell.m; sourceTree = "<group>"; };
|
||||||
E839533D276A0CDB00CF2F24 /* XPMineNameplateTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineNameplateTableViewCell.h; sourceTree = "<group>"; };
|
E839533D276A0CDB00CF2F24 /* XPMineNameplateTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineNameplateTableViewCell.h; sourceTree = "<group>"; };
|
||||||
E839533E276A0CDB00CF2F24 /* XPMineNameplateTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineNameplateTableViewCell.m; sourceTree = "<group>"; };
|
E839533E276A0CDB00CF2F24 /* XPMineNameplateTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineNameplateTableViewCell.m; sourceTree = "<group>"; };
|
||||||
|
E83980642902728D0084BFC8 /* XPSlider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSlider.h; sourceTree = "<group>"; };
|
||||||
|
E83980652902728D0084BFC8 /* XPSlider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSlider.m; sourceTree = "<group>"; };
|
||||||
|
E839806729027D4A0084BFC8 /* room_wish_gift_sendCelebrate.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = room_wish_gift_sendCelebrate.svga; sourceTree = "<group>"; };
|
||||||
|
E8398069290288660084BFC8 /* XPMessageInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMessageInfoModel.h; sourceTree = "<group>"; };
|
||||||
|
E839806A290288660084BFC8 /* XPMessageInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMessageInfoModel.m; sourceTree = "<group>"; };
|
||||||
E83ABEF4280E9AD800322EE4 /* MessageContentUnSupportView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageContentUnSupportView.h; sourceTree = "<group>"; };
|
E83ABEF4280E9AD800322EE4 /* MessageContentUnSupportView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageContentUnSupportView.h; sourceTree = "<group>"; };
|
||||||
E83ABEF5280E9AD800322EE4 /* MessageContentUnSupportView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessageContentUnSupportView.m; sourceTree = "<group>"; };
|
E83ABEF5280E9AD800322EE4 /* MessageContentUnSupportView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessageContentUnSupportView.m; sourceTree = "<group>"; };
|
||||||
E83ABEF7280EAF3F00322EE4 /* MessageContentOpenLiveView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageContentOpenLiveView.h; sourceTree = "<group>"; };
|
E83ABEF7280EAF3F00322EE4 /* MessageContentOpenLiveView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageContentOpenLiveView.h; sourceTree = "<group>"; };
|
||||||
@@ -6463,6 +6471,8 @@
|
|||||||
children = (
|
children = (
|
||||||
E87A24EF272935920086A794 /* XPMessageRemoteExtModel.h */,
|
E87A24EF272935920086A794 /* XPMessageRemoteExtModel.h */,
|
||||||
E87A24F0272935920086A794 /* XPMessageRemoteExtModel.m */,
|
E87A24F0272935920086A794 /* XPMessageRemoteExtModel.m */,
|
||||||
|
E8398069290288660084BFC8 /* XPMessageInfoModel.h */,
|
||||||
|
E839806A290288660084BFC8 /* XPMessageInfoModel.m */,
|
||||||
);
|
);
|
||||||
path = Model;
|
path = Model;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -7196,6 +7206,7 @@
|
|||||||
E8A1E45C276220B100B294CA /* Sources */ = {
|
E8A1E45C276220B100B294CA /* Sources */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
E839806729027D4A0084BFC8 /* room_wish_gift_sendCelebrate.svga */,
|
||||||
E897AC0228AF9DDE003B3587 /* sailing_prize_cowry.svga */,
|
E897AC0228AF9DDE003B3587 /* sailing_prize_cowry.svga */,
|
||||||
E897AC0028AF6B90003B3587 /* sailing_prize.svga */,
|
E897AC0028AF6B90003B3587 /* sailing_prize.svga */,
|
||||||
9B8DE0E7289CFE8100FB6EC2 /* compound_gift_banner.svga */,
|
9B8DE0E7289CFE8100FB6EC2 /* compound_gift_banner.svga */,
|
||||||
@@ -7384,6 +7395,8 @@
|
|||||||
E89DCF5928FFF1AD001647EC /* XPWishGiftSectionView.m */,
|
E89DCF5928FFF1AD001647EC /* XPWishGiftSectionView.m */,
|
||||||
E89DCF5E2900F4FB001647EC /* XPWishGiftEnterView.h */,
|
E89DCF5E2900F4FB001647EC /* XPWishGiftEnterView.h */,
|
||||||
E89DCF5F2900F4FB001647EC /* XPWishGiftEnterView.m */,
|
E89DCF5F2900F4FB001647EC /* XPWishGiftEnterView.m */,
|
||||||
|
E83980642902728D0084BFC8 /* XPSlider.h */,
|
||||||
|
E83980652902728D0084BFC8 /* XPSlider.m */,
|
||||||
);
|
);
|
||||||
path = View;
|
path = View;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -8914,6 +8927,7 @@
|
|||||||
E8E859E428264D8800EE4857 /* index.html in Resources */,
|
E8E859E428264D8800EE4857 /* index.html in Resources */,
|
||||||
E80EC89528ACD84000D133C5 /* emoji_99@2x.png in Resources */,
|
E80EC89528ACD84000D133C5 /* emoji_99@2x.png in Resources */,
|
||||||
E80EC89128ACD84000D133C5 /* emoji_133@2x.png in Resources */,
|
E80EC89128ACD84000D133C5 /* emoji_133@2x.png in Resources */,
|
||||||
|
E839806829027D4A0084BFC8 /* room_wish_gift_sendCelebrate.svga in Resources */,
|
||||||
E80EC87F28ACD84000D133C5 /* emoji_137@2x.png in Resources */,
|
E80EC87F28ACD84000D133C5 /* emoji_137@2x.png in Resources */,
|
||||||
E80EC8B028ACD84100D133C5 /* emoji_152@2x.png in Resources */,
|
E80EC8B028ACD84100D133C5 /* emoji_152@2x.png in Resources */,
|
||||||
E80EC85728ACD84000D133C5 /* emoji_130@2x.png in Resources */,
|
E80EC85728ACD84000D133C5 /* emoji_130@2x.png in Resources */,
|
||||||
@@ -9524,6 +9538,7 @@
|
|||||||
E82325F2274E2DE6003A3332 /* XPUserCardViewController.m in Sources */,
|
E82325F2274E2DE6003A3332 /* XPUserCardViewController.m in Sources */,
|
||||||
E8E859D228264C2300EE4857 /* HTTPServer.m in Sources */,
|
E8E859D228264C2300EE4857 /* HTTPServer.m in Sources */,
|
||||||
E8F65C222869A36F009BB5B9 /* ContentShareMonentsModel.m in Sources */,
|
E8F65C222869A36F009BB5B9 /* ContentShareMonentsModel.m in Sources */,
|
||||||
|
E83980662902728D0084BFC8 /* XPSlider.m in Sources */,
|
||||||
E8C167182806A03800ECB15C /* XPSuperAdminSetPresenter.m in Sources */,
|
E8C167182806A03800ECB15C /* XPSuperAdminSetPresenter.m in Sources */,
|
||||||
9B6E856E281AABAB0041A321 /* XPRoomRecommendModel.m in Sources */,
|
9B6E856E281AABAB0041A321 /* XPRoomRecommendModel.m in Sources */,
|
||||||
E801274B27E327DA00BAC3F2 /* XPRoomPKTypeTableViewCell.m in Sources */,
|
E801274B27E327DA00BAC3F2 /* XPRoomPKTypeTableViewCell.m in Sources */,
|
||||||
@@ -10022,6 +10037,7 @@
|
|||||||
E8A30BE328534A28003B4873 /* XPSessionFindNewViewController.m in Sources */,
|
E8A30BE328534A28003B4873 /* XPSessionFindNewViewController.m in Sources */,
|
||||||
E8A03DF927634A590098D9EA /* CandyTreeResultModel.m in Sources */,
|
E8A03DF927634A590098D9EA /* CandyTreeResultModel.m in Sources */,
|
||||||
E872308D26E89DAA00B90D4F /* LoginInputView.m in Sources */,
|
E872308D26E89DAA00B90D4F /* LoginInputView.m in Sources */,
|
||||||
|
E839806B290288660084BFC8 /* XPMessageInfoModel.m in Sources */,
|
||||||
E851E46827FF2141002F3ACB /* XPGuildSetNamePresenter.m in Sources */,
|
E851E46827FF2141002F3ACB /* XPGuildSetNamePresenter.m in Sources */,
|
||||||
E81C1B2C27706E5C0020D1E4 /* ArrangeMicModel.m in Sources */,
|
E81C1B2C27706E5C0020D1E4 /* ArrangeMicModel.m in Sources */,
|
||||||
9B1B729528002099003FACE9 /* XPMineFansTeamViewController.m in Sources */,
|
9B1B729528002099003FACE9 /* XPMineFansTeamViewController.m in Sources */,
|
||||||
|
22
xplan-ios/Assets.xcassets/Room/WishGift/room_wish_gift_mesage_finish.imageset/Contents.json
vendored
Normal file
22
xplan-ios/Assets.xcassets/Room/WishGift/room_wish_gift_mesage_finish.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "room_wish_gift_mesage_finish@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "room_wish_gift_mesage_finish@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
After Width: | Height: | Size: 43 KiB |
@@ -375,6 +375,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.giftBarView.sendButtonIsEnable = NO;
|
self.giftBarView.sendButtonIsEnable = NO;
|
||||||
|
NSLog(@"送礼物陈宫之前的时间:%@", [NSDate date]);
|
||||||
///发送消息
|
///发送消息
|
||||||
[self.presenter sendGift:uidString giftNum:giftNumber sendType:sendType giftId:giftId giftSource:sourceType giftType:giftInfo.giftType roomSendType:roomSendType roomUid:self.roomUid msg:@""];
|
[self.presenter sendGift:uidString giftNum:giftNumber sendType:sendType giftId:giftId giftSource:sourceType giftType:giftInfo.giftType roomSendType:roomSendType roomUid:self.roomUid msg:@""];
|
||||||
} else {
|
} else {
|
||||||
@@ -591,6 +592,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)sendGiftSuccess:(GiftReceiveInfoModel *)receiveInfo originDic:(NSDictionary *)originDic uidCount:(NSInteger)uidCount{
|
- (void)sendGiftSuccess:(GiftReceiveInfoModel *)receiveInfo originDic:(NSDictionary *)originDic uidCount:(NSInteger)uidCount{
|
||||||
|
NSLog(@"送礼物陈宫之后的时间:%@", [NSDate date]);
|
||||||
self.giftBarView.sendButtonIsEnable = YES;
|
self.giftBarView.sendButtonIsEnable = YES;
|
||||||
if (receiveInfo.sourceType == GiftSourceType_Pack) {
|
if (receiveInfo.sourceType == GiftSourceType_Pack) {
|
||||||
///更新个数
|
///更新个数
|
||||||
|
@@ -130,6 +130,8 @@
|
|||||||
@property (nonatomic, strong) NSMutableArray<AttachmentModel *> *graffitiGiftQueue;
|
@property (nonatomic, strong) NSMutableArray<AttachmentModel *> *graffitiGiftQueue;
|
||||||
///幸运礼物动画是否在播放
|
///幸运礼物动画是否在播放
|
||||||
@property (nonatomic,assign) BOOL isLuckyGiftAnimation;
|
@property (nonatomic,assign) BOOL isLuckyGiftAnimation;
|
||||||
|
#pragma mark - 心愿礼物
|
||||||
|
@property (nonatomic,strong) SVGAImageView *wishGiftEffectView;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation XPRoomAnimationView
|
@implementation XPRoomAnimationView
|
||||||
@@ -283,6 +285,8 @@
|
|||||||
[self receiveRoomSailing:attachment];
|
[self receiveRoomSailing:attachment];
|
||||||
} else if(attachment.first == CustomMessageType_Graffiti_Gift) {///涂鸦礼物
|
} else if(attachment.first == CustomMessageType_Graffiti_Gift) {///涂鸦礼物
|
||||||
[self receiveRoomGraffitiGift:attachment];
|
[self receiveRoomGraffitiGift:attachment];
|
||||||
|
} else if(attachment.first == CustomMessageType_Wish_Gift && attachment.second == Custom_Message_Sub_Wish_Gift_Gelebrate) {
|
||||||
|
[self receiveRoomWishGiftCelebrate:attachment];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1578,6 +1582,30 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - 心愿礼物
|
||||||
|
- (void)receiveRoomWishGiftCelebrate:(AttachmentModel *)attachment {
|
||||||
|
if (self.wishGiftEffectView.superview == nil) {
|
||||||
|
[self.lowLevelView addSubview:self.wishGiftEffectView];
|
||||||
|
CGFloat x = random() % 300;
|
||||||
|
CGFloat y= random() % 20 + kNavigationHeight;
|
||||||
|
[self.wishGiftEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.left.mas_equalTo(x);
|
||||||
|
make.top.mas_equalTo(y);
|
||||||
|
make.width.mas_equalTo(200);
|
||||||
|
make.height.mas_equalTo(167);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
[self.parser parseWithNamed:@"room_wish_gift_sendCelebrate" inBundle:NSBundle.mainBundle completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
|
||||||
|
self.wishGiftEffectView.alpha = 1;
|
||||||
|
self.wishGiftEffectView.loops = 1;
|
||||||
|
self.wishGiftEffectView.clearsAfterStop = YES;
|
||||||
|
self.wishGiftEffectView.videoItem = videoItem;
|
||||||
|
[self.wishGiftEffectView startAnimation];
|
||||||
|
} failureBlock:^(NSError * _Nonnull error) {
|
||||||
|
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - HWDMP4PlayDelegate
|
#pragma mark - HWDMP4PlayDelegate
|
||||||
//即将开始播放时询问,true马上开始播放,false放弃播放
|
//即将开始播放时询问,true马上开始播放,false放弃播放
|
||||||
- (BOOL)shouldStartPlayMP4:(VAPView *)container config:(QGVAPConfigModel *)config {
|
- (BOOL)shouldStartPlayMP4:(VAPView *)container config:(QGVAPConfigModel *)config {
|
||||||
@@ -1884,4 +1912,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (SVGAImageView *)wishGiftEffectView {
|
||||||
|
if (_wishGiftEffectView == nil) {
|
||||||
|
_wishGiftEffectView = [[SVGAImageView alloc]init];
|
||||||
|
_wishGiftEffectView.delegate = self;
|
||||||
|
_wishGiftEffectView.contentMode = UIViewContentModeScaleAspectFit;
|
||||||
|
_wishGiftEffectView.frame = CGRectMake(0, 0, 210, 183);
|
||||||
|
_wishGiftEffectView.backgroundColor = [UIColor clearColor];
|
||||||
|
_wishGiftEffectView.alpha = 1;
|
||||||
|
_wishGiftEffectView.userInteractionEnabled = NO;
|
||||||
|
}
|
||||||
|
return _wishGiftEffectView;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -140,6 +140,8 @@
|
|||||||
@property (nonatomic, strong) dispatch_source_t userGiftTimer;
|
@property (nonatomic, strong) dispatch_source_t userGiftTimer;
|
||||||
///许愿礼物
|
///许愿礼物
|
||||||
@property (nonatomic,strong) XPWishGiftEnterView *wishGiftView;
|
@property (nonatomic,strong) XPWishGiftEnterView *wishGiftView;
|
||||||
|
///心愿礼物面板 更新进度
|
||||||
|
@property (nonatomic,weak) XPWishGiftViewController* wishGiftVC ;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -883,7 +885,9 @@
|
|||||||
[self handleAnchorFansTeam:attachment];
|
[self handleAnchorFansTeam:attachment];
|
||||||
} else if (attachment.first == CustomMessageType_Noble_VIP && attachment.second == Custom_Message_Sub_Room_Trumpet) {
|
} else if (attachment.first == CustomMessageType_Noble_VIP && attachment.second == Custom_Message_Sub_Room_Trumpet) {
|
||||||
[self handleTrumpet:attachment];
|
[self handleTrumpet:attachment];
|
||||||
}
|
} else if(attachment.first == CustomMessageType_Wish_Gift) {
|
||||||
|
[self handleWishGiftMessage:attachment];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1647,6 +1651,7 @@
|
|||||||
- (void)tapWishGift {
|
- (void)tapWishGift {
|
||||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
|
||||||
XPWishGiftViewController * vc = [[XPWishGiftViewController alloc] initWithRoomUid:roomUid];
|
XPWishGiftViewController * vc = [[XPWishGiftViewController alloc] initWithRoomUid:roomUid];
|
||||||
|
self.wishGiftVC = vc;
|
||||||
vc.delegate = self;
|
vc.delegate = self;
|
||||||
vc.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
vc.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||||||
[self.delegate.getCurrentNav presentViewController:vc animated:YES completion:nil];
|
[self.delegate.getCurrentNav presentViewController:vc animated:YES completion:nil];
|
||||||
@@ -1655,16 +1660,7 @@
|
|||||||
- (void)configWishGiftEnter {
|
- (void)configWishGiftEnter {
|
||||||
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
||||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", roomInfo.uid];
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", roomInfo.uid];
|
||||||
roomInfo.hasOpenWishGift = YES;
|
|
||||||
if (roomInfo.hasOpenWishGift) {
|
if (roomInfo.hasOpenWishGift) {
|
||||||
if (!self.wishGiftView.superview) {
|
|
||||||
[self addSubview:self.wishGiftView];
|
|
||||||
[self.wishGiftView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
||||||
make.top.mas_equalTo(self).offset(kNavigationHeight + 47);
|
|
||||||
make.right.mas_equalTo(self.mas_right).offset(0);
|
|
||||||
make.size.mas_equalTo(CGSizeMake(81, 30));
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
[Api wishGiftList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
[Api wishGiftList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
NSArray * array = [WishGiftInfoModel modelsWithArray:data.data];
|
NSArray * array = [WishGiftInfoModel modelsWithArray:data.data];
|
||||||
@@ -1673,6 +1669,15 @@
|
|||||||
} else {
|
} else {
|
||||||
self.wishGiftView.hidden = YES;
|
self.wishGiftView.hidden = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!self.wishGiftView.superview) {
|
||||||
|
[self addSubview:self.wishGiftView];
|
||||||
|
[self.wishGiftView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.top.mas_equalTo(self).offset(kNavigationHeight + 47);
|
||||||
|
make.right.mas_equalTo(self.mas_right).offset(0);
|
||||||
|
make.size.mas_equalTo(CGSizeMake(81, 30));
|
||||||
|
}];
|
||||||
|
}
|
||||||
} roomUid:roomUid];
|
} roomUid:roomUid];
|
||||||
} else {
|
} else {
|
||||||
if (self.wishGiftView.superview) {
|
if (self.wishGiftView.superview) {
|
||||||
@@ -1691,6 +1696,22 @@
|
|||||||
[self.delegate.getCurrentNav presentViewController:giftView animated:YES completion:nil];
|
[self.delegate.getCurrentNav presentViewController:giftView animated:YES completion:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)handleWishGiftMessage:(AttachmentModel *)attachment {
|
||||||
|
if (attachment.second == Custom_Message_Sub_Wish_Gift_Open || attachment.second == Custom_Message_Sub_Wish_Gift_Update) {
|
||||||
|
NSArray * array = [WishGiftInfoModel modelsWithArray:attachment.data[@"gifts"]];
|
||||||
|
self.wishGiftView.giftList = array;
|
||||||
|
if (!self.wishGiftView.superview) {
|
||||||
|
[self addSubview:self.wishGiftView];
|
||||||
|
[self.wishGiftView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.top.mas_equalTo(self).offset(kNavigationHeight + 47);
|
||||||
|
make.right.mas_equalTo(self.mas_right).offset(0);
|
||||||
|
make.size.mas_equalTo(CGSizeMake(81, 30));
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
[self.wishGiftVC getWishGiftListSuccess:array];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Getters And Setters
|
#pragma mark - Getters And Setters
|
||||||
- (XPRoomRankEntranceView *)contributeEnterView {
|
- (XPRoomRankEntranceView *)contributeEnterView {
|
||||||
if (!_contributeEnterView) {
|
if (!_contributeEnterView) {
|
||||||
|
@@ -0,0 +1,35 @@
|
|||||||
|
//
|
||||||
|
// XPMessageInfoModel.h
|
||||||
|
// xplan-ios
|
||||||
|
//
|
||||||
|
// Created by 冯硕 on 2022/10/21.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface XPMessageInfoModel : NSObject
|
||||||
|
///显示文本
|
||||||
|
@property (nonatomic,strong) NSAttributedString *content;
|
||||||
|
///cell的高度
|
||||||
|
@property (nonatomic,assign) CGFloat rowHeight;
|
||||||
|
///文本内容的
|
||||||
|
@property (nonatomic,assign) CGFloat contentLeftMargin;
|
||||||
|
///文本右边的间隙
|
||||||
|
@property (nonatomic,assign) CGFloat contentRightMargin;
|
||||||
|
///文本上面的间隙
|
||||||
|
@property (nonatomic,assign) CGFloat contentTopMargin;
|
||||||
|
///文本底部的间隙
|
||||||
|
@property (nonatomic,assign) CGFloat contentBottomMargin;
|
||||||
|
///底部的间隙
|
||||||
|
@property (nonatomic,assign) CGFloat cellBottomMargin;
|
||||||
|
///是否要隐藏背景
|
||||||
|
@property (nonatomic,assign) BOOL isHiddenBubble;
|
||||||
|
///是否改变内容的区域
|
||||||
|
@property (nonatomic,assign) BOOL isUpdateContentFrame;
|
||||||
|
///气泡url
|
||||||
|
@property (nonatomic, copy) NSString *bubbleImageUrl;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,28 @@
|
|||||||
|
//
|
||||||
|
// XPMessageInfoModel.m
|
||||||
|
// xplan-ios
|
||||||
|
//
|
||||||
|
// Created by 冯硕 on 2022/10/21.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "XPMessageInfoModel.h"
|
||||||
|
#import "XPRoomMessageConstant.h"
|
||||||
|
#import <YYText/YYText.h>
|
||||||
|
|
||||||
|
|
||||||
|
@implementation XPMessageInfoModel
|
||||||
|
|
||||||
|
- (instancetype)init {
|
||||||
|
if ([super init]) {
|
||||||
|
self.contentLeftMargin = 12;
|
||||||
|
self.contentRightMargin = 0;
|
||||||
|
self.contentTopMargin = 10;
|
||||||
|
self.contentBottomMargin = 10;
|
||||||
|
self.cellBottomMargin = 6;
|
||||||
|
self.isUpdateContentFrame = NO;
|
||||||
|
self.isHiddenBubble = NO;
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@@ -9,11 +9,11 @@
|
|||||||
#import "RoomHostDelegate.h"
|
#import "RoomHostDelegate.h"
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@class NIMMessage;
|
@class NIMMessage, XPMessageInfoModel;
|
||||||
|
|
||||||
@interface XPRoomMessageParser : NSObject
|
@interface XPRoomMessageParser : NSObject
|
||||||
|
|
||||||
- (NSAttributedString*)parseMessageAttribute:(NIMMessage *)message;
|
- (XPMessageInfoModel*)parseMessageAttribute:(NIMMessage *)message;
|
||||||
- (NSString *)parseMessageBubble:(NIMMessage *)message;
|
- (NSString *)parseMessageBubble:(NIMMessage *)message;
|
||||||
|
|
||||||
///房间的代理
|
///房间的代理
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
#import "XPGiftStorage.h"
|
#import "XPGiftStorage.h"
|
||||||
#import "XPRoomFaceTool.h"
|
#import "XPRoomFaceTool.h"
|
||||||
#import "TTPopup.h"
|
#import "TTPopup.h"
|
||||||
|
#import "Api+WishGift.h"
|
||||||
///Model
|
///Model
|
||||||
#import "XPMessageRemoteExtModel.h"
|
#import "XPMessageRemoteExtModel.h"
|
||||||
#import "AttachmentModel.h"
|
#import "AttachmentModel.h"
|
||||||
@@ -37,6 +38,7 @@
|
|||||||
#import "XPGiftCompoundModel.h"
|
#import "XPGiftCompoundModel.h"
|
||||||
#import "RoomSailingPrizeModel.h"
|
#import "RoomSailingPrizeModel.h"
|
||||||
#import "XPOpenRedPacketModel.h"
|
#import "XPOpenRedPacketModel.h"
|
||||||
|
#import "XPMessageInfoModel.h"
|
||||||
|
|
||||||
#import "NetImageView.h"
|
#import "NetImageView.h"
|
||||||
|
|
||||||
@@ -47,20 +49,21 @@
|
|||||||
|
|
||||||
@implementation XPRoomMessageParser
|
@implementation XPRoomMessageParser
|
||||||
|
|
||||||
- (NSAttributedString*)parseMessageAttribute:(NIMMessage *)message {
|
- (XPMessageInfoModel*)parseMessageAttribute:(NIMMessage *)message {
|
||||||
NIMMessageType messageType = message.messageType;
|
NIMMessageType messageType = message.messageType;
|
||||||
|
XPMessageInfoModel * messageInfo = [[XPMessageInfoModel alloc] init];
|
||||||
switch (messageType) {
|
switch (messageType) {
|
||||||
case NIMMessageTypeText:
|
case NIMMessageTypeText:
|
||||||
return [self makeChatAttribute:message];
|
return [self makeChatAttribute:message messageInfo:messageInfo];
|
||||||
|
|
||||||
case NIMMessageTypeTip:
|
case NIMMessageTypeTip:
|
||||||
return [self makeTipsAttribute:message];
|
return [self makeTipsAttribute:message messageInfo:messageInfo];
|
||||||
|
|
||||||
case NIMMessageTypeNotification:
|
case NIMMessageTypeNotification:
|
||||||
return [self makeNotificationAttribute:message];
|
return [self makeNotificationAttribute:message messageInfo:messageInfo];
|
||||||
|
|
||||||
case NIMMessageTypeCustom:
|
case NIMMessageTypeCustom:
|
||||||
return [self makeCustomAttribute:message];
|
return [self makeCustomAttribute:message messageInfo:messageInfo];
|
||||||
default:
|
default:
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
@@ -72,60 +75,63 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// 用户公屏聊天
|
/// 用户公屏聊天
|
||||||
- (NSAttributedString *)makeCustomAttribute:(NIMMessage *)message {
|
- (XPMessageInfoModel *)makeCustomAttribute:(NIMMessage *)message messageInfo:(XPMessageInfoModel*)messageInfo{
|
||||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||||
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
||||||
XPMessageRemoteExtModel * model = [XPMessageRemoteExtModel modelWithJSON:message.remoteExt[message.from]];
|
XPMessageRemoteExtModel * model = [XPMessageRemoteExtModel modelWithJSON:message.remoteExt[message.from]];
|
||||||
|
messageInfo.bubbleImageUrl = [self parseMessageBubble:message];
|
||||||
int first = attachment.first;
|
int first = attachment.first;
|
||||||
if (first == CustomMessageType_Gift) {///单人送
|
if (first == CustomMessageType_Gift) {///单人送
|
||||||
return [self createSendGiftAttribute:attachment sendInfo:model];
|
return [self createSendGiftAttribute:attachment sendInfo:model messageInfo:messageInfo];
|
||||||
} else if(first == CustomMessageType_AllMicroSend) {///全麦送 多人送
|
} else if(first == CustomMessageType_AllMicroSend) {///全麦送 多人送
|
||||||
return [self createBatchMicroSendGiftAttribute:attachment sendInfo:model];
|
return [self createBatchMicroSendGiftAttribute:attachment sendInfo:model messageInfo:messageInfo];
|
||||||
} else if(first == CustomMessageType_Room_Tip) {///分享/收藏房间
|
} else if(first == CustomMessageType_Room_Tip) {///分享/收藏房间
|
||||||
return [self createShareOrAttentionRoomAttribute:attachment sendInfo:model uid:message.from];
|
return [self createShareOrAttentionRoomAttribute:attachment sendInfo:model uid:message.from messageInfo:messageInfo];
|
||||||
} else if(first == CustomMessageType_Kick_User || first == CustomMessageType_Queue) {
|
} else if(first == CustomMessageType_Kick_User || first == CustomMessageType_Queue) {
|
||||||
XPKickUserModel * kickModel = [XPKickUserModel modelWithJSON:attachment.data];
|
XPKickUserModel * kickModel = [XPKickUserModel modelWithJSON:attachment.data];
|
||||||
return [self createKickUserAttribute:attachment info:kickModel];
|
return [self createKickUserAttribute:attachment info:kickModel messageInfo:messageInfo];
|
||||||
} else if(first == CustomMessageType_Candy_Tree) {//糖果树
|
} else if(first == CustomMessageType_Candy_Tree) {//糖果树
|
||||||
return [self createCandyTreeHighLevelAttribute:attachment];
|
return [self createCandyTreeHighLevelAttribute:attachment messageInfo:messageInfo];
|
||||||
} else if(first == CustomMessageType_Arrange_Mic) {
|
} else if(first == CustomMessageType_Arrange_Mic) {
|
||||||
return [self createArrangeMicAttribute:attachment];
|
return [self createArrangeMicAttribute:attachment messageInfo:messageInfo];
|
||||||
}else if(first == CustomMessageType_Update_RoomInfo) {
|
}else if(first == CustomMessageType_Update_RoomInfo) {
|
||||||
return [self createRoomInfoUpdateAttribute:attachment];
|
return [self createRoomInfoUpdateAttribute:attachment messageInfo:messageInfo];
|
||||||
} else if(first == CustomMessageType_Collection_Room) {
|
} else if(first == CustomMessageType_Collection_Room) {
|
||||||
return [self createCollectRoomAttribute:attachment];
|
return [self createCollectRoomAttribute:attachment messageInfo:messageInfo];
|
||||||
} else if(first == CustomMessageType_RoomPlay_Dating) {
|
} else if(first == CustomMessageType_RoomPlay_Dating) {
|
||||||
return [self createRoomDatingAttribute:attachment];
|
return [self createRoomDatingAttribute:attachment messageInfo:messageInfo];
|
||||||
} else if (first == CustomMessageType_Noble_VIP) {//贵族
|
} else if (first == CustomMessageType_Noble_VIP) {//贵族
|
||||||
return [self createNobleLevelAttribute:attachment];
|
return [self createNobleLevelAttribute:attachment messageInfo:messageInfo];
|
||||||
} else if (first == CustomMessageType_Face) {//贵族
|
} else if (first == CustomMessageType_Face) {//贵族
|
||||||
return [self createRoomFaceAttribute:attachment];
|
return [self createRoomFaceAttribute:attachment messageInfo:messageInfo];
|
||||||
} else if (first == CustomMessageType_Tarot) {//塔罗
|
} else if (first == CustomMessageType_Tarot) {//塔罗
|
||||||
return [self createTarotAttribute:attachment];
|
return [self createTarotAttribute:attachment messageInfo:messageInfo];
|
||||||
} else if (first == CustomMessageType_Anchor_FansTeam) {//粉丝团
|
} else if (first == CustomMessageType_Anchor_FansTeam) {//粉丝团
|
||||||
return [self createAnchorFansTeamAttribute:attachment];
|
return [self createAnchorFansTeamAttribute:attachment messageInfo:messageInfo];
|
||||||
} else if(first == CustomMessageType_Hall_Super_Admin) {///超管踢人出房间
|
} else if(first == CustomMessageType_Hall_Super_Admin) {///超管踢人出房间
|
||||||
XPKickUserModel * kickModel = [XPKickUserModel modelWithJSON:attachment.data];
|
XPKickUserModel * kickModel = [XPKickUserModel modelWithJSON:attachment.data];
|
||||||
return [self createKickUserAttribute:attachment info:kickModel];
|
return [self createKickUserAttribute:attachment info:kickModel messageInfo:messageInfo];
|
||||||
} else if (first == CustomMessageType_Room_PK) {///房内PK
|
} else if (first == CustomMessageType_Room_PK) {///房内PK
|
||||||
return [self createRoomPKAttribute:attachment];
|
return [self createRoomPKAttribute:attachment messageInfo:messageInfo];
|
||||||
} else if (first == CustomMessageType_LuckyBag) {///幸运礼物
|
} else if (first == CustomMessageType_LuckyBag) {///幸运礼物
|
||||||
return [self createRoomLuckyBigPrizeAttribute:attachment];
|
return [self createRoomLuckyBigPrizeAttribute:attachment messageInfo:messageInfo];
|
||||||
} else if(first == CustomMessageType_Gift_Compound) {///礼物合成
|
} else if(first == CustomMessageType_Gift_Compound) {///礼物合成
|
||||||
return [self createRoomGiftCompoundAttribute:attachment];
|
return [self createRoomGiftCompoundAttribute:attachment messageInfo:messageInfo];
|
||||||
} else if(first == CustomMessageType_Room_Sailing) {///航海
|
} else if(first == CustomMessageType_Room_Sailing) {///航海
|
||||||
return [self createRoomSailingAttribute:attachment];
|
return [self createRoomSailingAttribute:attachment messageInfo:messageInfo];
|
||||||
} else if (first == CustomMessageType_RedPacket && attachment.second == Custom_Message_Sub_OpenRedPacketSuccess) {
|
} else if (first == CustomMessageType_RedPacket && attachment.second == Custom_Message_Sub_OpenRedPacketSuccess) {
|
||||||
return [self createRedPacketAttribute:attachment];
|
return [self createRedPacketAttribute:attachment messageInfo:messageInfo];
|
||||||
}
|
} else if (first == CustomMessageType_Wish_Gift) {
|
||||||
|
return [self createWishGiftAttribute:attachment messageInfo:messageInfo];
|
||||||
|
}
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param message 消息的实体
|
/// @param message 消息的实体
|
||||||
- (NSAttributedString*)makeChatAttribute:(NIMMessage *)message{
|
- (XPMessageInfoModel*)makeChatAttribute:(NIMMessage *)message messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||||
XPMessageRemoteExtModel * model = [XPMessageRemoteExtModel modelWithJSON:message.remoteExt[message.from]];
|
XPMessageRemoteExtModel * model = [XPMessageRemoteExtModel modelWithJSON:message.remoteExt[message.from]];
|
||||||
|
messageInfo.bubbleImageUrl = [self parseMessageBubble:message];
|
||||||
NSString * nick = [NSString stringWithFormat:@"%@:", ((NIMMessageChatroomExtension *)message.messageExt).roomNickname];
|
NSString * nick = [NSString stringWithFormat:@"%@:", ((NIMMessageChatroomExtension *)message.messageExt).roomNickname];
|
||||||
if ([message.from isEqualToString:uid]) {
|
if ([message.from isEqualToString:uid]) {
|
||||||
nick = @"我:";
|
nick = @"我:";
|
||||||
@@ -176,15 +182,17 @@
|
|||||||
[attribute appendAttributedString:msgStr];
|
[attribute appendAttributedString:msgStr];
|
||||||
}
|
}
|
||||||
[self attributeAddLongPressHihtLight:attribute uid:message.from nick:((NIMMessageChatroomExtension *)message.messageExt).roomNickname];
|
[self attributeAddLongPressHihtLight:attribute uid:message.from nick:((NIMMessageChatroomExtension *)message.messageExt).roomNickname];
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 房间tips消息
|
/// 房间tips消息
|
||||||
/// @param message 消息的实体
|
/// @param message 消息的实体
|
||||||
- (NSAttributedString*)makeTipsAttribute:(NIMMessage *)message {
|
- (XPMessageInfoModel*)makeTipsAttribute:(NIMMessage *)message messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
|
messageInfo.bubbleImageUrl = [self parseMessageBubble:message];
|
||||||
if ([message.localExt.allKeys containsObject:@"isRoomTopic"]) {
|
if ([message.localExt.allKeys containsObject:@"isRoomTopic"]) {
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
[attribute appendAttributedString: [self createTextAttribute:message.text color:[UIColor whiteColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString: [self createTextAttribute:message.text color:[UIColor whiteColor] font:kRoomMessageDefalutFont]];
|
||||||
if ([[message.localExt objectForKey:@"isRoomTopic"] boolValue] == YES) {
|
if ([[message.localExt objectForKey:@"isRoomTopic"] boolValue] == YES) {
|
||||||
[attribute yy_setTextHighlightRange:NSMakeRange(0, attribute.length) color:nil backgroundColor:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
|
[attribute yy_setTextHighlightRange:NSMakeRange(0, attribute.length) color:nil backgroundColor:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
|
||||||
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
|
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
|
||||||
@@ -196,15 +204,18 @@
|
|||||||
[TTPopup popupWithConfig:config];
|
[TTPopup popupWithConfig:config];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
} else {
|
} else {
|
||||||
return [self createTextAttribute:message.text color:UIColorFromRGB(0xFE5D7F) font:kRoomMessageDefalutFont];
|
NSAttributedString * attribute = [self createTextAttribute:message.text color:UIColorFromRGB(0xFE5D7F) font:kRoomMessageDefalutFont];
|
||||||
|
messageInfo.content = attribute;
|
||||||
}
|
}
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 房间通知类消息
|
/// 房间通知类消息
|
||||||
/// @param message 消息的实体
|
/// @param message 消息的实体
|
||||||
- (NSAttributedString*)makeNotificationAttribute:(NIMMessage *)message {
|
- (XPMessageInfoModel*)makeNotificationAttribute:(NIMMessage *)message messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
|
messageInfo.bubbleImageUrl = [self parseMessageBubble:message];
|
||||||
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
|
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
|
||||||
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
|
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
|
||||||
NIMChatroomNotificationMember *member = content.targets[0];
|
NIMChatroomNotificationMember *member = content.targets[0];
|
||||||
@@ -256,14 +267,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
[attribute appendAttributedString:[self createTextAttribute:@"进入了房间" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:@"进入了房间" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NIMChatroomEventTypeInfoUpdated:{
|
case NIMChatroomEventTypeInfoUpdated:{
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
if (self.hostDelegate.getRoomInfo.datingState == RoomDatingStateChangeType_Open) {
|
if (self.hostDelegate.getRoomInfo.datingState == RoomDatingStateChangeType_Open) {
|
||||||
[attribute appendAttributedString:[self createTextAttribute:@"相亲玩法已开启,请点击主持人麦位选择主持人" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:@"相亲玩法已开启,请点击主持人麦位选择主持人" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -273,8 +286,32 @@
|
|||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - 心愿礼物
|
||||||
|
- (XPMessageInfoModel *)createWishGiftAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
|
UIImageView *imaveView = [[UIImageView alloc]init];
|
||||||
|
imaveView.image = [UIImage imageNamed:@"room_wish_gift_mesage_finish"];
|
||||||
|
imaveView.bounds = CGRectMake(0, 0, 170, 34);
|
||||||
|
NSMutableAttributedString * attrString = [NSMutableAttributedString yy_attachmentStringWithContent:imaveView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(imaveView.frame.size.width, imaveView.frame.size.height) alignToFont:[UIFont systemFontOfSize:15.0] alignment:YYTextVerticalAlignmentCenter];
|
||||||
|
@kWeakify(self);
|
||||||
|
[attrString yy_setTextHighlightRange:NSMakeRange(0, attrString.length) color:nil backgroundColor:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
|
||||||
|
@kStrongify(self);
|
||||||
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", [self.hostDelegate getRoomInfo].uid];
|
||||||
|
[Api wishGiftSendCelebrate:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||||
|
|
||||||
|
} roomUid:roomUid];
|
||||||
|
}];
|
||||||
|
messageInfo.contentLeftMargin = 0;
|
||||||
|
messageInfo.contentRightMargin = 0;
|
||||||
|
messageInfo.contentTopMargin = 0;
|
||||||
|
messageInfo.contentBottomMargin = 0;
|
||||||
|
messageInfo.isUpdateContentFrame = YES;
|
||||||
|
messageInfo.isHiddenBubble = YES;
|
||||||
|
messageInfo.content = attrString;
|
||||||
|
return messageInfo;
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - 红包
|
#pragma mark - 红包
|
||||||
- (NSAttributedString *)createRedPacketAttribute:(AttachmentModel *)attachment {
|
- (XPMessageInfoModel *)createRedPacketAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
XPOpenRedPacketModel *info = [XPOpenRedPacketModel modelWithDictionary:attachment.data];
|
XPOpenRedPacketModel *info = [XPOpenRedPacketModel modelWithDictionary:attachment.data];
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
[attribute appendAttributedString:[self createNickAtrribute:info.openRedEnvelopeUserNick uid:info.openRedEnvelopeId.integerValue]];
|
[attribute appendAttributedString:[self createNickAtrribute:info.openRedEnvelopeUserNick uid:info.openRedEnvelopeId.integerValue]];
|
||||||
@@ -284,11 +321,12 @@
|
|||||||
if (info.amount.floatValue>0) {
|
if (info.amount.floatValue>0) {
|
||||||
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"%@钻石", info.amount] color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"%@钻石", info.amount] color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
|
||||||
}
|
}
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 航海
|
#pragma mark - 航海
|
||||||
- (NSAttributedString *)createRoomSailingAttribute:(AttachmentModel *)attachment {
|
- (XPMessageInfoModel *)createRoomSailingAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
RoomSailingPrizeModel *info = [RoomSailingPrizeModel modelWithDictionary:attachment.data];
|
RoomSailingPrizeModel *info = [RoomSailingPrizeModel modelWithDictionary:attachment.data];
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
[attribute appendAttributedString:[self createTextAttribute:@"厉害了! " color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:@"厉害了! " color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
@@ -299,11 +337,12 @@
|
|||||||
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"x%d", info.prizeNum] color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"x%d", info.prizeNum] color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
}
|
}
|
||||||
[self attributeAddHihtLight:attribute uid:info.uid.integerValue];
|
[self attributeAddHihtLight:attribute uid:info.uid.integerValue];
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 礼物合成
|
#pragma mark - 礼物合成
|
||||||
- (NSAttributedString *)createRoomGiftCompoundAttribute:(AttachmentModel *)attachment {
|
- (XPMessageInfoModel *)createRoomGiftCompoundAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
XPGiftCompoundModel *info = [XPGiftCompoundModel modelWithDictionary:attachment.data];
|
XPGiftCompoundModel *info = [XPGiftCompoundModel modelWithDictionary:attachment.data];
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
[attribute appendAttributedString:[self createTextAttribute:@"恭喜" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:@"恭喜" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
@@ -311,11 +350,12 @@
|
|||||||
[attribute appendAttributedString:[self createTextAttribute:info.msg color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:info.msg color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
[attribute appendAttributedString:[self createTextAttribute:info.giftName color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:info.giftName color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
|
||||||
[self attributeAddHihtLight:attribute uid:info.uid.integerValue];
|
[self attributeAddHihtLight:attribute uid:info.uid.integerValue];
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 房间内幸运礼物 大价值
|
#pragma mark - 房间内幸运礼物 大价值
|
||||||
- (NSAttributedString *)createRoomLuckyBigPrizeAttribute:(AttachmentModel *)attachment {
|
- (XPMessageInfoModel *)createRoomLuckyBigPrizeAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
XPGiftBigPrizeModel * info= [XPGiftBigPrizeModel modelWithDictionary:attachment.data];
|
XPGiftBigPrizeModel * info= [XPGiftBigPrizeModel modelWithDictionary:attachment.data];
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
[attribute appendAttributedString:[self createTextAttribute:@"恭喜" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:@"恭喜" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
@@ -324,11 +364,12 @@
|
|||||||
[attribute appendAttributedString:[self createTextAttribute:info.roomTitle color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:info.roomTitle color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"通过%@", info.luckyBagName] color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"通过%@", info.luckyBagName] color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@",开出%@", info.giftName] color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@",开出%@", info.giftName] color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 房间内PK
|
#pragma mark - 房间内PK
|
||||||
- (NSAttributedString *)createRoomPKAttribute:(AttachmentModel *)attachment {
|
- (XPMessageInfoModel *)createRoomPKAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
if (attachment.second == Custom_Message_Sub_Room_PK_Manager_Up_Mic) {
|
if (attachment.second == Custom_Message_Sub_Room_PK_Manager_Up_Mic) {
|
||||||
[attribute appendAttributedString:[self createTextAttribute:@"房主/管理员邀请" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:@"房主/管理员邀请" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
@@ -453,7 +494,8 @@
|
|||||||
[attribute appendAttributedString:[self createTextAttribute:title color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:title color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showRoomPKResult:(NSDictionary *)dic {
|
- (void)showRoomPKResult:(NSDictionary *)dic {
|
||||||
@@ -466,7 +508,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 表情显示
|
#pragma mark - 表情显示
|
||||||
- (NSAttributedString*)createRoomFaceAttribute:(AttachmentModel *)attachment {
|
- (XPMessageInfoModel*)createRoomFaceAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
if ([attachment.data[@"data"] isKindOfClass:[NSArray class]]) {
|
if ([attachment.data[@"data"] isKindOfClass:[NSArray class]]) {
|
||||||
NSArray * array = [RoomFaceSendInfoModel modelsWithArray:attachment.data[@"data"]];
|
NSArray * array = [RoomFaceSendInfoModel modelsWithArray:attachment.data[@"data"]];
|
||||||
@@ -490,11 +532,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 收藏房间
|
#pragma mark - 收藏房间
|
||||||
- (NSAttributedString*)createCollectRoomAttribute:(AttachmentModel *)attachment {
|
- (XPMessageInfoModel*)createCollectRoomAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
NSDictionary *data = attachment.data[@"data"];
|
NSDictionary *data = attachment.data[@"data"];
|
||||||
NSString *nick = [NSString stringWithFormat:@"%@",data[@"nick"]];
|
NSString *nick = [NSString stringWithFormat:@"%@",data[@"nick"]];
|
||||||
@@ -504,11 +547,12 @@
|
|||||||
tipString = @"收藏了房间";
|
tipString = @"收藏了房间";
|
||||||
}
|
}
|
||||||
[attribute appendAttributedString:[self createTextAttribute:tipString color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:tipString color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 房间信息更新
|
#pragma mark - 房间信息更新
|
||||||
- (NSAttributedString*)createRoomInfoUpdateAttribute:(AttachmentModel *)attachment {
|
- (XPMessageInfoModel*)createRoomInfoUpdateAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
if (attachment.second == Custom_Message_Sub_Update_RoomInfo_MessageState) {
|
if (attachment.second == Custom_Message_Sub_Update_RoomInfo_MessageState) {
|
||||||
NSDictionary * dic= attachment.data[@"roomInfo"];
|
NSDictionary * dic= attachment.data[@"roomInfo"];
|
||||||
if (dic.allKeys.count <=0) {
|
if (dic.allKeys.count <=0) {
|
||||||
@@ -522,7 +566,7 @@
|
|||||||
} else {
|
} else {
|
||||||
[attribute appendAttributedString:[self createTextAttribute:@"管理员已开启聊天公屏" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:@"管理员已开启聊天公屏" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||||
}
|
}
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
} else if(attachment.second == Custom_Message_Sub_Update_RoomInfo_AnimateEffect) {
|
} else if(attachment.second == Custom_Message_Sub_Update_RoomInfo_AnimateEffect) {
|
||||||
NSDictionary * dic = attachment.data[@"roomInfo"];
|
NSDictionary * dic = attachment.data[@"roomInfo"];
|
||||||
if (dic.allKeys.count <=0) {
|
if (dic.allKeys.count <=0) {
|
||||||
@@ -538,7 +582,7 @@
|
|||||||
[attribute appendAttributedString:[self createImageAttribute:[UIImage imageNamed:@"room_menu_more"]]];
|
[attribute appendAttributedString:[self createImageAttribute:[UIImage imageNamed:@"room_menu_more"]]];
|
||||||
[attribute appendAttributedString:[self createTextAttribute:@"图标即可开启" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:@"图标即可开启" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||||
}
|
}
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
} else if (attachment.second == Custom_Message_Sub_Update_RoomInfo_CleanScreen) {
|
} else if (attachment.second == Custom_Message_Sub_Update_RoomInfo_CleanScreen) {
|
||||||
NSNumber *roleType = attachment.data[@"roleType"];
|
NSNumber *roleType = attachment.data[@"roleType"];
|
||||||
NSString *nick = attachment.data[@"nick"];
|
NSString *nick = attachment.data[@"nick"];
|
||||||
@@ -559,13 +603,13 @@
|
|||||||
}
|
}
|
||||||
[attribute appendAttributedString:[self createTextAttribute:@"已清空房间公屏消息" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:@"已清空房间公屏消息" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||||
[self attributeAddHihtLight:attribute uid:uid];
|
[self attributeAddHihtLight:attribute uid:uid];
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
}
|
}
|
||||||
return nil;
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 相亲
|
#pragma mark - 相亲
|
||||||
- (NSAttributedString *)createRoomDatingAttribute:(AttachmentModel *)attachment {
|
- (XPMessageInfoModel *)createRoomDatingAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
if(attachment.second == Custom_Message_Sub_Room_Play_Dating_Pick_Heart) {
|
if(attachment.second == Custom_Message_Sub_Room_Play_Dating_Pick_Heart) {
|
||||||
DatingInfoModel * datingModel = [DatingInfoModel modelWithDictionary:attachment.data];
|
DatingInfoModel * datingModel = [DatingInfoModel modelWithDictionary:attachment.data];
|
||||||
@@ -598,11 +642,12 @@
|
|||||||
[attribute appendAttributedString:[self createTextAttribute:@"未选择心动对象" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:@"未选择心动对象" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 排麦
|
#pragma mark - 排麦
|
||||||
- (NSAttributedString *)createArrangeMicAttribute:(AttachmentModel *)attachment {
|
- (XPMessageInfoModel *)createArrangeMicAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
[attribute appendAttributedString:[self createTextAttribute:@"管理员" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:@"管理员" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
if (attachment.second == Custom_Message_Sub_Arrange_Mic_Mode_Open) {
|
if (attachment.second == Custom_Message_Sub_Arrange_Mic_Mode_Open) {
|
||||||
@@ -622,11 +667,12 @@
|
|||||||
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"%d麦", ((NSNumber *)dic[@"micPos"]).intValue + 1 ] color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"%d麦", ((NSNumber *)dic[@"micPos"]).intValue + 1 ] color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||||
[attribute appendAttributedString:[self createTextAttribute:@"自由麦" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:@"自由麦" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
}
|
}
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 糖果树公屏消息
|
#pragma mark - 糖果树公屏消息
|
||||||
- (NSAttributedString *)createCandyTreeHighLevelAttribute:(AttachmentModel *)attachment {
|
- (XPMessageInfoModel *)createCandyTreeHighLevelAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
//action
|
//action
|
||||||
[attribute appendAttributedString:[self createTextAttribute:@"厉害了 " color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:@"厉害了 " color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||||
@@ -643,11 +689,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
[self attributeAddHihtLight:attribute uid:giftInfo.uid.integerValue];
|
[self attributeAddHihtLight:attribute uid:giftInfo.uid.integerValue];
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 贵族
|
#pragma mark - 贵族
|
||||||
- (NSAttributedString *)createNobleLevelAttribute:(AttachmentModel *)attachment {
|
- (XPMessageInfoModel *)createNobleLevelAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
NSInteger uid = 0;
|
NSInteger uid = 0;
|
||||||
if ([attachment.data[@"uid"] isKindOfClass:[NSNumber class]]) {
|
if ([attachment.data[@"uid"] isKindOfClass:[NSNumber class]]) {
|
||||||
@@ -669,11 +716,12 @@
|
|||||||
[attribute appendAttributedString:[self createTextAttribute:@"!" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:@"!" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||||
}
|
}
|
||||||
[self attributeAddHihtLight:attribute uid:uid];
|
[self attributeAddHihtLight:attribute uid:uid];
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 塔罗
|
#pragma mark - 塔罗
|
||||||
- (NSAttributedString *)createTarotAttribute:(AttachmentModel *)attachment {
|
- (XPMessageInfoModel *)createTarotAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
if (attachment.second == Custom_Message_Sub_Tarot) {
|
if (attachment.second == Custom_Message_Sub_Tarot) {
|
||||||
[attribute appendAttributedString:[self createTextAttribute:@"恭喜" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:@"恭喜" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||||
@@ -685,11 +733,12 @@
|
|||||||
}
|
}
|
||||||
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"%@ ", attachment.data[@"chargeProdName"]] color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"%@ ", attachment.data[@"chargeProdName"]] color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||||
}
|
}
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 个播粉丝团
|
#pragma mark - 个播粉丝团
|
||||||
- (NSAttributedString *)createAnchorFansTeamAttribute:(AttachmentModel *)attachment {
|
- (XPMessageInfoModel *)createAnchorFansTeamAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
NSInteger uid = 0;
|
NSInteger uid = 0;
|
||||||
if ([attachment.data[@"uid"] isKindOfClass:[NSNumber class]]) {
|
if ([attachment.data[@"uid"] isKindOfClass:[NSNumber class]]) {
|
||||||
@@ -715,11 +764,12 @@
|
|||||||
[attribute appendAttributedString:[self createTextAttribute:@"已退出粉丝团" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:@"已退出粉丝团" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||||
}
|
}
|
||||||
[self attributeAddHihtLight:attribute uid:uid];
|
[self attributeAddHihtLight:attribute uid:uid];
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 踢出房间/拉黑/下麦
|
#pragma mark - 踢出房间/拉黑/下麦
|
||||||
- (NSAttributedString *)createKickUserAttribute:(AttachmentModel *)attachment info:(XPKickUserModel *)info {
|
- (XPMessageInfoModel *)createKickUserAttribute:(AttachmentModel *)attachment info:(XPKickUserModel *)info messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
[attribute appendAttributedString:[self createNickAtrribute:info.targetNick uid:info.targetUid]];
|
[attribute appendAttributedString:[self createNickAtrribute:info.targetNick uid:info.targetUid]];
|
||||||
[attribute appendAttributedString:[self createTextAttribute:@"被" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:@"被" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||||
@@ -733,12 +783,13 @@
|
|||||||
content = @"请下麦";
|
content = @"请下麦";
|
||||||
}
|
}
|
||||||
[attribute appendAttributedString:[self createTextAttribute:content color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:content color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - 分享房间
|
#pragma mark - 分享房间
|
||||||
- (NSAttributedString *)createShareOrAttentionRoomAttribute:(AttachmentModel *)attachment sendInfo:(XPMessageRemoteExtModel *)sendInfo uid:(NSString *)uid {
|
- (XPMessageInfoModel *)createShareOrAttentionRoomAttribute:(AttachmentModel *)attachment sendInfo:(XPMessageRemoteExtModel *)sendInfo uid:(NSString *)uid messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
NSDictionary *data = attachment.data[@"data"];
|
NSDictionary *data = attachment.data[@"data"];
|
||||||
NSString *nick = [NSString stringWithFormat:@"%@",data[@"nick"]];
|
NSString *nick = [NSString stringWithFormat:@"%@",data[@"nick"]];
|
||||||
@@ -751,11 +802,12 @@
|
|||||||
}
|
}
|
||||||
[attribute appendAttributedString:[self createTextAttribute:tipString color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:tipString color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||||
[self attributeAddHihtLight:attribute uid:uid.integerValue];
|
[self attributeAddHihtLight:attribute uid:uid.integerValue];
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 送礼物的公屏
|
#pragma mark - 送礼物的公屏
|
||||||
- (NSAttributedString *)createBatchMicroSendGiftAttribute:(AttachmentModel *)attachment sendInfo:(XPMessageRemoteExtModel *)sendInfo {
|
- (XPMessageInfoModel *)createBatchMicroSendGiftAttribute:(AttachmentModel *)attachment sendInfo:(XPMessageRemoteExtModel *)sendInfo messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
GiftReceiveInfoModel *info = [GiftReceiveInfoModel modelWithJSON:attachment.data];
|
GiftReceiveInfoModel *info = [GiftReceiveInfoModel modelWithJSON:attachment.data];
|
||||||
GiftInfoModel *giftInfo = info.gift == nil ? info.giftInfo : info.gift;
|
GiftInfoModel *giftInfo = info.gift == nil ? info.giftInfo : info.gift;
|
||||||
@@ -845,10 +897,11 @@
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSAttributedString *)createSendGiftAttribute:(AttachmentModel *)attachment sendInfo:(XPMessageRemoteExtModel *)sendInfo {
|
- (XPMessageInfoModel *)createSendGiftAttribute:(AttachmentModel *)attachment sendInfo:(XPMessageRemoteExtModel *)sendInfo messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
GiftReceiveInfoModel *info = [GiftReceiveInfoModel modelWithJSON:attachment.data];
|
GiftReceiveInfoModel *info = [GiftReceiveInfoModel modelWithJSON:attachment.data];
|
||||||
GiftInfoModel *giftInfo = info.gift == nil ? info.giftInfo : info.gift;
|
GiftInfoModel *giftInfo = info.gift == nil ? info.giftInfo : info.gift;
|
||||||
@@ -904,7 +957,8 @@
|
|||||||
//x N
|
//x N
|
||||||
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@" X%ld",info.giftNum] color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@" X%ld",info.giftNum] color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
}
|
}
|
||||||
return attribute;
|
messageInfo.content = attribute;
|
||||||
|
return messageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Commond Mehotd
|
#pragma mark - Commond Mehotd
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#import "RoomInfoModel.h"
|
#import "RoomInfoModel.h"
|
||||||
@class XPNetImageYYLabel;
|
@class XPNetImageYYLabel, XPMessageInfoModel;
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@@ -22,9 +22,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
///当前房间的类型
|
///当前房间的类型
|
||||||
@property (nonatomic,assign) RoomType roomType;
|
@property (nonatomic,assign) RoomType roomType;
|
||||||
|
|
||||||
@property (nonatomic,strong) NSAttributedString *attributedString;
|
@property (nonatomic,strong) XPMessageInfoModel *messageInfo;
|
||||||
///气泡url
|
|
||||||
@property (nonatomic, copy) NSString *bubbleImageUrl;
|
|
||||||
///代理
|
///代理
|
||||||
@property (nonatomic,weak) id<XPRoomMessageTableViewCellDelegate> delegate;
|
@property (nonatomic,weak) id<XPRoomMessageTableViewCellDelegate> delegate;
|
||||||
|
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#import "XPMacro.h"
|
#import "XPMacro.h"
|
||||||
#import "ThemeColor+Room.h"
|
#import "ThemeColor+Room.h"
|
||||||
#import "UIImage+Utils.h"
|
#import "UIImage+Utils.h"
|
||||||
|
#import "XPMessageInfoModel.h"
|
||||||
|
|
||||||
#import "XPRoomMessageConstant.h"
|
#import "XPRoomMessageConstant.h"
|
||||||
|
|
||||||
@@ -57,8 +58,8 @@
|
|||||||
|
|
||||||
[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.left.mas_equalTo(self.bubbleImageView).offset(12);
|
make.left.mas_equalTo(self.bubbleImageView).offset(12);
|
||||||
make.centerY.mas_equalTo(self.bubbleImageView);
|
make.right.bottom.mas_equalTo(self.bubbleImageView).offset(-10);
|
||||||
make.top.mas_equalTo(self.bubbleImageView).mas_offset(5);
|
make.top.mas_equalTo(self.bubbleImageView).mas_offset(10);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,21 +90,29 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Getters And Setters
|
#pragma mark - Getters And Setters
|
||||||
- (void)setAttributedString:(NSAttributedString *)attribute {
|
- (void)setMessageInfo:(XPMessageInfoModel *)messageInfo {
|
||||||
_attributedString = attribute;
|
_messageInfo = messageInfo;
|
||||||
self.contentLabel.attributedText = attribute;
|
if (_messageInfo) {
|
||||||
}
|
self.contentLabel.attributedText = _messageInfo.content;
|
||||||
|
if (_messageInfo.bubbleImageUrl.length) {
|
||||||
|
[self.bubbleImageView loadImageWithUrl:_messageInfo.bubbleImageUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
|
||||||
|
UIImage *image1 = [UIImage imageWithCGImage:image.CGImage scale:2.0 orientation:UIImageOrientationUp];
|
||||||
|
self.bubbleImageView.image = [self resizableImage:image1];
|
||||||
|
}];
|
||||||
|
} else {
|
||||||
|
_bubbleImageView.image = [UIImage imageWithColor:[ThemeColor messageBubbleColor]];
|
||||||
|
}
|
||||||
|
if (_messageInfo.isUpdateContentFrame) {
|
||||||
|
[self.contentLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.left.mas_equalTo(self.bubbleImageView).offset(_messageInfo.contentLeftMargin);
|
||||||
|
make.right.mas_equalTo(self.bubbleImageView).offset(_messageInfo.contentRightMargin);
|
||||||
|
make.top.mas_equalTo(self.bubbleImageView).offset(_messageInfo.contentTopMargin);
|
||||||
|
make.bottom.mas_equalTo(self.bubbleImageView).offset(-_messageInfo.contentBottomMargin);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
self.bubbleImageView.hidden = _messageInfo.isHiddenBubble;
|
||||||
|
|
||||||
- (void)setBubbleImageUrl:(NSString *)bubbleImageUrl {
|
}
|
||||||
_bubbleImageUrl = bubbleImageUrl;
|
|
||||||
if (bubbleImageUrl.length) {
|
|
||||||
[self.bubbleImageView loadImageWithUrl:bubbleImageUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
|
|
||||||
UIImage *image1 = [UIImage imageWithCGImage:image.CGImage scale:2.0 orientation:UIImageOrientationUp];
|
|
||||||
self.bubbleImageView.image = [self resizableImage:image1];
|
|
||||||
}];
|
|
||||||
} else {
|
|
||||||
_bubbleImageView.image = [UIImage imageWithColor:[ThemeColor messageBubbleColor]];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIImage *)scaleToSize:(UIImage *)img {
|
- (UIImage *)scaleToSize:(UIImage *)img {
|
||||||
@@ -124,7 +133,7 @@
|
|||||||
|
|
||||||
- (void)setRoomType:(RoomType)roomType {
|
- (void)setRoomType:(RoomType)roomType {
|
||||||
_roomType = roomType;
|
_roomType = roomType;
|
||||||
if (self.bubbleImageUrl.length > 0) {
|
if (self.messageInfo.bubbleImageUrl.length > 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_roomType == RoomType_MiniGame) {
|
if (_roomType == RoomType_MiniGame) {
|
||||||
@@ -134,6 +143,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (NetImageView *)bubbleImageView {
|
- (NetImageView *)bubbleImageView {
|
||||||
if (!_bubbleImageView) {
|
if (!_bubbleImageView) {
|
||||||
_bubbleImageView = [[NetImageView alloc] init];
|
_bubbleImageView = [[NetImageView alloc] init];
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
#import "CandyTreeResultModel.h"
|
#import "CandyTreeResultModel.h"
|
||||||
#import "RoomSailingPrizeModel.h"
|
#import "RoomSailingPrizeModel.h"
|
||||||
#import "UserInfoModel.h"
|
#import "UserInfoModel.h"
|
||||||
|
#import "XPMessageInfoModel.h"
|
||||||
///View
|
///View
|
||||||
#import "XPRoomMessageTableViewCell.h"
|
#import "XPRoomMessageTableViewCell.h"
|
||||||
#import "XPRoomMessageHeaderView.h"
|
#import "XPRoomMessageHeaderView.h"
|
||||||
@@ -54,11 +55,9 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
|||||||
///是否是最小化进房的
|
///是否是最小化进房的
|
||||||
@property (nonatomic,assign) BOOL isMiniEnter;
|
@property (nonatomic,assign) BOOL isMiniEnter;
|
||||||
///数据源
|
///数据源
|
||||||
@property (nonatomic,strong) NSMutableArray<NSAttributedString *> *datasource;
|
@property (nonatomic,strong) NSMutableArray<XPMessageInfoModel *> *datasource;
|
||||||
///临时存放消息的数组
|
///临时存放消息的数组
|
||||||
@property (nonatomic,strong) NSMutableArray<NIMMessage *> *incomingMessages;
|
@property (nonatomic,strong) NSMutableArray<NIMMessage *> *incomingMessages;
|
||||||
///气泡数组
|
|
||||||
@property (nonatomic, strong) NSMutableArray *messageBubbles;
|
|
||||||
///有多少人at我
|
///有多少人at我
|
||||||
@property (nonatomic, assign) NSInteger atCount;
|
@property (nonatomic, assign) NSInteger atCount;
|
||||||
///@我的消息位置集合
|
///@我的消息位置集合
|
||||||
@@ -138,7 +137,6 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
|||||||
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
|
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
|
||||||
NSArray *needRemoveMsgArray = [self.datasource objectsAtIndexes:set];
|
NSArray *needRemoveMsgArray = [self.datasource objectsAtIndexes:set];
|
||||||
[self.datasource removeObjectsInArray:needRemoveMsgArray];
|
[self.datasource removeObjectsInArray:needRemoveMsgArray];
|
||||||
[self.messageBubbles removeObjectsAtIndexes:set];
|
|
||||||
NSMutableIndexSet *indexSet = [NSMutableIndexSet indexSet];
|
NSMutableIndexSet *indexSet = [NSMutableIndexSet indexSet];
|
||||||
for (int i = 0; i<self.locationArray.count; i++) {///移除掉前面消息的数据后,前面如果有at我的消息,也一并移除掉
|
for (int i = 0; i<self.locationArray.count; i++) {///移除掉前面消息的数据后,前面如果有at我的消息,也一并移除掉
|
||||||
NSNumber *number = self.locationArray[i];
|
NSNumber *number = self.locationArray[i];
|
||||||
@@ -159,7 +157,6 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
|||||||
NSMutableArray *indexPaths = [NSMutableArray array];
|
NSMutableArray *indexPaths = [NSMutableArray array];
|
||||||
for (NIMMessage *item in self.incomingMessages) {
|
for (NIMMessage *item in self.incomingMessages) {
|
||||||
[self.datasource addObject:[self.messageParser parseMessageAttribute:item]];
|
[self.datasource addObject:[self.messageParser parseMessageAttribute:item]];
|
||||||
[self.messageBubbles addObject:[self.messageParser parseMessageBubble:item]];
|
|
||||||
[indexPaths addObject:[NSIndexPath indexPathForRow:self.datasource.count - 1 inSection:0]];
|
[indexPaths addObject:[NSIndexPath indexPathForRow:self.datasource.count - 1 inSection:0]];
|
||||||
id nickNameNifo = item.remoteExt[@"atUids"];
|
id nickNameNifo = item.remoteExt[@"atUids"];
|
||||||
if ([nickNameNifo isKindOfClass:[NSArray class]]) {
|
if ([nickNameNifo isKindOfClass:[NSArray class]]) {
|
||||||
@@ -313,14 +310,12 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
|||||||
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
|
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
|
||||||
NSArray *needRemoveMsgArray = [self.datasource objectsAtIndexes:set];
|
NSArray *needRemoveMsgArray = [self.datasource objectsAtIndexes:set];
|
||||||
[self.datasource removeObjectsInArray:needRemoveMsgArray];
|
[self.datasource removeObjectsInArray:needRemoveMsgArray];
|
||||||
[self.messageBubbles removeObjectsAtIndexes:set];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 执行插入
|
// 执行插入
|
||||||
NSMutableArray *indexPaths = [NSMutableArray array];
|
NSMutableArray *indexPaths = [NSMutableArray array];
|
||||||
for (NIMMessage *item in self.incomingMessages) {
|
for (NIMMessage *item in self.incomingMessages) {
|
||||||
[self.datasource addObject:[self.messageParser parseMessageAttribute:item]];
|
[self.datasource addObject:[self.messageParser parseMessageAttribute:item]];
|
||||||
[self.messageBubbles addObject:[self.messageParser parseMessageBubble:item]];
|
|
||||||
[indexPaths addObject:[NSIndexPath indexPathForRow:self.datasource.count - 1 inSection:0]];
|
[indexPaths addObject:[NSIndexPath indexPathForRow:self.datasource.count - 1 inSection:0]];
|
||||||
}
|
}
|
||||||
[self.incomingMessages removeAllObjects];
|
[self.incomingMessages removeAllObjects];
|
||||||
@@ -485,7 +480,12 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
|||||||
@(CustomMessageType_RedPacket):
|
@(CustomMessageType_RedPacket):
|
||||||
[NSSet setWithObjects:
|
[NSSet setWithObjects:
|
||||||
@(Custom_Message_Sub_OpenRedPacketSuccess),
|
@(Custom_Message_Sub_OpenRedPacketSuccess),
|
||||||
nil]
|
nil],
|
||||||
|
@(CustomMessageType_Wish_Gift):
|
||||||
|
[NSSet setWithObjects:
|
||||||
|
@(Custom_Message_Sub_Wish_Gift_Finish),
|
||||||
|
nil]
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -549,11 +549,9 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
|||||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||||
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
|
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
|
||||||
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
||||||
NSLog(@"当前的second:%d", attachment.second);
|
|
||||||
if (attachment.first == CustomMessageType_Update_RoomInfo && attachment.second == Custom_Message_Sub_Update_RoomInfo_MessageState) {
|
if (attachment.first == CustomMessageType_Update_RoomInfo && attachment.second == Custom_Message_Sub_Update_RoomInfo_MessageState) {
|
||||||
[self.datasource removeAllObjects];
|
[self.datasource removeAllObjects];
|
||||||
[self.incomingMessages removeAllObjects];
|
[self.incomingMessages removeAllObjects];
|
||||||
[self.messageBubbles removeAllObjects];
|
|
||||||
[self.locationArray removeAllObjects];
|
[self.locationArray removeAllObjects];
|
||||||
self.atCount = 0;
|
self.atCount = 0;
|
||||||
self.atTipBtn.hidden = YES;
|
self.atTipBtn.hidden = YES;
|
||||||
@@ -565,7 +563,6 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
|||||||
} else if (attachment.first == CustomMessageType_Update_RoomInfo && attachment.second == Custom_Message_Sub_Update_RoomInfo_CleanScreen) {
|
} else if (attachment.first == CustomMessageType_Update_RoomInfo && attachment.second == Custom_Message_Sub_Update_RoomInfo_CleanScreen) {
|
||||||
[self.datasource removeAllObjects];
|
[self.datasource removeAllObjects];
|
||||||
[self.incomingMessages removeAllObjects];
|
[self.incomingMessages removeAllObjects];
|
||||||
[self.messageBubbles removeAllObjects];
|
|
||||||
[self.locationArray removeAllObjects];
|
[self.locationArray removeAllObjects];
|
||||||
self.atCount = 0;
|
self.atCount = 0;
|
||||||
self.atTipBtn.hidden = YES;
|
self.atTipBtn.hidden = YES;
|
||||||
@@ -679,12 +676,10 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
|||||||
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
|
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
|
||||||
NSArray *needRemoveMsgArray = [self.datasource objectsAtIndexes:set];
|
NSArray *needRemoveMsgArray = [self.datasource objectsAtIndexes:set];
|
||||||
[self.datasource removeObjectsInArray:needRemoveMsgArray];
|
[self.datasource removeObjectsInArray:needRemoveMsgArray];
|
||||||
[self.messageBubbles removeObjectsAtIndexes:set];
|
|
||||||
}
|
}
|
||||||
// 执行插入
|
// 执行插入
|
||||||
for (NIMMessage *item in messages.reverseObjectEnumerator) {
|
for (NIMMessage *item in messages.reverseObjectEnumerator) {
|
||||||
[self.datasource addObject:[self.messageParser parseMessageAttribute:item]];
|
[self.datasource addObject:[self.messageParser parseMessageAttribute:item]];
|
||||||
[self.messageBubbles addObject:[self.messageParser parseMessageBubble:item]];
|
|
||||||
if (!self.isMiniEnter) {/// 最小化进房的话 不需要重新保存
|
if (!self.isMiniEnter) {/// 最小化进房的话 不需要重新保存
|
||||||
if (self.hostDelegate.getRoomInfo.isCloseScreen) {
|
if (self.hostDelegate.getRoomInfo.isCloseScreen) {
|
||||||
NIMCustomObject *obj = (NIMCustomObject *)item.messageObject;
|
NIMCustomObject *obj = (NIMCustomObject *)item.messageObject;
|
||||||
@@ -718,12 +713,10 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
|||||||
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
|
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
|
||||||
NSArray *needRemoveMsgArray = [self.datasource objectsAtIndexes:set];
|
NSArray *needRemoveMsgArray = [self.datasource objectsAtIndexes:set];
|
||||||
[self.datasource removeObjectsInArray:needRemoveMsgArray];
|
[self.datasource removeObjectsInArray:needRemoveMsgArray];
|
||||||
[self.messageBubbles removeObjectsAtIndexes:set];
|
|
||||||
}
|
}
|
||||||
// 执行插入
|
// 执行插入
|
||||||
for (NIMMessage *item in messages) {
|
for (NIMMessage *item in messages) {
|
||||||
[self.datasource addObject:[self.messageParser parseMessageAttribute:item]];
|
[self.datasource addObject:[self.messageParser parseMessageAttribute:item]];
|
||||||
[self.messageBubbles addObject:[self.messageParser parseMessageBubble:item]];
|
|
||||||
if (!self.isMiniEnter) {/// 最小化进房的话 不需要重新保存
|
if (!self.isMiniEnter) {/// 最小化进房的话 不需要重新保存
|
||||||
if (self.hostDelegate.getRoomInfo.isCloseScreen) {
|
if (self.hostDelegate.getRoomInfo.isCloseScreen) {
|
||||||
NIMCustomObject *obj = (NIMCustomObject *)item.messageObject;
|
NIMCustomObject *obj = (NIMCustomObject *)item.messageObject;
|
||||||
@@ -780,7 +773,6 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
|||||||
// 执行插入
|
// 执行插入
|
||||||
for (NIMMessage *item in temArray) {
|
for (NIMMessage *item in temArray) {
|
||||||
[self.datasource addObject:[self.messageParser parseMessageAttribute:item]];
|
[self.datasource addObject:[self.messageParser parseMessageAttribute:item]];
|
||||||
[self.messageBubbles addObject:[self.messageParser parseMessageBubble:item]];
|
|
||||||
}
|
}
|
||||||
[self.messageTableView reloadData];
|
[self.messageTableView reloadData];
|
||||||
//执行插入动画并滚动
|
//执行插入动画并滚动
|
||||||
@@ -849,22 +841,21 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
NSAttributedString* attr = [self.datasource objectAtIndex:indexPath.row];
|
XPMessageInfoModel* mesageInfo = [self.datasource objectAtIndex:indexPath.row];
|
||||||
CGSize maxSize = CGSizeMake(kRoomMessageMaxWidth - 24, MAXFLOAT);
|
CGSize maxSize = CGSizeMake(kRoomMessageMaxWidth - mesageInfo.contentLeftMargin - mesageInfo.contentRightMargin - 12, MAXFLOAT);
|
||||||
YYTextContainer *container = [YYTextContainer containerWithSize:maxSize];
|
YYTextContainer *container = [YYTextContainer containerWithSize:maxSize];
|
||||||
container.maximumNumberOfRows = 0;
|
container.maximumNumberOfRows = 0;
|
||||||
YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:attr];
|
YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:mesageInfo.content];
|
||||||
return layout.textBoundingSize.height + kRoomMessageTextSpaceHeight * 2 + 10;
|
CGFloat rowHeight = layout.textBoundingSize.height + mesageInfo.contentTopMargin + mesageInfo.contentBottomMargin + mesageInfo.cellBottomMargin;
|
||||||
|
return rowHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
XPRoomMessageTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPRoomMessageTableViewCell class])];
|
XPRoomMessageTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPRoomMessageTableViewCell class])];
|
||||||
cell.delegate = self;
|
cell.delegate = self;
|
||||||
NSAttributedString* attr = [self.datasource objectAtIndex:indexPath.row];
|
XPMessageInfoModel* attr = [self.datasource objectAtIndex:indexPath.row];
|
||||||
NSString *bubbleStr = [self.messageBubbles objectAtIndex:indexPath.row];
|
cell.messageInfo = attr;
|
||||||
cell.bubbleImageUrl = bubbleStr;
|
|
||||||
cell.roomType = self.hostDelegate.getRoomInfo.type;
|
cell.roomType = self.hostDelegate.getRoomInfo.type;
|
||||||
cell.attributedString = attr;
|
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -936,7 +927,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
|||||||
return _atTipBtn;
|
return _atTipBtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSMutableArray<NSAttributedString *> *)datasource {
|
- (NSMutableArray<XPMessageInfoModel *> *)datasource {
|
||||||
if (!_datasource) {
|
if (!_datasource) {
|
||||||
_datasource = [NSMutableArray array];
|
_datasource = [NSMutableArray array];
|
||||||
}
|
}
|
||||||
@@ -950,13 +941,6 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
|||||||
return _incomingMessages;
|
return _incomingMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSMutableArray *)messageBubbles {
|
|
||||||
if (!_messageBubbles) {
|
|
||||||
_messageBubbles = [NSMutableArray array];
|
|
||||||
}
|
|
||||||
return _messageBubbles;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSMutableArray *)locationArray {
|
- (NSMutableArray *)locationArray {
|
||||||
if (!_locationArray) {
|
if (!_locationArray) {
|
||||||
_locationArray = [NSMutableArray array];
|
_locationArray = [NSMutableArray array];
|
||||||
|
@@ -466,7 +466,7 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
|
|||||||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"redPacket"}];
|
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"redPacket"}];
|
||||||
[self dismissViewControllerAnimated:YES completion:nil];
|
[self dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
|
||||||
XPWishGiftCreateViewController *wishGiftVC = [[XPWishGiftCreateViewController alloc] initWithRoomUid:roomUid];
|
XPWishGiftCreateViewController *wishGiftVC = [[XPWishGiftCreateViewController alloc] initWithDelegate:self.hostDelegate];
|
||||||
[self.hostDelegate.getCurrentNav pushViewController:wishGiftVC animated:YES];
|
[self.hostDelegate.getCurrentNav pushViewController:wishGiftVC animated:YES];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@@ -40,6 +40,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/// @param roomUid 房主的uid
|
/// @param roomUid 房主的uid
|
||||||
+ (void)wishGiftHistoryList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid;
|
+ (void)wishGiftHistoryList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid;
|
||||||
|
|
||||||
|
/// 发送心愿完成庆祝特效
|
||||||
|
/// @param roomUid 房主的uid
|
||||||
|
+ (void)wishGiftSendCelebrate:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -67,4 +67,10 @@
|
|||||||
[self makeRequest:@"wishGift/listWishGiftHistory" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, roomUid, nil];
|
[self makeRequest:@"wishGift/listWishGiftHistory" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, roomUid, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 发送心愿完成庆祝特效
|
||||||
|
/// @param roomUid 房主的uid
|
||||||
|
+ (void)wishGiftSendCelebrate:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid {
|
||||||
|
[self makeRequest:@"wishGift/sendCelebrate" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, roomUid, nil];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
18
xplan-ios/Main/Room/View/WishGift/View/View/XPSlider.h
Normal file
18
xplan-ios/Main/Room/View/WishGift/View/View/XPSlider.h
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
//
|
||||||
|
// XPSlider.h
|
||||||
|
// xplan-ios
|
||||||
|
//
|
||||||
|
// Created by 冯硕 on 2022/10/21.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface XPSlider : UISlider
|
||||||
|
///
|
||||||
|
@property (nonatomic,assign) CGFloat height;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
16
xplan-ios/Main/Room/View/WishGift/View/View/XPSlider.m
Normal file
16
xplan-ios/Main/Room/View/WishGift/View/View/XPSlider.m
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
//
|
||||||
|
// XPSlider.m
|
||||||
|
// xplan-ios
|
||||||
|
//
|
||||||
|
// Created by 冯硕 on 2022/10/21.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "XPSlider.h"
|
||||||
|
|
||||||
|
@implementation XPSlider
|
||||||
|
|
||||||
|
- (CGRect)trackRectForBounds:(CGRect)bounds {
|
||||||
|
return CGRectMake(bounds.origin.x, bounds.origin.y, bounds.size.width, self.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@@ -15,6 +15,7 @@
|
|||||||
#import "NetImageView.h"
|
#import "NetImageView.h"
|
||||||
#import "UIImage+Utils.h"
|
#import "UIImage+Utils.h"
|
||||||
#import "UIView+Corner.h"
|
#import "UIView+Corner.h"
|
||||||
|
#import "XPSlider.h"
|
||||||
///Model
|
///Model
|
||||||
#import "WishGiftInfoModel.h"
|
#import "WishGiftInfoModel.h"
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@
|
|||||||
///进度
|
///进度
|
||||||
@property (nonatomic,strong) UILabel *progressLabel;
|
@property (nonatomic,strong) UILabel *progressLabel;
|
||||||
///进度
|
///进度
|
||||||
@property (nonatomic,strong) UISlider *progressView;
|
@property (nonatomic,strong) XPSlider *progressView;
|
||||||
@property (nonatomic,strong) WishGiftInfoModel *giftInfo;
|
@property (nonatomic,strong) WishGiftInfoModel *giftInfo;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -71,7 +72,7 @@
|
|||||||
}];
|
}];
|
||||||
|
|
||||||
[self.progressView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.progressView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.height.mas_equalTo(2);
|
make.height.mas_equalTo(5);
|
||||||
make.bottom.mas_equalTo(self.contentView.mas_bottom).offset(-2);
|
make.bottom.mas_equalTo(self.contentView.mas_bottom).offset(-2);
|
||||||
make.left.mas_equalTo(self.giftImageView.mas_right).offset(2);
|
make.left.mas_equalTo(self.giftImageView.mas_right).offset(2);
|
||||||
make.right.mas_equalTo(self.contentView).offset(-5);
|
make.right.mas_equalTo(self.contentView).offset(-5);
|
||||||
@@ -83,7 +84,7 @@
|
|||||||
NSString * actualNum = (self.giftInfo.actualNum > self.giftInfo.targetNum) ? [NSString stringWithFormat:@"%ld+", self.giftInfo.targetNum] : [NSString stringWithFormat:@"%ld", self.giftInfo.actualNum];
|
NSString * actualNum = (self.giftInfo.actualNum > self.giftInfo.targetNum) ? [NSString stringWithFormat:@"%ld+", self.giftInfo.targetNum] : [NSString stringWithFormat:@"%ld", self.giftInfo.actualNum];
|
||||||
NSString * title = [NSString stringWithFormat:@"%@%@", actualNum, targetNum];
|
NSString * title = [NSString stringWithFormat:@"%@%@", actualNum, targetNum];
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:10], NSForegroundColorAttributeName:[ThemeColor colorWithHexString:@"#FFC300"]}];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:10], NSForegroundColorAttributeName:[ThemeColor colorWithHexString:@"#FFC300"]}];
|
||||||
if (self.giftInfo.targetNum == self.giftInfo.actualNum) {
|
if (self.giftInfo.targetNum <= self.giftInfo.actualNum) {
|
||||||
[attribute addAttribute:NSForegroundColorAttributeName value:[ThemeColor colorWithHexString:@"#FFC300"] range:[title rangeOfString:targetNum]];
|
[attribute addAttribute:NSForegroundColorAttributeName value:[ThemeColor colorWithHexString:@"#FFC300"] range:[title rangeOfString:targetNum]];
|
||||||
} else {
|
} else {
|
||||||
[attribute addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithWhite:1 alpha:1] range:[title rangeOfString:targetNum]];
|
[attribute addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithWhite:1 alpha:1] range:[title rangeOfString:targetNum]];
|
||||||
@@ -97,19 +98,28 @@
|
|||||||
if (_giftInfo) {
|
if (_giftInfo) {
|
||||||
self.giftImageView.imageUrl = _giftInfo.giftUrl;
|
self.giftImageView.imageUrl = _giftInfo.giftUrl;
|
||||||
self.giftLabel.text = _giftInfo.giftName;
|
self.giftLabel.text = _giftInfo.giftName;
|
||||||
self.progressView.value = (CGFloat)giftInfo.actualNum / (CGFloat)_giftInfo.targetNum;
|
CGFloat value = (CGFloat)giftInfo.actualNum / (CGFloat)giftInfo.targetNum;
|
||||||
|
if (value > 1){
|
||||||
|
value = 1;
|
||||||
|
}
|
||||||
|
self.progressView.value = value;
|
||||||
self.progressLabel.attributedText = [self createProgressAttribute];
|
self.progressLabel.attributedText = [self createProgressAttribute];
|
||||||
self.progressLabel.textAlignment = NSTextAlignmentCenter;
|
self.progressLabel.textAlignment = NSTextAlignmentCenter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UISlider *)progressView {
|
- (XPSlider *)progressView {
|
||||||
if(!_progressView) {
|
if(!_progressView) {
|
||||||
_progressView = [[UISlider alloc] init];
|
_progressView = [[XPSlider alloc] init];
|
||||||
_progressView.enabled = NO;
|
_progressView.enabled = NO;
|
||||||
[_progressView setMinimumTrackImage:[UIImage gradientColorImageFromColors:@[[ThemeColor colorWithHexString:@"#FFA0C3"], [ThemeColor colorWithHexString:@"#C176FF"]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(1, 1)] forState:UIControlStateNormal];
|
[_progressView setMinimumTrackImage:[UIImage gradientColorImageFromColors:@[[ThemeColor colorWithHexString:@"#FFA0C3"], [ThemeColor colorWithHexString:@"#C176FF"]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(1, 1)] forState:UIControlStateNormal];
|
||||||
_progressView.thumbTintColor = [UIColor clearColor];
|
_progressView.thumbTintColor = [UIColor clearColor];
|
||||||
_progressView.value = 0.4l;
|
_progressView.minimumValue = 0;
|
||||||
|
_progressView.maximumValue = 1;
|
||||||
|
_progressView.value = 0.01;
|
||||||
|
_progressView.height = 5;
|
||||||
|
_progressView.layer.masksToBounds = YES;
|
||||||
|
_progressView.layer.cornerRadius = 2.5;
|
||||||
[_progressView setMaximumTrackImage:[UIImage imageWithColor:[ThemeColor colorWithHexString:@"#17093E"]] forState:UIControlStateNormal];
|
[_progressView setMaximumTrackImage:[UIImage imageWithColor:[ThemeColor colorWithHexString:@"#17093E"]] forState:UIControlStateNormal];
|
||||||
}
|
}
|
||||||
return _progressView;
|
return _progressView;
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
#import "NetImageView.h"
|
#import "NetImageView.h"
|
||||||
#import "ThemeColor.h"
|
#import "ThemeColor.h"
|
||||||
#import "UIImage+Utils.h"
|
#import "UIImage+Utils.h"
|
||||||
|
#import "XPSlider.h"
|
||||||
///Model
|
///Model
|
||||||
#import "WishGiftInfoModel.h"
|
#import "WishGiftInfoModel.h"
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@
|
|||||||
///进度
|
///进度
|
||||||
@property (nonatomic,strong) UILabel *progressLabel;
|
@property (nonatomic,strong) UILabel *progressLabel;
|
||||||
///进度条
|
///进度条
|
||||||
@property (nonatomic,strong) UISlider *progressView;
|
@property (nonatomic,strong) XPSlider *progressView;
|
||||||
///赠送按钮
|
///赠送按钮
|
||||||
@property (nonatomic,strong) UIButton *senderButton;
|
@property (nonatomic,strong) UIButton *senderButton;
|
||||||
///完成按钮
|
///完成按钮
|
||||||
@@ -101,7 +102,7 @@
|
|||||||
NSString * actualNum = (self.giftInfo.actualNum > self.giftInfo.targetNum) ? [NSString stringWithFormat:@"%ld+", self.giftInfo.targetNum] : [NSString stringWithFormat:@"%ld", self.giftInfo.actualNum];
|
NSString * actualNum = (self.giftInfo.actualNum > self.giftInfo.targetNum) ? [NSString stringWithFormat:@"%ld+", self.giftInfo.targetNum] : [NSString stringWithFormat:@"%ld", self.giftInfo.actualNum];
|
||||||
NSString * title = [NSString stringWithFormat:@"%@%@", actualNum, targetNum];
|
NSString * title = [NSString stringWithFormat:@"%@%@", actualNum, targetNum];
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:10], NSForegroundColorAttributeName:[ThemeColor colorWithHexString:@"#FFA0C3"]}];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:10], NSForegroundColorAttributeName:[ThemeColor colorWithHexString:@"#FFA0C3"]}];
|
||||||
if (self.giftInfo.targetNum == self.giftInfo.actualNum) {
|
if (self.giftInfo.targetNum <= self.giftInfo.actualNum) {
|
||||||
[attribute addAttribute:NSForegroundColorAttributeName value:[ThemeColor colorWithHexString:@"#FFA0C3"] range:[title rangeOfString:targetNum]];
|
[attribute addAttribute:NSForegroundColorAttributeName value:[ThemeColor colorWithHexString:@"#FFA0C3"] range:[title rangeOfString:targetNum]];
|
||||||
} else {
|
} else {
|
||||||
[attribute addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithWhite:1 alpha:0.5] range:[title rangeOfString:targetNum]];
|
[attribute addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithWhite:1 alpha:0.5] range:[title rangeOfString:targetNum]];
|
||||||
@@ -123,7 +124,11 @@
|
|||||||
self.giftImageView.imageUrl = giftInfo.giftUrl;
|
self.giftImageView.imageUrl = giftInfo.giftUrl;
|
||||||
self.giftLabel.text = _giftInfo.giftName;
|
self.giftLabel.text = _giftInfo.giftName;
|
||||||
self.priceLabel.text = [NSString stringWithFormat:@"%ld钻石", _giftInfo.goldPrice];
|
self.priceLabel.text = [NSString stringWithFormat:@"%ld钻石", _giftInfo.goldPrice];
|
||||||
self.progressView.value = (CGFloat)giftInfo.actualNum / (CGFloat)_giftInfo.targetNum;
|
CGFloat value = (CGFloat)giftInfo.actualNum / (CGFloat)giftInfo.targetNum;
|
||||||
|
if (value > 1) {
|
||||||
|
value = 1;
|
||||||
|
}
|
||||||
|
self.progressView.value = value;
|
||||||
self.progressLabel.attributedText = [self createProgressAttribute];
|
self.progressLabel.attributedText = [self createProgressAttribute];
|
||||||
self.progressLabel.textAlignment = NSTextAlignmentCenter;
|
self.progressLabel.textAlignment = NSTextAlignmentCenter;
|
||||||
self.completionImageView.hidden = _giftInfo.targetNum != _giftInfo.actualNum;
|
self.completionImageView.hidden = _giftInfo.targetNum != _giftInfo.actualNum;
|
||||||
@@ -182,13 +187,18 @@
|
|||||||
return _priceLabel;
|
return _priceLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UISlider *)progressView {
|
- (XPSlider *)progressView {
|
||||||
if(!_progressView) {
|
if(!_progressView) {
|
||||||
_progressView = [[UISlider alloc] init];
|
_progressView = [[XPSlider alloc] init];
|
||||||
_progressView.enabled = NO;
|
_progressView.enabled = NO;
|
||||||
[_progressView setMinimumTrackImage:[UIImage gradientColorImageFromColors:@[[ThemeColor colorWithHexString:@"#FFA0C3"], [ThemeColor colorWithHexString:@"#C176FF"]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(1, 1)] forState:UIControlStateNormal];
|
[_progressView setMinimumTrackImage:[[UIImage gradientColorImageFromColors:@[[ThemeColor colorWithHexString:@"#FFA0C3"], [ThemeColor colorWithHexString:@"#C176FF"]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(1, 1)] resizableImageWithCapInsets:UIEdgeInsetsMake(0.1, 0.0, 0.1, 0.1) resizingMode:UIImageResizingModeStretch] forState:UIControlStateNormal];
|
||||||
_progressView.thumbTintColor = [UIColor clearColor];
|
_progressView.thumbTintColor = [UIColor clearColor];
|
||||||
_progressView.value = 0.4l;
|
_progressView.minimumValue = 0;
|
||||||
|
_progressView.maximumValue = 1;
|
||||||
|
_progressView.height = 5;
|
||||||
|
_progressView.layer.masksToBounds = YES;
|
||||||
|
_progressView.layer.cornerRadius = 2.5;
|
||||||
|
_progressView.continuous = NO;
|
||||||
[_progressView setMaximumTrackImage:[UIImage imageWithColor:[ThemeColor colorWithHexString:@"#17093E"]] forState:UIControlStateNormal];
|
[_progressView setMaximumTrackImage:[UIImage imageWithColor:[ThemeColor colorWithHexString:@"#17093E"]] forState:UIControlStateNormal];
|
||||||
}
|
}
|
||||||
return _progressView;
|
return _progressView;
|
||||||
|
@@ -6,11 +6,11 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "MvpViewController.h"
|
#import "MvpViewController.h"
|
||||||
|
#import "RoomHostDelegate.h"
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@interface XPWishGiftCreateViewController : MvpViewController
|
@interface XPWishGiftCreateViewController : MvpViewController
|
||||||
- (instancetype)initWithRoomUid:(NSString *)roomUid;
|
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
#import "XPMacro.h"
|
#import "XPMacro.h"
|
||||||
///Model
|
///Model
|
||||||
#import "WishGiftInfoModel.h"
|
#import "WishGiftInfoModel.h"
|
||||||
|
#import "RoomInfoModel.h"
|
||||||
///View
|
///View
|
||||||
#import "XPWishGiftTableViewCell.h"
|
#import "XPWishGiftTableViewCell.h"
|
||||||
#import "XPWishGiftHistoryViewController.h"
|
#import "XPWishGiftHistoryViewController.h"
|
||||||
@@ -37,6 +38,8 @@
|
|||||||
@property (nonatomic,strong) NSArray *datasource;
|
@property (nonatomic,strong) NSArray *datasource;
|
||||||
///房主的uid
|
///房主的uid
|
||||||
@property (nonatomic,strong) NSString *roomUid;
|
@property (nonatomic,strong) NSString *roomUid;
|
||||||
|
///代理
|
||||||
|
@property (nonatomic,weak) id<RoomHostDelegate> delegate;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation XPWishGiftCreateViewController
|
@implementation XPWishGiftCreateViewController
|
||||||
@@ -44,10 +47,10 @@
|
|||||||
- (__kindof id)createPresenter {
|
- (__kindof id)createPresenter {
|
||||||
return [[XPWishGiftPresenter alloc] init];
|
return [[XPWishGiftPresenter alloc] init];
|
||||||
}
|
}
|
||||||
|
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate{
|
||||||
- (instancetype)initWithRoomUid:(NSString *)roomUid {
|
|
||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
self.roomUid = roomUid;
|
self.delegate = delegate;
|
||||||
|
self.roomUid = [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].uid];
|
||||||
[self initWishGiftList];
|
[self initWishGiftList];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@@ -125,6 +128,10 @@
|
|||||||
#pragma mark - XPWishGiftTableViewCellDelegate
|
#pragma mark - XPWishGiftTableViewCellDelegate
|
||||||
- (void)xPWishGiftTableViewCell:(XPWishGiftTableViewCell *)view didClearWishGift:(WishGiftInfoModel *)info {
|
- (void)xPWishGiftTableViewCell:(XPWishGiftTableViewCell *)view didClearWishGift:(WishGiftInfoModel *)info {
|
||||||
if (info) {
|
if (info) {
|
||||||
|
if (self.delegate.getRoomInfo.hasOpenWishGift) {
|
||||||
|
[self showErrorToast:@"心愿单一旦设置确认创建后,当日内不可再修改"];
|
||||||
|
return;
|
||||||
|
}
|
||||||
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
||||||
config.title = @"";
|
config.title = @"";
|
||||||
config.message = @"确认删除该条数据?";
|
config.message = @"确认删除该条数据?";
|
||||||
@@ -137,6 +144,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)xPWishGiftTableViewCell:(XPWishGiftTableViewCell *)view didUpdateWishGift:(WishGiftInfoModel *)info {
|
- (void)xPWishGiftTableViewCell:(XPWishGiftTableViewCell *)view didUpdateWishGift:(WishGiftInfoModel *)info {
|
||||||
|
if (self.delegate.getRoomInfo.hasOpenWishGift) {
|
||||||
|
[self showErrorToast:@"心愿单一旦设置确认创建后,当日内不可再修改"];
|
||||||
|
return;
|
||||||
|
}
|
||||||
XPWishGiftCreateItemViewController * createItemVC = [[XPWishGiftCreateItemViewController alloc] init];
|
XPWishGiftCreateItemViewController * createItemVC = [[XPWishGiftCreateItemViewController alloc] init];
|
||||||
createItemVC.roomUid = self.roomUid;
|
createItemVC.roomUid = self.roomUid;
|
||||||
createItemVC.modifiGiftInfo = info;
|
createItemVC.modifiGiftInfo = info;
|
||||||
@@ -150,6 +161,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - XPWishGiftProtocol
|
#pragma mark - XPWishGiftProtocol
|
||||||
|
- (void)addWishGiftSuccess {
|
||||||
|
[self.navigationController popViewControllerAnimated:YES];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)getWishGiftListSuccess:(NSArray *)list {
|
- (void)getWishGiftListSuccess:(NSArray *)list {
|
||||||
self.datasource = list;
|
self.datasource = list;
|
||||||
[self.tableView reloadData];
|
[self.tableView reloadData];
|
||||||
@@ -167,6 +182,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)clearButtonAction:(UIButton *)sender {
|
- (void)clearButtonAction:(UIButton *)sender {
|
||||||
|
if (self.delegate.getRoomInfo.hasOpenWishGift) {
|
||||||
|
[self showErrorToast:@"心愿单一旦设置确认创建后,当日内不可再修改"];
|
||||||
|
return;
|
||||||
|
}
|
||||||
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
||||||
config.title = @"";
|
config.title = @"";
|
||||||
config.message = @"确认清空当前数据?";
|
config.message = @"确认清空当前数据?";
|
||||||
@@ -190,6 +209,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)createButtonAction:(UIButton *)sender {
|
- (void)createButtonAction:(UIButton *)sender {
|
||||||
|
if (self.delegate.getRoomInfo.hasOpenWishGift) {
|
||||||
|
[self showErrorToast:@"心愿单一旦设置确认创建后,当日内不可再修改"];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
||||||
config.title = @"";
|
config.title = @"";
|
||||||
config.message = @"确认创建当前心愿? \n创建后当日不可在编辑或删除";
|
config.message = @"确认创建当前心愿? \n创建后当日不可在编辑或删除";
|
||||||
|
@@ -22,6 +22,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
///代理
|
///代理
|
||||||
@property (nonatomic,weak) id<XPWishGiftViewControllerDelegate> delegate;
|
@property (nonatomic,weak) id<XPWishGiftViewControllerDelegate> delegate;
|
||||||
|
|
||||||
|
- (void)getWishGiftListSuccess:(NSArray *)list;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -39,6 +39,7 @@
|
|||||||
@property (nonatomic,strong) NetImageView *secondAvatarImageView;
|
@property (nonatomic,strong) NetImageView *secondAvatarImageView;
|
||||||
///第三个头像
|
///第三个头像
|
||||||
@property (nonatomic,strong) NetImageView *thirdAvatarImageView;
|
@property (nonatomic,strong) NetImageView *thirdAvatarImageView;
|
||||||
|
@property (nonatomic,strong) NSArray<NetImageView *> * avatarViews;
|
||||||
///贡献的人数
|
///贡献的人数
|
||||||
@property (nonatomic,strong) UILabel *assistNumLabel;
|
@property (nonatomic,strong) UILabel *assistNumLabel;
|
||||||
///礼物
|
///礼物
|
||||||
@@ -91,9 +92,9 @@
|
|||||||
[self.backImageView addSubview:self.assistNumLabel];
|
[self.backImageView addSubview:self.assistNumLabel];
|
||||||
[self.backImageView addSubview:self.giftStackView];
|
[self.backImageView addSubview:self.giftStackView];
|
||||||
|
|
||||||
[self.userStackView addArrangedSubview:self.firstView];
|
[self.userStackView addArrangedSubview:self.firstAvatarImageView];
|
||||||
[self.userStackView addArrangedSubview:self.secondView];
|
[self.userStackView addArrangedSubview:self.secondAvatarImageView];
|
||||||
[self.userStackView addArrangedSubview:self.thirdView];
|
[self.userStackView addArrangedSubview:self.thirdAvatarImageView];
|
||||||
|
|
||||||
[self.giftStackView addArrangedSubview:self.firstView];
|
[self.giftStackView addArrangedSubview:self.firstView];
|
||||||
[self.giftStackView addArrangedSubview:self.secondView];
|
[self.giftStackView addArrangedSubview:self.secondView];
|
||||||
@@ -134,6 +135,18 @@
|
|||||||
make.top.mas_equalTo(self.lineView.mas_bottom).offset(10);
|
make.top.mas_equalTo(self.lineView.mas_bottom).offset(10);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
[self.firstAvatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.width.mas_equalTo(28);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.secondAvatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.width.mas_equalTo(28);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.thirdAvatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.width.mas_equalTo(28);
|
||||||
|
}];
|
||||||
|
|
||||||
[self.assistNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.assistNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.right.mas_equalTo(self.backImageView).offset(-15);
|
make.right.mas_equalTo(self.backImageView).offset(-15);
|
||||||
make.centerY.mas_equalTo(self.userStackView);
|
make.centerY.mas_equalTo(self.userStackView);
|
||||||
@@ -169,7 +182,7 @@
|
|||||||
|
|
||||||
#pragma mark - XPWishGiftProtocol
|
#pragma mark - XPWishGiftProtocol
|
||||||
- (void)getWishGiftAssistUserListSuccess:(NSArray *)list {
|
- (void)getWishGiftAssistUserListSuccess:(NSArray *)list {
|
||||||
for (int i = 0; i < self.userStackView.subviews.count; i++) {
|
for (int i = 0; i < self.userStackView.arrangedSubviews.count; i++) {
|
||||||
NetImageView * imageView = [self.userStackView.subviews objectAtIndex:i];
|
NetImageView * imageView = [self.userStackView.subviews objectAtIndex:i];
|
||||||
if (i < list.count) {
|
if (i < list.count) {
|
||||||
WishGiftUserModel * userInfo = [list objectAtIndex:i];
|
WishGiftUserModel * userInfo = [list objectAtIndex:i];
|
||||||
@@ -265,7 +278,7 @@
|
|||||||
_userStackView = [[UIStackView alloc] init];
|
_userStackView = [[UIStackView alloc] init];
|
||||||
_userStackView.axis = UILayoutConstraintAxisHorizontal;
|
_userStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||||
_userStackView.distribution = UIStackViewDistributionFill;
|
_userStackView.distribution = UIStackViewDistributionFill;
|
||||||
_userStackView.alignment = UIStackViewAlignmentFill;
|
_userStackView.alignment = UIStackViewAlignmentCenter;
|
||||||
_userStackView.spacing = 4;
|
_userStackView.spacing = 4;
|
||||||
}
|
}
|
||||||
return _userStackView;
|
return _userStackView;
|
||||||
|
BIN
xplan-ios/Sources/room_wish_gift_sendCelebrate.svga
Normal file
BIN
xplan-ios/Sources/room_wish_gift_sendCelebrate.svga
Normal file
Binary file not shown.
Reference in New Issue
Block a user