加入、退出粉丝团接口及协议处理

This commit is contained in:
chenguilong
2022-04-08 15:42:25 +08:00
parent 6c4360ab96
commit 5942609f58
20 changed files with 419 additions and 164 deletions

View File

@@ -119,6 +119,7 @@
9B16A34827E17D9B00E13A98 /* XPRoomTrumpetViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B16A34727E17D9B00E13A98 /* XPRoomTrumpetViewController.m */; };
9B16A34B27E1915A00E13A98 /* XPTrumpetPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B16A34A27E1915A00E13A98 /* XPTrumpetPresenter.m */; };
9B17F71827BD150600440843 /* SVGAParserManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B17F71727BD150600440843 /* SVGAParserManager.m */; };
9B1B7292280010E8003FACE9 /* Api+FansTeam.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B1B7291280010E8003FACE9 /* Api+FansTeam.m */; };
9B1EF3D227E81C0600554295 /* XPMineDressUpBubbleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B1EF3D127E81C0600554295 /* XPMineDressUpBubbleViewController.m */; };
9B1EF3D527E8294B00554295 /* XPMineDressEmptyCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B1EF3D427E8294B00554295 /* XPMineDressEmptyCollectionViewCell.m */; };
9B1FC3D527E49A5D006EFFE0 /* ChatBubbleModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B1FC3D427E49A5D006EFFE0 /* ChatBubbleModel.m */; };
@@ -833,6 +834,8 @@
9B16A34A27E1915A00E13A98 /* XPTrumpetPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPTrumpetPresenter.m; sourceTree = "<group>"; };
9B17F71627BD150600440843 /* SVGAParserManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAParserManager.h; sourceTree = "<group>"; };
9B17F71727BD150600440843 /* SVGAParserManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGAParserManager.m; sourceTree = "<group>"; };
9B1B7290280010E8003FACE9 /* Api+FansTeam.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+FansTeam.h"; sourceTree = "<group>"; };
9B1B7291280010E8003FACE9 /* Api+FansTeam.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+FansTeam.m"; sourceTree = "<group>"; };
9B1EF3D027E81C0600554295 /* XPMineDressUpBubbleViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineDressUpBubbleViewController.h; sourceTree = "<group>"; };
9B1EF3D127E81C0600554295 /* XPMineDressUpBubbleViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineDressUpBubbleViewController.m; sourceTree = "<group>"; };
9B1EF3D327E8294B00554295 /* XPMineDressEmptyCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineDressEmptyCollectionViewCell.h; sourceTree = "<group>"; };
@@ -3018,6 +3021,8 @@
9BDA3E6F27FD401100517FE6 /* Api */ = {
isa = PBXGroup;
children = (
9B1B7290280010E8003FACE9 /* Api+FansTeam.h */,
9B1B7291280010E8003FACE9 /* Api+FansTeam.m */,
);
path = Api;
sourceTree = "<group>";
@@ -5724,6 +5729,7 @@
E875FA8727D619820086ED04 /* ClientDataModel.m in Sources */,
18E7B29026EA0E6B0064BC9B /* FlutterBoost+Xplan.m in Sources */,
E8B846DC26FDE24300A777FE /* RechargeListModel.m in Sources */,
9B1B7292280010E8003FACE9 /* Api+FansTeam.m in Sources */,
E884C36C2743951B00E1EBED /* GiftReceiveInfoModel.m in Sources */,
9B7B606227BB96E40070BB72 /* XPRoomAnchorInfoCardView.m in Sources */,
E8395334276A03C300CF2F24 /* XPMineDressUpPresenter.m in Sources */,

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 817 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -276,6 +276,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageAnchorFansTeam) {
Custom_Message_Sub_FansTeam_Open_Fail = 902,
///用户加入粉丝团成功
Custom_Message_Sub_FansTeam_Join_Success = 903,
///用户退出粉丝团成功
Custom_Message_Sub_FansTeam_Out_Success = 904,
};

View File

