Commit a08a9751eea8fd1f4df72b1b382c5d5bae40f0d0

Authored by yanglingyu
1 parent 90108bd0

no message

Showing 50 changed files with 1628 additions and 70 deletions
CNLiveVideoClassifyKit.podspec
@@ -38,6 +38,7 @@ TODO: Add long description of the pod here. @@ -38,6 +38,7 @@ TODO: Add long description of the pod here.
38 # } 38 # }
39 s.prefix_header_contents = '#import "CNLivevideoClassifyPCH.h"' 39 s.prefix_header_contents = '#import "CNLivevideoClassifyPCH.h"'
40 s.public_header_files = 'Pod/Classes/**/*.h' 40 s.public_header_files = 'Pod/Classes/**/*.h'
  41 +# s.static_framework = true
41 s.frameworks = 'UIKit', 'MapKit' 42 s.frameworks = 'UIKit', 'MapKit'
42 s.dependency 'JXCategoryView' 43 s.dependency 'JXCategoryView'
43 s.dependency 'CNLiveTripartiteManagement/MJExtension' 44 s.dependency 'CNLiveTripartiteManagement/MJExtension'
@@ -47,6 +48,7 @@ TODO: Add long description of the pod here. @@ -47,6 +48,7 @@ TODO: Add long description of the pod here.
47 s.dependency 'CNLiveCommonCategory' 48 s.dependency 'CNLiveCommonCategory'
48 s.dependency 'CNLiveBeeHive' 49 s.dependency 'CNLiveBeeHive'
49 s.dependency 'CNLiveEnvironment' 50 s.dependency 'CNLiveEnvironment'
  51 + s.dependency 'UMCCommon'
50 s.dependency 'CNLiveTripartiteManagement/SDWebImage' 52 s.dependency 'CNLiveTripartiteManagement/SDWebImage'
51 s.dependency 'CNLiveTripartiteManagement/Masonry' 53 s.dependency 'CNLiveTripartiteManagement/Masonry'
52 s.dependency 'CNLiveTripartiteManagement/YYKit' 54 s.dependency 'CNLiveTripartiteManagement/YYKit'
CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/ClassifyMore@2x.png 0 → 100644

496 Bytes

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/ClassifyMore@3x.png 0 → 100644

831 Bytes

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/dzty-text@2x.png 0 → 100644

29.6 KB

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/dzty-text@3x.png 0 → 100644

125 KB

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/dzty@2x.png 0 → 100644

3.17 KB

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/dzty@3x.png 0 → 100644

8.17 KB

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/listen_downloading@2x.png 0 → 100644

1.19 KB

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/listen_downloading@3x.png 0 → 100644

2.15 KB

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/listen_historey@2x.png 0 → 100644

1.24 KB

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/listen_historey@3x.png 0 → 100644

2.37 KB

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/mjz-arrow@2x.png 0 → 100644

5.21 KB

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/mjz-arrow@3x.png 0 → 100644

13.1 KB

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/mjz-new-text@2x.png 0 → 100644

12.7 KB

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/mjz-new-text@3x.png 0 → 100644

54.8 KB

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/mjz@2x.png 0 → 100644

1.77 KB

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/mjz@3x.png 0 → 100644

6.69 KB

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/mjzgx_an@2x.png 0 → 100644

7.28 KB

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/mjzgx_an@3x.png 0 → 100644

19.4 KB

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/playBtn@2x.png 0 → 100644

418 Bytes

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/playBtn@3x.png 0 → 100644

667 Bytes

CNLiveVideoClassifyKit/Classes/Controller/CNCategoryBaseViewController.h
@@ -23,6 +23,7 @@ NS_ASSUME_NONNULL_BEGIN @@ -23,6 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
23 -(void)addTheFirstPage; //默认页 23 -(void)addTheFirstPage; //默认页
24 -(JXCategoryBaseView *)preferredCategoryView; 24 -(JXCategoryBaseView *)preferredCategoryView;
25 -(CGFloat)preferredCategoryViewHeight; 25 -(CGFloat)preferredCategoryViewHeight;
  26 +-(void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index;
26 @end 27 @end
27 28
28 NS_ASSUME_NONNULL_END 29 NS_ASSUME_NONNULL_END
CNLiveVideoClassifyKit/Classes/Controller/CNCategoryBaseViewController.m
@@ -102,6 +102,7 @@ @@ -102,6 +102,7 @@
102 [self.pageViewController setViewControllers:@[vc] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:NULL]; 102 [self.pageViewController setViewControllers:@[vc] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:NULL];
103 }else 103 }else
104 { 104 {
  105 + self.ld_currentIndex = index;
105 [self.pageViewController setViewControllers:@[vc] direction:UIPageViewControllerNavigationDirectionReverse animated:YES completion:NULL]; 106 [self.pageViewController setViewControllers:@[vc] direction:UIPageViewControllerNavigationDirectionReverse animated:YES completion:NULL];
106 } 107 }
107 } 108 }
CNLiveVideoClassifyKit/Classes/Controller/CNLiveClassifySegmentController.h
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 NS_ASSUME_NONNULL_BEGIN 10 NS_ASSUME_NONNULL_BEGIN
11 11
12 @interface CNLiveClassifySegmentController : CNCategoryBaseViewController 12 @interface CNLiveClassifySegmentController : CNCategoryBaseViewController
13 - 13 +- (void)dataDivideIntoNormalAndOtherWithFirst:(BOOL)first;
14 @end 14 @end
15 15
16 NS_ASSUME_NONNULL_END 16 NS_ASSUME_NONNULL_END
CNLiveVideoClassifyKit/Classes/Controller/CNLiveClassifySegmentController.m
@@ -11,23 +11,32 @@ @@ -11,23 +11,32 @@
11 #import "CNCategoryGetChannelModel.h" 11 #import "CNCategoryGetChannelModel.h"
12 #import "CNLiveListManager.h" 12 #import "CNLiveListManager.h"
13 #import "CNLiveSubSegmentController.h" 13 #import "CNLiveSubSegmentController.h"
  14 +#import "CNWebRedirectHandle.h"
  15 +#import "CNWitnessShadeManager.h"
  16 +#import "CNSupervisionGuideViewManager.h"
14 17
15 static const CGFloat animationTime = 0.3; 18 static const CGFloat animationTime = 0.3;
16 static const CGFloat animationHeight = 15; 19 static const CGFloat animationHeight = 15;
17 20
18 -@interface CNLiveClassifySegmentController ()<JXCategoryViewDelegate,CNCustomChannelListViewDelegate> 21 +@interface CNLiveClassifySegmentController ()<JXCategoryViewDelegate,CNCustomChannelListViewDelegate,CNSubClassifySegmentControllerDelegate>
19 22
20 @property (nonatomic, strong)JXCategoryTitleImageView *myCategoryView; //选择器 23 @property (nonatomic, strong)JXCategoryTitleImageView *myCategoryView; //选择器
21 @property (nonatomic, strong) UIButton *customChannelsBtn; 24 @property (nonatomic, strong) UIButton *customChannelsBtn;
22 @property (nonatomic, strong) UIButton *loginBtn; 25 @property (nonatomic, strong) UIButton *loginBtn;
23 @property (nonatomic, strong) CNCustomChannelListView *customChannelsV; 26 @property (nonatomic, strong) CNCustomChannelListView *customChannelsV;
24 -//@property (nonatomic, strong) CNTouristsLoginTipsView *fuzzyView;//游客登录弹框 27 +@property (nonatomic, strong) UIView *fuzzyView;//游客登录弹框
25 @property (nonatomic, strong) UIImageView *topBgImg; //头部图片 28 @property (nonatomic, strong) UIImageView *topBgImg; //头部图片
26 @property (nonatomic, assign) CGFloat topBgImgHeight;//头部图片高度 29 @property (nonatomic, assign) CGFloat topBgImgHeight;//头部图片高度
27 @property (nonatomic, assign) CGFloat lastOffsetY; 30 @property (nonatomic, assign) CGFloat lastOffsetY;
28 31
  32 +@property (nonatomic, assign) NSInteger isLoginIndex;
29 33
30 @property (nonatomic, strong) NSString * currentAtatusColor; 34 @property (nonatomic, strong) NSString * currentAtatusColor;
  35 +//电商通知返回
  36 +@property (nonatomic, copy) NSString *naviBackgroundColor;
  37 +@property (nonatomic, copy) NSString *naviNormalTitleColor;
  38 +@property (nonatomic, copy) NSString *naviSelectTitleColor;
  39 +@property (nonatomic, assign) NSUInteger statusState;
31 40
32 @property (nonatomic, strong) NSMutableArray *dataArray; //数据 41 @property (nonatomic, strong) NSMutableArray *dataArray; //数据
33 @property (nonatomic, strong) NSMutableArray *bgImages; //背景图 42 @property (nonatomic, strong) NSMutableArray *bgImages; //背景图
@@ -42,6 +51,8 @@ static const CGFloat animationHeight = 15; @@ -42,6 +51,8 @@ static const CGFloat animationHeight = 15;
42 @property (nonatomic, assign) BOOL isEditing; 51 @property (nonatomic, assign) BOOL isEditing;
43 @property (nonatomic, assign) BOOL oldStatusBar; 52 @property (nonatomic, assign) BOOL oldStatusBar;
44 @property (nonatomic, assign) BOOL isLoading; 53 @property (nonatomic, assign) BOOL isLoading;
  54 +@property (nonatomic, assign) BOOL isDSShopChanged;
  55 +@property (nonatomic, assign) BOOL contentLogin;//从内容跳过来的
45 56
46 @end 57 @end
47 58
@@ -49,10 +60,15 @@ static const CGFloat animationHeight = 15; @@ -49,10 +60,15 @@ static const CGFloat animationHeight = 15;
49 static CGFloat moveHeight = 50; 60 static CGFloat moveHeight = 50;
50 - (void)viewDidLoad { 61 - (void)viewDidLoad {
51 [super viewDidLoad]; 62 [super viewDidLoad];
52 - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(classifyChannelsRequest:) name:CNWjjClassifyChannelsRequestStateNotifiName object:nil];  
53 - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(classifyChannelsRequestedHideLoading:) name:CNWjjClassifyChannelsRequestHideLoadingNotifiName object:nil]; 63 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(DSShopNavColorChange:) name:CNWjjDSShopNavColorChangeNotifiName object:nil];
  64 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(PageControlScrollEnable:) name:kDSHappinessPageControlScrollEnableNotification object:nil];
  65 + self.navigationController.navigationBar.barTintColor = kWhiteColor;
  66 + [CNWebRedirectHandle manager].isSelectedClassify = YES;
  67 + [BHConfig set:CNLiveLaunchWithFirsh boolValue:NO];
  68 +
54 self.topBgImgHeight = kStatusHeight+100; 69 self.topBgImgHeight = kStatusHeight+100;
55 self.ld_currentIndex = 0; 70 self.ld_currentIndex = 0;
  71 + self.isLoginIndex = -1;
56 [self.view addSubview:self.topBgImg]; 72 [self.view addSubview:self.topBgImg];
57 [self.view sendSubviewToBack:self.topBgImg]; 73 [self.view sendSubviewToBack:self.topBgImg];
58 [self dataDivideIntoNormalAndOtherWithFirst:YES]; 74 [self dataDivideIntoNormalAndOtherWithFirst:YES];
@@ -79,39 +95,129 @@ static CGFloat moveHeight = 50; @@ -79,39 +95,129 @@ static CGFloat moveHeight = 50;
79 if (!self.isLoading) { 95 if (!self.isLoading) {
80 [self uploadSubViews]; 96 [self uploadSubViews];
81 } 97 }
82 - 98 + if (![CNUserShareManager isLogin]) {
  99 + NSString *showGuide = [[NSUserDefaults standardUserDefaults] objectForKey:CNLiveNetAddShowGuideKey];
  100 + if ([showGuide isEqualToString:@"1"] && ![BHConfig boolValue:ChannelsShowGuide]) {
  101 + NSString *showGuideH = [[NSUserDefaults standardUserDefaults] objectForKey:CNLiveNetAddShowGuideHKey];
  102 + BOOL result = [self judgeShowGuide:showGuideH];
  103 + if (!result) {
  104 + [CNLiveClassifyJumpBridge showViewOrPushVCWithCurrentVC:self pushType:CNLiveClassifyJumpShowLoginView];
  105 + }
  106 + } else {
  107 + [CNLiveClassifyJumpBridge showViewOrPushVCWithCurrentVC:self pushType:CNLiveClassifyJumpShowLoginView];
  108 + }
  109 + }
  110 + if (![CNUserShareManager isLogin]) {
  111 + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"is_Active_Application"];
  112 + [[NSUserDefaults standardUserDefaults] synchronize];
  113 + }
  114 + NSString *channelId = [BHConfig get:ChannelsSelectFirst];
  115 + [BHConfig set:ChannelsSelectFirst value:@""];
  116 + NSInteger selectChannelId = -1;
  117 + if (!CNLiveStringIsEmpty(channelId)) {
  118 + selectChannelId = [self containsWithChannelId:channelId];
  119 + if (selectChannelId != -1) {
  120 + self.isLoginIndex = selectChannelId;
  121 + }
  122 + }
  123 + if ([CNWebRedirectHandle manager].isClickedIntegral) {
  124 + [CNWebRedirectHandle manager].isClickedIntegral = NO;
  125 + [self categoryView:self.myCategoryView didSelectedItemAtIndex:[CNWebRedirectHandle manager].channelId];
  126 + CNLiveSubSegmentController *svc = [self.controllersArr safetyObjectAtIndex:[CNWebRedirectHandle manager].classifyId];
  127 + if([svc isKindOfClass:[CNLiveSubSegmentController class]]){
  128 + //目击者 - 今日要闻 - 中国冰雪
  129 + [svc categoryView:svc.categoryView didSelectedItemAtIndex:[CNWebRedirectHandle manager].classifyId];
  130 + }
  131 + [CNWebRedirectHandle manager].channelId = 0;
  132 + [CNWebRedirectHandle manager].classifyId = 0;
  133 + } else {
  134 +
  135 + if (!CNLiveStringIsEmpty(channelId)) {
  136 + self.contentLogin = YES;
  137 + if(selectChannelId == -1){
  138 + //我的频道中没有这个频道
  139 + [self categoryView:self.myCategoryView didSelectedItemAtIndex:self.ld_currentIndex];
  140 + self.fuzzyView = [CNLiveClassifyJumpBridge showViewOrPushVCWithCurrentVC:self pushType:CNLiveClassifyJumpShowFuzzyView];
  141 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(touristsLoginTipsViewIsClassify:) name:TouristloginTipsViewActionNotification object:nil];
  142 + } else {
  143 + [self categoryView:self.myCategoryView didSelectedItemAtIndex:selectChannelId];
  144 + }
  145 + //最后判断是否有url//
  146 + NSString *url = [BHConfig get:LoginPrepositionUrl];
  147 + if(url && ![url isEqualToString:@""]){
  148 + if ([url isEqualToString:@"DSShopLoginUrl"]) {
  149 + [CNLiveClassifyJumpBridge showViewOrPushVCWithCurrentVC:self pushType:CNLiveClassifyJumpPushShopSDKVC];
  150 + }
  151 + else if ([url isEqualToString:@"judgeGiftUrl"]) {
  152 + NSURL *otherUrl = [BHConfig get:ActivityNewUrl];
  153 + if (otherUrl && [CNUserShareManager isLogin]) {
  154 + [CNLiveClassifyJumpBridge checkForloginTurnToWithURL:otherUrl];
  155 + }
  156 + }
  157 + else {
  158 + [CNLiveClassifyJumpBridge checkWithFunctionForShareURL:url];
  159 + }
  160 + } else {
  161 + if ([CNUserShareManager isLogin]) {
  162 + NSURL *otherUrl = [BHConfig get:ActivityNewUrl];
  163 + if (otherUrl) {
  164 + [CNLiveClassifyJumpBridge checkForloginTurnToWithURL:otherUrl];
  165 + }
  166 + }
  167 + }
  168 + } else {
  169 + [self categoryView:self.myCategoryView didSelectedItemAtIndex:self.ld_currentIndex];
  170 + }
  171 + }
83 // Do any additional setup after loading the view. 172 // Do any additional setup after loading the view.
84 } 173 }
  174 +-(void)viewWillAppear:(BOOL)animated {
  175 +
  176 + [super viewWillAppear:animated];
  177 + if (![[NSUserDefaults standardUserDefaults] boolForKey:CNLiveLaunchWithFirsh]) {
  178 + [[NSNotificationCenter defaultCenter] postNotificationName:kCNLiveDeepLinkPushNotification object:nil];
  179 + [[NSNotificationCenter defaultCenter] postNotificationName:kCNLiveRemotePushNotification object:nil];
  180 + }
  181 + self.navigationController.navigationBar.hidden = YES;
  182 + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:CNLiveLaunchWithFirsh];
  183 + [[NSUserDefaults standardUserDefaults] synchronize];
  184 + self.tabBarController.tabBar.hidden = NO;
  185 +}
  186 +- (void)viewDidAppear:(BOOL)animated {
  187 + [super viewDidAppear:animated];
85 188
  189 + if ([[NSUserDefaults standardUserDefaults] boolForKey:CNLiveLaunchWithFirsh] && ![BHConfig get:CNLiveLaunchWithFirsh]) {
  190 + [[NSNotificationCenter defaultCenter] postNotificationName:kCNLiveDeepLinkPushNotification object:nil];
  191 + [[NSNotificationCenter defaultCenter] postNotificationName:kCNLiveRemotePushNotification object:nil];
  192 + }
  193 +}
  194 +- (void)viewWillDisappear:(BOOL)animated {
  195 + [super viewWillDisappear:animated];
  196 + [self quitCustomChannels];
  197 + self.navigationController.navigationBar.hidden = NO;
  198 +}
  199 +- (void)dealloc
  200 +{
  201 + [[NSNotificationCenter defaultCenter] removeObserver:self];
  202 + NSLog(@"CNClassifySegmentController dealloc");
  203 +}
