个播房增加房间分类标签,首页主播tab修改

This commit is contained in:
chenguilong
2022-07-15 18:46:17 +08:00
parent fa6b567959
commit 6db355173b
28 changed files with 563 additions and 49 deletions

View File

@@ -149,6 +149,9 @@
9B2EA7C32804052E00ED17BF /* AnchorPKMicroView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B2EA7C22804052E00ED17BF /* AnchorPKMicroView.m */; };
9B2EA7C628041EFC00ED17BF /* XPAnchorPkPanelView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B2EA7C528041EFC00ED17BF /* XPAnchorPkPanelView.m */; };
9B2EA7CC2804245500ED17BF /* XPAnchorPKPanelUserView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B2EA7CB2804245500ED17BF /* XPAnchorPKPanelUserView.m */; };
9B3353BB2881527A00AC2F24 /* XPHomeLivesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3353BA2881527A00AC2F24 /* XPHomeLivesViewController.m */; };
9B3353BE288156DB00AC2F24 /* XPHomeLivePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3353BD288156DB00AC2F24 /* XPHomeLivePresenter.m */; };
9B3353C228816E6F00AC2F24 /* HomeLiveTagModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3353C128816E6F00AC2F24 /* HomeLiveTagModel.m */; };
9B33E3CB27D85379003B0E62 /* UploadFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3C927D85379003B0E62 /* UploadFile.m */; };
9B33E3CE27D8540C003B0E62 /* XPVoiceCardViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3CD27D8540C003B0E62 /* XPVoiceCardViewController.m */; };
9B33E3D427D8A1A4003B0E62 /* XPSkillCardPlayerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3D327D8A1A4003B0E62 /* XPSkillCardPlayerManager.m */; };
@@ -263,6 +266,7 @@
9BEE3D142785884A00C83219 /* XPNobleCenterResidueView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BEE3D132785884A00C83219 /* XPNobleCenterResidueView.m */; };
9BEE3D1727858E5700C83219 /* XPNobleAuthorityDescView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BEE3D1627858E5700C83219 /* XPNobleAuthorityDescView.m */; };
9BF5192628801D4700B6BE92 /* XPAcrossRoomPKCountDownView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BF5192528801D4700B6BE92 /* XPAcrossRoomPKCountDownView.m */; };
9BFE992E288142FD009DA429 /* RoomClassifyModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BFE992D288142FD009DA429 /* RoomClassifyModel.m */; };
E80016232803CA5D00D6D17A /* XPMineGuildIncomeRecordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E80016222803CA5D00D6D17A /* XPMineGuildIncomeRecordViewController.m */; };
E80016262803CB2800D6D17A /* XPGuildIncomeHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = E80016252803CB2800D6D17A /* XPGuildIncomeHeaderView.m */; };
E80016292803D5C500D6D17A /* XPGuildIncomeRecordTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E80016282803D5C500D6D17A /* XPGuildIncomeRecordTableViewCell.m */; };
@@ -1144,6 +1148,13 @@
9B2EA7C528041EFC00ED17BF /* XPAnchorPkPanelView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAnchorPkPanelView.m; sourceTree = "<group>"; };
9B2EA7CA2804245500ED17BF /* XPAnchorPKPanelUserView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorPKPanelUserView.h; sourceTree = "<group>"; };
9B2EA7CB2804245500ED17BF /* XPAnchorPKPanelUserView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAnchorPKPanelUserView.m; sourceTree = "<group>"; };
9B3353B92881527A00AC2F24 /* XPHomeLivesViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeLivesViewController.h; sourceTree = "<group>"; };
9B3353BA2881527A00AC2F24 /* XPHomeLivesViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeLivesViewController.m; sourceTree = "<group>"; };
9B3353BC288156DB00AC2F24 /* XPHomeLivePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeLivePresenter.h; sourceTree = "<group>"; };
9B3353BD288156DB00AC2F24 /* XPHomeLivePresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeLivePresenter.m; sourceTree = "<group>"; };
9B3353BF2881570400AC2F24 /* XPHomeLiveProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeLiveProtocol.h; sourceTree = "<group>"; };
9B3353C028816E6F00AC2F24 /* HomeLiveTagModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HomeLiveTagModel.h; sourceTree = "<group>"; };
9B3353C128816E6F00AC2F24 /* HomeLiveTagModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HomeLiveTagModel.m; sourceTree = "<group>"; };
9B33E3C927D85379003B0E62 /* UploadFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UploadFile.m; sourceTree = "<group>"; };
9B33E3CA27D85379003B0E62 /* UploadFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UploadFile.h; sourceTree = "<group>"; };
9B33E3CC27D8540C003B0E62 /* XPVoiceCardViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPVoiceCardViewController.h; sourceTree = "<group>"; };
@@ -1374,6 +1385,8 @@
9BEE3D1627858E5700C83219 /* XPNobleAuthorityDescView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPNobleAuthorityDescView.m; sourceTree = "<group>"; };
9BF5192428801D4700B6BE92 /* XPAcrossRoomPKCountDownView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAcrossRoomPKCountDownView.h; sourceTree = "<group>"; };
9BF5192528801D4700B6BE92 /* XPAcrossRoomPKCountDownView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAcrossRoomPKCountDownView.m; sourceTree = "<group>"; };
9BFE992C288142FD009DA429 /* RoomClassifyModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RoomClassifyModel.h; sourceTree = "<group>"; };
9BFE992D288142FD009DA429 /* RoomClassifyModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RoomClassifyModel.m; sourceTree = "<group>"; };
B66633E061B1B34177CD011C /* Pods-xplan-ios.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-xplan-ios.release.xcconfig"; path = "Target Support Files/Pods-xplan-ios/Pods-xplan-ios.release.xcconfig"; sourceTree = "<group>"; };
CACF623970097D653132D69A /* Pods_xplan_ios.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_xplan_ios.framework; sourceTree = BUILT_PRODUCTS_DIR; };
E80016212803CA5D00D6D17A /* XPMineGuildIncomeRecordViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineGuildIncomeRecordViewController.h; sourceTree = "<group>"; };
@@ -4895,6 +4908,8 @@
E8412FA82779C2ED006E1101 /* XPRoomSettingItemModel.m */,
E84BF7CF277BFCDD00EF8877 /* RoomTagModel.h */,
E84BF7D0277BFCDD00EF8877 /* RoomTagModel.m */,
9BFE992C288142FD009DA429 /* RoomClassifyModel.h */,
9BFE992D288142FD009DA429 /* RoomClassifyModel.m */,
);
path = Model;
sourceTree = "<group>";
@@ -6287,6 +6302,8 @@
E8A6C29A27CF53BF00AC7442 /* XPHomeLikePresenter.m */,
E8F9168527EC927C00F10D8F /* XPHomeLittleGamePesenter.h */,
E8F9168627EC927C00F10D8F /* XPHomeLittleGamePesenter.m */,
9B3353BC288156DB00AC2F24 /* XPHomeLivePresenter.h */,
9B3353BD288156DB00AC2F24 /* XPHomeLivePresenter.m */,
);
path = Presenter;
sourceTree = "<group>";
@@ -6300,6 +6317,7 @@
E8E5E1B027C3920E00F457D8 /* XPHomeRecommendProtocol.h */,
E8A6C29C27CF53E100AC7442 /* XPHomeLikeProtocol.h */,
E8F9168827EC928F00F10D8F /* XPHomeLittleGameProtocol.h */,
9B3353BF2881570400AC2F24 /* XPHomeLiveProtocol.h */,
);
path = Protocol;
sourceTree = "<group>";
@@ -6327,6 +6345,8 @@
E8A6C2A127CF856E00AC7442 /* HomeCollectRoomModel.m */,
E8F9168C27ECA69500F10D8F /* HomeLittleGameRoomModel.h */,
E8F9168D27ECA69500F10D8F /* HomeLittleGameRoomModel.m */,
9B3353C028816E6F00AC2F24 /* HomeLiveTagModel.h */,
9B3353C128816E6F00AC2F24 /* HomeLiveTagModel.m */,
);
path = Model;
sourceTree = "<group>";
@@ -6338,6 +6358,8 @@
E8C6FFD12754AA6A004DC9F0 /* SubViews */,
E8C6FFC627548120004DC9F0 /* XPHomePartyViewController.h */,
E8C6FFC527548120004DC9F0 /* XPHomePartyViewController.m */,
9B3353B92881527A00AC2F24 /* XPHomeLivesViewController.h */,
9B3353BA2881527A00AC2F24 /* XPHomeLivesViewController.m */,
E8A6C28A27CF436300AC7442 /* XPHomeLikeViewController.h */,
E8A6C28B27CF436300AC7442 /* XPHomeLikeViewController.m */,
E8F9168227EC913C00F10D8F /* XPHomeLittleGameViewController.h */,
@@ -7312,6 +7334,7 @@
18EE3FF42750FA3700A452BF /* UIView+NIM.m in Sources */,
9BD63FB4277EF1B3006EB744 /* XPReleaseRadioModel.m in Sources */,
E8A03DFF27635F960098D9EA /* XPRoomCandyGiftView.m in Sources */,
9B3353BE288156DB00AC2F24 /* XPHomeLivePresenter.m in Sources */,
180116F9279E8C4C00F2CBC0 /* PLTimeUtil.m in Sources */,
9BA708A12823D4C900C474A2 /* LittleGameScrollStageView.m in Sources */,
E8834E4828003E1E0029CCC1 /* XPGuildMangerListPresenter.m in Sources */,
@@ -7347,6 +7370,7 @@
E8E70D7A26F2F16600F03460 /* XPMinePresent.m in Sources */,
E855516128059228005F293F /* XPMineGuildIncomeDetailViewController.m in Sources */,
E8A1E45B27620F4900B294CA /* XPRoomHalfWebView.m in Sources */,
9BFE992E288142FD009DA429 /* RoomClassifyModel.m in Sources */,
E8A88D3027E85EEA00CA8837 /* RoomPKInfoModel.m in Sources */,
E8A86E0527BA38DB001C21F9 /* NSString+RW.m in Sources */,
E800162C2803FE4900D6D17A /* GuildIncomeRecordModel.m in Sources */,
@@ -7695,6 +7719,7 @@
E86507E8281A8212006951B0 /* ContentTweetModel.m in Sources */,
E8D55CA0281186D6006935A5 /* SessionAudioRecordView.m in Sources */,
E8A88D2A27E81C8600CA8837 /* XPRoomPKUserCollectionViewCell.m in Sources */,
9B3353C228816E6F00AC2F24 /* HomeLiveTagModel.m in Sources */,
9B7B606627BBA0EE0070BB72 /* XPAnchorAttentSendInfo.m in Sources */,
E81C1B29277069DD0020D1E4 /* XPArrangeMicEmptyTableViewCell.m in Sources */,
E8AC721C26F4720B007D6E91 /* XPMineSettingPresent.m in Sources */,
@@ -7818,6 +7843,7 @@
E896EFA92771AEEC00AD2CC1 /* XPMineAttentionTableViewCell.m in Sources */,
E8F1559328129EBA00EE8C06 /* ContentSecretaryModel.m in Sources */,
9BBC02912786FC570007C24B /* XPMineNobleCardTableViewCell.m in Sources */,
9B3353BB2881527A00AC2F24 /* XPHomeLivesViewController.m in Sources */,
E8F9168727EC927C00F10D8F /* XPHomeLittleGamePesenter.m in Sources */,
E8AC722126F47E23007D6E91 /* XPMineAboutUsViewController.m in Sources */,
E8834E4C28003E4E0029CCC1 /* XPMineManagerSetPresenter.m in Sources */,