@@ -0,0 +1,21 @@
//
// Api+FansTeam.h
// xplan-ios
//
// Created by GreenLand on 2022/4/8.
//
#import "Api.h"
NS_ASSUME_NONNULL_BEGIN
@interface Api (FansTeam)
/// 请求退出粉丝团
/// @param completion 完成
/// @param teamUid 房间uid
+ (void)requestOutFansTeam:(HttpRequestHelperCompletion)completion teamUid:(NSString *)teamUid;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,19 @@
//
// Api+FansTeam.m
// xplan-ios
//
// Created by GreenLand on 2022/4/8.
//
#import "Api+FansTeam.h"
@implementation Api (FansTeam)
/// 退
/// @param completion
/// @param teamUid uid
+ (void)requestOutFansTeam:(HttpRequestHelperCompletion)completion teamUid:(NSString *)teamUid {
[self makeRequest:@"anchorFansTeam/outAnchorFansTeam" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, teamUid, nil];
}
@end

View File

@@ -11,6 +11,10 @@ NS_ASSUME_NONNULL_BEGIN
@interface XPAnchorFansTeamPresenter : BaseMvpPresenter
/// 退出粉丝团
/// @param teamUid 用户uid
- (void)outAnchorFansTeam:(NSString *)teamUid;
@end
NS_ASSUME_NONNULL_END

View File

@@ -6,7 +6,17 @@
//
#import "XPAnchorFansTeamPresenter.h"
#import "Api+FansTeam.h"
#import "XPAnchorFansTeamProtocol.h"
@implementation XPAnchorFansTeamPresenter
/// 退
/// @param teamUid uid
- (void)outAnchorFansTeam:(NSString *)teamUid {
[Api requestOutFansTeam:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] outFansTeamSuccess];
}] teamUid:teamUid];
}
@end

View File

@@ -7,6 +7,8 @@
@protocol XPAnchorFansTeamProtocol <NSObject>
///退出粉丝团成功
- (void)outFansTeamSuccess;
@end

View File

