首页个播页二级分类tab完成
@@ -155,6 +155,10 @@
|
||||
9B33E3CB27D85379003B0E62 /* UploadFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3C927D85379003B0E62 /* UploadFile.m */; };
|
||||
9B33E3CE27D8540C003B0E62 /* XPVoiceCardViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3CD27D8540C003B0E62 /* XPVoiceCardViewController.m */; };
|
||||
9B33E3D427D8A1A4003B0E62 /* XPSkillCardPlayerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3D327D8A1A4003B0E62 /* XPSkillCardPlayerManager.m */; };
|
||||
9B39C88328850EFB00564D17 /* XPHomeLiveHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B39C88228850EFA00564D17 /* XPHomeLiveHeadView.m */; };
|
||||
9B39C8862885408C00564D17 /* HomeLiveLookRecordModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B39C8852885408C00564D17 /* HomeLiveLookRecordModel.m */; };
|
||||
9B39C88928854AB300564D17 /* XPHomeLiveRecordCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B39C88828854AB300564D17 /* XPHomeLiveRecordCell.m */; };
|
||||
9B39C88C28855ECA00564D17 /* XPHomeLivePageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B39C88B28855ECA00564D17 /* XPHomeLivePageViewController.m */; };
|
||||
9B3A1DF4280571000058E2DD /* XPAnchorPKInviteView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3A1DF3280571000058E2DD /* XPAnchorPKInviteView.m */; };
|
||||
9B41D36E282649230048C588 /* XPWeekStarRankUserModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B41D36D282649230048C588 /* XPWeekStarRankUserModel.m */; };
|
||||
9B41D37128264E320048C588 /* XPWeekStarInfoView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B41D37028264E320048C588 /* XPWeekStarInfoView.m */; };
|
||||
@@ -1161,6 +1165,14 @@
|
||||
9B33E3CD27D8540C003B0E62 /* XPVoiceCardViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPVoiceCardViewController.m; sourceTree = "<group>"; };
|
||||
9B33E3D227D8A1A4003B0E62 /* XPSkillCardPlayerManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSkillCardPlayerManager.h; sourceTree = "<group>"; };
|
||||
9B33E3D327D8A1A4003B0E62 /* XPSkillCardPlayerManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSkillCardPlayerManager.m; sourceTree = "<group>"; };
|
||||
9B39C88128850EFA00564D17 /* XPHomeLiveHeadView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeLiveHeadView.h; sourceTree = "<group>"; };
|
||||
9B39C88228850EFA00564D17 /* XPHomeLiveHeadView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeLiveHeadView.m; sourceTree = "<group>"; };
|
||||
9B39C8842885408C00564D17 /* HomeLiveLookRecordModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HomeLiveLookRecordModel.h; sourceTree = "<group>"; };
|
||||
9B39C8852885408C00564D17 /* HomeLiveLookRecordModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HomeLiveLookRecordModel.m; sourceTree = "<group>"; };
|
||||
9B39C88728854AB300564D17 /* XPHomeLiveRecordCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeLiveRecordCell.h; sourceTree = "<group>"; };
|
||||
9B39C88828854AB300564D17 /* XPHomeLiveRecordCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeLiveRecordCell.m; sourceTree = "<group>"; };
|
||||
9B39C88A28855ECA00564D17 /* XPHomeLivePageViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeLivePageViewController.h; sourceTree = "<group>"; };
|
||||
9B39C88B28855ECA00564D17 /* XPHomeLivePageViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeLivePageViewController.m; sourceTree = "<group>"; };
|
||||
9B3A1DF2280571000058E2DD /* XPAnchorPKInviteView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorPKInviteView.h; sourceTree = "<group>"; };
|
||||
9B3A1DF3280571000058E2DD /* XPAnchorPKInviteView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAnchorPKInviteView.m; sourceTree = "<group>"; };
|
||||
9B41D36C282649230048C588 /* XPWeekStarRankUserModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWeekStarRankUserModel.h; sourceTree = "<group>"; };
|
||||
@@ -6347,6 +6359,8 @@
|
||||
E8F9168D27ECA69500F10D8F /* HomeLittleGameRoomModel.m */,
|
||||
9B3353C028816E6F00AC2F24 /* HomeLiveTagModel.h */,
|
||||
9B3353C128816E6F00AC2F24 /* HomeLiveTagModel.m */,
|
||||
9B39C8842885408C00564D17 /* HomeLiveLookRecordModel.h */,
|
||||
9B39C8852885408C00564D17 /* HomeLiveLookRecordModel.m */,
|
||||
);
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
@@ -6360,6 +6374,8 @@
|
||||
E8C6FFC527548120004DC9F0 /* XPHomePartyViewController.m */,
|
||||
9B3353B92881527A00AC2F24 /* XPHomeLivesViewController.h */,
|
||||
9B3353BA2881527A00AC2F24 /* XPHomeLivesViewController.m */,
|
||||
9B39C88A28855ECA00564D17 /* XPHomeLivePageViewController.h */,
|
||||
9B39C88B28855ECA00564D17 /* XPHomeLivePageViewController.m */,
|
||||
E8A6C28A27CF436300AC7442 /* XPHomeLikeViewController.h */,
|
||||
E8A6C28B27CF436300AC7442 /* XPHomeLikeViewController.m */,
|
||||
E8F9168227EC913C00F10D8F /* XPHomeLittleGameViewController.h */,
|
||||
@@ -6424,6 +6440,8 @@
|
||||
E80CBDEC27D0D899001E1EC2 /* XPHomeLikeEmptyTableViewCell.m */,
|
||||
E8F9168927EC940E00F10D8F /* XPHomeLittleGameTableViewCell.h */,
|
||||
E8F9168A27EC940E00F10D8F /* XPHomeLittleGameTableViewCell.m */,
|
||||
9B39C88728854AB300564D17 /* XPHomeLiveRecordCell.h */,
|
||||
9B39C88828854AB300564D17 /* XPHomeLiveRecordCell.m */,
|
||||
);
|
||||
path = Cell;
|
||||
sourceTree = "<group>";
|
||||
@@ -6447,6 +6465,8 @@
|
||||
E80CBDEF27D0E2C8001E1EC2 /* XPHomeRecommendOtherRoomView.m */,
|
||||
E81AF31827F19265003B9E43 /* XPHomeGradientLabel.h */,
|
||||
E81AF31927F19265003B9E43 /* XPHomeGradientLabel.m */,
|
||||
9B39C88128850EFA00564D17 /* XPHomeLiveHeadView.h */,
|
||||
9B39C88228850EFA00564D17 /* XPHomeLiveHeadView.m */,
|
||||
);
|
||||
path = SubViews;
|
||||
sourceTree = "<group>";
|
||||
@@ -7622,6 +7642,7 @@
|
||||
18F404C3276098F100A6C548 /* Api+Message.m in Sources */,
|
||||
E8E859D828264C2300EE4857 /* DDAbstractDatabaseLogger.m in Sources */,
|
||||
E8C6FFED27550CC2004DC9F0 /* HomeSearchResultModel.m in Sources */,
|
||||
9B39C88C28855ECA00564D17 /* XPHomeLivePageViewController.m in Sources */,
|
||||
E80016292803D5C500D6D17A /* XPGuildIncomeRecordTableViewCell.m in Sources */,
|
||||
9BB549592782E6A30090CD26 /* XPNobleCenterPresenter.m in Sources */,
|
||||
9B85B6D7279FDABA00A0A1AC /* XPUserCardSkillCardView.m in Sources */,
|
||||
@@ -7660,6 +7681,7 @@
|
||||
E883E82E28153BDF0000005D /* XPGuildAnchorIncomeSectionView.m in Sources */,
|
||||
9B17F71827BD150600440843 /* SVGAParserManager.m in Sources */,
|
||||
E80DE40D2775ABA500BE5BCB /* XPFirstRechargeFlowLayout.m in Sources */,
|
||||
9B39C88928854AB300564D17 /* XPHomeLiveRecordCell.m in Sources */,
|
||||
E896EFA22771AE9400AD2CC1 /* XPMineFriendViewController.m in Sources */,
|
||||
E8E70D8C26F2F5A500F03460 /* XPMineHeadItemCollectionViewCell.m in Sources */,
|
||||
9BE9F0FC27FED2E100667200 /* XPAnchorFansJoinModel.m in Sources */,
|
||||
@@ -7718,6 +7740,7 @@
|
||||
9B1B729828002147003FACE9 /* XPMineFansTeamPresenter.m in Sources */,
|
||||
E86507E8281A8212006951B0 /* ContentTweetModel.m in Sources */,
|
||||
E8D55CA0281186D6006935A5 /* SessionAudioRecordView.m in Sources */,
|
||||
9B39C88328850EFB00564D17 /* XPHomeLiveHeadView.m in Sources */,
|
||||
E8A88D2A27E81C8600CA8837 /* XPRoomPKUserCollectionViewCell.m in Sources */,
|
||||
9B3353C228816E6F00AC2F24 /* HomeLiveTagModel.m in Sources */,
|
||||
9B7B606627BBA0EE0070BB72 /* XPAnchorAttentSendInfo.m in Sources */,
|
||||
@@ -7865,6 +7888,7 @@
|
||||
E80016452804268E00D6D17A /* XPMineClanIncomeStatisViewController.m in Sources */,
|
||||
E88C72A3282917590047FB2B /* XPRoomMusicVoiceSettingView.m in Sources */,
|
||||
E81AF32827F1EE69003B9E43 /* XPRoomPKPanelUserView.m in Sources */,
|
||||
9B39C8862885408C00564D17 /* HomeLiveLookRecordModel.m in Sources */,
|
||||
E84150BF27747BD300A7F548 /* Api+FirstRecharge.m in Sources */,
|
||||
E8E859CF28264C2300EE4857 /* DDNumber.m in Sources */,
|
||||
E84B0E422727EE0A008818C6 /* XPRoomMessageHeaderView.m in Sources */,
|
||||
|
6
xplan-ios/Assets.xcassets/Home/Live/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
22
xplan-ios/Assets.xcassets/Home/Live/home_live_hot_bg.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "home_live_hot_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "home_live_hot_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Home/Live/home_live_hot_bg.imageset/home_live_hot_bg@2x.png
vendored
Normal file
After Width: | Height: | Size: 9.1 KiB |
BIN
xplan-ios/Assets.xcassets/Home/Live/home_live_hot_bg.imageset/home_live_hot_bg@3x.png
vendored
Normal file
After Width: | Height: | Size: 16 KiB |
22
xplan-ios/Assets.xcassets/Home/Live/home_live_recommend_tag.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "home_live_recommend_tag@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "home_live_recommend_tag@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Home/Live/home_live_recommend_tag.imageset/home_live_recommend_tag@2x.png
vendored
Normal file
After Width: | Height: | Size: 947 B |
BIN
xplan-ios/Assets.xcassets/Home/Live/home_live_recommend_tag.imageset/home_live_recommend_tag@3x.png
vendored
Normal file
After Width: | Height: | Size: 1.2 KiB |
22
xplan-ios/Assets.xcassets/Home/Live/home_live_record_bg.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "home_live_record_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "home_live_record_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Home/Live/home_live_record_bg.imageset/home_live_record_bg@2x.png
vendored
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
xplan-ios/Assets.xcassets/Home/Live/home_live_record_bg.imageset/home_live_record_bg@3x.png
vendored
Normal file
After Width: | Height: | Size: 16 KiB |
22
xplan-ios/Assets.xcassets/Home/Live/home_live_record_icon.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "home_live_record_icon@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "home_live_record_icon@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Home/Live/home_live_record_icon.imageset/home_live_record_icon@2x.png
vendored
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
xplan-ios/Assets.xcassets/Home/Live/home_live_record_icon.imageset/home_live_record_icon@3x.png
vendored
Normal file
After Width: | Height: | Size: 1.7 KiB |
@@ -67,7 +67,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// 请求个播放更多房间列表
|
||||
/// @param completion 完成
|
||||
+ (void)homeAnchorMoreRoomList:(HttpRequestHelperCompletion)completion;
|
||||
+ (void)homeAnchorMoreRoomList:(HttpRequestHelperCompletion)completion singleRoomSortId:(NSString *)singleRoomSortId;
|
||||
|
||||
/// 请求热门房间列表
|
||||
/// @param completion 完成
|
||||
@@ -110,6 +110,11 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param uid 用户的uid
|
||||
+ (void)homeQuickMatchLittleGame:(HttpRequestHelperCompletion)completion uid:(NSString *)uid;
|
||||
|
||||
/// 获取首页个播浏览记录
|
||||
/// @param complection 完成
|
||||
/// @param uid 用户的uid
|
||||
+ (void)onceLookAnchorRoomComplection:(HttpRequestHelperCompletion)complection uid:(NSString *)uid;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -73,8 +73,8 @@
|
||||
|
||||
/// 请求个播放更多房间列表
|
||||
/// @param completion 完成
|
||||
+ (void)homeAnchorMoreRoomList:(HttpRequestHelperCompletion)completion {
|
||||
[self makeRequest:@"single/broadcast/morePopularityAnchorList" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, nil];
|
||||
+ (void)homeAnchorMoreRoomList:(HttpRequestHelperCompletion)completion singleRoomSortId:(NSString *)singleRoomSortId {
|
||||
[self makeRequest:@"single/broadcast/morePopularityAnchorList" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, singleRoomSortId, nil];
|
||||
}
|
||||
|
||||
/// 请求热门房间列表
|
||||
@@ -135,4 +135,11 @@
|
||||
[self makeRequest:@"home/fastPick" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, uid, nil];
|
||||
}
|
||||
|
||||
/// 获取首页个播浏览记录
|
||||
/// @param complection 完成
|
||||
/// @param uid 用户的uid
|
||||
+ (void)onceLookAnchorRoomComplection:(HttpRequestHelperCompletion)complection uid:(NSString *)uid {
|
||||
[self makeRequest:@"single/broadcast/onceLook" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, uid, nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
21
xplan-ios/Main/Home/Model/HomeLiveLookRecordModel.h
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// HomeLiveLookRecordModel.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/7/18.
|
||||
// 个播房浏览记录
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class HomeRecommendRoomModel;
|
||||
@interface HomeLiveLookRecordModel : NSObject
|
||||
|
||||
///是否有历史浏览记录
|
||||
@property (nonatomic, assign) BOOL onceLookStatus;
|
||||
|
||||
@property (nonatomic, strong) NSArray<HomeRecommendRoomModel *> *singleRoomList;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
19
xplan-ios/Main/Home/Model/HomeLiveLookRecordModel.m
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// HomeLiveLookRecordModel.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/7/18.
|
||||
//
|
||||
|
||||
#import "HomeLiveLookRecordModel.h"
|
||||
#import "HomeRecommendRoomModel.h"
|
||||
|
||||
@implementation HomeLiveLookRecordModel
|
||||
|
||||
+ (NSDictionary *)objectClassInArray {
|
||||
return @{
|
||||
@"singleRoomList": [HomeRecommendRoomModel class]
|
||||
};
|
||||
}
|
||||
|
||||
@end
|
@@ -38,6 +38,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,copy) NSString *iconContent;
|
||||
///是否在跨房PK中
|
||||
@property (nonatomic, assign) BOOL crossPking;
|
||||
///是否是推荐房间
|
||||
@property (nonatomic, assign) BOOL isRecommend;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -11,9 +11,16 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPHomeLivePresenter : BaseMvpPresenter
|
||||
|
||||
/// 获取曾经看过的个播房列表
|
||||
- (void)getOnceLookRoom;
|
||||
|
||||
/// 获取所有的直播tag列表
|
||||
- (void)getHomeLiveTagList;
|
||||
|
||||
/// 获取更多的个播房间
|
||||
/// @param tabId 个播tabId
|
||||
- (void)getHomeMoreAnchorRoomListWithTabId:(NSString *)tabId;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -10,16 +10,48 @@
|
||||
#import "AccountInfoStorage.h"
|
||||
#import "HomeLiveTagModel.h"
|
||||
#import "XPHomeLiveProtocol.h"
|
||||
#import "HomeLiveLookRecordModel.h"
|
||||
#import "HomeRecommendRoomModel.h"
|
||||
|
||||
@implementation XPHomeLivePresenter
|
||||
|
||||
/// 获取曾经看过的个播房列表
|
||||
- (void)getOnceLookRoom {
|
||||
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||
[Api onceLookAnchorRoomComplection:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
HomeLiveLookRecordModel *model = [HomeLiveLookRecordModel modelWithJSON:data.data];
|
||||
[[self getView] getOnceLookRoomListSuccess:model];
|
||||
}] uid:uid];
|
||||
}
|
||||
|
||||
/// 获取所有的直播tag列表
|
||||
- (void)getHomeLiveTagList {
|
||||
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||
[Api homeLiveTagComplection:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
NSArray * array = [HomeLiveTagModel modelsWithArray:data.data];
|
||||
HomeLiveTagModel *recommend = [[HomeLiveTagModel alloc] init];
|
||||
recommend.sortName = @"推荐";
|
||||
NSMutableArray *array = [NSMutableArray array];
|
||||
[array addObject:recommend];
|
||||
NSArray * arrayData = [HomeLiveTagModel modelsWithArray:data.data];
|
||||
[array addObjectsFromArray:arrayData];
|
||||
[[self getView] getHomeLiveTagListSuccess:array];
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
HomeLiveTagModel *recommend = [[HomeLiveTagModel alloc] init];
|
||||
recommend.sortName = @"推荐";
|
||||
NSMutableArray *array = [NSMutableArray array];
|
||||
[array addObject:recommend];
|
||||
[[self getView] getHomeLiveTagListFail:array];
|
||||
}] uid:uid];
|
||||
}
|
||||
|
||||
/// 获取更多的个播房间
|
||||
/// @param tabId 个播tabId
|
||||
- (void)getHomeMoreAnchorRoomListWithTabId:(NSString *)tabId {
|
||||
[Api homeAnchorMoreRoomList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
NSArray * array = [HomeRecommendRoomModel modelsWithArray:data.data];
|
||||
[[self getView] getAnchorRoomListSuccess:array];
|
||||
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
}] singleRoomSortId:tabId ? tabId : @""];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -38,7 +38,7 @@
|
||||
[[self getView] getHomeMoreAnchorRoomListSuccess:array];
|
||||
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
[[self getView] getHomeMoreAnchorRoomListFail:msg];
|
||||
}]];
|
||||
}] singleRoomSortId:@""];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -7,10 +7,18 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class HomeLiveTagModel;
|
||||
@class HomeLiveTagModel, HomeLiveLookRecordModel, HomeRecommendRoomModel;
|
||||
@protocol XPHomeLiveProtocol <NSObject>
|
||||
|
||||
///获取个播浏览记录成功
|
||||
- (void)getOnceLookRoomListSuccess:(HomeLiveLookRecordModel *)data;
|
||||
|
||||
///获取所有的tag成功
|
||||
- (void)getHomeLiveTagListSuccess:(NSArray<HomeLiveTagModel *> *)array;
|
||||
///获取所有的tag失败
|
||||
- (void)getHomeLiveTagListFail:(NSArray<HomeLiveTagModel *> *)array;
|
||||
|
||||
///获取个播房成功
|
||||
- (void)getAnchorRoomListSuccess:(NSArray<HomeRecommendRoomModel *> *)array;
|
||||
|
||||
@end
|
||||
|
19
xplan-ios/Main/Home/View/Cell/XPHomeLiveRecordCell.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// XPHomeLiveRecordCell.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/7/18.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class HomeRecommendRoomModel;
|
||||
|
||||
@interface XPHomeLiveRecordCell : UICollectionViewCell
|
||||
|
||||
@property (nonatomic,strong) HomeRecommendRoomModel *recordRoom;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
127
xplan-ios/Main/Home/View/Cell/XPHomeLiveRecordCell.m
Normal file
@@ -0,0 +1,127 @@
|
||||
//
|
||||
// XPHomeLiveRecordCell.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/7/18.
|
||||
//
|
||||
|
||||
#import "XPHomeLiveRecordCell.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "NetImageView.h"
|
||||
#import "ThemeColor.h"
|
||||
#import "UIImage+Utils.h"
|
||||
///Model
|
||||
#import "HomeRecommendRoomModel.h"
|
||||
|
||||
@interface XPHomeLiveRecordCell ()
|
||||
|
||||
///头像
|
||||
@property (nonatomic,strong) NetImageView *avatarImageView;
|
||||
///昵称
|
||||
@property (nonatomic,strong) UILabel *nickLabel;
|
||||
///是否推荐标签
|
||||
@property (nonatomic, strong) UIImageView *tagImageView;
|
||||
///推荐
|
||||
@property (nonatomic, strong) UILabel *recommendLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPHomeLiveRecordCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self.contentView addSubview:self.avatarImageView];
|
||||
[self.contentView addSubview:self.nickLabel];
|
||||
[self.contentView addSubview:self.tagImageView];
|
||||
[self.contentView addSubview:self.recommendLabel];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(60, 60));
|
||||
make.left.mas_equalTo(self.contentView).mas_offset(2);
|
||||
make.top.mas_equalTo(self.contentView).mas_offset(1);
|
||||
}];
|
||||
|
||||
[self.tagImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.top.mas_equalTo(self.contentView);
|
||||
make.width.mas_equalTo(26);
|
||||
make.height.mas_equalTo(13);
|
||||
}];
|
||||
|
||||
[self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(0);
|
||||
make.top.mas_equalTo(self.avatarImageView.mas_bottom).offset(8);
|
||||
}];
|
||||
[self.recommendLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.tagImageView).mas_offset(4);
|
||||
make.top.mas_equalTo(self.tagImageView).mas_offset(1);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setRecordRoom:(HomeRecommendRoomModel *)recordRoom {
|
||||
_recordRoom = recordRoom;
|
||||
if (_recordRoom) {
|
||||
self.avatarImageView.imageUrl = _recordRoom.avatar;
|
||||
self.nickLabel.text = _recordRoom.nick;
|
||||
self.tagImageView.hidden = !recordRoom.isRecommend;
|
||||
self.recommendLabel.hidden = !recordRoom.isRecommend;
|
||||
}
|
||||
}
|
||||
|
||||
- (NetImageView *)avatarImageView {
|
||||
if (!_avatarImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_avatarImageView.layer.masksToBounds = YES;
|
||||
_avatarImageView.layer.cornerRadius = 8;
|
||||
}
|
||||
return _avatarImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)nickLabel {
|
||||
if (!_nickLabel) {
|
||||
_nickLabel = [[UILabel alloc] init];
|
||||
_nickLabel.font = [UIFont systemFontOfSize:10];
|
||||
_nickLabel.textColor = [ThemeColor mainTextColor];
|
||||
_nickLabel.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
return _nickLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)recommendLabel {
|
||||
if (!_recommendLabel) {
|
||||
_recommendLabel = [[UILabel alloc] init];
|
||||
_recommendLabel.text = @"推荐";
|
||||
_recommendLabel.font = [UIFont systemFontOfSize:8];
|
||||
_recommendLabel.textColor = [UIColor whiteColor];
|
||||
_recommendLabel.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
return _recommendLabel;
|
||||
}
|
||||
|
||||
- (UIImageView *)tagImageView {
|
||||
if (!_tagImageView) {
|
||||
_tagImageView = [[UIImageView alloc] init];
|
||||
_tagImageView.image = [UIImage imageNamed:@"home_live_recommend_tag"];
|
||||
_tagImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _tagImageView;
|
||||
}
|
||||
|
||||
@end
|
34
xplan-ios/Main/Home/View/SubViews/XPHomeLiveHeadView.h
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// XPHomeLiveHeadView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/7/18.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class HomeRecommendRoomModel;
|
||||
@protocol XPHomeLiveHeadViewDelegate <NSObject>
|
||||
///点击了某个item
|
||||
- (void)xPHomeLiveHeadViewDidClickItem:(HomeRecommendRoomModel *)model;
|
||||
|
||||
@end
|
||||
@interface XPHomeLiveHeadView : UIView
|
||||
|
||||
///当前的控制器
|
||||
@property (nonatomic,weak) UIViewController *currenViewController;
|
||||
|
||||
///获取当前View的高度
|
||||
+ (CGFloat)getHomeLiveHeaderViewHeight:(NSArray *)recommendList;
|
||||
///浏览记录列表
|
||||
@property (nonatomic, strong) NSMutableArray *roomList;
|
||||
///是否有历史浏览记录
|
||||
@property (nonatomic, assign) BOOL hadHistoryRecord;
|
||||
|
||||
@property (nonatomic, weak) id<XPHomeLiveHeadViewDelegate> delegate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
159
xplan-ios/Main/Home/View/SubViews/XPHomeLiveHeadView.m
Normal file
@@ -0,0 +1,159 @@
|
||||
//
|
||||
// XPHomeLiveHeadView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/7/18.
|
||||
//
|
||||
|
||||
#import "XPHomeLiveHeadView.h"
|
||||
#import "HomeRecommendRoomModel.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
#import "ThemeColor.h"
|
||||
#import "XPMacro.h"
|
||||
///View
|
||||
#import "XPHomeLiveRecordCell.h"
|
||||
|
||||
@interface XPHomeLiveHeadView()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
|
||||
|
||||
@property (nonatomic, strong) UIImageView *bgImageView;
|
||||
@property (nonatomic, strong) UIImageView *iconImageView;
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
///列表
|
||||
@property (nonatomic,strong) UICollectionView *collectionView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPHomeLiveHeadView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
self.clipsToBounds = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
#pragma mark - Public Method
|
||||
+ (CGFloat)getHomeLiveHeaderViewHeight:(NSArray *)recommendList {
|
||||
CGFloat totaHeight = 0;
|
||||
if (recommendList.count) {
|
||||
totaHeight = 127 + 8;
|
||||
}
|
||||
return totaHeight;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.bgImageView];
|
||||
[self addSubview:self.iconImageView];
|
||||
[self addSubview:self.titleLabel];
|
||||
[self addSubview:self.collectionView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(15);
|
||||
make.right.mas_equalTo(-15);
|
||||
make.top.mas_equalTo(8);
|
||||
make.bottom.mas_equalTo(0);
|
||||
}];
|
||||
|
||||
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.bgImageView).mas_offset(14);
|
||||
make.top.mas_equalTo(self.bgImageView).mas_offset(6);
|
||||
make.width.height.mas_equalTo(16);
|
||||
}];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.iconImageView.mas_right).mas_offset(4);
|
||||
make.centerY.mas_equalTo(self.iconImageView);
|
||||
}];
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.bottom.mas_equalTo(self.bgImageView);
|
||||
make.top.mas_equalTo(self.iconImageView.mas_bottom).mas_offset(8);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionViewCellDelegate And UICollectionViewDatasource
|
||||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
XPHomeLiveRecordCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPHomeLiveRecordCell class]) forIndexPath:indexPath];
|
||||
cell.recordRoom = [self.roomList objectAtIndex:indexPath.item];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
||||
return self.roomList.count;
|
||||
}
|
||||
|
||||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
|
||||
if (self.roomList.count > 0) {
|
||||
HomeRecommendRoomModel * liveModel = [self.roomList objectAtIndex:indexPath.item];
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPHomeLiveHeadViewDidClickItem:)]) {
|
||||
[self.delegate xPHomeLiveHeadViewDidClickItem:liveModel];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setRoomList:(NSMutableArray *)roomList {
|
||||
_roomList = roomList;
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
- (void)setHadHistoryRecord:(BOOL)hadHistoryRecord {
|
||||
if (hadHistoryRecord) {
|
||||
self.bgImageView.image = [UIImage imageNamed:@"home_live_record_bg"];
|
||||
self.titleLabel.text = @"曾经看过的人";
|
||||
} else {
|
||||
self.bgImageView.image = [UIImage imageNamed:@"home_live_hot_bg"];
|
||||
self.titleLabel.text = @"Top热播";
|
||||
}
|
||||
}
|
||||
|
||||
- (UICollectionView *)collectionView{
|
||||
if (!_collectionView) {
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
layout.minimumLineSpacing = 12;
|
||||
layout.itemSize = CGSizeMake(62, 80);
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 15, 0, 15);
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.delegate = self;
|
||||
_collectionView.backgroundColor = [UIColor clearColor];
|
||||
[_collectionView registerClass:[XPHomeLiveRecordCell class] forCellWithReuseIdentifier:NSStringFromClass([XPHomeLiveRecordCell class])];
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
|
||||
- (UIImageView *)bgImageView {
|
||||
if (!_bgImageView) {
|
||||
_bgImageView = [[UIImageView alloc] init];
|
||||
_bgImageView.image = [UIImage imageNamed:@"home_live_record_bg"];
|
||||
}
|
||||
return _bgImageView;
|
||||
}
|
||||
|
||||
- (UIImageView *)iconImageView {
|
||||
if (!_iconImageView) {
|
||||
_iconImageView = [[UIImageView alloc] init];
|
||||
_iconImageView.image = [UIImage imageNamed:@"home_live_record_icon"];
|
||||
}
|
||||
return _iconImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
|
||||
_titleLabel.textColor = [ThemeColor mainTextColor];
|
||||
_titleLabel.text = @"曾经看过的人";
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
@end
|
22
xplan-ios/Main/Home/View/XPHomeLivePageViewController.h
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// XPHomeLivePageViewController.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/7/18.
|
||||
//
|
||||
|
||||
#import "MvpViewController.h"
|
||||
#import <JXPagingView/JXPagerView.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPHomeLivePageViewController : MvpViewController<JXPagerViewListViewDelegate>
|
||||
|
||||
///模块的 ID
|
||||
@property (nonatomic,copy) NSString *tabId;
|
||||
|
||||
- (void)configLiveRoomList:(NSArray *)list;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
196
xplan-ios/Main/Home/View/XPHomeLivePageViewController.m
Normal file
@@ -0,0 +1,196 @@
|
||||
//
|
||||
// XPHomeLivePageViewController.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/7/18.
|
||||
//
|
||||
|
||||
#import "XPHomeLivePageViewController.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <MJRefresh/MJRefresh.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "XPMacro.h"
|
||||
///View
|
||||
#import "XPHomeHapppyRoomTableViewCell.h"
|
||||
#import "XPHomeBannerTableViewCell.h"
|
||||
#import "XPHomeListEmptyTableViewCell.h"
|
||||
#import "XPHomeListCollectionViewCell.h"
|
||||
#import "XPHomeListEmptyCollectionViewCell.h"
|
||||
///Model
|
||||
#import "HomePlayRoomModel.h"
|
||||
#import "HomeRecommendRoomModel.h"
|
||||
///VC
|
||||
#import "XPWebViewController.h"
|
||||
#import "XPRoomViewController.h"
|
||||
#import "XPHomeLivePresenter.h"
|
||||
#import "XPHomeLiveProtocol.h"
|
||||
|
||||
@interface XPHomeLivePageViewController ()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, XPHomeLiveProtocol>
|
||||
///列表
|
||||
@property (nonatomic,strong) UICollectionView *collectionView;
|
||||
@property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView);
|
||||
///没有新的数据了
|
||||
@property (nonatomic,assign) BOOL hasNoMoreData;
|
||||
///数据源
|
||||
@property (nonatomic,strong) NSMutableArray *datasource;
|
||||
@end
|
||||
|
||||
@implementation XPHomeLivePageViewController
|
||||
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (XPHomeLivePresenter *)createPresenter {
|
||||
return [[XPHomeLivePresenter alloc] init];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self headerRefresh];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.view.backgroundColor = [UIColor clearColor];
|
||||
[self.view addSubview:self.collectionView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.view);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - 刷新的fangfa
|
||||
- (void)headerRefresh {
|
||||
[self.presenter getHomeMoreAnchorRoomListWithTabId:self.tabId];
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionViewDataSource
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
||||
return self.datasource.count > 0 ? self.datasource.count : 1;
|
||||
}
|
||||
|
||||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
XPHomeListCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPHomeListCollectionViewCell class]) forIndexPath:indexPath];
|
||||
HomeRecommendRoomModel * model = [self.datasource objectAtIndex:indexPath.item];
|
||||
cell.roomModel = model;
|
||||
return cell;
|
||||
}
|
||||
|
||||
XPHomeListEmptyCollectionViewCell * emptyCell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPHomeListEmptyCollectionViewCell class]) forIndexPath:indexPath];
|
||||
return emptyCell;
|
||||
|
||||
}
|
||||
#pragma mark - UICollectionViewDelegate
|
||||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
|
||||
if (self.datasource.count > 0) {
|
||||
HomeRecommendRoomModel * model = [self.datasource objectAtIndex:indexPath.item];
|
||||
NSString *roomUid = model.uid;
|
||||
if (roomUid.length > 0) {
|
||||
[XPRoomViewController openRoom:roomUid viewController:self];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count <= 0) {
|
||||
return CGSizeMake(KScreenWidth, KScreenHeight- kNavigationHeight - 49 - 20);
|
||||
}
|
||||
return CGSizeMake((KScreenWidth - 15 * 3) / 2, 157 + 36);
|
||||
}
|
||||
|
||||
#pragma mark - XPHomeProtocol
|
||||
- (void)getHomeRecommendRoomListSuccess:(NSArray *)list state:(BOOL)state {
|
||||
if (state == 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
[self.datasource removeAllObjects];
|
||||
[self.collectionView.mj_header endRefreshing];
|
||||
} else {
|
||||
[self.collectionView.mj_footer endRefreshing];
|
||||
}
|
||||
if (list.count > 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
[self.datasource addObjectsFromArray:list];
|
||||
} else {
|
||||
self.hasNoMoreData = YES;
|
||||
}
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
- (void)getHomeRecommendRoomListFail:(NSString *)message state:(BOOL)state {
|
||||
if (state ==0) {
|
||||
[self.collectionView.mj_header endRefreshing];
|
||||
} else {
|
||||
[self.collectionView.mj_footer endRefreshing];
|
||||
}
|
||||
}
|
||||
|
||||
///获取个播房列表成功
|
||||
- (void)getAnchorRoomListSuccess:(NSArray<HomeRecommendRoomModel *> *)array {
|
||||
[self.datasource removeAllObjects];
|
||||
[self.datasource addObjectsFromArray:array];
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
- (void)getHomeMoreAnchorRoomListFail:(NSString *)messag {
|
||||
[self.collectionView.mj_header endRefreshing];
|
||||
[self.collectionView.mj_footer endRefreshing];
|
||||
}
|
||||
|
||||
#pragma mark - JXPagingViewListViewDelegate
|
||||
- (UIView *)listView {
|
||||
return self.view;
|
||||
}
|
||||
|
||||
- (UIScrollView *)listScrollView {
|
||||
return self.collectionView;
|
||||
}
|
||||
|
||||
- (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
|
||||
self.scrollCallback = callback;
|
||||
}
|
||||
|
||||
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
||||
self.scrollCallback(scrollView);
|
||||
}
|
||||
#pragma mark - Getters And Setters
|
||||
|
||||
- (void)setTabId:(NSString *)tabId {
|
||||
_tabId = tabId;
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[self headerRefresh];
|
||||
});
|
||||
}
|
||||
|
||||
- (UICollectionView *)collectionView{
|
||||
if (!_collectionView) {
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
|
||||
layout.minimumLineSpacing = 0;
|
||||
layout.minimumInteritemSpacing = 15;
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 15, 0, 15);
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.delegate = self;
|
||||
_collectionView.backgroundColor = [UIColor clearColor];
|
||||
[_collectionView registerClass:[XPHomeListCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPHomeListCollectionViewCell class])];
|
||||
[_collectionView registerClass:[XPHomeListEmptyCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPHomeListEmptyCollectionViewCell class])];
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
|
||||
- (NSMutableArray *)datasource {
|
||||
if (!_datasource) {
|
||||
_datasource = [NSMutableArray array];
|
||||
}
|
||||
return _datasource;
|
||||
}
|
||||
|
||||
@end
|
@@ -11,107 +11,104 @@
|
||||
#import <JXCategoryView/JXCategoryView.h>
|
||||
#import <JXCategoryView/JXCategoryIndicatorBackgroundView.h>
|
||||
#import <JXCategoryView/JXCategoryListContainerView.h>
|
||||
#import <JXPagingView/JXPagerView.h>
|
||||
#import <MJRefresh/MJRefresh.h>
|
||||
///Tool
|
||||
#import "XPMacro.h"
|
||||
#import "ThemeColor.h"
|
||||
#import "XPHtmlUrl.h"
|
||||
///Model
|
||||
#import "HomeLiveTagModel.h"
|
||||
#import "HomeLiveLookRecordModel.h"
|
||||
#import "HomeRecommendRoomModel.h"
|
||||
///View
|
||||
#import "XPRoomSearchContainerViewController.h"
|
||||
#import "XPHomePartyViewController.h"
|
||||
#import "XPWebViewController.h"
|
||||
#import "XPHomeLikeViewController.h"
|
||||
#import "XPHomeLittleGameViewController.h"
|
||||
#import "XPHomeLiveHeadView.h"
|
||||
#import "XPHomeHappyViewController.h"
|
||||
#import "XPHomeLivePageViewController.h"
|
||||
#import "XPMineUserInfoViewController.h"
|
||||
#import "XPRoomViewController.h"
|
||||
///P
|
||||
#import "XPHomeLivePresenter.h"
|
||||
#import "XPHomeLiveProtocol.h"
|
||||
|
||||
UIKIT_EXTERN NSString * kHomeMoreScrollPageKey;
|
||||
|
||||
@interface XPHomeLivesViewController ()<JXCategoryViewDelegate, JXCategoryListContainerViewDelegate, XPHomeLiveProtocol>
|
||||
|
||||
@interface XPHomeLivesViewController ()<JXCategoryViewDelegate, JXPagerViewDelegate, JXPagerMainTableViewGestureDelegate, XPHomeLiveProtocol, XPHomeLiveHeadViewDelegate>
|
||||
|
||||
///分页标题
|
||||
@property (nonatomic, strong) NSArray<NSString *> *titles;
|
||||
@property (nonatomic, strong) JXPagerView *pagingView;
|
||||
///分页控件
|
||||
@property (nonatomic, strong) JXCategoryTitleView *titleView;
|
||||
///分页lineView
|
||||
@property (nonatomic, strong) JXCategoryListContainerView *contentView;
|
||||
///tag的列表
|
||||
@property (nonatomic,copy) NSArray<HomeLiveTagModel *> *tagList;
|
||||
///头部浏览记录
|
||||
@property (nonatomic, strong) XPHomeLiveHeadView *headerView;
|
||||
///浏览记录房间列表
|
||||
@property (nonatomic, strong) NSArray<HomeRecommendRoomModel *> *roomList;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPHomeLivesViewController
|
||||
|
||||
- (XPHomeLivePresenter *)createPresenter {
|
||||
return [[XPHomeLivePresenter alloc] init];
|
||||
}
|
||||
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (XPHomeLivePresenter *)createPresenter {
|
||||
return [[XPHomeLivePresenter alloc] init];
|
||||
}
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self initHttp];
|
||||
[self initHeaderAndFooterRrfresh];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
|
||||
- (void)viewDidLayoutSubviews {
|
||||
[super viewDidLayoutSubviews];
|
||||
self.pagingView.frame = self.view.bounds;
|
||||
}
|
||||
|
||||
#pragma mark - InitHttp
|
||||
- (void)headerRefresh {
|
||||
self.titleView.defaultSelectedIndex = 0;
|
||||
[self.presenter getOnceLookRoom];
|
||||
[self.presenter getHomeLiveTagList];
|
||||
}
|
||||
|
||||
- (void)initHeaderAndFooterRrfresh {
|
||||
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
|
||||
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.stateLabel.textColor = [ThemeColor secondTextColor];
|
||||
header.lastUpdatedTimeLabel.textColor = [ThemeColor secondTextColor];
|
||||
self.pagingView.mainTableView.mj_header = header;
|
||||
[self headerRefresh];
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(recommendMoreNotification:) name:kHomeMoreScrollPageKey object:nil];
|
||||
self.view.backgroundColor = [UIColor clearColor];
|
||||
[self.view addSubview:self.titleView];
|
||||
[self.view addSubview:self.contentView];
|
||||
[self.view addSubview:self.pagingView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.view).offset(10);
|
||||
make.left.right.mas_equalTo(self.view);
|
||||
make.height.mas_equalTo(30);
|
||||
}];
|
||||
|
||||
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.titleView.mas_bottom);
|
||||
make.left.right.bottom.mas_equalTo(self.view);
|
||||
}];
|
||||
#pragma mark - XPHomeRecommendProtocol
|
||||
- (void)getOnceLookRoomListSuccess:(HomeLiveLookRecordModel *)data {
|
||||
self.headerView.hadHistoryRecord = data.onceLookStatus;
|
||||
self.headerView.roomList = [NSMutableArray arrayWithArray:data.singleRoomList];
|
||||
self.roomList = data.singleRoomList;
|
||||
[self.pagingView reloadData];
|
||||
}
|
||||
|
||||
- (void)initHttp {
|
||||
[self.presenter getHomeLiveTagList];
|
||||
}
|
||||
|
||||
#pragma mark - JXCategoryViewDelegate
|
||||
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView {
|
||||
return self.titles.count;
|
||||
}
|
||||
|
||||
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index {
|
||||
HomeLiveTagModel * hometag = [self.tagList objectAtIndex:index];
|
||||
UIViewController<JXCategoryListContentViewDelegate> * list = (UIViewController<JXCategoryListContentViewDelegate> *)[self.contentView.validListDict objectForKey:[NSNumber numberWithInteger:index]];
|
||||
if (list) {
|
||||
return list;
|
||||
} else {
|
||||
XPHomePartyViewController * homeVC = [[XPHomePartyViewController alloc] init];
|
||||
homeVC.tabId = hometag.tid;
|
||||
return homeVC;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
|
||||
HomeLiveTagModel * hometag = [self.tagList objectAtIndex:index];
|
||||
XPHomePartyViewController * list = (XPHomePartyViewController<JXCategoryListContentViewDelegate> *)[self.contentView.validListDict objectForKey:[NSNumber numberWithInteger:index]];;
|
||||
list.tabId = hometag.tid;
|
||||
}
|
||||
|
||||
#pragma mark - JXCategoryListContentViewDelegate
|
||||
- (UIView *)listView {
|
||||
return self.view;
|
||||
}
|
||||
|
||||
#pragma mark - XPHomeContainerProtocol
|
||||
- (void)getHomeLiveTagListSuccess:(NSArray<HomeLiveTagModel *> *)array {
|
||||
self.tagList = array;
|
||||
NSMutableArray * titles = [NSMutableArray array];
|
||||
@@ -123,16 +120,85 @@ UIKIT_EXTERN NSString * kHomeMoreScrollPageKey;
|
||||
self.titles = titles.copy;
|
||||
self.titleView.titles = self.titles;
|
||||
[self.titleView reloadData];
|
||||
[self.pagingView.mainTableView.mj_header endRefreshing];
|
||||
[self.pagingView reloadData];
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)recommendMoreNotification:(NSNotification *)notification {
|
||||
NSDictionary * dic = notification.object;
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
if ([[dic objectForKey:@"section"] integerValue] == 3) {
|
||||
[self.titleView selectItemAtIndex:0];
|
||||
- (void)getHomeLiveTagListFail:(NSArray<HomeLiveTagModel *> *)array {
|
||||
self.tagList = array;
|
||||
NSMutableArray * titles = [NSMutableArray array];
|
||||
[array enumerateObjectsUsingBlock:^(HomeLiveTagModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.sortName.length > 0) {
|
||||
[titles addObject:obj.sortName];
|
||||
}
|
||||
}];
|
||||
self.titles = titles.copy;
|
||||
self.titleView.titles = self.titles;
|
||||
[self.titleView reloadData];
|
||||
[self.pagingView.mainTableView.mj_header endRefreshing];
|
||||
[self.pagingView reloadData];
|
||||
}
|
||||
|
||||
#pragma mark - JXCategoryListContentViewDelegate
|
||||
- (UIView *)listView {
|
||||
return self.view;
|
||||
}
|
||||
|
||||
#pragma mark - JXCategoryViewDelegate
|
||||
- (NSUInteger)tableHeaderViewHeightInPagerView:(JXPagerView *)pagerView {
|
||||
return [XPHomeLiveHeadView getHomeLiveHeaderViewHeight:self.roomList];
|
||||
}
|
||||
|
||||
- (UIView *)tableHeaderViewInPagerView:(JXPagerView *)pagerView {
|
||||
return self.headerView;
|
||||
}
|
||||
|
||||
- (NSUInteger)heightForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
|
||||
return 50;
|
||||
}
|
||||
|
||||
- (UIView *)viewForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
|
||||
return self.titleView;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfListsInPagerView:(JXPagerView *)pagerView {
|
||||
return self.titles.count;
|
||||
}
|
||||
|
||||
- (id<JXPagerViewListViewDelegate>)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index {
|
||||
UIViewController *viewController;
|
||||
XPHomeLivePageViewController * homeVC = [[XPHomeLivePageViewController alloc] init];
|
||||
HomeLiveTagModel *tag = self.tagList[index];
|
||||
homeVC.tabId = tag.tid;
|
||||
return homeVC;
|
||||
return (id <JXPagerViewListViewDelegate>)viewController;
|
||||
}
|
||||
|
||||
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
|
||||
// HomeLiveTagModel *tag = self.tagList[index];
|
||||
// [self.presenter getHomeMoreAnchorRoomListWithTabId:tag.tid];
|
||||
// if ([title isEqualToString:@"开黑畅聊"]) {
|
||||
// [self.presenter getPlayGameWithTeam:1];
|
||||
// } else {
|
||||
// [self.presenter getHomePersonalRoomList];
|
||||
// }
|
||||
}
|
||||
|
||||
#pragma mark - JXPagerMainTableViewGestureDelegate
|
||||
- (BOOL)mainTableViewGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
|
||||
///1000是外部的scrollView 1001是人气主播中的collectionView
|
||||
if (otherGestureRecognizer.view.tag == 1000 || otherGestureRecognizer.view == self.headerView || otherGestureRecognizer.view.tag == 1001) {
|
||||
return NO;
|
||||
}
|
||||
return [gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]] && [otherGestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]];
|
||||
}
|
||||
|
||||
#pragma mark - XPHomeLiveHeadViewDelegate
|
||||
- (void)xPHomeLiveHeadViewDidClickItem:(HomeRecommendRoomModel *)model {
|
||||
NSString *roomUid = model.uid;
|
||||
if (roomUid.length > 0) {
|
||||
[XPRoomViewController openRoom:roomUid viewController:self];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
@@ -140,36 +206,50 @@ UIKIT_EXTERN NSString * kHomeMoreScrollPageKey;
|
||||
if (!_titleView) {
|
||||
_titleView = [[JXCategoryTitleView alloc] init];
|
||||
_titleView.delegate = self;
|
||||
_titleView.titles = self.titles;
|
||||
_titleView.backgroundColor = [UIColor clearColor];
|
||||
_titleView.titleColor = [ThemeColor secondTextColor];
|
||||
_titleView.titleColor = [ThemeColor textThirdColor];
|
||||
_titleView.titleSelectedColor = [ThemeColor mainTextColor];
|
||||
_titleView.titleFont = [UIFont fontWithName:@"PingFang-SC-Medium" size:13];
|
||||
_titleView.titleSelectedFont = [UIFont fontWithName:@"PingFang-SC-Medium" size:16];
|
||||
_titleView.titleFont = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
|
||||
_titleView.titleSelectedFont = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
|
||||
_titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter;
|
||||
_titleView.contentScrollViewClickTransitionAnimationEnabled = NO;
|
||||
_titleView.defaultSelectedIndex = 0;
|
||||
_titleView.cellSpacing = 20;
|
||||
_titleView.cellWidthIncrement = 5;
|
||||
_titleView.listContainer = self.contentView;
|
||||
_titleView.averageCellSpacingEnabled = NO;
|
||||
_titleView.titles = self.titles;
|
||||
_titleView.cellSpacing = 25;
|
||||
_titleView.titles = self.titles;
|
||||
_titleView.listContainer = (id<JXCategoryViewListContainer>)self.pagingView.listContainerView;
|
||||
|
||||
JXCategoryIndicatorBackgroundView * indocator = [[JXCategoryIndicatorBackgroundView alloc] init];
|
||||
indocator.indicatorColor = [ThemeColor appMainColor];
|
||||
indocator.indicatorHeight = 24;
|
||||
indocator.indicatorWidthIncrement = 15;
|
||||
indocator.indicatorWidthIncrement = 20;
|
||||
indocator.indicatorCornerRadius = 12;
|
||||
_titleView.indicators = @[indocator];
|
||||
}
|
||||
return _titleView;
|
||||
}
|
||||
|
||||
- (JXCategoryListContainerView *)contentView {
|
||||
if (!_contentView) {
|
||||
_contentView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
|
||||
_contentView.defaultSelectedIndex = 0;
|
||||
- (JXPagerView *)pagingView {
|
||||
if (!_pagingView) {
|
||||
_pagingView = [[JXPagerView alloc] initWithDelegate:self];
|
||||
_pagingView.backgroundColor = [UIColor clearColor];
|
||||
_pagingView.listContainerView.backgroundColor = [UIColor clearColor];
|
||||
_pagingView.mainTableView.backgroundColor = [UIColor clearColor];
|
||||
_pagingView.mainTableView.gestureDelegate = self;
|
||||
_pagingView.listContainerView.listCellBackgroundColor = UIColor.clearColor;
|
||||
}
|
||||
return _contentView;
|
||||
return _pagingView;
|
||||
}
|
||||
|
||||
- (XPHomeLiveHeadView *)headerView {
|
||||
if (!_headerView) {
|
||||
_headerView = [[XPHomeLiveHeadView alloc] init];
|
||||
_headerView.backgroundColor = [UIColor clearColor];
|
||||
_headerView.currenViewController = self;
|
||||
_headerView.delegate = self;
|
||||
}
|
||||
return _headerView;
|
||||
}
|
||||
|
||||
@end
|
||||
|