View File

@@ -16,6 +16,11 @@ NS_ASSUME_NONNULL_BEGIN
/// @param uid 用户的uid
+ (void)homeTagComplection:(HttpRequestHelperCompletion)complection uid:(NSString *)uid;
/// 获取首页所有的直播tag
/// @param complection 完成
/// @param uid 用户的uid
+ (void)homeLiveTagComplection:(HttpRequestHelperCompletion)complection uid:(NSString *)uid;
/// 查看推荐列表
/// @param complection 完成
/// @param uid 用户的uid

View File

@@ -17,6 +17,12 @@
[self makeRequest:@"home/tagV2" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, uid, nil];
}
/// tag
/// @param complection
/// @param uid uid
+ (void)homeLiveTagComplection:(HttpRequestHelperCompletion)complection uid:(NSString *)uid {
[self makeRequest:@"single/broadcast/sort" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, uid, nil];
}
///
/// @param complection
/// @param uid uid

View File

@@ -0,0 +1,21 @@
//
// HomeLiveTagModel.h
// xplan-ios
//
// Created by GreenLand on 2022/7/15.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface HomeLiveTagModel : NSObject
///id
@property (nonatomic,copy) NSString *tid;
///名字
@property (nonatomic,copy) NSString *sortName;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,16 @@
//
// HomeLiveTagModel.m
// xplan-ios
//
// Created by GreenLand on 2022/7/15.
//
#import "HomeLiveTagModel.h"
@implementation HomeLiveTagModel
+ (NSDictionary *)replacedKeyFromPropertyName {
return @{@"tid":@"id"};
}
@end