86 -(void)viewDidLayoutSubviews 204 -(void)viewDidLayoutSubviews
87 { 205 {
88 [super viewDidLayoutSubviews]; 206 [super viewDidLayoutSubviews];
89 self.pageViewController.view.frame = CGRectMake(0, self.myCategoryView.bottom, kScreenWidth, self.view.bounds.size.height - self.myCategoryView.bottom+ moveHeight); 207 self.pageViewController.view.frame = CGRectMake(0, self.myCategoryView.bottom, kScreenWidth, self.view.bounds.size.height - self.myCategoryView.bottom+ moveHeight);
90 if ([CNUserShareManager isLogin]) { 208 if ([CNUserShareManager isLogin]) {
91 self.myCategoryView.width = kScreenWidth - 45; 209 self.myCategoryView.width = kScreenWidth - 45;
92 - self.customChannelsBtn.centerY = self.myCategoryView.centerY; 210 + self.customChannelsBtn.centerY = self.myCategoryView.height/2 + kStatusHeight;
93 self.customChannelsBtn.right = kScreenWidth - 18; 211 self.customChannelsBtn.right = kScreenWidth - 18;
94 }else 212 }else
95 { 213 {
96 self.myCategoryView.width = kScreenWidth - 70; 214 self.myCategoryView.width = kScreenWidth - 70;
97 - self.loginBtn.centerY = self.myCategoryView.centerY; 215 + self.loginBtn.centerY = self.myCategoryView.height/2 + kStatusHeight;
98 self.loginBtn.right = kScreenWidth - 11; 216 self.loginBtn.right = kScreenWidth - 11;
99 } 217 }
100 218
101 } 219 }
102 220
103 --(void)viewDidAppear:(BOOL)animated  
104 -{  
105 - [super viewDidAppear:animated];  
106 -  
107 -}  
108 -  
109 --(void)viewDidDisappear:(BOOL)animated  
110 -{  
111 - [super viewDidDisappear: animated];  
112 - [self quitCustomChannels];  
113 -}  
114 -  
115 221
116 -(UIStatusBarStyle)preferredStatusBarStyle 222 -(UIStatusBarStyle)preferredStatusBarStyle
117 { 223 {
@@ -157,6 +263,10 @@ static CGFloat moveHeight = 50; @@ -157,6 +263,10 @@ static CGFloat moveHeight = 50;
157 self.topBgImg.frame = CGRectMake(0, 0, KScreenWidth, self.topBgImgHeight); 263 self.topBgImg.frame = CGRectMake(0, 0, KScreenWidth, self.topBgImgHeight);
158 CNLiveSubSegmentController *subVC = [[CNLiveSubSegmentController alloc] initWithModel:model]; 264 CNLiveSubSegmentController *subVC = [[CNLiveSubSegmentController alloc] initWithModel:model];
159 subVC.isBlack = isBlack; 265 subVC.isBlack = isBlack;
  266 + subVC.delegate = self;
  267 + if (i == self.isLoginIndex) {
  268 + subVC.selectChannelId = i;
  269 + }
160 weakself 270 weakself
161 subVC.scrollViewDidScrollBlock = ^(BOOL isUp) { 271 subVC.scrollViewDidScrollBlock = ^(BOOL isUp) {
162 [weakSelf scrollViewUpDowm:isUp]; 272 [weakSelf scrollViewUpDowm:isUp];
@@ -175,6 +285,9 @@ static CGFloat moveHeight = 50; @@ -175,6 +285,9 @@ static CGFloat moveHeight = 50;
175 } 285 }
176 } 286 }
177 [self addTheFirstPage]; 287 [self addTheFirstPage];
  288 + if (![CNUserShareManager isLogin]) {
  289 + [CNLiveClassifyJumpBridge bringCenterLoginViewToFront];
  290 + }
178 } 291 }
179 292
180 293
@@ -193,7 +306,63 @@ static CGFloat moveHeight = 50; @@ -193,7 +306,63 @@ static CGFloat moveHeight = 50;
193 306
194 [QMUITips hideAllTipsInView:self.view]; 307 [QMUITips hideAllTipsInView:self.view];
195 } 308 }
  309 +// 电商中国通过电商SDK发通知修改电商频道的选择器样式
  310 +- (void)DSShopNavColorChange:(NSNotification *)noti {
  311 +
  312 + self.naviBackgroundColor = [noti.userInfo objectForKey:@"naviBackgroundColor"];
  313 + self.naviNormalTitleColor = [noti.userInfo objectForKey:@"naviNormalTitleColor"];
  314 + self.naviSelectTitleColor = [noti.userInfo objectForKey:@"naviSelectTitleColor"];
  315 + self.statusState = [[noti.userInfo objectForKey:@"statusState"] integerValue];
  316 +
  317 + if (CNLiveStringIsEmpty(self.naviBackgroundColor)||CNLiveStringIsEmpty(self.naviNormalTitleColor)||CNLiveStringIsEmpty(self.naviSelectTitleColor)) {
  318 + return;
  319 + }
  320 + // 判断是否是电商中国
  321 + NSInteger selectedIndex = self.myCategoryView.selectedIndex>=self.dataArray.count?0:self.myCategoryView.selectedIndex;
  322 + NSString *dataStr = [self.dataArray safetyObjectAtIndex:selectedIndex];
  323 + NSMutableDictionary *dataDic = [[NSMutableDictionary alloc] initWithDictionary:CNLiveStringJsonToDictionary(dataStr)];
  324 + if ([[dataDic objectForKey:@"pageType"] integerValue] != 2) {//电商中国
  325 + return;
  326 + }
  327 + // 改变电商中国channels UI
  328 + self.myCategoryView.titleColor = CNLiveColorWithHexString(self.naviNormalTitleColor);
  329 + self.myCategoryView.titleSelectedColor = CNLiveColorWithHexString(self.naviSelectTitleColor);
  330 + self.topBgImg.backgroundColor = CNLiveColorWithHexString(self.naviBackgroundColor);
  331 + self.currentAtatusColor = [NSString stringWithFormat:@"%lu",(unsigned long)self.statusState];
  332 + [self setNeedsStatusBarAppearanceUpdate];
  333 +
  334 + // 改变数据
  335 + [self.textColors replaceObjectAtIndex:selectedIndex withObject:CNLiveColorWithHexString(self.naviNormalTitleColor)];
  336 + [self.textColorSeleteds replaceObjectAtIndex:selectedIndex withObject:CNLiveColorWithHexString(self.naviSelectTitleColor)];
  337 + [self.statusBarColors replaceObjectAtIndex:selectedIndex withObject:self.statusState==0 ? @"0" : @"1"];
  338 + [self.bgColors replaceObjectAtIndex:selectedIndex withObject:self.naviBackgroundColor];
  339 + self.isDSShopChanged = YES; //改变过
  340 +
  341 +}
196 342
  343 +// 电商中国可以下拉出地图页面 当下拉出地图页面时不可以左右滚动
  344 +- (void)PageControlScrollEnable:(NSNotification *)noti {
  345 + if (!self.findScrollView.isScrollEnabled) {
  346 + return;
  347 + }
  348 + BOOL scrollEnable = [noti.object boolValue];
  349 + NSLog(@"是否可滚动:%d",scrollEnable);
  350 + self.findScrollView.scrollEnabled = scrollEnable;
  351 +}
  352 +
  353 +- (void)touristsLoginTipsViewIsClassify:(NSNotification *)noti{
  354 + NSString *isClassify = noti.userInfo[@"isClassify"];
  355 + if([isClassify isEqualToString:@"close"]){
  356 + //隐藏TouristsLoginTipsView
  357 + [self.fuzzyView removeFromSuperview];
  358 +
  359 + }else if([isClassify isEqualToString:@"jump"]){
  360 + //进入频道管理页面
  361 + [self.fuzzyView removeFromSuperview];
  362 + [self customAction:self.customChannelsBtn];
  363 + }
  364 + [[NSNotificationCenter defaultCenter] removeObserver:self name:TouristloginTipsViewActionNotification object:nil];
  365 +}
197 #pragma mark - Action 366 #pragma mark - Action
198 // 点击定制频道按钮进入定制 367 // 点击定制频道按钮进入定制
199 - (void)customAction:(UIButton *)sender { 368 - (void)customAction:(UIButton *)sender {
@@ -219,10 +388,51 @@ static CGFloat moveHeight = 50; @@ -219,10 +388,51 @@ static CGFloat moveHeight = 50;
219 388
220 } 389 }
221 #pragma mark - Method 390 #pragma mark - Method
  391 +- (NSInteger)containsWithChannelId:(NSString *)channelId {
  392 + NSString *normalKey = [NSString stringWithFormat:@"%@_%@",NormalChannelArray,CNUserShareModel.uid];
  393 + NSMutableArray *channelArray = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:normalKey]];
  394 +
  395 + NSInteger i = 0;
  396 + for (NSString *str in channelArray) {
  397 + NSDictionary *dic = CNLiveStringJsonToDictionary(str);
  398 + CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
  399 + if ([model.id isEqualToString:channelId]) {
  400 + return i;
  401 + }
  402 + i++;
  403 + }
  404 + return -1;
  405 +}
  406 +- (BOOL)judgeShowGuide:(NSString *)guide {
  407 +
  408 + if (CNLiveStringIsEmpty(guide)) {
  409 + return NO;;
  410 + }
  411 + NSString *locaVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
  412 +
  413 + if ([locaVersion compare:guide options:NSNumericSearch]==NSOrderedAscending) {
  414 + //show
  415 + [BHConfig set:ChannelsShowGuide boolValue:YES];
  416 + [CNLiveClassifyJumpBridge showViewOrPushVCWithCurrentVC:self pushType:CNLiveClassifyJumpShowGuideView];
  417 + return YES;
  418 + } else {
  419 + return NO;
  420 + }
  421 +}
222 -(void)updateSelectColors:(NSInteger)index 422 -(void)updateSelectColors:(NSInteger)index
223 { 423 {
224 NSString *backgroundImage = [self.bgImages safetyObjectAtIndex:index]; 424 NSString *backgroundImage = [self.bgImages safetyObjectAtIndex:index];
225 - [self.topBgImg sd_setImageWithURL:[NSURL URLWithString:backgroundImage]]; 425 + weakself
  426 + [self.topBgImg sd_setImageWithURL:[NSURL URLWithString:backgroundImage] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
  427 + if (image) {
  428 + weakSelf.topBgImgHeight = KScreenWidth*image.size.height/image.size.width;
  429 + } else {
  430 + weakSelf.topBgImgHeight = kStatusHeight+100;
  431 + }
  432 + weakSelf.topBgImg.height = weakSelf.topBgImgHeight;
  433 + weakSelf.topBgImg.bottom = kStatusHeight+100;
  434 + weakSelf.myCategoryView.bottom = weakSelf.topBgImg.height-60;
  435 + }];
226 NSString *backgroundColor = [self.bgColors safetyObjectAtIndex:index]; 436 NSString *backgroundColor = [self.bgColors safetyObjectAtIndex:index];
227 self.topBgImg.backgroundColor = CNLiveColorWithHexString(backgroundColor); 437 self.topBgImg.backgroundColor = CNLiveColorWithHexString(backgroundColor);
228 self.myCategoryView.titleColor = self.textColors[index]; 438 self.myCategoryView.titleColor = self.textColors[index];
@@ -317,6 +527,9 @@ static CGFloat moveHeight = 50; @@ -317,6 +527,9 @@ static CGFloat moveHeight = 50;
317 527
318 } else { // 从未请求到过数据 528 } else { // 从未请求到过数据
319 if ([BHConfig boolValue:ChannelsRequested]&& first) { 529 if ([BHConfig boolValue:ChannelsRequested]&& first) {
  530 +
  531 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(classifyChannelsRequest:) name:CNWjjClassifyChannelsRequestStateNotifiName object:nil];
  532 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(classifyChannelsRequestedHideLoading:) name:CNWjjClassifyChannelsRequestHideLoadingNotifiName object:nil];
320 [QMUITips showLoadingInView:self.view]; 533 [QMUITips showLoadingInView:self.view];
321 self.isLoading = YES; 534 self.isLoading = YES;
322 return; 535 return;
@@ -426,6 +639,16 @@ static CGFloat moveHeight = 50; @@ -426,6 +639,16 @@ static CGFloat moveHeight = 50;
426 { 639 {
427 [self.statusBarColors addObject:@"1"]; 640 [self.statusBarColors addObject:@"1"];
428 } 641 }
  642 + if (!CNLiveStringIsEmpty(model.defaultPage) && [model.defaultPage isEqualToString:@"1"]) {
  643 + self.ld_currentIndex = [normalArray indexOfObject:dic];
  644 + }
  645 + if ([model.pageType isEqualToString:@"2"] && self.isDSShopChanged) {//是电商中国且刷新过颜色
  646 + NSInteger i = [normalArray indexOfObject:str];
  647 + [self.bgColors replaceObjectAtIndex:i withObject:self.naviBackgroundColor];
  648 + [self.statusBarColors replaceObjectAtIndex:i withObject:[NSString stringWithFormat:@"%lu",(unsigned long)self.statusState]];
  649 + [self.textColors replaceObjectAtIndex:i withObject:CNLiveColorWithHexString(self.naviNormalTitleColor)];
  650 + [self.textColorSeleteds replaceObjectAtIndex:i withObject:CNLiveColorWithHexString(self.naviSelectTitleColor)];
  651 + }
429 } 652 }
430 } 653 }
431 -(void)scrollViewUpDowm:(BOOL)isUp 654 -(void)scrollViewUpDowm:(BOOL)isUp
@@ -437,12 +660,6 @@ static CGFloat moveHeight = 50; @@ -437,12 +660,6 @@ static CGFloat moveHeight = 50;
437 { 660 {
438 [self scrollViewDown]; 661 [self scrollViewDown];
439 } 662 }
440 - if ([CNUserShareManager isLogin]) {  
441 - self.customChannelsBtn.centerY = self.myCategoryView.collectionView.centerY + kStatusHeight;  
442 - }else  
443 - {  
444 - self.loginBtn.centerY = self.myCategoryView.collectionView.centerY+kStatusHeight;  
445 - }  
446 }]; 663 }];
447 } 664 }
448 665
@@ -454,6 +671,12 @@ static CGFloat moveHeight = 50; @@ -454,6 +671,12 @@ static CGFloat moveHeight = 50;
454 self.topBgImg.top -= moveHeight; 671 self.topBgImg.top -= moveHeight;
455 self.myCategoryView.collectionView.top = -50-kStatusHeight; 672 self.myCategoryView.collectionView.top = -50-kStatusHeight;
456 self.pageViewController.view.top = kStatusHeight; 673 self.pageViewController.view.top = kStatusHeight;
  674 + if ([CNUserShareManager isLogin]) {
  675 + self.customChannelsBtn.centerY = self.myCategoryView.collectionView.centerY + kStatusHeight;
  676 + }else
  677 + {
  678 + self.loginBtn.centerY = self.myCategoryView.collectionView.centerY+kStatusHeight;
  679 + }
