feat: 修正初步 debug 问题

This commit is contained in:
eggmanQQQ
2024-10-12 19:30:41 +08:00
parent 80549b57aa
commit 3f6fae9c07
44 changed files with 890 additions and 167 deletions

View File

@@ -9,7 +9,7 @@
"scale" : "2x" "scale" : "2x"
}, },
{ {
"filename" : "麦克风@3x(1).png", "filename" : "麦克风@3x-2.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "3x" "scale" : "3x"
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "麦克风@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@@ -67,6 +67,10 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic,copy) NSString *introduction; @property(nonatomic,copy) NSString *introduction;
@property(nonatomic,strong) UserLevelVo *userLevelVo; @property(nonatomic,strong) UserLevelVo *userLevelVo;
@property (nonatomic, copy) NSString *roomDesc; @property (nonatomic, copy) NSString *roomDesc;
@property (nonatomic, assign) BOOL roomBoom;
@property (nonatomic, copy) NSString *roomBoomPic;
@property (nonatomic, copy) NSString *roomBoomVapUrl;
@end @end
@interface HomePlayMicUserModel : PIBaseModel @interface HomePlayMicUserModel : PIBaseModel
@@ -79,6 +83,9 @@ NS_ASSUME_NONNULL_BEGIN
///用户的uid ///用户的uid
@property (nonatomic,copy) NSString *uid; @property (nonatomic,copy) NSString *uid;
@property(nonatomic,copy) NSString *erbanNo; @property(nonatomic,copy) NSString *erbanNo;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -30,6 +30,8 @@
@property (nonatomic, assign) NSInteger membersCount; @property (nonatomic, assign) NSInteger membersCount;
@property (nonatomic,strong) NetImageView *boomImageView;
@end @end
@implementation XPNewHomePartyCollectionViewCell @implementation XPNewHomePartyCollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame{ -(instancetype)initWithFrame:(CGRect)frame{
@@ -74,7 +76,9 @@
[self.contentView addSubview:self.subView]; [self.contentView addSubview:self.subView];
[self.contentView addSubview:self.heatGifView]; [self.contentView addSubview:self.heatGifView];
[self.contentView addSubview:self.heatView]; [self.contentView addSubview:self.heatView];
[self.contentView addSubview:self.boomImageView];
@kWeakify(self); @kWeakify(self);
[self.parser parseWithNamed:@"pi_home_new_pk" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { [self.parser parseWithNamed:@"pi_home_new_pk" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@kStrongify(self); @kStrongify(self);
@@ -131,6 +135,12 @@
make.trailing.mas_equalTo(-kGetScaleWidth(6)); make.trailing.mas_equalTo(-kGetScaleWidth(6));
make.bottom.equalTo(self.avatarView.mas_bottom).mas_offset(-kGetScaleWidth(6)); make.bottom.equalTo(self.avatarView.mas_bottom).mas_offset(-kGetScaleWidth(6));
}]; }];
[self.boomImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.contentView).offset(11);
make.trailing.mas_equalTo(self.contentView).offset(-8);
make.size.mas_equalTo(CGSizeMake(40, 40));
}];
} }
- (void)setRoomInfo:(HomePlayRoomModel *)roomInfo{ - (void)setRoomInfo:(HomePlayRoomModel *)roomInfo{
_roomInfo = roomInfo; _roomInfo = roomInfo;
@@ -174,6 +184,13 @@
[self.heatView mas_updateConstraints:^(MASConstraintMaker *make) { [self.heatView mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(self.roomInfo.width); make.width.mas_equalTo(self.roomInfo.width);
}]; }];
if (roomInfo.roomBoom) {
self.boomImageView.hidden = NO;
self.boomImageView.imageUrl = [roomInfo roomBoomPic];
} else {
self.boomImageView.hidden = YES;
}
} }
#pragma mark - #pragma mark -
- (NetImageView *)avatarView{ - (NetImageView *)avatarView{
@@ -198,6 +215,13 @@
} }
return _tagavatarView; return _tagavatarView;
} }
- (NetImageView *)boomImageView{
if(!_boomImageView){
_boomImageView = [NetImageView new];
_boomImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _boomImageView;
}
- (UILabel *)nameView{ - (UILabel *)nameView{
if(!_nameView){ if(!_nameView){
_nameView = [UILabel labelInitWithText:@"" font:kFontMedium(15) textColor:UIColorFromRGB(0x1E1E1F)]; _nameView = [UILabel labelInitWithText:@"" font:kFontMedium(15) textColor:UIColorFromRGB(0x1E1E1F)];

View File

@@ -150,6 +150,10 @@
[self.engine adjustRecordingSignalVolume:soundVol]; [self.engine adjustRecordingSignalVolume:soundVol];
} }
- (NSInteger)loadUserSound {
return -1;
}
- (void)updateMusicSound:(int)soundVol { - (void)updateMusicSound:(int)soundVol {
[self.engine adjustAudioMixingVolume:soundVol]; [self.engine adjustAudioMixingVolume:soundVol];
} }

View File

@@ -68,6 +68,9 @@ NS_ASSUME_NONNULL_BEGIN
///背景人声的音量大小 ///背景人声的音量大小
- (void)updateUserSound:(int)soundVol; - (void)updateUserSound:(int)soundVol;
///获取人声音量大小
- (NSInteger)loadUserSound;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -215,6 +215,10 @@
[self.engine setAudioCaptureVolume:soundVol]; [self.engine setAudioCaptureVolume:soundVol];
} }
- (NSInteger)loadUserSound {
return self.engine.getAudioCaptureVolume;
}
- (void)updateMusicSound:(int)soundVol { - (void)updateMusicSound:(int)soundVol {
[self.musicManager setMusicPublishVolume:self.musicId volume:soundVol * 1.5]; [self.musicManager setMusicPublishVolume:self.musicId volume:soundVol * 1.5];
[self.musicManager setMusicPlayoutVolume:self.musicId volume:soundVol * 1.5]; [self.musicManager setMusicPlayoutVolume:self.musicId volume:soundVol * 1.5];

View File

@@ -156,6 +156,10 @@
} }
} }
- (NSInteger)loadUserSound {
return self.engine.getCaptureSoundLevel;
}
- (void)updateMusicSound:(int)soundVol { - (void)updateMusicSound:(int)soundVol {
if (soundVol) { if (soundVol) {
[self.mediaPlayer setVolume:soundVol]; [self.mediaPlayer setVolume:soundVol];

View File

@@ -137,6 +137,8 @@ typedef NS_ENUM(NSInteger, BackMusicPlayState) {
///背景人声的音量大小 ///背景人声的音量大小
- (void)updateUserSound:(int)soundVol; - (void)updateUserSound:(int)soundVol;
- (NSInteger)loadUserSound;
@property (nonatomic,assign) BOOL broadcast; @property (nonatomic,assign) BOOL broadcast;
@end @end

View File

@@ -140,6 +140,10 @@
[self.engine updateUserSound:soundVol]; [self.engine updateUserSound:soundVol];
} }
- (NSInteger)loadUserSound {
return [self.engine loadUserSound];
}
- (void)usersSpeaking:(NSMutableArray *)uids { - (void)usersSpeaking:(NSMutableArray *)uids {
if (self.engineDelegate) { if (self.engineDelegate) {
[self.engineDelegate usersSpeaking:uids]; [self.engineDelegate usersSpeaking:uids];

View File

@@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface BoomInfoViewController : MvpViewController @interface BoomInfoViewController : MvpViewController
//+ (BoomInfoViewController *)vcFromBoomProgress:(NSArray <BoomDetailModel *>*)models; //+ (BoomInfoViewController *)vcFromBoomProgress:(NSArray <BoomDetailModel *>*)models;
@property (nonatomic, copy) void(^showGiftPanel)(void);
@end @end

View File

@@ -123,6 +123,9 @@
@property (nonatomic, strong) UIImageView *progressBar; @property (nonatomic, strong) UIImageView *progressBar;
@property (nonatomic, strong) UIView *rankingView; @property (nonatomic, strong) UIView *rankingView;
//@property (nonatomic, strong) UIImageView *wear_1;
//@property (nonatomic, strong) UIImageView *wear_2;
//@property (nonatomic, strong) UIImageView *wear_3;
@property (nonatomic, strong) NetImageView *rankAvatar_1; @property (nonatomic, strong) NetImageView *rankAvatar_1;
@property (nonatomic, strong) NetImageView *rankAvatar_2; @property (nonatomic, strong) NetImageView *rankAvatar_2;
@property (nonatomic, strong) NetImageView *rankAvatar_3; @property (nonatomic, strong) NetImageView *rankAvatar_3;
@@ -551,7 +554,13 @@
} }
- (void)handleTapBottomButton { - (void)handleTapBottomButton {
[self dismissViewControllerAnimated:YES completion:nil]; @kWeakify(self);
[self dismissViewControllerAnimated:YES completion:^{
@kStrongify(self);
if (self.showGiftPanel) {
self.showGiftPanel();
}
}];
} }
- (void)handleTapHelpButton { - (void)handleTapHelpButton {
@@ -618,6 +627,14 @@
if (boom.roomBoomRankVos.count > 0) { if (boom.roomBoomRankVos.count > 0) {
self.rankingView.hidden = NO; self.rankingView.hidden = NO;
self.giftsView.hidden = YES; self.giftsView.hidden = YES;
self.rankName_1.text = @"";
self.rankName_2.text = @"";
self.rankName_3.text = @"";
self.rankAvatar_1.image = nil;
self.rankAvatar_2.image = nil;
self.rankAvatar_3.image = nil;
for (roomBoomRankVo *rank in boom.roomBoomRankVos) { for (roomBoomRankVo *rank in boom.roomBoomRankVos) {
switch (rank.position) { switch (rank.position) {
case 1: case 1:
@@ -639,25 +656,33 @@
} else { } else {
self.rankingView.hidden = YES; self.rankingView.hidden = YES;
self.giftsView.hidden = NO; self.giftsView.hidden = NO;
self.giftBig.image = nil;
self.giftSmall_1.image = nil;
self.giftSmall_2.image = nil;
self.giftSmall_3.image = nil;
self.giftSmall_4.image = nil;
for (roomBoomLevelAwardVo *award in boom.roomBoomLevelAwardVos) { for (roomBoomLevelAwardVo *award in boom.roomBoomLevelAwardVos) {
if (award.isShow != 1) { if (award.isShow != 1) {
continue; continue;
} }
NSString *pic = [award.awardPic stringByRemovingPercentEncoding];
switch (award.seq) { switch (award.seq) {
case 1: case 1:
self.giftBig.imageUrl = award.awardPic; self.giftBig.imageUrl = pic;
break; break;
case 2: case 2:
self.giftSmall_1.imageUrl = award.awardPic; self.giftSmall_1.imageUrl = pic;
break; break;
case 3: case 3:
self.giftSmall_2.imageUrl = award.awardPic; self.giftSmall_2.imageUrl = pic;
break; break;
case 4: case 4:
self.giftSmall_3.imageUrl = award.awardPic; self.giftSmall_3.imageUrl = pic;
break; break;
case 5: case 5:
self.giftSmall_4.imageUrl = award.awardPic; self.giftSmall_4.imageUrl = pic;
break; break;
default: default:
break; break;

View File

@@ -94,12 +94,13 @@
return; return;
} }
__block NSString *targetRoomUid = @(self.model.roomUid).stringValue;
@kWeakify(self); @kWeakify(self);
[TTPopup alertWithMessage:YMLocalizedString(@"Combo_10") confirmHandler:^{ [TTPopup alertWithMessage:YMLocalizedString(@"Combo_10") confirmHandler:^{
@kStrongify(self); @kStrongify(self);
[roomVC exitRoom]; [roomVC exitRoom];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[XPRoomViewController openRoom:@(self.model.roomUid).stringValue [XPRoomViewController openRoom:targetRoomUid
viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
}); });
} cancelHandler:^{}]; } cancelHandler:^{}];
@@ -196,6 +197,7 @@
- (NetImageView *)rocket { - (NetImageView *)rocket {
if (!_rocket) { if (!_rocket) {
_rocket = [[NetImageView alloc] init]; _rocket = [[NetImageView alloc] init];
_rocket.contentMode = UIViewContentModeScaleAspectFit;
} }
return _rocket; return _rocket;
} }

View File

@@ -7,7 +7,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
@class AttachmentModel, BoomInfoModel, BoomDetailModel; @class AttachmentModel, BoomInfoModel, BoomDetailModel, UserInfoModel;
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@@ -19,6 +19,8 @@ typedef void(^BoomEventBlock)(id sth);
- (NSArray *)loadBoomDetails; - (NSArray *)loadBoomDetails;
- (void)saveUserInfo:(UserInfoModel *)userInfo;
- (void)leaveRoom; - (void)leaveRoom;
- (void)updateBoomDetailArray:(NSArray <BoomDetailModel *> *)array; - (void)updateBoomDetailArray:(NSArray <BoomDetailModel *> *)array;

View File

@@ -8,7 +8,9 @@
#import "RoomBoomManager.h" #import "RoomBoomManager.h"
#import "BoomInfoModel.h" #import "BoomInfoModel.h"
#import "UserInfoModel.h"
#import "AttachmentModel.h" #import "AttachmentModel.h"
#import "XPSkillCardPlayerManager.h"
@interface RoomBoomManager () <NIMChatManagerDelegate, NIMBroadcastManagerDelegate> @interface RoomBoomManager () <NIMChatManagerDelegate, NIMBroadcastManagerDelegate>
@@ -25,9 +27,11 @@
@property (nonatomic, strong) NSMutableArray *bannerEventsQueue; @property (nonatomic, strong) NSMutableArray *bannerEventsQueue;
@property (nonatomic, assign) BOOL isBooming; @property (nonatomic, assign) BOOL isBooming;
@property (nonatomic, assign) BOOL isGitfing; @property (nonatomic, assign) BOOL isGifting;
@property (nonatomic, assign) BOOL isBannering; @property (nonatomic, assign) BOOL isBannering;
@property (nonatomic,strong) UserInfoModel *userInfo;
@end @end
@implementation RoomBoomManager @implementation RoomBoomManager
@@ -55,6 +59,10 @@
return instance; return instance;
} }
- (void)saveUserInfo:(UserInfoModel *)userInfo {
_userInfo = userInfo;
}
- (void)test { - (void)test {
[self handleBannerUpdate:nil]; [self handleBannerUpdate:nil];
[self handleExplosionUpdate:nil]; [self handleExplosionUpdate:nil];
@@ -118,44 +126,58 @@
} }
- (void)checkAndStartBoomEvent { - (void)checkAndStartBoomEvent {
if (self.isBooming) { if (self.isBooming ||
self.isGifting ||
self.boomEventsQueue.count == 0) {
return; return;
} }
if (self.boomEventsQueue.count > 0) {
id obj = self.boomEventsQueue.firstObject;
NSString *url_1 = @""; self.isBooming = YES;
NSString *url_2 = @""; NSString *url_1 = @"";
NSString *url_2 = @"";
if ([obj isKindOfClass:[AttachmentModel class]]) { id obj = self.boomEventsQueue.firstObject;
Boom632Model *m = [Boom632Model modelWithJSON:[(AttachmentModel *)obj data]]; [self.boomEventsQueue removeObjectAtIndex:0];
url_1 = m.countDownVapUrl; if ([obj isKindOfClass:[AttachmentModel class]]) {
url_2 = m.endVapUrl; Boom632Model *m = [Boom632Model modelWithJSON:[(AttachmentModel *)obj data]];
} else if ([obj isKindOfClass:[RoomBoomSignVo class]]) { if ([XPSkillCardPlayerManager shareInstance].roomUid.integerValue != m.roomUid) {
url_1 = [(RoomBoomSignVo *)obj countDownVapUrl]; [self explosionEnd];
url_2 = [(RoomBoomSignVo *)obj endVapUrl]; return;
} }
if (url_1.length > 0 && url_2.length > 0) { url_1 = m.countDownVapUrl;
self.isBooming = YES; url_2 = m.endVapUrl;
[self handleExplosionUpdate:@[url_1, url_2]]; } else if ([obj isKindOfClass:[RoomBoomSignVo class]]) {
} url_1 = [(RoomBoomSignVo *)obj countDownVapUrl];
url_2 = [(RoomBoomSignVo *)obj endVapUrl];
[self.boomEventsQueue removeObjectAtIndex:0]; }
if (url_1.length > 0 && url_2.length > 0) {
[self handleExplosionUpdate:@[url_1, url_2]];
}else {
[self explosionEnd];
} }
} }
- (void)explosionEnd { - (void)explosionEnd {
self.isBooming = NO;
if (self.giftEventsQueue.count > 0) { if (self.giftEventsQueue.count > 0) {
if (self.isGifting) {
return;
}
self.isGifting = YES;
id obj = self.giftEventsQueue.firstObject; id obj = self.giftEventsQueue.firstObject;
[self handleBoomGiftUpdate:obj];
[self.giftEventsQueue removeObjectAtIndex:0]; [self.giftEventsQueue removeObjectAtIndex:0];
[self handleBoomGiftUpdate:obj];
} else { } else {
self.isBooming = NO;
[self checkAndStartBoomEvent]; [self checkAndStartBoomEvent];
} }
} }
- (void)giftDisplayEnd {
self.isBooming = NO;
self.isGifting = NO;
[self checkAndStartBoomEvent];
}
- (void)checkAndStartBannerEvent { - (void)checkAndStartBannerEvent {
if (self.isBannering) { if (self.isBannering) {
return; return;
@@ -163,15 +185,11 @@
if (self.bannerEventsQueue.count > 0) { if (self.bannerEventsQueue.count > 0) {
self.isBannering = YES; self.isBannering = YES;
id obj = self.bannerEventsQueue.firstObject; id obj = self.bannerEventsQueue.firstObject;
[self handleBannerUpdate:obj];
[self.bannerEventsQueue removeObjectAtIndex:0]; [self.bannerEventsQueue removeObjectAtIndex:0];
[self handleBannerUpdate:obj];
} }
} }
- (void)giftDisplayEnd {
[self checkAndStartBoomEvent];
}
- (void)bannerDisplayEnd { - (void)bannerDisplayEnd {
self.isBannering = NO; self.isBannering = NO;
[self checkAndStartBannerEvent]; [self checkAndStartBannerEvent];
@@ -326,9 +344,14 @@
if ([AccountInfoStorage instance].getUid.length == 0) { if ([AccountInfoStorage instance].getUid.length == 0) {
return; return;
} }
if (broadcastMessage.content) { if (broadcastMessage.content) {
NSDictionary *msgDictionary = [broadcastMessage.content toJSONObject]; NSDictionary *msgDictionary = [broadcastMessage.content toJSONObject];
AttachmentModel *attachment = [AttachmentModel modelWithJSON:msgDictionary[@"body"]]; AttachmentModel *attachment = [AttachmentModel modelWithJSON:msgDictionary[@"body"]];
NSString *partitionId = [NSString stringWithFormat:@"%@",attachment.data[@"partitionId"]];
if(![partitionId isEqualToString:self.userInfo.partitionId]){
return;
}
if (attachment.first == CustomMessageType_RoomBoom) { if (attachment.first == CustomMessageType_RoomBoom) {
[self receiveNIMResponse:attachment]; [self receiveNIMResponse:attachment];
} }

View File

@@ -41,7 +41,7 @@
- (void)setModel:(BoomGiftModel *)model { - (void)setModel:(BoomGiftModel *)model {
_model = model; _model = model;
self.giftPic.imageUrl = model.awardPic; self.giftPic.imageUrl = [model.awardPic stringByRemovingPercentEncoding];
} }
- (UIImageView *)bgView { - (UIImageView *)bgView {
@@ -111,6 +111,7 @@
if (!attachment || if (!attachment ||
![attachment.data isKindOfClass:[NSArray class]] || ![attachment.data isKindOfClass:[NSArray class]] ||
[attachment.data count] == 0) { [attachment.data count] == 0) {
[[RoomBoomManager sharedManager] giftDisplayEnd];
return; return;
} }
@@ -224,6 +225,7 @@
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
RoomBoomResultCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"GiftCell" forIndexPath:indexPath]; RoomBoomResultCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"GiftCell" forIndexPath:indexPath];
cell.model = [self.dataSource xpSafeObjectAtIndex:indexPath.row];
return cell; return cell;
} }

View File

@@ -21,6 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface XPRoomActivityContainerView : UIView<RoomGuestDelegate> @interface XPRoomActivityContainerView : UIView<RoomGuestDelegate>
@property(nonatomic,copy)OpenRedPacketHandle openRedPacketHandle; @property(nonatomic,copy)OpenRedPacketHandle openRedPacketHandle;
@property (nonatomic, copy) void(^showSendGiftView)(void);
@property(nonatomic,strong) NSMutableArray *redPacketList; @property(nonatomic,strong) NSMutableArray *redPacketList;
@property(nonatomic,strong) NSMutableArray<ActivityInfoModel *> *playList; @property(nonatomic,strong) NSMutableArray<ActivityInfoModel *> *playList;
@property(nonatomic,strong) NSMutableArray<LittleGameInfoModel *> *littleGameList; @property(nonatomic,strong) NSMutableArray<LittleGameInfoModel *> *littleGameList;

View File

@@ -643,6 +643,14 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
BoomInfoViewController *vc = [[BoomInfoViewController alloc] init]; BoomInfoViewController *vc = [[BoomInfoViewController alloc] init];
vc.modalPresentationStyle = UIModalPresentationOverFullScreen; vc.modalPresentationStyle = UIModalPresentationOverFullScreen;
[self.hostDelegate.getCurrentNav presentViewController:vc animated:YES completion:nil]; [self.hostDelegate.getCurrentNav presentViewController:vc animated:YES completion:nil];
@kWeakify(self);
[vc setShowGiftPanel:^{
@kStrongify(self);
if (self.showSendGiftView) {
self.showSendGiftView();
}
}];
} }
- (void)didTapConfigEntranceButton { - (void)didTapConfigEntranceButton {

View File

@@ -463,6 +463,7 @@ HWDMP4PlayDelegate>
} }
- (void)playLuckyWinningBanner:(AttachmentModel *)nextAttachment { - (void)playLuckyWinningBanner:(AttachmentModel *)nextAttachment {
// [self receiveRoomGeneralFloatingScreen]
RoomInfoModel *roomInfo = self.delegate.getRoomInfo; RoomInfoModel *roomInfo = self.delegate.getRoomInfo;
// display // display
@kWeakify(self); @kWeakify(self);

View File

@@ -51,6 +51,7 @@
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.playButton.mas_trailing).offset(5); make.leading.mas_equalTo(self.playButton.mas_trailing).offset(5);
make.trailing.mas_equalTo(self.settingButton.mas_leading).offset(-5);
make.centerY.mas_equalTo(self.playButton); make.centerY.mas_equalTo(self.playButton);
}]; }];

View File

@@ -70,11 +70,11 @@ UIKIT_EXTERN NSString * kRoomBackMusicCaptureVolumeKey;
self.playView.isPlaying = self.isPlaying; self.playView.isPlaying = self.isPlaying;
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults]; NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
NSInteger musicVolum = [defaults integerForKey:kRoomBackMusicAudioMixingVolumeKey]; NSInteger musicVolum = [defaults integerForKey:kRoomBackMusicAudioMixingVolumeKey];
musicVolum = musicVolum > 0 ? musicVolum : 50; musicVolum = musicVolum > 0 ? musicVolum : 50;
self.voiceSettingView.musicVolum = musicVolum; self.voiceSettingView.musicVolum = musicVolum;
NSInteger captureVolum = [defaults integerForKey:kRoomBackMusicCaptureVolumeKey]; NSInteger captureVolum = [[RtcManager instance] loadUserSound]; //[defaults integerForKey:kRoomBackMusicCaptureVolumeKey];
captureVolum = captureVolum > 0 ? captureVolum : 50; captureVolum = captureVolum > 0 ? captureVolum : 50;
self.voiceSettingView.captureVolum = captureVolum; self.voiceSettingView.captureVolum = captureVolum;
} }
@@ -87,15 +87,16 @@ UIKIT_EXTERN NSString * kRoomBackMusicCaptureVolumeKey;
} }
- (void)initSubViewConstraints { - (void)initSubViewConstraints {
[self.playView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(55);
make.bottom.mas_equalTo(self.view).offset(-kSafeAreaBottomHeight );
make.leading.trailing.mas_equalTo(self.view);
}];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.top.trailing.mas_equalTo(self.view); make.leading.top.trailing.mas_equalTo(self.view);
make.bottom.mas_equalTo(self.playView.mas_top); make.bottom.mas_equalTo(self.playView.mas_top);
}]; }];
[self.playView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(55);
make.bottom.leading.trailing.mas_equalTo(self.view);
}];
[self.voiceSettingView mas_makeConstraints:^(MASConstraintMaker *make) { [self.voiceSettingView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.playView.mas_top); make.bottom.mas_equalTo(self.playView.mas_top);

View File

@@ -13,7 +13,10 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface XPRoomMenuContainerView : UIView<RoomGuestDelegate> @interface XPRoomMenuContainerView : UIView<RoomGuestDelegate>
@property (nonatomic,strong) XPFreeGiftModel *freeModel; @property (nonatomic,strong) XPFreeGiftModel *freeModel;
@property (nonatomic, copy) void(^updateHeight)(CGFloat height);
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate; - (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
-(void)showInputView:(NSString *)text; -(void)showInputView:(NSString *)text;
- (void)menuResignFirstResponder; - (void)menuResignFirstResponder;

View File

@@ -36,12 +36,17 @@
#import "MSRoomMenuGameVC.h" #import "MSRoomMenuGameVC.h"
#import "SVGA.h" #import "SVGA.h"
UIKIT_EXTERN NSString * kRoomBackMusicCaptureVolumeKey;
@interface XPRoomMenuContainerView ()<XPRoomMessageBubbleViewDelegate> @interface XPRoomMenuContainerView ()<XPRoomMessageBubbleViewDelegate>
/// ///
@property (nonatomic,strong) UIButton *inputButton; @property (nonatomic,strong) UIButton *inputButton;
/// ///
@property (nonatomic,strong) UIButton *micButton; @property (nonatomic,strong) UIButton *micButton;
@property (nonatomic,strong) UIButton *micButton_open;
@property (nonatomic,strong) UIButton *micButton_close_all;
@property (nonatomic,strong) UIButton *micButton_close_butMusic;
/// ///
@property (nonatomic,strong) UIButton *voiceButton; @property (nonatomic,strong) UIButton *voiceButton;
/// ///
@@ -68,6 +73,10 @@
@property (nonatomic, strong) UIStackView *stackView; @property (nonatomic, strong) UIStackView *stackView;
@property (nonatomic, assign) NSInteger defaultVoiceVolume;
@property (nonatomic, assign) BOOL isDisplayMicStatusControl;
@end @end
@@ -76,6 +85,9 @@
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate { - (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
self = [super init]; self = [super init];
if (self) { if (self) {
self.clipsToBounds = NO;
self.defaultVoiceVolume = [[RtcManager instance] loadUserSound] > 0 ? [[RtcManager instance] loadUserSound] : 50;
self.delegate = delegate; self.delegate = delegate;
[self initSubViews]; [self initSubViews];
[self initSubViewConstraints]; [self initSubViewConstraints];
@@ -109,15 +121,7 @@
break; break;
case XPRoomMenuItemType_Mic: { case XPRoomMenuItemType_Mic: {
[RtcManager instance].localMuted = !self.micButton.isSelected; [self showMicControlMenu];
if([RtcManager instance].localMuted == NO){
for (MicroQueueModel *sequence in [self.delegate getMicroQueue].allValues) {
if ([AccountInfoStorage instance].getUid.integerValue == sequence.userInfo.uid) {
[[RtcManager instance] broadcast:YES];
}
}
}
self.micButton.selected = [RtcManager instance].isLocalMuted;
} }
break; break;
@@ -219,6 +223,111 @@
} }
} }
- (void)showMicControlMenu {
if (self.isDisplayMicStatusControl) {
[self hideMicControlMenu];
return;
} else {
self.isDisplayMicStatusControl = YES;
}
self.defaultVoiceVolume = [[RtcManager instance] loadUserSound] > 0 ? [[RtcManager instance] loadUserSound] : 50;
if (self.updateHeight) {
self.updateHeight(180);
}
@kWeakify(self);
[self _micControlButton:self.micButton_open isShow:YES complete:^{
@kStrongify(self);
@kWeakify(self);
[self _micControlButton:self.micButton_close_all isShow:YES complete:^{
@kStrongify(self);
[self _micControlButton:self.micButton_close_butMusic isShow:YES complete:nil];
}];
}];
}
- (void)hideMicControlMenu {
self.isDisplayMicStatusControl = NO;
if (self.updateHeight) {
self.updateHeight(52);
}
@kWeakify(self);
[self _micControlButton:self.micButton_close_butMusic isShow:NO complete:^{
@kStrongify(self);
@kWeakify(self);
[self _micControlButton:self.micButton_close_all isShow:NO complete:^{
@kStrongify(self);
[self _micControlButton:self.micButton_open isShow:NO complete:nil];
}];
}];
}
- (void)_micControlButton:(UIButton *)button
isShow:(BOOL)isShow
complete:(void(^)(void))complete {
[UIView animateWithDuration:0.1 animations:^{
button.alpha = isShow ? 1 : 0;
} completion:^(BOOL finished) {
if (complete) {
complete();
}
}];
}
- (void)handleMicControl:(UIButton *)sender {
switch (sender.tag) {
case 1: {
[RtcManager instance].localMuted = NO;
[[RtcManager instance] updateUserSound:(int)self.defaultVoiceVolume];
for (MicroQueueModel *sequence in [self.delegate getMicroQueue].allValues) {
if ([AccountInfoStorage instance].getUid.integerValue == sequence.userInfo.uid) {
[[RtcManager instance] broadcast:YES];
}
}
}
break;
case 2: {
[RtcManager instance].localMuted = YES;
}
break;
case 3: {
// self.defaultVoiceVolume = [[RtcManager instance] loadUserSound];
[RtcManager instance].localMuted = NO;
[[RtcManager instance] updateUserSound:0];
// [[NSUserDefaults standardUserDefaults] setInteger:0 forKey:kRoomBackMusicCaptureVolumeKey];
// [[NSUserDefaults standardUserDefaults] synchronize];
}
break;
default:
break;
}
[self micButtonUpdate:sender.tag];
[self hideMicControlMenu];
}
- (void)micButtonUpdate:(NSInteger)type {
switch (type) {
case 1:
//
[self.micButton setImage:kImage(@"room_menu_mic_open") forState:UIControlStateNormal];
break;
case 2:
//
[self.micButton setImage:kImage(@"room_menu_mic_close") forState:UIControlStateNormal];
break;
case 3:
// 0
[self.micButton setImage:kImage(@"room_menu_mic_close_but_music") forState:UIControlStateNormal];
break;
default:
break;
}
}
#pragma mark - notification #pragma mark - notification
- (void)showGiftView:(NSNotification *)noti { - (void)showGiftView:(NSNotification *)noti {
NSDictionary *dict = noti.object; NSDictionary *dict = noti.object;
@@ -233,13 +342,28 @@
} }
#pragma mark - Private Method #pragma mark - Private Method
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
// subButton
UIView *hitView = [super hitTest:point withEvent:event];
if (hitView == self) {
// parentView nil
return nil;
}
// subButton
return hitView;
}
- (void)initSubViews { - (void)initSubViews {
[self setExclusiveTouch:YES];
[self addSubview:self.stackView]; [self addSubview:self.stackView];
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) { [self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self); make.bottom.mas_equalTo(self).offset(-kSafeAreaBottomHeight);
make.leading.mas_equalTo(self).offset(15); make.leading.mas_equalTo(self).offset(15);
make.trailing.mas_equalTo(self).offset(-15); make.trailing.mas_equalTo(self).offset(-15);
make.height.mas_equalTo(46); make.top.mas_equalTo(self);
}]; }];
[self.stackView addArrangedSubview:self.inputButton]; [self.stackView addArrangedSubview:self.inputButton];
@@ -251,6 +375,29 @@
[self.stackView addArrangedSubview:self.giftButton]; [self.stackView addArrangedSubview:self.giftButton];
[self.stackView addSubview:self.faceButton]; [self.stackView addSubview:self.faceButton];
[self.stackView addSubview:self.micButton_open];
[self.stackView addSubview:self.micButton_close_all];
[self.stackView addSubview:self.micButton_close_butMusic];
[self.micButton_open mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.micButton);
make.bottom.mas_equalTo(self.micButton.mas_top).offset(-10);
make.size.mas_equalTo(self.micButton);
}];
[self.micButton_close_all mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.micButton);
make.bottom.mas_equalTo(self.micButton_open.mas_top).offset(-10);
make.size.mas_equalTo(self.micButton);
}];
[self.micButton_close_butMusic mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.micButton);
make.bottom.mas_equalTo(self.micButton_close_all.mas_top).offset(-10);
make.size.mas_equalTo(self.micButton);
}];
} }
- (void)initSubViewConstraints { - (void)initSubViewConstraints {
@@ -354,11 +501,14 @@
#pragma mark - RoomGuestDelegate #pragma mark - RoomGuestDelegate
- (void)onMicroQueueUpdate:(NSMutableDictionary<NSString *,MicroQueueModel *> *)queue { - (void)onMicroQueueUpdate:(NSMutableDictionary<NSString *,MicroQueueModel *> *)queue {
MicroQueueModel * model = [self findMySelfMicro:queue]; MicroQueueModel *model = [self findMySelfMicro:queue];
if (model) { if (model) {
self.micButton.hidden = NO; self.micButton.hidden = NO;
self.micButton.selected = model.microState.micState == MicroMicStateType_Close ? YES : [RtcManager instance].isLocalMuted; if (model.microState.micState == MicroMicStateType_Close || [RtcManager instance].isLocalMuted) {
self.micButton.enabled = model.microState.micState == MicroMicStateType_Open; [self micButtonUpdate:2];
} else {
[self micButtonUpdate:1];
}
self.faceButton.hidden = NO; self.faceButton.hidden = NO;
} else { } else {
self.micButton.hidden = YES; self.micButton.hidden = YES;
@@ -537,8 +687,6 @@
if (!_micButton) { if (!_micButton) {
_micButton = [UIButton buttonWithType:UIButtonTypeCustom]; _micButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_micButton setImage:[UIImage imageNamed:@"room_menu_mic_open"] forState:UIControlStateNormal]; [_micButton setImage:[UIImage imageNamed:@"room_menu_mic_open"] forState:UIControlStateNormal];
[_micButton setImage:[UIImage imageNamed:@"room_menu_mic_close"] forState:UIControlStateSelected];
[_micButton setImage:[UIImage imageNamed:@"room_menu_mic_close"] forState:UIControlStateDisabled | UIControlStateSelected];
_micButton.tag = XPRoomMenuItemType_Mic; _micButton.tag = XPRoomMenuItemType_Mic;
[_micButton addTarget:self action:@selector(menuButtonAction:) forControlEvents:UIControlEventTouchUpInside]; [_micButton addTarget:self action:@selector(menuButtonAction:) forControlEvents:UIControlEventTouchUpInside];
_micButton.hidden = YES; _micButton.hidden = YES;
@@ -546,6 +694,39 @@
return _micButton; return _micButton;
} }
- (UIButton *)micButton_open {
if (!_micButton_open) {
_micButton_open = [UIButton buttonWithType:UIButtonTypeCustom];
[_micButton_open setImage:[UIImage imageNamed:@"room_menu_mic_open"] forState:UIControlStateNormal];
_micButton_open.tag = 1;
[_micButton_open addTarget:self action:@selector(handleMicControl:) forControlEvents:UIControlEventTouchUpInside];
_micButton_open.alpha = 0;
}
return _micButton_open;
}
- (UIButton *)micButton_close_all {
if (!_micButton_close_all) {
_micButton_close_all = [UIButton buttonWithType:UIButtonTypeCustom];
[_micButton_close_all setImage:[UIImage imageNamed:@"room_menu_mic_close"] forState:UIControlStateNormal];
_micButton_close_all.tag = 2;
[_micButton_close_all addTarget:self action:@selector(handleMicControl:) forControlEvents:UIControlEventTouchUpInside];
_micButton_close_all.alpha = 0;
}
return _micButton_close_all;
}
- (UIButton *)micButton_close_butMusic {
if (!_micButton_close_butMusic) {
_micButton_close_butMusic = [UIButton buttonWithType:UIButtonTypeCustom];
[_micButton_close_butMusic setImage:[UIImage imageNamed:@"room_menu_mic_close_but_music"] forState:UIControlStateNormal];
_micButton_close_butMusic.tag = 3;
[_micButton_close_butMusic addTarget:self action:@selector(handleMicControl:) forControlEvents:UIControlEventTouchUpInside];
_micButton_close_butMusic.alpha = 0;
}
return _micButton_close_butMusic;
}
- (UIButton *)voiceButton { - (UIButton *)voiceButton {
if (!_voiceButton) { if (!_voiceButton) {
_voiceButton = [UIButton buttonWithType:UIButtonTypeCustom]; _voiceButton = [UIButton buttonWithType:UIButtonTypeCustom];
@@ -617,6 +798,7 @@
if (!_stackView) { if (!_stackView) {
_stackView = [[UIStackView alloc] init]; _stackView = [[UIStackView alloc] init];
_stackView.spacing = 9; _stackView.spacing = 9;
_stackView.clipsToBounds = NO;
_stackView.alignment = UIStackViewAlignmentBottom; _stackView.alignment = UIStackViewAlignmentBottom;
} }
return _stackView; return _stackView;

View File

@@ -11,6 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface XPMessageInfoModel : PIBaseModel @interface XPMessageInfoModel : PIBaseModel
@property(nonatomic,assign) BOOL isChatHall; @property(nonatomic,assign) BOOL isChatHall;
@property(nonatomic,assign) BOOL isBoom;
@property(nonatomic,strong) PIRoomPhotoAlbumItemModel *albumModel; @property(nonatomic,strong) PIRoomPhotoAlbumItemModel *albumModel;
@property(nonatomic,copy) NSString *vipIcon; @property(nonatomic,copy) NSString *vipIcon;
@property(nonatomic,strong) NSString *charmUrl; @property(nonatomic,strong) NSString *charmUrl;
@@ -38,6 +39,8 @@ NS_ASSUME_NONNULL_BEGIN
///气泡url ///气泡url
@property (nonatomic, copy) NSString *bubbleImageUrl; @property (nonatomic, copy) NSString *bubbleImageUrl;
@property (nonatomic, copy) NSString *boomImageUrl;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -12,7 +12,10 @@
#import "Api+Message.h" #import "Api+Message.h"
#import "AttachmentModel.h" #import "AttachmentModel.h"
#import "RoomInfoModel.h" #import "RoomInfoModel.h"
@interface MsRoomMessageMainView()<XPRoomMessageContainerViewDelegate> #import "BoomInfoModel.h"
#import "XPSkillCardPlayerManager.h"
@interface MsRoomMessageMainView()<XPRoomMessageContainerViewDelegate, NIMBroadcastManagerDelegate>
@property(nonatomic,strong) XPRoomMessageContainerView *messageListView; @property(nonatomic,strong) XPRoomMessageContainerView *messageListView;
@@ -36,9 +39,16 @@
self.hostDelegate = delegate; self.hostDelegate = delegate;
[self installUI]; [self installUI];
[self installConstraints]; [self installConstraints];
[[NIMSDK sharedSDK].broadcastManager addDelegate:self];
} }
return self; return self;
} }
- (void)dealloc {
[[NIMSDK sharedSDK].broadcastManager removeDelegate:self];
}
-(void)installUI{ -(void)installUI{
[self addSubview:self.buttonRoom]; [self addSubview:self.buttonRoom];
[self addSubview:self.buttonChat]; [self addSubview:self.buttonChat];
@@ -48,29 +58,27 @@
} }
-(void)installConstraints{ -(void)installConstraints{
[self.buttonRoom mas_makeConstraints:^(MASConstraintMaker *make) { [self.buttonRoom mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.top.mas_equalTo(self); make.top.mas_equalTo(self);
make.width.mas_equalTo(100); make.leading.mas_equalTo(self).offset(15);
make.height.mas_equalTo(40); make.height.mas_equalTo(20);
}]; }];
[self.buttonChat mas_makeConstraints:^(MASConstraintMaker *make) { [self.buttonChat mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self); make.top.mas_equalTo(self);
make.leading.mas_equalTo(self.buttonRoom.mas_trailing).offset(8); make.leading.mas_equalTo(self.buttonRoom.mas_trailing).offset(20);
make.width.mas_equalTo(100); make.height.mas_equalTo(20);
make.height.mas_equalTo(40);
}]; }];
[self.buttonGift mas_makeConstraints:^(MASConstraintMaker *make) { [self.buttonGift mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self); make.top.mas_equalTo(self);
make.leading.mas_equalTo(self.buttonChat.mas_trailing).offset(8); make.leading.mas_equalTo(self.buttonChat.mas_trailing).offset(20);
make.width.mas_equalTo(100); make.height.mas_equalTo(20);
make.height.mas_equalTo(40);
}]; }];
[self.selectedMark mas_makeConstraints:^(MASConstraintMaker *make) { [self.selectedMark mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self).offset(40); make.top.mas_equalTo(self).offset(19);
make.centerX.mas_equalTo(self.buttonRoom); make.centerX.mas_equalTo(self.buttonRoom);
make.size.mas_equalTo(CGSizeMake(10, 3)); make.size.mas_equalTo(CGSizeMake(9, 3));
}]; }];
[self.messageListView mas_makeConstraints:^(MASConstraintMaker *make) { [self.messageListView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -87,7 +95,7 @@
[UIView animateWithDuration:0.2 animations:^{ [UIView animateWithDuration:0.2 animations:^{
[self.selectedMark mas_remakeConstraints:^(MASConstraintMaker *make) { [self.selectedMark mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self).offset(40); make.top.mas_equalTo(self).offset(19);
if (sender.tag == 101) { if (sender.tag == 101) {
make.centerX.mas_equalTo(self.buttonRoom); make.centerX.mas_equalTo(self.buttonRoom);
} else if (sender.tag == 102) { } else if (sender.tag == 102) {
@@ -155,6 +163,19 @@
} }
} }
#pragma mark -
- (void)onReceiveBroadcastMessage:(NIMBroadcastMessage *)broadcastMessage {
if ([AccountInfoStorage instance].getUid.length == 0) {
return;
}
if ([XPSkillCardPlayerManager shareInstance].roomUid != broadcastMessage.sender) {
return;
}
[self.messageListView handleBroadcastMessage:broadcastMessage];
}
#pragma mark - #pragma mark -
- (NSInteger)type{ - (NSInteger)type{
return 0; return 0;
@@ -172,6 +193,7 @@
if (!_buttonRoom) { if (!_buttonRoom) {
_buttonRoom = [UIButton buttonWithType:UIButtonTypeCustom]; _buttonRoom = [UIButton buttonWithType:UIButtonTypeCustom];
_buttonRoom.tag = 101; _buttonRoom.tag = 101;
[_buttonRoom.titleLabel setFont:kFontMedium(14)];
[_buttonRoom setTitle:YMLocalizedString(@"RoomMessageTitle_0") forState:UIControlStateNormal]; [_buttonRoom setTitle:YMLocalizedString(@"RoomMessageTitle_0") forState:UIControlStateNormal];
[_buttonRoom addTarget:self action:@selector(didTapButton:) forControlEvents:UIControlEventTouchUpInside]; [_buttonRoom addTarget:self action:@selector(didTapButton:) forControlEvents:UIControlEventTouchUpInside];
} }
@@ -182,6 +204,7 @@
if (!_buttonChat) { if (!_buttonChat) {
_buttonChat = [UIButton buttonWithType:UIButtonTypeCustom]; _buttonChat = [UIButton buttonWithType:UIButtonTypeCustom];
_buttonChat.tag = 102; _buttonChat.tag = 102;
[_buttonChat.titleLabel setFont:kFontMedium(14)];
[_buttonChat setTitle:YMLocalizedString(@"RoomMessageTitle_1") forState:UIControlStateNormal]; [_buttonChat setTitle:YMLocalizedString(@"RoomMessageTitle_1") forState:UIControlStateNormal];
[_buttonChat addTarget:self action:@selector(didTapButton:) forControlEvents:UIControlEventTouchUpInside]; [_buttonChat addTarget:self action:@selector(didTapButton:) forControlEvents:UIControlEventTouchUpInside];
} }
@@ -192,6 +215,7 @@
if (!_buttonGift) { if (!_buttonGift) {
_buttonGift = [UIButton buttonWithType:UIButtonTypeCustom]; _buttonGift = [UIButton buttonWithType:UIButtonTypeCustom];
_buttonGift.tag = 103; _buttonGift.tag = 103;
[_buttonGift.titleLabel setFont:kFontMedium(14)];
[_buttonGift setTitle:YMLocalizedString(@"RoomMessageTitle_2") forState:UIControlStateNormal]; [_buttonGift setTitle:YMLocalizedString(@"RoomMessageTitle_2") forState:UIControlStateNormal];
[_buttonGift addTarget:self action:@selector(didTapButton:) forControlEvents:UIControlEventTouchUpInside]; [_buttonGift addTarget:self action:@selector(didTapButton:) forControlEvents:UIControlEventTouchUpInside];
} }
@@ -201,7 +225,9 @@
- (UIImageView *)selectedMark { - (UIImageView *)selectedMark {
if (!_selectedMark) { if (!_selectedMark) {
_selectedMark = [[UIImageView alloc] init]; _selectedMark = [[UIImageView alloc] init];
_selectedMark.backgroundColor = [UIColor systemGreenColor]; _selectedMark.backgroundColor = UIColorFromRGB(0x04D5C6);
_selectedMark.layer.cornerRadius = 1;
_selectedMark.layer.masksToBounds = YES;
} }
return _selectedMark; return _selectedMark;
} }

View File

@@ -9,13 +9,15 @@
#import "RoomHostDelegate.h" #import "RoomHostDelegate.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@class NIMMessage, XPMessageInfoModel; @class NIMMessage, NIMBroadcastMessage, XPMessageInfoModel;
@interface XPRoomMessageParser : NSObject @interface XPRoomMessageParser : NSObject
- (XPMessageInfoModel*)parseMessageAttribute:(NIMMessage *)message; - (XPMessageInfoModel*)parseMessageAttribute:(NIMMessage *)message;
- (NSString *)parseMessageBubble:(NIMMessage *)message; - (NSString *)parseMessageBubble:(NIMMessage *)message;
- (XPMessageInfoModel*)parseBroadcastMessageAttribute:(NIMBroadcastMessage *)message;
///房间的代理 ///房间的代理
@property (nonatomic,weak) id<RoomHostDelegate> hostDelegate; @property (nonatomic,weak) id<RoomHostDelegate> hostDelegate;
- (void)showUserCard:(NSInteger)uid; - (void)showUserCard:(NSInteger)uid;

View File

@@ -54,6 +54,9 @@
#import "XPTreasureFairyViewController.h" #import "XPTreasureFairyViewController.h"
#import "PIGeneralPublicScreenModel.h" #import "PIGeneralPublicScreenModel.h"
#import "QEmotionHelper.h" #import "QEmotionHelper.h"
#import "BoomInfoModel.h"
@implementation XPRoomMessageParser @implementation XPRoomMessageParser
- (XPMessageInfoModel*)parseMessageAttributeForChatHall:(NIMMessage *)message{ - (XPMessageInfoModel*)parseMessageAttributeForChatHall:(NIMMessage *)message{
@@ -79,6 +82,34 @@
} }
} }
- (XPMessageInfoModel*)parseBroadcastMessageAttribute:(NIMBroadcastMessage *)message {
if (message.content) {
NSDictionary *msgDictionary = [message.content toJSONObject];
AttachmentModel *attachment = [AttachmentModel modelWithJSON:msgDictionary[@"body"]];
if (attachment.first == CustomMessageType_RoomBoom) {
Boom632Model *model = [Boom632Model modelWithJSON:attachment.data];
XPMessageInfoModel * messageInfo = [[XPMessageInfoModel alloc] init];
NSString *text = [NSString stringWithFormat:@"%@%@%@", YMLocalizedString(@"RoomMessageBoom_0"), model.nick, YMLocalizedString(@"RoomMessageBoom_1")];
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:text];
[attributedString addAttribute:NSFontAttributeName value:kFontMedium(11) range:NSMakeRange(0, text.length)];
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0, text.length)];
[attributedString addAttribute:NSForegroundColorAttributeName value:UIColorFromRGB(0xFF3B3B) range:NSMakeRange([YMLocalizedString(@"RoomMessageBoom_0") length], model.nick.length)];
messageInfo.content = attributedString;
messageInfo.isBoom = YES;
messageInfo.boomImageUrl = model.pic;
messageInfo.rowHeight = 80;
messageInfo.first = attachment.first;
return messageInfo;
}
}
return nil;
}
- (XPMessageInfoModel*)parseMessageAttribute:(NIMMessage *)message { - (XPMessageInfoModel*)parseMessageAttribute:(NIMMessage *)message {
NIMMessageType messageType = message.messageType; NIMMessageType messageType = message.messageType;
XPMessageInfoModel * messageInfo = [[XPMessageInfoModel alloc] init]; XPMessageInfoModel * messageInfo = [[XPMessageInfoModel alloc] init];
@@ -316,7 +347,7 @@
NSAttributedString * attribute = [self createTextAttribute:message.text color:UIColorFromRGB(0xFE5D7F) font:kRoomMessageDefalutFont]; NSAttributedString * attribute = [self createTextAttribute:message.text color:UIColorFromRGB(0xFE5D7F) font:kRoomMessageDefalutFont];
messageInfo.content = attribute; messageInfo.content = attribute;
} }
messageInfo.first = message.messageType; messageInfo.first = 10;
return messageInfo; return messageInfo;
} }
@@ -479,6 +510,7 @@
[attribute appendAttributedString:nickAttriibute]; [attribute appendAttributedString:nickAttriibute];
} }
messageInfo.content = attribute; messageInfo.content = attribute;
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }
@@ -522,6 +554,7 @@
} }
} }
messageInfo.content = attribute; messageInfo.content = attribute;
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }
- (XPMessageInfoModel *)createGuardianPlanetAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{ - (XPMessageInfoModel *)createGuardianPlanetAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
@@ -538,6 +571,7 @@
}]; }];
messageInfo.content = attribute; messageInfo.content = attribute;
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }
@@ -557,6 +591,7 @@
}]; }];
messageInfo.content = attribute; messageInfo.content = attribute;
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }
#pragma mark - #pragma mark -
@@ -571,6 +606,7 @@
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:YMLocalizedString(@"XPRoomMessageParser11"), info.amount] color:[DJDKMIMOMColor messageNickColor] font:kRoomMessageDefalutFont]]; [attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:YMLocalizedString(@"XPRoomMessageParser11"), info.amount] color:[DJDKMIMOMColor messageNickColor] font:kRoomMessageDefalutFont]];
} }
messageInfo.content = attribute; messageInfo.content = attribute;
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }
@@ -587,6 +623,7 @@
} }
[self attributeAddHihtLight:attribute uid:info.uid.integerValue]; [self attributeAddHihtLight:attribute uid:info.uid.integerValue];
messageInfo.content = attribute; messageInfo.content = attribute;
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }
@@ -600,6 +637,7 @@
[attribute appendAttributedString:[self createTextAttribute:info.giftName color:[DJDKMIMOMColor messageNickColor] font:kRoomMessageDefalutFont]]; [attribute appendAttributedString:[self createTextAttribute:info.giftName color:[DJDKMIMOMColor messageNickColor] font:kRoomMessageDefalutFont]];
[self attributeAddHihtLight:attribute uid:info.uid.integerValue]; [self attributeAddHihtLight:attribute uid:info.uid.integerValue];
messageInfo.content = attribute; messageInfo.content = attribute;
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }
@@ -613,6 +651,7 @@
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:text attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:kRoomMessageDefalutFont],NSForegroundColorAttributeName:[DJDKMIMOMColor messageTextColor],NSParagraphStyleAttributeName:[self paragraphStyle]}]; NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:text attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:kRoomMessageDefalutFont],NSForegroundColorAttributeName:[DJDKMIMOMColor messageTextColor],NSParagraphStyleAttributeName:[self paragraphStyle]}];
[attribute addAttributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor messageNickColor]} range:[text rangeOfString:info.nick]]; [attribute addAttributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor messageNickColor]} range:[text rangeOfString:info.nick]];
messageInfo.content = attribute; messageInfo.content = attribute;
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }
@@ -743,6 +782,7 @@
} }
} }
messageInfo.content = attribute; messageInfo.content = attribute;
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }
@@ -781,6 +821,7 @@
} }
} }
messageInfo.content = attribute; messageInfo.content = attribute;
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }
@@ -796,6 +837,7 @@
} }
[attribute appendAttributedString:[self createTextAttribute:tipString color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]]; [attribute appendAttributedString:[self createTextAttribute:tipString color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
messageInfo.content = attribute; messageInfo.content = attribute;
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }
@@ -853,6 +895,7 @@
[self attributeAddHihtLight:attribute uid:uid]; [self attributeAddHihtLight:attribute uid:uid];
messageInfo.content = attribute; messageInfo.content = attribute;
} }
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }
@@ -916,6 +959,7 @@
[attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser76") color:[DJDKMIMOMColor messageTextColor] font:kRoomMessageDefalutFont]]; [attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser76") color:[DJDKMIMOMColor messageTextColor] font:kRoomMessageDefalutFont]];
} }
messageInfo.content = attribute; messageInfo.content = attribute;
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }
@@ -941,6 +985,7 @@
[self attributeAddHihtLight:attribute uid:giftInfo.uid.integerValue]; [self attributeAddHihtLight:attribute uid:giftInfo.uid.integerValue];
messageInfo.content = attribute; messageInfo.content = attribute;
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }
@@ -968,6 +1013,7 @@
} }
[self attributeAddHihtLight:attribute uid:uid]; [self attributeAddHihtLight:attribute uid:uid];
messageInfo.content = attribute; messageInfo.content = attribute;
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }
@@ -988,6 +1034,7 @@
} }
messageInfo.content = attribute; messageInfo.content = attribute;
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }
@@ -1019,6 +1066,7 @@
} }
[self attributeAddHihtLight:attribute uid:uid]; [self attributeAddHihtLight:attribute uid:uid];
messageInfo.content = attribute; messageInfo.content = attribute;
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }
@@ -1047,7 +1095,7 @@
- (XPMessageInfoModel *)createShareOrAttentionRoomAttribute:(AttachmentModel *)attachment sendInfo:(XPMessageRemoteExtModel *)sendInfo uid:(NSString *)uid messageInfo:(XPMessageInfoModel *)messageInfo{ - (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; NSDictionary *data = attachment.data;
NSString *nick = [NSString stringWithFormat:@"%@",data[@"data"][@"nick"]]; NSString *nick = [NSString stringWithFormat:@"%@",data[@"nick"]];
[attribute appendAttributedString:[self createTextAttribute:nick color:[DJDKMIMOMColor messageNickColor] font:kRoomMessageDefalutFont]]; [attribute appendAttributedString:[self createTextAttribute:nick color:[DJDKMIMOMColor messageNickColor] font:kRoomMessageDefalutFont]];
NSString *tipString = @""; NSString *tipString = @"";
if (attachment.second == Custom_Message_Sub_Room_Tip_ShareRoom) { if (attachment.second == Custom_Message_Sub_Room_Tip_ShareRoom) {
@@ -1058,6 +1106,7 @@
[attribute appendAttributedString:[self createTextAttribute:tipString color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]]; [attribute appendAttributedString:[self createTextAttribute:tipString color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[self attributeAddHihtLight:attribute uid:uid.integerValue]; [self attributeAddHihtLight:attribute uid:uid.integerValue];
messageInfo.content = attribute; messageInfo.content = attribute;
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }
@@ -1154,6 +1203,7 @@
} }
} }
messageInfo.content = attribute; messageInfo.content = attribute;
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }
@@ -1214,6 +1264,7 @@
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@" X%ld",info.giftNum] color:[DJDKMIMOMColor messageTextColor] font:kRoomMessageDefalutFont]]; [attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@" X%ld",info.giftNum] color:[DJDKMIMOMColor messageTextColor] font:kRoomMessageDefalutFont]];
} }
messageInfo.content = attribute; messageInfo.content = attribute;
messageInfo.first = attachment.first;
return messageInfo; return messageInfo;
} }