View File

@@ -0,0 +1,19 @@
//
// XPHomeLivePresenter.h
// xplan-ios
//
// Created by GreenLand on 2022/7/15.
//
#import "BaseMvpPresenter.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPHomeLivePresenter : BaseMvpPresenter
/// 获取所有的直播tag列表
- (void)getHomeLiveTagList;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,25 @@
//
// XPHomeLivePresenter.m
// xplan-ios
//
// Created by GreenLand on 2022/7/15.
//
#import "XPHomeLivePresenter.h"
#import "Api+Home.h"
#import "AccountInfoStorage.h"
#import "HomeLiveTagModel.h"
#import "XPHomeLiveProtocol.h"
@implementation XPHomeLivePresenter
/// tag
- (void)getHomeLiveTagList {
NSString * uid = [[AccountInfoStorage instance] getUid];
[Api homeLiveTagComplection:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSArray * array = [HomeLiveTagModel modelsWithArray:data.data];
[[self getView] getHomeLiveTagListSuccess:array];
}] uid:uid];
}
@end

View File

@@ -0,0 +1,16 @@
//
// XPHomeLiveProtocol.h
// xplan-ios
//
// Created by GreenLand on 2022/7/15.
//
#import <Foundation/Foundation.h>
@class HomeLiveTagModel;
@protocol XPHomeLiveProtocol <NSObject>
///获取所有的tag成功
- (void)getHomeLiveTagListSuccess:(NSArray<HomeLiveTagModel *> *)array;
@end

View File

