1.0.19 feat:首页 UI 配置更新
This commit is contained in:
@@ -36,16 +36,28 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
|
||||
///初始化一些 sdk配置
|
||||
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
|
||||
UIStoryboard *launchStoryboard = [UIStoryboard storyboardWithName:@"Launch Screen" bundle:nil];
|
||||
UIViewController *launchScreenVC = [launchStoryboard instantiateInitialViewController];
|
||||
self.window.rootViewController = launchScreenVC;
|
||||
[self.window makeKeyAndVisible];
|
||||
|
||||
|
||||
///初始化一些 sdk配置
|
||||
[self initThirdConfig];
|
||||
[self initUM:application launchOptions:launchOptions];
|
||||
|
||||
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
[self.window makeKeyAndVisible];
|
||||
|
||||
[self loadMainPage];
|
||||
[self setupLaunchADView];
|
||||
@kWeakify(self);
|
||||
[[ClientConfig shareConfig] clientConfig:^{
|
||||
@kStrongify(self);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self loadMainPage];
|
||||
[self setupLaunchADView];
|
||||
});
|
||||
|
||||
}];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@@ -14,12 +14,18 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
///初始化
|
||||
- (void)clientInit;
|
||||
|
||||
/// 获取 UI 配置
|
||||
- (void)clientConfig:(void(^)(void))finish;
|
||||
|
||||
/// iOS第三方登录是否需要绑定手机号
|
||||
@property (nonatomic,assign) BOOL iOSPhoneBind;
|
||||
/// 是否开启了糖果树
|
||||
@property (nonatomic,assign) BOOL openCandyTree;
|
||||
///配置信息
|
||||
@property (nonatomic,strong) ClientDataModel *configInfo;
|
||||
|
||||
@property (nonatomic, strong) AppUISetting *uiSetting;
|
||||
|
||||
///开箱子 大于等级 展示
|
||||
@property (nonatomic, assign) NSInteger openCandyTreeLimitLevel;
|
||||
|
||||
@@ -46,14 +52,19 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
- (UIColor *)bgColor;
|
||||
- (UIImage *)navBGImage;
|
||||
- (UIImage *)tabbarBGImage;
|
||||
- (NSString *)tabName:(NSInteger)tabIndex;
|
||||
- (NSString *)tabNormalImage:(NSInteger)tabIndex;
|
||||
- (NSString *)tabSelectedImage:(NSInteger)tabIndex;
|
||||
- (UIImage *)tabNormalImageImage:(NSInteger)tabIndex;
|
||||
- (UIImage *)tabSelectedImageImage:(NSInteger)tabIndex;
|
||||
|
||||
@property (nonatomic, copy) NSString *reloadNavigationAreaImageKey;
|
||||
@property (nonatomic, copy) NSString *reloadViewBackgroundColorKey;
|
||||
|
||||
@property (nonatomic, strong) UIImage *navigationAreaBG;
|
||||
@property (nonatomic, strong) UIImage *tabbarBGImage;
|
||||
|
||||
- (void)loadTabImages;
|
||||
|
||||
@property (nonatomic, copy) void(^updateTabbarBG)(UIImage *image);
|
||||
@property (nonatomic, copy) void(^updateNormalTabImage)(UIImage *normalImage, NSInteger index);
|
||||
|
@@ -42,6 +42,7 @@
|
||||
config = [[ClientConfig alloc] init];
|
||||
config.isTF = [ClientConfig isTestFlight];
|
||||
config.reloadNavigationAreaImageKey = @"今天光线很好";
|
||||
config.reloadViewBackgroundColorKey = @"年轻人买不起:美国买房平均年龄飙升至56岁";
|
||||
});
|
||||
return config;
|
||||
}
|
||||
@@ -105,9 +106,6 @@
|
||||
self.configInfo = model;
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"reloadAfterLoadConfig" object:nil];
|
||||
|
||||
[self prepareCustomUI];
|
||||
|
||||
} else {
|
||||
if (self.retryCount < 10) {
|
||||
[self clientInit];
|
||||
@@ -117,44 +115,45 @@
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)clientConfig:(void(^)(void))finish {
|
||||
@kWeakify(self);
|
||||
[Api clientConfig:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
if (code == 200) {
|
||||
self.uiSetting = [AppUISetting modelWithJSON:data.data[@"appUiSetting"]];
|
||||
}
|
||||
[self prepareCustomUI];
|
||||
if (finish) {
|
||||
finish();
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)loadTabImages {
|
||||
[self loadNormalTabImage:0];
|
||||
[self loadSelectedTabImage:0];
|
||||
}
|
||||
|
||||
- (void)prepareCustomUI {
|
||||
NSArray *defaultArray = @[@"", @"", @"", @"", @""];
|
||||
self.normalTabImageSource = defaultArray.mutableCopy;
|
||||
self.selectedTabImageSource = defaultArray.mutableCopy;
|
||||
|
||||
#if DEBUG
|
||||
self.configInfo.appUiSetting.homeSelectIcon = @"https://cdn-icons-png.flaticon.com/128/18174/18174161.png";
|
||||
self.configInfo.appUiSetting.homeUnSelectIcon = @"";
|
||||
self.configInfo.appUiSetting.gameSelectIcon = @"";
|
||||
self.configInfo.appUiSetting.gameUnSelectIcon = @"https://cdn-icons-png.flaticon.com/128/18174/18174164.png";
|
||||
self.configInfo.appUiSetting.dynamicSelectIcon = @"https://cdn-icons-png.flaticon.com/128/18174/18174165.png";
|
||||
self.configInfo.appUiSetting.dynamicUnSelectIcon = @"https://cdn-icons-png.flaticon.com/128/18174/18174166.png";
|
||||
self.configInfo.appUiSetting.msgSelectIcon = @"";
|
||||
self.configInfo.appUiSetting.msgUnSelectIcon = @"https://cdn-icons-png.flaticon.com/128/18174/18174168.png";
|
||||
self.configInfo.appUiSetting.mineSelectIcon = @"https://cdn-icons-png.flaticon.com/128/18174/18174169.png";
|
||||
self.configInfo.appUiSetting.mineUnSelectIcon = @" ";
|
||||
|
||||
self.configInfo.appUiSetting.headIcon = @"https://wx1.moyu.im/mw2000/4e093a49ly1hvbccotkj8j23jm2g8e84.jpg";
|
||||
self.configInfo.appUiSetting.navbar = @"https://wx2.moyu.im/mw600/008ElFOcly1hvbe8wq5tkj318g0totuv.jpg";
|
||||
|
||||
self.configInfo.appUiSetting.settingStatus = arc4random()%2;
|
||||
#endif
|
||||
|
||||
if (self.configInfo && self.configInfo.appUiSetting && self.configInfo.appUiSetting.settingStatus == 1) {
|
||||
if (self.uiSetting) {
|
||||
NSArray *unselectIcons = @[
|
||||
self.configInfo.appUiSetting.homeUnSelectIcon ?: @"",
|
||||
self.configInfo.appUiSetting.gameUnSelectIcon ?: @"",
|
||||
self.configInfo.appUiSetting.dynamicUnSelectIcon ?: @"",
|
||||
self.configInfo.appUiSetting.msgUnSelectIcon ?: @"",
|
||||
self.configInfo.appUiSetting.mineUnSelectIcon ?: @""
|
||||
self.uiSetting.homeUnSelectIcon ?: @"",
|
||||
self.uiSetting.gameUnSelectIcon ?: @"",
|
||||
self.uiSetting.dynamicUnSelectIcon ?: @"",
|
||||
self.uiSetting.msgUnSelectIcon ?: @"",
|
||||
self.uiSetting.mineUnSelectIcon ?: @""
|
||||
];
|
||||
|
||||
NSArray *selectIcons = @[
|
||||
self.configInfo.appUiSetting.homeSelectIcon ?: @"",
|
||||
self.configInfo.appUiSetting.gameSelectIcon ?: @"",
|
||||
self.configInfo.appUiSetting.dynamicSelectIcon ?: @"",
|
||||
self.configInfo.appUiSetting.msgSelectIcon ?: @"",
|
||||
self.configInfo.appUiSetting.mineSelectIcon ?: @""
|
||||
self.uiSetting.homeSelectIcon ?: @"",
|
||||
self.uiSetting.gameSelectIcon ?: @"",
|
||||
self.uiSetting.dynamicSelectIcon ?: @"",
|
||||
self.uiSetting.msgSelectIcon ?: @"",
|
||||
self.uiSetting.mineSelectIcon ?: @""
|
||||
];
|
||||
|
||||
self.normalTabImageSource = unselectIcons.mutableCopy;
|
||||
@@ -162,14 +161,12 @@
|
||||
|
||||
[self loadNavigationAreaBG];
|
||||
[self loadTabbarBG];
|
||||
[self loadBGColor];
|
||||
} else {
|
||||
if (self.updateTabbarBG) {
|
||||
self.updateTabbarBG(kImage(@"tab_bar_bg"));
|
||||
}
|
||||
}
|
||||
|
||||
[self loadNormalTabImage:0];
|
||||
[self loadSelectedTabImage:0];
|
||||
}
|
||||
|
||||
- (UIImage *)navigationAreaBG {
|
||||
@@ -186,7 +183,7 @@
|
||||
}
|
||||
|
||||
@kWeakify(self);
|
||||
[self.navigationAreaBGImageLoader loadImageWithUrl:self.configInfo.appUiSetting.headIcon
|
||||
[self.navigationAreaBGImageLoader loadImageWithUrl:self.uiSetting.headIcon
|
||||
completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
|
||||
@kStrongify(self);
|
||||
self.navigationAreaBG = image;
|
||||
@@ -201,9 +198,10 @@
|
||||
}
|
||||
|
||||
@kWeakify(self);
|
||||
[self.tabbarBGImageLoader loadImageWithUrl:self.configInfo.appUiSetting.navbar
|
||||
[self.tabbarBGImageLoader loadImageWithUrl:self.uiSetting.navbar
|
||||
completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
|
||||
@kStrongify(self);
|
||||
self.tabbarBGImage = image;
|
||||
if (self.updateTabbarBG) {
|
||||
self.updateTabbarBG(image);
|
||||
}
|
||||
@@ -220,41 +218,36 @@
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *normalURLString = self.normalTabImageSource[index];
|
||||
if ([normalURLString isEmpty]) {
|
||||
self.updateNormalTabImage([UIImage imageNamed:[self tabNormalImage:index]], index);
|
||||
[self loadNormalTabImage:index + 1];
|
||||
if (!self.updateNormalTabImage) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
dispatch_group_t downloadGroup = dispatch_group_create();
|
||||
NSString *normalURLString = self.normalTabImageSource[index];
|
||||
if ([NSString isEmpty:normalURLString]) {
|
||||
self.updateNormalTabImage([UIImage imageNamed:[self _tabNormalImage:index]], index);
|
||||
[self loadNormalTabImage:index + 1];
|
||||
return;
|
||||
}
|
||||
__block UIImage *normalImage = nil;
|
||||
|
||||
if (!self.normalTabImageLoader) {
|
||||
self.normalTabImageLoader = [[NetImageView alloc] init];
|
||||
if (!_normalTabImageLoader) {
|
||||
_normalTabImageLoader = [[NetImageView alloc] init];
|
||||
}
|
||||
|
||||
dispatch_group_enter(downloadGroup);
|
||||
@kWeakify(self);
|
||||
[self.normalTabImageLoader loadImageWithUrl:normalURLString
|
||||
completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
|
||||
normalImage = image;
|
||||
dispatch_group_leave(downloadGroup);
|
||||
}
|
||||
fail:^(NSError * _Nonnull error) {
|
||||
dispatch_group_leave(downloadGroup);
|
||||
}];
|
||||
|
||||
// 当两个图片都下载完成后回调
|
||||
@kWeakify(self);
|
||||
dispatch_group_notify(downloadGroup, dispatch_get_main_queue(), ^{
|
||||
@kStrongify(self);
|
||||
if (normalImage && self.updateNormalTabImage) {
|
||||
self.updateNormalTabImage([normalImage resizeTo:CGSizeMake(25, 25)],
|
||||
index);
|
||||
index);
|
||||
}
|
||||
[self loadNormalTabImage:index + 1];
|
||||
});
|
||||
}
|
||||
fail:^(NSError * _Nonnull error) {
|
||||
@kStrongify(self);
|
||||
[self loadNormalTabImage:index + 1];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)loadSelectedTabImage:(NSInteger)index {
|
||||
@@ -262,40 +255,43 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (!self.updateSelectedTabImage) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *selectedURLString = self.selectedTabImageSource[index];
|
||||
if ([selectedURLString isEmpty]) {
|
||||
self.updateSelectedTabImage([UIImage imageNamed:[self tabSelectedImage:index]], index);
|
||||
if ([NSString isEmpty:selectedURLString]) {
|
||||
self.updateSelectedTabImage([UIImage imageNamed:[self _tabSelectedImage:index]], index);
|
||||
[self loadSelectedTabImage:index + 1];
|
||||
return;
|
||||
}
|
||||
|
||||
dispatch_group_t downloadGroup = dispatch_group_create();
|
||||
__block UIImage *selectedImage = nil;
|
||||
|
||||
if (!self.selectedTabImageLoader) {
|
||||
self.selectedTabImageLoader = [[NetImageView alloc] init];
|
||||
if (!_selectedTabImageLoader) {
|
||||
_selectedTabImageLoader = [[NetImageView alloc] init];
|
||||
}
|
||||
|
||||
dispatch_group_enter(downloadGroup);
|
||||
@kWeakify(self);
|
||||
[self.selectedTabImageLoader loadImageWithUrl:selectedURLString
|
||||
completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
|
||||
selectedImage = image;
|
||||
dispatch_group_leave(downloadGroup);
|
||||
}
|
||||
fail:^(NSError * _Nonnull error) {
|
||||
dispatch_group_leave(downloadGroup);
|
||||
}];
|
||||
|
||||
// 当两个图片都下载完成后回调
|
||||
@kWeakify(self);
|
||||
dispatch_group_notify(downloadGroup, dispatch_get_main_queue(), ^{
|
||||
@kStrongify(self);
|
||||
selectedImage = image;
|
||||
if (selectedImage && self.updateSelectedTabImage) {
|
||||
self.updateSelectedTabImage([selectedImage resizeTo:CGSizeMake(25, 25)],
|
||||
index);
|
||||
index);
|
||||
}
|
||||
[self loadSelectedTabImage:index + 1];
|
||||
});
|
||||
}
|
||||
fail:^(NSError * _Nonnull error) {
|
||||
@kStrongify(self);
|
||||
[self loadSelectedTabImage:index + 1];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)loadBGColor {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:self.reloadNavigationAreaImageKey
|
||||
object:nil];
|
||||
}
|
||||
|
||||
- (void)addHeartBratTimer {
|
||||
@@ -315,29 +311,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (UIColor *)bgColor {
|
||||
if (self.configInfo && self.configInfo.appUiSetting.settingStatus == 1) {
|
||||
|
||||
if (self.uiSetting) {
|
||||
return [DJDKMIMOMColor colorWithHexString:self.uiSetting.backgroundColor];
|
||||
}
|
||||
|
||||
return [DJDKMIMOMColor colorWithHexString:@"#FCF4DF"];
|
||||
}
|
||||
- (UIImage *)navBGImage {
|
||||
if (self.configInfo && self.configInfo.appUiSetting.settingStatus == 1) {
|
||||
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (UIImage *)tabbarBGImage {
|
||||
if (self.configInfo && self.configInfo.appUiSetting.settingStatus == 1) {
|
||||
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)tabName:(NSInteger)tabIndex {
|
||||
return @[YMLocalizedString(@"TabbarViewController2"),
|
||||
@@ -347,7 +327,7 @@
|
||||
YMLocalizedString(@"TabbarViewController5")][tabIndex];
|
||||
}
|
||||
|
||||
- (NSString *)tabNormalImage:(NSInteger)tabIndex {
|
||||
- (NSString *)_tabNormalImage:(NSInteger)tabIndex {
|
||||
return @[@"tab_gameHome_normal",
|
||||
@"tab_gameHome_game_normal",
|
||||
@"tab_monents_normal",
|
||||
@@ -355,7 +335,7 @@
|
||||
@"tab_mine_normal"][tabIndex];
|
||||
}
|
||||
|
||||
- (NSString *)tabSelectedImage:(NSInteger)tabIndex {
|
||||
- (NSString *)_tabSelectedImage:(NSInteger)tabIndex {
|
||||
return @[@"tab_gameHome_selected",
|
||||
@"tab_gameHome_game_selected",
|
||||
@"tab_monents_select",
|
||||
@@ -363,4 +343,20 @@
|
||||
@"tab_mine_selected"][tabIndex];
|
||||
}
|
||||
|
||||
- (NSString *)tabNormalImage:(NSInteger)tabIndex {
|
||||
return [self.normalTabImageSource xpSafeObjectAtIndex:tabIndex];
|
||||
}
|
||||
|
||||
- (NSString *)tabSelectedImage:(NSInteger)tabIndex {
|
||||
return [self.selectedTabImageSource xpSafeObjectAtIndex:tabIndex];
|
||||
}
|
||||
|
||||
- (UIImage *)tabNormalImageImage:(NSInteger)tabIndex {
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (UIImage *)tabSelectedImageImage:(NSInteger)tabIndex {
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -60,8 +60,8 @@
|
||||
|
||||
- (void)setupTopTheme {
|
||||
__block UIImageView *theme = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, kGetScaleWidth(140))];
|
||||
theme.image = [[ClientConfig shareConfig] navigationAreaBG];// [UIImage imageNamed:@"home_top_bg"];
|
||||
theme.contentMode = UIViewContentModeScaleAspectFit;
|
||||
theme.image = [[ClientConfig shareConfig] navigationAreaBG];
|
||||
theme.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self.view addSubview:theme];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:[ClientConfig shareConfig].reloadNavigationAreaImageKey
|
||||
|
@@ -120,8 +120,8 @@ UIKIT_EXTERN NSString *kRequestTicket;
|
||||
|
||||
- (void)setupTopTheme {
|
||||
__block UIImageView *theme = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, kGetScaleWidth(140))];
|
||||
theme.image = [[ClientConfig shareConfig] navigationAreaBG];// [UIImage imageNamed:@"home_top_bg"];
|
||||
theme.contentMode = UIViewContentModeScaleAspectFit;
|
||||
theme.image = [[ClientConfig shareConfig] navigationAreaBG];
|
||||
theme.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self.view addSubview:theme];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:[ClientConfig shareConfig].reloadNavigationAreaImageKey
|
||||
|
@@ -66,8 +66,8 @@
|
||||
|
||||
- (void)setupTopTheme {
|
||||
__block UIImageView *theme = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, kGetScaleWidth(140))];
|
||||
theme.image = [[ClientConfig shareConfig] navigationAreaBG];// [UIImage imageNamed:@"home_top_bg"];
|
||||
theme.contentMode = UIViewContentModeScaleAspectFit;
|
||||
theme.image = [[ClientConfig shareConfig] navigationAreaBG];
|
||||
theme.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self.view addSubview:theme];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:[ClientConfig shareConfig].reloadNavigationAreaImageKey
|
||||
|
@@ -89,8 +89,8 @@
|
||||
|
||||
- (void)setupTopTheme {
|
||||
__block UIImageView *theme = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, kGetScaleWidth(140))];
|
||||
theme.image = [[ClientConfig shareConfig] navigationAreaBG];// [UIImage imageNamed:@"home_top_bg"];
|
||||
theme.contentMode = UIViewContentModeScaleAspectFit;
|
||||
theme.image = [[ClientConfig shareConfig] navigationAreaBG];
|
||||
theme.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self.view addSubview:theme];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:[ClientConfig shareConfig].reloadNavigationAreaImageKey
|
||||
|
@@ -53,7 +53,9 @@
|
||||
_bannerInfoList = bannerInfoList;
|
||||
NSMutableArray *picArray = @[].mutableCopy;
|
||||
for (HomeBannerInfoModel *model in bannerInfoList) {
|
||||
[picArray addObject:model.bannerPic];
|
||||
if (![NSString isEmpty:model.bannerPic]) {
|
||||
[picArray addObject:model.bannerPic];
|
||||
}
|
||||
}
|
||||
self.bannerView.imageURLStringsGroup = picArray.copy;
|
||||
self.bannerView.autoScroll = YES;
|
||||
|
@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
+ (void)buyRoomBackground:(HttpRequestHelperCompletion)completion
|
||||
roomUid:(NSString *)roomUid
|
||||
backgroundItemId:(NSString *)id;
|
||||
id:(NSString *)bid;
|
||||
|
||||
+ (void)deleteRoomBackground:(HttpRequestHelperCompletion)completion
|
||||
roomUid:(NSString *)roomUid
|
||||
@@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
+ (void)selectedRoomBackground:(HttpRequestHelperCompletion)completion
|
||||
roomUid:(NSString *)roomUid
|
||||
backgroundItemId:(NSString *)id;
|
||||
id:(NSString *)bid;
|
||||
|
||||
@end
|
||||
|
||||
|
@@ -11,10 +11,10 @@
|
||||
|
||||
+ (void)buyRoomBackground:(HttpRequestHelperCompletion)completion
|
||||
roomUid:(NSString *)roomUid
|
||||
backgroundItemId:(NSString *)id{
|
||||
id:(NSString *)bid{
|
||||
[self makeRequest:@"room/background/buy"
|
||||
method:HttpRequestHelperMethodPOST
|
||||
completion:completion, __FUNCTION__, roomUid, id, nil];
|
||||
completion:completion, __FUNCTION__, roomUid, bid, nil];
|
||||
}
|
||||
|
||||
+ (void)deleteRoomBackground:(HttpRequestHelperCompletion)completion
|
||||
@@ -34,10 +34,10 @@
|
||||
|
||||
+ (void)selectedRoomBackground:(HttpRequestHelperCompletion)completion
|
||||
roomUid:(NSString *)roomUid
|
||||
backgroundItemId:(NSString *)id {
|
||||
id:(NSString *)bid {
|
||||
[self makeRequest:@"room/background/select"
|
||||
method:HttpRequestHelperMethodPOST
|
||||
completion:completion, __FUNCTION__, roomUid, id, nil];
|
||||
completion:completion, __FUNCTION__, roomUid, bid, nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -9,6 +9,20 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
typedef enum : NSUInteger {
|
||||
RoomBGStatus_Expired = -1,
|
||||
RoomBGStatus_Reviewing = 0,
|
||||
RoomBGStatus_Pass = 1,
|
||||
RoomBGStatus_Rejected = 2
|
||||
} RoomBGStatus;
|
||||
|
||||
typedef enum : NSUInteger {
|
||||
RoomBGType_Free = 0,
|
||||
RoomBGType_Pay = 1,
|
||||
RoomBGType_Custom = 2 ,
|
||||
} RoomBGType;
|
||||
|
||||
@interface CustomRoomBGItemModel : PIBaseModel
|
||||
|
||||
@property (nonatomic, assign) NSInteger buyHour;
|
||||
@@ -17,9 +31,16 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, assign) BOOL isCur;
|
||||
@property (nonatomic, assign) NSInteger remainHour;
|
||||
@property (nonatomic, copy) NSString *url;
|
||||
@property (nonatomic, assign) NSInteger type; // 0=免费,1=付费,2=自定义
|
||||
@property (nonatomic, assign) NSInteger status; // -1=过期,0=审核中,1=通过,2=不过审
|
||||
/// 0=免费,1=付费,2=自定义
|
||||
@property (nonatomic, assign) RoomBGType type;
|
||||
@property (nonatomic, assign) RoomBGStatus status; // -1=过期,0=审核中,1=通过,2=不过审
|
||||
|
||||
@end
|
||||
|
||||
@interface CustomRoomBGModel : PIBaseModel
|
||||
@property (nonatomic, assign) NSInteger customHour;
|
||||
@property (nonatomic, assign) NSInteger customGoldPrice;
|
||||
@property (nonatomic, copy) NSArray <CustomRoomBGItemModel *> *itemList;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -9,4 +9,15 @@
|
||||
|
||||
@implementation CustomRoomBGItemModel
|
||||
|
||||
@end
|
||||
|
||||
@implementation CustomRoomBGModel
|
||||
|
||||
+ (NSDictionary *)objectClassInArray {
|
||||
return @{
|
||||
@"itemList": CustomRoomBGItemModel.class
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
@@ -62,22 +62,40 @@
|
||||
self.customBackgrounds = @[].mutableCopy;
|
||||
|
||||
[self setupUI];
|
||||
[self didSelectedButton:self.freeButton];
|
||||
|
||||
[self setupData];
|
||||
}
|
||||
|
||||
- (void)setupData {
|
||||
__block CustomRoomBGItemModel *currentModel = nil;
|
||||
@kWeakify(self);
|
||||
[self.presenter loadListOfRoomBG:self.roomUID
|
||||
complete:^(NSArray<CustomRoomBGItemModel *> * _Nonnull list) {
|
||||
complete:^(CustomRoomBGModel *roomBGModel) {
|
||||
@kStrongify(self);
|
||||
for (CustomRoomBGItemModel *model in list) {
|
||||
if (model.goldPrice == 0) {
|
||||
[self.freeBackgrounds addObject:model];
|
||||
} else {
|
||||
[self.payBackgrounds addObject:model];
|
||||
for (CustomRoomBGItemModel *model in roomBGModel.itemList) {
|
||||
if (model.isCur) {
|
||||
currentModel = model;
|
||||
}
|
||||
switch (model.type) {
|
||||
case RoomBGType_Free:
|
||||
[self.freeBackgrounds addObject:model];
|
||||
break;
|
||||
case RoomBGType_Pay:
|
||||
[self.payBackgrounds addObject:model];
|
||||
break;
|
||||
case RoomBGType_Custom:
|
||||
[self.customBackgrounds addObject:model];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentModel) {
|
||||
[self updateTabButtonStatus:currentModel];
|
||||
} else {
|
||||
[self didSelectedButton:self.freeButton];
|
||||
}
|
||||
|
||||
[self.collectionView reloadData];
|
||||
@@ -87,6 +105,24 @@
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)updateTabButtonStatus:(CustomRoomBGItemModel *)model {
|
||||
self.currentSelectedTabIndex = model.type;
|
||||
switch (model.type) {
|
||||
case RoomBGType_Pay:
|
||||
[self didSelectedButton:self.payButton];
|
||||
break;
|
||||
case RoomBGType_Free:
|
||||
[self didSelectedButton:self.freeButton];
|
||||
break;
|
||||
case RoomBGType_Custom:
|
||||
[self didSelectedButton:self.customButton];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setupUI {
|
||||
self.view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3];
|
||||
[self setupBackgroundContent];
|
||||
@@ -327,15 +363,52 @@
|
||||
|
||||
|
||||
- (void)updateRoomBG {
|
||||
switch (self.currentSelectedModel.type) {
|
||||
case 0:
|
||||
[self applyBG];
|
||||
break;
|
||||
case 1:
|
||||
if (self.currentSelectedModel.status == 1) {
|
||||
[self applyBG];
|
||||
} else {
|
||||
[self buyBG];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
[self uploadBG];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)buyBG {
|
||||
@kWeakify(self);
|
||||
[self.presenter buyRoomBG:self.roomUID
|
||||
itemID:@(self.currentSelectedModel.id).stringValue
|
||||
complete:^{
|
||||
@kStrongify(self);
|
||||
[self applyBG];
|
||||
}
|
||||
failure:^{}];
|
||||
}
|
||||
|
||||
- (void)uploadBG {
|
||||
|
||||
}
|
||||
|
||||
- (void)applyBG {
|
||||
@kWeakify(self);
|
||||
[self.presenter useRoomBG:self.roomUID
|
||||
itemID:@(self.currentSelectedModel.id).stringValue
|
||||
complete:^{
|
||||
// MARK: RoomVC 會接受云信通知
|
||||
} failure:^{
|
||||
|
||||
}];
|
||||
@kStrongify(self);
|
||||
[self didTapEmptySpace];
|
||||
}
|
||||
failure:^{}];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
||||
switch (self.currentSelectedTabIndex) {
|
||||
@@ -401,10 +474,19 @@
|
||||
break;
|
||||
}
|
||||
if (model) {
|
||||
self.currentSelectedItemIndex = indexPath.row;
|
||||
[self displayPreviewArea];
|
||||
[self updatePreviewArea:model];
|
||||
[collectionView reloadData];
|
||||
self.currentSelectedModel = model;
|
||||
if (model.isCur) {
|
||||
[collectionView reloadData];
|
||||
return;
|
||||
}
|
||||
if (model.status == RoomBGStatus_Pass) {
|
||||
[self applyBG];
|
||||
} else {
|
||||
self.currentSelectedItemIndex = indexPath.row;
|
||||
[self displayPreviewArea];
|
||||
[self updatePreviewArea:model];
|
||||
[collectionView reloadData];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
failure:(void(^)(void))failure;
|
||||
|
||||
- (void)loadListOfRoomBG:(NSString *)roomUID
|
||||
complete:(void(^)(NSArray <CustomRoomBGItemModel *>*list))complete
|
||||
complete:(void(^)(CustomRoomBGModel *model))complete
|
||||
failure:(void(^)(void))failure;
|
||||
|
||||
@end
|
||||
|
@@ -15,9 +15,9 @@
|
||||
itemID:(NSString *)itemID
|
||||
complete:(void(^)(void))complete
|
||||
failure:(void(^)(void))failure {
|
||||
@kWeakify(self);
|
||||
// @kWeakify(self);
|
||||
[Api buyRoomBackground:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
// @kStrongify(self);
|
||||
if (complete) {
|
||||
complete();
|
||||
}
|
||||
@@ -30,16 +30,16 @@
|
||||
showLoading:YES
|
||||
errorToast:YES]
|
||||
roomUid:roomUID
|
||||
backgroundItemId:itemID];
|
||||
id:itemID];
|
||||
}
|
||||
|
||||
- (void)deleteRoomBG:(NSString *)roomUID
|
||||
itemID:(NSString *)itemID
|
||||
complete:(void(^)(void))complete
|
||||
failure:(void(^)(void))failure {
|
||||
@kWeakify(self);
|
||||
// @kWeakify(self);
|
||||
[Api deleteRoomBackground:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
// @kStrongify(self);
|
||||
if (complete) {
|
||||
complete();
|
||||
}
|
||||
@@ -72,16 +72,16 @@
|
||||
showLoading:YES
|
||||
errorToast:YES]
|
||||
roomUid:roomUID
|
||||
backgroundItemId:itemID];
|
||||
id:itemID];
|
||||
}
|
||||
|
||||
- (void)loadListOfRoomBG:(NSString *)roomUID
|
||||
complete:(void(^)(NSArray <CustomRoomBGItemModel *>*list))complete
|
||||
complete:(void(^)(CustomRoomBGModel *model))complete
|
||||
failure:(void(^)(void))failure {
|
||||
[Api listOfRoomBackground:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
if (complete) {
|
||||
NSArray *array = [CustomRoomBGItemModel modelsWithArray:data.data];
|
||||
complete(array);
|
||||
CustomRoomBGModel *model = [CustomRoomBGModel modelWithJSON:data.data];
|
||||
complete(model);
|
||||
}
|
||||
}
|
||||
fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
|
@@ -41,6 +41,13 @@
|
||||
[super viewDidLoad];
|
||||
[self installUI];
|
||||
[self installConstraints];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:[ClientConfig shareConfig].reloadViewBackgroundColorKey
|
||||
object:nil
|
||||
queue:[NSOperationQueue mainQueue]
|
||||
usingBlock:^(NSNotification * _Nonnull notification) {
|
||||
self.view.backgroundColor = [[ClientConfig shareConfig] bgColor];
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)installUI{
|
||||
@@ -53,8 +60,8 @@
|
||||
|
||||
- (void)setupTopTheme {
|
||||
__block UIImageView *theme = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, kGetScaleWidth(140))];
|
||||
theme.image = [[ClientConfig shareConfig] navigationAreaBG];// [UIImage imageNamed:@"home_top_bg"];
|
||||
theme.contentMode = UIViewContentModeScaleAspectFit;
|
||||
theme.image = [[ClientConfig shareConfig] navigationAreaBG];
|
||||
theme.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self.view addSubview:theme];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:[ClientConfig shareConfig].reloadNavigationAreaImageKey
|
||||
|
@@ -2046,8 +2046,14 @@ XPCandyTreeInsufficientBalanceViewDelegate>
|
||||
} else if (attachment.first == CustomMessageType_Custom_Room_Background) {
|
||||
if (attachment.second == Custom_Message_Sub_Custom_Room_Background) {
|
||||
// TODO: 更新 背景
|
||||
self.roomInfo.backPic = @"https://tva1.moyu.im/mw600/9f0b0dd5ly1hvacrep5fhj20jg0t60w4.jpg";
|
||||
[self.backContainerView onRoomUpdate];
|
||||
if ([attachment.data isKindOfClass:[NSDictionary class]]) {
|
||||
NSString *url = attachment.data[@"url"];
|
||||
if (![NSString isEmpty:url]) {
|
||||
self.roomInfo.backPic = url;//@"https://tva1.moyu.im/mw600/9f0b0dd5ly1hvacrep5fhj20jg0t60w4.jpg";
|
||||
[self.backContainerView onRoomUpdate];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
[self.messageContainerView handleNIMCustomMessage:message];
|
||||
|
@@ -21,6 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param complection 完成
|
||||
+ (void)clientInitConfig:(HttpRequestHelperCompletion)complection;
|
||||
|
||||
+ (void)clientConfig:(HttpRequestHelperCompletion)completion;
|
||||
|
||||
///邀请码进房
|
||||
/// @param completion 完成
|
||||
/// @param inviteCode 邀请码
|
||||
|
@@ -51,7 +51,11 @@
|
||||
/// @param complection 完成
|
||||
+ (void)clientInitConfig:(HttpRequestHelperCompletion)complection {
|
||||
NSString * fang = [NSString stringFromBase64String:@"Y2xpZW50L2luaXQ="];///client/init
|
||||
[HttpRequestHelper request:fang method:HttpRequestHelperMethodGET params:[NSMutableDictionary dictionary] completion:complection];
|
||||
[HttpRequestHelper request:fang method:HttpRequestHelperMethodGET params:@{} completion:complection];
|
||||
}
|
||||
|
||||
+ (void)clientConfig:(HttpRequestHelperCompletion)completion {
|
||||
[HttpRequestHelper request:@"client/config" method:HttpRequestHelperMethodGET params:@{} completion:completion];
|
||||
}
|
||||
|
||||
|
||||
|
@@ -199,6 +199,9 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
[self configTheme:image];
|
||||
}];
|
||||
|
||||
[self configTheme:[[ClientConfig shareConfig] tabbarBGImage]];
|
||||
[[ClientConfig shareConfig] loadTabImages];
|
||||
|
||||
[[RoomBoomManager sharedManager] registerBoomBanner:^(id _Nonnull sth) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[RoomBoomBannerAnimation display:kWindow
|
||||
@@ -802,6 +805,8 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
// 设置视图控制器数组和默认选择项
|
||||
self.viewControllers = [viewControllers copy];
|
||||
self.selectedIndex = 0;
|
||||
|
||||
[[ClientConfig shareConfig] loadTabImages];
|
||||
}
|
||||
|
||||
- (BaseNavigationController *)createTabBarItem:(UIViewController *)itemVc
|
||||
@@ -818,6 +823,11 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
itemVc.tabBarItem.image = [[UIImage imageNamed:imageURL] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
||||
itemVc.tabBarItem.selectedImage = [[UIImage imageNamed:selectedImageURL] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
||||
}
|
||||
|
||||
// if ([imageURL hasPrefix:@"http"]) {
|
||||
// itemVc.tabBarItem.image = [[[ClientConfig shareConfig] tabNormalImageImage:index] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
||||
// }
|
||||
|
||||
BaseNavigationController *nav = [[BaseNavigationController alloc] initWithRootViewController:itemVc];
|
||||
return nav;
|
||||
}
|
||||
|
@@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
+ (NSString *)createUUID;
|
||||
|
||||
+ (BOOL)isEmpty:(NSString *)string;
|
||||
- (BOOL)isEmpty;
|
||||
//- (BOOL)isEmpty;
|
||||
@end
|
||||
|
||||
|
||||
|
@@ -339,8 +339,8 @@
|
||||
return trimmedString.length == 0;
|
||||
}
|
||||
|
||||
- (BOOL)isEmpty {
|
||||
return [NSString isEmpty:self];
|
||||
}
|
||||
//- (BOOL)isEmpty {
|
||||
// return [NSString isEmpty:self];
|
||||
//}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user