@@ -16,8 +16,11 @@
#import "XPMacro.h"
#import "UIImage+Utils.h"
#import "ThemeColor.h"
#import "TTPopup.h"
#import "XPHtmlUrl.h"
///View
#import "XPAnchorFansTaskTableViewCell.h"
#import "XPRoomHalfWebView.h"
@interface XPAnchorFansTaskViewController()<XPAnchorFansTeamProtocol, UITableViewDelegate, UITableViewDataSource>
@@ -36,7 +39,7 @@
///
@property (nonatomic, strong) UILabel *nameLabel;
///
@property (nonatomic, strong) UILabel *countLabel;
@property (nonatomic, strong) UIButton *countButton;
@property (nonatomic, strong) UIView *stackView;
///
@@ -53,9 +56,17 @@
///
@property (nonatomic, strong) UIView *progressBgView;
///
@property (nonatomic, strong) UIView *progressView;
@property (nonatomic, strong) UIImageView *progressView;
///
@property (nonatomic, strong) UILabel *progressLabel;
///
@property (nonatomic, strong) UIImageView *explainBgImageView;
///
@property (nonatomic, strong) UIButton *explainButton;
///线
@property (nonatomic, strong) UIView *devideView;
///退
@property (nonatomic, strong) UIButton *exitButton;
@end
@@ -77,6 +88,7 @@
[super viewDidLoad];
[self initSubViews];
[self initSubViewConstraints];
[self setupInfo];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
@@ -94,7 +106,7 @@
[self.contentView addSubview:self.helpButton];
[self.contentView addSubview:self.avatarImageView];
[self.contentView addSubview:self.nameLabel];
[self.contentView addSubview:self.countLabel];
[self.contentView addSubview:self.countButton];
[self.contentView addSubview:self.stackView];
[self.stackView addSubview:self.rankImageView];
[self.contentView addSubview:self.privilegeTitleImageView];
@@ -104,8 +116,13 @@
[self.bottomView addSubview:self.myAvatarImageView];
[self.bottomView addSubview:self.intimateLabel];
[self.bottomView addSubview:self.progressBgView];
[self.bottomView addSubview:self.progressView];
[self.bottomView addSubview:self.progressLabel];
[self.progressBgView addSubview:self.progressView];
[self.progressBgView addSubview:self.progressLabel];
[self.contentView addSubview:self.explainBgImageView];
[self.explainBgImageView addSubview:self.explainButton];
[self.explainBgImageView addSubview:self.devideView];
[self.explainBgImageView addSubview:self.exitButton];
}
- (void)initSubViewConstraints {
@@ -140,10 +157,10 @@
make.height.mas_equalTo(21);
make.left.mas_equalTo(self.avatarImageView.mas_right).mas_offset(8);
make.top.mas_equalTo(self.avatarImageView).offset(6);
make.right.mas_equalTo(self.countLabel.mas_left).mas_offset(-4);
make.right.mas_equalTo(self.countButton.mas_left).mas_offset(-4);
}];
[self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
[self.countButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.nameLabel);
make.right.mas_equalTo(-26);
make.height.mas_equalTo(15);
@@ -200,12 +217,35 @@
}];
[self.progressView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.progressView);
make.top.bottom.mas_equalTo(self.progressBgView);
make.top.left.bottom.mas_equalTo(self.progressBgView);
make.width.mas_equalTo(0);
}];
[self.progressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.progressView);
make.right.mas_equalTo(self.progressView.mas_right).mas_offset(-8);
make.centerX.centerY.mas_equalTo(self.progressBgView);
}];
[self.explainBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-13);
make.top.mas_equalTo(29);
make.width.mas_equalTo(111);
make.height.mas_equalTo(98);
}];
[self.explainButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(0);
make.height.mas_equalTo(43);
make.top.mas_equalTo(12);
}];
[self.devideView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(7);
make.right.mas_equalTo(-12);
make.height.mas_equalTo(1);
make.top.mas_equalTo(self.explainButton.mas_bottom);
}];
[self.exitButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(0);
make.height.mas_equalTo(43);
make.top.mas_equalTo(self.devideView.mas_bottom);
}];
}
@@ -231,32 +271,24 @@
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)moreButtonAction:(UIButton *)button {
}
- (void)setModel:(XPAnchorFansTaskModel *)model {
_model = model;
self.avatarImageView.imageUrl = model.anchorAvatar;
self.nameLabel.text = model.anchorNick;
NSString *countStr = [NSString stringWithFormat:@"·%ld人", model.teamNum];
NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
style.alignment = NSTextAlignmentJustified;
// style.firstLineHeadIndent = 5;
style.headIndent = 3.0f;
style.tailIndent = -3.0f;
}
NSAttributedString *attrText = [[NSAttributedString alloc] initWithString:countStr attributes:@{ NSParagraphStyleAttributeName : style}];
self.countLabel.numberOfLines = 1;
self.countLabel.attributedText = attrText;
- (void)setupInfo {
if (self.model) {
self.avatarImageView.imageUrl = self.model.anchorAvatar;
self.nameLabel.text = self.model.anchorNick;
[self.countButton setTitle:[NSString stringWithFormat:@"·%ld人", self.model.teamNum] forState:UIControlStateNormal];
CGFloat margin = 8;
for (int i = 0; i < model.avatarList.count; i++) {
NSString *str = model.avatarList[i];
for (int i = 0; i < self.model.avatarList.count; i++) {
NSString *str = self.model.avatarList[i];
NetImageConfig *config = [[NetImageConfig alloc] init];
config.radius = 10;
NetImageView *imageView = [[NetImageView alloc] initWithConfig:config];
imageView.imageUrl = str;
imageView.layer.cornerRadius = 10;
imageView.layer.masksToBounds = YES;
[self.stackView addSubview:imageView];
[imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.stackView);
@@ -265,14 +297,53 @@
}];
}
[self.stackView mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(model.avatarList.count * (20 + margin) + 34);
make.width.mas_equalTo(self.model.avatarList.count * (20 + margin) + 34);
}];
self.myAvatarImageView.imageUrl = model.memberAvatar;
self.intimateLabel.text = [NSString stringWithFormat:@"亲密值%ld", model.levelSeq];
self.progressLabel.text = [NSString stringWithFormat:@"%ld/%ld", model.levelExper, model.nextLevelExper];
float progress = self.model.levelExper * 1.0 / self.model.nextLevelExper;
[self.progressView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(self.progressBgView.mas_width).multipliedBy(progress);
make.top.left.bottom.mas_equalTo(self.progressBgView);
}];
self.myAvatarImageView.imageUrl = self.model.memberAvatar;
self.intimateLabel.text = [NSString stringWithFormat:@"亲密值LV%ld", self.model.levelSeq];
self.progressLabel.text = [NSString stringWithFormat:@"%ld/%ld", self.model.levelExper, self.model.nextLevelExper];
[self.tableView reloadData];
}
}
- (void)gotoFansRank:(UITapGestureRecognizer *)ges {
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
webView.url = [NSString stringWithFormat:@"%@?roomUid=%@", URLWithType(kAnchorFansRankURL), self.roomUid];
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
}
- (void)moreButtonAction:(UIButton *)button {
self.explainBgImageView.hidden = NO;
}
- (void)explainButtonAction:(UIButton *)button {
self.explainBgImageView.hidden = YES;
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
webView.url = [NSString stringWithFormat:@"%@?roomUid=%@", URLWithType(kAnchorFansRuleURL), self.roomUid];
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
}
- (void)exitButtonAction:(UIButton *)button {
self.explainBgImageView.hidden = YES;
[self.presenter outAnchorFansTeam:self.roomUid];
}
- (void)hideRuleView:(UITapGestureRecognizer *)ges {
self.explainBgImageView.hidden = YES;
}
#pragma mark - XPAnchorFansTeamProtocol
- (void)outFansTeamSuccess {
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - getter
- (UIView *)topView {
@@ -292,6 +363,8 @@
CAShapeLayer * layer = [CAShapeLayer layer];
layer.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth,454) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(12, 12)].CGPath;
_contentView.layer.mask = layer;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideRuleView:)];
[_contentView addGestureRecognizer:tap];
}
return _contentView;
}
@@ -327,26 +400,26 @@
return _nameLabel;
}
- (UILabel *)countLabel {
if (!_countLabel) {
UILabel *label = [[UILabel alloc] init];
label.textColor = UIColorFromRGB(0xFE3478);
label.textAlignment = NSTextAlignmentRight;
label.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium];
label.layer.cornerRadius = 7.5;
label.layer.masksToBounds = YES;
label.backgroundColor = [UIColor whiteColor];
_countLabel = label;
- (UIButton *)countButton {
if (!_countButton) {
_countButton = [[UIButton alloc] init];
[_countButton setTitleColor:UIColorFromRGB(0xFE3478) forState:UIControlStateNormal];
_countButton.titleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium];
_countButton.layer.cornerRadius = 7.5;
_countButton.layer.masksToBounds = YES;
[_countButton setBackgroundColor:[UIColor whiteColor]];
}
return _countLabel;
return _countButton;
}
- (UIView *)stackView {
if (!_stackView) {
_stackView = [[UIStackView alloc] init];
_stackView = [[UIView alloc] init];
_stackView.backgroundColor = [UIColor whiteColor];
_stackView.layer.cornerRadius = 14;
_stackView.layer.masksToBounds = YES;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gotoFansRank:)];
[_stackView addGestureRecognizer:tap];
}
return _stackView;
}
@@ -431,7 +504,7 @@
- (UIView *)progressBgView {
if (!_progressBgView) {
_progressBgView = [[UIStackView alloc] init];
_progressBgView = [[UIView alloc] init];
_progressBgView.backgroundColor = [ThemeColor appBackgroundColor];
_progressBgView.layer.cornerRadius = 8;
_progressBgView.layer.masksToBounds = YES;
@@ -439,15 +512,54 @@
return _progressBgView;
}
- (UIView *)progressView {
- (UIImageView *)progressView {
if (!_progressView) {
_progressView = [[UIStackView alloc] init];
_progressView.backgroundColor = [ThemeColor appBackgroundColor];
_progressView = [[UIImageView alloc] init];
[_progressView setImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFF49A3), UIColorFromRGB(0xFF2B4C)] gradientType:GradientTypeTopToBottom imgSize:CGSizeMake(10, 10)]];
_progressView.layer.cornerRadius = 8;
_progressView.layer.masksToBounds = YES;
}
return _progressView;
}
- (UIImageView *)explainBgImageView {
if (!_explainBgImageView) {
_explainBgImageView = [[UIImageView alloc] init];
_explainBgImageView.image = [UIImage imageNamed:@"anchor_fansTeam_ruleBg"];
_explainBgImageView.userInteractionEnabled = YES;
_explainBgImageView.hidden = YES;
}
return _explainBgImageView;
}
- (UIButton *)explainButton {
if (!_explainButton) {
_explainButton = [[UIButton alloc] init];
[_explainButton setTitle:@"查看粉丝团说明" forState:UIControlStateNormal];
_explainButton.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
[_explainButton setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal];
[_explainButton addTarget:self action:@selector(explainButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _explainButton;
}
- (UIButton *)exitButton {
if (!_exitButton) {
_exitButton = [[UIButton alloc] init];
[_exitButton setTitle:@"退出粉丝团" forState:UIControlStateNormal];
_exitButton.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
[_exitButton setTitleColor:UIColorFromRGB(0xFE3478) forState:UIControlStateNormal];
[_exitButton addTarget:self action:@selector(exitButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _exitButton;
}
- (UIView *)devideView {
if (!_devideView) {
_devideView = [[UIView alloc] init];
_devideView.backgroundColor = [ThemeColor appBackgroundColor];
}
return _devideView;
}
@end

View File

@@ -69,29 +69,25 @@
- (void)setModel:(XPAnchorFansRelationModel *)model {
_model = model;
if (model.isCurrentRoomAnchor) {///
if (model.hasFansTeamCurrentRoom) {//
self.titleLabel.text = [NSString stringWithFormat:@"粉丝团(%ld", model.anchorFansNum];
[self.iconImageView mas_updateConstraints:^(MASConstraintMaker *make) {
self.iconImageView.image = [UIImage imageNamed:@"anchor_fansTeam_entrance_hadOpen"];
[self.iconImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(20);
make.height.mas_equalTo(13);
make.height.mas_equalTo(14);
make.centerY.mas_equalTo(self.bgImageView);
}];
[self.bgImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.iconImageView).mas_offset(8);
}];
if (model.hasFansTeamCurrentRoom) {//
self.titleLabel.text = [NSString stringWithFormat:@"粉丝团(%ld", model.anchorFansNum];
} else {
self.titleLabel.text = @"开通粉丝团";
[self.iconImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(0);
}];
[self.bgImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.titleLabel).mas_offset(8);
}];
}
} else {
if (model.hasFansTeamCurrentRoom) {//
if (model.isAnchorFans) {
self.titleLabel.text = [NSString stringWithFormat:@"粉丝团(%ld", model.anchorFansNum];
self.iconImageView.image = [UIImage imageNamed:@"anchor_fansTeam_entrance_hadOpen"];
[self.iconImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(20);
make.height.mas_equalTo(14);

View File

@@ -39,7 +39,7 @@
///
@property (nonatomic, strong) UILabel *nameLabel;
///
@property (nonatomic, strong) UILabel *countLabel;
@property (nonatomic, strong) UIButton *countButton;
@property (nonatomic, strong) UIView *stackView;
///
@@ -89,6 +89,7 @@
[super viewDidLoad];
[self initSubViews];
[self initSubViewConstraints];
[self setupInfo];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
@@ -106,7 +107,7 @@
[self.contentView addSubview:self.helpButton];
[self.contentView addSubview:self.avatarImageView];
[self.contentView addSubview:self.nameLabel];
[self.contentView addSubview:self.countLabel];
[self.contentView addSubview:self.countButton];
[self.contentView addSubview:self.stackView];
[self.stackView addSubview:self.rankImageView];
@@ -158,10 +159,10 @@
make.height.mas_equalTo(21);
make.left.mas_equalTo(self.avatarImageView.mas_right).mas_offset(8);
make.top.mas_equalTo(self.avatarImageView).offset(6);
make.right.mas_equalTo(self.countLabel.mas_left).mas_offset(-4);
make.right.mas_equalTo(self.countButton.mas_left).mas_offset(-4);
}];
[self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
[self.countButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.nameLabel);
make.right.mas_equalTo(-26);
make.height.mas_equalTo(15);
@@ -251,37 +252,33 @@
- (void)setModel:(XPAnchorFansJoinModel *)model {
_model = model;
self.avatarImageView.imageUrl = model.anchorAvatar;
self.nameLabel.text = model.anchorNick;
NSString *countStr = [NSString stringWithFormat:@"·%ld人", model.teamNum];
NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
style.alignment = NSTextAlignmentJustified;
// style.firstLineHeadIndent = 5;
style.headIndent = 3.0f;
style.tailIndent = -3.0f;
}
NSAttributedString *attrText = [[NSAttributedString alloc] initWithString:countStr attributes:@{ NSParagraphStyleAttributeName : style}];
self.countLabel.numberOfLines = 1;
self.countLabel.attributedText = attrText;
- (void)setupInfo {
if (self.model) {
self.avatarImageView.imageUrl = self.model.anchorAvatar;
self.nameLabel.text = self.model.anchorNick;
[self.countButton setTitle:[NSString stringWithFormat:@"·%ld人", self.model.teamNum] forState:UIControlStateNormal];
XPAnchorFansPrivilegeModel *nameplateModel = model.privilegeConfigVos[0];
XPAnchorFansPrivilegeModel *nameplateModel = self.model.privilegeConfigVos[0];
self.nameplateImageView.imageUrl = nameplateModel.icon;
self.nameplateLabel.text = nameplateModel.name;
self.nameplateDescLabel.text = nameplateModel.desc;
XPAnchorFansPrivilegeModel *giftModel = model.privilegeConfigVos[1];
XPAnchorFansPrivilegeModel *giftModel = self.model.privilegeConfigVos[1];
self.giftImageView.imageUrl = giftModel.icon;
self.giftLabel.text = giftModel.name;
self.giftDescLabel.text = giftModel.desc;
XPAnchorFansPrivilegeModel *joinModel = model.privilegeConfigVos[2];
XPAnchorFansPrivilegeModel *joinModel = self.model.privilegeConfigVos[2];
self.joinLabel.text = joinModel.name;
CGFloat margin = 8;
for (int i = 0; i < model.avatarList.count; i++) {
NSString *str = model.avatarList[i];
for (int i = 0; i < self.model.avatarList.count; i++) {
NSString *str = self.model.avatarList[i];
NetImageConfig *config = [[NetImageConfig alloc] init];
config.radius = 10;
NetImageView *imageView = [[NetImageView alloc] initWithConfig:config];
imageView.layer.cornerRadius = 10;
imageView.layer.masksToBounds = YES;
imageView.imageUrl = str;
[self.stackView addSubview:imageView];
[imageView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -291,9 +288,10 @@
}];
}
[self.stackView mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(model.avatarList.count * (20 + margin) + 34);
make.width.mas_equalTo(self.model.avatarList.count * (20 + margin) + 34);
}];
}
}
#pragma mark - private
- (void)onDismiss:(UITapGestureRecognizer *)ges {
@@ -366,18 +364,16 @@
return _nameLabel;
}
- (UILabel *)countLabel {
if (!_countLabel) {
UILabel *label = [[UILabel alloc] init];
label.textColor = UIColorFromRGB(0xFE3478);
label.textAlignment = NSTextAlignmentRight;
label.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium];
label.layer.cornerRadius = 7.5;
label.layer.masksToBounds = YES;
label.backgroundColor = [UIColor whiteColor];
_countLabel = label;
- (UIButton *)countButton {
if (!_countButton) {
_countButton = [[UIButton alloc] init];
[_countButton setTitleColor:UIColorFromRGB(0xFE3478) forState:UIControlStateNormal];
_countButton.titleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium];
_countButton.layer.cornerRadius = 7.5;
_countButton.layer.masksToBounds = YES;
[_countButton setBackgroundColor:[UIColor whiteColor]];
}
return _countLabel;
return _countButton;
}
- (UIView *)stackView {

View File

@@ -475,6 +475,8 @@
default:
break;
}
} else if (attachment.first == CustomMessageType_Anchor_FansTeam) {
[self handleAnchorFansTeam:attachment];
}
}
}
@@ -634,24 +636,17 @@
return;
}
NSString *roomUid = [NSString stringWithFormat:@"%zd", self.delegate.getRoomInfo.uid];
RoomInfoModel *roomInfo = self.delegate.getRoomInfo;
// if (!self.relationFansModel) {
// [Api requestInRoomFansTeam:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
// XPAnchorFansRelationModel *model = [XPAnchorFansRelationModel modelWithJSON:data.data];
// [self updateFansTeamEntranceView:model];
// } teamUid:[NSString stringWithFormat:@"%ld", roomInfo.uid]];
// return;
// }
if (self.relationFansModel.isCurrentRoomAnchor) {///
XPWebViewController * webVC =[[XPWebViewController alloc] init];
if (self.relationFansModel.hasFansTeamCurrentRoom) {
webVC.url = URLWithType(kAnchorFansListURL);
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
webView.url = [NSString stringWithFormat:@"%@?roomUid=%@", URLWithType(kAnchorFansListURL), roomUid];
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
} else {
webVC.url = URLWithType(kAnchorFansOpenURL);
}
XPWebViewController * webVC =[[XPWebViewController alloc] init];
webVC.roomUid = roomUid;
webVC.url = URLWithType(kAnchorFansOpenURL);
[self.delegate.getCurrentNav pushViewController:webVC animated:YES];
}
} else {
if (self.relationFansModel.hasFansTeamCurrentRoom) {//
if (self.relationFansModel.isAnchorFans) {
@@ -825,29 +820,32 @@
#pragma mark -
- (void)updateFansTeamEntranceView:(XPAnchorFansRelationModel *)model {
// RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
// roomInfo.anchorFansRedDot = model.isRedPop;
// if ([[[AccountInfoStorage instance] getUid] integerValue] == roomInfo.uid) {///
// if (model.hasFansTeamCurrentRoom) {//
// self.fansTeamEntranceView.title = [NSString stringWithFormat:@"粉丝团(%ld", model.anchorFansNum];
// } else {
// self.fansTeamEntranceView.title = @"开通粉丝团";
// }
// } else {
// if (model.hasFansTeamCurrentRoom) {//
// if (model.isAnchorFans) {
// self.fansTeamEntranceView.title = [NSString stringWithFormat:@"粉丝团(%ld", model.anchorFansNum];
// } else {
// self.fansTeamEntranceView.title = @"加入我的粉丝团吧~";
// }
// } else {
// self.fansTeamEntranceView.title = @"该主播暂未开通粉丝团";
// }
// }
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
self.fansTeamEntranceView.hidden = roomInfo.type != RoomType_Anchor;
self.fansTeamEntranceView.model = model;
self.relationFansModel = model;
}
- (void)handleAnchorFansTeam:(AttachmentModel *)attachment {
if (attachment.second == Custom_Message_Sub_FansTeam_Open_Success || attachment.second == Custom_Message_Sub_FansTeam_Join_Success || attachment.second == Custom_Message_Sub_FansTeam_Out_Success) {
NSString *roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
NSString *uid;
if ([attachment.data[@"uid"] isKindOfClass:[NSNumber class]]) {
uid = [NSString stringWithFormat:@"%@", attachment.data[@"uid"]];
} else if ([attachment.data[@"uid"] isKindOfClass:[NSString class]]) {
uid = attachment.data[@"uid"];
}
if ([uid isEqualToString:[AccountInfoStorage instance].getUid] || [uid isEqualToString:roomUid]) {
[Api requestInRoomFansTeam:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
XPAnchorFansRelationModel *model = [XPAnchorFansRelationModel modelWithJSON:data.data];
[self updateFansTeamEntranceView:model];
} teamUid:roomUid];
}
} else if (attachment.second == Custom_Message_Sub_FansTeam_Open_Fail) {
}
}
#pragma mark - XPRoomLittleGameListViewDelegate
- (void)xPRoomLittleGameListView:(XPLittleGameRoomListView *)view didSelectItem:(LittleGameInfoModel *)itemInfo {
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
@@ -943,6 +941,7 @@
- (XPAnchorFansTeamEntranceView *)fansTeamEntranceView {
if (!_fansTeamEntranceView) {
_fansTeamEntranceView = [[XPAnchorFansTeamEntranceView alloc]init];
_fansTeamEntranceView.hidden = YES;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapFansTeamRecognizer)];
[_fansTeamEntranceView addGestureRecognizer:tap];
}

View File

@@ -93,6 +93,8 @@
return [self createRoomFaceAttribute:attachment];
} else if (first == CustomMessageType_Tarot) {//
return [self createTarotAttribute:attachment];
} else if (first == CustomMessageType_Anchor_FansTeam) {//
return [self createAnchorFansTeamAttribute:attachment];
}
return nil;
}
@@ -408,6 +410,36 @@
return attribute;
}
#pragma mark -
- (NSAttributedString *)createAnchorFansTeamAttribute:(AttachmentModel *)attachment {
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
NSInteger uid = 0;
if ([attachment.data[@"uid"] isKindOfClass:[NSNumber class]]) {
uid = ((NSNumber *)attachment.data[@"uid"]).integerValue;
} else if ([attachment.data[@"uid"] isKindOfClass:[NSString class]]) {
uid = ((NSString *)attachment.data[@"uid"]).integerValue;
}
NSString *idString = [NSString stringWithFormat:@"%ld", uid];
NSString *nickName = attachment.data[@"nickName"];
if ([idString isEqualToString:[[AccountInfoStorage instance] getUid]]) {
nickName = @"您";
}
if (attachment.second == Custom_Message_Sub_FansTeam_Open_Success) {///
[attribute appendAttributedString:[self createTextAttribute:@"恭喜" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:nickName color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:@"开通粉丝团成功" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
} else if (attachment.second == Custom_Message_Sub_FansTeam_Join_Success) {///
[attribute appendAttributedString:[self createTextAttribute:@"恭喜" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:nickName color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:@"加入粉丝团" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
} else if (attachment.second == Custom_Message_Sub_FansTeam_Out_Success) {//退
[attribute appendAttributedString:[self createTextAttribute:nickName color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:@"已退出粉丝团" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
}
[self attributeAddHihtLight:attribute uid:uid];
return attribute;
}
#pragma mark - //
- (NSAttributedString *)createKickUserAttribute:(AttachmentModel *)attachment info:(XPKickUserModel *)info {
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];

View File

@@ -280,6 +280,13 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
[NSSet setWithObjects:
@(Custom_Message_Sub_Face_Send),
nil],
@(CustomMessageType_Anchor_FansTeam):
[NSSet setWithObjects:
@(Custom_Message_Sub_FansTeam_Open_Success),
@(Custom_Message_Sub_FansTeam_Open_Fail),
@(Custom_Message_Sub_FansTeam_Join_Success),
@(Custom_Message_Sub_FansTeam_Out_Success),
nil],
};
}

View File

@@ -151,7 +151,12 @@ NSString * const kCloseWebView = @"closeWebView";
[self.webview evaluateJavaScript:@"document.location.href" completionHandler:^(id _Nullable response, NSError * _Nullable error) {
NSLog(@"%@", response);
NSString *currentUrl = [NSString stringWithFormat:@"%@", response];
///host,便h5
#ifdef DEBUG
if (currentUrl != nil) {
#else
if (currentUrl != nil && [currentUrl containsString:API_HOST_URL]) {
#endif
if ([message.name isEqualToString:kJSOpenSharePage]) {
if (message.body && message.body != [NSNull null]) {
NSDictionary *body;