Commit 8fe9290f by ludi

1.完成首页逻辑

2.修改了广播
parent 3b3254dd
Showing with 924 additions and 60 deletions
......@@ -36,6 +36,10 @@
+(void)printUTF8WithDict:(NSDictionary *)dict;
/// 输出字典转换utf8的字符串以适配中文打印
-(NSString *)dictToUTF8String;
/**
* 中文编码格式打印字典
*/
......
......@@ -70,6 +70,17 @@
printf("--->PrintUTF8Dict:\n%s",[strUTF8 UTF8String]);
}
- (NSString *)dictToUTF8String{
if ([NSDictionary isNull:self]) {
return @"";
}
NSString *tempStr1 = [[self description] stringByReplacingOccurrencesOfString:@"\\u" withString:@"\\U"];
NSString *tempStr2 = [tempStr1 stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""];
NSString *tempStr3 = [[@"\"" stringByAppendingString:tempStr2] stringByAppendingString:@"\""];
NSData *tempData = [tempStr3 dataUsingEncoding:NSUTF8StringEncoding];
NSString *strUTF8 = [NSPropertyListSerialization propertyListWithData:tempData options:NSPropertyListImmutable format:NULL error:NULL];
return strUTF8;
}
/**
* 中文编码格式打印字典
......
......@@ -140,6 +140,10 @@
} else {
dataDict = [self parseDictionaryWithResponseObject:responseObject];
}
// 打印解析结果
if(FUSConfig.sharedInstanced.devConfigs.enableHttpDebug){
NSLog(@"--->URL:%@\n%@",urlStr,dataDict);
}
// 判断空值
if ([NSObject isNullWithDictionary:dataDict]) {
......@@ -337,6 +341,10 @@
} else {
dataDict = [self parseDictionaryWithResponseObject:responseObject];
}
// 打印解析结果
if(FUSConfig.sharedInstanced.devConfigs.enableHttpDebug){
NSLog(@"--->URL:%@\n%@",urlStr,dataDict);
}
// 判断空值
if ([NSObject isNullWithDictionary:dataDict]) {
......@@ -955,6 +963,10 @@
} else {
dataDict = [self parseDictionaryWithResponseObject:responseObject];
}
// 打印解析结果
if(FUSConfig.sharedInstanced.devConfigs.enableHttpDebug){
NSLog(@"--->URL:%@\n%@",urlStr,dataDict);
}
// 判断空值
if ([NSObject isNullWithDictionary:dataDict]) {
......@@ -1393,7 +1405,7 @@ NSString *decimalNumberWithDouble(double conversionValue){
// 先解析json,解析之后再逐层解析URLEncode的百分号数据
jsonDict = [self fus_parseJSONDictionaryLayerByLayerWithObject:jsonDict];
// 打印解析结果
if(FUSConfig.sharedInstanced.devConfigs.enableHttpDebug) [NSDictionary printUTF8WithDict:jsonDict];
// if(FUSConfig.sharedInstanced.devConfigs.enableHttpDebug) [NSDictionary printUTF8WithDict:jsonDict];
// 返回字典
return jsonDict;
......@@ -1460,7 +1472,7 @@ NSString *decimalNumberWithDouble(double conversionValue){
jsonDict = [self fus_parseJSONDictionaryLayerByLayerWithObject:jsonDict];
// 打印解析结果
if(FUSConfig.sharedInstanced.devConfigs.enableHttpDebug) [NSDictionary printUTF8WithDict:jsonDict];
// if(FUSConfig.sharedInstanced.devConfigs.enableHttpDebug) [NSDictionary printUTF8WithDict:jsonDict];
// 返回字典
return jsonDict;
......
......@@ -26,7 +26,7 @@
}
- (UIStatusBarStyle)preferredStatusBarStyle {
return UIStatusBarStyleLightContent;
return UIStatusBarStyleDefault;
}
- (void)viewWillAppear:(BOOL)animated
......@@ -37,7 +37,7 @@
// 显示状态栏
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
// // 设置状态栏为白色
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:NO];
[self setNeedsStatusBarAppearanceUpdate];
[self.navigationController.navigationBar setShadowImage:[[UIImage alloc] init]];
......
......@@ -24,6 +24,9 @@
+ (UIColor *)fus_appMainColor;
+ (UIColor *)fus_appSubColor;
/// 输入框颜色
+(UIColor *)fus_inpuContentColor;
/// 主题蓝色
+(UIColor *)fus_diamondBlue;
/// 泪水蓝
......@@ -44,5 +47,7 @@
/// 弹窗背景颜色
+(UIColor *)fus_alertViewBackgroundColor;
/// 阴影颜色
+(UIColor *)fus_shadowColor;
@end
......@@ -47,6 +47,10 @@
return [UIColor colorWithHex:@"#24242E"];
}
+ (UIColor *)fus_inpuContentColor{
return [UIColor colorWithHex:@"#F3F3F3"];
}
+(UIColor *)fus_diamondBlue{
return [UIColor colorWithHex:@"#01D9E0"];
......@@ -79,5 +83,8 @@
+ (UIColor *)fus_alertViewBackgroundColor{
return [UIColor colorWithHex:@"#000000" alpha:0.6];
}
+ (UIColor *)fus_shadowColor{
return [UIColor colorWithHex:@"#8F8F8F"];
}
@end
......@@ -7,6 +7,9 @@
objects = {
/* Begin PBXBuildFile section */
00A19B9E2C1BE7E30036AE22 /* FUSMyEditNameAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A19B9D2C1BE7E30036AE22 /* FUSMyEditNameAlertView.m */; };
00A19BA32C1C46C40036AE22 /* FUSHomeLanguageGetlistModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A19BA22C1C46C40036AE22 /* FUSHomeLanguageGetlistModel.m */; };
00A19BA62C1C73320036AE22 /* FUSHomeAnchorListSmallCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A19BA52C1C73320036AE22 /* FUSHomeAnchorListSmallCell.m */; };
00A2D48F2C1AEFBF00A15ECA /* FUSLiveStateAnimationView.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A2D44F2C1AEFBF00A15ECA /* FUSLiveStateAnimationView.m */; };
00A2D4902C1AEFBF00A15ECA /* FUSMultiDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A2D4512C1AEFBF00A15ECA /* FUSMultiDelegate.m */; };
00A2D4942C1AEFBF00A15ECA /* FUSResponsibilityConfirmAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A2D45A2C1AEFBF00A15ECA /* FUSResponsibilityConfirmAlertView.m */; };
......@@ -1381,6 +1384,12 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
00A19B9C2C1BE7E30036AE22 /* FUSMyEditNameAlertView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSMyEditNameAlertView.h; sourceTree = "<group>"; };
00A19B9D2C1BE7E30036AE22 /* FUSMyEditNameAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSMyEditNameAlertView.m; sourceTree = "<group>"; };
00A19BA12C1C46C40036AE22 /* FUSHomeLanguageGetlistModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSHomeLanguageGetlistModel.h; sourceTree = "<group>"; };
00A19BA22C1C46C40036AE22 /* FUSHomeLanguageGetlistModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSHomeLanguageGetlistModel.m; sourceTree = "<group>"; };
00A19BA42C1C73320036AE22 /* FUSHomeAnchorListSmallCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSHomeAnchorListSmallCell.h; sourceTree = "<group>"; };
00A19BA52C1C73320036AE22 /* FUSHomeAnchorListSmallCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSHomeAnchorListSmallCell.m; sourceTree = "<group>"; };
00A2D44E2C1AEFBF00A15ECA /* FUSLiveStateAnimationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FUSLiveStateAnimationView.h; sourceTree = "<group>"; };
00A2D44F2C1AEFBF00A15ECA /* FUSLiveStateAnimationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FUSLiveStateAnimationView.m; sourceTree = "<group>"; };
00A2D4502C1AEFBF00A15ECA /* FUSMultiDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FUSMultiDelegate.h; sourceTree = "<group>"; };
......@@ -3613,6 +3622,24 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
00A19B9F2C1BEC8C0036AE22 /* MyEditName */ = {
isa = PBXGroup;
children = (
00A19B9C2C1BE7E30036AE22 /* FUSMyEditNameAlertView.h */,
00A19B9D2C1BE7E30036AE22 /* FUSMyEditNameAlertView.m */,
);
path = MyEditName;
sourceTree = "<group>";
};
00A19BA02C1C46680036AE22 /* Model */ = {
isa = PBXGroup;
children = (
00A19BA12C1C46C40036AE22 /* FUSHomeLanguageGetlistModel.h */,
00A19BA22C1C46C40036AE22 /* FUSHomeLanguageGetlistModel.m */,
);
path = Model;
sourceTree = "<group>";
};
00A2D4582C1AEFBF00A15ECA /* Others */ = {
isa = PBXGroup;
children = (
......@@ -3645,6 +3672,7 @@
00A2D45F2C1AEFBF00A15ECA /* AlertView */ = {
isa = PBXGroup;
children = (
00A19B9F2C1BEC8C0036AE22 /* MyEditName */,
00A2D45B2C1AEFBF00A15ECA /* ResponsibilityConfirm */,
00A2D45E2C1AEFBF00A15ECA /* ShowbroadcastGuide */,
);
......@@ -3656,6 +3684,8 @@
children = (
00A2D4602C1AEFBF00A15ECA /* FUSHomeAnchorCollectionViewSmallCell.h */,
00A2D4612C1AEFBF00A15ECA /* FUSHomeAnchorCollectionViewSmallCell.m */,
00A19BA42C1C73320036AE22 /* FUSHomeAnchorListSmallCell.h */,
00A19BA52C1C73320036AE22 /* FUSHomeAnchorListSmallCell.m */,
);
path = cell;
sourceTree = "<group>";
......@@ -3697,6 +3727,7 @@
00A2D47B2C1AEFBF00A15ECA /* HomePage */ = {
isa = PBXGroup;
children = (
00A19BA02C1C46680036AE22 /* Model */,
00A2D45F2C1AEFBF00A15ECA /* AlertView */,
00A2D4622C1AEFBF00A15ECA /* cell */,
00A2D4732C1AEFBF00A15ECA /* View */,
......@@ -9139,6 +9170,7 @@
BED0FB922C0C49CA0017B285 /* FUSSearchTableViewCell.swift in Sources */,
BED0FC5D2C0C49CA0017B285 /* FUSMyZoneSendJewelCountCell.m in Sources */,
BED0F9F52C0C49C90017B285 /* FUSLiveAuthorizationHelper.m in Sources */,
00A19BA32C1C46C40036AE22 /* FUSHomeLanguageGetlistModel.m in Sources */,
BED0FBDE2C0C49CA0017B285 /* FUSEmotionCollectionViewCell.m in Sources */,
BED0FA862C0C49C90017B285 /* FUSEmitterViewCell.m in Sources */,
BECDD3632C13099700576A03 /* FUSLiveNormalGiftEffectView.m in Sources */,
......@@ -9635,6 +9667,7 @@
BED0FA572C0C49C90017B285 /* GradientLabel.m in Sources */,
BED0F9622C0C49C90017B285 /* FUSSocketMessageQueue.m in Sources */,
BED0F97E2C0C49C90017B285 /* FUSIMChatHttpHelper.m in Sources */,
00A19BA62C1C73320036AE22 /* FUSHomeAnchorListSmallCell.m in Sources */,
BED0FC142C0C49CA0017B285 /* FUSSingleChatTableViewCell.m in Sources */,
BED0FC452C0C49CA0017B285 /* FUSZoneHttpRequest.m in Sources */,
BED0F9122C0C49C90017B285 /* FUSSocialShareHelper.m in Sources */,
......@@ -9649,6 +9682,7 @@
BED0F8B22C0C49C80017B285 /* FUSLikeBaoFangModel.m in Sources */,
BED0F8A92C0C49C80017B285 /* FUSBaoFangThemeViewController.m in Sources */,
BED0FC722C0C49CA0017B285 /* FUSVideoCreditDetailsView.m in Sources */,
00A19B9E2C1BE7E30036AE22 /* FUSMyEditNameAlertView.m in Sources */,
BED0F8CA2C0C49C80017B285 /* FUSBaoFangVideoLiveCollectionViewSmallCell.m in Sources */,
BED0F8912C0C49C80017B285 /* FUSAuthHttpHelper.m in Sources */,
BED0F9782C0C49C90017B285 /* FUSVideoChatModel.m in Sources */,
......
......@@ -5,6 +5,7 @@
"scale" : "1x"
},
{
"filename" : "baofang_broadcast_trumpet_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "fus_live_liveRoom_hot_num_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "fus_live_liveRoom_hot_num_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -17,6 +17,16 @@ typedef NS_ENUM(NSInteger,FUSBaoFangRecommendType) {
FUSBaoFangRecommendTypeReplenish = 4, // 补位推荐位
};
@interface FUSBaoFangAnchorInsertModel : FUSBaseModel
/// 插入位置
@property (nonatomic, assign) NSInteger index;
/// 背景图
@property (nonatomic, copy) NSString *cover;
/// 访问地址
@property (nonatomic, copy) NSString *url;
@end
@interface FUSBaoFangAnchorMicUserModel : FUSBaseModel
// 用户ID
......@@ -143,4 +153,25 @@ typedef NS_ENUM(NSInteger,FUSBaoFangRecommendType) {
// 房间类型(0:视频直播房、2:聊天直播房)
@property (nonatomic, assign) NSInteger roomType;
#pragma mark --- fusi 新加的
/// 收费价格(小于等于0表示不收费)
@property (nonatomic, copy) NSString *tollPrice;
/// 人气值对象({“score”:10000,”lev”:2,”change”:0})
@property (nonatomic, copy) NSDictionary *popular;
/// 房间是否密码(0:未加密、1:加密)
@property (nonatomic, assign) NSInteger encryption;
/// 付费房状态(1:等待期、2:倒计时期、3:表演中)
@property (nonatomic, assign) NSInteger tollState;
/// 标签集合
@property (nonatomic, copy) NSString *roomTags;
/// 语言
@property (nonatomic, copy) NSString *lang;
/// 用来区分cell的类型(自己手动修改的),0=普通类型。1=活动宣传版面。2=新星主播模块。3=FUSI主播应援模块。
@property (nonatomic, assign) NSInteger fus_itemType;
/// 插入的模型
@property (nonatomic, strong) FUSBaoFangAnchorInsertModel *fus_insertModel;
@end
......@@ -9,6 +9,10 @@
#import "FUSBaoFangAnchorModel.h"
#import "FUSNotificationCenter.h"
@implementation FUSBaoFangAnchorInsertModel
@end
@implementation FUSBaoFangAnchorModel
- (instancetype)init
......@@ -16,6 +20,8 @@
self = [super init];
if (self) {
self.hasEndedLive = NO;
self.fus_itemType = 0;
self.lang = @"";
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_liveHasEndedNofitication:) name:BaoFang_Did_End_Live_Notification object:nil];
}
return self;
......
......@@ -67,7 +67,7 @@
dispatch_async(dispatch_get_global_queue(0, 0), ^{
self.attr = [NSMutableAttributedString fus_attributeStringWithHTMLString:self.languageContent baseColor:@"ffffff" font:[UIFont themeFont:13] needRTLTransfer:FUSRTL.isRTL imgHeight:33 imgWidth:0];
self.attr = [NSMutableAttributedString fus_attributeStringWithHTMLString:self.languageContent baseColor:@"303036" font:[UIFont themeFont:13] needRTLTransfer:FUSRTL.isRTL imgHeight:33 imgWidth:0];
dispatch_async(dispatch_get_main_queue(), ^{
if (completed) {
......
......@@ -13,6 +13,7 @@
#import "FUSOpenScreenPushModel.h"
#import "FUSCheckRecieveModel.h"
#import "FUSCheckInModel.h"
#import "FUSHomeLanguageGetlistModel.h"
@interface FUSBaoFangHttpHelper : NSObject
......@@ -270,4 +271,15 @@ typedef enum : NSUInteger {
*/
+ (void)fus_requestStartPageAlertSuccess:(void (^)(FUSCheckInModel *checkInModel, FUSOpenScreenPushModel *openScreenPushModel))success failure:(void (^)(NSString *, int))failure;
/// Fusi-首页语言分类配置
/// @param success 1
/// @param failure 1
+(void)fus_homeLanguageGetlistSuccess:(void(^)(NSArray<FUSHomeLanguageGetlistModel *> *languageList))success failure:(void(^)(NSString *msg,int code))failure;
/// 获取直播房间列表
/// @param success 1
/// @param failure 1
+(void)fus_homeVestRoomGetlistSuccess:(void(^)(NSArray<FUSBaoFangAnchorModel *> *modelList))success failure:(void(^)(NSString *msg,int code))failure;
@end
......@@ -796,4 +796,66 @@
}
}];
}
/// Fusi-首页语言分类配置
+(void)fus_homeLanguageGetlistSuccess:(void(^)(NSArray<FUSHomeLanguageGetlistModel *> *languageList))success failure:(void(^)(NSString *msg,int code))failure{
[FUSHttpHelper postRequestBinaryWithUrl:URL_HOME_LANGUAGE_GETLIST params:nil success:^(NSDictionary *dataDict, int code) {
NSMutableArray *resList = [[NSMutableArray alloc] init];
NSArray *dataList = dataDict[@"languageList"];
if (dataList != nil && dataList.count > 0) {
for (NSDictionary *tempData in dataList) {
FUSHomeLanguageGetlistModel *tempModel = [[FUSHomeLanguageGetlistModel alloc] init];
[tempModel fus_setValueWithDict:tempData];
[resList appendObject:tempModel];
}
}
success(resList);
} failure:^(NSDictionary *dataDict, int code) {
if (failure) {
failure(FAILURE_MESSAGE, code);
}
}];
}
+(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) {
NSMutableArray *resList = [[NSMutableArray alloc] init];
//拼接rooms
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];
}
}
// 拼接插入模型
//1=活动宣传版面。2=新星主播模块。3=FUSI主播应援模块。
NSDictionary *insertItemTypeDict = @{@"activityInfo": @"1", @"novaInfo": @"2", @"supportInfo": @"3"};
NSArray *insertItemSortList = @[@"activityInfo", @"novaInfo", @"supportInfo"];
[insertItemSortList enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(NSString * _Nonnull insertKey, NSUInteger idx, BOOL * _Nonnull stop) {
NSDictionary *inserDict = dataDict[insertKey];
if (inserDict != nil && inserDict.allKeys.count > 0) {
FUSBaoFangAnchorInsertModel *insertModel = [[FUSBaoFangAnchorInsertModel alloc] init];
[insertModel fus_setValueWithDict:inserDict];
FUSBaoFangAnchorModel *tempModel = [[FUSBaoFangAnchorModel alloc] init];
tempModel.fus_itemType = [insertItemTypeDict[insertKey] intValue];
tempModel.fus_insertModel = insertModel;
if (insertModel.index <= resList.count) {
[resList insertObject:tempModel atIndex:insertModel.index];
}
}
}];
success(resList);
} failure:^(NSDictionary *dataDict, int code) {
if (failure) {
failure(FAILURE_MESSAGE, code);
}
}];
}
@end
......@@ -60,8 +60,14 @@
if (self) {
self.bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(6, 0, self.width - 12, self.height)];
self.bgImageView.image = [UIImage imageNamed:@"baofang_broadcast_bg_img"];
// self.bgImageView.image = [UIImage imageNamed:@"baofang_broadcast_bg_img"];
[self addSubview:self.bgImageView];
self.bgImageView.backgroundColor = [UIColor whiteColor];
self.bgImageView.layer.cornerRadius = 8;
self.bgImageView.layer.shadowColor = [UIColor fus_shadowColor].CGColor;
self.bgImageView.layer.shadowOffset = CGSizeMake(0, 2);
self.bgImageView.layer.shadowOpacity = 0.3;
self.bgImageView.layer.shadowRadius = 8;
self.iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 15, 15)];
self.iconImageView.image = [UIImage imageNamed:@"baofang_broadcast_trumpet_icon"];
......
......@@ -135,6 +135,9 @@
// 空间粉丝未读数
#define ZONE_FANS_UNREADER_COUNT @"zoneFansUnreaderCount"
/// 首页语言选择的 language
#define HOME_LANGUAGE_GET_LIST_SELECT_KEY @"HOME_LANGUAGE_GET_LIST_SELECT_KEY"
// deviceToken
#define DEVICE_TOKEN_STRING @"DeviceTokenString"
// deviceToken
......
......@@ -1233,3 +1233,7 @@
//同意协议跳转地址
#define FUS_AGREEMENT DNS_WEB(@"/Nesting/help/Agreement.html")
// Fusi-首页语言分类配置
#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")
//
// FUSMyEditNameAlertView.h
// FuSiLive
//
// Created by aaa on 2024/6/14.
//
#import <UIKit/UIKit.h>
#import "FUSDefine.h"
NS_ASSUME_NONNULL_BEGIN
@interface FUSMyEditNameAlertView : UIView
/// 显示
/// - Parameters:
/// - onView: 显示在哪
/// - type: 0=修改用户名,1=修改珍爱团名
/// - clickHandler: 回调
+(void)fus_showOn:(UIView * _Nullable )onView type:(NSInteger)type clickHandler:(void(^)(BOOL suc, NSInteger code, NSString *msg))clickHandler;
@end
NS_ASSUME_NONNULL_END
//
// FUSMyEditNameAlertView.m
// FuSiLive
//
// Created by aaa on 2024/6/14.
//
#import "FUSMyEditNameAlertView.h"
@interface FUSMyEditNameAlertView ()
/// 0=修改用户名,1=修改珍爱团名
@property (nonatomic, assign) NSInteger viewType;
@property (nonatomic, copy) void(^clickHandler)(BOOL, NSInteger, NSString *);
@property (nonatomic, assign) CGFloat contentViewHeight;
@property (nonatomic, strong) UIView *contentView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *descLabel;
@property (nonatomic, strong) UIView *inpuContentView;
@property (nonatomic, strong) FUSTextField *inpuTextField;
@property (nonatomic, strong) UIButton *okBtn;
@property (nonatomic, strong) UILabel *warningLabel;
@end
@implementation FUSMyEditNameAlertView
+ (void)fus_showOn:(UIView *)onView type:(NSInteger)type clickHandler:(void (^)(BOOL, NSInteger, NSString * _Nonnull))clickHandler{
UIView *showView = [UINavigationController fus_topViewController].view;
if (onView) {
showView = onView;
}
FUSMyEditNameAlertView *sv = [[FUSMyEditNameAlertView alloc] initWithFrame:showView.bounds];
sv.clickHandler = clickHandler;
sv.viewType = type;
[showView addSubview:sv];
[sv fus_showWithAnimate];
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self fus_createUI];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_keyboardDidShowNotification:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_keyboardWillHideNotification:) name:UIKeyboardWillHideNotification object:nil];
}
return self;
}
-(void)fus_createUI{
self.backgroundColor = [UIColor fus_alertViewBackgroundColor];
self.alpha = 0;
UIButton *tapBgbtn = [UIButton buttonWithType:UIButtonTypeCustom];
tapBgbtn.frame = self.bounds;
[self addSubview:tapBgbtn];
[tapBgbtn addTarget:self action:@selector(fus_dismissWithAnimate) forControlEvents:UIControlEventTouchUpInside];
self.contentViewHeight = 148;
self.contentView = [[UIView alloc] initWithFrame:CGRectMake(0, self.height - self.contentViewHeight, UIView.fus_screenW, self.contentViewHeight)];
self.contentView.backgroundColor = [UIColor fus_appBGColor];
[self.contentView addRoundedCorners:UIRectCornerTopLeft|UIRectCornerTopRight withRadii:CGSizeMake(17, 17)];
[tapBgbtn addSubview:self.contentView];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.font = [UIFont themeBoldFont:18];
self.titleLabel.textColor = [UIColor fus_textColorRich];
[self.contentView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.offset(10);
make.centerX.offset(0);
}];
self.descLabel = [[UILabel alloc] init];
self.descLabel.font = [UIFont themeMediumFont:14];
self.descLabel.textColor = [UIColor fus_textColorRich];
[self.contentView addSubview:self.descLabel];
[self.descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.offset(14);
make.top.equalTo(self.titleLabel.mas_bottom).offset(8);
}];
self.inpuContentView = [[UIView alloc] init];
self.inpuContentView.backgroundColor = [UIColor fus_inpuContentColor];
self.inpuContentView.layer.cornerRadius = 8;
self.inpuContentView.layer.masksToBounds = YES;
[self.contentView addSubview:self.inpuContentView];
self.okBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.okBtn.titleLabel.font = [UIFont themeMediumFont:15];
[self.okBtn setTitleColor:[UIColor fus_textColorRich] forState:UIControlStateNormal];
[self.okBtn setTitle:FUSLocalizationHelper.versionLocalString(@"确定") forState:UIControlStateNormal];
[self.contentView addSubview:self.okBtn];
[self.okBtn addTarget:self action:@selector(fus_okButonDidClicked:) forControlEvents:UIControlEventTouchUpInside];
CGSize oktextSize = [self.okBtn.titleLabel.text sizeWithFont:self.okBtn.titleLabel.font maxWidth:MAXFLOAT];
[self.okBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.bottom.equalTo(self.inpuContentView);
make.right.offset(0);
make.width.offset(oktextSize.width + 28);
}];
[self.inpuContentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.offset(10);
make.top.equalTo(self.descLabel.mas_bottom).offset(8);
make.right.equalTo(self.okBtn.mas_left);
make.height.offset(36);
}];
self.inpuTextField = [[FUSTextField alloc] init];
self.inpuTextField.font = [UIFont themeFont:15];
self.inpuTextField.backgroundColor = [UIColor clearColor];
self.inpuTextField.borderStyle = UITextBorderStyleNone;
[self.inpuContentView addSubview:self.inpuTextField];
[self.inpuTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.inset(9);
make.top.bottom.offset(0);
}];
self.warningLabel = [[UILabel alloc] init];
self.warningLabel.font = [UIFont themeFont:14];
self.warningLabel.textColor = [UIColor fus_textColorMedium];
self.warningLabel.textAlignment = NSTextAlignmentLeft;
[self.contentView addSubview:self.warningLabel];
[self.warningLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.descLabel.mas_left);
make.top.equalTo(self.inpuContentView.mas_bottom).offset(12);
make.right.equalTo(self.contentView.mas_right).offset(-10);
}];
}
#pragma mark --- notification
-(void)fus_keyboardDidShowNotification:(NSNotification *)notification{
CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
CGFloat duration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
[UIView animateWithDuration:duration animations:^{
self.alpha = 1;
self.contentView.y = keyboardFrame.origin.y - self.contentViewHeight;
}];
}
-(void)fus_keyboardWillHideNotification:(NSNotification *)notification{
// CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
CGFloat duration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
[UIView animateWithDuration:duration animations:^{
self.contentView.y = self.height;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
#pragma mark --- button did clicked
-(void)fus_okButonDidClicked:(UIButton *)btn{
}
#pragma mark --- method
-(void)fus_showWithAnimate{
[self.inpuTextField becomeFirstResponder];
}
-(void)fus_dismissWithAnimate{
[self.inpuTextField resignFirstResponder];
}
//获取一些信息分类
-(int)fus_maxTextLength{
if (_viewType == 0) {
return 16;
}else{
return 8;
}
}
-(NSString *)fus_desStr{
if (_viewType == 0) {
return FUSLocalizationHelper.versionLocalString(@"修改昵称消耗 %@ x1");
}else{
return FUSLocalizationHelper.versionLocalString(@"修改珍爱团名消耗 %@ x1");
}
}
-(NSString *)fus_title{
if (_viewType == 0) {
return FUSLocalizationHelper.versionLocalString(@"修改昵称");
}else{
return FUSLocalizationHelper.versionLocalString(@"修改珍爱团名");
}
}
-(NSString *)fus_cardName{
if (_viewType == 0) {
return FUSLocalizationHelper.versionLocalString(@"改名卡");
}else{
return FUSLocalizationHelper.versionLocalString(@"珍爱团改名卡");
}
}
-(UIColor *)fus_cardColor{
if (_viewType == 0) {
return [UIColor fus_diamondBlue];
}else{
return [UIColor colorWithHex:@"#EB6F9E"];
}
}
-(NSString *)fus_placehodler{
if (_viewType == 0) {
return FUSLocalizationHelper.versionLocalString(@"請輸入昵稱");
}else{
return FUSLocalizationHelper.versionLocalString(@"請輸入珍爱团名");
}
}
-(NSString *)fus_warning{
if (_viewType == 0) {
return FUSLocalizationHelper.versionLocalString(@"我們拒絕涉及暴力或明顯裸露、性暗示的暱稱。");
}else{
return FUSLocalizationHelper.versionLocalString(@"");
}
}
#pragma mark --- getter and setter
- (void)setViewType:(NSInteger)viewType{
_viewType = viewType;
NSString *descStr = [self fus_desStr];
NSString *cardNameStr = [self fus_cardName];
UIColor *cardColor = [self fus_cardColor];
descStr = [descStr stringByReplacingOccurrencesOfString:@"%@" withString:cardNameStr];
NSMutableAttributedString *descAtt = [[NSMutableAttributedString alloc] initWithString:descStr attributes:@{NSForegroundColorAttributeName: [UIColor fus_textColorRich], NSFontAttributeName: [UIFont themeMediumFont:14]}];
[descAtt addAttribute:NSForegroundColorAttributeName value:cardColor range:[descStr rangeOfString:cardNameStr]];
self.descLabel.attributedText = descAtt;
self.titleLabel.text = [self fus_title];
[self.titleLabel sizeToFit];
self.inpuTextField.textMaxLength = [self fus_maxTextLength];
self.inpuTextField.placeholder = [self fus_placehodler];
self.warningLabel.text = [self fus_warning];
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
@end
//
// FUSHomeLanguageGetlistModel.h
// FuSiLive
//
// Created by aaa on 2024/6/14.
//
#import <FUSFoundation/FUSFoundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface FUSHomeLanguageGetlistModel : FUSBaseModel
/// -1=oher,
@property (nonatomic, copy) NSString *language;
@property (nonatomic, copy) NSString *content;
@end
NS_ASSUME_NONNULL_END
//
// FUSHomeLanguageGetlistModel.m
// FuSiLive
//
// Created by aaa on 2024/6/14.
//
#import "FUSHomeLanguageGetlistModel.h"
@implementation FUSHomeLanguageGetlistModel
@end
......@@ -21,9 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, weak) id<FUSHomeLanguageSegmentViewDelegate> delegate;
-(void)fus_setTitleNamesList:(NSArray *)titleNamesList;
-(void)fus_setSelect:(NSInteger)index;
@property (nonatomic, copy) NSString *selectName;
@property (nonatomic, copy) NSArray *otherNamesList;
@end
......
......@@ -11,15 +11,12 @@
@interface FUSHomeLanguageSegmentView ()
@property (nonatomic, strong) NSArray *orignalTitleNamesList;
@property (nonatomic, strong) UIButton *selectBtn;
@property (nonatomic, strong) NSMutableArray *btnList;
@property (nonatomic, strong) UIScrollView *btnScrollView;
@property (nonatomic, strong) UIStackView *btnBgView;
@property (nonatomic, assign) NSInteger currentSelect;
@end
@implementation FUSHomeLanguageSegmentView
......@@ -42,7 +39,6 @@
}
-(void)fus_createUI{
self.currentSelect = 0;
self.selectBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.selectBtn.titleLabel.font = [UIFont themeBoldFont:13];
......@@ -85,7 +81,6 @@
#pragma mark --- method
- (void)fus_setTitleNamesList:(NSArray *)titleNamesList{
self.orignalTitleNamesList = titleNamesList;
[self.btnList removeAllObjects];
for (UIView *tempView in self.btnBgView.arrangedSubviews) {
......@@ -113,28 +108,12 @@
[self.btnList addObject:tagBtn];
}
[self fus_tagBtnDidClicked:0];
}
- (void)fus_setSelect:(NSInteger)index{
if (index >= self.btnList.count) {
return;
}
for (int i = 0; i < self.btnList.count; i++) {
UIButton *tagBtn = self.btnList[i];
tagBtn.hidden = (i == index);
}
[self.selectBtn setTitle:self.orignalTitleNamesList[index] forState:UIControlStateNormal];
self.currentSelect = index;
}
#pragma mark --- button did clicked
-(void)fus_tagBtnDidClicked:(UIButton *)btn{
[self fus_setSelect:btn.tag];
if (self.delegate && [self.delegate respondsToSelector:@selector(fus_homeLanguageSegmentViewDidClicked:)]) {
[self.delegate fus_homeLanguageSegmentViewDidClicked:btn.tag];
}
......@@ -147,5 +126,13 @@
}
return _btnList;
}
- (void)setOtherNamesList:(NSArray *)otherNamesList{
_otherNamesList = otherNamesList;
[self fus_setTitleNamesList:otherNamesList];
}
- (void)setSelectName:(NSString *)selectName{
_selectName = selectName;
[self.selectBtn setTitle:selectName forState:UIControlStateNormal];
}
@end
......@@ -11,17 +11,18 @@
#import "FUSBaoFangBroadcastView.h"
#import "FUSBaofangBroadcastHelper.h"
#import "FUSBaoFangBaseCollectionView.h"
#import "FUSHomeAnchorCollectionViewSmallCell.h"
#import "FUSHomeAnchorListSmallCell.h"
#import "FUSBannerViewCell.h"
#import "FUSHomeViewViewModel.h"
#import "FUSShowBroadcastGuideAlertView.h"
#import "FUSResponsibilityConfirmAlertView.h"
#import "FUSMyEditNameAlertView.h"
#import "FUSBaoFangMainLiveDataSource.h"
#import "FUSDefine.h"
@interface FUSHomeView ()<FUSHomeNaviViewDelegate, FUSHomeLanguageSegmentViewDelegate, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
@interface FUSHomeView ()<FUSHomeNaviViewDelegate, FUSHomeLanguageSegmentViewDelegate, FUSHomeViewViewModelDelegate, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
#pragma mark 头部部分
@property (nonatomic, strong) UIView *titleContainerView;
......@@ -52,15 +53,18 @@
if (self) {
[self fus_setup];
[self fus_createUI];
[self.viewModel fus_reloadData];
}
return self;
}
-(void)fus_setup{
self.viewModel = [[FUSHomeViewViewModel alloc] init];
self.viewModel.delegate = self;
self.columnMargin = 3;
self.rowMargin = 3;
self.columnMargin = 0;
self.rowMargin = 0;
self.columnsCount = 2;
}
......@@ -76,7 +80,6 @@
[self.titleContainerView addSubview:self.naviView];
self.languageSegmentView = [[FUSHomeLanguageSegmentView alloc] initWithFrame:CGRectMake(0, self.naviView.bottom, UIView.fus_screenW, 40)];
[self.languageSegmentView fus_setTitleNamesList:@[@"中文",@"English",@"日語",@"Tiếng Việt",@"23232g34",@"32g342eg2",@"sdvdhrde",@"45j452"]];
self.languageSegmentView.delegate = self;
[self.titleContainerView addSubview:self.languageSegmentView];
......@@ -98,10 +101,15 @@
self.collectionView.backgroundColor = [UIColor clearColor];
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
[self.collectionView registerClass:[FUSHomeAnchorCollectionViewSmallCell class] forCellWithReuseIdentifier:@"FUSHomeAnchorCollectionViewSmallCell"];
[self.collectionView registerClass:[FUSHomeAnchorListSmallCell class] forCellWithReuseIdentifier:@"FUSHomeAnchorListSmallCell"];
[self addSubview:self.collectionView];
[self bringSubviewToFront:self.titleContainerView];
self.collectionView.mj_header = [FUSRefreshHeader headerWithRefreshingBlock:^{
[self.viewModel fus_reloadData];
}];
self.collectionView.mj_header.backgroundColor = [UIColor fus_appSubColor];
}
- (void)layoutSubviews{
......@@ -116,14 +124,9 @@
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
FUSHomeAnchorCollectionViewSmallCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"FUSHomeAnchorCollectionViewSmallCell" forIndexPath:indexPath];
cell.layer.cornerRadius = 4;
cell.layer.masksToBounds = YES;
FUSHomeAnchorListSmallCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"FUSHomeAnchorListSmallCell" forIndexPath:indexPath];
cell.contentView.backgroundColor = [UIColor yellowColor];
cell.layer.borderWidth = 1;
cell.layer.borderColor = [UIColor blackColor].CGColor;
cell.model = self.viewModel.dataList[indexPath.row];
return cell;
}
......@@ -144,11 +147,6 @@
#pragma mark --- UICollectionViewDelegateFlowLayout
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
// if ([self.dataList[indexPath.row] isKindOfClass:[FUSBannerModel class]]) {
// UIEdgeInsets sectionInset = ((UICollectionViewFlowLayout *)collectionViewLayout).sectionInset;
// return CGSizeMake(collectionView.width - sectionInset.left - sectionInset.right, BANNER_HEIGHT);
// }
//
CGFloat width = [self fus_itemWidth];
CGFloat height = width;
......@@ -203,16 +201,34 @@
}];
}
break;
case FUSHomeNaviViewClickTypeSearch:{
[FUSMyEditNameAlertView fus_showOn:self.parentController.view type:0 clickHandler:^(BOOL suc, NSInteger code, NSString * _Nonnull msg) {
}];
}
break;
default:
break;
}
}
#pragma mark --- FUSHomeViewViewModelDelegate
-(void)fus_homeViewViewModelLanguageListDidUpdate:(NSString *)selectTitle others:(NSArray<NSString *> *)otherTitlesList{
self.languageSegmentView.otherNamesList = otherTitlesList;
self.languageSegmentView.selectName = selectTitle;
}
-(void)fus_homeViewViewModelAnchorListDidUpdate{
if ([self.collectionView.mj_header isRefreshing]) {
[self.collectionView.mj_header endRefreshing];
}
[self.collectionView reloadData];
}
#pragma mark --- FUSHomeLanguageSegmentViewDelegate
- (void)fus_homeLanguageSegmentViewDidClicked:(NSInteger)index{
// 点击语言
[self.viewModel fus_selectLanguage:index];
}
#pragma mark --- scrollview delegate
......
......@@ -36,7 +36,7 @@
tempBgView.tag = [typeNum integerValue];
tempBgView.backgroundColor = [UIColor whiteColor];
tempBgView.layer.cornerRadius = 8;
tempBgView.layer.shadowColor = [UIColor colorWithHex:@"#8F8F8F"].CGColor;
tempBgView.layer.shadowColor = [UIColor fus_shadowColor].CGColor;
tempBgView.layer.shadowOffset = CGSizeMake(0, 2);
tempBgView.layer.shadowOpacity = 0.3;
tempBgView.layer.shadowRadius = 8;
......
......@@ -158,13 +158,16 @@
-(void)fus_createMessageColumn{
//分页控制
_segCtrlView = [[FUSSegmentControlView alloc] initWithFrame:CGRectMake(0, 0, UIView.fus_screenW*0.5, 38) withItems:@[FUSLocalizationHelper.versionLocalString(@"私信"),FUSLocalizationHelper.versionLocalString(@"亲密")]];
_segCtrlView = [[FUSSegmentControlView alloc] initWithFrame:CGRectMake(0, 0, UIView.fus_screenW, 38) withItems:@[FUSLocalizationHelper.versionLocalString(@"私信"),FUSLocalizationHelper.versionLocalString(@"亲密")]];
// [_segCtrlView fus_setUnderLineSelectedImage:[UIImage imageNamed:@"common_icon_segment_selected"]];
_segCtrlView.itemSelectedFont = [UIFont themeBoldFont:18];
_segCtrlView.itemFont = [UIFont themeBoldFont:18];
[_segCtrlView fus_setItemTitleColor:[UIColor blackColor] forState:UIControlStateSelected];
[_segCtrlView fus_setItemTitleColor:[UIColor colorWithHex:@"#000000" alpha:0.6] forState:UIControlStateNormal];
_segCtrlView.alignment = FUSSegmentControlAlignmentLeft;
// _segCtrlView.underLine = underLineView;
_segCtrlView.underLine.backgroundColor = [UIColor fus_textColorRich];
_segCtrlView.isShowUnderLine = YES;
if (UIView.fus_screenW > 320) {
_segCtrlView.space = 30;
}else{
......@@ -176,6 +179,7 @@
make.top.equalTo(self.headerStackView.mas_bottom);
make.height.offset(38);
}];
[_segCtrlView fus_setSelectedItem:0 autoCallBack:NO];
WEAKSELF;
_segCtrlView.selectItemBlock = ^(NSInteger index, NSString *itemText) {
......
......@@ -10,10 +10,33 @@
NS_ASSUME_NONNULL_BEGIN
@protocol FUSHomeViewViewModelDelegate <NSObject>
@optional
/// 语言栏需要更新
/// - Parameters:
/// - selectTitle: 当前标题
/// - otherTitlesList: 其他标题
-(void)fus_homeViewViewModelLanguageListDidUpdate:(NSString *)selectTitle others:(NSArray<NSString *> *)otherTitlesList;
/// 主播栏需要更新
-(void)fus_homeViewViewModelAnchorListDidUpdate;
@end
@interface FUSHomeViewViewModel : NSObject
// 数据请求返回的数据(直播、动态入口、banner、动态四种数据合并的列表)
@property (nonatomic, strong) NSMutableArray * _Nullable dataList;
@property (nonatomic, strong) NSMutableArray<FUSBaoFangAnchorModel *> * _Nullable dataList;
@property (nonatomic, weak) id<FUSHomeViewViewModelDelegate> delegate;
/// 选择语言
/// - Parameter index: 语言index
-(void)fus_selectLanguage:(NSInteger)index;
-(void)fus_reloadData;
@end
......
......@@ -7,11 +7,23 @@
//
#import "FUSHomeViewViewModel.h"
#import "FUSBaoFangHttpHelper.h"
#import "FUSDefine.h"
@interface FUSHomeViewViewModel ()
/// 语言原始数据
@property (nonatomic, copy) NSArray<FUSHomeLanguageGetlistModel *> *homeLanguageGetList;
/// 选择的语言
@property (nonatomic, strong) FUSHomeLanguageGetlistModel *selectLanguageModel;
/// 显示中的其他语言,也就是剔除了选择的语言
@property (nonatomic, copy) NSMutableArray<FUSHomeLanguageGetlistModel *> *showingOtherLanguagelist;
/// 主播信息原始数据
@property (nonatomic, copy) NSArray<FUSBaoFangAnchorModel *> *anchorOriginalList;
@property (nonatomic, assign) BOOL isFirstLoad;
@end
......@@ -21,15 +33,154 @@
{
self = [super init];
if (self) {
[self fus_setup];
self.isFirstLoad = YES;
}
return self;
}
-(void)fus_setup{
for (int i = 0; i < 100; i++) {
[self.dataList addObject:@"0"];
#pragma mark --- method
- (void)fus_reloadData{
if (self.homeLanguageGetList == nil || self.homeLanguageGetList.count <= 0) {
[self fus_loadHomeLanguageListWithAnchorList:YES];
}else {
[self fus_loadvestRoomGetlist];
}
}
-(void)fus_loadHomeLanguageListWithAnchorList:(BOOL)shouldLoadAnchorList{
[FUSBaoFangHttpHelper fus_homeLanguageGetlistSuccess:^(NSArray<FUSHomeLanguageGetlistModel *> *languageList) {
self.homeLanguageGetList = languageList;
if (self.isFirstLoad && self.homeLanguageGetList.count > 0) {
// 第一次加载
self.isFirstLoad = NO;
// 先取出存储
NSString *languageKey = [[NSUserDefaults standardUserDefaults] objectForKey:HOME_LANGUAGE_GET_LIST_SELECT_KEY];
if (languageKey != nil && languageKey.length > 0) {
for (FUSHomeLanguageGetlistModel *tempModel in self.homeLanguageGetList) {
if ([tempModel.language isEqualToString:languageKey]) {
self.selectLanguageModel = tempModel;
break;
}
}
}else {
// 如果没有选择第一个
self.selectLanguageModel = [self.homeLanguageGetList firstObject];
}
}else {
// 如果不是第一次加载了,那么复选一下
if (self.homeLanguageGetList.count > 0) {
if (self.selectLanguageModel == nil) {
// 没有选择,则选择第一个
self.selectLanguageModel = [self.homeLanguageGetList firstObject];
}else {
//有选择,则复选
BOOL hasSelectItem = NO;
for (FUSHomeLanguageGetlistModel *tempModel in self.homeLanguageGetList) {
if ([tempModel.language isEqualToString:self.selectLanguageModel.language]) {
self.selectLanguageModel = tempModel;
hasSelectItem = YES;
break;
}
}
// 如果复选未命中,则代表列表刷新了,并且之前的选择没有了,则选择第一个
if (hasSelectItem == NO) {
self.selectLanguageModel = [self.homeLanguageGetList firstObject];
}
}
}else {
// 如果请求成功了,然后列表仍然什么都没有,那么代表服务器清空数据了,这边也清空
self.selectLanguageModel = nil;
}
}
[self fus_updateSelectLanguageModel];
if (shouldLoadAnchorList) {
[self fus_loadvestRoomGetlist];
}
} failure:^(NSString *msg, int code) {
[FUSDialogView fus_showDialog:msg];
// 为了让下拉刷新可以回调
if (self.delegate && [self.delegate respondsToSelector:@selector(fus_homeViewViewModelAnchorListDidUpdate)]) {
[self.delegate fus_homeViewViewModelAnchorListDidUpdate];
}
}];
}
-(void)fus_loadvestRoomGetlist{
[FUSBaoFangHttpHelper fus_homeVestRoomGetlistSuccess:^(NSArray<FUSBaoFangAnchorModel *> *modelList) {
self.anchorOriginalList = modelList;
[self fus_sortDataList];
} failure:^(NSString *msg, int code) {
[FUSDialogView fus_showDialog:msg];
}];
}
/// 选择语言后讲数据排序
-(void)fus_sortDataList{
if (self.selectLanguageModel != nil) {
[self.dataList removeAllObjects];
NSMutableArray *preDataList = [[NSMutableArray alloc] init];
NSMutableArray *subDataList = [[NSMutableArray alloc] init];
for (FUSBaoFangAnchorModel *tempModel in self.anchorOriginalList) {
if ([tempModel.lang isEqualToString:self.selectLanguageModel.language]) {
[preDataList addObject:tempModel];
}else {
[subDataList addObject:tempModel];
}
}
[preDataList addObjectsFromArray:subDataList];
self.dataList = preDataList;
}
if (self.delegate && [self.delegate respondsToSelector:@selector(fus_homeViewViewModelAnchorListDidUpdate)]) {
[self.delegate fus_homeViewViewModelAnchorListDidUpdate];
}
}
/// 更新语言选择的模型,主要是为了适配其他未选择的语言
-(void)fus_updateSelectLanguageModel{
//存储一下
[[NSUserDefaults standardUserDefaults] setValue:self.selectLanguageModel == nil ? @"" : self.selectLanguageModel.language forKey:HOME_LANGUAGE_GET_LIST_SELECT_KEY];
NSMutableArray *titleNamesList = [[NSMutableArray alloc] init];
[self.showingOtherLanguagelist removeAllObjects];
for (FUSHomeLanguageGetlistModel *tempModel in self.homeLanguageGetList) {
if (![tempModel.language isEqualToString:self.selectLanguageModel.language]) {
[titleNamesList appendObject:tempModel.content];
[self.showingOtherLanguagelist addObject:tempModel];
}
}
if (self.delegate && [self.delegate respondsToSelector:@selector(fus_homeViewViewModelLanguageListDidUpdate:others:)]) {
[self.delegate fus_homeViewViewModelLanguageListDidUpdate:self.selectLanguageModel == nil ? @"" : self.selectLanguageModel.content others:titleNamesList];
}
}
- (void)fus_selectLanguage:(NSInteger)index{
if (self.showingOtherLanguagelist.count <= index || index < 0) {
return;
}
self.selectLanguageModel = self.showingOtherLanguagelist[index];
[self fus_updateSelectLanguageModel];
[self fus_sortDataList];
}
#pragma mark --- setter
......@@ -39,5 +190,11 @@
}
return _dataList;
}
- (NSMutableArray<FUSHomeLanguageGetlistModel *> *)showingOtherLanguagelist{
if (!_showingOtherLanguagelist) {
_showingOtherLanguagelist = [[NSMutableArray alloc] init];
}
return _showingOtherLanguagelist;
}
@end
//
// FUSHomeAnchorListSmallCell.h
// FuSiLive
//
// Created by aaa on 2024/6/14.
//
#import "FUSBaofangBaseHomeLiveCell.h"
NS_ASSUME_NONNULL_BEGIN
@interface FUSHomeAnchorListSmallCell : FUSBaofangBaseHomeLiveCell
@end
NS_ASSUME_NONNULL_END
//
// FUSHomeAnchorListSmallCell.m
// FuSiLive
//
// Created by aaa on 2024/6/14.
//
#import "FUSHomeAnchorListSmallCell.h"
@interface FUSHomeAnchorListSmallCell ()
@property (nonatomic, strong) UIImageView *bgImageView; //用户图
/// 人气值
@property (nonatomic, strong) UIButton *hotNumBtn;
/// 新的标签
@property (nonatomic, strong) UIImageView *neoImageView;
/// 位置
@property (nonatomic, strong) UIButton *locationBtn;
///用户名
@property (nonatomic, strong) UILabel *nickNameLabel;
@end
@implementation FUSHomeAnchorListSmallCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self fus_createUI];
}
return self;
}
-(void)fus_createUI{
self.bgImageView = [[UIImageView alloc] init];
[self.contentView addSubview:self.bgImageView];
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.contentView);
}];
self.hotNumBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.hotNumBtn.backgroundColor = [UIColor colorWithHex:@"#040404" alpha:0.24];
self.hotNumBtn.titleLabel.font = [UIFont themeFont:11];
[self.hotNumBtn setTitleColor:[UIColor fus_textColorVeryLight] forState:UIControlStateNormal];
[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.bgImageView addSubview:self.hotNumBtn];
[self.hotNumBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.top.offset(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];
[self.bgImageView addSubview:self.nickNameLabel];
[self.nickNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.offset(8);
make.bottom.offset(-9);
}];
self.locationBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.locationBtn.titleLabel.font = [UIFont themeMediumFont:10];
[self.locationBtn setImage:[UIImage imageNamed:@"BaoFang_icon_address"] forState:UIControlStateNormal];
[self.locationBtn setTitleColor:[UIColor fus_textColorVeryLight] forState:UIControlStateNormal];
[self.bgImageView addSubview:self.locationBtn];
[self.locationBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.nickNameLabel.mas_left);
make.bottom.equalTo(self.nickNameLabel.mas_top).offset(-4);
}];
}
- (UIView *)playerSuperView {
return self.bgImageView;
}
#pragma mark --- getter and setter
- (void)setModel:(FUSBaoFangAnchorModel *)model{
[super setModel:model];
if(![model isKindOfClass:[FUSBaoFangAnchorModel class]]) {
return;
}
if (model.fus_itemType == 0) {
self.nickNameLabel.hidden = NO;
self.nickNameLabel.text = model.nickname;
if ([NSString isNull:model.addr]) {
self.locationBtn.hidden = YES;
}else {
self.locationBtn.hidden = NO;
[self.locationBtn setTitle:model.addr forState:UIControlStateNormal];
}
if ([NSString isNull:model.hot]) {
self.hotNumBtn.hidden = YES;
}else {
self.hotNumBtn.hidden = NO;
[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);
}];
}
[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){
self.nickNameLabel.hidden = YES;
self.locationBtn.hidden = YES;
self.hotNumBtn.hidden = YES;
self.neoImageView.hidden = YES;
[self.bgImageView setWebImageWithSubURLString:model.fus_insertModel.cover placeholder:[UIImage imageNamed:@"icon_baofang_default"]];
}
}
@end
......@@ -54,7 +54,7 @@
_model = model;
[_faceImageView cancelCurrentImageRequest];
_faceImageView.hidden = NO;
_faceImageView.image = UIImage.fus_defaultIcon;
_faceImageView.image = [UIImage themeFontIcon];
NSInteger level = 0;
......@@ -76,7 +76,7 @@
// 设置头像
NSString *path = [FUSConfig.sharedInstanced.pathConfigs thumbImageSizeUrl:model.face size:_faceImageView.size.width * [UIScreen mainScreen].scale];
[_faceImageView setLiveFaceWebImageWithSubURLString:path placeholder:UIImage.fus_defaultIcon];
[_faceImageView setLiveFaceWebImageWithSubURLString:path placeholder:[UIImage themeFontIcon]];
// 有显示的权利
_richManImageView.top = -2;
......
......@@ -132,7 +132,7 @@
[FUSLog setLogLevel:FUSLogLevelAll];
self.enableTestCode = true;
self.enableSocketDebug = false;
self.enableHttpDebug = false;
self.enableHttpDebug = true;
self.enableDBDebug = false;
break;
case FUSDevlopLevelTest:
......
{
"Signature": "RqP81gBONHgxeBkYBv59/23r03ReNtrsf73EUC1LSuSRK4kYCh37/jyrJ080oPozymGEvPW9banFeoOTJEGGyuX15phDBVBhPSEoYdJyLRN92o9H7GRSpiheMawun0n1Q5soe/hjhOliKMqMn+/d5y3QClaBmMoKGUpmcOSxZ+OcbtsTaoNygjZm/58JpusYLSxGbkMc4mchIOZoS3SzOoaQYm9vPcu+IabQFe6NIgRcaropGJQS7Z+Jxl98chdaw0QVQbapICuL7mWKsRsqZGpMup4q3TvItGZgw390sPnZu+3p0p0wiSLF6Iq7ufdxrqB1GtTjmSFS2KUceK0CkA==",
"Content": "eyJJZCI6IjEwMDY2NyIsICJWZXJzaW9uIjoyLCAiQ2hhbm5lbCI6InZvZCIsICJUeXBlIjoyLCAiUGFja2FnZU5hbWUiOiJjb20ubWl0YW8ubGl2ZSIsICJCdW5kbGVJZCI6ImNvbS5mdC5jaGF0LmlvcyIsICJNb2R1bGVzIjpbeyJOYW1lIjoidm9kX3BsYXkiLCAiRWRpdGlvbiI6InByZW1pdW1fZWRpdGlvbiIsICJTdGFydFRpbWUiOjE2NDA2ODA5MDAxMzUsICJFeHBpcmVUaW1lIjoxNzAzNzUyOTAwMTM1LCAiRXhwaXJlQnVmZmVyIjoxNTU1MjAwMDAwMH0sIHsiTmFtZSI6ImxpdmVfcHVzaCIsICJFZGl0aW9uIjoicHJlbWl1bV9lZGl0aW9uIiwgIlN0YXJ0VGltZSI6MTY0MDY4MDkwMDEzNSwgIkV4cGlyZVRpbWUiOjE3MDM3NTI5MDAxMzUsICJFeHBpcmVCdWZmZXIiOjE1NTUyMDAwMDAwfSwgeyJOYW1lIjoibGl2ZV9wdWxsIiwgIkVkaXRpb24iOiJwcmVtaXVtX2VkaXRpb24iLCAiU3RhcnRUaW1lIjoxNjQwNjgwOTAwMTM1LCAiRXhwaXJlVGltZSI6MTcwMzc1MjkwMDEzNSwgIkV4cGlyZUJ1ZmZlciI6MTU1NTIwMDAwMDB9XSwgIkZpbGVWZXJzaW9uIjoiMTY0MDY4MDkwMDE1Mzg0ODA1NyJ9",
"MainURL": "https://vod-license-m.volccdn.com/vod-license/l-100667-ch-vod-a-209566.lic?x-expires=4794280900&x-signature=b21JKaZc%2Bx1hBlChvd8uedRTq5k%3D",
"BackupURL": "https://vod-license-b.volccdn.com/vod-license/l-100667-ch-vod-a-209566.lic?x-expires=4794280900&x-signature=iNd3uLcF%2FjtSd53v5aZOfLz%2FfD0%3D",
"Id": "100667"
}
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