Commit 6a53fc79 by ludi

完成首页的润色

parent 8fe9290f
Showing with 1101 additions and 74 deletions
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "fus_common_navigation_back_black@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "fus_common_navigation_back_black@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -120,13 +120,15 @@
if (@available(iOS 15.0, *)) {
UINavigationBarAppearance *barApp = [UINavigationBarAppearance new];
barApp.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor colorWithHex:@"#E3E3E3"]};
// barApp.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor colorWithHex:@"#E3E3E3"]};
barApp.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor fus_textColorRich]};
barApp.backgroundColor = UIColor.fus_navBarColor;; // 设置为你项目中的颜色
self.navigationController.navigationBar.scrollEdgeAppearance = barApp; // 可滑动界面配置
self.navigationController.navigationBar.standardAppearance = barApp; // 普通页面配置
} else {
[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithHex:@"#E3E3E3"],NSFontAttributeName:[UIFont themeFont:18]}];
// [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithHex:@"#E3E3E3"],NSFontAttributeName:[UIFont themeFont:18]}];
[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor fus_textColorRich],NSFontAttributeName:[UIFont themeFont:18]}];
// 设置导航栏颜色
self.navigationController.navigationBar.barTintColor = UIColor.fus_navBarColor;
......
......@@ -38,6 +38,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 性别女背景图标
+ (UIImage *)fus_girlBgImg;
/// 空空如也背景图
+ (UIImage *)fus_emptyImg;
/// 弹窗背景图
+ (UIImage *)fus_alertBg;
......
......@@ -63,7 +63,8 @@
@implementation UIImage (FUSFoundationBundle)
+ (UIImage *)fus_backImage {
return [self fus_ImageNamed:[FUSRTL RTLImageName:@"common_navigation_back_white"]];
// return [self fus_ImageNamed:[FUSRTL RTLImageName:@"common_navigation_back_white"]];
return [self fus_ImageNamed:@"fus_common_navigation_back_black"];
}
+ (UIImage *)themeFontIcon {
......@@ -95,6 +96,11 @@
return [self fus_ImageNamed:@"common_sex_girl_bg"];
}
+ (UIImage *)fus_emptyImg{
//TODO: 补上空空如也图
return [self fus_ImageNamed:@""];
}
/// 弹窗背景图
+ (UIImage *)fus_alertBg {
return [self fus_ImageNamed:@"common_alert_bg_img"];
......
......@@ -26,8 +26,9 @@
/// 输入框颜色
+(UIColor *)fus_inpuContentColor;
/// 主题蓝色
/// 主题色
+(UIColor *)fus_themeColor;
/// 钻石蓝色
+(UIColor *)fus_diamondBlue;
/// 泪水蓝
+(UIColor *)fus_dewBlue;
......
......@@ -51,6 +51,9 @@
return [UIColor colorWithHex:@"#F3F3F3"];
}
+ (UIColor *)fus_themeColor{
return [self fus_diamondBlue];
}
+(UIColor *)fus_diamondBlue{
return [UIColor colorWithHex:@"#01D9E0"];
......
......@@ -31,6 +31,11 @@
00A2D4A42C1AEFBF00A15ECA /* FUSStartPageWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A2D4832C1AEFBF00A15ECA /* FUSStartPageWindow.m */; };
00A2D4A52C1AEFBF00A15ECA /* FUSFloatTabbarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A2D4862C1AEFBF00A15ECA /* FUSFloatTabbarView.m */; };
00A2D4A62C1AEFBF00A15ECA /* FUSTopRightBadgeButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A2D4882C1AEFBF00A15ECA /* FUSTopRightBadgeButton.m */; };
00A36A492C1D89DE004D28FA /* FUSHomeNovaListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A36A482C1D89DE004D28FA /* FUSHomeNovaListViewController.m */; };
00A36A4E2C1D8A38004D28FA /* FUSHomeNovaListCollectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A36A4D2C1D8A38004D28FA /* FUSHomeNovaListCollectionView.m */; };
00A36A522C1D8A69004D28FA /* FUSHomeNovaListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A36A512C1D8A69004D28FA /* FUSHomeNovaListModel.m */; };
00A36A552C1D8A7C004D28FA /* FUSHomeNovaListBroadcastHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A36A542C1D8A7C004D28FA /* FUSHomeNovaListBroadcastHelper.m */; };
00A36A592C1D9FD6004D28FA /* FUSLeftPopScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A36A582C1D9FD6004D28FA /* FUSLeftPopScrollView.m */; };
BE0395D12C132E0F003EB21B /* BEComposerNodeModel.m in Sources */ = {isa = PBXBuildFile; fileRef = BE0395BA2C132E0F003EB21B /* BEComposerNodeModel.m */; };
BE0395D22C132E0F003EB21B /* BEEffectDataManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BE0395BC2C132E0F003EB21B /* BEEffectDataManager.m */; };
BE0395D32C132E0F003EB21B /* BEEffectManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = BE0395BE2C132E0F003EB21B /* BEEffectManager.mm */; };
......@@ -1432,6 +1437,16 @@
00A2D4862C1AEFBF00A15ECA /* FUSFloatTabbarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FUSFloatTabbarView.m; sourceTree = "<group>"; };
00A2D4872C1AEFBF00A15ECA /* FUSTopRightBadgeButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FUSTopRightBadgeButton.h; sourceTree = "<group>"; };
00A2D4882C1AEFBF00A15ECA /* FUSTopRightBadgeButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FUSTopRightBadgeButton.m; sourceTree = "<group>"; };
00A36A472C1D89DE004D28FA /* FUSHomeNovaListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FUSHomeNovaListViewController.h; sourceTree = "<group>"; };
00A36A482C1D89DE004D28FA /* FUSHomeNovaListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FUSHomeNovaListViewController.m; sourceTree = "<group>"; };
00A36A4C2C1D8A38004D28FA /* FUSHomeNovaListCollectionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FUSHomeNovaListCollectionView.h; sourceTree = "<group>"; };
00A36A4D2C1D8A38004D28FA /* FUSHomeNovaListCollectionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FUSHomeNovaListCollectionView.m; sourceTree = "<group>"; };
00A36A502C1D8A68004D28FA /* FUSHomeNovaListModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FUSHomeNovaListModel.h; sourceTree = "<group>"; };
00A36A512C1D8A69004D28FA /* FUSHomeNovaListModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FUSHomeNovaListModel.m; sourceTree = "<group>"; };
00A36A532C1D8A7C004D28FA /* FUSHomeNovaListBroadcastHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FUSHomeNovaListBroadcastHelper.h; sourceTree = "<group>"; };
00A36A542C1D8A7C004D28FA /* FUSHomeNovaListBroadcastHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FUSHomeNovaListBroadcastHelper.m; sourceTree = "<group>"; };
00A36A572C1D9FD6004D28FA /* FUSLeftPopScrollView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSLeftPopScrollView.h; sourceTree = "<group>"; };
00A36A582C1D9FD6004D28FA /* FUSLeftPopScrollView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSLeftPopScrollView.m; sourceTree = "<group>"; };
6DFACA8A2DF329F3E7F7B2FF /* Pods-FuSiLive.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FuSiLive.debug.xcconfig"; path = "Target Support Files/Pods-FuSiLive/Pods-FuSiLive.debug.xcconfig"; sourceTree = "<group>"; };
AD8AA4E093E761AA637769AD /* Pods-FuSiLive.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FuSiLive.release.xcconfig"; path = "Target Support Files/Pods-FuSiLive/Pods-FuSiLive.release.xcconfig"; sourceTree = "<group>"; };
BE03959E2C132E0F003EB21B /* bef_effect_ai_api.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bef_effect_ai_api.h; sourceTree = "<group>"; };
......@@ -3647,6 +3662,8 @@
00A2D44F2C1AEFBF00A15ECA /* FUSLiveStateAnimationView.m */,
00A2D4502C1AEFBF00A15ECA /* FUSMultiDelegate.h */,
00A2D4512C1AEFBF00A15ECA /* FUSMultiDelegate.m */,
00A36A572C1D9FD6004D28FA /* FUSLeftPopScrollView.h */,
00A36A582C1D9FD6004D28FA /* FUSLeftPopScrollView.m */,
);
path = Others;
sourceTree = "<group>";
......@@ -3780,6 +3797,7 @@
00A2D48A2C1AEFBF00A15ECA /* ViewController */ = {
isa = PBXGroup;
children = (
00A36A462C1D89AF004D28FA /* NovaList */,
00A2D47B2C1AEFBF00A15ECA /* HomePage */,
00A2D4812C1AEFBF00A15ECA /* ImAnchor */,
00A2D4842C1AEFBF00A15ECA /* StartPage */,
......@@ -3805,6 +3823,45 @@
path = FusiVersionFeature;
sourceTree = "<group>";
};
00A36A462C1D89AF004D28FA /* NovaList */ = {
isa = PBXGroup;
children = (
00A36A4F2C1D8A55004D28FA /* Model */,
00A36A4B2C1D8A1C004D28FA /* ViewModel */,
00A36A4A2C1D8A16004D28FA /* View */,
00A36A472C1D89DE004D28FA /* FUSHomeNovaListViewController.h */,
00A36A482C1D89DE004D28FA /* FUSHomeNovaListViewController.m */,
);
path = NovaList;
sourceTree = "<group>";
};
00A36A4A2C1D8A16004D28FA /* View */ = {
isa = PBXGroup;
children = (
00A36A4C2C1D8A38004D28FA /* FUSHomeNovaListCollectionView.h */,
00A36A4D2C1D8A38004D28FA /* FUSHomeNovaListCollectionView.m */,
);
path = View;
sourceTree = "<group>";
};
00A36A4B2C1D8A1C004D28FA /* ViewModel */ = {
isa = PBXGroup;
children = (
00A36A532C1D8A7C004D28FA /* FUSHomeNovaListBroadcastHelper.h */,
00A36A542C1D8A7C004D28FA /* FUSHomeNovaListBroadcastHelper.m */,
);
path = ViewModel;
sourceTree = "<group>";
};
00A36A4F2C1D8A55004D28FA /* Model */ = {
isa = PBXGroup;
children = (
00A36A502C1D8A68004D28FA /* FUSHomeNovaListModel.h */,
00A36A512C1D8A69004D28FA /* FUSHomeNovaListModel.m */,
);
path = Model;
sourceTree = "<group>";
};
BE0395B82C132E0F003EB21B /* include */ = {
isa = PBXGroup;
children = (
......@@ -9278,6 +9335,7 @@
BED0FAB02C0C49C90017B285 /* FUSPKEmptyView.m in Sources */,
BED0FAB72C0C49C90017B285 /* FUSPKSetView.m in Sources */,
BED0FC982C0C49CA0017B285 /* FUSZoneEditPickerView.m in Sources */,
00A36A592C1D9FD6004D28FA /* FUSLeftPopScrollView.m in Sources */,
BED0FC612C0C49CA0017B285 /* FUSMyZoneVideoCreditCell.m in Sources */,
BED0F8942C0C49C80017B285 /* FUSBannerView.m in Sources */,
BED0FC822C0C49CA0017B285 /* FUSTaskCenterHeaderTableViewCell.m in Sources */,
......@@ -9654,6 +9712,8 @@
BED0FB9D2C0C49CA0017B285 /* FUSLivingSettingViewController.m in Sources */,
00A2D4902C1AEFBF00A15ECA /* FUSMultiDelegate.m in Sources */,
BED0F9082C0C49C80017B285 /* FUSAPIDNSManager.m in Sources */,
00A36A522C1D8A69004D28FA /* FUSHomeNovaListModel.m in Sources */,
00A36A552C1D8A7C004D28FA /* FUSHomeNovaListBroadcastHelper.m in Sources */,
BED0F9D82C0C49C90017B285 /* FUSLoginHelper.m in Sources */,
BED0FA9B2C0C49C90017B285 /* FUSPKAnchorListTableViewCell.m in Sources */,
BED0FA0E2C0C49C90017B285 /* FUSLiveGiftCollectionViewCell.m in Sources */,
......@@ -9688,6 +9748,7 @@
BED0F9782C0C49C90017B285 /* FUSVideoChatModel.m in Sources */,
BED0FA532C0C49C90017B285 /* FUSScrollNumberCollectionViewCell.m in Sources */,
BED0F8E42C0C49C80017B285 /* FUSOpenScreenPushModel.m in Sources */,
00A36A4E2C1D8A38004D28FA /* FUSHomeNovaListCollectionView.m in Sources */,
BE03981E2C134566003EB21B /* BezierPath.swift in Sources */,
BED0FB182C0C49CA0017B285 /* FUSNewsFeedListModel.m in Sources */,
BE0397E72C134566003EB21B /* Shape.swift in Sources */,
......@@ -9847,6 +9908,7 @@
BED0FB9B2C0C49CA0017B285 /* FUSCheckNetworkWebController.m in Sources */,
BED0FAF22C0C49CA0017B285 /* FUSLivePushPrepareView.m in Sources */,
BE03982B2C134566003EB21B /* GradientValueProvider.swift in Sources */,
00A36A492C1D89DE004D28FA /* FUSHomeNovaListViewController.m in Sources */,
BED0FA412C0C49C90017B285 /* FUSBulletMessageFluorescenceView.m in Sources */,
BE0397F42C134566003EB21B /* AnyValueContainer.swift in Sources */,
BED0F9452C0C49C90017B285 /* FUSImagePickerSquarePhotoCell.m in Sources */,
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "fus_home_navi_follow_nodata_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "fus_home_navi_follow_nodata_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -14,6 +14,7 @@
#import "FUSCheckRecieveModel.h"
#import "FUSCheckInModel.h"
#import "FUSHomeLanguageGetlistModel.h"
#import "FUSBaoFangBroadcastModel.h"
@interface FUSBaoFangHttpHelper : NSObject
......@@ -282,4 +283,26 @@ typedef enum : NSUInteger {
/// @param failure 1
+(void)fus_homeVestRoomGetlistSuccess:(void(^)(NSArray<FUSBaoFangAnchorModel *> *modelList))success failure:(void(^)(NSString *msg,int code))failure;
/// 新星列表
/// @param page 页吗
/// @param sort 排序(1:按时间、2:按热度)
/// @param success 1
/// @param failure 1
+(void)fus_requestHomeNovaListWithPage:(NSInteger)page sort:(NSInteger)sort success:(void(^)(NSDictionary *responDict))success failure:(void(^)(NSString *msg,int code))failure;
/// 新星主播批量关注
/// @param mark 列表标记
/// @param success 1
/// @param failure 0
+(void)fus_requestRoomNovaBatchLikesWithMark:(NSString *)mark success:(void(^)(void))success failure:(void(^)(NSString *msg,int code))failure;
/// 获取新星主播广播列表
+(void)fus_requestHomeNovaRadioGetAllSuccess:(void(^)(NSArray<FUSBaoFangBroadcastModel *> *modelList))success failure:(void(^)(NSString *msg,int code))failure;
/// Fusi-获取已关注房间列表
/// @param type 列表类别(0:推荐热门,1:关注,2:亲密) 有问题,暂时先全部填0
/// @param success recommend只有用户无关注时返回,同rooms单个房间结构一致
/// @param failure 1
+(void)fus_requestHomeVestFollowGetlistType:(NSInteger)type success:(void(^)(NSMutableArray<FUSBaoFangAnchorModel *> *modelList, FUSBaoFangAnchorModel *recommendModel))success failure:(void(^)(NSString *msg,int code))failure;
@end
......@@ -816,7 +816,7 @@
}
}];
}
/// 获取直播房间列表
+(void)fus_homeVestRoomGetlistSuccess:(void(^)(NSArray<FUSBaoFangAnchorModel *> *modelList))success failure:(void(^)(NSString *msg,int code))failure{
[FUSHttpHelper postRequestBinaryWithUrl:URL_HOME_VEST_ROOM_GETLIST params:nil success:^(NSDictionary *dataDict, int code) {
......@@ -857,5 +857,73 @@
}
}];
}
/// 新星列表
+(void)fus_requestHomeNovaListWithPage:(NSInteger)page sort:(NSInteger)sort success:(void(^)(NSDictionary *responDict))success failure:(void(^)(NSString *msg,int code))failure{
NSMutableDictionary *params = [NSMutableDictionary dictionary];
params[@"page"] = @(page);
params[@"sort"] = @(sort);
[FUSHttpHelper postRequestBinaryWithUrl:URL_HOME_NOVA_LIST params:params success:^(NSDictionary * _Nullable dataDict, int code) {
success(dataDict);
} failure:^(NSDictionary * _Nullable dataDict, int code) {
if (failure) {
failure(FAILURE_MESSAGE, code);
}
}];
}
// 新星主播批量关注
+(void)fus_requestRoomNovaBatchLikesWithMark:(NSString *)mark success:(void(^)(void))success failure:(void(^)(NSString *msg,int code))failure{
NSMutableDictionary *params = [NSMutableDictionary dictionary];
params[@"mark"] = mark;
[FUSHttpHelper postRequestBinaryWithUrl:URL_ROOM_NOVA_BATCH_LIKES params:params success:^(NSDictionary * _Nullable dataDict, int code) {
success();
} failure:^(NSDictionary * _Nullable dataDict, int code) {
if (failure) {
failure(FAILURE_MESSAGE, code);
}
}];
}
/// 获取新星主播广播列表
+(void)fus_requestHomeNovaRadioGetAllSuccess:(void(^)(NSArray<FUSBaoFangBroadcastModel *> *modelList))success failure:(void(^)(NSString *msg,int code))failure{
[FUSHttpHelper postRequestBinaryWithUrl:URL_HOME_NOVA_RADIO_GET_ALL params:nil success:^(NSDictionary * _Nullable dataDict, int code) {
NSArray *radioList = dataDict[@"dataList"];
NSMutableArray *resList = [[NSMutableArray alloc] init];
for (NSDictionary *tempDict in radioList) {
[resList appendObject:[FUSBaoFangBroadcastModel fus_modelWithDict:tempDict]];
}
success(resList);
} failure:^(NSDictionary * _Nullable dataDict, int code) {
if (failure) {
failure(FAILURE_MESSAGE, code);
}
}];
}
/// Fusi-获取已关注房间列表
+(void)fus_requestHomeVestFollowGetlistType:(NSInteger)type success:(void(^)(NSMutableArray<FUSBaoFangAnchorModel *> *modelList, FUSBaoFangAnchorModel *recommendModel))success failure:(void(^)(NSString *msg,int code))failure{
NSMutableDictionary *params = [NSMutableDictionary dictionary];
params[@"type"] = @(type);
[FUSHttpHelper postRequestBinaryWithUrl:URL_HOME_VEST_FOLLOW_GETLIST params:params success:^(NSDictionary * _Nullable dataDict, int code) {
NSMutableArray *resList = [[NSMutableArray alloc] init];
FUSBaoFangAnchorModel *resModel = nil;
NSArray *dataList = dataDict[@"rooms"];
if (dataList != nil && dataList.count > 0) {
for (NSDictionary *tempData in dataList) {
FUSBaoFangAnchorModel *tempModel = [[FUSBaoFangAnchorModel alloc] init];
[tempModel fus_setValueWithDict:tempData];
[resList appendObject:tempModel];
}
}
if ([NSArray isNull:resList]) {
resModel = [FUSBaoFangAnchorModel fus_modelWithDict:dataDict[@"recommend"]];
}
success(resList, resModel);
} failure:^(NSDictionary * _Nullable dataDict, int code) {
if (failure) {
failure(FAILURE_MESSAGE, code);
}
}];
}
@end
......@@ -35,7 +35,8 @@ typedef enum {
@property (nonatomic, assign) CurrentNaviController currentNavigationContrller;
// 自定义tabbarController
/// fusi保存nvc
@property (nonatomic, strong) UINavigationController *homePageViewController;
//@property (nonatomic, strong) UINavigationController *navBoard;
//@property (nonatomic, strong) UINavigationController *navSetting;
......
......@@ -24,8 +24,6 @@
@interface FUSMainViewControllerHelper ()
@property (nonatomic, strong) UINavigationController *homePageViewController;
@end
@implementation FUSMainViewControllerHelper
......@@ -93,7 +91,7 @@
_homePageViewController = [[UINavigationController alloc] initWithRootViewController:[[FUSHomePageViewController alloc] init]];
[UIApplication sharedApplication].delegate.window.rootViewController = _homePageViewController;
//
//解决一些在切换rootViewController时无法显示 keywindow 上面的刚加进去的 View
[[UIApplication sharedApplication].keyWindow bringSubviewToFront:[UIApplication sharedApplication].keyWindow.subviews.firstObject];
......
......@@ -1237,3 +1237,11 @@
#define URL_HOME_LANGUAGE_GETLIST DNS_FUS_API(@"/setting/data/home/language/getlist")
// Fusi-获取直播房间列表
#define URL_HOME_VEST_ROOM_GETLIST DNS_FUS_API(@"/home/vest/room/getlist")
// 新星主播列表
#define URL_HOME_NOVA_LIST DNS_FUS_API(@"/home/nova/list")
// 新星主播批量关注
#define URL_ROOM_NOVA_BATCH_LIKES DNS_FUS_API(@"/room/nova/batch/likes")
// 获取新星主播广播列表
#define URL_HOME_NOVA_RADIO_GET_ALL DNS_FUS_API(@"/home/nova/radio/getAll")
// Fusi-获取已关注房间列表
#define URL_HOME_VEST_FOLLOW_GETLIST DNS_FUS_API(@"/home/vest/follow/getlist")
//
// FUSLeftPopScrollView.h
// FuSiLive
//
// Created by aaa on 2024/6/15.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 这个类是为了能让scrollerview能够适配左滑返回上一页的,可以写成分类全局,但是比较危险,建议写成单独页面
@interface FUSLeftPopScrollView : UIScrollView
@end
NS_ASSUME_NONNULL_END
//
// FUSLeftPopScrollView.m
// FuSiLive
//
// Created by aaa on 2024/6/15.
//
#import "FUSLeftPopScrollView.h"
@implementation FUSLeftPopScrollView
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
// 过滤UITextView(因为UITextView继承自UIScrollView),否则会引起崩溃
if ([gestureRecognizer.view isKindOfClass:[UITextView class]]) {
return YES;
}
CGPoint velocity = [(UIPanGestureRecognizer *)gestureRecognizer velocityInView:self];
CGPoint location = [gestureRecognizer locationInView:self];
if (self.contentOffset.x <= 4 && velocity.x > 0.0 && (NSInteger)location.x % (NSInteger)[UIScreen mainScreen].bounds.size.width < 60) {
return NO;
}
return YES;
}
@end
......@@ -7,13 +7,13 @@
//
#import <UIKit/UIKit.h>
#import "FUSLikeBaoFangModel.h"
#import "FUSBaoFangAnchorModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface FUSShowBroadcastGuideAlertView : UIView
+(void)fus_showOn:(UIView * _Nullable )onView broadcast:(FUSLikeBaoFangModel *)model clickHandler:(void(^)(void))clickHandler;
+(void)fus_showOn:(UIView * _Nullable )onView broadcast:(FUSBaoFangAnchorModel *)model clickHandler:(void(^)(void))clickHandler;
@end
......
......@@ -20,13 +20,13 @@
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) FUSLiveStateAnimationView *liveStateView;
@property (nonatomic, strong) FUSLikeBaoFangModel *model;
@property (nonatomic, strong) FUSBaoFangAnchorModel *model;
@end
@implementation FUSShowBroadcastGuideAlertView
+ (void)fus_showOn:(UIView *)onView broadcast:(FUSLikeBaoFangModel *)model clickHandler:(void (^)(void))clickHandler{
+ (void)fus_showOn:(UIView *)onView broadcast:(FUSBaoFangAnchorModel *)model clickHandler:(void (^)(void))clickHandler{
UIView *showView = [UINavigationController fus_topViewController].view;
if (onView) {
showView = onView;
......@@ -153,12 +153,17 @@
}
#pragma mark --- getter and setter
- (void)setModel:(FUSLikeBaoFangModel *)model{
- (void)setModel:(FUSBaoFangAnchorModel *)model{
_model = model;
self.nameLabel.text = @"egewgwehwe";
self.avatorImageView.backgroundColor = [UIColor yellowColor];
self.liveStateView.roomType = 2;
[self.liveStateView startAnimating];
self.nameLabel.text = model.nickname;
[self.avatorImageView setWebImageWithSubURLString:model.face placeholder:[UIImage themeFontIcon]];
if ([model.haveMC integerValue] == 1) {
self.liveStateView.hidden = NO;
[self.liveStateView startAnimating];
self.liveStateView.roomType = 0;
}else {
self.liveStateView.hidden = YES;
}
}
@end
......@@ -30,6 +30,10 @@ typedef enum :NSInteger{
@property (nonatomic, weak) id<FUSHomeNaviViewDelegate> delegate;
-(void)fus_setButton:(FUSHomeNaviViewClickType)btnType selected:(BOOL)selected;
-(BOOL)fus_isButtonSelected:(FUSHomeNaviViewClickType)btnType;
@end
NS_ASSUME_NONNULL_END
......@@ -36,14 +36,17 @@
make.height.offset(44);
}];
NSArray *imageNamesList = @[@"fus_home_navi_follow_icon", @"fus_home_navi_share_icon", @"fus_home_navi_startLive_icon", @"fus_home_navi_search_icon", @"fus_home_navi_rank_icon"];
NSArray *imageNamesList = @[@"fus_home_navi_follow_nodata_icon", @"fus_home_navi_share_icon", @"fus_home_navi_startLive_icon", @"fus_home_navi_search_icon", @"fus_home_navi_rank_icon"];
NSArray *selectImageNamesList = @[@"fus_home_navi_follow_icon", @"fus_home_navi_share_icon", @"fus_home_navi_startLive_icon", @"fus_home_navi_search_icon", @"fus_home_navi_rank_icon"];
self.btnList = [[NSMutableArray alloc] init];
for (int i = 0; i < imageNamesList.count; i++) {
NSString *imgName = imageNamesList[i];
NSString *selectImgName = selectImageNamesList[i];
FUSTopRightBadgeButton *tempBtn = [FUSTopRightBadgeButton buttonWithType:UIButtonTypeCustom];
[tempBtn setImage:[UIImage imageNamed:imgName] forState:UIControlStateNormal];
[tempBtn setImage:[UIImage imageNamed:selectImgName] forState:UIControlStateSelected];
[bgView addSubview:tempBtn];
tempBtn.tag = i;
......@@ -58,6 +61,23 @@
}];
}
#pragma mark --- method
- (void)fus_setButton:(FUSHomeNaviViewClickType)btnType selected:(BOOL)selected{
if (btnType > self.btnList.count) {
return;
}
UIButton *tempBtn = self.btnList[btnType];
tempBtn.selected = selected;
}
- (BOOL)fus_isButtonSelected:(FUSHomeNaviViewClickType)btnType{
if (btnType > self.btnList.count) {
return NO;
}
UIButton *tempBtn = self.btnList[btnType];
return tempBtn.isSelected;
}
#pragma mark --- button did clicked
-(void)naviBtnDidClicked:(UIButton *)btn{
if (self.delegate && [self.delegate respondsToSelector:@selector(fus_homeNaviView:didClickedBtn:)]) {
......
......@@ -17,6 +17,8 @@
#import "FUSShowBroadcastGuideAlertView.h"
#import "FUSResponsibilityConfirmAlertView.h"
#import "FUSMyEditNameAlertView.h"
#import "FUSHomeNovaListViewController.h"
#import "FuSiLive-Swift.h"
#import "FUSBaoFangMainLiveDataSource.h"
......@@ -54,7 +56,7 @@
[self fus_setup];
[self fus_createUI];
[self.viewModel fus_reloadData];
[self.collectionView.mj_header beginRefreshing];
}
return self;
}
......@@ -62,6 +64,7 @@
-(void)fus_setup{
self.viewModel = [[FUSHomeViewViewModel alloc] init];
self.viewModel.delegate = self;
self.viewModel.anchorListType = FUSHomeViewAnchorListTypeNormal;
self.columnMargin = 0;
self.rowMargin = 0;
......@@ -118,7 +121,12 @@
self.collectionView.frame = self.bounds;
}
#pragma mark scrollview delegate
#pragma mark --- method
-(void)fus_enterRoom:(FUSBaoFangAnchorModel *)model index:(NSInteger)index{
[FUSBaoFangViewHelper fus_clickBaofangItemAtIndex:model type:FUSAnchorHotData controllerType:FUSBaoFangControllerTypeMainLive index:index onLiveRooms:self.viewModel.onlyLiveRoomList];
}
#pragma mark --- scrollview delegate
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.viewModel.dataList.count;
}
......@@ -141,7 +149,28 @@
return YES;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
FUSBaoFangAnchorModel *model = self.viewModel.dataList[indexPath.row];
if (model.fus_itemType == 0) {
// 普通的房间,跳转直播
[self fus_enterRoom:model index:indexPath.row];
}else{
NSString *webUrl = model.fus_insertModel.url;
if (![NSString isNull:webUrl]) {
// 有url则跳转url
FUSWKWebViewController *vc = [[FUSWKWebViewController alloc] init];
vc.webUrlString = webUrl;
[self.parentController.navigationController pushViewController:vc animated:YES];
return;
}
if (model.fus_itemType == 2) {
// 新星主播
FUSHomeNovaListViewController *vc = [[FUSHomeNovaListViewController alloc] init];
[self.parentController.navigationController pushViewController:vc animated:YES];
}
}
}
#pragma mark --- UICollectionViewDelegateFlowLayout
......@@ -180,29 +209,38 @@
// 点击导航栏的按钮
switch (btnType) {
case FUSHomeNaviViewClickTypeFollow:{
[FUSShowBroadcastGuideAlertView fus_showOn:self.parentController.view broadcast:[FUSLikeBaoFangModel new] clickHandler:^{
}];
//点击追踪
BOOL isSelected = [naviView fus_isButtonSelected:FUSHomeNaviViewClickTypeFollow];
FUSHomeViewAnchorListType turnToType = isSelected ? FUSHomeViewAnchorListTypeNormal : FUSHomeViewAnchorListTypeFollow;
if (![self.viewModel fus_switchToList:turnToType]) {
self.viewModel.anchorListType = turnToType;
[self.viewModel fus_reloadData];
}
}
break;
case FUSHomeNaviViewClickTypeShare:{
[FUSResponsibilityConfirmAlertView fus_showOn:self.parentController.view type:1 clickHandler:^(NSInteger clickType) {
if (clickType == 0) {
[FUSAlertView showAlertWithTitle:nil message:FUSLocalizationHelper.versionLocalString(@"您需要勾選所有確認事項後 開啟直播") cancelButtonTitle:FUSLocalizationHelper.versionLocalString(@"確認") otherButtonTitles:nil clickBlock:^(NSInteger buttonIndex) {
NSLog(@"122t23g3232gh2:%ld",buttonIndex);
}];
}
}];
}
break;
case FUSHomeNaviViewClickTypeStartLive:{
[FUSResponsibilityConfirmAlertView fus_showOn:self.parentController.view type:0 clickHandler:^(NSInteger clickType) {
NSLog(@"FUSResponsibilityConfirmAlertViewCLicktype:%ld",clickType);
}];
// [FUSResponsibilityConfirmAlertView fus_showOn:self.parentController.view type:0 clickHandler:^(NSInteger clickType) {
// NSLog(@"FUSResponsibilityConfirmAlertViewCLicktype:%ld",clickType);
// }];
[FUSLiveHelper fus_pushLive];
}
break;
case FUSHomeNaviViewClickTypeSearch:{
[FUSMyEditNameAlertView fus_showOn:self.parentController.view type:0 clickHandler:^(BOOL suc, NSInteger code, NSString * _Nonnull msg) {
// [FUSMyEditNameAlertView fus_showOn:self.parentController.view type:0 clickHandler:^(BOOL suc, NSInteger code, NSString * _Nonnull msg) {
//
// }];
FUSSearchViewController *searchVC = [[FUSSearchViewController alloc] init];
searchVC.searchType = FUSSearchVcTypePeopleNetwork;
[self.parentController.navigationController pushViewController:searchVC animated:YES];
[searchVC fus_clickJump:^{
}];
}
......@@ -218,10 +256,22 @@
self.languageSegmentView.selectName = selectTitle;
}
-(void)fus_homeViewViewModelAnchorListDidUpdate{
-(void)fus_homeViewViewModelAnchorListDidUpdate:(FUSHomeViewAnchorListType)type{
if ([self.collectionView.mj_header isRefreshing]) {
[self.collectionView.mj_header endRefreshing];
}
if (type == FUSHomeViewAnchorListTypeFollow && [NSArray isNull:self.viewModel.dataList]) {
[self.viewModel fus_switchToList:FUSHomeViewAnchorListTypeNormal];
if (self.viewModel.recommendModel != nil) {
FUSWeakSelf(weakself);
[FUSShowBroadcastGuideAlertView fus_showOn:self.parentController.view broadcast:self.viewModel.recommendModel clickHandler:^{
[weakself fus_enterRoom:weakself.viewModel.recommendModel index:0];
}];
}
return;
}
[self.naviView fus_setButton:FUSHomeNaviViewClickTypeFollow selected:type == FUSHomeViewAnchorListTypeFollow ? YES : NO];
[self.collectionView reloadData];
}
......
......@@ -12,6 +12,9 @@
#import "FUSDefine.h"
#import "FUSZoneCacheOperate.h"
#import "FUSImAnchorViewController.h"
#import "FUSSettingViewController.h"
#import "FUSSingleChatViewController.h"
#import "FUSZoneTaskCenterViewController.h"
typedef NS_ENUM(NSInteger, FUSMySettingItemType){
FUSMySettingItemTypeImAnchor = 0,
......@@ -260,6 +263,35 @@ typedef NS_ENUM(NSInteger, FUSMySettingItemType){
[[UINavigationController fus_topViewController].navigationController pushViewController:vc animated:YES];
}
break;
case FUSMySettingItemTypeSetting:{
FUSSettingViewController *settingVC = [[FUSSettingViewController alloc] init];
[self.parentController.navigationController pushViewController:settingVC animated:YES];
}
break;
case FUSMySettingItemTypeHelp:{
if (FUSConfig.sharedInstanced.devConfigs.appStatus) {
FUSSingleChatViewController *serviceChat = [[FUSSingleChatViewController alloc] initWithUID:@(SERVEICE_UID).stringValue face:nil nikename:nil];
serviceChat.isServiceAccount = YES;
[self.parentController.navigationController pushViewController:serviceChat animated:YES];
} else {
FUSWKWebViewController *webVC = [[FUSWKWebViewController alloc] init];
NSString *webURL = FUSLocalizationHelper.isArbicLanguage ? URL_WEB_ARBIC_HELP : URL_WEB_HELP;
webVC.webUrlString = [NSString stringWithFormat:@"%@?lang=%@", webURL,FUSLocalizationHelper.fus_currentLanguage.languageID];
[self.parentController.navigationController pushViewController:webVC animated:YES];
}
}
case FUSMySettingItemTypeTaskReward:{
[FUSTalkingData fus_trackEvent:EVENT_ME_TASKCENTER];
[[NSUserDefaults standardUserDefaults] setObject:@(YES) forKey:TASKCENTER_IS_CLICK];
// if (item.isShowRedCirclePoint) {
// item.isShowRedCirclePoint = NO;
// [weakSelf.tableView reloadData];
// }
FUSZoneTaskCenterViewController *taskCenterVC = [[FUSZoneTaskCenterViewController alloc] init];
[self.parentController.navigationController pushViewController:taskCenterVC animated:YES];
}
break;
default:
break;
......
......@@ -10,6 +10,12 @@
NS_ASSUME_NONNULL_BEGIN
/// 主播列表类型
typedef enum :NSInteger{
FUSHomeViewAnchorListTypeNormal = 0, // 普通
FUSHomeViewAnchorListTypeFollow = 1, // 追踪
}FUSHomeViewAnchorListType;
@protocol FUSHomeViewViewModelDelegate <NSObject>
@optional
......@@ -20,23 +26,34 @@ NS_ASSUME_NONNULL_BEGIN
/// - otherTitlesList: 其他标题
-(void)fus_homeViewViewModelLanguageListDidUpdate:(NSString *)selectTitle others:(NSArray<NSString *> *)otherTitlesList;
/// 主播栏需要更新
-(void)fus_homeViewViewModelAnchorListDidUpdate;
/// 通知主播列表改变
/// - Parameter type: 改变的列表类型
-(void)fus_homeViewViewModelAnchorListDidUpdate:(FUSHomeViewAnchorListType)type;
@end
@interface FUSHomeViewViewModel : NSObject
// 数据请求返回的数据(直播、动态入口、banner、动态四种数据合并的列表)
/// 数据请求返回的数据(直播、动态入口、banner、动态四种数据合并的列表)
@property (nonatomic, strong) NSMutableArray<FUSBaoFangAnchorModel *> * _Nullable dataList;
/// 只有直播间的数据列表,用来上下滚动直播间的
@property (nonatomic, strong) NSMutableArray<FUSBaoFangAnchorModel *> * _Nullable onlyLiveRoomList;
/// 只有用户无关注时返回,同rooms单个房间结构一致
@property (nonatomic, strong) FUSBaoFangAnchorModel * _Nullable recommendModel;
/// 主播类型,关乎请求的
@property (nonatomic, assign) FUSHomeViewAnchorListType anchorListType;
@property (nonatomic, weak) id<FUSHomeViewViewModelDelegate> delegate;
/// 选择语言
/// - Parameter index: 语言index
-(void)fus_selectLanguage:(NSInteger)index;
/// 根据主播列表类型刷新主播列表,语言
-(void)fus_reloadData;
/// 切换到另外一个列表,返回是否能直接切换,能直接切换则切换,不能直接切换则是因为数据还没请求,需要reload
/// - Parameter anchorListType: 列表类型
-(BOOL)fus_switchToList:(FUSHomeViewAnchorListType)anchorListType;
@end
......
......@@ -22,6 +22,8 @@
/// 主播信息原始数据
@property (nonatomic, copy) NSArray<FUSBaoFangAnchorModel *> *anchorOriginalList;
/// 追踪主播原始数据
@property (nonatomic, copy) NSMutableArray<FUSBaoFangAnchorModel *> *followAnchorOriginalList;
@property (nonatomic, assign) BOOL isFirstLoad;
......@@ -34,20 +36,12 @@
self = [super init];
if (self) {
self.isFirstLoad = YES;
[self fus_loadhomeVestFollowGetlistAutoCall:NO];
}
return self;
}
#pragma mark --- method
- (void)fus_reloadData{
if (self.homeLanguageGetList == nil || self.homeLanguageGetList.count <= 0) {
[self fus_loadHomeLanguageListWithAnchorList:YES];
}else {
[self fus_loadvestRoomGetlist];
}
}
#pragma mark --- net work
-(void)fus_loadHomeLanguageListWithAnchorList:(BOOL)shouldLoadAnchorList{
......@@ -102,32 +96,103 @@
[self fus_updateSelectLanguageModel];
if (shouldLoadAnchorList) {
[self fus_loadvestRoomGetlist];
[self fus_loadvestRoomGetlistAutoCall:YES];
}
} failure:^(NSString *msg, int code) {
[FUSDialogView fus_showDialog:msg];
// 为了让下拉刷新可以回调
if (self.delegate && [self.delegate respondsToSelector:@selector(fus_homeViewViewModelAnchorListDidUpdate)]) {
[self.delegate fus_homeViewViewModelAnchorListDidUpdate];
if (shouldLoadAnchorList) {
if (self.delegate && [self.delegate respondsToSelector:@selector(fus_homeViewViewModelAnchorListDidUpdate:)]) {
[self.delegate fus_homeViewViewModelAnchorListDidUpdate:FUSHomeViewAnchorListTypeNormal];
}
}
}];
}
-(void)fus_loadvestRoomGetlist{
-(void)fus_loadvestRoomGetlistAutoCall:(BOOL)autoCall{
[FUSBaoFangHttpHelper fus_homeVestRoomGetlistSuccess:^(NSArray<FUSBaoFangAnchorModel *> *modelList) {
self.anchorOriginalList = modelList;
[self fus_sortDataList];
[self.onlyLiveRoomList removeAllObjects];
for (FUSBaoFangAnchorModel *tempModel in modelList) {
if (tempModel.fus_itemType == 0) {
[self.onlyLiveRoomList addObject:tempModel];
}
}
[self fus_sortNormalDataListAutoCall:autoCall];
} failure:^(NSString *msg, int code) {
[FUSDialogView fus_showDialog:msg];
}];
}
-(void)fus_loadhomeVestFollowGetlistAutoCall:(BOOL)autoCall{
[FUSBaoFangHttpHelper fus_requestHomeVestFollowGetlistType:0 success:^(NSMutableArray<FUSBaoFangAnchorModel *> *modelList, FUSBaoFangAnchorModel *recommendModel) {
self.followAnchorOriginalList = modelList;
self.recommendModel = recommendModel;
if (autoCall) {
// 为了让下拉刷新可以回调
if (self.delegate && [self.delegate respondsToSelector:@selector(fus_homeViewViewModelAnchorListDidUpdate:)]) {
[self.delegate fus_homeViewViewModelAnchorListDidUpdate:FUSHomeViewAnchorListTypeFollow];
}
}
} failure:^(NSString *msg, int code) {
if (autoCall) {
// 为了让下拉刷新可以回调
if (self.delegate && [self.delegate respondsToSelector:@selector(fus_homeViewViewModelAnchorListDidUpdate:)]) {
[self.delegate fus_homeViewViewModelAnchorListDidUpdate:FUSHomeViewAnchorListTypeFollow];
}
}
}];
}
#pragma mark --- method
- (void)fus_reloadData{
if (self.anchorListType == FUSHomeViewAnchorListTypeNormal) {
if (self.homeLanguageGetList == nil || self.homeLanguageGetList.count <= 0) {
[self fus_loadHomeLanguageListWithAnchorList:YES];
}else {
[self fus_loadvestRoomGetlistAutoCall:YES];
}
}else {
[self fus_loadhomeVestFollowGetlistAutoCall:YES];
}
}
- (BOOL)fus_switchToList:(FUSHomeViewAnchorListType)anchorListType{
if (anchorListType == FUSHomeViewAnchorListTypeNormal) {
if (self.homeLanguageGetList == nil || self.homeLanguageGetList.count <= 0 || self.anchorOriginalList == nil) {
return NO;
}else {
self.anchorListType = anchorListType;
[self fus_sortNormalDataListAutoCall:YES];
return YES;
}
}else {
if ([NSArray isNull:self.followAnchorOriginalList] && self.recommendModel == nil) {
return NO;
}else {
self.anchorListType = anchorListType;
self.dataList = [[NSMutableArray alloc] initWithArray:self.followAnchorOriginalList];
if (self.delegate && [self.delegate respondsToSelector:@selector(fus_homeViewViewModelAnchorListDidUpdate:)]) {
[self.delegate fus_homeViewViewModelAnchorListDidUpdate:FUSHomeViewAnchorListTypeFollow];
}
return YES;
}
}
}
/// 选择语言后讲数据排序
-(void)fus_sortDataList{
-(void)fus_sortNormalDataListAutoCall:(BOOL)autoCall{
if (self.selectLanguageModel != nil) {
......@@ -145,8 +210,10 @@
self.dataList = preDataList;
}
if (self.delegate && [self.delegate respondsToSelector:@selector(fus_homeViewViewModelAnchorListDidUpdate)]) {
[self.delegate fus_homeViewViewModelAnchorListDidUpdate];
if (autoCall) {
if (self.delegate && [self.delegate respondsToSelector:@selector(fus_homeViewViewModelAnchorListDidUpdate:)]) {
[self.delegate fus_homeViewViewModelAnchorListDidUpdate:FUSHomeViewAnchorListTypeNormal];
}
}
}
......@@ -180,7 +247,9 @@
self.selectLanguageModel = self.showingOtherLanguagelist[index];
[self fus_updateSelectLanguageModel];
[self fus_sortDataList];
if (self.anchorListType == FUSHomeViewAnchorListTypeNormal) {
[self fus_sortNormalDataListAutoCall:YES];
}
}
#pragma mark --- setter
......@@ -196,5 +265,11 @@
}
return _showingOtherLanguagelist;
}
- (NSMutableArray<FUSBaoFangAnchorModel *> *)onlyLiveRoomList{
if (!_onlyLiveRoomList) {
_onlyLiveRoomList = [[NSMutableArray alloc] init];
}
return _onlyLiveRoomList;
}
@end
......@@ -6,11 +6,15 @@
//
#import "FUSBaofangBaseHomeLiveCell.h"
#import "FUSHomeNovaListModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface FUSHomeAnchorListSmallCell : FUSBaofangBaseHomeLiveCell
/// 赋值这个的话就会变成新星模式
@property (nonatomic, strong) FUSHomeNovaListModel *novaModel;
@end
NS_ASSUME_NONNULL_END
......@@ -6,6 +6,7 @@
//
#import "FUSHomeAnchorListSmallCell.h"
#import "FUSBaoFangTagView.h"
@interface FUSHomeAnchorListSmallCell ()
......@@ -13,12 +14,12 @@
/// 人气值
@property (nonatomic, strong) UIButton *hotNumBtn;
/// 新的标签
@property (nonatomic, strong) UIImageView *neoImageView;
/// 位置
@property (nonatomic, strong) UIButton *locationBtn;
///用户名
@property (nonatomic, strong) UILabel *nickNameLabel;
/// 这个是龟龟左上角new的那个图标,找了一万年没找到
@property (nonatomic, strong) FUSBaoFangTagView *tagView;
@end
......@@ -48,21 +49,14 @@
[self.hotNumBtn setImage:[UIImage imageNamed:@"fus_live_liveRoom_hot_num_icon"] forState:UIControlStateNormal];
self.hotNumBtn.layer.cornerRadius = 20 /2.0f;
self.hotNumBtn.layer.masksToBounds = YES;
self.hotNumBtn.contentEdgeInsets = UIEdgeInsetsMake(0, 4, 0, 0);
self.hotNumBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -4, 0, 0);
[self.bgImageView addSubview:self.hotNumBtn];
[self.hotNumBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.top.offset(6);
make.right.top.inset(6);
make.height.offset(20);
make.width.offset(40);
}];
self.neoImageView = [[UIImageView alloc] init];
[self.bgImageView addSubview:self.neoImageView];
[self.neoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.offset(0);
make.size.mas_equalTo(CGSizeMake(55, 28));
}];
self.nickNameLabel = [[UILabel alloc] init];
self.nickNameLabel.font = [UIFont themeBoldFont:16];
self.nickNameLabel.textColor = [UIColor fus_textColorVeryLight];
......@@ -82,6 +76,10 @@
make.bottom.equalTo(self.nickNameLabel.mas_top).offset(-4);
}];
self.tagView = [[FUSBaoFangTagView alloc] initWithFrame:CGRectMake(0, 0, 1, 38 * UIView.fus_screenW / 375.0)];
self.tagView.itemSpace = 4;
[self.contentView addSubview:self.tagView];
}
- (UIView *)playerSuperView {
......@@ -89,6 +87,19 @@
}
#pragma mark --- getter and setter
- (void)setNovaModel:(FUSHomeNovaListModel *)novaModel{
_novaModel = novaModel;
self.nickNameLabel.text = novaModel.nickname;
if ([NSString isNull:novaModel.addr]) {
self.locationBtn.hidden = YES;
}else {
self.locationBtn.hidden = NO;
[self.locationBtn setTitle:novaModel.addr forState:UIControlStateNormal];
}
self.hotNumBtn.hidden = YES;
[self.bgImageView setWebImageWithSubURLString:novaModel.cover placeholder:[UIImage themeFontIcon]];
}
- (void)setModel:(FUSBaoFangAnchorModel *)model{
[super setModel:model];
......@@ -112,9 +123,13 @@
[self.hotNumBtn setTitle:model.hot forState:UIControlStateNormal];
CGSize hotSize = [model.hot sizeWithFont:self.hotNumBtn.titleLabel.font maxWidth:MAXFLOAT];
[self.hotNumBtn mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.offset(hotSize.width + 14 + 4 + 14);
make.width.offset(hotSize.width + 14 + 4 + 10);
}];
}
self.tagView.hidden = NO;
[self.tagView fus_refreshTagImagesWithModel:model];
[self.bgImageView setWebImageWithSubURLString:model.face placeholder:[UIImage imageNamed:@"icon_baofang_default"]];
}else if (model.fus_itemType == 1 || model.fus_itemType == 2 || model.fus_itemType == 3){
......@@ -122,7 +137,7 @@
self.nickNameLabel.hidden = YES;
self.locationBtn.hidden = YES;
self.hotNumBtn.hidden = YES;
self.neoImageView.hidden = YES;
self.tagView.hidden = YES;
[self.bgImageView setWebImageWithSubURLString:model.fus_insertModel.cover placeholder:[UIImage imageNamed:@"icon_baofang_default"]];
}
......
//
// FUSHomeNovaListViewController.h
// HomeList
//
// Created by aaa on 2024/3/21.
//
#import "FUSBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface FUSHomeNovaListViewController : FUSBaseViewController
@end
NS_ASSUME_NONNULL_END
//
// FUSHomeNovaListModel.h
// HomeList
//
// Created by aaa on 2024/3/21.
//
#import <FUSFoundation/FUSFoundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface FUSHomeNovaListModel : FUSBaseModel
/// 显示封面
@property (nonatomic, copy) NSString *cover;
/// 用户UID
@property (nonatomic, copy) NSString *uid;
/// 用户昵称(urlencode编码)
@property (nonatomic, copy) NSString *nickname;
/// 用户头像
@property (nonatomic, copy) NSString *face;
/// 用户富豪等级
@property (nonatomic, copy) NSString *level;
/// 用户在线等级
@property (nonatomic, copy) NSString *lev;
/// 国家.地区(urlencode编码)
@property (nonatomic, copy) NSString *addr;
/// 性别
@property (nonatomic, copy) NSString *sex;
/// 年龄
@property (nonatomic, copy) NSString *age;
/// 签名(urlencode编码)
@property (nonatomic, copy) NSString *sign;
/// 体重
@property (nonatomic, copy) NSString *weight;
/// 身高
@property (nonatomic, copy) NSString *height;
/// 直播状态(0:未在直播、1:视频直播中、2:语音直播中)
@property (nonatomic, assign) int liveState;
/// 視訊状态(-1:離線中、0:空閒中、2:視訊中)
@property (nonatomic, assign) int videoState;
/// 直播预告(0:未设置、1:已设置)
@property (nonatomic, assign) int previewLive;
@end
NS_ASSUME_NONNULL_END
//
// FUSHomeNovaListModel.m
// HomeList
//
// Created by aaa on 2024/3/21.
//
#import "FUSHomeNovaListModel.h"
@implementation FUSHomeNovaListModel
@end
//
// FUSHomeNovaListCollectionView.h
// HomeList
//
// Created by aaa on 2024/3/22.
//
#import <UIKit/UIKit.h>
#import "FUSHomeNovaListModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface FUSHomeNovaListCollectionView : UIView
/// 排序(1:按时间、2:按热度)
@property (nonatomic, assign) NSInteger sort;
/// 已经跟踪所有(0:否、1:是)
@property (nonatomic, assign) BOOL isFollowAll;
/// 点击事件
@property (nonatomic, copy) void(^clickedHandler)(FUSHomeNovaListModel *model);
/// 已经跟踪所有状态改变
@property (nonatomic, copy) void(^followAllStatusDidChange)(void);
/// 第一次请求数据,如果需要的话
-(void)ff_requestDataSourceIfInNeed;
/// 关注所有
-(void)ff_followAll;
@end
NS_ASSUME_NONNULL_END
//
// FUSHomeNovaListCollectionView.m
// HomeList
//
// Created by aaa on 2024/3/22.
//
#import "FUSHomeNovaListCollectionView.h"
#import <Masonry/Masonry.h>
#import "FUSHomeAnchorListSmallCell.h"
#import "FUSDefine.h"
#import "FUSBaoFangHttpHelper.h"
#import <YYKit/YYKit.h>
@interface FUSHomeNovaListCollectionView ()<UICollectionViewDelegate, UICollectionViewDataSource>
@property (nonatomic, strong) UICollectionView *collectionView;
@property (nonatomic, assign) CGFloat columnMargin; //每一列之间的间距
@property (nonatomic, assign) CGFloat rowMargin; //每一行之间的间距
@property (nonatomic, assign) int columnsCount; //显示多少列
/// 是否是第一次加载
@property (nonatomic, assign) BOOL isFristLoad;
/// 当前页码
@property (nonatomic, assign) NSInteger currentPage;
@property (nonatomic, strong) NSMutableArray<FUSHomeNovaListModel *> *dataSourceList;
@property (nonatomic, strong) FUSEmptyView *emptyView;
/// 返回的数据标识,用于关注所有
@property (nonatomic, copy) NSString *mark;
@end
@implementation FUSHomeNovaListCollectionView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self makeUI];
}
return self;
}
- (instancetype)init
{
self = [super init];
if (self) {
[self makeUI];
}
return self;
}
-(void)makeUI{
self.sort = 1;
self.columnMargin = 0;
self.columnsCount = 2;
self.rowMargin = 0;
self.isFristLoad = YES;
self.currentPage = 1;
self.emptyView = [[FUSEmptyView alloc] initWithFrame:CGRectMake(0, 0, UIView.fus_screenW, UIView.fus_screenH/2.0f)];
[self.emptyView fus_setEmptyViewIcon:[UIImage fus_emptyImg] title:FUSLocalizationHelper.versionLocalString(@"空空如也") buttonTittle:nil];
[self addSubview:self.emptyView];
self.emptyView.hidden = YES;
CGFloat itemWidth = (UIView.fus_screenW - self.rowMargin * 2 - (self.columnsCount - 1) * self.rowMargin) / self.columnsCount;
itemWidth = floor(itemWidth);
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.sectionInset = UIEdgeInsetsMake(0, self.columnMargin, self.columnMargin, self.columnMargin);
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
layout.minimumLineSpacing = self.rowMargin;
layout.minimumInteritemSpacing = self.rowMargin;
layout.itemSize = CGSizeMake(itemWidth, itemWidth);
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, UIView.fus_screenW, UIView.fus_screenH - 50) collectionViewLayout:layout];
self.collectionView.backgroundColor = [UIColor clearColor];
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
self.collectionView.showsVerticalScrollIndicator = NO;
self.collectionView.showsHorizontalScrollIndicator = NO;
self.collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
[self addSubview:self.collectionView];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
[self.collectionView registerClass:[FUSHomeAnchorListSmallCell class] forCellWithReuseIdentifier:@"FUSHomeAnchorListSmallCell"];
FUSWeakSelf(weakself);
self.collectionView.mj_header = [FUSRefreshHeader headerWithRefreshingBlock:^{
[weakself ffloadDataWithHeadRefresh:YES];
}];
self.collectionView.mj_footer = [FUSRefreshAutoFooter footerWithRefreshingBlock:^{
[weakself ffloadDataWithHeadRefresh:NO];
}];
}
#pragma mark ---------- method
- (void)ff_requestDataSourceIfInNeed{
if (self.isFristLoad) {
self.isFristLoad = NO;
[self.collectionView.mj_header beginRefreshing];
}
}
// 全部关注
- (void)ff_followAll{
if (self.dataSourceList.count <= 0) {
return;
}
if (self.mark == nil || self.mark.length <= 0) {
return;
}
[FUSLoadingView fus_showProgressViewWithMessage:nil];
[FUSBaoFangHttpHelper fus_requestRoomNovaBatchLikesWithMark:self.mark success:^{
[FUSLoadingView fus_showProgressViewWithMessage:FUSLocalizationHelper.versionLocalString(@"关注成功")];
[FUSLoadingView fus_dismissProgressView];
self.isFollowAll = YES;
if (self.followAllStatusDidChange) {
self.followAllStatusDidChange();
}
} failure:^(NSString *msg, int code) {
[FUSLoadingView fus_dismissProgressView];
[FUSLoadingView fus_showProgressViewWithMessage:msg];
}];
}
#pragma mark ---------- network
/// 请求数据
/// - Parameter isHeadRefresh: 是否是下啦刷新
-(void)ffloadDataWithHeadRefresh:(BOOL)isHeadRefresh{
if (isHeadRefresh) {
self.currentPage = 1;
}
[FUSBaoFangHttpHelper fus_requestHomeNovaListWithPage:self.currentPage sort:self.sort success:^(NSDictionary *responDict) {
NSInteger pageTotal = [responDict[@"pageTotal"] intValue];
NSArray *dataArr = [NSArray modelArrayWithClass:[FUSHomeNovaListModel class] json:responDict[@"dataList"]];
self.isFollowAll = [responDict[@"followAll"] boolValue];
self.mark = [responDict[@"mark"] description];
if (isHeadRefresh) {
[self.dataSourceList removeAllObjects];
self.dataSourceList = [NSMutableArray arrayWithArray:dataArr];
[self.collectionView.mj_header endRefreshing];
if (pageTotal <= self.currentPage) {
[self.collectionView.mj_footer endRefreshingWithNoMoreData];
}else {
[self.collectionView.mj_footer resetNoMoreData];
}
}else {
[self.dataSourceList addObjectsFromArray:dataArr];
if (pageTotal <= self.currentPage) {
[self.collectionView.mj_footer endRefreshingWithNoMoreData];
}else {
[self.collectionView.mj_footer endRefreshing];
}
}
self.currentPage++;
[self.collectionView reloadData];
if (self.followAllStatusDidChange) {
self.followAllStatusDidChange();
}
} failure:^(NSString *msg, int code) {
[FUSLoadingView fus_showProgressViewWithMessage:msg];
[self.collectionView.mj_header endRefreshing];
[self.collectionView.mj_footer endRefreshing];
}];
}
#pragma mark ---------- collection delegate && datasource
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
return 1;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
if (self.isFristLoad == NO) {
self.emptyView.hidden = self.dataSourceList.count > 0;
}
return self.dataSourceList.count;
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
FUSHomeAnchorListSmallCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"FUSHomeAnchorListSmallCell" forIndexPath:indexPath];
cell.novaModel = self.dataSourceList[indexPath.row];
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
if (self.clickedHandler) {
self.clickedHandler(self.dataSourceList[indexPath.row]);
}
}
#pragma mark ---------- lazy init
- (NSMutableArray<FUSHomeNovaListModel *> *)dataSourceList{
if (!_dataSourceList) {
_dataSourceList = [[NSMutableArray alloc] init];
}
return _dataSourceList;
}
@end
//
// FUSHomeNovaListBroadcastHelper.h
// HomeList
//
// Created by aaa on 2024/4/22.
//
#import <Foundation/Foundation.h>
#import "FUSBaoFangBroadcastView.h"
NS_ASSUME_NONNULL_BEGIN
@interface FUSHomeNovaListBroadcastHelper : NSObject
- (void)ya_addObserveView:(FUSBaoFangBroadcastView *)observeView;
- (void)ya_refreshBroadcastDatas;
- (void)ya_stopAnim;
- (void)ya_startAnimIfNeeded;
@end
NS_ASSUME_NONNULL_END
//
// FUSHomeNovaListBroadcastHelper.m
// HomeList
//
// Created by aaa on 2024/4/22.
//
#import "FUSHomeNovaListBroadcastHelper.h"
#import "FUSBaoFangBroadcastModel.h"
#import "FUSBaoFangHttpHelper.h"
@interface FUSHomeNovaListBroadcastHelper ()
/// 接管的广播view
@property (nonatomic, weak) FUSBaoFangBroadcastView *observeView;
// 固定轮循广播的数据
@property (nonatomic, strong) NSMutableArray<FUSBaoFangBroadcastModel *> *recycleList;
// 当前轮循的位置
@property (nonatomic, assign) NSInteger recycleIndex;
// 是否已经开始轮播了
@property (nonatomic, assign) BOOL hasStartAnim;
@end
@implementation FUSHomeNovaListBroadcastHelper
- (instancetype)init
{
self = [super init];
if (self) {
self.recycleList = [[NSMutableArray alloc] init];
[self ya_refreshBroadcastDatas];
self.hasStartAnim = NO;
}
return self;
}
- (void)ya_addObserveView:(FUSBaoFangBroadcastView *)observeView {
if (self.observeView == observeView) {
return;
}
self.observeView = observeView;
[self ya_startAnimIfNeeded];
}
- (void)ya_stopAnim {
self.hasStartAnim = NO;
}
#pragma - network
-(void)ya_refreshBroadcastDatas{
[FUSBaoFangHttpHelper fus_requestHomeNovaRadioGetAllSuccess:^(NSArray<FUSBaoFangBroadcastModel *> *modelList) {
self.recycleList = [modelList mutableCopy];
self.recycleIndex = 0;
[self ya_startAnimIfNeeded];
} failure:^(NSString *msg, int code) {
}];
}
#pragma mark - Animations
- (void)ya_startAnimIfNeeded {
if (self.hasStartAnim) {
return;
}
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(ya_playCurrentAnim) object:nil];
[self performSelector:@selector(ya_playCurrentAnim) withObject:nil afterDelay:0.3];
}
- (void)ya_playCurrentAnim {
if (!self.observeView) {
return;
}
// 找到当前的model
FUSBaoFangBroadcastModel *model = nil;
if (self.recycleList.count) {
if (self.recycleIndex < 0 || self.recycleIndex >= self.recycleList.count) {
self.recycleIndex = 0;
}
model = self.recycleList[self.recycleIndex];
self.recycleIndex ++;
}
// 找到下一个model
FUSBaoFangBroadcastModel *nextModel = nil;
if (self.recycleList.count) {
NSInteger nextIndex = self.recycleIndex;
if (nextIndex < 0 || nextIndex >= self.recycleList.count) {
nextIndex = 0;
}
nextModel = self.recycleList[nextIndex];
}
// 如果当前的model存在,开始动画
if (model) {
self.hasStartAnim = YES;
FUSWeakSelf(weakSelf);
[self ya_setCurrentModel:model completed:^{
if (nextModel) {
[weakSelf ya_setNextModel:nextModel];
} else {
[weakSelf ya_setNextModel:model];
}
// 开始显示动画
[weakSelf ya_playCurrentAnim:^{
// 动画结束后,切换成第二个广播
[weakSelf ya_changeToNextAnim:^{
// 切换到下个广播之后,重新开始循环
[weakSelf ya_playCurrentAnim];
}];
}];
}];
}
}
#pragma mark - View Functions
- (void)ya_setCurrentModel:(FUSBaoFangBroadcastModel *)model completed:(void(^)(void))completed {
FUSWeakSelf(weakSelf);
[model fus_requestAttr:^{
[weakSelf.observeView fus_setShowLabelWithModel:model];
if (weakSelf.hasStartAnim) {
if (completed) {
completed();
}
}
}];
}
- (void)ya_setNextModel:(FUSBaoFangBroadcastModel *)model {
FUSWeakSelf(weakSelf);
if (self.hasStartAnim) {
[model fus_requestAttr:^{
[weakSelf.observeView fus_setNextShowLabelWithModel:model];
}];
}
}
- (void)ya_playCurrentAnim:(void(^)(void))completed {
if (self.hasStartAnim) {
FUSWeakSelf(weakSelf);
[self.observeView fus_startShowLabelAnimWithMinDuration:3 completed:^{
if (weakSelf.hasStartAnim) {
if (completed) {
completed();
}
}
}];
}
}
- (void)ya_changeToNextAnim:(void(^)(void))completed {
if (self.hasStartAnim) {
FUSWeakSelf(weakSelf);
[self.observeView fus_startChangedToNextLabelAnim:^{
if (weakSelf.hasStartAnim && completed) {
completed();
}
}];
}
}
@end
......@@ -704,7 +704,13 @@
*/
+ (void)fus_quitLiveWithCompletion:(void(^)(void))completion animated:(BOOL)animated {
UITabBarController *vc = [[FUSMainViewControllerHelper themeFontHelper] tabBarController];
// UITabBarController *vc = [[FUSMainViewControllerHelper themeFontHelper] tabBarController];
UIViewController *vc = nil;
if ([[FUSMainViewControllerHelper themeFontHelper] tabBarController]) {
vc = [[FUSMainViewControllerHelper themeFontHelper] tabBarController];
}else if ([[FUSMainViewControllerHelper themeFontHelper] homePageViewController]){
vc = [[FUSMainViewControllerHelper themeFontHelper] homePageViewController];
}
if (vc.presentedViewController) {
[vc dismissViewControllerAnimated:animated completion:^{
......@@ -805,9 +811,16 @@
}
+ (void)fus_showLiveMainVCAnimation:(BOOL)anim Completion:(void (^ __nullable)(void))completion {
if (![[[FUSMainViewControllerHelper themeFontHelper] tabBarController] presentedViewController]) {
// if (![[[FUSMainViewControllerHelper themeFontHelper] tabBarController] presentedViewController]) {
// [[[FUSMainViewControllerHelper themeFontHelper] tabBarController] presentViewController:[[FUSLiveHelper shareInstance] navLive] animated:anim completion:completion];
// [[NSNotificationCenter defaultCenter] postNotificationName:ENTER_LIVE_ROOM object:nil];
// }
if ([[FUSMainViewControllerHelper themeFontHelper] tabBarController] && ![[[FUSMainViewControllerHelper themeFontHelper] tabBarController] presentedViewController]) {
[[[FUSMainViewControllerHelper themeFontHelper] tabBarController] presentViewController:[[FUSLiveHelper shareInstance] navLive] animated:anim completion:completion];
[[NSNotificationCenter defaultCenter] postNotificationName:ENTER_LIVE_ROOM object:nil];
}else if ([[FUSMainViewControllerHelper themeFontHelper] homePageViewController] && ![[[FUSMainViewControllerHelper themeFontHelper] homePageViewController] presentedViewController]){
[[[FUSMainViewControllerHelper themeFontHelper] homePageViewController] presentViewController:[[FUSLiveHelper shareInstance] navLive] animated:anim completion:completion];
[[NSNotificationCenter defaultCenter] postNotificationName:ENTER_LIVE_ROOM object:nil];
}
}
......
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