个播房主播魅力值、魅力榜
This commit is contained in:
@@ -112,6 +112,7 @@
|
||||
73FFADDC93E195344047A2EC /* Pods_xplan_ios.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CACF623970097D653132D69A /* Pods_xplan_ios.framework */; };
|
||||
9B0086C627BA392B0032BD2B /* AnchorStageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B0086C527BA392B0032BD2B /* AnchorStageView.m */; };
|
||||
9B0086CA27BA4F570032BD2B /* AnchorMicroView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B0086C927BA4F570032BD2B /* AnchorMicroView.m */; };
|
||||
9B060B5827BCAEE20001B767 /* AnchorGiftValueView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B060B5727BCAEE20001B767 /* AnchorGiftValueView.m */; };
|
||||
9B0E1C5926E77022005D4442 /* BaseNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B0E1C5826E77022005D4442 /* BaseNavigationController.m */; };
|
||||
9B7B605B27BB53060070BB72 /* XPAnchorAudienceUpMicView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7B605A27BB53060070BB72 /* XPAnchorAudienceUpMicView.m */; };
|
||||
9B7B606227BB96E40070BB72 /* XPRoomAnchorInfoCardView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7B606127BB96E40070BB72 /* XPRoomAnchorInfoCardView.m */; };
|
||||
@@ -638,6 +639,8 @@
|
||||
9B0086C527BA392B0032BD2B /* AnchorStageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnchorStageView.m; sourceTree = "<group>"; };
|
||||
9B0086C827BA4F570032BD2B /* AnchorMicroView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AnchorMicroView.h; sourceTree = "<group>"; };
|
||||
9B0086C927BA4F570032BD2B /* AnchorMicroView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnchorMicroView.m; sourceTree = "<group>"; };
|
||||
9B060B5627BCAEE20001B767 /* AnchorGiftValueView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AnchorGiftValueView.h; sourceTree = "<group>"; };
|
||||
9B060B5727BCAEE20001B767 /* AnchorGiftValueView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnchorGiftValueView.m; sourceTree = "<group>"; };
|
||||
9B0E1C5726E77022005D4442 /* BaseNavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseNavigationController.h; sourceTree = "<group>"; };
|
||||
9B0E1C5826E77022005D4442 /* BaseNavigationController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BaseNavigationController.m; sourceTree = "<group>"; };
|
||||
9B7B605927BB53060070BB72 /* XPAnchorAudienceUpMicView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPAnchorAudienceUpMicView.h; sourceTree = "<group>"; };
|
||||
@@ -1931,6 +1934,8 @@
|
||||
children = (
|
||||
9B0086C827BA4F570032BD2B /* AnchorMicroView.h */,
|
||||
9B0086C927BA4F570032BD2B /* AnchorMicroView.m */,
|
||||
9B060B5627BCAEE20001B767 /* AnchorGiftValueView.h */,
|
||||
9B060B5727BCAEE20001B767 /* AnchorGiftValueView.m */,
|
||||
);
|
||||
path = Anchor;
|
||||
sourceTree = "<group>";
|
||||
@@ -3815,6 +3820,7 @@
|
||||
E8EEB91D26FC9D58007C6EBA /* XPMineUserInfoDateView.m in Sources */,
|
||||
E82325E9274CE56A003A3332 /* XPShareItem.m in Sources */,
|
||||
E890BC0D273D09A50007C46B /* XPGiftCountView.m in Sources */,
|
||||
9B060B5827BCAEE20001B767 /* AnchorGiftValueView.m in Sources */,
|
||||
E81C1B262770663B0020D1E4 /* XPArrangeMicTableViewCell.m in Sources */,
|
||||
E8AC722F26F49610007D6E91 /* XPMineNotificationItemModel.m in Sources */,
|
||||
E8E70D7A26F2F16600F03460 /* XPMinePresent.m in Sources */,
|
||||
|
@@ -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
|
||||
|
@@ -11,6 +11,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@interface XPRoomHalfWebView : UIView
|
||||
///地址
|
||||
@property (nonatomic,copy) NSString *url;
|
||||
///房间uid
|
||||
@property (nonatomic,copy) NSString *roomUid;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -96,6 +96,7 @@
|
||||
- (void)setUrl:(NSString *)url {
|
||||
_url = url;
|
||||
if (_url.length > 0) {
|
||||
self.webVC.roomUid = self.roomUid;
|
||||
self.webVC.url = _url;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// AnchorGiftValueView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/2/16.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface AnchorGiftValueView : UIView
|
||||
|
||||
///当前的礼物值
|
||||
@property (nonatomic,assign) long long giftValue;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// AnchorGiftValueView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/2/16.
|
||||
//
|
||||
|
||||
#import "AnchorGiftValueView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
#import "UIImage+Utils.h"
|
||||
#import "ThemeColor.h"
|
||||
|
||||
@interface AnchorGiftValueView ()
|
||||
///背景图
|
||||
@property (nonatomic, strong) UIImageView *bgImageView;
|
||||
///心形图标
|
||||
@property (nonatomic, strong) UIImageView *iconImageView;
|
||||
///礼物值
|
||||
@property (nonatomic, strong) UILabel *valueLabel;
|
||||
@end
|
||||
|
||||
@implementation AnchorGiftValueView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.bgImageView];
|
||||
[self.bgImageView addSubview:self.iconImageView];
|
||||
[self.bgImageView addSubview:self.valueLabel];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.bgImageView);
|
||||
}];
|
||||
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.bottom.mas_equalTo(self);
|
||||
make.left.mas_equalTo(self.valueLabel.mas_left).mas_offset(-8);
|
||||
make.right.mas_equalTo(self.iconImageView.mas_right).mas_offset(8);
|
||||
}];
|
||||
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.bgImageView);
|
||||
make.width.height.mas_equalTo(12);
|
||||
}];
|
||||
[self.valueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.bgImageView);
|
||||
make.right.mas_equalTo(self.iconImageView.mas_left).mas_offset(-2);
|
||||
}];
|
||||
|
||||
}
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setGiftValue:(long long)giftValue {
|
||||
NSString *value;
|
||||
if (giftValue < 1000000) {
|
||||
value = @(giftValue).stringValue;
|
||||
} else if (giftValue >= 100000000) {
|
||||
value = @"9999万+";
|
||||
} else {
|
||||
value = [NSString stringWithFormat:@"%lld万", giftValue/10000];
|
||||
}
|
||||
self.valueLabel.text = value;
|
||||
}
|
||||
|
||||
- (UIImageView *)bgImageView {
|
||||
if (_bgImageView == nil) {
|
||||
_bgImageView = [[UIImageView alloc] init];
|
||||
_bgImageView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFF2D7C), UIColorFromRGB(0xFF8BB2)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(20, 50)];
|
||||
_bgImageView.userInteractionEnabled = YES;
|
||||
}
|
||||
return _bgImageView;
|
||||
}
|
||||
|
||||
- (UIImageView *)iconImageView {
|
||||
if (_iconImageView == nil) {
|
||||
_iconImageView = [[UIImageView alloc] init];
|
||||
_iconImageView.userInteractionEnabled = YES;
|
||||
_iconImageView.image = [UIImage imageNamed:@"room_position_giftValue_heart"];
|
||||
}
|
||||
return _iconImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)valueLabel {
|
||||
if (_valueLabel == nil) {
|
||||
_valueLabel = [[UILabel alloc] init];
|
||||
_valueLabel.textColor = UIColor.whiteColor;
|
||||
_valueLabel.font = [UIFont systemFontOfSize:12];
|
||||
_valueLabel.text = @"0";
|
||||
}
|
||||
return _valueLabel;
|
||||
}
|
||||
|
||||
|
||||
@end
|
@@ -510,6 +510,7 @@ UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
|
||||
AttachmentModel * attachment = obj.attachment;
|
||||
[self.stageView handleNIMCustomMessage:message];
|
||||
[self.animationView handleNIMCustomMessage:message];
|
||||
[self.functionView handleNIMCustomMessage:message];
|
||||
if (attachment.first == CustomMessageType_Update_RoomInfo && attachment.second == Custom_Message_Sub_Update_RoomInfo_MessageState) {
|
||||
RoomInfoModel * roomInfo = [RoomInfoModel modelWithDictionary:attachment.data[@"roomInfo"]];
|
||||
self.roomInfo.isCloseScreen = roomInfo.isCloseScreen;
|
||||
|
Reference in New Issue
Block a user