View File

@@ -19,6 +19,9 @@ NS_ASSUME_NONNULL_BEGIN
@end @end
@interface XPRoomMessageTableViewCell : UITableViewCell @interface XPRoomMessageTableViewCell : UITableViewCell
@property (nonatomic, assign) BOOL isLeftBigImage;
///当前房间的类型 ///当前房间的类型
@property (nonatomic,assign) RoomType roomType; @property (nonatomic,assign) RoomType roomType;

View File

@@ -22,6 +22,7 @@
@property(nonatomic,strong) UIButton *clickBtn; @property(nonatomic,strong) UIButton *clickBtn;
/// ///
@property (nonatomic,strong) NetImageView *bubbleImageView; @property (nonatomic,strong) NetImageView *bubbleImageView;
@property (nonatomic, strong) NetImageView *leftBigImageView;
/// ///
@property (nonatomic,strong) XPNetImageYYLabel *contentLabel; @property (nonatomic,strong) XPNetImageYYLabel *contentLabel;
/// ///
@@ -48,15 +49,17 @@
tap.delegate = self; tap.delegate = self;
self.tapEmptyRecognizer = tap; self.tapEmptyRecognizer = tap;
[self.contentView addGestureRecognizer:self.tapEmptyRecognizer]; [self.contentView addGestureRecognizer:self.tapEmptyRecognizer];
[self.contentView addSubview:self.leftBigImageView];
} }
- (void)initSubViewConstraints { - (void)initSubViewConstraints {
[self.bubbleImageView mas_makeConstraints:^(MASConstraintMaker *make) { [self.bubbleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.contentLabel).offset(-12); make.leading.mas_equalTo(self.contentLabel).offset(-12);
make.top.mas_equalTo(self.contentLabel).offset(-10); make.top.mas_equalTo(self.contentLabel).offset(-10);
make.bottom.mas_equalTo(self.contentLabel).offset(10); make.bottom.mas_equalTo(self.contentLabel).offset(10);
make.trailing.mas_equalTo(self.contentLabel).offset(10); make.trailing.mas_equalTo(self.contentLabel).offset(10);
}]; }];
[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -69,6 +72,33 @@
}]; }];
} }
- (void)setIsLeftBigImage:(BOOL)isLeftBigImage {
_isLeftBigImage = isLeftBigImage;
if (isLeftBigImage) {
[self.bubbleImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(0);
make.top.mas_equalTo(0);
make.bottom.mas_equalTo(-10);
make.trailing.mas_equalTo(self.contentLabel).offset(10);
}];
[self.leftBigImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(0);
make.centerY.mas_equalTo(self.contentView);
make.size.mas_equalTo(CGSizeMake(50, 50));
}];
[self.contentLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.leftBigImageView.mas_trailing);
make.centerY.mas_equalTo(self.contentView);
if (isMSRTL()) {
make.width.mas_equalTo(20);
}
}];
}
}
#pragma mark - tool #pragma mark - tool
- (UIImage*)resizableImage:(UIImage *)image { - (UIImage*)resizableImage:(UIImage *)image {
// //
@@ -103,7 +133,6 @@
if (_messageInfo) { if (_messageInfo) {
self.contentLabel.attributedText = _messageInfo.content; self.contentLabel.attributedText = _messageInfo.content;
if (_messageInfo.bubbleImageUrl.length) { if (_messageInfo.bubbleImageUrl.length) {
@kWeakify(self); @kWeakify(self);
[self.bubbleImageView loadImageWithUrl:_messageInfo.bubbleImageUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) { [self.bubbleImageView loadImageWithUrl:_messageInfo.bubbleImageUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
@@ -112,30 +141,33 @@
UIImage *cutImage = [image1 cropRightAndBottomPixels:2]; UIImage *cutImage = [image1 cropRightAndBottomPixels:2];
self.bubbleImageView.image = [self resizableImage:cutImage]; self.bubbleImageView.image = [self resizableImage:cutImage];
}]; }];
} }
// else {
// _bubbleImageView.image = [UIImage imageWithColor:[DJDKMIMOMColor messageBubbleColor]];
//
// [self.contentLabel mas_updateConstraints:^(MASConstraintMaker *make) {
// make.leading.mas_equalTo(12);
// make.bottom.mas_equalTo(-20);
// make.top.mas_equalTo(10);
// // MARK: 使 layout
// make.width.mas_equalTo([self RTLLabelWidth]);
// }];
//
// }
[self.contentLabel mas_updateConstraints:^(MASConstraintMaker *make) { if (self.isLeftBigImage) {
make.leading.mas_equalTo(self.bubbleImageView).offset(self.messageInfo.contentLeftMargin); self.leftBigImageView.imageUrl = messageInfo.boomImageUrl;
make.top.mas_equalTo(self.bubbleImageView).offset(self.messageInfo.contentTopMargin); [self.contentLabel mas_updateConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.bubbleImageView).offset(-self.messageInfo.contentBottomMargin); make.leading.mas_equalTo(self.leftBigImageView.mas_trailing);
if (isMSRTL()) { // MARK: 使 layout make.trailing.mas_equalTo(-self.messageInfo.contentRightMargin - 8);
make.width.mas_equalTo([self RTLLabelWidth]); // make.centerY.mas_equalTo(self.contentView);
} make.top.mas_equalTo(self.bubbleImageView).offset(self.messageInfo.contentTopMargin);
}]; make.bottom.mas_equalTo(self.bubbleImageView).offset(-self.messageInfo.contentBottomMargin);
// if (isMSRTL()) {
// make.width.mas_equalTo([self RTLLabelWidth] - 65);
// }
}];
} else {
[self.contentLabel mas_updateConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.bubbleImageView).offset(self.messageInfo.contentLeftMargin);
make.top.mas_equalTo(self.bubbleImageView).offset(self.messageInfo.contentTopMargin);
make.bottom.mas_equalTo(self.bubbleImageView).offset(-self.messageInfo.contentBottomMargin);
if (isMSRTL()) { // MARK: 使 layout
make.width.mas_equalTo([self RTLLabelWidth]);
}
}];
}
_bubbleImageView.hidden = _messageInfo.isHiddenBubble; _bubbleImageView.hidden = _messageInfo.isHiddenBubble;
// [self layoutIfNeeded];
} }
} }
@@ -182,6 +214,15 @@
return _bubbleImageView; return _bubbleImageView;
} }
- (NetImageView *)leftBigImageView {
if (!_leftBigImageView) {
_leftBigImageView = [[NetImageView alloc] init];
_leftBigImageView.userInteractionEnabled = YES;
_leftBigImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _leftBigImageView;
}
- (XPNetImageYYLabel *)contentLabel { - (XPNetImageYYLabel *)contentLabel {
if (!_contentLabel) { if (!_contentLabel) {
_contentLabel = [[XPNetImageYYLabel alloc] init]; _contentLabel = [[XPNetImageYYLabel alloc] init];

View File

@@ -11,7 +11,7 @@
#import <JXCategoryView/JXCategoryListContainerView.h> #import <JXCategoryView/JXCategoryListContainerView.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@class XPRoomMessageContainerView; @class XPRoomMessageContainerView, AttachmentModel, NIMBroadcastMessage;
@protocol XPRoomMessageContainerViewDelegate <NSObject> @protocol XPRoomMessageContainerViewDelegate <NSObject>
- (void)xPRoomMessageContainerViewlDidTapEmpty:(XPRoomMessageContainerView *)view; - (void)xPRoomMessageContainerViewlDidTapEmpty:(XPRoomMessageContainerView *)view;
@@ -27,6 +27,10 @@ NS_ASSUME_NONNULL_BEGIN
- (void)changeType:(NSInteger)type; - (void)changeType:(NSInteger)type;
- (void)handleBroadcastMessageAttachment:(AttachmentModel *)attachment;
- (void)handleBroadcastMessage:(NIMBroadcastMessage *)message;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -45,6 +45,9 @@
#import "SDPhotoBrowser.h" #import "SDPhotoBrowser.h"
#import "XPSkillCardPlayerManager.h" #import "XPSkillCardPlayerManager.h"
// Boom
#import "BoomInfoModel.h"
NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
@interface XPRoomMessageContainerView ()<UITableViewDelegate, UITableViewDataSource, XPRoomMessageTableViewCellDelegate, UIGestureRecognizerDelegate,PIRoomMessagePhotoAlbumCellDelegate,SDPhotoBrowserDelegate,PIRoomMessageUnlockPhotoAlbumViewDelegate> @interface XPRoomMessageContainerView ()<UITableViewDelegate, UITableViewDataSource, XPRoomMessageTableViewCellDelegate, UIGestureRecognizerDelegate,PIRoomMessagePhotoAlbumCellDelegate,SDPhotoBrowserDelegate,PIRoomMessageUnlockPhotoAlbumViewDelegate>
@@ -67,7 +70,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
@property (nonatomic,strong) NSMutableArray<XPMessageInfoModel *> *datasource_chat; @property (nonatomic,strong) NSMutableArray<XPMessageInfoModel *> *datasource_chat;
@property (nonatomic,strong) NSMutableArray<XPMessageInfoModel *> *datasource_gift; @property (nonatomic,strong) NSMutableArray<XPMessageInfoModel *> *datasource_gift;
/// ///
@property (nonatomic,strong) NSMutableArray<NIMMessage *> *incomingMessages; @property (nonatomic,strong) NSMutableArray *incomingMessages;
///at ///at
@property (nonatomic, assign) NSInteger atCount; @property (nonatomic, assign) NSInteger atCount;
///@ ///@
@@ -122,7 +125,11 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
[self.datasource_chat addObject:model]; [self.datasource_chat addObject:model];
break; break;
case CustomMessageType_Gift: case CustomMessageType_Gift:
case CustomMessageType_RoomBoom:
case CustomMessageType_Candy_Tree:
case CustomMessageType_Super_Gift:
case CustomMessageType_AllMicroSend: case CustomMessageType_AllMicroSend:
case CustomMessageType_Treasure_Fairy:
[self.datasource_gift addObject:model]; [self.datasource_gift addObject:model];
break; break;
} }
@@ -329,22 +336,32 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
#pragma mark - #pragma mark -
/// ///
- (void)addRoomMessage:(NIMMessage *)message { - (void)addRoomMessage:(id)messageData {
if(self.isLoadHistoryMessage == YES)return; if(self.isLoadHistoryMessage == YES)return;
[self.incomingMessages addObject:message]; [self.incomingMessages addObject:messageData];
if (!self.isMiniEnter) {///
if (self.hostDelegate.getRoomInfo.isCloseScreen) { if ([messageData isKindOfClass:[NIMBroadcastMessage class]]) {
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; NIMBroadcastMessage *broadcastMessage = (NIMBroadcastMessage *)messageData;
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) { [[XPRoomMiniManager shareManager] saveRoomMessage:broadcastMessage];
AttachmentModel *attachment = (AttachmentModel *)obj.attachment; } else if ([messageData isKindOfClass:[NIMMessage class]]) {
if (attachment.first == CustomMessageType_Update_RoomInfo && attachment.second == Custom_Message_Sub_Update_RoomInfo_MessageState){ NIMMessage *message = (NIMMessage *)messageData;
[[XPRoomMiniManager shareManager] saveRoomMessage:message]; if (!self.isMiniEnter) {///
} if (self.hostDelegate.getRoomInfo.isCloseScreen) {
} NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
} else { if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
[[XPRoomMiniManager shareManager] saveRoomMessage:message]; AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
} if (attachment.first == CustomMessageType_Update_RoomInfo &&
} attachment.second == Custom_Message_Sub_Update_RoomInfo_MessageState){
[[XPRoomMiniManager shareManager] saveRoomMessage:message];
}
}
} else {
[[XPRoomMiniManager shareManager] saveRoomMessage:message];
}
}
}
if (self.isPending) { if (self.isPending) {
self.messageTipsBtn.hidden = NO; self.messageTipsBtn.hidden = NO;
[self findAtMeNumber]; [self findAtMeNumber];
@@ -368,10 +385,21 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
} }
// //
for (NIMMessage *item in self.incomingMessages) { // for (NIMMessage *item in self.incomingMessages) {
XPMessageInfoModel *model = [self.messageParser parseMessageAttribute:item]; // XPMessageInfoModel *model = [self.messageParser parseMessageAttribute:item];
[self.datasource addObject:model]; // [self.datasource addObject:model];
} // }
[self.incomingMessages enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:[NIMMessage class]]) {
XPMessageInfoModel *model = [self.messageParser parseMessageAttribute:(NIMMessage *)obj];
[self.datasource addObject:model];
} else if ([obj isKindOfClass:[NIMBroadcastMessage class]]) {
XPMessageInfoModel *model = [self.messageParser parseBroadcastMessageAttribute:(NIMBroadcastMessage *)obj];
if (model) {
[self.datasource addObject:model];
}
}
}];
[self updateAllDataSource]; [self updateAllDataSource];
@@ -675,6 +703,22 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
[self addRoomMessage:message]; [self addRoomMessage:message];
} }
- (void)handleBroadcastMessageAttachment:(AttachmentModel *)attachment; {
// if (attachment.first == CustomMessageType_RoomBoom) {
// Boom632Model *m = [Boom632Model modelWithJSON:attachment.data];
// NIMMessage * message = [[NIMMessage alloc] init];
// message.text = YMLocalizedString(@"XPRoomMessageContainerView5");
// message.localExt = @{@"isRoomTopic": @(YES)};
// [message setValue:@(NIMMessageTypeTip) forKey:@"messageType"];
// [message setValue:[NIMSession session:[NSString stringWithFormat:@"%ld", roomInfo.roomId] type:NIMSessionTypeChatroom] forKey:@"session"];
// [self addRoomMessage:message];
// }
}
- (void)handleBroadcastMessage:(NIMBroadcastMessage *)message {
[self addRoomMessage:message];
}
#pragma mark - RoomGuestDelegate #pragma mark - RoomGuestDelegate
- (void)handleNIMCustomAttachment:(AttachmentModel *)attachment{ - (void)handleNIMCustomAttachment:(AttachmentModel *)attachment{
@@ -953,9 +997,21 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSArray * temArray = [XPRoomMiniManager shareManager].getLocalCurrentRoomMessage; NSArray * temArray = [XPRoomMiniManager shareManager].getLocalCurrentRoomMessage;
// //
for (NIMMessage *item in temArray) { // for (NIMMessage *item in temArray) {
[self.datasource addObject:[self.messageParser parseMessageAttribute:item]]; // [self.datasource addObject:[self.messageParser parseMessageAttribute:item]];
} // }
[temArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:[NIMMessage class]]) {
XPMessageInfoModel *model = [self.messageParser parseMessageAttribute:(NIMMessage *)obj];
[self.datasource addObject:model];
} else if ([obj isKindOfClass:[NIMBroadcastMessage class]]) {
XPMessageInfoModel *model = [self.messageParser parseBroadcastMessageAttribute:(NIMBroadcastMessage *)obj];
if (model) {
[self.datasource addObject:model];
}
}
}];
[self updateAllDataSource]; [self updateAllDataSource];
@@ -1028,6 +1084,35 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
#pragma mark - UITableViewDelegate And UITableViewDataSource #pragma mark - UITableViewDelegate And UITableViewDataSource
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
NSArray *source = @[];
switch (self.displayType) {
case 1:
source = self.datasource;
break;
case 2:
source = self.datasource_chat;
break;
case 3:
source = self.datasource_gift;
break;
default:
source = self.datasource;
break;
}
XPMessageInfoModel *model = [source xpSafeObjectAtIndex:indexPath.row];
// model 使 model
if (model.rowHeight > 0) {
return model.rowHeight;
}
// 使
return UITableViewAutomaticDimension;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
switch (self.displayType) { switch (self.displayType) {
case 1: case 1:
@@ -1063,20 +1148,48 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
source = self.datasource; source = self.datasource;
break; break;
} }
XPMessageInfoModel *model = [source xpSafeObjectAtIndex:indexPath.row]; XPMessageInfoModel *model = [source xpSafeObjectAtIndex:indexPath.row];
NSString *cellKey = NSStringFromClass([XPRoomMessageTableViewCell class]);
if(model.first == CustomMessageType_Room_Album){ if(model.first == CustomMessageType_Room_Album){
PIRoomMessagePhotoAlbumCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([PIRoomMessagePhotoAlbumCell class])]; PIRoomMessagePhotoAlbumCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([PIRoomMessagePhotoAlbumCell class])];
cell.delegate = self; cell.delegate = self;
cell.messageInfo = model; cell.messageInfo = model;
cell.roomType = self.hostDelegate.getRoomInfo.type; cell.roomType = self.hostDelegate.getRoomInfo.type;
return cell; return cell;
} else { }
XPRoomMessageTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPRoomMessageTableViewCell class])]; else if (model.isBoom) {
cell.delegate = self; cellKey = @"XPRoomMessageTableViewCell_Boom";
cell.messageInfo = model; }
cell.roomType = self.hostDelegate.getRoomInfo.type;
return cell; XPRoomMessageTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellKey];
cell.delegate = self;
cell.isLeftBigImage = model.isBoom;
cell.messageInfo = model;
cell.roomType = self.hostDelegate.getRoomInfo.type;
return cell;
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
NSArray *source = @[];
switch (self.displayType) {
case 1:
source = self.datasource;
break;
case 2:
source = self.datasource_chat;
break;
case 3:
source = self.datasource_gift;
break;
default:
source = self.datasource;
break;
}
XPMessageInfoModel *model = [source xpSafeObjectAtIndex:indexPath.row];
if (model.rowHeight == 0) {
model.rowHeight = CGRectGetHeight(cell.frame);
} }
} }
@@ -1188,6 +1301,8 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
_messageTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; _messageTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_messageTableView.delegate = self; _messageTableView.delegate = self;
_messageTableView.dataSource = self; _messageTableView.dataSource = self;
_messageTableView.rowHeight = UITableViewAutomaticDimension;
_messageTableView.estimatedRowHeight = 44; //
_messageTableView.tableFooterView = [UIView new]; _messageTableView.tableFooterView = [UIView new];
_messageTableView.separatorStyle = UITableViewCellSeparatorStyleNone; _messageTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_messageTableView.backgroundColor = [UIColor clearColor]; _messageTableView.backgroundColor = [UIColor clearColor];
@@ -1196,6 +1311,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
if (@available(iOS 11.0, *)) { if (@available(iOS 11.0, *)) {
_messageTableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; _messageTableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
} }
[_messageTableView registerClass:[XPRoomMessageTableViewCell class] forCellReuseIdentifier:@"XPRoomMessageTableViewCell_Boom"];
[_messageTableView registerClass:[XPRoomMessageTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPRoomMessageTableViewCell class])]; [_messageTableView registerClass:[XPRoomMessageTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPRoomMessageTableViewCell class])];
[_messageTableView registerClass:[PIRoomMessagePhotoAlbumCell class] forCellReuseIdentifier:NSStringFromClass([PIRoomMessagePhotoAlbumCell class])]; [_messageTableView registerClass:[PIRoomMessagePhotoAlbumCell class] forCellReuseIdentifier:NSStringFromClass([PIRoomMessagePhotoAlbumCell class])];
@@ -1261,7 +1377,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
return _datasource_gift; return _datasource_gift;
} }
- (NSMutableArray<NIMMessage *> *)incomingMessages { - (NSMutableArray *)incomingMessages {
if (!_incomingMessages) { if (!_incomingMessages) {
_incomingMessages = [NSMutableArray array]; _incomingMessages = [NSMutableArray array];
} }

View File

@@ -23,8 +23,9 @@ NS_ASSUME_NONNULL_BEGIN
- (void)configUserInfo:(UserInfoModel * _Nullable)userInfo; - (void)configUserInfo:(UserInfoModel * _Nullable)userInfo;
///保存一下 房间的公屏防止最小化出去之后 被清空了 ///保存一下 房间的公屏防止最小化出去之后 被清空了
- (void)saveRoomMessage:(NIMMessage *)message; ///MARK: 原类型是 NIMMessage, 改为 id 兼容 NIMBroadcastMessage
- (NSArray<NIMMessage *> *)getLocalCurrentRoomMessage; - (void)saveRoomMessage:(id)message;
- (NSArray *)getLocalCurrentRoomMessage;
- (void)resetLocalMessage; - (void)resetLocalMessage;
///获取当前播放的歌曲 ///获取当前播放的歌曲

View File

@@ -64,7 +64,7 @@
} }
/// ///
- (void)saveRoomMessage:(NIMMessage *)message { - (void)saveRoomMessage:(id)message {
[self.messageArray addObject:message]; [self.messageArray addObject:message];
if (self.messageArray.count > kRoomMessageMaxLength) { if (self.messageArray.count > kRoomMessageMaxLength) {
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)]; NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
@@ -72,7 +72,7 @@
[self.messageArray removeObjectsInArray:needRemoveMsgArray]; [self.messageArray removeObjectsInArray:needRemoveMsgArray];
} }
} }
- (NSArray<NIMMessage *> *)getLocalCurrentRoomMessage { - (NSArray *)getLocalCurrentRoomMessage {
return [self.messageArray copy]; return [self.messageArray copy];
} }