@@ -0,0 +1,17 @@
//
// XPHomeLivesViewController.h
// xplan-ios
//
// Created by GreenLand on 2022/7/15.
//
#import "MvpViewController.h"
#import <JXCategoryView/JXCategoryListContainerView.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPHomeLivesViewController : MvpViewController<JXCategoryListContentViewDelegate>
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,175 @@
//
// XPHomeLivesViewController.m
// xplan-ios
//
// Created by GreenLand on 2022/7/15.
//
#import "XPHomeLivesViewController.h"
///Third
#import <Masonry/Masonry.h>
#import <JXCategoryView/JXCategoryView.h>
#import <JXCategoryView/JXCategoryIndicatorBackgroundView.h>
#import <JXCategoryView/JXCategoryListContainerView.h>
///Tool
#import "XPMacro.h"
#import "ThemeColor.h"
#import "XPHtmlUrl.h"
///Model
#import "HomeLiveTagModel.h"
///View
#import "XPRoomSearchContainerViewController.h"
#import "XPHomePartyViewController.h"
#import "XPWebViewController.h"
#import "XPHomeLikeViewController.h"
#import "XPHomeLittleGameViewController.h"
///P
#import "XPHomeLivePresenter.h"
#import "XPHomeLiveProtocol.h"
UIKIT_EXTERN NSString * kHomeMoreScrollPageKey;
@interface XPHomeLivesViewController ()<JXCategoryViewDelegate, JXCategoryListContainerViewDelegate, XPHomeLiveProtocol>
///
@property (nonatomic, strong) NSArray<NSString *> *titles;
///
@property (nonatomic, strong) JXCategoryTitleView *titleView;
///lineView
@property (nonatomic, strong) JXCategoryListContainerView *contentView;
///tag
@property (nonatomic,copy) NSArray<HomeLiveTagModel *> *tagList;
@end
@implementation XPHomeLivesViewController
- (BOOL)isHiddenNavBar {
return YES;
}
- (XPHomeLivePresenter *)createPresenter {
return [[XPHomeLivePresenter alloc] init];
}
- (void)viewDidLoad {
[super viewDidLoad];
[self initHttp];
[self initSubViews];
[self initSubViewConstraints];
}
#pragma mark - Private Method
- (void)initSubViews {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(recommendMoreNotification:) name:kHomeMoreScrollPageKey object:nil];
self.view.backgroundColor = [UIColor clearColor];
[self.view addSubview:self.titleView];
[self.view addSubview:self.contentView];
}
- (void)initSubViewConstraints {
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.view).offset(10);
make.left.right.mas_equalTo(self.view);
make.height.mas_equalTo(30);
}];
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.titleView.mas_bottom);
make.left.right.bottom.mas_equalTo(self.view);
}];
}
- (void)initHttp {
[self.presenter getHomeLiveTagList];
}
#pragma mark - JXCategoryViewDelegate
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView {
return self.titles.count;
}
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index {
HomeLiveTagModel * hometag = [self.tagList objectAtIndex:index];
UIViewController<JXCategoryListContentViewDelegate> * list = (UIViewController<JXCategoryListContentViewDelegate> *)[self.contentView.validListDict objectForKey:[NSNumber numberWithInteger:index]];
if (list) {
return list;
} else {
XPHomePartyViewController * homeVC = [[XPHomePartyViewController alloc] init];
homeVC.tabId = hometag.tid;
return homeVC;
}
}
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
HomeLiveTagModel * hometag = [self.tagList objectAtIndex:index];
XPHomePartyViewController * list = (XPHomePartyViewController<JXCategoryListContentViewDelegate> *)[self.contentView.validListDict objectForKey:[NSNumber numberWithInteger:index]];;
list.tabId = hometag.tid;
}
#pragma mark - JXCategoryListContentViewDelegate
- (UIView *)listView {
return self.view;
}
#pragma mark - XPHomeContainerProtocol
- (void)getHomeLiveTagListSuccess:(NSArray<HomeLiveTagModel *> *)array {
self.tagList = array;
NSMutableArray * titles = [NSMutableArray array];
[array enumerateObjectsUsingBlock:^(HomeLiveTagModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (obj.sortName.length > 0) {
[titles addObject:obj.sortName];
}
}];
self.titles = titles.copy;
self.titleView.titles = self.titles;
[self.titleView reloadData];
}
#pragma mark - Event Response
- (void)recommendMoreNotification:(NSNotification *)notification {
NSDictionary * dic = notification.object;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if ([[dic objectForKey:@"section"] integerValue] == 3) {
[self.titleView selectItemAtIndex:0];
}
});
}
#pragma mark - Getters And Setters
- (JXCategoryTitleView *)titleView {
if (!_titleView) {
_titleView = [[JXCategoryTitleView alloc] init];
_titleView.delegate = self;
_titleView.titles = self.titles;
_titleView.backgroundColor = [UIColor clearColor];
_titleView.titleColor = [ThemeColor secondTextColor];
_titleView.titleSelectedColor = [ThemeColor mainTextColor];
_titleView.titleFont = [UIFont fontWithName:@"PingFang-SC-Medium" size:13];
_titleView.titleSelectedFont = [UIFont fontWithName:@"PingFang-SC-Medium" size:16];
_titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter;
_titleView.contentScrollViewClickTransitionAnimationEnabled = NO;
_titleView.defaultSelectedIndex = 0;
_titleView.cellSpacing = 20;
_titleView.cellWidthIncrement = 5;
_titleView.listContainer = self.contentView;
_titleView.averageCellSpacingEnabled = NO;
JXCategoryIndicatorBackgroundView * indocator = [[JXCategoryIndicatorBackgroundView alloc] init];
indocator.indicatorColor = [ThemeColor appMainColor];
indocator.indicatorHeight = 24;
indocator.indicatorWidthIncrement = 15;
indocator.indicatorCornerRadius = 12;
_titleView.indicators = @[indocator];
}
return _titleView;
}
- (JXCategoryListContainerView *)contentView {
if (!_contentView) {
_contentView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
_contentView.defaultSelectedIndex = 0;
}
return _contentView;
}
@end

View File

