Commit 931163fc by suolong

更新陪伴中和试看的userlist

parent 41ac5dbe
Showing with 586 additions and 49 deletions
......@@ -112,5 +112,83 @@
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "4B4C9D12-5F36-4B96-BE77-C1250DFEBE1B"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/View/Push/LiveStartView/FUSLiveStartSetPrivacyView.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "355"
endingLineNumber = "355"
landmarkName = "FUSLiveStartSetPrivacyView"
landmarkType = "3">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "B74BD247-B090-42F6-B87A-B0E8C990E91A"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Controller/FUSLiveMainViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "741"
endingLineNumber = "741"
landmarkName = "-initPushPrepareView"
landmarkType = "7">
<Locations>
<Location
uuid = "B74BD247-B090-42F6-B87A-B0E8C990E91A - 1b41df9b0d1316b3"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "__48-[FUSLiveMainViewController initPushPrepareView]_block_invoke_3"
moduleName = "FuSiLive"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Volumes/MovingDrive/fusi/Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Controller/FUSLiveMainViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "742"
endingLineNumber = "742">
</Location>
<Location
uuid = "B74BD247-B090-42F6-B87A-B0E8C990E91A - 1b41df9b0d1316fa"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "__48-[FUSLiveMainViewController initPushPrepareView]_block_invoke_4"
moduleName = "FuSiLive"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Volumes/MovingDrive/fusi/Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Controller/FUSLiveMainViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "744"
endingLineNumber = "744">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "F4BE1479-4F1D-4880-9016-00D4F7B4CCA0"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/View/FunctionView/PayRoom/FUSPayRoomViewerListView.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "94"
endingLineNumber = "94"
landmarkName = "-fus_loadData"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
......@@ -1780,6 +1780,10 @@
00F0A0132F5F0A1B00C0FFEE /* FusAnchorPayRoomView.h in Headers */ = {isa = PBXBuildFile; fileRef = 00F0A0112F5F0A1B00C0FFEE /* FusAnchorPayRoomView.h */; };
00F0A0142F5F0A1B00C0FFEE /* FusAnchorPayRoomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 00F0A0122F5F0A1B00C0FFEE /* FusAnchorPayRoomView.m */; };
BEEAB2632D34CC60008CD059 /* FUSLiveStartSetPrivacyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEEAB2612D34CC60008CD059 /* FUSLiveStartSetPrivacyView.swift */; };
A1B2C3D4E5F60718293A4B6C /* FUSPayRoomViewerPopView.h in Headers */ = {isa = PBXBuildFile; fileRef = A1B2C3D4E5F60718293A4B6A /* FUSPayRoomViewerPopView.h */; };
A1B2C3D4E5F60718293A4B6D /* FUSPayRoomViewerPopView.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3D4E5F60718293A4B6B /* FUSPayRoomViewerPopView.m */; };
A1B2C3D4E5F60718293A4B8B /* FUSPayRoomViewerListView.h in Headers */ = {isa = PBXBuildFile; fileRef = A1B2C3D4E5F60718293A4B7C /* FUSPayRoomViewerListView.h */; };
A1B2C3D4E5F60718293A4B8D /* FUSPayRoomViewerListView.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3D4E5F60718293A4B7D /* FUSPayRoomViewerListView.m */; };
BEEAB2642D34CC60008CD059 /* FUSLiveStartContentWarningView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEEAB2602D34CC60008CD059 /* FUSLiveStartContentWarningView.swift */; };
BEEAB2652D34CC60008CD059 /* FUSLiveStartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEEAB2622D34CC60008CD059 /* FUSLiveStartView.swift */; };
BEEAB2662D34CC60008CD059 /* FUSLiveStartBeautyFavoritesEditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEEAB2552D34CC60008CD059 /* FUSLiveStartBeautyFavoritesEditView.swift */; };
......@@ -4136,6 +4140,10 @@
BEEAB2522D3380FA008CD059 /* FusAnchorRewardView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FusAnchorRewardView.m; sourceTree = "<group>"; };
00F0A0112F5F0A1B00C0FFEE /* FusAnchorPayRoomView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FusAnchorPayRoomView.h; sourceTree = "<group>"; };
00F0A0122F5F0A1B00C0FFEE /* FusAnchorPayRoomView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FusAnchorPayRoomView.m; sourceTree = "<group>"; };
A1B2C3D4E5F60718293A4B6A /* FUSPayRoomViewerPopView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSPayRoomViewerPopView.h; sourceTree = "<group>"; };
A1B2C3D4E5F60718293A4B6B /* FUSPayRoomViewerPopView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSPayRoomViewerPopView.m; sourceTree = "<group>"; };
A1B2C3D4E5F60718293A4B7C /* FUSPayRoomViewerListView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSPayRoomViewerListView.h; sourceTree = "<group>"; };
A1B2C3D4E5F60718293A4B7D /* FUSPayRoomViewerListView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSPayRoomViewerListView.m; sourceTree = "<group>"; };
BEEAB2552D34CC60008CD059 /* FUSLiveStartBeautyFavoritesEditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FUSLiveStartBeautyFavoritesEditView.swift; sourceTree = "<group>"; };
BEEAB2562D34CC60008CD059 /* FUSLiveStartBeautyFavoritesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FUSLiveStartBeautyFavoritesView.swift; sourceTree = "<group>"; };
BEEAB2572D34CC60008CD059 /* FUSLiveStartBeautySetItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FUSLiveStartBeautySetItemView.swift; sourceTree = "<group>"; };
......@@ -7734,6 +7742,10 @@
children = (
00F0A0112F5F0A1B00C0FFEE /* FusAnchorPayRoomView.h */,
00F0A0122F5F0A1B00C0FFEE /* FusAnchorPayRoomView.m */,
A1B2C3D4E5F60718293A4B6A /* FUSPayRoomViewerPopView.h */,
A1B2C3D4E5F60718293A4B6B /* FUSPayRoomViewerPopView.m */,
A1B2C3D4E5F60718293A4B7C /* FUSPayRoomViewerListView.h */,
A1B2C3D4E5F60718293A4B7D /* FUSPayRoomViewerListView.m */,
);
path = PayRoom;
sourceTree = "<group>";
......@@ -8764,6 +8776,8 @@
BED658DE2C5B745E00668116 /* FUSAudiencePopView.h in Headers */,
BEEAB2532D3380FA008CD059 /* FusAnchorRewardView.h in Headers */,
00F0A0132F5F0A1B00C0FFEE /* FusAnchorPayRoomView.h in Headers */,
A1B2C3D4E5F60718293A4B6C /* FUSPayRoomViewerPopView.h in Headers */,
A1B2C3D4E5F60718293A4B8B /* FUSPayRoomViewerListView.h in Headers */,
BED65A572C5B745F00668116 /* FUSLiveTreasureBoxRecordDetailView.h in Headers */,
BED658C02C5B745E00668116 /* FUSLiveHalfWebViewCatalogueView.h in Headers */,
BED65A542C5B745F00668116 /* FUSLiveTreasureBoxListIconView.h in Headers */,
......@@ -10703,6 +10717,8 @@
BED65A2E2C5B745F00668116 /* FUSLiveShareHttpHelper.m in Sources */,
BEEAB2542D3380FA008CD059 /* FusAnchorRewardView.m in Sources */,
00F0A0142F5F0A1B00C0FFEE /* FusAnchorPayRoomView.m in Sources */,
A1B2C3D4E5F60718293A4B6D /* FUSPayRoomViewerPopView.m in Sources */,
A1B2C3D4E5F60718293A4B8D /* FUSPayRoomViewerListView.m in Sources */,
BED65ABF2C5B745F00668116 /* FUSHomeNovaListBroadcastHelper.m in Sources */,
BED6598C2C5B745E00668116 /* FUSLiveDewIncreaseView.m in Sources */,
BE189DE22C733B460008418B /* FSRSettingOnlineViewController.m in Sources */,
......@@ -19,6 +19,7 @@ FOUNDATION_EXPORT const unsigned char FUSShowRoomModuleVersionString[];
#import "FUSLiveHttpHelper.h"
#import "FUSShowRoomCenterBunble.h"
#import "FUSShowRoomURLs.h"
#import "FUSPayRoomViewerPopView.h"
#import "FUSCheckInDayRewardModel.h"
#import "FUSCheckInRewardItemModel.h"
......
......@@ -938,12 +938,6 @@ typedef NS_ENUM(NSInteger, FUSStreamState) {
}];
FUSSwiftLiveHelper.shared.roomInfoModel.channelId = [dict[@"channelId"] description];
if (![NSString isNull:roundId]) {
FUSSwiftLiveHelper.shared.roomInfoModel.roundId = roundId;
[FUSLiveHelper shareInstance].roomInfoModel.roundId = roundId;
}
[[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveUDKeys.fus_IS_JOIN_ROOM_SUCCESS object:@(YES)];
__weak typeof(self) weakSelf = self;
......
......@@ -25,6 +25,7 @@
@property (nonatomic, copy) NSString *isdisplay; // 是否显示(是否机器人)(0:否、1:是)
@property (nonatomic, copy) NSString *isHide; //是否是神秘人
@property (nonatomic, copy) NSString *isVip; //是否是神秘人
@property (nonatomic, copy) NSString *realLevel; //真实的等级
@property (nonatomic, copy) NSString *realUid; //真实的uid
......@@ -34,6 +35,7 @@
/// 是否付费(0:未付费、1:已付费)
@property (nonatomic, assign) BOOL inPay;
/// 拥有宝石(0:无、1:有)
@property (nonatomic, assign) BOOL haveGem;
......
......@@ -10,6 +10,22 @@
@implementation FUSOnlineUserModel
+ (NSDictionary *)modelCustomPropertyMapper {
return @{
@"nickname": @[@"nickname", @"nickeName"],
@"isHide": @[@"isHide", @"inHide"],
@"lev": @[@"lev", @"level"]
};
}
- (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
if (![self.privilege isKindOfClass:NSDictionary.class]) {
NSInteger richPower = self.isVip.integerValue > 0 ? 1 : 0;
self.privilege = @{@"richPower": @(richPower)};
}
return YES;
}
- (instancetype)init {
self = [super init];
if (self) {
......
......@@ -1073,6 +1073,23 @@ NS_ASSUME_NONNULL_BEGIN
cancel:(NSString *)cancel
succeed:(void (^)(NSDictionary *dataDict))succeed
failure:(void(^)(NSString *msg,NSInteger code))failure;
/// 视图-获取用户列表:陪伴中、试看中
/// @param uid 用户ID
/// @param roomId 房间ID
/// @param channelId 直播频道ID
/// @param roundId 付费房回合ID
/// @param listType 表单类型0陪伴中列表 1试看中列表
/// @param page 页数
/// @param failure 0
+(void)fus_requestGetPayRoomUserLisWithUid:(NSString *)uid
RoomId:(NSString *)roomId
channelId:(NSString *)channelId
roundId:(NSString *)roundId
listType:(NSString *)listType
page:(NSString *)page
succeed:(void (^)(NSDictionary *dataDict))succeed
failure:(void(^)(NSString *msg,NSInteger code))failure;
@end
......
......@@ -2821,11 +2821,7 @@
[FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_Live_Before_GetLiveInfo params:@{} success:^(NSDictionary * _Nullable dataDict, int code) {
NSDictionary *liveGasStation = dataDict[@"liveGasStation"];
// roundId:付费房回合ID。用于“开播前/恢复直播”的场景同步当前回合,后续付费房数据请求会依赖该值进行准确匹配。
NSString *roundId = [dataDict[@"roundId"] description];
if (![NSString isNull:roundId] && FUSLiveHelper.shareInstance.roomInfoModel) {
FUSLiveHelper.shareInstance.roomInfoModel.roundId = roundId;
}
if (succeed) succeed(liveGasStation[@"publicizeConfig"],
liveGasStation[@"gasStationConfig"]);
......@@ -3002,4 +2998,37 @@
if (failure) failure(dataDict[@"msg"],code);
}];
}
/// 视图-获取用户列表:陪伴中、试看中
/// @param uid 用户ID
/// @param roomId 房间ID
/// @param channelId 直播频道ID
/// @param roundId 付费房回合ID
/// @param listType 表单类型0陪伴中列表 1试看中列表
/// @param page 页数
/// @param failure 0
+(void)fus_requestGetPayRoomUserLisWithUid:(NSString *)uid
RoomId:(NSString *)roomId
channelId:(NSString *)channelId
roundId:(NSString *)roundId
listType:(NSString *)listType
page:(NSString *)page
succeed:(void (^)(NSDictionary *dataDict))succeed
failure:(void(^)(NSString *msg,NSInteger code))failure
{
NSDictionary *parm = @{@"uid": uid,
@"roomId":roomId,
@"channelId":channelId,
@"roundId":roundId,
@"listType":listType,
@"page":page};
[FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_liveGetPayRoomUserList params:parm success:^(NSDictionary * _Nullable dataDict, int code) {
if (succeed) {
succeed(dataDict);
}
}failure:^(NSDictionary * _Nullable dataDict, int code) {
if (failure) failure(dataDict[@"msg"],code);
}];
}
@end
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface FUSPayRoomViewerListView : UIView
@property (nonatomic, copy) void(^clickUserHandler)(NSDictionary *userDict);
@property (nonatomic, copy) void(^totalUserChangedHandler)(NSInteger total);
- (void)showUserListWithListType:(NSInteger)listType;
@end
NS_ASSUME_NONNULL_END
#import "FUSPayRoomViewerListView.h"
#import "FUSAudienceTableViewCell.h"
#import "FUSLiveHelper.h"
#import "FUSLiveHttpHelper.h"
@interface FUSPayRoomViewerListView () <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) FUSEmptyView *emptyView;
@property (nonatomic, strong) NSMutableArray<FUSOnlineUserModel *> *userList;
@property (nonatomic, strong) NSMutableSet<NSString *> *userIdSet;
@property (nonatomic, assign) NSInteger page;
@property (nonatomic, assign) NSInteger listType;
@end
@implementation FUSPayRoomViewerListView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.tableView = [[UITableView alloc] initWithFrame:self.bounds style:UITableViewStylePlain];
self.tableView.backgroundColor = [UIColor fus_appBGColor];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.rowHeight = 60;
self.tableView.tableFooterView = [[UIView alloc] init];
[self.tableView registerClass:[FUSAudienceTableViewCell class] forCellReuseIdentifier:[FUSAudienceTableViewCell cellIdentifer]];
[self addSubview:self.tableView];
self.userList = [NSMutableArray array];
self.userIdSet = [NSMutableSet set];
self.emptyView = [[FUSEmptyView alloc] initWithFrame:CGRectMake(0, 0, UIView.fus_screenW, 400)];
self.emptyView.contentAligment = FUSEmptyViewAligmentCenter;
[self.emptyView fus_setEmptyViewIcon:UIImage.fus_emptyImg title:[NSString fus_localString:@"暂无数据"] buttonTittle:nil];
self.emptyView.imageScale = 0.3;
self.emptyView.contentVerticalOffset = -20;
self.emptyView.backgroundColor = [UIColor clearColor];
__weak typeof(self) weakSelf = self;
self.tableView.mj_header = [FUSRefreshHeader headerWithRefreshingBlock:^{
[weakSelf fus_reloadData];
}];
self.tableView.mj_footer = [FUSRefreshAutoFooter footerWithRefreshingBlock:^{
[weakSelf fus_loadMoreData];
}];
}
return self;
}
- (void)layoutSubviews {
[super layoutSubviews];
self.tableView.frame = self.bounds;
}
- (void)showUserListWithListType:(NSInteger)listType {
self.listType = MAX(0, MIN(1, listType));
[self fus_reloadData];
}
- (void)fus_reloadData {
self.page = 1;
[self fus_loadData];
}
- (void)fus_loadMoreData {
self.page++;
[self fus_loadData];
}
- (void)fus_loadData {
NSString *uid = [[FUSCacheDataShare shareStore].userVerifyInfo.uid description];
FUSRoomInfoModel *roomInfoModel = [FUSLiveHelper shareInstance].roomInfoModel;
NSString *roomId = [roomInfoModel.roomId description];
NSString *channelId = [roomInfoModel.channelId description];
NSString *roundId = [roomInfoModel.roundId description];
if ([NSString isNull:roundId]) {
roundId = @"";
}
if ([NSString isNull:uid] || [NSString isNull:roomId] || [NSString isNull:channelId]) {
[self.tableView.mj_header endRefreshing];
[self.tableView.mj_footer endRefreshing];
return;
}
__weak typeof(self) weakSelf = self;
[FUSLiveHttpHelper fus_requestGetPayRoomUserLisWithUid:uid RoomId:roomId channelId:channelId roundId:roundId listType:[NSString stringWithFormat:@"%zd", self.listType] page:[NSString stringWithFormat:@"%zd", self.page] succeed:^(NSDictionary *dataDict) {
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) {
return;
}
NSDictionary *payload = [dataDict[@"data"] isKindOfClass:NSDictionary.class] ? dataDict[@"data"] : dataDict;
NSInteger respPage = [payload[@"page"] integerValue];
if (respPage > 0) {
strongSelf.page = respPage;
}
NSInteger total = [payload[@"total"] integerValue];
NSArray *list = [payload[@"list"] isKindOfClass:NSArray.class] ? payload[@"list"] : @[];
if (strongSelf.page <= 1) {
[strongSelf.userList removeAllObjects];
[strongSelf.userIdSet removeAllObjects];
}
NSMutableArray<FUSOnlineUserModel *> *newUsers = [NSMutableArray array];
for (NSDictionary *userDict in list) {
FUSOnlineUserModel *model = [FUSOnlineUserModel fus_modelWithDict:userDict];
if (model.uid.length <= 0) {
continue;
}
if ([strongSelf.userIdSet containsObject:model.uid]) {
continue;
}
[strongSelf.userIdSet addObject:model.uid];
[newUsers addObject:model];
}
[strongSelf.userList addObjectsFromArray:newUsers];
if (strongSelf.userList.count > 0) {
strongSelf.tableView.tableFooterView = [[UIView alloc] init];
} else {
strongSelf.tableView.tableFooterView = strongSelf.emptyView;
[strongSelf.tableView.mj_footer endRefreshingWithNoMoreData];
}
[strongSelf.tableView reloadData];
if (strongSelf.totalUserChangedHandler) {
strongSelf.totalUserChangedHandler(total > 0 ? total : strongSelf.userList.count);
}
[strongSelf.tableView.mj_header endRefreshing];
if (newUsers.count == 0) {
[strongSelf.tableView.mj_footer endRefreshingWithNoMoreData];
} else {
[strongSelf.tableView.mj_footer endRefreshing];
}
} failure:^(NSString *msg, NSInteger code) {
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) {
return;
}
[strongSelf.tableView.mj_header endRefreshing];
[strongSelf.tableView.mj_footer endRefreshing];
if (![NSString isNull:msg]) {
[FUSDialogView fus_showDialog:msg];
}
}];
}
#pragma mark - UITableViewDelegate, UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.userList.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
FUSAudienceTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[FUSAudienceTableViewCell cellIdentifer] forIndexPath:indexPath];
cell.userModel = self.userList[indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if (self.clickUserHandler && indexPath.row < self.userList.count) {
self.clickUserHandler(self.userList[indexPath.row].fus_getDictionary);
}
}
@end
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface FUSPayRoomViewerPopView : UIView
@property (nonatomic, copy) void(^clickUserHandler)(NSDictionary *userDict);
+ (FUSPayRoomViewerPopView *)fus_showPayRoomViewerPopViewWithRootView:(UIView *)rootView;
+ (FUSPayRoomViewerPopView *)fus_showWithRootView:(UIView *)rootView;
+ (FUSPayRoomViewerPopView *)fus_showWithRootView:(UIView *)rootView startIndex:(NSInteger)startIndex;
- (void)fus_dismissView;
@end
NS_ASSUME_NONNULL_END
#import "FUSPayRoomViewerPopView.h"
#import "FUSSegmentControlView.h"
#import "FUSShowRoomCenterBunble.h"
#import "FUSPayRoomViewerListView.h"
@interface FUSPayRoomViewerPopView () <UIScrollViewDelegate>
@property (nonatomic, strong) UIButton *bgBtn;
@property (nonatomic, strong) UIView *contentView;
@property (nonatomic, strong) UIButton *closeBtn;
@property (nonatomic, strong) FUSSegmentControlView *segmentView;
@property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, strong) FUSPayRoomViewerListView *accompanyUserView;
@property (nonatomic, strong) FUSPayRoomViewerListView *trialUserView;
@property (nonatomic, assign) NSInteger startIndex;
@end
@implementation FUSPayRoomViewerPopView
+ (FUSPayRoomViewerPopView *)fus_showPayRoomViewerPopViewWithRootView:(UIView *)rootView {
return [self fus_showWithRootView:rootView];
}
+ (FUSPayRoomViewerPopView *)fus_showWithRootView:(UIView *)rootView {
return [self fus_showWithRootView:rootView startIndex:0];
}
+ (FUSPayRoomViewerPopView *)fus_showWithRootView:(UIView *)rootView startIndex:(NSInteger)startIndex {
if (!rootView) {
return nil;
}
for (UIView *subview in rootView.subviews) {
if ([subview isKindOfClass:[FUSPayRoomViewerPopView class]]) {
FUSPayRoomViewerPopView *existView = (FUSPayRoomViewerPopView *)subview;
[rootView bringSubviewToFront:existView];
NSInteger index = MAX(0, MIN(1, startIndex));
[existView.segmentView fus_setSelectedItem:index autoCallBack:YES];
[existView fus_showUserList];
return existView;
}
}
FUSPayRoomViewerPopView *popView = [[FUSPayRoomViewerPopView alloc] initWithFrame:UIView.fus_screenFrame];
popView.startIndex = MAX(0, MIN(1, startIndex));
[rootView addSubview:popView];
[popView.segmentView fus_setSelectedItem:popView.startIndex autoCallBack:YES];
[popView fus_showUserList];
return popView;
}
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.bgBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.bgBtn.frame = self.bounds;
[self.bgBtn addTarget:self action:@selector(fus_dismissView) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:self.bgBtn];
self.contentView = [[UIView alloc] initWithFrame:CGRectMake(0, UIView.fus_screenH, UIView.fus_screenW, 632)];
self.contentView.backgroundColor = UIColor.whiteColor;
[self.contentView addRoundedCorners:UIRectCornerTopLeft|UIRectCornerTopRight withRadii:CGSizeMake(16, 16)];
[self addSubview:self.contentView];
self.closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[self.closeBtn setImage:[FUSShowRoomCenterBunble imageNamed:@"live_board_close"] forState:UIControlStateNormal];
self.closeBtn.frame = CGRectMake(UIView.fus_screenW - 44, 0, 44, 44);
[self.closeBtn addTarget:self action:@selector(fus_dismissView) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:self.closeBtn];
self.segmentView = [[FUSSegmentControlView alloc] initWithFrame:CGRectMake(19, 0, UIView.fus_screenW - 70, 44) withItems:@[[NSString fus_localString:@"陪伴中"], [NSString fus_localString:@"试看中"]]];
self.segmentView.space = 27;
self.segmentView.alignment = FUSSegmentControlAlignmentLeft;
[self.segmentView fus_setUnderLineSelectedImage:UIImage.fus_segmentSelected];
[self.contentView addSubview:self.segmentView];
__weak typeof(self) weakSelf = self;
self.segmentView.selectItemBlock = ^(NSInteger index, NSString * _Nonnull itemText) {
weakSelf.scrollView.contentOffset = CGPointMake(index * weakSelf.scrollView.width, 0);
};
self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, self.segmentView.bottom, self.width, self.contentView.height - self.segmentView.height)];
self.scrollView.contentSize = CGSizeMake(self.width * 2, self.scrollView.height);
self.scrollView.showsVerticalScrollIndicator = NO;
self.scrollView.showsHorizontalScrollIndicator = NO;
self.scrollView.pagingEnabled = YES;
self.scrollView.delegate = self;
[self.contentView addSubview:self.scrollView];
self.accompanyUserView = [[FUSPayRoomViewerListView alloc] initWithFrame:self.scrollView.bounds];
self.accompanyUserView.clickUserHandler = ^(NSDictionary * _Nonnull userDict) {
if (weakSelf.clickUserHandler) {
weakSelf.clickUserHandler(userDict);
}
[weakSelf fus_dismissView];
};
[self.scrollView addSubview:self.accompanyUserView];
self.trialUserView = [[FUSPayRoomViewerListView alloc] initWithFrame:self.scrollView.bounds];
self.trialUserView.x = self.scrollView.width;
self.trialUserView.clickUserHandler = ^(NSDictionary * _Nonnull userDict) {
if (weakSelf.clickUserHandler) {
weakSelf.clickUserHandler(userDict);
}
[weakSelf fus_dismissView];
};
[self.scrollView addSubview:self.trialUserView];
}
return self;
}
- (void)fus_showUserList {
__weak typeof(self) weakSelf = self;
self.accompanyUserView.totalUserChangedHandler = ^(NSInteger total) {
[weakSelf.segmentView fus_setImageForIndex:0 title:[NSString stringWithFormat:@"%@ %zd", [NSString fus_localString:@"陪伴中"], total]];
};
[self.accompanyUserView showUserListWithListType:0];
self.trialUserView.totalUserChangedHandler = ^(NSInteger total) {
[weakSelf.segmentView fus_setImageForIndex:1 title:[NSString stringWithFormat:@"%@ %zd", [NSString fus_localString:@"试看中"], total]];
};
[self.trialUserView showUserListWithListType:1];
[self.segmentView fus_setSelectedItem:self.startIndex autoCallBack:YES];
[UIView animateWithDuration:0.3 animations:^{
self.contentView.bottom = UIView.fus_screenH;
}];
}
- (void)fus_dismissView {
[UIView animateWithDuration:0.3 animations:^{
self.contentView.top = UIView.fus_screenH;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
#pragma mark - UIScrollViewDelegate
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
NSInteger page = scrollView.contentOffset.x / scrollView.width;
[self.segmentView fus_setSelectedItem:page autoCallBack:NO];
}
@end
......@@ -11,6 +11,7 @@
#import "FUSLiveHelper.h"
#import "FUSLiveHttpHelper.h"
#import "FUSPayRoomViewerPopView.h"
@interface FUSPayRoomPayViewingData : FUSBaseModel
@property (nonatomic, copy) NSString *payViewingNum;
......@@ -69,6 +70,7 @@
@property (nonatomic, strong) UIView *statsBackgroundView;
@property (nonatomic, strong) UIView *statsSeparatorView1;
@property (nonatomic, strong) UIView *statsSeparatorView2;
@property (nonatomic, strong) UIButton *statsTapButton;
@property (nonatomic, assign) BOOL didRequestPayRoomData;
@property (nonatomic, assign) BOOL isRequestingPayRoomData;
......@@ -106,9 +108,9 @@
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_recieveGiftChangeNotification:) name:STR(ROOM_CID_GIFT_CHANGE) object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_recieveSomeoneEnterRoomNotification:) name:STR(ROOM_CID_SOMEBODY_JOIN) object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_recieveSomeoneExitRoomNotification:) name:STR(ROOM_CID_EXIT) object:nil];
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_recieveGiftChangeNotification:) name:STR(ROOM_CID_GIFT_CHANGE) object:nil];
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_recieveSomeoneEnterRoomNotification:) name:STR(ROOM_CID_SOMEBODY_JOIN) object:nil];
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_recieveSomeoneExitRoomNotification:) name:STR(ROOM_CID_EXIT) object:nil];
self.backgroundColor = UIColor.clearColor;
self.clipsToBounds = NO;
......@@ -169,6 +171,10 @@
[self.statsBackgroundView addSubview:label];
}
self.statsTapButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.statsTapButton addTarget:self action:@selector(fus_clickStatsAction:forEvent:) forControlEvents:UIControlEventTouchUpInside];
[self.statsBackgroundView addSubview:self.statsTapButton];
self.statsSeparatorView1 = [[UIView alloc] initWithFrame:CGRectMake(10, itemH, statsW - 20, 0.5)];
self.statsSeparatorView1.backgroundColor = [UIColor colorWithWhite:1 alpha:0.15];
[self.statsBackgroundView addSubview:self.statsSeparatorView1];
......@@ -230,6 +236,7 @@
self.accompanyLabel.frame = CGRectMake(9, 0, statsW - 9, itemH);
self.trialLabel.frame = CGRectMake(9, itemH, statsW - 9, itemH);
self.incomeLabel.frame = CGRectMake(9, itemH * 2.0, statsW - 9, itemH);
self.statsTapButton.frame = self.statsBackgroundView.bounds;
self.statsSeparatorView1.frame = CGRectMake(10, itemH, statsW - 20, 0.5);
self.statsSeparatorView2.frame = CGRectMake(10, itemH * 2.0, statsW - 20, 0.5);
......@@ -239,6 +246,23 @@
self.coverBtn.frame = self.bounds;
}
- (void)fus_clickStatsAction:(UIButton *)sender forEvent:(UIEvent *)event {
UITouch *touch = event.allTouches.anyObject;
if (!touch) {
return;
}
CGPoint point = [touch locationInView:self.statsBackgroundView];
CGFloat itemH = self.statsBackgroundView.height / 3.0;
NSInteger startIndex = 0;
if (point.y >= itemH && point.y < itemH * 2.0) {
startIndex = 1;
}
UIView *rootView = [[FUSLiveHelper shareInstance].currentFunctionView fus_viewWithLayer:FUSLiveFunctionLayerManualPopView];
[FUSPayRoomViewerPopView fus_showWithRootView:rootView startIndex:startIndex];
}
- (void)fus_requestPayRoomDataIfNeeded {
[self fus_requestPayRoomDataWithForce:NO];
}
......@@ -356,9 +380,6 @@
- (void)fus_refreshContentTexts {
NSString *accompanyValue = [self.payRoomDataModel.payViewingData.payViewingNum description];
if ([NSString isNull:accompanyValue]) {
accompanyValue = [[FUSLiveHelper shareInstance].roomInfoModel.num description];
}
if ([NSString isNull:accompanyValue]) {
accompanyValue = @"0";
}
......@@ -369,9 +390,6 @@
NSString *incomeValue = [self.payRoomDataModel.incomeData.income description];
if ([NSString isNull:incomeValue]) {
incomeValue = [[FUSLiveHelper shareInstance].roomInfoModel.bonds description];
}
if ([NSString isNull:incomeValue]) {
incomeValue = @"0";
}
......@@ -380,34 +398,34 @@
self.incomeLabel.attributedText = [self fus_incomeLineWithValue:incomeValue];
}
- (void)fus_recieveGiftChangeNotification:(NSNotification *)notification {
FUSSocketMessageModel *messageModel = notification.object;
if (![[[[FUSLiveHelper shareInstance] roomInfoModel] roomId] isEqualToString:[NSString stringWithFormat:@"%d", messageModel.extend1]]) {
return;
}
NSDictionary *dict = [messageModel fus_getJsonDict];
NSString *bonds = [dict[@"bonds"] description];
if (![NSString isNull:bonds]) {
[FUSLiveHelper shareInstance].roomInfoModel.bonds = bonds;
}
[self fus_refreshContentTexts];
}
- (void)fus_recieveSomeoneEnterRoomNotification:(NSNotification *)notification {
FUSSocketMessageModel *messageModel = notification.object;
if (![[[[FUSLiveHelper shareInstance] roomInfoModel] roomId] isEqualToString:[NSString stringWithFormat:@"%d", messageModel.extend1]]) {
return;
}
[self fus_refreshContentTexts];
}
- (void)fus_recieveSomeoneExitRoomNotification:(NSNotification *)notification {
FUSSocketMessageModel *messageModel = notification.object;
if (![[[[FUSLiveHelper shareInstance] roomInfoModel] roomId] isEqualToString:[NSString stringWithFormat:@"%d", messageModel.extend1]]) {
return;
}
[self fus_refreshContentTexts];
}
//- (void)fus_recieveGiftChangeNotification:(NSNotification *)notification {
// FUSSocketMessageModel *messageModel = notification.object;
// if (![[[[FUSLiveHelper shareInstance] roomInfoModel] roomId] isEqualToString:[NSString stringWithFormat:@"%d", messageModel.extend1]]) {
// return;
// }
// NSDictionary *dict = [messageModel fus_getJsonDict];
// NSString *bonds = [dict[@"bonds"] description];
// if (![NSString isNull:bonds]) {
// [FUSLiveHelper shareInstance].roomInfoModel.bonds = bonds;
// }
// [self fus_refreshContentTexts];
//}
//- (void)fus_recieveSomeoneEnterRoomNotification:(NSNotification *)notification {
// FUSSocketMessageModel *messageModel = notification.object;
// if (![[[[FUSLiveHelper shareInstance] roomInfoModel] roomId] isEqualToString:[NSString stringWithFormat:@"%d", messageModel.extend1]]) {
// return;
// }
// [self fus_refreshContentTexts];
//}
//- (void)fus_recieveSomeoneExitRoomNotification:(NSNotification *)notification {
// FUSSocketMessageModel *messageModel = notification.object;
// if (![[[[FUSLiveHelper shareInstance] roomInfoModel] roomId] isEqualToString:[NSString stringWithFormat:@"%d", messageModel.extend1]]) {
// return;
// }
// [self fus_refreshContentTexts];
//}
- (void)fus_clickArrowBtnAction:(UIButton *)sender {
......
......@@ -547,6 +547,8 @@ NS_ASSUME_NONNULL_BEGIN
+ (NSString *)fus_URL_indexGetSuccessRecommendResult;
/// 切换付费模式V2
+ (NSString *)fus_URL_liveChangePay;
/// 视图-获取用户列表:陪伴中、试看中
+ (NSString *)fus_URL_liveGetPayRoomUserList;
@end
......
......@@ -892,7 +892,11 @@
{
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/live/change/pay"];
}
/// 视图-获取用户列表:陪伴中、试看中
+ (NSString *)fus_URL_liveGetPayRoomUserList
{
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/payRoom/getPayRoomUserList"];
}
@end
......
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