View File

@@ -22,6 +22,7 @@
#import "StatisticsServiceHelper.h" #import "StatisticsServiceHelper.h"
#import "NSArray+Safe.h" #import "NSArray+Safe.h"
#import "NSMutableDictionary+Saft.h" #import "NSMutableDictionary+Saft.h"
#import "XPSkillCardPlayerManager.h"
#import "XCCurrentVCStackManager.h" #import "XCCurrentVCStackManager.h"
#import "CountDownHelper.h" #import "CountDownHelper.h"
///Model ///Model
@@ -89,6 +90,8 @@
#import "RoomBoomExplosionView.h" #import "RoomBoomExplosionView.h"
#import "RoomBoomResultView.h" #import "RoomBoomResultView.h"
#import "XPSendGiftView.h"
UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey; UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
UIKIT_EXTERN NSString * const kRoomMiniNotificationKey; UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
UIKIT_EXTERN NSString * kNewUserRechargeKey; UIKIT_EXTERN NSString * kNewUserRechargeKey;
@@ -288,6 +291,15 @@ XPCandyTreeInsufficientBalanceViewDelegate>
[[RoomBoomManager sharedManager] leaveRoom]; [[RoomBoomManager sharedManager] leaveRoom];
[XPSkillCardPlayerManager shareInstance].photoIdList = nil;
[XPSkillCardPlayerManager shareInstance].isInRoomVC = NO;
[XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge = NO;
[XPSkillCardPlayerManager shareInstance].isInRoom = NO;
[XPSkillCardPlayerManager shareInstance].roomUid = @"";
if([[XPRoomMiniManager shareManager] getRoomInfo]==nil){
[XPSkillCardPlayerManager shareInstance].isMineInMic = NO;
}
[[CountDownHelper shareHelper] stopCountDown]; [[CountDownHelper shareHelper] stopCountDown];
[CountDownHelper shareHelper].delegate = nil; [CountDownHelper shareHelper].delegate = nil;
[[NIMSDK sharedSDK].chatroomManager removeDelegate:self]; [[NIMSDK sharedSDK].chatroomManager removeDelegate:self];
@@ -330,11 +342,13 @@ XPCandyTreeInsufficientBalanceViewDelegate>
/// ///
[self.presenter getRoomSuperAdmin:self.roomUid]; [self.presenter getRoomSuperAdmin:self.roomUid];
[XPSkillCardPlayerManager shareInstance].isInRoom = YES;
[self startCheckOnlineCountTimer]; [self startCheckOnlineCountTimer];
[CountDownHelper shareHelper].delegate = self; [CountDownHelper shareHelper].delegate = self;
[self setupFroBoom]; [self setupForBoom];
//#if DEBUG //#if DEBUG
@@ -344,11 +358,67 @@ XPCandyTreeInsufficientBalanceViewDelegate>
// [b addTarget:self action:@selector(test) forControlEvents:UIControlEventTouchUpInside]; // [b addTarget:self action:@selector(test) forControlEvents:UIControlEventTouchUpInside];
//#endif //#endif
} }
//- (void)test { - (void)test {
// // UITextView
//} UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(20, 100, 300, 100)];
textView.editable = NO;
textView.backgroundColor = [UIColor clearColor]; //
- (void)setupFroBoom { // NSMutableAttributedString
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init];
// NSTextAttachment
NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
attachment.image = [UIImage imageNamed:@"room_boom_progress_avatar"]; //
// bounds
CGFloat imageOffsetY = -5.0; //
attachment.bounds = CGRectMake(0, imageOffsetY, 40, 40); //
// attributed string
NSAttributedString *imageString = [NSAttributedString attributedStringWithAttachment:attachment];
// attributed string
[attributedString appendAttributedString:imageString];
//
NSString *text1 = @" 恭喜!";
NSString *text2 = @" 八六八八八本";
NSString *text3 = @" 触发超级大奖BOOM所有在房用户将获得奖励";
//
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.alignment = NSTextAlignmentLeft; //
paragraphStyle.lineSpacing = 5.0; //
paragraphStyle.paragraphSpacing = 10.0; //
// attributed string
NSDictionary *attributes1 = @{NSFontAttributeName: [UIFont systemFontOfSize:17],
NSParagraphStyleAttributeName: paragraphStyle};
NSAttributedString *attributedText1 = [[NSAttributedString alloc] initWithString:text1 attributes:attributes1];
[attributedString appendAttributedString:attributedText1];
//
NSDictionary *attributes2 = @{NSFontAttributeName: [UIFont boldSystemFontOfSize:17],
NSForegroundColorAttributeName: [UIColor redColor],
NSParagraphStyleAttributeName: paragraphStyle};
NSAttributedString *attributedText2 = [[NSAttributedString alloc] initWithString:text2 attributes:attributes2];
[attributedString appendAttributedString:attributedText2];
//
NSAttributedString *attributedText3 = [[NSAttributedString alloc] initWithString:text3 attributes:attributes1];
[attributedString appendAttributedString:attributedText3];
// attributedString UITextView
textView.attributedText = attributedString;
// UITextView
[self.view addSubview:textView];
}
- (void)setupForBoom {
@kWeakify(self); @kWeakify(self);
[[RoomBoomManager sharedManager] registerBoomExplosion:^(id _Nonnull sth) { [[RoomBoomManager sharedManager] registerBoomExplosion:^(id _Nonnull sth) {
@kStrongify(self); @kStrongify(self);
@@ -478,11 +548,13 @@ XPCandyTreeInsufficientBalanceViewDelegate>
- (void)viewDidDisappear:(BOOL)animated{ - (void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:animated]; [super viewDidDisappear:animated];
self.navigationController.interactivePopGestureRecognizer.enabled = YES; self.navigationController.interactivePopGestureRecognizer.enabled = YES;
[XPSkillCardPlayerManager shareInstance].isInRoomVC = NO;
} }
- (void)viewDidAppear:(BOOL)animated { - (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated]; [super viewDidAppear:animated];
self.freeView.hidden = NO; self.freeView.hidden = NO;
self.navigationController.interactivePopGestureRecognizer.enabled = NO; self.navigationController.interactivePopGestureRecognizer.enabled = NO;
[XPSkillCardPlayerManager shareInstance].isInRoomVC = YES;
} }
#pragma mark - Private Method #pragma mark - Private Method
@@ -552,7 +624,8 @@ XPCandyTreeInsufficientBalanceViewDelegate>
quickMsgHeight = 30; quickMsgHeight = 30;
} }
[self.quickMessageContainerView mas_makeConstraints:^(MASConstraintMaker *make) { [self.quickMessageContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.menuContainerView.mas_top); make.bottom.mas_equalTo(self.view).offset(- 52 - kSafeAreaBottomHeight);
// make.bottom.mas_equalTo(self.menuContainerView.mas_top);
make.height.mas_equalTo(0); make.height.mas_equalTo(0);
make.leading.trailing.mas_equalTo(self.view); make.leading.trailing.mas_equalTo(self.view);
}]; }];
@@ -648,6 +721,60 @@ XPCandyTreeInsufficientBalanceViewDelegate>
[self.view addSubview:view]; [self.view addSubview:view];
[self.view bringSubviewToFront:view]; [self.view bringSubviewToFront:view];
}; };
self.activityContainerView.showSendGiftView = ^{
@kStrongify(self);
NSString * roomUid = [NSString stringWithFormat:@"%ld", [self getRoomInfo].uid];
XPSendGiftView * giftView = [[XPSendGiftView alloc] initWithType:SendGiftType_Room uid:roomUid];
giftView.delegate = self;
NSArray * giftUses = [self configGiftUsers:[self getMicroQueue]];
[giftView configGiftUsers:giftUses];
[self.getCurrentNav presentViewController:giftView animated:YES completion:nil];
};
}
- (NSArray<XPGiftUserInfoModel *> *)configGiftUsers:(NSMutableDictionary<NSString *,MicroQueueModel *> *)queue {
NSMutableArray * array = [NSMutableArray array];
for (MicroQueueModel * microModel in queue.allValues) {
if (microModel.userInfo && microModel.userInfo.uid >0) {
UserInfoModel * userInfo = microModel.userInfo;
XPGiftUserInfoModel * userModel = [[XPGiftUserInfoModel alloc] init];
userModel.avatar = userInfo.avatar;
userModel.vipMic = userInfo.vipMic;
userModel.position = [NSString stringWithFormat:@"%d", microModel.microState.position];
userModel.uid = userInfo.uid;
if (self.getRoomInfo.type == RoomType_Anchor && microModel.microState.position == -1) {///
continue;
}
[array addObject:userModel];
}
}
if (self.getRoomInfo.leaveMode) {
RoomInfoModel * roomInfo= self.getRoomInfo;
XPGiftUserInfoModel * userModel = [[XPGiftUserInfoModel alloc] init];
userModel.avatar = roomInfo.avatar;
userModel.position = @"-1";
userModel.uid = roomInfo.uid;
[array addObject:userModel];
} else if (self.getRoomInfo.type == RoomType_Anchor) {
RoomInfoModel * roomInfo= self.getRoomInfo;
BOOL hadContainerOwner = NO;
for (UserInfoModel *userModel in array) {
if (userModel.uid == roomInfo.uid) {
hadContainerOwner = YES;
break;
}
}
if (!hadContainerOwner) {
XPGiftUserInfoModel * userModel = [[XPGiftUserInfoModel alloc] init];
userModel.avatar = roomInfo.avatar;
userModel.position = @"-1";
userModel.uid = roomInfo.uid;
[array addObject:userModel];
}
}
return array;
} }
- (void)exitOldRoom { - (void)exitOldRoom {
@@ -1272,6 +1399,8 @@ XPCandyTreeInsufficientBalanceViewDelegate>
- (void)initEnterRoomSuccess:(RoomInfoModel *)roomInfo user:(UserInfoModel *)userInfo { - (void)initEnterRoomSuccess:(RoomInfoModel *)roomInfo user:(UserInfoModel *)userInfo {
[XNDJTDDLoadingTool hideHUDInView:self.navigationController.view]; [XNDJTDDLoadingTool hideHUDInView:self.navigationController.view];
[XPSkillCardPlayerManager shareInstance].roomUid = @(roomInfo.uid).stringValue;
userInfo.fromUid = self.fromUid; userInfo.fromUid = self.fromUid;
userInfo.fromType = self.fromType; userInfo.fromType = self.fromType;
userInfo.fromNick = self.fromNick; userInfo.fromNick = self.fromNick;
@@ -1815,6 +1944,11 @@ XPCandyTreeInsufficientBalanceViewDelegate>
[self.menuContainerView handleNIMNotificationMessage:message]; [self.menuContainerView handleNIMNotificationMessage:message];
[self.functionView handleNIMNotificationMessage:message]; [self.functionView handleNIMNotificationMessage:message];
[self.littleGameView handleNIMNotificationMessage:message]; [self.littleGameView handleNIMNotificationMessage:message];
if([self.stageView findMicroViewByUid:@(self.userInfo.uid).stringValue] != nil){
[XPSkillCardPlayerManager shareInstance].isMineInMic = YES;
}else{
[XPSkillCardPlayerManager shareInstance].isMineInMic = NO;
};
} else if (message.messageType == NIMMessageTypeCustom) { } else if (message.messageType == NIMMessageTypeCustom) {
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]]) {
@@ -2527,6 +2661,14 @@ XPCandyTreeInsufficientBalanceViewDelegate>
- (XPRoomMenuContainerView *)menuContainerView { - (XPRoomMenuContainerView *)menuContainerView {
if (!_menuContainerView) { if (!_menuContainerView) {
_menuContainerView = [[XPRoomMenuContainerView alloc] initWithDelegate:self]; _menuContainerView = [[XPRoomMenuContainerView alloc] initWithDelegate:self];
@kWeakify(self);
[_menuContainerView setUpdateHeight:^(CGFloat height) {
@kStrongify(self);
[self.menuContainerView mas_updateConstraints:^(MASConstraintMaker *make) {
// make.leading.trailing.bottom.mas_equalTo(self.view);
make.height.mas_equalTo(height + kSafeAreaBottomHeight);
}];
}];
} }
return _menuContainerView; return _menuContainerView;
} }

View File

@@ -249,7 +249,7 @@
PIUniversalBannerModel *model = [PIUniversalBannerModel modelWithDictionary:attacment.data]; PIUniversalBannerModel *model = [PIUniversalBannerModel modelWithDictionary:attacment.data];
BOOL isSvga = [model.resourceType isEqualToString:@"SVGA"]; BOOL isSvga = [model.resourceType isEqualToString:@"SVGA"];
__block PIUniversalBannerView *bannerView; __block PIUniversalBannerView *bannerView;
@kWeakify(self); @kWeakify(self);
if (isSvga == YES) { if (isSvga == YES) {
SVGAParser *parser = [SVGAParser new]; SVGAParser *parser = [SVGAParser new];

View File

@@ -183,7 +183,6 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
[[RoomBoomManager sharedManager] registerBoomBanner:^(id _Nonnull sth) { [[RoomBoomManager sharedManager] registerBoomBanner:^(id _Nonnull sth) {
// @kStrongify(self);
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[RoomBoomBannerAnimation display:[UIApplication sharedApplication].keyWindow with:sth tapToRoom:YES complete:^{ [RoomBoomBannerAnimation display:[UIApplication sharedApplication].keyWindow with:sth tapToRoom:YES complete:^{
@@ -314,6 +313,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
return; return;
} }
self.userInfo = userInfo; self.userInfo = userInfo;
[[RoomBoomManager sharedManager] saveUserInfo:userInfo];
[self getRoomGameInfo]; [self getRoomGameInfo];
[AccountInfoStorage instance].name = self.userInfo.nick; [AccountInfoStorage instance].name = self.userInfo.nick;
@@ -673,11 +673,12 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
if([XPSkillCardPlayerManager shareInstance].isInRoomVC == YES)return; if([XPSkillCardPlayerManager shareInstance].isInRoomVC == YES)return;
[self.roomAnimation receiveAnchorHourRank:attachment]; [self.roomAnimation receiveAnchorHourRank:attachment];
}else if (attachment.first == CustomMessageType_Noble_VIP && attachment.second == Custom_Message_Sub_Room_Noble_LevelUp_Suspend) {///VIP }else if (attachment.first == CustomMessageType_Noble_VIP && attachment.second == Custom_Message_Sub_Room_Noble_LevelUp_Suspend) {///VIP
if([XPSkillCardPlayerManager shareInstance].isInRoomVC == YES)return; // if([XPSkillCardPlayerManager shareInstance].isInRoomVC == YES)return;
[self.roomAnimation receiveNobleLevelUp:attachment]; // [self.roomAnimation receiveNobleLevelUp:attachment];
}else if (attachment.first == CustomMessageType_General_Floating_Screen && attachment.second == Custom_Message_Sub_General_Floating_Screen_All_Room){ }else if (attachment.first == CustomMessageType_General_Floating_Screen && attachment.second == Custom_Message_Sub_General_Floating_Screen_All_Room){
if([XPSkillCardPlayerManager shareInstance].isInRoomVC == YES)return; if([XPSkillCardPlayerManager shareInstance].isInRoomVC == YES) {
[self.roomAnimation receiveRoomGeneralFloatingScreen:attachment]; [self.roomAnimation receiveRoomGeneralFloatingScreen:attachment];
}
} }
} }
} }

View File

@@ -20,7 +20,6 @@
+ (NSString *)msSign:(NSMutableDictionary *)dic { + (NSString *)msSign:(NSMutableDictionary *)dic {
[dic removeObjectForKey:@"Accept-Language"]; [dic removeObjectForKey:@"Accept-Language"];
[dic removeObjectForKey:@"ticket"];
[dic removeObjectForKey:@"pub_uid"]; [dic removeObjectForKey:@"pub_uid"];
[dic removeObjectForKey:@"appVersion"]; [dic removeObjectForKey:@"appVersion"];
[dic removeObjectForKey:@"appVersionCode"]; [dic removeObjectForKey:@"appVersionCode"];

View File

@@ -135,7 +135,7 @@
"MvpViewController5" = "المصادقة بالاسم الحقيقي"; "MvpViewController5" = "المصادقة بالاسم الحقيقي";
"MvpViewController6" = "لقد تم حظرك"; "MvpViewController6" = "لقد تم حظرك";
"MvpViewController7" = "تم حظر حسابك بسبب %@\nوقت فتح الحظر: %@"; "MvpViewController7" = "%@\nوقت فتح الحظر: %@";
"XPRoomInsidekfjdskfjks" = "يتم بذل الجهود للعثور على غرفة مناسبة ~"; "XPRoomInsidekfjdskfjks" = "يتم بذل الجهود للعثور على غرفة مناسبة ~";
@@ -2958,7 +2958,7 @@ ineHeadView12" = "الحمل";
"MvpViewController5" = "التحقق من الهوية"; "MvpViewController5" = "التحقق من الهوية";
"MvpViewController6" = "تم حظر حسابك"; "MvpViewController6" = "تم حظر حسابك";
"MvpViewController7" = "تم حظر حسابك بسبب %@\nوقت فك الحظر: %@"; "MvpViewController7" = "%@\nوقت فتح الحظر: %@";
"XPRoomInsidekfjdskfjks" = "جاري البحث عن غرفة مناسبة ~"; "XPRoomInsidekfjdskfjks" = "جاري البحث عن غرفة مناسبة ~";
@@ -3939,6 +3939,8 @@ ineHeadView12" = "الحمل";
"RoomBoom_5" = "房間暱稱:"; "RoomBoom_5" = "房間暱稱:";
"RoomBoom_6" = "Reset time: 0:00 (GMT+3) daily"; "RoomBoom_6" = "Reset time: 0:00 (GMT+3) daily";
"RoomMessageTitle_0" = "房間"; "RoomMessageTitle_0" = "الكل";
"RoomMessageTitle_1" = "聊天"; "RoomMessageTitle_1" = "رسالة خاصة";
"RoomMessageTitle_2" = "禮物"; "RoomMessageTitle_2" = "إرسال";
"RoomMessageBoom_0" = "تهانينا! ";
"RoomMessageBoom_1" = " إطلاق الجائزة الكبرى السوبر بووم، ستتم مكافأة جميع المستخدمين في الغرفة!";

View File

@@ -2563,7 +2563,7 @@
"MvpViewController5" = "Real-name Authentication"; "MvpViewController5" = "Real-name Authentication";
"MvpViewController6" = "You have been banned"; "MvpViewController6" = "You have been banned";
"MvpViewController7" = "Your account has been banned due to %@\nUnban time: %@"; "MvpViewController7" = "%@\nUnban time: %@";
"XPRoomInsidekfjdskfjks" = "Efforts are being made to find a suitable room~"; "XPRoomInsidekfjdskfjks" = "Efforts are being made to find a suitable room~";
@@ -3735,6 +3735,8 @@
"RoomBoom_5" = "房間暱稱:"; "RoomBoom_5" = "房間暱稱:";
"RoomBoom_6" = "Reset time: 0:00 (GMT+3) daily"; "RoomBoom_6" = "Reset time: 0:00 (GMT+3) daily";
"RoomMessageTitle_0" = "房間"; "RoomMessageTitle_0" = "All";
"RoomMessageTitle_1" = "聊天"; "RoomMessageTitle_1" = "Chat";
"RoomMessageTitle_2" = "禮物"; "RoomMessageTitle_2" = "Gift";
"RoomMessageBoom_0" = "Congratulations! ";
"RoomMessageBoom_1" = " has triggered the super jackpot BOOM, and all users in the room will receive rewards!";

View File

@@ -2281,7 +2281,7 @@
"MvpViewController5" = "实名认证"; "MvpViewController5" = "实名认证";
"MvpViewController6" = "您被封号了"; "MvpViewController6" = "您被封号了";
"MvpViewController7" = "您的账号因%@被封禁\n解封时间%@"; "MvpViewController7" = "%@\n解封时间%@";
"XPRoomInsidekfjdskfjks" = "努力寻找合适房间中~"; "XPRoomInsidekfjdskfjks" = "努力寻找合适房间中~";
@@ -3399,6 +3399,9 @@
"RoomBoom_5" = "房間暱稱:"; "RoomBoom_5" = "房間暱稱:";
"RoomBoom_6" = "Reset time: 0:00 (GMT+3) daily"; "RoomBoom_6" = "Reset time: 0:00 (GMT+3) daily";
"RoomMessageTitle_0" = "房間"; "RoomMessageTitle_0" = "全部";
"RoomMessageTitle_1" = "聊天"; "RoomMessageTitle_1" = "聊天";
"RoomMessageTitle_2" = "禮物"; "RoomMessageTitle_2" = "禮物";
"RoomMessageBoom_0" = "恭喜!";
"RoomMessageBoom_1" = "触发超级大奖BOOM所有在房用户将获得奖励";

View File

@@ -2274,7 +2274,7 @@
"MvpViewController5" = "實名認證"; "MvpViewController5" = "實名認證";
"MvpViewController6" = "您被封號了"; "MvpViewController6" = "您被封號了";
"MvpViewController7" = "您的賬號因%@被封禁\n解封時間%@"; "MvpViewController7" = "%@\n解封時間%@";
"XPRoomInsidekfjdskfjks" = "努力尋找合適房間中~"; "XPRoomInsidekfjdskfjks" = "努力尋找合適房間中~";
@@ -3391,6 +3391,8 @@
"RoomBoom_5" = "房間暱稱:"; "RoomBoom_5" = "房間暱稱:";
"RoomBoom_6" = "Reset time: 0:00 (GMT+3) daily"; "RoomBoom_6" = "Reset time: 0:00 (GMT+3) daily";
"RoomMessageTitle_0" = "房間"; "RoomMessageTitle_0" = "全部";
"RoomMessageTitle_1" = "聊天"; "RoomMessageTitle_1" = "聊天";
"RoomMessageTitle_2" = "禮物"; "RoomMessageTitle_2" = "禮物";
"RoomMessageBoom_0" = "恭喜!";
"RoomMessageBoom_1" = "触发超级大奖BOOM所有在房用户将获得奖励";