@@ -27,6 +27,7 @@
#import "XPHomeHotRoomViewController.h"
#import "XPRoomViewController.h"
#import "XPLittleGameRoomOpenView.h"
#import "XPHomeLivesViewController.h"
UIKIT_EXTERN NSString *kHomeMoreScrollPageKey;
@@ -42,7 +43,9 @@ UIKIT_EXTERN NSString *kHomeMoreScrollPageKey;
@property (nonatomic,strong) XPHomeRecommendViewController *recommendVC;
@property (nonatomic,strong) XPHomePartyContainerViewController *partyVC;
///
@property (nonatomic,strong) XPHomePartyViewController *anchorRoomListVC;
//@property (nonatomic,strong) XPHomePartyViewController *anchorRoomListVC;
@property (nonatomic, strong) XPHomeLivesViewController *anchorRoomListVC;
@end
@implementation XPHomeViewController
@@ -104,9 +107,9 @@ UIKIT_EXTERN NSString *kHomeMoreScrollPageKey;
}
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
if (index == 2) {
self.anchorRoomListVC.isAnchor = YES;
}
// if (index == 2) {
// self.anchorRoomListVC.isAnchor = YES;
// }
}
#pragma mark - XPHoneNavViewDelegate
@@ -200,12 +203,19 @@ UIKIT_EXTERN NSString *kHomeMoreScrollPageKey;
return _partyVC;
}
- (XPHomePartyViewController *)anchorRoomListVC {
if (!_anchorRoomListVC) {
_anchorRoomListVC = [[XPHomePartyViewController alloc] init];
_anchorRoomListVC.isAnchor = YES;
}
return _anchorRoomListVC;
//- (XPHomePartyViewController *)anchorRoomListVC {
// if (!_anchorRoomListVC) {
// _anchorRoomListVC = [[XPHomePartyViewController alloc] init];
// _anchorRoomListVC.isAnchor = YES;
// }
// return _anchorRoomListVC;
//}
- (XPHomeLivesViewController *)anchorRoomListVC {
if (!_anchorRoomListVC) {
_anchorRoomListVC = [[XPHomeLivesViewController alloc] init];
}
return _anchorRoomListVC;
}
@end

View File

@@ -69,6 +69,8 @@ typedef NS_ENUM(NSInteger, RoomDatingStateChangeType) {
@property (nonatomic , assign) NSInteger isRecom;
@property (nonatomic , assign) NSInteger calcSumDataIndex;
@property (nonatomic , copy) NSString * roomTag;
@property (nonatomic , copy) NSString *singleRoomSortId;//房间分类
@property (nonatomic , copy) NSString *sortName;
@property (nonatomic , copy) NSString * audioSdkType;
@property (nonatomic , copy) NSString * trtcSig;
@property (nonatomic , assign) NSInteger hideFlag;

View File

@@ -63,6 +63,12 @@ NS_ASSUME_NONNULL_BEGIN
/// @param ticket ticket
/// @param uid uid
+ (void)updateRoomInfoMessageState:(HttpRequestHelperCompletion)complection roomId:(NSString *)roomId isCloseScreen:(NSString *)isCloseScreen ticket:(NSString *)ticket uid:(NSString *)uid;
/// 获取房间所有的分类tag
/// @param completion 完成
/// @param uid uid
+ (void)getRoomClassifyList:(HttpRequestHelperCompletion)completion uid:(NSString *)uid;
@end
NS_ASSUME_NONNULL_END

View File

@@ -81,4 +81,11 @@
[self makeRequest:@"room/setCloseScreen" method:HttpRequestHelperMethodPOST completion:complection, __FUNCTION__, roomId, isCloseScreen, ticket, uid, nil];
}
/// tag
/// @param completion
/// @param uid uid
+ (void)getRoomClassifyList:(HttpRequestHelperCompletion)completion uid:(NSString *)uid {
[self makeRequest:@"single/broadcast/sort" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, uid, nil];
}
@end

View File

@@ -0,0 +1,27 @@
//
// RoomClassifyModel.h
// xplan-ios
//
// Created by GreenLand on 2022/7/15.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface RoomClassifyModel : NSObject
///tag的id
@property (nonatomic,copy) NSString *cid;
///名字
@property (nonatomic, copy) NSString *sortName;
///描述
@property (nonatomic, copy) NSString *sortDesc;
@property (nonatomic, assign) NSInteger seq;
///是否选择
@property (nonatomic,assign) BOOL isSelect;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,16 @@
//
// RoomClassifyModel.m
// xplan-ios
//
// Created by GreenLand on 2022/7/15.
//
#import "RoomClassifyModel.h"
@implementation RoomClassifyModel
+ (NSDictionary *)replacedKeyFromPropertyName {
return @{@"cid":@"id"};
}
@end

View File

@@ -16,6 +16,8 @@ typedef NS_ENUM(NSInteger, RoomSettingItemType) {
RoomSettingItemType_Lock,
///房间密码
RoomSettingItemType_Pwd,
///房间分类
RoomSettingItemType_Class,
///房间标签
RoomSettingItemType_Tag,
///管理员

View File

@@ -42,6 +42,7 @@ NS_ASSUME_NONNULL_BEGIN
/// @param title 房间标题
/// @param roomPwd 房间密码
/// @param tagId 房间tag
/// @param classifyId 房间分类
/// @param hasAnimationEffect 是否开启房间特效
/// @param roomUid 房间uid
/// @param roomId 群聊的id
@@ -50,6 +51,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)updateRoomInfo:(NSString *)title
roomPwd:(NSString *)roomPwd
tagId:(NSString *)tagId
classifyId:(NSString *)classifyId
hasAnimationEffect:(BOOL)hasAnimationEffect
roomUid:(NSString *)roomUid
roomId:(NSString *)roomId

View File

@@ -38,6 +38,11 @@
pwdItem.type = RoomSettingItemType_Pwd;
}
XPRoomSettingItemModel *classItem = [[XPRoomSettingItemModel alloc] init];
classItem.title = @"房间分类";
classItem.subTitle = roomInfo.sortName;
classItem.type = RoomSettingItemType_Class;
XPRoomSettingItemModel *tagItem = [[XPRoomSettingItemModel alloc] init];
tagItem.title = @"房间标签";
tagItem.subTitle = roomInfo.roomTag;
@@ -87,13 +92,13 @@
if (roomInfo.roomPwd.length > 0) {
array = @[
@[titleItem, lockItem, pwdItem],
@[tagItem],
@[classItem, tagItem],
@[managerItem, blackItem, giftEffectItem, messageScreedItem]
];
} else {
array = @[
@[titleItem, lockItem],
@[tagItem],
@[classItem, tagItem],
@[managerItem, blackItem, giftEffectItem, messageScreedItem]
];
}
@@ -101,13 +106,13 @@
if (roomInfo.roomPwd.length > 0) {
array = @[
@[titleItem, lockItem, pwdItem],
@[tagItem],
@[classItem, tagItem],
@[managerItem, blackItem, giftEffectItem, messageScreedItem]
];
} else {
array = @[
@[titleItem, lockItem],
@[tagItem],
@[classItem, tagItem],
@[managerItem, blackItem, giftEffectItem, messageScreedItem]
];
}
@@ -278,7 +283,7 @@
/// @param roomUid uid
/// @param roomId id
/// @param mgId id
- (void)updateRoomInfo:(NSString *)title roomPwd:(NSString *)roomPwd tagId:(NSString *)tagId hasAnimationEffect:(BOOL)hasAnimationEffect roomUid:(NSString *)roomUid roomId:(NSString *)roomId type:(RoomType)type itemType:(RoomSettingItemType)itemType mgId:(NSString *)mgId{
- (void)updateRoomInfo:(NSString *)title roomPwd:(NSString *)roomPwd tagId:(NSString *)tagId classifyId:(NSString *)classifyId hasAnimationEffect:(BOOL)hasAnimationEffect roomUid:(NSString *)roomUid roomId:(NSString *)roomId type:(RoomType)type itemType:(RoomSettingItemType)itemType mgId:(NSString *)mgId{
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
NSMutableDictionary * params = [NSMutableDictionary dictionary];
@@ -298,6 +303,9 @@
if (tagId.length > 0) {
[params setObject:tagId forKey:@"tagId"];
}
if (classifyId.length > 0) {
[params setObject:classifyId forKey:@"singleRoomSortId"];
}
[params setObject:@(type) forKey:@"type"];
[params setObject:@(hasAnimationEffect) forKey:@"hasAnimationEffect"];

View File

@@ -11,7 +11,10 @@ NS_ASSUME_NONNULL_BEGIN
@interface XPRoomTagPresenter : BaseMvpPresenter
///获取房间标签列表
- (void)getRoomTagList;
///获取房间分类列表
- (void)getRoomClassifyList;
@end

View File

@@ -10,6 +10,7 @@
#import "AccountInfoStorage.h"
#import "XPRoomTagProtocol.h"
#import "RoomTagModel.h"
#import "RoomClassifyModel.h"
@implementation XPRoomTagPresenter
@@ -22,4 +23,12 @@
}] uid:uid];
}
- (void)getRoomClassifyList {
NSString * uid = [AccountInfoStorage instance].getUid;
[Api getRoomClassifyList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSArray * array = [RoomClassifyModel modelsWithArray:data.data];
[[self getView] getRoomClassifyListSuccess:array];
}] uid:uid];
}
@end