457 } 680 }
458 -(void)scrollViewDown{ 681 -(void)scrollViewDown{
459 if (self.topBgImg.top==0) { 682 if (self.topBgImg.top==0) {
@@ -463,7 +686,12 @@ static CGFloat moveHeight = 50; @@ -463,7 +686,12 @@ static CGFloat moveHeight = 50;
463 self.topBgImg.top += moveHeight; 686 self.topBgImg.top += moveHeight;
464 self.myCategoryView.collectionView.top = 0; 687 self.myCategoryView.collectionView.top = 0;
465 self.pageViewController.view.top = self.myCategoryView.bottom; 688 self.pageViewController.view.top = self.myCategoryView.bottom;
466 - 689 + if ([CNUserShareManager isLogin]) {
  690 + self.customChannelsBtn.centerY = self.myCategoryView.centerY;
  691 + }else
  692 + {
  693 + self.loginBtn.centerY = self.myCategoryView.centerY;
  694 + }
467 } 695 }
468 696
469 -(void)managerScrollView:(BOOL)enabled 697 -(void)managerScrollView:(BOOL)enabled
@@ -474,6 +702,33 @@ static CGFloat moveHeight = 50; @@ -474,6 +702,33 @@ static CGFloat moveHeight = 50;
474 [subVc layoutRightSubViewWithShow:!enabled]; 702 [subVc layoutRightSubViewWithShow:!enabled];
475 } 703 }
476 } 704 }
  705 +#pragma mark -
  706 +#pragma mark - CNSubClassifySegmentControllerDelegate
  707 +// 显示 目击者/监管/大众体育 首次使用引导页
  708 +- (void)showGuideShadeViewWithType:(NSInteger)type cellFrame:(CGRect)cellFrame {
  709 + if (type==1) {
  710 + [CNWitnessShadeManager showWitnessShadeViewWithTopImg:@"mjz" contentImg:@"mjz-new-text" topImgRect:CGRectMake(cellFrame.origin.x-10, cellFrame.origin.y+10, 75, 30) contentImgSize:CGSizeMake(199, 68) vc:self cancelBlock:^{
  711 + [BHConfig set:wjjIsShowWitnessShadeKey boolValue:nil];
  712 + if (![[NSUserDefaults standardUserDefaults] boolForKey:[NSString stringWithFormat:@"%@_%@",wjjIsShowSupervisionShadeKey,CNUserShareModelUid]]) {
  713 + [CNSupervisionGuideViewManager showSupervisionGuideViewWithVC:self];
  714 + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:[NSString stringWithFormat:@"%@_%@",wjjIsShowSupervisionShadeKey,CNUserShareModelUid]];
  715 + [[NSUserDefaults standardUserDefaults] synchronize];
  716 + }
  717 + }];
  718 + [BHConfig set:wjjIsShowWitnessShadeKey boolValue:YES];
  719 + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:[NSString stringWithFormat:@"%@_%@",wjjIsShowWitnessShadeKey,CNUserShareModelUid]];
  720 + [[NSUserDefaults standardUserDefaults] synchronize];
  721 + } else if(type==2) {
  722 + [CNWitnessShadeManager showWitnessShadeViewWithTopImg:@"dzty" contentImg:@"dzty-text" topImgRect:CGRectMake(cellFrame.origin.x-10, cellFrame.origin.y+10, 102, 30) contentImgSize:CGSizeMake(276, 129) vc:self cancelBlock:nil];
  723 + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:[NSString stringWithFormat:@"%@_%@",wjjIsShowSportShadeKey,CNUserShareModelUid]];
  724 + [[NSUserDefaults standardUserDefaults] synchronize];
  725 + } else if (type==3) {
  726 + [CNSupervisionGuideViewManager showSupervisionGuideViewWithVC:self];
  727 + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:[NSString stringWithFormat:@"%@_%@",wjjIsShowSupervisionShadeKey,CNUserShareModelUid]];
  728 + [[NSUserDefaults standardUserDefaults] synchronize];
  729 + }
  730 +}
  731 +
477 #pragma mark - CNCustomChannelListViewDelegate !!!!!!!!!!!!!!!!!!!!!! 732 #pragma mark - CNCustomChannelListViewDelegate !!!!!!!!!!!!!!!!!!!!!!
478 - (void)changeChannelsList 733 - (void)changeChannelsList
479 { 734 {
@@ -493,7 +748,43 @@ static CGFloat moveHeight = 50; @@ -493,7 +748,43 @@ static CGFloat moveHeight = 50;
493 - (void)pushToControllerWithIndex:(NSInteger)index 748 - (void)pushToControllerWithIndex:(NSInteger)index
494 { 749 {
495 // 跳到其他频道的对应页面 750 // 跳到其他频道的对应页面
496 -// [self goToOtherChannelViewControllerWithIndex:index]; 751 + NSString *otherKey = [NSString stringWithFormat:@"%@_%@",OtherChannelArray,CNUserShareModel.uid];
  752 + NSArray *otherArray = [[NSUserDefaults standardUserDefaults] objectForKey:otherKey];
  753 + NSString *dataStr = [otherArray safetyObjectAtIndex:index];
  754 + NSDictionary *dic = CNLiveStringJsonToDictionary(dataStr);
  755 + CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
  756 + NSDictionary *paramDic = nil;
  757 + if (model.pageStyleList.count>0) {
  758 + paramDic = @{
  759 + @"showName":model.showName?model.showName:@"",
  760 + @"backgroundColor":model.backgroundColor?model.backgroundColor:@""
  761 + };
  762 + }else if([model.pageType isEqualToString:@"4"] || [model.pageType isEqualToString:@"5"]){
  763 + paramDic= @{
  764 + @"bgColor": model.backgroundColor?model.backgroundColor:@"",
  765 + @"channelId":model.channelId?model.channelId:@"",
  766 + @"channelName":model.id?model.id:@"",
  767 + @"pageId":model.pageId?model.pageId:@"",
  768 + };
  769 + }else if ([model.pageType isEqualToString:@"2"]) {//电商中国
  770 + paramDic = @{
  771 + @"showName":model.showName?model.showName:@""
  772 + };
  773 + }else
  774 + {
  775 + BOOL isBlack = NO;
  776 + if (CNLiveStringIsEmpty(model.statusBarColor)) {
  777 + isBlack = YES;
  778 + } else {
  779 + isBlack = [model.statusBarColor boolValue];//1 黑色
  780 + }
  781 + paramDic= @{
  782 + @"title": model.showName?model.showName:@"",
  783 + @"isBlack":@(isBlack),
  784 + @"thirdUrl":model.thirdUrl?model.thirdUrl:@""
  785 + };
  786 + }
  787 + [CNLiveClassifyJumpBridge showViewOrPushVCWithCurrentVC:self pushType:CNLiveClassifyJumpPushCustomVC pageType:model.pageType.integerValue param:paramDic];
497 } 788 }
498 789
499 - (void)closeCustomChannelsView { 790 - (void)closeCustomChannelsView {
@@ -533,7 +824,46 @@ static CGFloat moveHeight = 50; @@ -533,7 +824,46 @@ static CGFloat moveHeight = 50;
533 self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0); 824 self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0);
534 [self updateSelectColors:index]; 825 [self updateSelectColors:index];
535 [self configCategoryViewWithType:JXCategoryTitleImageType_OnlyImage selectIndex:index unselectIndex:index]; 826 [self configCategoryViewWithType:JXCategoryTitleImageType_OnlyImage selectIndex:index unselectIndex:index];
536 - 827 + CNCategoryGetChannelModel *model = (CNCategoryGetChannelModel *)[self.dataArray safetyObjectAtIndex:index];
  828 + if (![CNUserShareManager isLogin]) {
  829 + [BHConfig set:ChannelsSelectFirst value:model.id];
  830 + }
  831 + if (model.pageStyleList.count>0) {
  832 + CNLiveSubSegmentController *subVC = (CNLiveSubSegmentController *)self.controllersArr[index];
  833 + if (subVC && [subVC respondsToSelector:@selector(refreshCurrentVCData)]) {
  834 + [subVC refreshCurrentVCData];
  835 + }
  836 + BOOL witness = ![[NSUserDefaults standardUserDefaults] boolForKey:[NSString stringWithFormat:@"%@_%@",wjjIsShowWitnessShadeKey,CNUserShareModelUid]];
  837 + BOOL sport = ![[NSUserDefaults standardUserDefaults] boolForKey:[NSString stringWithFormat:@"%@_%@",wjjIsShowSportShadeKey,CNUserShareModelUid]];
  838 + BOOL supervision = ![[NSUserDefaults standardUserDefaults] boolForKey:[NSString stringWithFormat:@"%@_%@",wjjIsShowSupervisionShadeKey,CNUserShareModelUid]];
  839 + if (!self.contentLogin && (witness || sport || supervision) && [CNUserShareManager isLogin]) {
  840 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  841 + [subVC showGuideView];
  842 + });
  843 + }
  844 + self.contentLogin = NO;
  845 + }else{
  846 + NSDictionary *paramDic = nil;
  847 + if ([model.pageType isEqualToString:@"4"] || [model.pageType isEqualToString:@"5"]){
  848 + paramDic= @{
  849 + @"bgColor": model.backgroundColor?model.backgroundColor:@"",
  850 + @"backgroundImg": model.backgroundImg?model.backgroundImg:@"",
  851 + @"channelId":model.channelId?model.channelId:@"",
  852 + @"channelName":model.id?model.id:@"",
  853 + @"pageId":model.pageId?model.pageId:@"",
  854 + };
  855 + }
  856 + NSTimeInterval time = 300;
  857 + if ([model.id isEqualToString:@"1"]) {
  858 + time = 60;
  859 + }
  860 + [CNLiveClassifyJumpBridge listViewRefreshWithVC:self.controllersArr[index] pageType:model.pageType.integerValue param:paramDic refreshTime:time];
  861 + }
  862 + if (index != self.myCategoryView.selectedIndex) {
  863 + [[NSNotificationCenter defaultCenter] postNotificationName:WjjH5StopVideoPlayerNotification object:nil];
  864 + [[NSNotificationCenter defaultCenter] postNotificationName:kDSHappinessPageControlScrollEnableNotification object:@(YES)];
  865 + }
  866 +// [MobClick event:@"channel_click_top"];
537 } 867 }
538 #pragma mark - Public 868 #pragma mark - Public
539 -(JXCategoryBaseView *)preferredCategoryView 869 -(JXCategoryBaseView *)preferredCategoryView
CNLiveVideoClassifyKit/Classes/Controller/CNLiveSubSegmentController.h
@@ -9,10 +9,18 @@ @@ -9,10 +9,18 @@
9 @class CNCategoryGetChannelModel; 9 @class CNCategoryGetChannelModel;
10 10
11 NS_ASSUME_NONNULL_BEGIN 11 NS_ASSUME_NONNULL_BEGIN
  12 +@protocol CNSubClassifySegmentControllerDelegate <NSObject>
  13 +// 1/2/3 目击者/大众体/监管
  14 +- (void)showGuideShadeViewWithType:(NSInteger)type cellFrame:(CGRect)cellFrame;
  15 +
  16 +@end
  17 +
12 18
13 @interface CNLiveSubSegmentController : CNCategoryBaseViewController 19 @interface CNLiveSubSegmentController : CNCategoryBaseViewController
14 20
15 @property (nonatomic, assign) BOOL isBlack; 21 @property (nonatomic, assign) BOOL isBlack;
  22 +@property (nonatomic, assign) NSInteger selectChannelId;
  23 +@property (nonatomic, weak) id <CNSubClassifySegmentControllerDelegate>delegate;
16 24
17 -(instancetype)initWithModel:(CNCategoryGetChannelModel *)model; 25 -(instancetype)initWithModel:(CNCategoryGetChannelModel *)model;
18 @property (nonatomic, copy) void (^scrollViewDidScrollBlock)(BOOL isUp); 26 @property (nonatomic, copy) void (^scrollViewDidScrollBlock)(BOOL isUp);
@@ -20,6 +28,9 @@ NS_ASSUME_NONNULL_BEGIN @@ -20,6 +28,9 @@ NS_ASSUME_NONNULL_BEGIN
20 // 一级频道显示隐藏时二级频道右侧的搜索按钮变宽变窄控制 28 // 一级频道显示隐藏时二级频道右侧的搜索按钮变宽变窄控制
21 - (void)layoutRightSubViewWithShow:(BOOL)show; 29 - (void)layoutRightSubViewWithShow:(BOOL)show;
22 30
  31 +- (void)refreshCurrentVCData;
  32 +- (void)showGuideView;
  33 +
23 @end 34 @end
24 35
25 NS_ASSUME_NONNULL_END 36 NS_ASSUME_NONNULL_END
CNLiveVideoClassifyKit/Classes/Controller/CNLiveSubSegmentController.m
@@ -7,25 +7,36 @@ @@ -7,25 +7,36 @@
7 7
8 #import "CNLiveSubSegmentController.h" 8 #import "CNLiveSubSegmentController.h"
9 #import "CNCategoryGetChannelModel.h" 9 #import "CNCategoryGetChannelModel.h"
  10 +#import "CNAudioPlayProgressView.h"
10 #import "CNLiveListManager.h" 11 #import "CNLiveListManager.h"
11 12
12 @interface CNLiveSubSegmentController () 13 @interface CNLiveSubSegmentController ()
13 @property (nonatomic, strong)JXCategoryTitleView *myCategoryView; 14 @property (nonatomic, strong)JXCategoryTitleView *myCategoryView;
14 @property (nonatomic, strong) QMUIButton *searchBtn; 15 @property (nonatomic, strong) QMUIButton *searchBtn;
  16 +@property (nonatomic, strong) UIButton *moreBtn;
  17 +@property (nonatomic, strong) UIImageView *bgImgView;//背景图
  18 +@property (nonatomic, strong) CNAudioPlayProgressView *progressView;//听见中国二级频道当前播放音乐的进度
  19 +@property (nonatomic, strong) UIButton *playingBtn;//听见中国二级频道当前播放音乐按钮
  20 +@property (nonatomic, strong) UIImageView *playingImgV;//听见中国二级频道当前播放音乐背景图
  21 +@property (nonatomic, strong) UIImageView *playTipImgV;//听见中国二级频道当前播放tip
  22 +@property (nonatomic, strong) UIButton *historyBtn;//历史记录
  23 +@property (nonatomic, strong) UIButton *downloadingBtn;//听见中国下载按钮
  24 +
15 25
16 @property (nonatomic, strong)NSArray<CNCategoryGetChannelModel*> *pageListArr; 26 @property (nonatomic, strong)NSArray<CNCategoryGetChannelModel*> *pageListArr;
17 @property (nonatomic, strong)UIColor *textColor; 27 @property (nonatomic, strong)UIColor *textColor;
18 @property (nonatomic, strong)NSString *backgroundColor; 28 @property (nonatomic, strong)NSString *backgroundColor;
19 @property (nonatomic, strong)NSString *backImage; 29 @property (nonatomic, strong)NSString *backImage;
20 @property (nonatomic, strong)NSString *backImageH5; 30 @property (nonatomic, strong)NSString *backImageH5;
  31 +@property (nonatomic, strong)NSString *channelId;
21 32
22 33
23 @end 34 @end
24 35
25 @implementation CNLiveSubSegmentController 36 @implementation CNLiveSubSegmentController
26 --(void)dealloc  
27 -{  
28 - 37 +- (void)dealloc {
  38 + [[NSNotificationCenter defaultCenter] removeObserver:self];
  39 +
29 } 40 }
30 -(instancetype)initWithModel:(CNCategoryGetChannelModel *)model 41 -(instancetype)initWithModel:(CNCategoryGetChannelModel *)model
31 { 42 {
@@ -46,13 +57,41 @@ @@ -46,13 +57,41 @@
46 } 57 }
47 self.backImageH5 = model.backgroundImgH5; 58 self.backImageH5 = model.backgroundImgH5;
48 self.backImage = model.backgroundImg; 59 self.backImage = model.backgroundImg;
  60 + self.channelId = model.id;
49 61
  62 + self.ld_currentIndex = 0;
  63 + self.selectChannelId = -1;
50 } 64 }
51 return self; 65 return self;
52 } 66 }
53 67
54 - (void)viewDidLoad { 68 - (void)viewDidLoad {
55 [super viewDidLoad]; 69 [super viewDidLoad];
  70 +
  71 + if (!CNLiveStringIsEmpty(self.backImageH5)) {
  72 + // 如果后台传了背景图 就设置背景图
  73 + [self.view addSubview:self.bgImgView];
  74 + [self.view sendSubviewToBack:self.bgImgView];
  75 + weakself
  76 + [self.bgImgView sd_setImageWithURL:[NSURL URLWithString:self.backImageH5] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
  77 + if (image) {
  78 + weakSelf.bgImgView.height = KScreenWidth*image.size.height/image.size.width;
  79 + }
  80 + }];
  81 + }
  82 + if (self.selectChannelId != -1) {
  83 + NSString *classifyId = [BHConfig get:ChannelsSelectSecond];
  84 + [BHConfig set:ChannelsSelectSecond value:nil];
  85 + if (!CNLiveStringIsEmpty(classifyId)) {
  86 + NSInteger selectChannelId = [self containsWithChannelIndex:self.selectChannelId classifyId:classifyId];
  87 + if(selectChannelId == -1){
  88 + //我的频道中没有这个频道
  89 + } else {
  90 + self.myCategoryView.defaultSelectedIndex = selectChannelId;
  91 + self.ld_currentIndex = selectChannelId;
  92 + }
  93 + }
  94 + }
56 [self handleDateWithChannelsArray]; 95 [self handleDateWithChannelsArray];
57 // 添加二级频道右侧的搜索按钮 96 // 添加二级频道右侧的搜索按钮
58 [self.view addSubview:self.searchBtn]; 97 [self.view addSubview:self.searchBtn];
@@ -86,24 +125,166 @@ @@ -86,24 +125,166 @@
86 [self.controllersArr addObject:listVC]; 125 [self.controllersArr addObject:listVC];
87 } 126 }
88 [self addTheFirstPage]; 127 [self addTheFirstPage];
  128 +
  129 + if ([self.channelId isEqualToString:@"219"]) {
  130 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updatePlayingStatus:) name:WjjAudioPlayerStatusNotification object:nil];
  131 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updatePlayingSchedule:) name:WjjAudioPlayerScheduleNotification object:nil];
  132 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioPlayFinishedUpdateSchedule:) name:WjjAudioPlayDidFinishNotification object:nil];
  133 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioPlayUpdateInfo:) name:WjjAudioPlayerWhichPlayingNotification object:nil];
  134 +
  135 + [self.view addSubview:self.moreBtn];
  136 + [self.view addSubview:self.progressView];
  137 + [self.progressView addSubview:self.playingImgV];
  138 + [self.playingImgV addSubview:self.playTipImgV];
  139 + [self.progressView addSubview:self.playingBtn];
  140 + YYCache * yyCache = [YYCache cacheWithName:[NSString stringWithFormat:@"CNLastPlayedAudio_%@",CNUserShareModel.uid]];
  141 + CNLiveAlbumAudioListModel *model = (CNLiveAlbumAudioListModel *)[yyCache objectForKey:[NSString stringWithFormat:@"%@_%@",wjjLastAudioInfoSaveKey,CNUserShareModel.uid]];
  142 + if (model) {
  143 + if (model && !CNLiveStringIsEmpty(model.activityId)) {
  144 + self.playingBtn.userInteractionEnabled = YES;
  145 + self.progressView.hidden = NO;
  146 + } else {
  147 + self.playingBtn.userInteractionEnabled = NO;
  148 + self.progressView.hidden = YES;
  149 + }
  150 + if (model && (!CNLiveStringIsEmpty(model.img) || !CNLiveStringIsEmpty(model.poster) || !CNLiveStringIsEmpty(model.albumImg)) ) {
  151 + [self.playingImgV sd_setImageWithURL:[NSURL URLWithString:model.img?[model.img stringByRemovingPercentEncoding]:(model.poster?[model.poster stringByRemovingPercentEncoding]:[model.albumImg stringByRemovingPercentEncoding])] placeholderImage:[UIImage loadBundleImage:@""]];
  152 + } else {
  153 + self.playingImgV.image = nil;
  154 + }
  155 +
  156 + if ([CNLiveClassifyJumpBridge audioPlayerIsplaying]) {
  157 + self.playTipImgV.hidden = YES;
  158 + [self playingStartAnimating];
  159 + } else {
  160 + self.playTipImgV.hidden = NO;
  161 + [self playingStopAnimating];
  162 + }
  163 + }
  164 + }else if ([self.channelId isEqualToString:@"11"]) {
  165 + // 美食中国 历史记录
  166 + [self.view addSubview:self.historyBtn];
  167 + }
89 // Do any additional setup after loading the view. 168 // Do any additional setup after loading the view.
90 } 169 }
91 -(void)viewDidLayoutSubviews 170 -(void)viewDidLayoutSubviews
92 { 171 {
93 [super viewDidLayoutSubviews]; 172 [super viewDidLayoutSubviews];
94 - self.searchBtn.right = KScreenWidth-12;  
95 - self.searchBtn.centerY = self.myCategoryView.height/2;  
96 self.myCategoryView.top = 0; 173 self.myCategoryView.top = 0;
97 - self.myCategoryView.width = self.searchBtn.left;  
98 self.pageViewController.view.frame = CGRectMake(0, self.myCategoryView.bottom+10, kScreenWidth, self.view.bounds.size.height - self.myCategoryView.bottom); 174 self.pageViewController.view.frame = CGRectMake(0, self.myCategoryView.bottom+10, kScreenWidth, self.view.bounds.size.height - self.myCategoryView.bottom);
  175 + self.searchBtn.right = KScreenWidth-12;
  176 + CGFloat width = self.searchBtn.left;
  177 + self.searchBtn.centerY = self.myCategoryView.height/2;
  178 + if ([self.channelId isEqualToString:@"219"]) {
  179 + self.moreBtn.right = KScreenWidth-12-66-15;
  180 + self.moreBtn.centerY = self.myCategoryView.height/2;
  181 + self.progressView.right = KScreenWidth-93-18-15;
  182 + self.progressView.centerY = self.myCategoryView.height/2;
  183 + width = self.progressView.left;
  184 + }else if ([self.channelId isEqualToString:@"11"]){
  185 + self.historyBtn.right = KScreenWidth-93;
  186 + self.historyBtn.centerY = self.myCategoryView.height/2;
  187 + width = self.historyBtn.left;
  188 + }
  189 + self.myCategoryView.width = width;
  190 +}
  191 +#pragma mark - Notification
  192 +- (void)updatePlayingStatus:(NSNotification *)notifi {
  193 +
  194 + NSInteger status = [[notifi.userInfo objectForKey:@"Status"] integerValue];//1播放 0暂停
  195 + if (status == 1) {
  196 + self.playTipImgV.hidden = YES;
  197 + [self playingStartAnimating];
  198 + }else {
  199 + self.playTipImgV.hidden = NO;
  200 + [self playingStopAnimating];
  201 + }
  202 +}
  203 +- (void)updatePlayingSchedule:(NSNotification *)notifi {
  204 +
  205 + NSDictionary *dic = notifi.userInfo;
  206 + [self.progressView animationWithProgres:[[dic objectForKey:@"schedule"] floatValue] duration:0.8];
  207 +}
  208 +// 通知方法 更新当前播放音乐完成时的进度
  209 +- (void)audioPlayFinishedUpdateSchedule:(NSNotification *)notifi {
  210 +
  211 + [self.progressView animationWithProgres:0.0f duration:0.0f];
  212 +}
  213 +// 通知方法 切换音乐时的显示
  214 +- (void)audioPlayUpdateInfo:(NSNotification *)notifi {
  215 +
  216 + CNLiveAlbumAudioListModel *model = notifi.object;
  217 + if (model && !CNLiveStringIsEmpty(model.activityId)) {
  218 + self.playingBtn.userInteractionEnabled = YES;
  219 + self.progressView.hidden = NO;
  220 + } else {
  221 + self.playingBtn.userInteractionEnabled = NO;
  222 + self.progressView.hidden = YES;
  223 + }
  224 + if (model && (!CNLiveStringIsEmpty(model.img) || !CNLiveStringIsEmpty(model.poster) || !CNLiveStringIsEmpty(model.albumImg)) ) {
  225 + [self.playingImgV sd_setImageWithURL:[NSURL URLWithString:model.img?[model.img stringByRemovingPercentEncoding]:(model.poster?[model.poster stringByRemovingPercentEncoding]:[model.albumImg stringByRemovingPercentEncoding])] placeholderImage:[UIImage loadBundleImage:@""]];
  226 + } else {
  227 + self.playingImgV.image = nil;
  228 + }
99 } 229 }
100 #pragma mark - Method 230 #pragma mark - Method
  231 +
  232 +// 开始当前播放音乐转动动画
  233 +- (void)playingStartAnimating {
  234 +
  235 + CABasicAnimation *rotationAnimation;
  236 + rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
  237 + rotationAnimation.fromValue = @0;
  238 + rotationAnimation.toValue = @(M_PI * 2);
  239 + rotationAnimation.duration = 5.0;
  240 + rotationAnimation.repeatCount = HUGE;
  241 + rotationAnimation.removedOnCompletion = NO;
  242 + [self.playingImgV.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
  243 +
  244 +}
  245 +// 停止当前播放音乐转动动画
  246 +- (void)playingStopAnimating {
  247 +
  248 + [self.playingImgV.layer removeAllAnimations];//停止动画
  249 +}
  250 +// 判断我的频道中是否包含参数中的一级频道中的二级频道(偏移前的判断)
  251 +- (NSInteger)containsWithChannelIndex:(NSInteger)index classifyId:(NSString *)classifyId {
  252 + NSString *normalKey = [NSString stringWithFormat:@"%@_%@",NormalChannelArray,CNUserShareModel.uid];
  253 + NSMutableArray *channelArray = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:normalKey]];
  254 + NSInteger i = 0;
  255 +
  256 + if(channelArray.count > index){
  257 + NSString *modelStr = channelArray[index];
  258 + NSDictionary *dic = CNLiveStringJsonToDictionary(modelStr);
  259 + CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
  260 + for (CNCategoryGetChannelModel *subModel in model.pageStyleList) {
  261 + if ([subModel.id isEqualToString:classifyId]) {
  262 + return i;
  263 + }
  264 + if (CNLiveStringIsEmpty(subModel.pageType)) {
  265 + continue;
  266 + }else{
  267 + i++;
  268 + }
  269 + }
  270 + }
  271 + return -1;
  272 +
  273 +}
101 -(void)handleDateWithChannelsArray{ 274 -(void)handleDateWithChannelsArray{
102 [self.titles removeAllObjects]; 275 [self.titles removeAllObjects];
103 - 276 + NSMutableArray *array = [NSMutableArray array];
104 for (CNCategoryGetChannelModel *model in self.pageListArr) { 277 for (CNCategoryGetChannelModel *model in self.pageListArr) {
105 - [self.titles addObject:model.name]; 278 + if (!CNLiveStringIsEmpty(model.showName) && !CNLiveStringIsEmpty(model.pageType)) {
  279 + [self.titles addObject:model.name];
  280 + [array addObject:model];
  281 + if (!CNLiveStringIsEmpty(model.defaultPage) && [model.defaultPage isEqualToString:@"1"]) {
  282 + self.myCategoryView.defaultSelectedIndex = [self.pageListArr indexOfObject:model];
  283 + self.ld_currentIndex = [self.pageListArr indexOfObject:model];
  284 + }
  285 + }
106 } 286 }
  287 + self.pageListArr = array.copy;
107 } 288 }
108 // 一级频道显示隐藏时二级频道右侧的搜索按钮变宽变窄控制 289 // 一级频道显示隐藏时二级频道右侧的搜索按钮变宽变窄控制
109 - (void)layoutRightSubViewWithShow:(BOOL)show { 290 - (void)layoutRightSubViewWithShow:(BOOL)show {
@@ -114,15 +295,17 @@ @@ -114,15 +295,17 @@
114 self.searchBtn.width = 66; 295 self.searchBtn.width = 66;
115 self.searchBtn.right = KScreenWidth-12; 296 self.searchBtn.right = KScreenWidth-12;
116 [self.searchBtn setTitle:@"搜索" forState:UIControlStateNormal]; 297 [self.searchBtn setTitle:@"搜索" forState:UIControlStateNormal];
  298 + CGFloat width = self.searchBtn.left;
  299 + if ([self.channelId isEqualToString:@"219"]) {
  300 + self.moreBtn.right = KScreenWidth-12-66-15;
  301 + self.progressView.right = KScreenWidth-93-18-15;
  302 + width = self.progressView.left;
  303 + } else if ([self.channelId isEqualToString:@"11"]) {
  304 + self.historyBtn.right = KScreenWidth-93;
  305 + width = self.historyBtn.left;
  306 + }
117 307
118 -// if ([self.channelModel.id isEqualToString:@"219"]) {  
119 -// self.moreBtn.right = KScreenWidth-12-66-15;  
120 -// self.progressView.right = KScreenWidth-93-18-15;  
121 -// } else if ([self.channelModel.id isEqualToString:@"11"]) {  
122 -// self.historyBtn.right = KScreenWidth-93;  
123 -// }  
124 -  
125 - self.myCategoryView.width = self.searchBtn.left; 308 + self.myCategoryView.width = width;
126 } else { 309 } else {
127 // 变窄 310 // 变窄
128 311
@@ -130,16 +313,167 @@ @@ -130,16 +313,167 @@
130 self.searchBtn.right = KScreenWidth-12; 313 self.searchBtn.right = KScreenWidth-12;
131 [self.searchBtn setTitle:nil forState:UIControlStateNormal]; 314 [self.searchBtn setTitle:nil forState:UIControlStateNormal];
132 315
133 -// if ([self.channelModel.id isEqualToString:@"219"]) {  
134 -// self.moreBtn.right = KScreenWidth-12-66-15+30;  
135 -// self.progressView.right = KScreenWidth-93-18-15+30;  
136 -// } else if ([self.channelModel.id isEqualToString:@"11"]) {  
137 -// self.historyBtn.right = KScreenWidth-93+30;  
138 -// } 316 + if ([self.channelId isEqualToString:@"219"]) {
  317 + self.moreBtn.right = KScreenWidth-12-66-15+30;
  318 + self.progressView.right = KScreenWidth-93-18-15+30;
  319 + } else if ([self.channelId isEqualToString:@"11"]) {
  320 + self.historyBtn.right = KScreenWidth-93+30;
  321 + }
139 self.myCategoryView.width = self.searchBtn.left; 322 self.myCategoryView.width = self.searchBtn.left;
140 } 323 }
141 } 324 }
142 325
  326 +-(void)refreshCurrentVCData
  327 +{
  328 + weakself
  329 + [self.bgImgView sd_setImageWithURL:[NSURL URLWithString:self.backImageH5] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
  330 + if (image) {
  331 + weakSelf.bgImgView.height = KScreenWidth*image.size.height/image.size.width;
  332 + }
  333 + }];
  334 + CNCategoryGetChannelModel *model = (CNCategoryGetChannelModel *)[self.pageListArr safetyObjectAtIndex:self.ld_currentIndex];
  335 + if (![CNUserShareManager isLogin]) {
  336 + [BHConfig set:ChannelsSelectSecond value:self.channelId];
  337 + }
  338 + NSDictionary *paramDic = nil;
  339 + if ([model.pageType isEqualToString:@"4"] || [model.pageType isEqualToString:@"5"]){
  340 + paramDic= @{
  341 + @"bgColor": model.backgroundColor?model.backgroundColor:@"",
  342 + @"backgroundImg": model.backgroundImg?model.backgroundImg:@"",
  343 + @"channelId":model.channelId?model.channelId:@"",
  344 + @"channelName":model.id?model.id:@"",
  345 + @"pageId":model.pageId?model.pageId:@"",
  346 + };
  347 + }
  348 + NSTimeInterval time = 300;
  349 + if ([model.id isEqualToString:@"1"]) {
  350 + time = 60;
  351 + }
  352 + [CNLiveClassifyJumpBridge listViewRefreshWithVC:self.controllersArr[self.ld_currentIndex] pageType:model.pageType.integerValue param:paramDic refreshTime:time];
  353 +}
  354 +-(void)showGuideView
  355 +{
  356 + if (![CNUserShareManager isLogin] || [BHConfig boolValue:wjjIsShowWitnessShadeKey]) {
  357 + return;
  358 + }
  359 + CNCategoryGetChannelModel *model = (CNCategoryGetChannelModel *)[self.pageListArr safetyObjectAtIndex:self.ld_currentIndex];
  360 + if (![[NSUserDefaults standardUserDefaults] boolForKey:[NSString stringWithFormat:@"%@_%@",wjjIsShowWitnessShadeKey,CNUserShareModelUid]]) {
  361 + [self showWitnessShadeViewWithModel:model];
  362 + } else if (![[NSUserDefaults standardUserDefaults] boolForKey:[NSString stringWithFormat:@"%@_%@",wjjIsShowSupervisionShadeKey,CNUserShareModelUid]]) {
  363 + [self showSupervisionViewWithModel:model];
  364 + }
  365 + if (![[NSUserDefaults standardUserDefaults] boolForKey:[NSString stringWithFormat:@"%@_%@",wjjIsShowSportShadeKey,CNUserShareModelUid]]) {
  366 + [self showSportShadeViewWithModel:model];
  367 + }
  368 +
  369 +}
  370 +- (void)showWitnessShadeViewWithModel:(CNCategoryGetChannelModel *)model {
  371 + if (![CNUserShareManager isLogin]) {
  372 + return;
  373 + }
  374 + if (model && [model.id isEqualToString:@"101"]) {
  375 +
  376 + UICollectionViewLayoutAttributes * att = [self.myCategoryView.collectionView layoutAttributesForItemAtIndexPath:[NSIndexPath indexPathForRow:self.ld_currentIndex inSection:0]];
  377 + CGRect cellRect = att.frame;
  378 + CGRect cellFrame = [self.myCategoryView.collectionView convertRect:cellRect toView:AppKeyWindow];
  379 +
  380 + if (self.delegate && [self.delegate respondsToSelector:@selector(showGuideShadeViewWithType:cellFrame:)]) {
  381 + [self.delegate showGuideShadeViewWithType:1 cellFrame:cellFrame];
  382 + }
  383 + }
  384 +
  385 +}
  386 +// 显示目击者中监管首次显示引导图
  387 +- (void)showSupervisionViewWithModel:(CNCategoryGetChannelModel *)model {
  388 +
  389 + if (![CNUserShareManager isLogin]) {
  390 + return;
  391 + }
  392 + if (model && [model.id isEqualToString:@"101"]) {
  393 + if (self.delegate && [self.delegate respondsToSelector:@selector(showGuideShadeViewWithType:cellFrame:)]) {
  394 + [self.delegate showGuideShadeViewWithType:3 cellFrame:CGRectZero];
  395 + }
  396 + }
  397 +
  398 +}
  399 +// 显示大众体育首次使用引导图
  400 +- (void)showSportShadeViewWithModel:(CNCategoryGetChannelModel *)model {
  401 + if (![CNUserShareManager isLogin]) {
  402 + return;
  403 + }
  404 + if (model && ([model.id isEqualToString:@"223"] || [model.id isEqualToString:@"801"])) {//大众体育
  405 +
  406 + UICollectionViewLayoutAttributes * att = [self.myCategoryView.collectionView layoutAttributesForItemAtIndexPath:[NSIndexPath indexPathForRow:self.ld_currentIndex inSection:0]];
  407 + CGRect cellRect = att.frame;
  408 + CGRect cellFrame = [self.myCategoryView.collectionView convertRect:cellRect toView:AppKeyWindow];
  409 +
  410 + if (self.delegate && [self.delegate respondsToSelector:@selector(showGuideShadeViewWithType:cellFrame:)]) {
  411 + [self.delegate showGuideShadeViewWithType:2 cellFrame:cellFrame];
  412 + }
  413 + }
  414 +}
  415 +#pragma mark - Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  416 +#pragma mark - TODO 正在播放
  417 +- (void)playingAction:(UIButton *)sender {
  418 +
  419 + YYCache * yyCache = [YYCache cacheWithName:[NSString stringWithFormat:@"CNLastPlayedAudio_%@",CNUserShareModel.uid]];
  420 + CNLiveAlbumAudioListModel *model = (CNLiveAlbumAudioListModel *)[yyCache objectForKey:[NSString stringWithFormat:@"%@_%@",wjjLastAudioInfoSaveKey,CNUserShareModel.uid]];
  421 + if (model && model.activityId) {
  422 + [CNLiveClassifyJumpBridge showViewOrPushVCWithCurrentVC:self pushType:CNLiveClassifyJumpPushAudioPlayerVC];
  423 + }
  424 +
  425 +}
  426 +#pragma mark - TODO 历史
  427 +- (void)historyAction:(UIButton *)sender {
  428 + if (![CNUserShareManager isLogin]) {
  429 + [BHConfig set:LoginPrepositionUrl value:@""];
  430 + [CNLiveClassifyJumpBridge showViewOrPushVCWithCurrentVC:self pushType:CNLiveClassifyJumpPushLoginVC];
  431 + return;
  432 + }
  433 + if ([self.channelId isEqualToString:@"11"]){
  434 + //美食中国历史
  435 + [CNLiveClassifyJumpBridge showViewOrPushVCWithCurrentVC:self pushType:CNLiveClassifyJumpPushHistoryVC];
  436 +
  437 + }else if ([self.channelId isEqualToString:@"219"]) {
  438 + [CNLiveClassifyJumpBridge showViewOrPushVCWithCurrentVC:self pushType:CNLiveClassifyJumpPushRecordVC];
  439 + }
  440 +}
  441 +#pragma mark - TODO 下载中...
  442 +- (void)loadingAction:(UIButton *)sender {
  443 + [CNLiveClassifyJumpBridge showViewOrPushVCWithCurrentVC:self pushType:CNLiveClassifyJumpPushDownloadVC];
  444 +}
  445 +#pragma mark - TODO 搜索
  446 +- (void)searchAction:(UIButton *)sender {
  447 +// [MobClick event:@"channel_click_search"];
  448 + [CNLiveClassifyJumpBridge showViewOrPushVCWithCurrentVC:self pushType:CNLiveClassifyJumpPushSearchVC];
  449 +}
  450 +
  451 +#pragma mark - TODO 听见中国-更多
  452 +- (void)moreAction:(UIButton *)sender event:(UIEvent *)event{
  453 + if (![CNUserShareManager isLogin]) {
  454 + [BHConfig set:LoginPrepositionUrl value:@""];
  455 + [CNLiveClassifyJumpBridge showViewOrPushVCWithCurrentVC:self pushType:CNLiveClassifyJumpPushLoginVC];
  456 + return;
  457 + }
  458 + [CNLiveClassifyJumpBridge popOverShowEvent:event imageDone:^(NSInteger selectIndex) {
  459 + if (selectIndex == 0) {
  460 + // 下载中
  461 + [self loadingAction:self.downloadingBtn];
  462 + } else if (selectIndex == 1) {
  463 + // 历史记录
  464 + [self historyAction:self.historyBtn];
  465 + } else if (selectIndex == 2) {
  466 + // 我的设备
  467 +
  468 +#pragma mark - TODO:皮肤测试
  469 + [CNLiveClassifyJumpBridge showViewOrPushVCWithCurrentVC:self pushType:CNLiveClassifyJumpPushAddDiviceVC];
  470 +
  471 + }
  472 + } dismissBlock:^{
  473 + NSLog(@"dismiss");
  474 + }];
  475 +
  476 +}
143 #pragma mark - Public 477 #pragma mark - Public
144 -(JXCategoryTitleView *)preferredCategoryView{ 478 -(JXCategoryTitleView *)preferredCategoryView{
145 return [[JXCategoryTitleView alloc] init]; 479 return [[JXCategoryTitleView alloc] init];
@@ -157,16 +491,109 @@ @@ -157,16 +491,109 @@
157 [self.pageViewController setViewControllers:@[vc] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:NULL]; 491 [self.pageViewController setViewControllers:@[vc] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:NULL];
158 }else 492 }else
159 { 493 {
  494 + self.ld_currentIndex = index;
  495 + if (index != self.myCategoryView.selectedIndex) {
  496 + [[NSNotificationCenter defaultCenter] postNotificationName:WjjH5StopVideoPlayerNotification object:nil];
  497 + [[NSNotificationCenter defaultCenter] postNotificationName:kDSHappinessPageControlScrollEnableNotification object:@(YES)];
  498 + }
160 [self.pageViewController setViewControllers:@[vc] direction:UIPageViewControllerNavigationDirectionReverse animated:YES completion:NULL]; 499 [self.pageViewController setViewControllers:@[vc] direction:UIPageViewControllerNavigationDirectionReverse animated:YES completion:NULL];
  500 + CNCategoryGetChannelModel *model = (CNCategoryGetChannelModel *)[self.pageListArr safetyObjectAtIndex:index];
  501 + if (![CNUserShareManager isLogin]) {
  502 + [BHConfig set:ChannelsSelectSecond value:model.id];
  503 + }
  504 + NSDictionary *paramDic = nil;
  505 + if ([model.pageType isEqualToString:@"4"] || [model.pageType isEqualToString:@"5"]){
  506 + paramDic= @{
  507 + @"bgColor": model.backgroundColor?model.backgroundColor:@"",
  508 + @"backgroundImg": model.backgroundImg?model.backgroundImg:@"",
  509 + @"channelId":model.channelId?model.channelId:@"",
  510 + @"channelName":model.id?model.id:@"",
  511 + @"pageId":model.pageId?model.pageId:@"",
  512 + };
  513 + }
  514 + NSTimeInterval time = 300;
  515 + if ([model.id isEqualToString:@"1"]) {
  516 + time = 60;
  517 + }
  518 + [CNLiveClassifyJumpBridge listViewRefreshWithVC:self.controllersArr[index] pageType:model.pageType.integerValue param:paramDic refreshTime:time];
  519 + [self showGuideView];
  520 + weakself
  521 + [self.bgImgView sd_setImageWithURL:[NSURL URLWithString:self.backImageH5] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
  522 + if (image) {
  523 + weakSelf.bgImgView.height = KScreenWidth*image.size.height/image.size.width;
  524 + }
  525 + }];
161 } 526 }
162 -  
163 } 527 }
164 #pragma mark - Getting&&Setting 528 #pragma mark - Getting&&Setting
165 -(JXCategoryTitleView *)myCategoryView 529 -(JXCategoryTitleView *)myCategoryView
166 { 530 {
167 return (JXCategoryTitleView *)self.categoryView; 531 return (JXCategoryTitleView *)self.categoryView;
168 } 532 }
  533 +- (UIImageView *)bgImgView {
  534 + if (!_bgImgView) {
  535 + _bgImgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 50, KScreenWidth, self.view.height-50)];
  536 + _bgImgView.backgroundColor = kWhiteColor;
  537 + }
  538 + return _bgImgView;
  539 +
  540 +}
  541 +- (UIButton *)historyBtn {
  542 + if (!_historyBtn) {
  543 + _historyBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 19, 19)];
  544 + [_historyBtn setBackgroundImage:[UIImage loadBundleImage:@"listen_historey"] forState:UIControlStateNormal];
  545 + [_historyBtn addTarget:self action:@selector(historyAction:) forControlEvents:UIControlEventTouchUpInside];
  546 + _historyBtn.touchAreaInsets = UIEdgeInsetsMake(9, 9, 9, 9);
  547 +
  548 + }
  549 + return _historyBtn;
  550 +}
  551 +- (UIButton *)downloadingBtn {
  552 + if (!_downloadingBtn) {
  553 + _downloadingBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 21, 19)];
  554 + [_downloadingBtn setBackgroundImage:[UIImage loadBundleImage:@"listen_historey"] forState:UIControlStateNormal];
  555 + [_downloadingBtn addTarget:self action:@selector(loadingAction:) forControlEvents:UIControlEventTouchUpInside];
  556 + _downloadingBtn.touchAreaInsets = UIEdgeInsetsMake(9, 9, 9, 9);
  557 + }
  558 + return _downloadingBtn;
  559 +}
  560 +- (CNAudioPlayProgressView *)progressView {
  561 + if (!_progressView) {
  562 + _progressView = [[CNAudioPlayProgressView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
  563 + _progressView.backgroundColor = CNLiveColorWithHexString(@"#5CBFB1");
  564 + _progressView.layer.cornerRadius = 20;
  565 + _progressView.layer.masksToBounds = YES;
  566 + _progressView.hidden = YES;
  567 + }
  568 + return _progressView;
  569 +}
  570 +- (UIButton *)playingBtn {
  571 + if (!_playingBtn) {
  572 + _playingBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
  573 + [_playingBtn addTarget:self action:@selector(playingAction:) forControlEvents:UIControlEventTouchUpInside];
  574 + _playingBtn.userInteractionEnabled = NO;
  575 + }
  576 + return _playingBtn;
  577 +}
169 578
  579 +- (UIImageView *)playingImgV {
  580 + if (!_playingImgV) {
  581 + _playingImgV = [[UIImageView alloc]initWithFrame:CGRectMake(2, 2, 36, 36)];
  582 + _playingImgV.image = [UIImage loadBundleImage:@""];
  583 + _playingImgV.backgroundColor = RGBA(255, 169, 82, 1);
  584 + _playingImgV.layer.cornerRadius = 18;
  585 + _playingImgV.layer.masksToBounds = YES;
  586 + }
  587 + return _playingImgV;
  588 +}
  589 +
  590 +- (UIImageView *)playTipImgV {
  591 + if (!_playTipImgV) {
  592 + _playTipImgV = [[UIImageView alloc]initWithFrame:CGRectMake(13, 12, 10, 12)];
  593 + _playTipImgV.image = [UIImage loadBundleImage:@"playBtn"];
  594 + }
  595 + return _playTipImgV;
  596 +}
170 - (QMUIButton *)searchBtn { 597 - (QMUIButton *)searchBtn {
171 if (!_searchBtn) { 598 if (!_searchBtn) {
172 _searchBtn = [QMUIButton buttonWithType:UIButtonTypeCustom]; 599 _searchBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
@@ -191,7 +618,16 @@ @@ -191,7 +618,16 @@
191 } 618 }
192 return _searchBtn; 619 return _searchBtn;
193 } 620 }
194 - 621 +- (UIButton *)moreBtn {
  622 + if (!_moreBtn) {
  623 + _moreBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  624 + _moreBtn.frame = CGRectMake(0, 0, 18, 44);
  625 + [_moreBtn setImage:[UIImage loadBundleImage:@"ClassifyMore"] forState:UIControlStateNormal];
  626 + [_moreBtn addTarget:self action:@selector(moreAction:event:) forControlEvents:UIControlEventTouchUpInside];
  627 + _moreBtn.touchAreaInsets = UIEdgeInsetsMake(9, 9, 9, 9);
  628 + }
  629 + return _moreBtn;
  630 +}
195 /* 631 /*
196 #pragma mark - Navigation 632 #pragma mark - Navigation
197 633
CNLiveVideoClassifyKit/Classes/Header/CNLiveCommonDefines.h
@@ -8,9 +8,41 @@ @@ -8,9 +8,41 @@
8 #ifndef CNLiveCommonDefines_h 8 #ifndef CNLiveCommonDefines_h
9 #define CNLiveCommonDefines_h 9 #define CNLiveCommonDefines_h
10 10
11 -//#ifndef CNTouristsId  
12 -//#define CNTouristsId @"100056" //游客Id  
13 -//#endif 11 +typedef enum : NSUInteger {
  12 + CNLiveClassifyJumpShowLoginView,
  13 + CNLiveClassifyJumpShowGuideView,
  14 + CNLiveClassifyJumpShowFuzzyView,
  15 + CNLiveClassifyJumpPushShopSDKVC,
  16 + CNLiveClassifyJumpPushAudioPlayerVC,
  17 + CNLiveClassifyJumpPushLoginVC,
  18 + CNLiveClassifyJumpPushHistoryVC,
  19 + CNLiveClassifyJumpPushRecordVC,
  20 + CNLiveClassifyJumpPushDownloadVC,
  21 + CNLiveClassifyJumpPushSearchVC,
  22 + CNLiveClassifyJumpPushAddDiviceVC,
  23 + CNLiveClassifyJumpPushCustomVC
  24 +} CNLiveClassifyJumpType;
  25 +
  26 +static NSString *const CNLiveLaunchWithFirsh = @"CNLiveLaunchWithFirsh";
  27 +static NSString * const kCNLiveDeepLinkPushNotification = @"CNLiveDeepLinkPushNotification";//外部拉起启动相应
  28 +static NSString * const kCNLiveRemotePushNotification = @"CNLiveRemotePushNotification";//远程推送启动相应
  29 +
  30 +// 重定向链接失败通知
  31 +#define CNLiveScanQRCodeScanErrorNotification @"CNLiveScanQRCodeScanError"
  32 +
  33 +// 本地存储音频信息KEY
  34 +#define wjjIsShowWitnessShadeKey @"wjjIsShowWitnessShadeKey"
  35 +#define wjjIsShowSportShadeKey @"wjjIsShowSportShadeKey"
  36 +#define wjjIsShowSupervisionShadeKey @"wjjIsShowSupervisionShadeKey"//监管
  37 +// showGuide"提示导航页"
  38 +#ifndef CNLiveNetAddShowGuideKey
  39 +#define CNLiveNetAddShowGuideKey @"CNLiveNetAddShowGuideKey"
  40 +#endif
  41 +
  42 +#ifndef CNLiveNetAddShowGuideHKey
  43 +#define CNLiveNetAddShowGuideHKey @"CNLiveNetAddShowGuideHKey"
  44 +#endif
  45 +
14 #ifndef CNLiveNetAddGetCategoryChannels 46 #ifndef CNLiveNetAddGetCategoryChannels
15 #define CNLiveNetAddGetCategoryChannels @"CNLiveNetAddGetCategoryChannels" 47 #define CNLiveNetAddGetCategoryChannels @"CNLiveNetAddGetCategoryChannels"
16 #endif 48 #endif
@@ -34,6 +66,33 @@ @@ -34,6 +66,33 @@
34 #ifndef CNWjjClassifyChannelsRequestHideLoadingNotifiName 66 #ifndef CNWjjClassifyChannelsRequestHideLoadingNotifiName
35 #define CNWjjClassifyChannelsRequestHideLoadingNotifiName @"CNWjjClassifyChannelsRequestHideLoadingNotifiName" 67 #define CNWjjClassifyChannelsRequestHideLoadingNotifiName @"CNWjjClassifyChannelsRequestHideLoadingNotifiName"
36 #endif 68 #endif
  69 +#pragma mark - 电商中国首页
  70 +#ifndef kDSHappinessPageControlScrollEnableNotification
  71 +#define kDSHappinessPageControlScrollEnableNotification @"kDSHappinessPageControlScrollEnableNotification"
  72 +#endif
  73 +
  74 +#pragma mark - 登录
  75 +#ifndef TouristloginTipsViewActionNotification
  76 +#define TouristloginTipsViewActionNotification @"touristloginTipsViewActionNotification"
  77 +#endif
  78 +#pragma mark - 听见中国
  79 +// 分类-听见中国-音频播放状态(播放,暂停)
  80 +#ifndef WjjAudioPlayerStatusNotification
  81 +#define WjjAudioPlayerStatusNotification @"WjjAudioPlayerStatusNotification"
  82 +#endif
  83 +// 分类-听见中国-音频播放进度
  84 +#ifndef WjjAudioPlayerScheduleNotification
  85 +#define WjjAudioPlayerScheduleNotification @"WjjAudioPlayerScheduleNotification"
  86 +#endif
  87 +// 分类-听见中国-一首音频播放完成
  88 +#ifndef WjjAudioPlayDidFinishNotification
  89 +#define WjjAudioPlayDidFinishNotification @"WjjAudioPlayDidFinishNotification"
  90 +#endif
  91 +// 分类-听见中国-播放哪一首音频(contenId)
  92 +#ifndef WjjAudioPlayerWhichPlayingNotification
  93 +#define WjjAudioPlayerWhichPlayingNotification @"WjjAudioPlayerWhichPlayingNotification"
  94 +#endif
  95 +#define wjjLastAudioInfoSaveKey @"wjjLastAudioInfoSaveKey"
37 //分类-频道-新版本 96 //分类-频道-新版本
38 #ifndef CNWjjNewCategoryChannelVerKey 97 #ifndef CNWjjNewCategoryChannelVerKey
39 #define CNWjjNewCategoryChannelVerKey @"CNWjjNewCategoryChannelVerKey" 98 #define CNWjjNewCategoryChannelVerKey @"CNWjjNewCategoryChannelVerKey"
@@ -42,13 +101,37 @@ @@ -42,13 +101,37 @@
42 #ifndef CNWjjOldCategoryChannelVerKey 101 #ifndef CNWjjOldCategoryChannelVerKey
43 #define CNWjjOldCategoryChannelVerKey @"CNWjjOldCategoryChannelVerKey" 102 #define CNWjjOldCategoryChannelVerKey @"CNWjjOldCategoryChannelVerKey"
44 #endif 103 #endif
45 -#pragma mark - 电商中国首页  
46 -#ifndef kDSHappinessPageControlScrollEnableNotification  
47 -#define kDSHappinessPageControlScrollEnableNotification @"kDSHappinessPageControlScrollEnableNotification"  
48 -#endif  
49 -  
50 #ifndef ChannelsRequested 104 #ifndef ChannelsRequested
51 #define ChannelsRequested @"channelsRequested" 105 #define ChannelsRequested @"channelsRequested"
52 #endif 106 #endif
53 107
  108 +#ifndef ChannelsShowGuide
  109 +#define ChannelsShowGuide @"channelsShowGuide"
  110 +#endif
  111 +
  112 +#ifndef ChannelsSelectFirst
  113 +#define ChannelsSelectFirst @"channelsSelectFirst"
  114 +#endif
  115 +#ifndef ChannelsSelectSecond
  116 +#define ChannelsSelectSecond @"channelsSelectSecond"
  117 +#endif
  118 +
  119 +#ifndef LoginPrepositionUrl
  120 +#define LoginPrepositionUrl @"loginPrepositionUrl"
  121 +#endif
  122 +
  123 +#ifndef ActivityNewUrl
  124 +#define ActivityNewUrl @"activityNewUrl"
  125 +#endif
  126 +
  127 +//分类-频道-幸福中国导航更新颜色
  128 +#ifndef CNWjjDSShopNavColorChangeNotifiName
  129 +#define CNWjjDSShopNavColorChangeNotifiName @"CNWjjDSShopNavColorChangeNotifiName"
  130 +#endif
  131 +
  132 +//分类-频道-幸福中国是否可左右滑动
  133 +#ifndef kDSHappinessPageControlScrollEnableNotification
  134 +#define kDSHappinessPageControlScrollEnableNotification @"kDSHappinessPageControlScrollEnableNotification"
  135 +#endif
  136 +
54 #endif /* CNLiveCommonDefines_h */ 137 #endif /* CNLiveCommonDefines_h */
CNLiveVideoClassifyKit/Classes/Header/CNLivevideoClassifyPCH.h
@@ -20,6 +20,7 @@ @@ -20,6 +20,7 @@
20 #import <CNLiveBeeHive/BHConfig.h> 20 #import <CNLiveBeeHive/BHConfig.h>
21 #import <CNLiveEnvironment/CNLiveEnvironment.h> 21 #import <CNLiveEnvironment/CNLiveEnvironment.h>
22 #import <MJExtension/MJExtension.h> 22 #import <MJExtension/MJExtension.h>
  23 +//#import <UMCommon/MobClick.h>
23 #import "CNLiveCommonDefines.h" 24 #import "CNLiveCommonDefines.h"
24 #import <QMUIKit/QMUIKit.h> 25 #import <QMUIKit/QMUIKit.h>
25 #import "UIImage+AdBundleImage.h" 26 #import "UIImage+AdBundleImage.h"
CNLiveVideoClassifyKit/Classes/Manager/CNLiveClassifyJumpBridge.h
@@ -13,9 +13,28 @@ NS_ASSUME_NONNULL_BEGIN @@ -13,9 +13,28 @@ NS_ASSUME_NONNULL_BEGIN
13 @interface CNLiveClassifyJumpBridge : NSObject 13 @interface CNLiveClassifyJumpBridge : NSObject
14 @property (nonatomic, strong) id<CNLiveVideoClassifyProtocol> protocol; 14 @property (nonatomic, strong) id<CNLiveVideoClassifyProtocol> protocol;
15 15
16 -+(instancetype)shareInstance; 16 ++ (instancetype)shareInstance;
17 17
18 -+(UIViewController *)ListViewWithPageType:(NSInteger)pageType param:(NSDictionary *_Nullable)param; 18 ++ (UIViewController *)ListViewWithPageType:(NSInteger)pageType param:(NSDictionary *_Nullable)param;
  19 +
  20 ++ (void)listViewRefreshWithVC:(UIViewController *)currentVC pageType:(NSInteger)pageType param:(NSDictionary * _Nullable)param refreshTime:(NSTimeInterval)time;
  21 +
  22 ++ (UIView *)showViewOrPushVCWithCurrentVC:(UIViewController *)currentVC pushType:(CNLiveClassifyJumpType)type;
  23 +
  24 ++ (UIView *)showViewOrPushVCWithCurrentVC:(UIViewController *)currentVC pushType:(CNLiveClassifyJumpType)type pageType:(NSInteger)pageType param:(NSDictionary * _Nullable)param;
  25 +
  26 ++(void)popOverShowEvent:(UIEvent *)event
  27 + imageDone:(FTPopDoneBlock)doneBlock
  28 + dismissBlock:(FTPopDismissBlock)dismissBlock;
  29 ++(void)showGuideShadeViewType:(NSInteger)type cellFrame:(CGRect)cellFrame cancelBlock:(FTPopDismissBlock)cancelBlock;
  30 +
  31 ++ (void)checkForloginTurnToWithURL:(NSURL *)url;
  32 +
  33 ++ (void)checkWithFunctionForShareURL:(NSString *)shareUrl;
  34 +
  35 ++ (void)bringCenterLoginViewToFront;
  36 +
  37 ++ (BOOL)audioPlayerIsplaying;
19 @end 38 @end
20 39
21 NS_ASSUME_NONNULL_END 40 NS_ASSUME_NONNULL_END
CNLiveVideoClassifyKit/Classes/Manager/CNLiveClassifyJumpBridge.m
@@ -32,4 +32,51 @@ @@ -32,4 +32,51 @@
32 { 32 {
33 return [[CNLiveClassifyJumpBridge shareInstance].protocol listViewShowPageType:pageType param:param]; 33 return [[CNLiveClassifyJumpBridge shareInstance].protocol listViewShowPageType:pageType param:param];
34 } 34 }
  35 +
  36 ++(void)listViewRefreshWithVC:(UIViewController *)currentVC pageType:(NSInteger)pageType param:(NSDictionary *)param refreshTime:(NSTimeInterval)time
  37 +{
  38 +
  39 +}
  40 +
  41 ++(UIView *)showViewOrPushVCWithCurrentVC:(UIViewController *)currentVC pushType:(CNLiveClassifyJumpType)type
  42 +{
  43 + return [CNLiveClassifyJumpBridge showViewOrPushVCWithCurrentVC:currentVC pushType:type pageType:0 param:nil];
  44 +}
  45 ++(UIView *)showViewOrPushVCWithCurrentVC:(UIViewController *)currentVC pushType:(CNLiveClassifyJumpType)type pageType:(NSInteger)pageType param:(NSDictionary *_Nullable)param
  46 +{
  47 + return [[CNLiveClassifyJumpBridge shareInstance].protocol showViewOrPushVCWithCurrentVC:currentVC pushType:type pageType:pageType param:param];
  48 +}
  49 ++(void)popOverShowEvent:(UIEvent *)event imageDone:(FTPopDoneBlock)doneBlock dismissBlock:(FTPopDismissBlock)dismissBlock
  50 +{
  51 + [[CNLiveClassifyJumpBridge shareInstance].protocol popOverShowEvent:event imageDone:doneBlock dismissBlock:dismissBlock];
  52 +}
  53 ++(void)checkForloginTurnToWithURL:(NSURL *)url
  54 +{
  55 + Class class = NSClassFromString(@"CNLiveSkipActionManager");
  56 + SEL sel = NSSelectorFromString(@"checkForloginTurnToWithURL");
  57 + if (class && sel) {
  58 + [class performSelector:sel withObject:url];
  59 + }
  60 +}
  61 +
  62 ++(void)checkWithFunctionForShareURL:(NSString *)shareUrl
  63 +{
  64 + Class class = NSClassFromString(@"CNLiveSkipActionManager");
  65 + SEL sel = NSSelectorFromString(@"checkWithFunctionForShareURL");
  66 + if (class && sel) {
  67 + [class performSelector:sel withObject:shareUrl];
  68 + }
  69 +
  70 +}
  71 +
  72 ++ (void)bringCenterLoginViewToFront
  73 +{
  74 + Class class = NSClassFromString(@"CNTouristsLoginView");
  75 + SEL sel = NSSelectorFromString(@"bringCenterLoginViewToFront");
  76 + [class performSelector:sel];
  77 +}
  78 ++ (BOOL)audioPlayerIsplaying
  79 +{
  80 + return [[CNLiveClassifyJumpBridge shareInstance].protocol audioPlayerIsplaying];
  81 +}
35 @end 82 @end
CNLiveVideoClassifyKit/Classes/Manager/CNLiveListManager.h
@@ -19,6 +19,8 @@ NS_ASSUME_NONNULL_BEGIN @@ -19,6 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
19 -(UIViewController *)model:(CNCategoryGetChannelModel *)model black:(BOOL)black bgImage:(NSString *)bgImage bgColor:(NSString *)bgColor bgImageH5:(NSString *)bgImageH5; 19 -(UIViewController *)model:(CNCategoryGetChannelModel *)model black:(BOOL)black bgImage:(NSString *)bgImage bgColor:(NSString *)bgColor bgImageH5:(NSString *)bgImageH5;
20 20
21 - (void)requestWebViewForScrollView:(nonnull UIScrollView *)scrollView isBeginDragging:(BOOL)isBeginDragging; 21 - (void)requestWebViewForScrollView:(nonnull UIScrollView *)scrollView isBeginDragging:(BOOL)isBeginDragging;
  22 +
  23 ++ (CNCategoryBaseViewController *)CNCategoryBaseViewController;
22 @end 24 @end
23 25
24 NS_ASSUME_NONNULL_END 26 NS_ASSUME_NONNULL_END
CNLiveVideoClassifyKit/Classes/Manager/CNLiveListManager.m
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 7
8 #import "CNLiveListManager.h" 8 #import "CNLiveListManager.h"
9 #import "CNCategoryGetChannelModel.h" 9 #import "CNCategoryGetChannelModel.h"
  10 +#import "CNLiveClassifySegmentController.h"
10 11
11 @interface CNLiveListManager() 12 @interface CNLiveListManager()
12 { 13 {
@@ -25,6 +26,10 @@ @@ -25,6 +26,10 @@
25 return manager; 26 return manager;
26 } 27 }
27 28
  29 ++(CNCategoryBaseViewController *)CNCategoryBaseViewController
  30 +{
  31 + return [[CNLiveClassifySegmentController alloc] init];
  32 +}
28 33
29 -(UIViewController *)model:(CNCategoryGetChannelModel *)model black:(BOOL)black bgImage:(NSString *)bgImage bgColor:(nonnull NSString *)bgColor bgImageH5:(nonnull NSString *)bgImageH5 34 -(UIViewController *)model:(CNCategoryGetChannelModel *)model black:(BOOL)black bgImage:(NSString *)bgImage bgColor:(nonnull NSString *)bgColor bgImageH5:(nonnull NSString *)bgImageH5
30 { 35 {
@@ -58,9 +63,9 @@ @@ -58,9 +63,9 @@
58 beginoffsetY = scrollView.offsetY; 63 beginoffsetY = scrollView.offsetY;
59 }else 64 }else
60 { 65 {
61 - if (scrollView.offsetY - beginoffsetY>2) { 66 + if (scrollView.offsetY - beginoffsetY>5) {
62 !self.scrollViewDidScrollBlock ?: self.scrollViewDidScrollBlock(YES); 67 !self.scrollViewDidScrollBlock ?: self.scrollViewDidScrollBlock(YES);
63 - }else if (scrollView.offsetY - beginoffsetY<-2) { 68 + }else if (scrollView.offsetY - beginoffsetY<0) {
64 !self.scrollViewDidScrollBlock ?: self.scrollViewDidScrollBlock(NO); 69 !self.scrollViewDidScrollBlock ?: self.scrollViewDidScrollBlock(NO);
65 } 70 }
66 } 71 }
CNLiveVideoClassifyKit/Classes/Manager/CNLiveVideoClassifyProtocol.h
@@ -7,8 +7,11 @@ @@ -7,8 +7,11 @@
7 7
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 9
10 -NS_ASSUME_NONNULL_BEGIN 10 +typedef void(^FTPopDoneBlock)(NSInteger selectIndex);
  11 +
  12 +typedef void(^FTPopDismissBlock)(void);
11 13
  14 +NS_ASSUME_NONNULL_BEGIN
12 @protocol CNLiveVideoClassifyProtocol <NSObject> 15 @protocol CNLiveVideoClassifyProtocol <NSObject>
13 /** 16 /**
14 *返回需要加载的View 17 *返回需要加载的View
@@ -17,6 +20,13 @@ NS_ASSUME_NONNULL_BEGIN @@ -17,6 +20,13 @@ NS_ASSUME_NONNULL_BEGIN
17 */ 20 */
18 -(UIViewController *)listViewShowPageType:(NSUInteger)pageType 21 -(UIViewController *)listViewShowPageType:(NSUInteger)pageType
19 param:(NSDictionary *)param; 22 param:(NSDictionary *)param;
  23 +-(UIView *)showViewOrPushVCWithCurrentVC:(UIViewController *)currentVC
  24 + pushType:(CNLiveClassifyJumpType)type pageType:(NSInteger)pageType param:(NSDictionary *_Nullable)param;
  25 +-(BOOL)audioPlayerIsplaying;
  26 +
  27 +-(void)popOverShowEvent:(UIEvent *)event
  28 + imageDone:(FTPopDoneBlock)doneBlock
  29 + dismissBlock:(FTPopDismissBlock)dismissBlock;
20 @end 30 @end
21 31
22 NS_ASSUME_NONNULL_END 32 NS_ASSUME_NONNULL_END
CNLiveVideoClassifyKit/Classes/Manager/CNWebRedirectHandle.h 0 → 100644
  1 +//
  2 +// CNWebRedirectHandle.h
  3 +// CNLiveNetAdd
  4 +//
  5 +// Created by cnliveJunBo on 2019/1/3.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +// 跳转二级webview的管理类
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +@interface CNWebRedirectHandle : NSObject
  14 +
  15 +@property (nonatomic, assign) BOOL isSelectedClassify;//是否进入过分类页面
  16 +@property (nonatomic, assign) BOOL isClickedIntegral; //未进入过分类页面时,是否点击过积分任务跳转
  17 +@property (nonatomic, assign) NSInteger channelId; //一级index
  18 +@property (nonatomic, assign) NSInteger classifyId; //二级index
  19 +
  20 ++ (CNWebRedirectHandle *)manager;
  21 +
  22 +// 外部使用(短连接->长连接)(多了encode decode操作)
  23 +- (void)webRedirectHandleWithUrlStr:(NSString *)urlStr;
  24 +// 外部使用(跳转二级webView页)(无encode decode,无短链重定向长链操作,仅仅初始化二级webview做跳转)
  25 +- (void)turnToCategorySubWebVCWithUrl:(NSString *)urlStr;
  26 +
  27 +// junbo自己使用 (无encode decode操作。因为一二级webview内不再做任何encode decode操作,容易产生多次encode问题,所以一二级webview内使用这个)
  28 +- (void)jb_webRedirectHandleWithUrlStr:(NSString *)urlStr;
  29 +
  30 +@end
  31 +
  32 +NS_ASSUME_NONNULL_END
CNLiveVideoClassifyKit/Classes/Manager/CNWebRedirectHandle.m 0 → 100644
  1 +//
  2 +// CNWebRedirectHandle.m
  3 +// CNLiveNetAdd
  4 +//
  5 +// Created by cnliveJunBo on 2019/1/3.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNWebRedirectHandle.h"
  10 +
  11 +@interface CNWebRedirectHandle ()<NSURLSessionTaskDelegate>
  12 +
  13 +@property (nonatomic, copy) NSString *loadUrlStr;
  14 +@property (nonatomic, assign) BOOL isRedirect;
  15 +@property (nonatomic, copy) NSString *oldUrlStr;
  16 +@property (nonatomic, copy) NSString *redirectUrlStr;
  17 +
  18 +@end
  19 +
  20 +@implementation CNWebRedirectHandle
  21 +
  22 ++ (CNWebRedirectHandle *)manager
  23 +{
  24 + static id instance = nil;
  25 + static dispatch_once_t onceToken;
  26 + dispatch_once(&onceToken, ^{
  27 + instance = [[self alloc] init];
  28 + });
  29 + return instance;
  30 +}
  31 +
  32 +- (void)webRedirectHandleWithUrlStr:(NSString *)urlStr {
  33 +
  34 + urlStr = [urlStr stringByURLDecode];
  35 + urlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
  36 + [self jb_webRedirectHandleWithUrlStr:urlStr];
  37 +}
  38 +
  39 +- (void)turnToCategorySubWebVCWithUrl:(NSString *)urlStr {
  40 +#warning pushVC
  41 + // 二级页
  42 +// NSDictionary *dic = [NSString getURLParameters:urlStr];
  43 +// AppDelegate *delegte = (AppDelegate *)[UIApplication sharedApplication].delegate;
  44 +// delegte.shouldChangeOrientation = WebPlayer;
  45 +// NSString *pageTitle = @" ";
  46 +// if ([dic containsObjectForKey:@"isShowTitle"] && [dic[@"isShowTitle"] isEqualToString:@"true"]) {
  47 +// pageTitle = nil;
  48 +// }
  49 +// CNDarenCategoryWebController *webVC = [[CNDarenCategoryWebController alloc] initWithUrl:urlStr pageTitle:pageTitle];
  50 +// webVC.statUrl = urlStr;
  51 +// if([dic[@"model"] isEqualToString:@"witness"]){
  52 +// webVC.shareType = @"witnessVideo";
  53 +// }
  54 +// else if([dic[@"model"] isEqualToString:@"3_witness"]){
  55 +// webVC.shareType = @"witnessArticle";
  56 +// }
  57 +// else {
  58 +// webVC.shareType = @"article";
  59 +// }
  60 +// [[AppDelegate sharedAppDelegate] pushViewController:webVC withBackTitle:@" "];
  61 +}
  62 +
  63 +- (void)jb_webRedirectHandleWithUrlStr:(NSString *)urlStr {
  64 + [QMUITips showLoadingInView:AppKeyWindow];
  65 + self.loadUrlStr = urlStr?urlStr:@"";
  66 + NSURL *url = [NSURL URLWithString:urlStr];
  67 + NSMutableURLRequest *quest = [NSMutableURLRequest requestWithURL:url];
  68 + quest.HTTPMethod = @"GET";
  69 +
  70 + weakself
  71 + NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
  72 + config.requestCachePolicy = NSURLRequestReloadIgnoringLocalCacheData;
  73 + NSURLSession *urlSession = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:[NSOperationQueue currentQueue]];
  74 + NSURLSessionDataTask *task = [urlSession dataTaskWithRequest:quest completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error)
  75 + {
  76 + [QMUITips hideAllTipsInView:AppKeyWindow];
  77 + if (error) {
  78 + if (error.code == -1009) {
  79 + [QMUITips showError:@"似乎已断开与互联网的连接。" inView:AppKeyWindow hideAfterDelay:1.5];
  80 + }
  81 + weakSelf.isRedirect = NO;
  82 + weakSelf.oldUrlStr = nil;
  83 + weakSelf.redirectUrlStr = nil;
  84 + return ;
  85 + }
  86 +
  87 + NSString *loadUrlStr = weakSelf.loadUrlStr;
  88 + if (weakSelf.isRedirect) {
  89 + loadUrlStr = weakSelf.redirectUrlStr;
  90 + [CNLiveClassifyJumpBridge checkWithFunctionForShareURL:loadUrlStr];
  91 + } else {
  92 + // 没有重定向
  93 + [[NSNotificationCenter defaultCenter] postNotificationName:CNLiveScanQRCodeScanErrorNotification object:nil];
  94 + [QMUITips showWithText:@"链接地址错误" inView:AppKeyWindow hideAfterDelay:1.5f];
  95 + }
  96 + weakSelf.isRedirect = NO;
  97 + weakSelf.oldUrlStr = nil;
  98 + weakSelf.redirectUrlStr = nil;
  99 + }];
  100 + [task resume];
  101 +
  102 +}
  103 +
  104 +#pragma mark - NSURLSessionTaskDelegate
  105 +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURLRequest * __nullable))completionHandler
  106 +{
  107 + NSLog(@"statusCode: %ld", response.statusCode);
  108 +
  109 + NSDictionary *headers = response.allHeaderFields;
  110 + NSLog(@"%@", headers);
  111 + if (response.statusCode==302 || response.statusCode==301) {
  112 + self.isRedirect = YES;
  113 + self.oldUrlStr = [[response URL] absoluteString];
  114 + self.redirectUrlStr = headers[@"Location"];
  115 + NSLog(@"======>>>>>>111111:%@",headers[@"Location"]);
  116 + }
  117 + NSLog(@"redirect url: %@", headers[@"Location"]); // 重定向的地址,如:http://www.jd.com
  118 + NSLog(@"newRequest url: %@", [request URL]); // 重定向的地址,如:http://www.jd.com
  119 + NSLog(@"redirect response url: %@", [response URL]);// 触发重定向请求的地址,如:http://www.360buy.com
  120 +
  121 + completionHandler(request);
  122 + // completionHandler(nil);// 参数为nil,表示拦截(禁止)重定向
  123 +}
  124 +
  125 +@end
