个播房主播魅力值、魅力榜
This commit is contained in:
@@ -25,10 +25,12 @@
|
||||
#import "MicroQueueModel.h"
|
||||
#import "UserInfoModel.h"
|
||||
#import "AttachmentModel.h"
|
||||
#import "GiftValueInfoModel.h"
|
||||
///View
|
||||
#import "XPRoomHalfWebView.h"
|
||||
#import "XPAnchorAudienceUpMicView.h"
|
||||
#import "XPRoomAnchorInfoCardView.h"
|
||||
#import "AnchorGiftValueView.h"
|
||||
@interface XPRoomFunctionContainerView ()
|
||||
///host 代理
|
||||
@property (nonatomic,weak) id<RoomHostDelegate>delegate;
|
||||
@@ -38,6 +40,9 @@
|
||||
@property (nonatomic,strong) UIButton *datingProgresButton;
|
||||
///关注个播房主倒计时
|
||||
@property (nonatomic, strong) dispatch_source_t followAnchorTimer;
|
||||
///个播房房主魅力值
|
||||
@property (nonatomic, strong) AnchorGiftValueView *anchorGiftValueView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPRoomFunctionContainerView
|
||||
@@ -54,6 +59,7 @@
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.contributionButton];
|
||||
[self addSubview:self.anchorGiftValueView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
@@ -63,6 +69,11 @@
|
||||
make.width.mas_equalTo(90);
|
||||
make.height.mas_equalTo(26);
|
||||
}];
|
||||
[self.anchorGiftValueView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.contributionButton.mas_right).mas_offset(12);
|
||||
make.centerY.mas_equalTo(self.contributionButton);
|
||||
make.height.mas_equalTo(26);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - RoomGuestDelegate
|
||||
@@ -100,19 +111,34 @@
|
||||
[self.datingProgresButton removeFromSuperview];
|
||||
}
|
||||
}
|
||||
if (roomInfo.type == RoomType_Anchor) {
|
||||
[self.contributionButton setTitle:@"主播榜" forState:UIControlStateNormal];
|
||||
self.anchorGiftValueView.hidden = NO;
|
||||
} else {
|
||||
[self.contributionButton setTitle:@"房间榜" forState:UIControlStateNormal];
|
||||
self.anchorGiftValueView.hidden = YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onRoomEntered {
|
||||
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", roomInfo.uid];
|
||||
if (roomInfo.type == RoomType_Anchor && ![[AccountInfoStorage instance].getUid isEqualToString:roomUid]) {//个播房且非房主
|
||||
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||
[Api attentionStatusCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {//是否关注了个播房主
|
||||
BOOL isLike = ((NSNumber *)data.data).boolValue;
|
||||
if (!isLike) {
|
||||
[self setFollowAnchorTimer];
|
||||
if (roomInfo.type == RoomType_Anchor) {//个播房
|
||||
if (![[AccountInfoStorage instance].getUid isEqualToString:roomUid]) {//非房主
|
||||
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||
[Api attentionStatusCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {//是否关注了个播房主
|
||||
BOOL isLike = ((NSNumber *)data.data).boolValue;
|
||||
if (!isLike) {
|
||||
[self setFollowAnchorTimer];
|
||||
}
|
||||
} uid:uid isLikeUid:roomUid];
|
||||
}
|
||||
// 获取礼物值
|
||||
[Api roomMicroGiftValue:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
[self handleAnchorGiftValue:data.data];
|
||||
}
|
||||
} uid:uid isLikeUid:roomUid];
|
||||
} roomUid:[NSString stringWithFormat:@"%ld", roomInfo.uid] uid:[AccountInfoStorage instance].getUid];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -131,6 +157,12 @@
|
||||
config.contentView = upMicView;
|
||||
config.style = TTPopupStyleAlert;
|
||||
[TTPopup popupWithConfig:config];
|
||||
} else if(attachment.first == CustomMessageType_Room_GiftValue && attachment.second == Custom_Message_Sub_Room_GiftValue_Sync) {
|
||||
[self handleAnchorGiftValue:attachment.data];
|
||||
} else if(attachment.first == CustomMessageType_Gift && (attachment.second == Custom_Message_Sub_Gift_Send || attachment.second == Custom_Message_Sub_Gift_LuckySend || attachment.second == Custom_Message_Sub_Gift_ChannelNotify)) {
|
||||
[self handleAnchorGiftValue:attachment.data];
|
||||
}else if(attachment.first == CustomMessageType_AllMicroSend && (attachment.second == Custom_Message_Sub_AllMicroSend || attachment.second == Custom_Message_Sub_AllBatchSend || attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend)) {
|
||||
[self handleAnchorGiftValue:attachment.data];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,6 +204,16 @@
|
||||
|
||||
}];}
|
||||
|
||||
- (void)tapGiftValueRecognizer {
|
||||
if (self.anchorGiftValueView.hidden) return;
|
||||
if (self.delegate.getUserInfo && self.delegate.getUserInfo.uid > 0) {
|
||||
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
|
||||
webView.roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
|
||||
webView.url = [NSString stringWithFormat:@"%@?uid=%ld", URLWithType(kRoomCharmRankURL), self.delegate.getRoomInfo.uid];
|
||||
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - 个播模式弹窗关注主播
|
||||
- (void)setFollowAnchorTimer {
|
||||
if (self.followAnchorTimer != nil) {
|
||||
@@ -220,6 +262,20 @@
|
||||
} uid:roomUid];
|
||||
}
|
||||
|
||||
- (void)handleAnchorGiftValue:(NSDictionary *)dict {
|
||||
if (self.delegate.getRoomInfo.type != RoomType_Anchor) {//个播房房主位置魅力值刷新
|
||||
return;
|
||||
}
|
||||
GiftValueInfoModel * model = [GiftValueInfoModel modelWithDictionary:dict];
|
||||
for (int i = 0; i < model.giftValueVos.count; i++) {
|
||||
GiftValueDetailModel * giftValueModel = [model.giftValueVos objectAtIndex:i];
|
||||
if (![giftValueModel.uid isEqualToString:[NSString stringWithFormat:@"%zd", self.delegate.getRoomInfo.uid]]) {
|
||||
continue;
|
||||
}
|
||||
self.anchorGiftValueView.giftValue = giftValueModel.giftValue;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIButton *)contributionButton {
|
||||
if (!_contributionButton) {
|
||||
@@ -252,4 +308,16 @@
|
||||
return _datingProgresButton;
|
||||
}
|
||||
|
||||
- (AnchorGiftValueView *)anchorGiftValueView {
|
||||
if (!_anchorGiftValueView) {
|
||||
_anchorGiftValueView = [[AnchorGiftValueView alloc] init];
|
||||
_anchorGiftValueView.hidden = YES;
|
||||
_anchorGiftValueView.layer.cornerRadius = 13;
|
||||
_anchorGiftValueView.layer.masksToBounds = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGiftValueRecognizer)];
|
||||
[_anchorGiftValueView addGestureRecognizer:tap];
|
||||
}
|
||||
return _anchorGiftValueView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user