View File

@@ -13,6 +13,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)getRoomTagListSuccess:(NSArray *)array;
- (void)getRoomClassifyListSuccess:(NSArray *)array;
@end
NS_ASSUME_NONNULL_END

View File

@@ -84,7 +84,7 @@
- (void)setItemModel:(XPRoomSettingItemModel *)itemModel {
_itemModel = itemModel;
self.titleLabel.text = _itemModel.title;
if (_itemModel.type == RoomSettingItemType_Title || _itemModel.type == RoomSettingItemType_Tag || _itemModel.type == RoomSettingItemType_Black_List || _itemModel.type == RoomSettingItemType_Manager_List || _itemModel.type == RoomSettingItemType_Pwd) {
if (_itemModel.type == RoomSettingItemType_Title || _itemModel.type == RoomSettingItemType_Class || _itemModel.type == RoomSettingItemType_Tag || _itemModel.type == RoomSettingItemType_Black_List || _itemModel.type == RoomSettingItemType_Manager_List || _itemModel.type == RoomSettingItemType_Pwd) {
self.switchView.hidden = YES;
self.arrowImageView.hidden = NO;
self.subTitleLabel.hidden = NO;

View File

@@ -8,10 +8,13 @@
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class RoomTagModel;
@class RoomTagModel, RoomClassifyModel;
@interface XPRoomSettingTagCell : UICollectionViewCell
///房间tag
@property (nonatomic,strong) RoomTagModel *roomTag;
@property (nonatomic, strong) RoomClassifyModel *roomClassify;
@end
NS_ASSUME_NONNULL_END

View File

@@ -11,6 +11,8 @@
///Model
#import "RoomTagModel.h"
#import "ThemeColor.h"
#import "RoomClassifyModel.h"
@interface XPRoomSettingTagCell ()
@property (nonatomic, strong) UILabel *tagLabel;
@end
@@ -46,6 +48,20 @@
}
}
- (void)setRoomClassify:(RoomClassifyModel *)roomClassify {
_roomClassify = roomClassify;
if (_roomClassify) {
self.tagLabel.text = _roomClassify.sortName;
if (_roomClassify.isSelect) {
self.backgroundColor = [ThemeColor appMainColor];
self.tagLabel.textColor = [ThemeColor mainTextColor];
} else {
self.backgroundColor = [ThemeColor disableButtonColor];
self.tagLabel.textColor = [ThemeColor disableButtonTextColor];
}
}
}
#pragma mark - Getter & Setter
- (UILabel *)tagLabel {
if (!_tagLabel) {

View File

@@ -201,22 +201,39 @@ XPRoomSettingItemModel * itemModel = [[self.datasource objectAtIndex:indexPath.s
XPRoomSettingItemModel * itemModel = [[self.datasource objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid];
NSString * roomId = [NSString stringWithFormat:@"%ld", self.roomInfo.roomId];
NSString * roomTag = [NSString stringWithFormat:@"%ld", self.roomInfo.tagId];
NSString *roomClassifyId = self.roomInfo.singleRoomSortId;
switch (itemModel.type) {
case RoomSettingItemType_Tag:
case RoomSettingItemType_Class:
{
XPRoomTagListViewController * roomTagVC = [[XPRoomTagListViewController alloc] init];
roomTagVC.tagId = [NSString stringWithFormat:@"%ld", self.roomInfo.tagId];
roomTagVC.tagType = RoomSettingTagTypeClassify;
roomTagVC.tagId = self.roomInfo.singleRoomSortId;
roomTagVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
@kWeakify(self);
roomTagVC.completion = ^(NSString * _Nonnull tag) {
@kStrongify(self)
NSString * mgId = [NSString stringWithFormat:@"%lld", self.roomInfo.mgId];
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:self.roomInfo.roomPwd tagId:tag hasAnimationEffect:self.roomInfo.hasAnimationEffect roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:itemModel.type mgId:mgId];
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:self.roomInfo.roomPwd tagId:roomTag classifyId:tag hasAnimationEffect:self.roomInfo.hasAnimationEffect roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:itemModel.type mgId:mgId];
};
[self.navigationController presentViewController:roomTagVC animated:YES completion:nil];
}
break;
case RoomSettingItemType_Tag:
{
XPRoomTagListViewController * roomTagVC = [[XPRoomTagListViewController alloc] init];
roomTagVC.tagType = RoomSettingTagTypeTag;
roomTagVC.tagId = [NSString stringWithFormat:@"%ld", self.roomInfo.tagId];
roomTagVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
@kWeakify(self);
roomTagVC.completion = ^(NSString * _Nonnull tag) {
@kStrongify(self)
NSString * mgId = [NSString stringWithFormat:@"%lld", self.roomInfo.mgId];
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:self.roomInfo.roomPwd tagId:tag classifyId:roomClassifyId hasAnimationEffect:self.roomInfo.hasAnimationEffect roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:itemModel.type mgId:mgId];
};
[self.navigationController presentViewController:roomTagVC animated:YES completion:nil];
}
break;
case RoomSettingItemType_Title:
{
XPRoomSettingInputView * titleView = [[XPRoomSettingInputView alloc] init];
@@ -267,11 +284,12 @@ XPRoomSettingItemModel * itemModel = [[self.datasource objectAtIndex:indexPath.s
NSString * roomId = [NSString stringWithFormat:@"%ld", self.roomInfo.roomId];
NSString * roomTag = [NSString stringWithFormat:@"%ld", self.roomInfo.tagId];
NSString * mgId = [NSString stringWithFormat:@"%lld", self.roomInfo.mgId];
NSString * roomClassifyId = self.roomInfo.singleRoomSortId;
if (type == RoomSettingInputType_Pwd) {
NSString *pwdDes = [DESEncrypt encryptUseDES:text key:KeyWithType(KeyType_PasswordEncode)];
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:pwdDes tagId:roomTag hasAnimationEffect:self.roomInfo.hasAnimationEffect roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:RoomSettingItemType_Pwd mgId:mgId];
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:pwdDes tagId:roomTag classifyId:roomClassifyId hasAnimationEffect:self.roomInfo.hasAnimationEffect roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:RoomSettingItemType_Pwd mgId:mgId];
} else if(type == RoomSettingInputType_Title) {
[self.presenter updateRoomInfo:text roomPwd:self.roomInfo.roomPwd tagId:roomTag hasAnimationEffect:self.roomInfo.hasAnimationEffect roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:RoomSettingItemType_Title mgId:mgId];
[self.presenter updateRoomInfo:text roomPwd:self.roomInfo.roomPwd tagId:roomTag classifyId:roomClassifyId hasAnimationEffect:self.roomInfo.hasAnimationEffect roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:RoomSettingItemType_Title mgId:mgId];
}
}
@@ -281,6 +299,7 @@ XPRoomSettingItemModel * itemModel = [[self.datasource objectAtIndex:indexPath.s
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid];
NSString * roomId = [NSString stringWithFormat:@"%ld", self.roomInfo.roomId];
NSString * roomTag = [NSString stringWithFormat:@"%ld", self.roomInfo.tagId];
NSString * roomClassifyId = self.roomInfo.singleRoomSortId;
switch (itemModel.type) {
case RoomSettingItemType_Arrange_Mic:
{
@@ -333,7 +352,7 @@ XPRoomSettingItemModel * itemModel = [[self.datasource objectAtIndex:indexPath.s
[TTPopup popupView:titleView style:TTPopupStyleAlert];
} else {
NSString * mgId = [NSString stringWithFormat:@"%lld", self.roomInfo.mgId];
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:@"" tagId:roomTag hasAnimationEffect:self.roomInfo.hasAnimationEffect roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:itemModel.type mgId:mgId];
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:@"" tagId:roomTag classifyId:roomClassifyId hasAnimationEffect:self.roomInfo.hasAnimationEffect roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:itemModel.type mgId:mgId];
}
}
break;
@@ -341,7 +360,7 @@ XPRoomSettingItemModel * itemModel = [[self.datasource objectAtIndex:indexPath.s
{
if (isOn) {
NSString * mgId = [NSString stringWithFormat:@"%lld", self.roomInfo.mgId];
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:self.roomInfo.roomPwd tagId:roomTag hasAnimationEffect:YES roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:itemModel.type mgId:mgId];
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:self.roomInfo.roomPwd tagId:roomTag classifyId:roomClassifyId hasAnimationEffect:YES roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:itemModel.type mgId:mgId];
return;
}
TTAlertConfig *config = [[TTAlertConfig alloc] init];
@@ -351,7 +370,7 @@ XPRoomSettingItemModel * itemModel = [[self.datasource objectAtIndex:indexPath.s
[TTPopup alertWithConfig:config confirmHandler:^{
NSString * mgId = [NSString stringWithFormat:@"%lld", self.roomInfo.mgId];
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:self.roomInfo.roomPwd tagId:roomTag hasAnimationEffect:NO roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:itemModel.type mgId:mgId];
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:self.roomInfo.roomPwd tagId:roomTag classifyId:roomClassifyId hasAnimationEffect:NO roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:itemModel.type mgId:mgId];
} cancelHandler:^{
}];

View File

@@ -7,6 +7,11 @@
#import "MvpViewController.h"
typedef NS_ENUM(NSUInteger, RoomSettingTagType) {
RoomSettingTagTypeTag,///房间标签
RoomSettingTagTypeClassify,///房间分类
};
NS_ASSUME_NONNULL_BEGIN
typedef void(^DidClickCompletion)(NSString *tag);
@@ -16,6 +21,8 @@ typedef void(^DidClickCompletion)(NSString *tag);
@property (nonatomic,copy) NSString *tagId;
///选择完成了
@property (nonatomic,copy) DidClickCompletion completion;
///标签类型
@property (nonatomic, assign) RoomSettingTagType tagType;
@end

View File

@@ -10,8 +10,10 @@
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "XPMacro.h"
///Model
#import "RoomTagModel.h"
#import "RoomClassifyModel.h"
///View
#import "XPRoomSettingTagCell.h"
///P
@@ -31,6 +33,9 @@
@property (nonatomic,strong) NSArray *datasource;
///tag
@property (nonatomic,strong) RoomTagModel *selectTagInfo;
///
@property (nonatomic, strong) RoomClassifyModel *selectClassifyInfo;
@end
@implementation XPRoomTagListViewController
@@ -41,7 +46,12 @@
- (void)viewDidLoad {
[super viewDidLoad];
[self.presenter getRoomTagList];
if (self.tagType == RoomSettingTagTypeTag) {
[self.presenter getRoomTagList];
} else {
[self.presenter getRoomClassifyList];
self.titleLabel.text = @"快给您的房间选个分类吧!";
}
[self initSubViews];
[self initSubViewConstraints];
}
@@ -64,7 +74,7 @@
[self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(32);
make.top.mas_equalTo(36-5);
make.top.mas_equalTo(kStatusBarHeight + 6);
make.right.mas_equalTo(-23+5);
}];
@@ -87,6 +97,12 @@
[self.collectionView reloadData];
}
- (void)getRoomClassifyListSuccess:(NSArray *)array {
self.datasource = array;
[self.collectionView reloadData];
}
#pragma mark - UICollectionViewDataSource
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
return 1;
@@ -98,21 +114,39 @@
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
XPRoomSettingTagCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPRoomSettingTagCell class]) forIndexPath:indexPath];
RoomTagModel *homeTag = [self.datasource objectAtIndex:indexPath.row];
if (self.selectTagInfo) {
if (homeTag.tid.intValue == self.selectTagInfo.tid.intValue) {
homeTag.isSelect = YES;
}else {
homeTag.isSelect = NO;
}
} else {
if (homeTag.tid.intValue == self.tagId.intValue) {
homeTag.isSelect = YES;
}else {
homeTag.isSelect = NO;
}
}
cell.roomTag = homeTag;
if (self.tagType == RoomSettingTagTypeTag) {
RoomTagModel *homeTag = [self.datasource objectAtIndex:indexPath.row];
if (self.selectTagInfo) {
if (homeTag.tid.intValue == self.selectTagInfo.tid.intValue) {
homeTag.isSelect = YES;
}else {
homeTag.isSelect = NO;
}
} else {
if (homeTag.tid.intValue == self.tagId.intValue) {
homeTag.isSelect = YES;
}else {
homeTag.isSelect = NO;
}
}
cell.roomTag = homeTag;
} else {
RoomClassifyModel *homeTag = [self.datasource objectAtIndex:indexPath.row];
if (self.selectClassifyInfo) {
if (homeTag.cid.intValue == self.selectClassifyInfo.cid.intValue) {
homeTag.isSelect = YES;
}else {
homeTag.isSelect = NO;
}
} else {
if (homeTag.cid.intValue == self.tagId.intValue) {
homeTag.isSelect = YES;
}else {
homeTag.isSelect = NO;
}
}
cell.roomClassify = homeTag;
}
return cell;
}
@@ -121,16 +155,27 @@
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
RoomTagModel *homeTag = [self.datasource objectAtIndex:indexPath.row];
CGFloat width = [homeTag.name boundingRectWithSize:CGSizeMake(200, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12]} context:nil].size.width;
return CGSizeMake(width + 26, 26);
if (self.tagType == RoomSettingTagTypeTag) {
RoomTagModel *homeTag = [self.datasource objectAtIndex:indexPath.row];
CGFloat width = [homeTag.name boundingRectWithSize:CGSizeMake(200, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12]} context:nil].size.width;
return CGSizeMake(width + 26, 26);
} else {
RoomClassifyModel *homeTag = [self.datasource objectAtIndex:indexPath.row];
CGFloat width = [homeTag.sortName boundingRectWithSize:CGSizeMake(200, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12]} context:nil].size.width;
return CGSizeMake(width + 26, 26);
}
}
#pragma mark - UICollectionViewDelegate
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
RoomTagModel * roomTag = [self.datasource objectAtIndex:indexPath.row];
self.selectTagInfo = roomTag;
if (self.tagType == RoomSettingTagTypeTag) {
RoomTagModel * roomTag = [self.datasource objectAtIndex:indexPath.row];
self.selectTagInfo = roomTag;
} else {
RoomClassifyModel *roomClassify = [self.datasource objectAtIndex:indexPath.row];
self.selectClassifyInfo = roomClassify;
}
[collectionView reloadData];
}
@@ -138,7 +183,11 @@
- (void)confirmButtonAction:(UIButton *)sender {
[self dismissViewControllerAnimated:YES completion:nil];
if (self.completion) {
self.completion(self.selectTagInfo.tid);
if (self.tagType == RoomSettingTagTypeTag) {
self.completion(self.selectTagInfo.tid);
} else {
self.completion(self.selectClassifyInfo.cid);
}
}
}