CNLiveVideoClassifyKit/Classes/Model/CNCategoryGetChannelModel.h
@@ -50,3 +50,79 @@ @@ -50,3 +50,79 @@
50 - (NSInteger)containsWithChannelArray:(NSArray <NSString *>*)channelArray; 50 - (NSInteger)containsWithChannelArray:(NSArray <NSString *>*)channelArray;
51 51
52 @end 52 @end
  53 +
  54 +@interface CNLiveAlbumAudioListModel : NSObject<NSCoding>
  55 +@property (nonatomic, copy) NSString *activityId; //活动ID
  56 +@property (nonatomic, copy) NSString *cmccActiveId;//音响播放id
  57 +@property (nonatomic, copy) NSString *title; //标题名称
  58 +@property (nonatomic, copy) NSString *albumId; //专辑ID
  59 +@property (nonatomic, copy) NSString *albumName; //专辑名称
  60 +@property (nonatomic, copy) NSString *actor; //作者
  61 +@property (nonatomic, copy) NSString *modelId; //类型ID,5是音频
  62 +@property (nonatomic, copy) NSString *time;
  63 +@property (nonatomic, copy) NSString *img;
  64 +@property (nonatomic, copy) NSString *counts; //后面标题号
  65 +@property (nonatomic, copy) NSString *viewCounts; //人数
  66 +@property (nonatomic, copy) NSString *schedule; //播放长度
  67 +@property (nonatomic, copy) NSString *comments; //评论数
  68 +@property (nonatomic, copy) NSString *contentId;
  69 +@property (nonatomic, copy) NSString *duration; //时长
  70 +@property (nonatomic, copy) NSString *shareUrl;
  71 +@property (nonatomic, copy) NSString *aid; //专辑ID
  72 +@property (nonatomic, copy) NSString *poster; //封面图
  73 +@property (nonatomic, copy) NSString *channelName; //
  74 +@property (nonatomic, copy) NSString *likesNum; //点赞人数
  75 +@property (nonatomic, copy) NSString *goodsJson; //商品
  76 +@property (nonatomic, assign) BOOL liked; //自己是否点赞
  77 +// 付费音频 h5->app
  78 +@property (nonatomic, copy) NSString * productId;
  79 +@property (nonatomic, copy) NSString * productType; //类型 0 免费 1 积分 2 付费 3 4试听
  80 +@property (nonatomic, copy) NSString * iosRmb;
  81 +@property (nonatomic, copy) NSString * androidRmb;
  82 +@property (nonatomic, copy) NSString * point; //积分
  83 +// 分享
  84 +@property (nonatomic, copy) NSString * aProductId;
  85 +@property (nonatomic, copy) NSString * aProductType;
  86 +// 播放详情接口
  87 +@property (nonatomic, copy) NSString * desc; //描述
  88 +@property (nonatomic, copy) NSString * cultureDesc;
  89 +@property (nonatomic, copy) NSString * bodyContent; //内容简介
  90 +@property (nonatomic, copy) NSString * model; //
  91 +@property (nonatomic, copy) NSString * publishTime; //
  92 +@property (nonatomic, copy) NSString * siteId; //
  93 +@property (nonatomic, copy) NSString * subTitle;
  94 +@property (nonatomic, copy) NSString *isSelected; //是否被播放过
  95 +// 历史记录
  96 +@property (nonatomic, copy) NSString *recordId;
  97 +@property (nonatomic, copy) NSString *activeId;
  98 +@property (nonatomic, copy) NSString *recent;
  99 +@property (nonatomic, copy) NSString *sid;
  100 +@property (nonatomic, copy) NSString *albumImg;
  101 +@property (nonatomic, copy) NSString *number; //展示前面的数字,自己加的
  102 +@property (nonatomic, copy) NSString *isCellSelected; //cell是否被选中
  103 +//下载的数据
  104 +@property (nonatomic, copy) NSString *localPath; // 下载完成路径
  105 +@property (nonatomic, copy) NSString *url; // url
  106 +@property (nonatomic, strong) NSData *resumeData; // 下载的数据
  107 +@property (nonatomic, assign) CGFloat progress; // 下载进度
  108 +@property (nonatomic, assign) NSUInteger totalFileSize; // 文件总大小
  109 +@property (nonatomic, assign) NSUInteger tmpFileSize; // 下载大小
  110 +@property (nonatomic, assign) NSUInteger speed; // 下载速度
  111 +@property (nonatomic, assign) NSTimeInterval lastSpeedTime; // 上次计算速度时的时间戳
  112 +@property (nonatomic, assign) NSUInteger intervalFileSize; // 计算速度时间内下载文件的大小
  113 +@property (nonatomic, assign) NSUInteger lastStateTime; // 记录任务加入准备下载的时间(点击默认、暂停、失败状态),用于计算开始、停止任务的先后顺序
  114 +@property (nonatomic, copy) NSString *fileSize; //服务器返的文件大小
  115 +@property (nonatomic, copy) NSString *isProgram; //是节目列表还是简介列表里的 "0"简介 "1"节目
  116 +@property (nonatomic, copy) NSString *createTime; //已购列表创建时间
  117 +//@property (nonatomic, assign) BOOL isPay; //是否付费
  118 +@property (nonatomic, assign) BOOL downloadType; //是否可下载 YES可下载 NO不可下载
  119 +@property (nonatomic, copy) NSString *isHorizontalScreen;//是否是竖屏视频(非null&&=0是竖屏,1是横屏) 跳到点播详情使用
  120 +@property (nonatomic, copy) NSString *liveType; //直播类型
  121 +
  122 +@property (nonatomic, copy) NSString *albumType; // 0 是视频 1 是音频
  123 +@property (nonatomic, assign) BOOL isVideoType; //是否是视频类型 Yes是包括点播和直播 NO 音频
  124 +@property (nonatomic, copy) NSString *isStudy; // 1 可以考试 2 已学完
  125 +
  126 +
  127 +@end
  128 +
