Commit 74f7e096 by ludi

1.完成新星new标签。

2.完成拍一拍点击事件兼容。
parent fea65792
Showing with 211 additions and 88 deletions
......@@ -7,12 +7,12 @@
<key>FUSChatCenterBundle.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>71</integer>
<integer>75</integer>
</dict>
<key>FUSChatCenterModule.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>75</integer>
<integer>72</integer>
</dict>
</dict>
</dict>
......
......@@ -7,7 +7,7 @@
<key>FUSShowRoomBundle.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>72</integer>
<integer>74</integer>
</dict>
<key>FUSShowRoomModule.xcscheme_^#shared#^_</key>
<dict>
......
......@@ -18,25 +18,36 @@
@end
@interface FUSBaoFangAnchorMicUserModel : FUSBaseModel
// 用户ID
@property (nonatomic, copy) NSString *uid;
// 用户昵称
@property (nonatomic, copy) NSString *nickname;
// 用户头像
@property (nonatomic, copy) NSString *face;
//@interface FUSBaoFangAnchorMicUserModel : FUSBaseModel
//
//// 用户ID
//@property (nonatomic, copy) NSString *uid;
//
//// 用户昵称
//@property (nonatomic, copy) NSString *nickname;
//
//// 用户头像
//@property (nonatomic, copy) NSString *face;
//
//// 富豪等级
//@property (nonatomic, assign) NSInteger level;
//
//// 直播等级
//@property (nonatomic, assign) NSInteger lev;
//
//// VIP状态(0:否、1:是)
//@property (nonatomic, assign) BOOL vip;
//
//@end
// 富豪等级
@property (nonatomic, assign) NSInteger level;
/// 标签模型
@interface FUSBaoFangAnchorRoomTagsModel : FUSBaseModel
// 直播等级
@property (nonatomic, assign) NSInteger lev;
//标签url
@property (nonatomic, copy) NSString *tagUrl;
// VIP状态(0:否、1:是)
@property (nonatomic, assign) BOOL vip;
// 0原有默认样式 1新版本样式
@property (nonatomic, assign) NSInteger tagStyle;
@end
......@@ -116,12 +127,13 @@
// 房间类型(0:视频直播房、2:聊天直播房)
@property (nonatomic, assign) NSInteger roomType;
/// 标签集合
@property (nonatomic, copy) NSArray<FUSBaoFangAnchorRoomTagsModel *> *roomTags;
#pragma mark --- fusi 新加的
/// 人气值对象({“score”:10000,”lev”:2,”change”:0})
@property (nonatomic, copy) NSDictionary *popular;
/// 标签集合
@property (nonatomic, copy) NSString *roomTags;
/// 语言
@property (nonatomic, copy) NSString *lang;
......@@ -131,7 +143,7 @@
/// 插入的模型
@property (nonatomic, strong) FUSBaoFangAnchorInsertModel *fus_insertModel;
/// 提供一个将主播列表的其他模块(如:新星主播模块)生成FUSBaoFangAnchorMicUserModel模型插入列表中的方法
+(NSMutableArray<FUSBaoFangAnchorMicUserModel *> *)fus_sortInsertModelWithDataDict:(NSDictionary *)dataDict;
/// 提供一个将主播列表的其他模块(如:新星主播模块)生成FUSBaoFangAnchorModel模型插入列表中的方法
+(NSMutableArray<FUSBaoFangAnchorModel *> *)fus_sortInsertModelWithDataDict:(NSDictionary *)dataDict;
@end
......@@ -44,7 +44,7 @@
return _roomId;
}
+ (NSMutableArray<FUSBaoFangAnchorMicUserModel *> *)fus_sortInsertModelWithDataDict:(NSDictionary *)dataDict{
+ (NSMutableArray<FUSBaoFangAnchorModel *> *)fus_sortInsertModelWithDataDict:(NSDictionary *)dataDict{
NSMutableArray *resList = [[NSMutableArray alloc] init];
//拼接rooms
......@@ -120,12 +120,22 @@
return resList;
}
+ (NSDictionary *)modelContainerPropertyGenericClass {
// return @{@“children”:[CustomModel class]};
return @{@"roomTags": [FUSBaoFangAnchorRoomTagsModel class]};
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
@end
@implementation FUSBaoFangAnchorMicUserModel
//@implementation FUSBaoFangAnchorMicUserModel
//
//@end
@implementation FUSBaoFangAnchorRoomTagsModel
@end
......@@ -12,6 +12,8 @@
@property (nonatomic, strong) NSMutableArray<YYAnimatedImageView *> *tagImageViews;
@property (nonatomic, strong) FUSBaoFangAnchorModel *model;
@end
@implementation FUSBaoFangTagView
......@@ -56,14 +58,15 @@
- (void)fus_refreshTagImagesWithModel:(FUSBaoFangAnchorModel *)model {
if ([NSArray isNull:model.tag] || model.tag.count <= 0) {
if ([NSArray isNull:model.roomTags] || model.roomTags.count <= 0) {
self.hidden = YES;
return;
}
self.hidden = NO;
self.model = model;
for (NSInteger i = 0; i < model.tag.count; i++) {
for (NSInteger i = 0; i < model.roomTags.count; i++) {
if (self.tagImageViews.count < i + 1) {
YYAnimatedImageView *imageView = [[YYAnimatedImageView alloc] init];
......@@ -76,9 +79,9 @@
self.tagImageViews[i].hidden = YES;
__weak typeof(self) weakSelf = self;
NSString *tagString = model.tag[i];
if (![NSString isNullWithString:tagString]) {
[self.tagImageViews[i] setWebImageWithSubURLString:tagString placeholder:nil completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
FUSBaoFangAnchorRoomTagsModel *tagModel = model.roomTags[i];
if (![NSString isNullWithString:tagModel.tagUrl]) {
[self.tagImageViews[i] setWebImageWithSubURLString:tagModel.tagUrl placeholder:nil completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
if ([image isKindOfClass:[YYImage class]]) {
((YYImage *)image).preloadAllAnimatedImageFrames = YES;
}
......@@ -124,7 +127,12 @@
imageView.image = image;
imageView.hidden = NO;
CGSize size = CGSizeZero;
size.height = self.height;
// size.height = self.height;
CGFloat imageHeight = 32 * UIView.fus_screenW / 375.0;
if (self.model.roomTags.count > 0) {
imageHeight = self.model.roomTags[index].tagStyle == 0 ? 21 * UIView.fus_screenW / 375.0 : self.height;
}
size.height = imageHeight;
size.width = image.size.width / image.size.height * size.height;
CGRect frame = CGRectZero;
......
......@@ -320,6 +320,11 @@ typedef NS_ENUM(NSInteger,FUSLiveRoomScopeType) {
- (void)fus_showAudienceError;
/// 开始倒计时直播间无互动行为上报
-(void)fus_starCountdownRoomLiveNoBehaviorReport;
/// 停止倒计时直播间无互动行为上报
-(void)fus_stopCountdownRoomLiveNoBehaviorReport;
#pragma -mark 实例
/**
* 获取单例
......
......@@ -1442,6 +1442,29 @@
[FUSLiveHelper shareInstance].audioMute = NO;
}
/// 开始倒计时直播间无互动行为上报
-(void)fus_starCountdownRoomLiveNoBehaviorReport{
if (self.liveType == FUSLiveTypeAudience) {
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(fus_handleCountdownRoomLiveNoBehaviorReport) object:nil];
[self performSelector:@selector(fus_handleCountdownRoomLiveNoBehaviorReport) afterDelay:60 * 3];
}
}
/// 停止倒计时直播间无互动行为上报
-(void)fus_stopCountdownRoomLiveNoBehaviorReport{
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(fus_handleCountdownRoomLiveNoBehaviorReport) object:nil];
}
-(void)fus_handleCountdownRoomLiveNoBehaviorReport{
if (self.liveType == FUSLiveTypeAudience) {
[FUSLiveHttpHelper fus_requestRoomLiveNoBehaviorReportWithRoomId:self.roomInfoModel.roomId succeed:^{
} failure:^(NSString *msg, NSInteger code) {
}];
}
}
#pragma mark - setter
- (void)setRoomScopeType:(FUSLiveRoomScopeType)roomScopeType {
......
......@@ -841,4 +841,22 @@
msg:(NSString *)msg
succeed:(void(^)(void))succeed
failure:(void(^)(NSString *msg,NSInteger code))failure;
/// 直播中屏幕点赞
/// @param roomId 房间id
/// @param num 次数
/// @param succeed 成功
/// @param failure 失败
+(void)fus_requestLivePraiseSendWithRoomId:(NSString *)roomId
num:(NSInteger)num
succeed:(void(^)(void))succeed
failure:(void(^)(NSString *msg,NSInteger code))failure;
/// 长时间观看直播无互动行为上报
/// @param roomId 房间id
/// @param succeed 成功
/// @param failure 失败
+(void)fus_requestRoomLiveNoBehaviorReportWithRoomId:(NSString *)roomId
succeed:(void(^)(void))succeed
failure:(void(^)(NSString *msg,NSInteger code))failure;
@end
......@@ -2498,5 +2498,31 @@
if (failure) failure(dataDict[@"msg"],code);
}];
}
/// 直播中屏幕点赞
/// @param roomId 房间id
/// @param num 次数
/// @param succeed 成功
/// @param failure 失败
+ (void)fus_requestLivePraiseSendWithRoomId:(NSString *)roomId num:(NSInteger)num succeed:(void (^)(void))succeed failure:(void (^)(NSString *, NSInteger))failure{
NSDictionary *parm = @{@"roomId": roomId,
@"num":[NSString stringWithFormat:@"%ld",num]};
[FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_ROOM_PRAISE_SEND params:parm success:^(NSDictionary * _Nullable dataDict, int code) {
succeed();
} failure:^(NSDictionary * _Nullable dataDict, int code) {
if (failure) failure(dataDict[@"msg"],code);
}];
}
/// 长时间观看直播无互动行为上报
/// @param roomId 房间id
/// @param succeed 成功
/// @param failure 失败
+ (void)fus_requestRoomLiveNoBehaviorReportWithRoomId:(NSString *)roomId succeed:(void (^)(void))succeed failure:(void (^)(NSString *, NSInteger))failure{
NSDictionary *parm = @{@"roomId": roomId};
[FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_ROOM_NO_BEHAVIOR_REPORT params:parm success:^(NSDictionary * _Nullable dataDict, int code) {
succeed();
} failure:^(NSDictionary * _Nullable dataDict, int code) {
if (failure) failure(dataDict[@"msg"],code);
}];
}
@end
......@@ -17,7 +17,7 @@
@property (nonatomic, strong) FUSLiveChatModel *model; // model
@property (nonatomic, copy) void(^onClickNickname)(NSString *);
//@property (nonatomic, copy) void(^onClickNickname)(NSString *);
@property (nonatomic, copy) void(^onClickNicknameWithModel)(FUSLiveChatModel *);
......
......@@ -19,7 +19,7 @@
@interface FUSLiveChatTableViewCell () <FUSLiveChatLabelDelegate>
//@property (nonatomic, strong) UIButton *nickNameBtn;
@property (nonatomic, strong) FUSLiveChatLabel *contentLabel; // label
@property (nonatomic, strong) YYLabel *contentLabel; // label
@property (nonatomic, strong) FUSRoundRectLabel *levLabel;
......@@ -82,7 +82,7 @@
_bgView.userInteractionEnabled = YES;
[self.contentView addSubview:_bgView];
_contentLabel = [[FUSLiveChatLabel alloc]init];
_contentLabel = [[YYLabel alloc]init];
_contentLabel.numberOfLines = 0;
_contentLabel.x = CELL_LEADING_SPACE;
_contentLabel.y = CELL_MARGIN;
......@@ -244,11 +244,11 @@
}
#pragma mark - label delegate
- (void)fus_label:(FUSLiveChatLabel *)label onClickCustomLink:(NSString *)link
{
if (self.onClickNickname) {
self.onClickNickname(link);
}
}
//- (void)fus_label:(FUSLiveChatLabel *)label onClickCustomLink:(NSString *)link
//{
// if (self.onClickNickname) {
// self.onClickNickname(link);
// }
//}
@end
......@@ -197,11 +197,6 @@ typedef NS_ENUM(NSInteger, FUSFunctionMode) {
- (void)fus_setupOnlineUsers:(NSArray *)usersArr;
/**
设置发送点赞剩余时间
*/
- (void)fus_setupLikeLimitTime:(NSString *)likeLimitTime;
/**
设置下方输入区域是否隐藏
@param hidden 是否隐藏
......
......@@ -103,7 +103,8 @@ FUSEmitterViewDelegate,
UIScrollViewDelegate,
FUSLiveChatInputViewDelegate,
FUSPKHelperDeleagte,
FUSLinkMicUserListDelegate
FUSLinkMicUserListDelegate,
UIGestureRecognizerDelegate
>
#pragma mark - View Property
......@@ -210,12 +211,6 @@ FUSLinkMicUserListDelegate
// 直播时长view
@property (nonatomic, strong) UIImageView *anchorAudioCloseImageView;
// 是否允许点赞
@property (nonatomic, assign) BOOL shouldSendLike;
// 点赞计时器
@property (nonatomic, strong) NSTimer *sendLikeTimer;
// 显示各种PK的入口
@property (nonatomic,strong) FUSPKStyleView *pkStyleView;
......@@ -331,6 +326,12 @@ FUSLinkMicUserListDelegate
/// 观众端拍一拍的弹窗
@property (nonatomic, strong) FUSPatAudiencePromptAlertView *patAudienceProptAlertView;
/// 连续点赞次数
@property (nonatomic, assign) NSInteger clickSendLikeCount;
/// 点赞需要请求的次数
@property (nonatomic, copy) NSArray<NSNumber *> *sendLikeSendConditionList;
@end
@implementation FUSLiveFunctionView
......@@ -347,7 +348,8 @@ FUSLinkMicUserListDelegate
_isStayLiveRoom = YES;
_isClickGiftBtn = NO;
_shareMessageShowTime = 0;
_shouldSendLike = YES;
_sendLikeSendConditionList = @[@1,@10,@100,@500];
_clickSendLikeCount = 1;
_currentMode = FUSFunctionModeNormal;
_dealDataQueue = [[NSOperationQueue alloc] init];
......@@ -793,6 +795,7 @@ FUSLinkMicUserListDelegate
CGFloat safeAreaBottom = 0;
safeAreaBottom = UIView.fus_SafeBottom;
self.chatFastInputView.hidden = keyboardShow;
CGFloat fastChatInputViewHeight = 0;
if (self.chatFastInputView && self.chatFastInputView.isHidden == NO) {
fastChatInputViewHeight = self.chatFastInputView.height;
......@@ -840,6 +843,7 @@ FUSLinkMicUserListDelegate
__weak typeof(self) weakSelf = self;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:weakSelf action:@selector(fus_sendClickLiveEvent)];
tap.delegate = self;
[_chatTableView addGestureRecognizer:tap];
_inputViewBgViewOriginal_Y = _chatViewBgView.y;
......@@ -937,6 +941,17 @@ FUSLinkMicUserListDelegate
_chatViewBgView.layer.mask = _gradientLayer;
}
#pragma mark GestureDelegate
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
// fixed 手势事件会与YYLabel的点击事件冲突的问题
if ([touch.view isKindOfClass:[YYLabel class]]) {
return NO;
}
return YES;
}
// 搭建粒子发射器
- (void)initEmitterView
{
......@@ -3836,16 +3851,6 @@ FUSLinkMicUserListDelegate
}
/**
发送点赞计时器倒计时
*/
- (void)sendLikeTimerCountDown:(NSTimer *)sender
{
[_sendLikeTimer invalidate];
_sendLikeTimer = nil;
_shouldSendLike = YES;
}
/**
开启pk匹配计时器
*/
- (void)fus_startPKMatchingTimer:(NSString *)timeout {
......@@ -4455,17 +4460,39 @@ FUSLinkMicUserListDelegate
if ([FUSLiveHelper shareInstance].liveType != FUSLiveTypeAnchor) {
if (self.shouldSendLike) {
[FUSLiveHttpHelper fus_sendLikeWithRoomId:[FUSLiveHelper shareInstance].roomInfoModel.roomId Success:nil failure:nil];
self.shouldSendLike = NO;
self.sendLikeTimer = [NSTimer scheduledTimerWithTimeInterval:20 target:[YYWeakProxy proxyWithTarget:self] selector:@selector(sendLikeTimerCountDown:) userInfo:nil repeats:NO];
[self fus_resetClickSendLikeCountWithCountdown:YES];
NSNumber *countNumber = [NSNumber numberWithInteger:self.clickSendLikeCount];
if ([self.sendLikeSendConditionList containsObject:countNumber]) {
[FUSLiveHttpHelper fus_requestLivePraiseSendWithRoomId:FUSLiveHelper.shareInstance.roomInfoModel.roomId num:self.clickSendLikeCount succeed:^{
} failure:^(NSString *msg, NSInteger code) {
}];
}
NSString *logStr = [NSString stringWithFormat:@"ludy点击了屏幕:%ld",self.clickSendLikeCount];
FUSLogInfo(logStr);
self.clickSendLikeCount++;
// 点赞 在家族列表里也发送了泡泡
[FUSSocketMessageHelper fus_socketSendLike];
}
}
/// 重置点赞次数并且开始倒数10秒再继续充值
/// - Parameter beginCountdown: 是否开始倒数10秒再继续充值
-(void)fus_resetClickSendLikeCountWithCountdown:(BOOL)beginCountdown{
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(fus_handleResetClickSendLikeCount) object:nil];
if (beginCountdown) {
[self performSelector:@selector(fus_handleResetClickSendLikeCount) afterDelay:10];
}
}
-(void)fus_handleResetClickSendLikeCount{
self.clickSendLikeCount = 1;
}
#pragma mark - Method
/**
......@@ -4691,6 +4718,9 @@ FUSLinkMicUserListDelegate
[self.bottomToolView fus_switchInteractionGameBtn:model.stateSwitch.liveGameState];
// 开始倒计时检测直播无互动行为
[[FUSLiveHelper shareInstance] fus_starCountdownRoomLiveNoBehaviorReport];
}
/**
......@@ -4734,9 +4764,8 @@ FUSLinkMicUserListDelegate
_isStayLiveRoom = NO;
_isClickGiftBtn = NO;
[_sendLikeTimer invalidate];
_sendLikeTimer = nil;
_shouldSendLike = YES;
_clickSendLikeCount = 1;
[self fus_resetClickSendLikeCountWithCountdown:NO];
[self.halfWebManager fus_removeAllWebView];
......@@ -4969,23 +4998,6 @@ FUSLinkMicUserListDelegate
}
/**
设置发送点赞剩余时间
*/
- (void)fus_setupLikeLimitTime:(NSString *)likeLimitTime
{
if (likeLimitTime.floatValue > 0) {
_shouldSendLike = NO;
[_sendLikeTimer invalidate];
_sendLikeTimer = nil;
_sendLikeTimer = [NSTimer scheduledTimerWithTimeInterval:likeLimitTime.integerValue target:[YYWeakProxy proxyWithTarget:self] selector:@selector(sendLikeTimerCountDown:) userInfo:nil repeats:NO];
} else {
_shouldSendLike = YES;
}
}
/**
设置下方输入区域是否隐藏
@param hidden 是否隐藏
......
......@@ -382,6 +382,12 @@ NS_ASSUME_NONNULL_BEGIN
/// 新增房间快速发言文字链 msg:文案内容
+(NSString *)fus_URL_ROOM_QUICK_CHAT_ADD;
/// 点赞V2
+(NSString *)fus_URL_ROOM_PRAISE_SEND;
/// 长时间观看直播无互动行为上报
+(NSString *)fus_URL_ROOM_NO_BEHAVIOR_REPORT;
@end
......
......@@ -514,6 +514,14 @@
+(NSString *)fus_URL_ROOM_QUICK_CHAT_ADD{
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/room/quick/chat/add"];
}
/// 点赞V2
+(NSString *)fus_URL_ROOM_PRAISE_SEND{
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/live/v2/praise/send"];
}
/// 长时间观看直播无互动行为上报
+(NSString *)fus_URL_ROOM_NO_BEHAVIOR_REPORT{
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/room/live/no/behavior/report"];
}
#pragma mark -- PK
// 房间PK信息
......
......@@ -12,7 +12,7 @@
<key>FUSUserCenterModuleBundle.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>74</integer>
<integer>71</integer>
</dict>
</dict>
</dict>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment