Commit 6a779669ec8e81bf5ded66a2b5424520aa0e93e8

Authored by yanglingyu
1 parent a448c4cc

no message

CNLiveVideoClassifyKit.podspec
@@ -45,11 +45,9 @@ TODO: Add long description of the pod here. @@ -45,11 +45,9 @@ TODO: Add long description of the pod here.
45 s.dependency 'CNLiveBaseClass' 45 s.dependency 'CNLiveBaseClass'
46 s.dependency 'CNLiveUserManagement' 46 s.dependency 'CNLiveUserManagement'
47 s.dependency 'CNLiveCommonCategory' 47 s.dependency 'CNLiveCommonCategory'
48 - s.dependency 'CNLiveCWebViewModule'  
49 s.dependency 'CNLiveBeeHive' 48 s.dependency 'CNLiveBeeHive'
50 s.dependency 'CNLiveTripartiteManagement/SDWebImage' 49 s.dependency 'CNLiveTripartiteManagement/SDWebImage'
51 s.dependency 'CNLiveTripartiteManagement/Masonry' 50 s.dependency 'CNLiveTripartiteManagement/Masonry'
52 s.dependency 'CNLiveTripartiteManagement/YYKit' 51 s.dependency 'CNLiveTripartiteManagement/YYKit'
53 - s.dependency 'CNLiveTripartiteManagement/QMUIKit'  
54 52
55 end 53 end
CNLiveVideoClassifyKit/Classes/Controller/CNCategoryBaseViewController.m
@@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
17 17
18 - (void)viewDidLoad { 18 - (void)viewDidLoad {
19 [super viewDidLoad]; 19 [super viewDidLoad];
  20 +
20 [self.view addSubview: self.categoryView]; 21 [self.view addSubview: self.categoryView];
21 [self.view addSubview:self.listContainerView]; 22 [self.view addSubview:self.listContainerView];
22 self.view.backgroundColor = [UIColor whiteColor]; 23 self.view.backgroundColor = [UIColor whiteColor];
CNLiveVideoClassifyKit/Classes/Controller/CNLiveClassifySegmentController.m
@@ -530,14 +530,14 @@ static CGFloat moveHeight = 50; @@ -530,14 +530,14 @@ static CGFloat moveHeight = 50;
530 subVC.isBlack = isBlack; 530 subVC.isBlack = isBlack;
531 weakself 531 weakself
532 subVC.scrollViewDidScrollBlock = ^(BOOL isUp) { 532 subVC.scrollViewDidScrollBlock = ^(BOOL isUp) {
533 - [self scrollViewUpDowm:isUp]; 533 + [weakSelf scrollViewUpDowm:isUp];
534 }; 534 };
535 535
536 return subVC; 536 return subVC;
537 } 537 }
538 self.topBgImg.frame = CGRectMake(0, 0, KScreenWidth, self.topBgImgHeight - 50); 538 self.topBgImg.frame = CGRectMake(0, 0, KScreenWidth, self.topBgImgHeight - 50);
539 CNLiveListManager *list = [CNLiveListManager shareListManager]; 539 CNLiveListManager *list = [CNLiveListManager shareListManager];
540 - [list model:model black:isBlack]; 540 + [list model:model black:isBlack bgImage:[self.bgImages safetyObjectAtIndex:index] bgColor:model.backgroundColor bgImageH5:model.backgroundImgH5];
541 list.contentVC = self; 541 list.contentVC = self;
542 weakself 542 weakself
543 list.scrollViewDidScrollBlock = ^(BOOL isUp) { 543 list.scrollViewDidScrollBlock = ^(BOOL isUp) {
CNLiveVideoClassifyKit/Classes/Controller/CNLiveSubSegmentController.m
@@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
17 @property (nonatomic, strong)UIColor *textColor; 17 @property (nonatomic, strong)UIColor *textColor;
18 @property (nonatomic, strong)UIColor *backgroundColor; 18 @property (nonatomic, strong)UIColor *backgroundColor;
19 @property (nonatomic, strong)NSString *backImage; 19 @property (nonatomic, strong)NSString *backImage;
  20 +@property (nonatomic, strong)NSString *backImageH5;
20 21
21 22
22 @end 23 @end
@@ -43,7 +44,7 @@ @@ -43,7 +44,7 @@
43 { 44 {
44 self.backgroundColor = CNLiveColorWithHexString(@"#FFFFFF"); 45 self.backgroundColor = CNLiveColorWithHexString(@"#FFFFFF");
45 } 46 }
46 - 47 + self.backImageH5 = model.backgroundImgH5;
47 self.backImage = model.backgroundImg; 48 self.backImage = model.backgroundImg;
48 49
49 } 50 }
@@ -141,7 +142,7 @@ @@ -141,7 +142,7 @@
141 { 142 {
142 CNCategoryGetChannelModel *model = self.pageListArr[index]; 143 CNCategoryGetChannelModel *model = self.pageListArr[index];
143 CNLiveListManager *list = [CNLiveListManager shareListManager]; 144 CNLiveListManager *list = [CNLiveListManager shareListManager];
144 - [list model:model black:_isBlack]; 145 + [list model:model black:_isBlack bgImage:self.backImage bgColor:self.backgroundColor bgImageH5:self.backImageH5];
145 list.contentVC = self; 146 list.contentVC = self;
146 weakself 147 weakself
147 list.scrollViewDidScrollBlock = ^(BOOL isUp) { 148 list.scrollViewDidScrollBlock = ^(BOOL isUp) {
CNLiveVideoClassifyKit/Classes/Header/CNLivevideoClassifyPCH.h
@@ -24,6 +24,7 @@ @@ -24,6 +24,7 @@
24 #import <QMUIKit/QMUIKit.h> 24 #import <QMUIKit/QMUIKit.h>
25 #import "UIImage+AdBundleImage.h" 25 #import "UIImage+AdBundleImage.h"
26 #import "CNLiveClassifySegmentController.h" 26 #import "CNLiveClassifySegmentController.h"
  27 +#import "CNLiveClassifyJumpBridge.h"
27 28
28 29
29 #endif /* CNLivevideoClassifyPCH_h */ 30 #endif /* CNLivevideoClassifyPCH_h */
CNLiveVideoClassifyKit/Classes/Manager/CNLiveClassifyJumpBridge.h
@@ -6,12 +6,16 @@ @@ -6,12 +6,16 @@
6 // 6 //
7 7
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 -# 9 +#import "CNLiveVideoClassifyProtocol.h"
10 10
11 NS_ASSUME_NONNULL_BEGIN 11 NS_ASSUME_NONNULL_BEGIN
12 12
13 @interface CNLiveClassifyJumpBridge : NSObject 13 @interface CNLiveClassifyJumpBridge : NSObject
14 -@p 14 +@property (nonatomic, weak) id<CNLiveVideoClassifyProtocol> protocol;
  15 +
  16 ++(instancetype)shareInstance;
  17 +
  18 ++(UIViewController *)ListViewWithPageType:(NSInteger)pageType param:(NSDictionary *_Nullable)param;
15 @end 19 @end
16 20
17 NS_ASSUME_NONNULL_END 21 NS_ASSUME_NONNULL_END
CNLiveVideoClassifyKit/Classes/Manager/CNLiveClassifyJumpBridge.m
@@ -7,6 +7,30 @@ @@ -7,6 +7,30 @@
7 7
8 #import "CNLiveClassifyJumpBridge.h" 8 #import "CNLiveClassifyJumpBridge.h"
9 9
  10 +
10 @implementation CNLiveClassifyJumpBridge 11 @implementation CNLiveClassifyJumpBridge
  12 ++(instancetype)shareInstance
  13 +{
  14 + static dispatch_once_t onceToken;
  15 + static CNLiveClassifyJumpBridge *bridge = nil;
  16 + dispatch_once(&onceToken, ^{
  17 + bridge = [[CNLiveClassifyJumpBridge alloc] init];
  18 + });
  19 + return bridge;
  20 +}
  21 +-(instancetype)init
  22 +{
  23 + self = [super init];
  24 + if (self) {
  25 + Class class = NSClassFromString(@"CNLiveClassifyKitImpl");
  26 + self.protocol = [CNLiveVideoClassifyProtocol Protocol];
  27 + [[BeeHive shareInstance] registerService:self.protocol service:class];
  28 + }
  29 + return self;
  30 +}
11 31
  32 ++(UIViewController *)ListViewWithPageType:(NSInteger)pageType param:(NSDictionary *)param
  33 +{
  34 + return [[CNLiveClassifyJumpBridge shareInstance].protocol listViewShowPageType:pageType param:param];
  35 +}
12 @end 36 @end
CNLiveVideoClassifyKit/Classes/Manager/CNLiveListManager.h
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
16 16
17 +(instancetype)shareListManager; 17 +(instancetype)shareListManager;
18 18
19 --(void)model:(CNCategoryGetChannelModel *)model black:(BOOL)black; 19 +-(void)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 @end 22 @end
CNLiveVideoClassifyKit/Classes/Manager/CNLiveListManager.m
@@ -9,13 +9,13 @@ @@ -9,13 +9,13 @@
9 #import "CNCategoryGetChannelModel.h" 9 #import "CNCategoryGetChannelModel.h"
10 #import <CNLiveCWebViewModule/CNLiveCWebViewModule.h> 10 #import <CNLiveCWebViewModule/CNLiveCWebViewModule.h>
11 #import <CNLiveCWebViewModule/CNLiveSubWebViewController.h> 11 #import <CNLiveCWebViewModule/CNLiveSubWebViewController.h>
12 -#import "CNLiveVideoClassifyProtocol.h"  
13 12
14 @interface CNLiveListManager() 13 @interface CNLiveListManager()
15 { 14 {
16 BOOL _black; 15 BOOL _black;
17 CNCategoryGetChannelModel *_model; 16 CNCategoryGetChannelModel *_model;
18 CGFloat beginoffsetY; 17 CGFloat beginoffsetY;
  18 + NSString *_backImage, *_backColor ,*_backImageH5;
19 } 19 }
20 @end 20 @end
21 21
@@ -31,10 +31,13 @@ @@ -31,10 +31,13 @@
31 } 31 }
32 32
33 33
34 --(void)model:(CNCategoryGetChannelModel *)model black:(BOOL)black 34 +-(void)model:(CNCategoryGetChannelModel *)model black:(BOOL)black bgImage:(NSString *)bgImage bgColor:(nonnull NSString *)bgColor bgImageH5:(nonnull NSString *)bgImageH5
35 { 35 {
36 _model = model; 36 _model = model;
37 _black = black; 37 _black = black;
  38 + _backImage = bgImage;
  39 + _backColor = bgColor;
  40 + _backImageH5 = bgImageH5;
38 } 41 }
39 - (void)requestWebViewForScrollView:(nonnull UIScrollView *)scrollView isBeginDragging:(BOOL)isBeginDragging 42 - (void)requestWebViewForScrollView:(nonnull UIScrollView *)scrollView isBeginDragging:(BOOL)isBeginDragging
40 { 43 {
@@ -57,18 +60,28 @@ @@ -57,18 +60,28 @@
57 实现 <JXCategoryListContentViewDelegate> 协议方法,返回该视图控制器所拥有的「视图」 60 实现 <JXCategoryListContentViewDelegate> 协议方法,返回该视图控制器所拥有的「视图」
58 */ 61 */
59 - (UIView *)listView { 62 - (UIView *)listView {
  63 + NSDictionary * paramDic = nil;
60 if ([_model.pageType isEqualToString:@"4"] || [_model.pageType isEqualToString:@"5"]){ 64 if ([_model.pageType isEqualToString:@"4"] || [_model.pageType isEqualToString:@"5"]){
61 - Class class = NSClassFromString(@"CNLiveClassifyKitImpl");  
62 -// [[BeeHive shareInstance] registerService:cnlivevid service:<#(__unsafe_unretained Class)#>]; 65 + paramDic= @{
  66 + @"title": _model.showName?_model.showName:@"",
  67 + @"bgColor": _backColor?_backColor:@"",
  68 + @"isBlack":@(_black),
  69 + @"backgroundImg": _backImage?_backImage:@"",
  70 + @"channelId":_model.channelId?_model.channelId:@"",
  71 + @"channelName":_model.id?_model.id:@"",
  72 + @"pageId":_model.pageId?_model.pageId:@""
  73 +
  74 + };
  75 + }else{
  76 + paramDic= @{
  77 + @"title": _model.showName,
  78 + @"bgColor": _backColor,
  79 + @"isBlack":@(_black),
  80 + @"thirdUrl":_model.thirdUrl,
  81 + @"backgroundImgH5":_backImageH5
  82 + };
63 } 83 }
64 - NSDictionary * paramDic= @{  
65 - @"title": _model.showName,  
66 - @"intercept": @(YES),  
67 - @"isBlack":@(_black)  
68 -  
69 - };  
70 - CNLiveSubWebViewController *subVC = [CNLiveCWebViewModule showWebVCWithLunchForWebURL:_model.thirdUrl  
71 - ParamDict:paramDic ShowType:CNLiveWebViewLunchShowTypeHidden]; 84 + UIViewController *subVC = [CNLiveClassifyJumpBridge ListViewWithPageType:_model.pageType.integerValue param:paramDic];
72 [self.contentVC addChildViewController:subVC]; 85 [self.contentVC addChildViewController:subVC];
73 return subVC.view; 86 return subVC.view;
74 } 87 }
CNLiveVideoClassifyKit/Classes/Manager/CNLiveVideoClassifyProtocol.h
@@ -2,15 +2,21 @@ @@ -2,15 +2,21 @@
2 // CNLiveVideoClassifyProtocol.h 2 // CNLiveVideoClassifyProtocol.h
3 // CNLiveVideoClassifyKit 3 // CNLiveVideoClassifyKit
4 // 4 //
5 -// Created by CNLive on 2021/9/9. 5 +// Created by CNLive on 2021/9/10.
6 // 6 //
7 7
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 9
  10 +NS_ASSUME_NONNULL_BEGIN
10 11
11 @protocol CNLiveVideoClassifyProtocol <NSObject> 12 @protocol CNLiveVideoClassifyProtocol <NSObject>
12 -  
13 --(UIView *)listViewShowPageType:(NSUInteger)pageType param:(NSDictionary *)param;  
14 - 13 +/**
  14 + *返回需要加载的View
  15 + *pageType加载页面类型
  16 + *param 传给View的参数
  17 + */
  18 +-(UIViewController *)listViewShowPageType:(NSUInteger)pageType
  19 + param:(NSDictionary *)param;
15 @end 20 @end
16 21
  22 +NS_ASSUME_NONNULL_END
Example/CNLiveVideoClassifyKit/CNLIVEDemoViewController.h
@@ -7,10 +7,11 @@ @@ -7,10 +7,11 @@
7 // 7 //
8 8
9 #import <UIKit/UIKit.h> 9 #import <UIKit/UIKit.h>
  10 +#import <QMUIKit/QMUIKit.h>
10 11
11 NS_ASSUME_NONNULL_BEGIN 12 NS_ASSUME_NONNULL_BEGIN
12 13
13 -@interface CNLIVEDemoViewController : UIViewController 14 +@interface CNLIVEDemoViewController :QMUICommonViewController
14 15
15 @end 16 @end
16 17
Example/CNLiveVideoClassifyKit/CNLIVEViewController.h
@@ -7,7 +7,8 @@ @@ -7,7 +7,8 @@
7 // 7 //
8 8
9 @import UIKit; 9 @import UIKit;
  10 +#import <QMUIKit/QMUIKit.h>
10 11
11 -@interface CNLIVEViewController : UIViewController 12 +@interface CNLIVEViewController : QMUICommonViewController
12 13
13 @end 14 @end
Example/CNLiveVideoClassifyKit/CNLiveClassifyKitImpl.m
@@ -8,12 +8,38 @@ @@ -8,12 +8,38 @@
8 8
9 #import "CNLiveClassifyKitImpl.h" 9 #import "CNLiveClassifyKitImpl.h"
10 #import "CNLIVEDemoViewController.h" 10 #import "CNLIVEDemoViewController.h"
  11 +#import "CNLIVEViewController.h"
  12 +#import <CNLiveCWebViewModule/CNLiveCWebViewModule.h>
  13 +#import <CNLiveCWebViewModule/CNLiveSubWebViewController.h>
  14 +#import <CNLiveCommonCategory/NSString+CNLiveUrlEncode.h>
11 15
12 @implementation CNLiveClassifyKitImpl 16 @implementation CNLiveClassifyKitImpl
13 17
14 --(UIView *)listViewShowPageType:(NSUInteger)pageType param:(NSDictionary *)param 18 +-(UIViewController *)listViewShowPageType:(NSUInteger)pageType param:(NSDictionary *)param
15 { 19 {
16 - CNLIVEDemoViewController *demo = [CNLIVEDemoViewController new];  
17 - return demo.view; 20 + if (pageType == 4|| pageType == 5) {
  21 + CNLIVEDemoViewController *demo = [CNLIVEDemoViewController new];
  22 + return demo;
  23 + }else if (pageType == 2){
  24 + CNLIVEViewController *demo = [CNLIVEViewController new];
  25 + return demo;
  26 + }else if (pageType == 7){
  27 + CNLIVEViewController *demo = [CNLIVEViewController new];
  28 + return demo;
  29 + }else{
  30 + NSString *thirdUrl = param[@"thirdUrl"];
  31 + NSString *backgroundColor = param[@"backgroundColor"];
  32 + NSString *backImageH5 = param[@"backgroundImgH5"];
  33 + if (!CNLiveStringIsEmpty(thirdUrl)) {
  34 + NSString *andStr = @"&";
  35 + if (![thirdUrl cn_containsString:@"?"]) {
  36 + andStr = @"?";
  37 + }
  38 + thirdUrl = [thirdUrl stringByAppendingFormat:@"%@backgroundColor=%@&backgroundImgH5=%@",andStr,backgroundColor?[backgroundColor urlEncode]:@"",backImageH5?[backImageH5 urlEncode]:@""];
  39 + }
  40 + CNLiveSubWebViewController *subVC = [CNLiveCWebViewModule showWebVCWithLunchForWebURL:thirdUrl ParamDict:param ShowType:CNLiveWebViewLunchShowTypeHidden];
  41 + return subVC;
  42 + }
  43 +
18 } 44 }
19 @end 45 @end