CNLiveVideoClassifyKit/Classes/Model/CNCategoryGetChannelModel.m
@@ -41,3 +41,6 @@ @@ -41,3 +41,6 @@
41 } 41 }
42 42
43 @end 43 @end
  44 +@implementation CNLiveAlbumAudioListModel
  45 +
  46 +@end
CNLiveVideoClassifyKit/Classes/view/CNAudioPlayProgressView.h 0 → 100644
  1 +//
  2 +// CNAudioPlayProgressView.h
  3 +// CNLiveNetAdd
  4 +//
  5 +// Created by cnliveJunBo on 2019/7/3.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +@interface CNAudioPlayProgressView : UIView
  14 +
  15 +- (void)animationWithProgres:(CGFloat)progress duration:(CGFloat)duration;
  16 +
  17 +@end
  18 +
  19 +NS_ASSUME_NONNULL_END
CNLiveVideoClassifyKit/Classes/view/CNAudioPlayProgressView.m 0 → 100644
  1 +//
  2 +// CNAudioPlayProgressView.m
  3 +// CNLiveNetAdd
  4 +//
  5 +// Created by cnliveJunBo on 2019/7/3.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNAudioPlayProgressView.h"
  10 +
  11 +@interface CNAudioPlayProgressView ()
  12 +
  13 +@property (nonatomic, strong) CAShapeLayer *progressLayer;
  14 +@property (nonatomic, assign) CGFloat progress;
  15 +
  16 +@end
  17 +
  18 +@implementation CNAudioPlayProgressView
  19 +
  20 +- (instancetype)initWithFrame:(CGRect)frame
  21 +{
  22 + self = [super initWithFrame:frame];
  23 + if (self) {
  24 + self.progress = 0.0f;
  25 + }
  26 + return self;
  27 +}
  28 +
  29 +- (void)drawRect:(CGRect)rect {
  30 +
  31 + CGFloat lineWidth = 2.0f;
  32 +
  33 + //创建一个圆形贝塞尔曲线
  34 + UIBezierPath *aPath2 = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.width/2, self.height/2) radius:(self.width - lineWidth)/ 2 startAngle:-M_PI_2 endAngle:M_PI * 3.0 / 2.0 clockwise:YES];
  35 + aPath2.lineCapStyle = kCGLineCapRound; //线条拐角
  36 + aPath2.lineJoinStyle = kCGLineJoinRound; //终点处理
  37 + CAShapeLayer *shapeLayer = [CAShapeLayer layer];
  38 + shapeLayer.frame = self.bounds;//设置shapeLayer的尺寸和位置
  39 + shapeLayer.fillColor = [UIColor clearColor].CGColor;//填充颜色为ClearColor
  40 + //设置线条的宽度和颜色
  41 + shapeLayer.lineWidth = lineWidth;
  42 + shapeLayer.strokeColor = kWhiteColor.CGColor;
  43 + //将贝塞尔曲线设置为CAShapeLayer的path
  44 + shapeLayer.path = aPath2.CGPath;
  45 + //将shapeLayer添加到视图的layer上
  46 + [self.layer addSublayer:shapeLayer];
  47 +
  48 + self.progressLayer = [CAShapeLayer layer];
  49 + self.progressLayer.frame = self.bounds;
  50 + self.progressLayer.fillColor = [UIColor clearColor].CGColor;//填充颜色为ClearColor
  51 + //设置线条的宽度和颜色
  52 + self.progressLayer.lineWidth = lineWidth;
  53 + self.progressLayer.strokeColor = RGBA(255, 169, 82, 1).CGColor;
  54 + self.progressLayer.path = aPath2.CGPath;
  55 + self.progressLayer.strokeStart = 0;
  56 + self.progressLayer.strokeEnd = self.progress;
  57 + [self.layer addSublayer:self.progressLayer];
  58 +
  59 +}
  60 +
  61 +- (void)animationWithProgres:(CGFloat)progress duration:(CGFloat)duration {
  62 +
  63 + self.progress = progress;
  64 + if (progress>1.0) {
  65 + progress = 1.0;
  66 + }
  67 +// NSLog(@"look here 进度:%f",progress);
  68 + [CATransaction begin];
  69 + [CATransaction setAnimationTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
  70 + [CATransaction setAnimationDuration:duration];
  71 + self.progressLayer.strokeEnd = progress;
  72 + [CATransaction commit];
  73 +
  74 +}
  75 +
  76 +@end
CNLiveVideoClassifyKit/Classes/view/CNSupervisionGuideViewManager.h 0 → 100644
  1 +//
  2 +// CNSupervisionGuideViewManager.h
  3 +// CNLiveNetAdd
  4 +//
  5 +// Created by cnliveJunBo on 2020/3/10.
  6 +// Copyright © 2020 cnlive. All rights reserved.
  7 +// 目击者监管首次引导管理类
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +@interface CNSupervisionGuideViewManager : NSObject
  14 +
  15 ++ (void)showSupervisionGuideViewWithVC:(UIViewController *)vc;
  16 +
  17 +@end
  18 +
  19 +NS_ASSUME_NONNULL_END
CNLiveVideoClassifyKit/Classes/view/CNSupervisionGuideViewManager.m 0 → 100644
  1 +//
  2 +// CNSupervisionGuideViewManager.m
  3 +// CNLiveNetAdd
  4 +//
  5 +// Created by cnliveJunBo on 2020/3/10.
  6 +// Copyright © 2020 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNSupervisionGuideViewManager.h"
  10 +
  11 +static CNSupervisionGuideViewManager * instance = nil;
  12 +
  13 +@interface CNSupervisionGuideViewManager ()
  14 +
  15 +@property (nonatomic, strong) UIView *bgView;
  16 +@property (nonatomic, strong) UIImageView *titleView;
  17 +@property (nonatomic, strong) UIImageView *arrowsView;
  18 +@property (nonatomic, strong) UIImageView *contentView;
  19 +@property (nonatomic, strong) UIButton *cancelBtn;
  20 +
  21 +@end
  22 +
  23 +@implementation CNSupervisionGuideViewManager
  24 +
  25 ++ (void)showSupervisionGuideViewWithVC:(UIViewController *)vc {
  26 +
  27 + instance = [[self alloc] init];
  28 + [vc.view addSubview:instance.bgView];
  29 + [instance.bgView addSubview:instance.contentView];
  30 + [instance.bgView addSubview:instance.arrowsView];
  31 + [instance.bgView addSubview:instance.titleView];
  32 + [instance.bgView addSubview:instance.cancelBtn];
  33 + if (instance.titleView.bottom>instance.cancelBtn.top-20) {
  34 + instance.cancelBtn.top=instance.titleView.bottom+20;
  35 + }
  36 +
  37 +}
  38 +
  39 +- (void)cancelAction:(UIButton *)sender {
  40 +
  41 + [instance.contentView removeFromSuperview];
  42 + [instance.arrowsView removeFromSuperview];
  43 + [instance.titleView removeFromSuperview];
  44 + [instance.cancelBtn removeFromSuperview];
  45 + instance.contentView = nil;
  46 + instance.arrowsView = nil;
  47 + instance.titleView = nil;
  48 + instance.cancelBtn = nil;
  49 + [instance.bgView removeFromSuperview];
  50 + instance.bgView = nil;
  51 +
  52 +}
  53 +
  54 +- (UIView *)bgView {
  55 + if (!_bgView) {
  56 + _bgView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
  57 + _bgView.backgroundColor = RGBA(0, 0, 0, 0.7);
  58 + }
  59 + return _bgView;
  60 +}
  61 +
  62 +- (UIImageView *)titleView {
  63 + if (!_titleView) {
  64 + CGFloat height = (KScreenWidth-22)*191/353;
  65 + _titleView = [[UIImageView alloc] initWithFrame:CGRectMake(11, kStatusHeight+72, KScreenWidth-22, height)];
  66 + _titleView.image = [UIImage imageNamed:@"spjg_title"];
  67 + }
  68 + return _titleView;
  69 +}
  70 +
  71 +- (UIImageView *)arrowsView {
  72 + if (!_arrowsView) {
  73 + _arrowsView = [[UIImageView alloc] initWithFrame:CGRectMake(KScreenWidth*0.5-46.5, instance.titleView.bottom+7, 20, 43)];
  74 + _arrowsView.image = [UIImage imageNamed:@"spjg_arrow"];
  75 + }
  76 + return _arrowsView;
  77 +}
  78 +
  79 +- (UIImageView *)contentView {
  80 + if (!_contentView) {
  81 + CGFloat height = (KScreenWidth-22)*80/353;
  82 + _contentView = [[UIImageView alloc] initWithFrame:CGRectMake(11, instance.arrowsView.bottom+7 , KScreenWidth-22, height)];
  83 + _contentView.image = [UIImage imageNamed:@"spjg_content"];
  84 + }
  85 + return _contentView;
  86 +}
  87 +
  88 +- (UIButton *)cancelBtn {
  89 + if (!_cancelBtn) {
  90 + _cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  91 + _cancelBtn.frame = CGRectMake((KScreenWidth-96)*0.5, instance.contentView.bottom+104.5, 96, 39);
  92 + [_cancelBtn setImage:[UIImage imageNamed:@"spjg_know"] forState:UIControlStateNormal];
  93 + [_cancelBtn addTarget:self action:@selector(cancelAction:) forControlEvents:UIControlEventTouchUpInside];
  94 + }
  95 + return _cancelBtn;
  96 +}
  97 +
  98 +@end
CNLiveVideoClassifyKit/Classes/view/CNWitnessShadeManager.h 0 → 100644
  1 +//
  2 +// CNWitnessShadeManager.h
  3 +// CNLiveNetAdd
  4 +//
  5 +// Created by cnliveJunBo on 2019/7/5.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +// 目击者遮罩引导管理类
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +@interface CNWitnessShadeManager : NSObject
  14 +
  15 +// y: kStatusHeight+50+5
  16 ++ (void)showWitnessShadeViewWithTopImg:(NSString *)topImg contentImg:(NSString *)contentImg topImgRect:(CGRect)topImgRect contentImgSize:(CGSize)contentImgSize vc:(UIViewController *)vc cancelBlock:(void(^)(void))cancelBlock;
  17 +
  18 +@end
  19 +
  20 +NS_ASSUME_NONNULL_END
CNLiveVideoClassifyKit/Classes/view/CNWitnessShadeManager.m 0 → 100644
  1 +//
  2 +// CNWitnessShadeManager.m
  3 +// CNLiveNetAdd
  4 +//
  5 +// Created by cnliveJunBo on 2019/7/5.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNWitnessShadeManager.h"
  10 +
  11 +static CNWitnessShadeManager * instance = nil;
  12 +typedef void(^CancelBlock)(void);
  13 +@interface CNWitnessShadeManager ()
  14 +
  15 +@property (nonatomic, strong) UIView *bgView;
  16 +@property (nonatomic, strong) UIImageView *mjzView;
  17 +@property (nonatomic, strong) UIImageView *arrowsView;
  18 +@property (nonatomic, strong) UIImageView *titleView;
  19 +@property (nonatomic, strong) UIButton *cancelBtn;
  20 +
  21 +@property (nonatomic, copy) NSString *topImgName;
  22 +@property (nonatomic, copy) NSString *contentImgName;
  23 +@property (nonatomic, assign) CGRect topImgRect;
  24 +@property (nonatomic, assign) CGSize contentImgSize;
  25 +@property (nonatomic, copy) CancelBlock cancelBlock;
  26 +
  27 +@end
  28 +
  29 +@implementation CNWitnessShadeManager
  30 +
  31 ++ (void)showWitnessShadeViewWithTopImg:(NSString *)topImg contentImg:(NSString *)contentImg topImgRect:(CGRect)topImgRect contentImgSize:(CGSize)contentImgSize vc:(UIViewController *)vc cancelBlock:(void(^)(void))cancelBlock {
  32 +
  33 + instance = [[self alloc] init];
  34 + instance.topImgName = topImg;
  35 + instance.contentImgName = contentImg;
  36 + instance.topImgRect = topImgRect;
  37 + instance.contentImgSize = contentImgSize;
  38 + instance.cancelBlock = cancelBlock;
  39 + [vc.view addSubview:instance.bgView];
  40 + [instance.bgView addSubview:instance.mjzView];
  41 + [instance.bgView addSubview:instance.arrowsView];
  42 + [instance.bgView addSubview:instance.titleView];
  43 + [instance.bgView addSubview:instance.cancelBtn];
  44 + if (instance.titleView.bottom>instance.cancelBtn.top-20) {
  45 + instance.cancelBtn.top=instance.titleView.bottom+20;
  46 + }
  47 +
  48 +}
  49 +
  50 +- (void)cancelAction:(UIButton *)sender {
  51 +
  52 + [instance.mjzView removeFromSuperview];
  53 + [instance.arrowsView removeFromSuperview];
  54 + [instance.titleView removeFromSuperview];
  55 + [instance.cancelBtn removeFromSuperview];
  56 + instance.mjzView = nil;
  57 + instance.arrowsView = nil;
  58 + instance.titleView = nil;
  59 + instance.cancelBtn = nil;
  60 + [instance.bgView removeFromSuperview];
  61 + instance.bgView = nil;
  62 + if (instance.cancelBlock) {
  63 + instance.cancelBlock();
  64 + }
  65 +}
  66 +
  67 +- (UIView *)bgView {
  68 + if (!_bgView) {
  69 + _bgView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
  70 + _bgView.backgroundColor = RGBA(0, 0, 0, 0.7);
  71 + }
  72 + return _bgView;
  73 +}
  74 +
  75 +- (UIImageView *)mjzView {
  76 + if (!_mjzView) {
  77 + _mjzView = [[UIImageView alloc] initWithFrame:instance.topImgRect];
  78 + _mjzView.image = [UIImage loadBundleImage:instance.topImgName];
  79 + }
  80 + return _mjzView;
  81 +}
  82 +
  83 +- (UIImageView *)arrowsView {
  84 + if (!_arrowsView) {
  85 + _arrowsView = [[UIImageView alloc] initWithFrame:CGRectMake(instance.mjzView.x+53, instance.mjzView.bottom+3, 47, 136)];
  86 + _arrowsView.image = [UIImage loadBundleImage:@"mjz-arrow"];
  87 + }
  88 + return _arrowsView;
  89 +}
  90 +
  91 +- (UIImageView *)titleView {
  92 + if (!_titleView) {
  93 + _titleView = [[UIImageView alloc] initWithFrame:CGRectMake((KScreenWidth-instance.contentImgSize.width)*0.5, instance.arrowsView.bottom+10, instance.contentImgSize.width, instance.contentImgSize.height)];
  94 + _titleView.image = [UIImage loadBundleImage:instance.contentImgName];
  95 + }
  96 + return _titleView;
  97 +}
  98 +
  99 +- (UIButton *)cancelBtn {
  100 + if (!_cancelBtn) {
  101 + _cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  102 + _cancelBtn.frame = CGRectMake((KScreenWidth-96)*0.5, 410.0*KScreenHeight/667.0, 96, 39);
  103 + [_cancelBtn setImage:[UIImage loadBundleImage:@"mjzgx_an"] forState:UIControlStateNormal];
  104 + [_cancelBtn addTarget:self action:@selector(cancelAction:) forControlEvents:UIControlEventTouchUpInside];
  105 + }
  106 + return _cancelBtn;
  107 +}
  108 +
  109 +@end
Example/CNLiveVideoClassifyKit.xcodeproj/project.pbxproj
@@ -579,9 +579,11 @@ @@ -579,9 +579,11 @@
579 buildSettings = { 579 buildSettings = {
580 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 580 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
581 DEVELOPMENT_TEAM = 94X49GG3ZW; 581 DEVELOPMENT_TEAM = 94X49GG3ZW;
  582 + ENABLE_BITCODE = NO;
582 GCC_PRECOMPILE_PREFIX_HEADER = YES; 583 GCC_PRECOMPILE_PREFIX_HEADER = YES;
583 GCC_PREFIX_HEADER = "CNLiveVideoClassifyKit/CNLiveVideoClassifyKit-prefix.pch"; 584 GCC_PREFIX_HEADER = "CNLiveVideoClassifyKit/CNLiveVideoClassifyKit-prefix.pch";
584 INFOPLIST_FILE = "CNLiveVideoClassifyKit/CNLiveVideoClassifyKit-Info.plist"; 585 INFOPLIST_FILE = "CNLiveVideoClassifyKit/CNLiveVideoClassifyKit-Info.plist";
  586 + IPHONEOS_DEPLOYMENT_TARGET = 10.0;
585 MARKETING_VERSION = 1.0; 587 MARKETING_VERSION = 1.0;
586 MODULE_NAME = ExampleApp; 588 MODULE_NAME = ExampleApp;
587 PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 589 PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
@@ -597,9 +599,11 @@ @@ -597,9 +599,11 @@
597 buildSettings = { 599 buildSettings = {
598 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 600 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
599 DEVELOPMENT_TEAM = 94X49GG3ZW; 601 DEVELOPMENT_TEAM = 94X49GG3ZW;
  602 + ENABLE_BITCODE = NO;
600 GCC_PRECOMPILE_PREFIX_HEADER = YES; 603 GCC_PRECOMPILE_PREFIX_HEADER = YES;
601 GCC_PREFIX_HEADER = "CNLiveVideoClassifyKit/CNLiveVideoClassifyKit-prefix.pch"; 604 GCC_PREFIX_HEADER = "CNLiveVideoClassifyKit/CNLiveVideoClassifyKit-prefix.pch";
602 INFOPLIST_FILE = "CNLiveVideoClassifyKit/CNLiveVideoClassifyKit-Info.plist"; 605 INFOPLIST_FILE = "CNLiveVideoClassifyKit/CNLiveVideoClassifyKit-Info.plist";
  606 + IPHONEOS_DEPLOYMENT_TARGET = 10.0;
603 MARKETING_VERSION = 1.0; 607 MARKETING_VERSION = 1.0;
604 MODULE_NAME = ExampleApp; 608 MODULE_NAME = ExampleApp;
605 PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 609 PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
Example/CNLiveVideoClassifyKit/CNLIVEViewController.m
@@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
17 #import <CNLiveNetworking.h> 17 #import <CNLiveNetworking.h>
18 #import <CNLiveCommonCategory/CNLiveCommonCategory.h> 18 #import <CNLiveCommonCategory/CNLiveCommonCategory.h>
19 #import <MJExtension.h> 19 #import <MJExtension.h>
  20 +#import <CNLiveBeeHive/CNLiveBeeHive.h>
20 #import "CNTools.h" 21 #import "CNTools.h"
21 22
22 23
@@ -40,7 +41,7 @@ @@ -40,7 +41,7 @@
40 - (void)viewDidLoad 41 - (void)viewDidLoad
41 { 42 {
42 [super viewDidLoad]; 43 [super viewDidLoad];
43 - 44 + [BHConfig set:ChannelsSelectFirst value:@"0"];
44 [CNTools GetClassifyChannelsUrlsAndSave]; 45 [CNTools GetClassifyChannelsUrlsAndSave];
45 self.title = @"首页"; 46 self.title = @"首页";
46 segArr = @[@"分类"]; 47 segArr = @[@"分类"];
Example/CNLiveVideoClassifyKit/CNLiveClassifyKitImpl.h
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 // 7 //
8 8
9 #import <Foundation/Foundation.h> 9 #import <Foundation/Foundation.h>
10 -#import <CNLiveVideoClassifyKit/CNLiveVideoClassifyProtocol.h> 10 +#import <CNLiveVideoClassifyKit/CNLivevideoClassifyPCH.h>
11 11
12 NS_ASSUME_NONNULL_BEGIN 12 NS_ASSUME_NONNULL_BEGIN
13 13
Example/CNLiveVideoClassifyKit/CNLiveClassifyKitImpl.m
@@ -42,4 +42,21 @@ @@ -42,4 +42,21 @@
42 } 42 }
43 43
44 } 44 }
  45 +-(UIView *)showViewOrPushVCWithCurrentVC:(UIViewController *)currentVC
  46 + pushType:(CNLiveClassifyJumpType)type pageType:(NSInteger)pageType param:(NSDictionary *_Nullable)param {
  47 + return [UIView new];
  48 +}
  49 +-(BOOL)audioPlayerIsplaying
  50 +{
  51 + return YES;
  52 +}
  53 +
  54 +-(void)popOverShowEvent:(UIEvent *)event
  55 + imageDone:(FTPopDoneBlock)doneBlock
  56 + dismissBlock:(FTPopDismissBlock)dismissBlock{
  57 +
  58 +}
  59 +-(void)showGuideShadeViewType:(NSInteger)type cellFrame:(CGRect)cellFrame cancelBlock:(FTPopDismissBlock)cancelBlock{
  60 +
  61 +}
45 @end 62 @end
Example/CNLiveVideoClassifyKit/CNLiveWebViewModuleImpl.m
@@ -50,7 +50,7 @@ @@ -50,7 +50,7 @@
50 WebBridge:(WKWebViewJavascriptBridge *)webBridge 50 WebBridge:(WKWebViewJavascriptBridge *)webBridge
51 FromVC:(CNLiveWebViewController *)fromVC 51 FromVC:(CNLiveWebViewController *)fromVC
52 ResultData:(id)resultData 52 ResultData:(id)resultData
53 - CompleterBlock:(nonnull void (^)(id _Nonnull))completerBlock 53 + CompleterBlock:( void (^)(id _Nonnull))completerBlock
54 { 54 {
55 NSLog(@"交互方法响应了=>%@ 参数=>%@",handleName,resultData); 55 NSLog(@"交互方法响应了=>%@ 参数=>%@",handleName,resultData);
56 if ([handleName isEqualToString:kCNLiveWebForJSRegisterKWIdentifier]) { 56 if ([handleName isEqualToString:kCNLiveWebForJSRegisterKWIdentifier]) {
Example/Podfile
@@ -26,6 +26,17 @@ target &#39;CNLiveVideoClassifyKit_Example&#39; do @@ -26,6 +26,17 @@ target &#39;CNLiveVideoClassifyKit_Example&#39; do
26 #删除WebViewJavascriptBridge中的WebViewJavascriptBridge.h和WebViewJavascriptBridge.m文件 26 #删除WebViewJavascriptBridge中的WebViewJavascriptBridge.h和WebViewJavascriptBridge.m文件
27 ################################################# 27 #################################################
28 end 28 end
  29 +
  30 + post_install do |installer_representation|
  31 + installer_representation.pods_project.targets.each do |target|
  32 + target.build_configurations.each do |config|
  33 + #share使用pod库时,pod中包含[UIApplication sharedApplication]的代码,需要下面的配置
  34 + config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
  35 + config.build_settings['ENABLE_BITCODE'] = false
  36 + end
  37 + end
  38 + end
  39 +
29 target 'CNLiveVideoClassifyKit_Tests' do 40 target 'CNLiveVideoClassifyKit_Tests' do
30 inherit! :search_paths 41 inherit! :search_paths
31 42