Commit 6a779669ec8e81bf5ded66a2b5424520aa0e93e8
1 parent
a448c4cc
no message
Showing
13 changed files
with
106 additions
and
30 deletions
CNLiveVideoClassifyKit.podspec
| ... | ... | @@ -45,11 +45,9 @@ TODO: Add long description of the pod here. |
| 45 | 45 | s.dependency 'CNLiveBaseClass' |
| 46 | 46 | s.dependency 'CNLiveUserManagement' |
| 47 | 47 | s.dependency 'CNLiveCommonCategory' |
| 48 | - s.dependency 'CNLiveCWebViewModule' | |
| 49 | 48 | s.dependency 'CNLiveBeeHive' |
| 50 | 49 | s.dependency 'CNLiveTripartiteManagement/SDWebImage' |
| 51 | 50 | s.dependency 'CNLiveTripartiteManagement/Masonry' |
| 52 | 51 | s.dependency 'CNLiveTripartiteManagement/YYKit' |
| 53 | - s.dependency 'CNLiveTripartiteManagement/QMUIKit' | |
| 54 | 52 | |
| 55 | 53 | end | ... | ... |
CNLiveVideoClassifyKit/Classes/Controller/CNCategoryBaseViewController.m
CNLiveVideoClassifyKit/Classes/Controller/CNLiveClassifySegmentController.m
| ... | ... | @@ -530,14 +530,14 @@ static CGFloat moveHeight = 50; |
| 530 | 530 | subVC.isBlack = isBlack; |
| 531 | 531 | weakself |
| 532 | 532 | subVC.scrollViewDidScrollBlock = ^(BOOL isUp) { |
| 533 | - [self scrollViewUpDowm:isUp]; | |
| 533 | + [weakSelf scrollViewUpDowm:isUp]; | |
| 534 | 534 | }; |
| 535 | 535 | |
| 536 | 536 | return subVC; |
| 537 | 537 | } |
| 538 | 538 | self.topBgImg.frame = CGRectMake(0, 0, KScreenWidth, self.topBgImgHeight - 50); |
| 539 | 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 | 541 | list.contentVC = self; |
| 542 | 542 | weakself |
| 543 | 543 | list.scrollViewDidScrollBlock = ^(BOOL isUp) { | ... | ... |
CNLiveVideoClassifyKit/Classes/Controller/CNLiveSubSegmentController.m
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | @property (nonatomic, strong)UIColor *textColor; |
| 18 | 18 | @property (nonatomic, strong)UIColor *backgroundColor; |
| 19 | 19 | @property (nonatomic, strong)NSString *backImage; |
| 20 | +@property (nonatomic, strong)NSString *backImageH5; | |
| 20 | 21 | |
| 21 | 22 | |
| 22 | 23 | @end |
| ... | ... | @@ -43,7 +44,7 @@ |
| 43 | 44 | { |
| 44 | 45 | self.backgroundColor = CNLiveColorWithHexString(@"#FFFFFF"); |
| 45 | 46 | } |
| 46 | - | |
| 47 | + self.backImageH5 = model.backgroundImgH5; | |
| 47 | 48 | self.backImage = model.backgroundImg; |
| 48 | 49 | |
| 49 | 50 | } |
| ... | ... | @@ -141,7 +142,7 @@ |
| 141 | 142 | { |
| 142 | 143 | CNCategoryGetChannelModel *model = self.pageListArr[index]; |
| 143 | 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 | 146 | list.contentVC = self; |
| 146 | 147 | weakself |
| 147 | 148 | list.scrollViewDidScrollBlock = ^(BOOL isUp) { | ... | ... |
CNLiveVideoClassifyKit/Classes/Header/CNLivevideoClassifyPCH.h
CNLiveVideoClassifyKit/Classes/Manager/CNLiveClassifyJumpBridge.h
| ... | ... | @@ -6,12 +6,16 @@ |
| 6 | 6 | // |
| 7 | 7 | |
| 8 | 8 | #import <Foundation/Foundation.h> |
| 9 | -# | |
| 9 | +#import "CNLiveVideoClassifyProtocol.h" | |
| 10 | 10 | |
| 11 | 11 | NS_ASSUME_NONNULL_BEGIN |
| 12 | 12 | |
| 13 | 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 | 19 | @end |
| 16 | 20 | |
| 17 | 21 | NS_ASSUME_NONNULL_END | ... | ... |
CNLiveVideoClassifyKit/Classes/Manager/CNLiveClassifyJumpBridge.m
| ... | ... | @@ -7,6 +7,30 @@ |
| 7 | 7 | |
| 8 | 8 | #import "CNLiveClassifyJumpBridge.h" |
| 9 | 9 | |
| 10 | + | |
| 10 | 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 | 36 | @end | ... | ... |
CNLiveVideoClassifyKit/Classes/Manager/CNLiveListManager.h
| ... | ... | @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN |
| 16 | 16 | |
| 17 | 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 | 21 | - (void)requestWebViewForScrollView:(nonnull UIScrollView *)scrollView isBeginDragging:(BOOL)isBeginDragging; |
| 22 | 22 | @end | ... | ... |
CNLiveVideoClassifyKit/Classes/Manager/CNLiveListManager.m
| ... | ... | @@ -9,13 +9,13 @@ |
| 9 | 9 | #import "CNCategoryGetChannelModel.h" |
| 10 | 10 | #import <CNLiveCWebViewModule/CNLiveCWebViewModule.h> |
| 11 | 11 | #import <CNLiveCWebViewModule/CNLiveSubWebViewController.h> |
| 12 | -#import "CNLiveVideoClassifyProtocol.h" | |
| 13 | 12 | |
| 14 | 13 | @interface CNLiveListManager() |
| 15 | 14 | { |
| 16 | 15 | BOOL _black; |
| 17 | 16 | CNCategoryGetChannelModel *_model; |
| 18 | 17 | CGFloat beginoffsetY; |
| 18 | + NSString *_backImage, *_backColor ,*_backImageH5; | |
| 19 | 19 | } |
| 20 | 20 | @end |
| 21 | 21 | |
| ... | ... | @@ -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 | 36 | _model = model; |
| 37 | 37 | _black = black; |
| 38 | + _backImage = bgImage; | |
| 39 | + _backColor = bgColor; | |
| 40 | + _backImageH5 = bgImageH5; | |
| 38 | 41 | } |
| 39 | 42 | - (void)requestWebViewForScrollView:(nonnull UIScrollView *)scrollView isBeginDragging:(BOOL)isBeginDragging |
| 40 | 43 | { |
| ... | ... | @@ -57,18 +60,28 @@ |
| 57 | 60 | 实现 <JXCategoryListContentViewDelegate> 协议方法,返回该视图控制器所拥有的「视图」 |
| 58 | 61 | */ |
| 59 | 62 | - (UIView *)listView { |
| 63 | + NSDictionary * paramDic = nil; | |
| 60 | 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 | 85 | [self.contentVC addChildViewController:subVC]; |
| 73 | 86 | return subVC.view; |
| 74 | 87 | } | ... | ... |
CNLiveVideoClassifyKit/Classes/Manager/CNLiveVideoClassifyProtocol.h
| ... | ... | @@ -2,15 +2,21 @@ |
| 2 | 2 | // CNLiveVideoClassifyProtocol.h |
| 3 | 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 | 8 | #import <Foundation/Foundation.h> |
| 9 | 9 | |
| 10 | +NS_ASSUME_NONNULL_BEGIN | |
| 10 | 11 | |
| 11 | 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 | 20 | @end |
| 16 | 21 | |
| 22 | +NS_ASSUME_NONNULL_END | ... | ... |
Example/CNLiveVideoClassifyKit/CNLIVEDemoViewController.h
Example/CNLiveVideoClassifyKit/CNLIVEViewController.h
Example/CNLiveVideoClassifyKit/CNLiveClassifyKitImpl.m
| ... | ... | @@ -8,12 +8,38 @@ |
| 8 | 8 | |
| 9 | 9 | #import "CNLiveClassifyKitImpl.h" |
| 10 | 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 | 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 | 45 | @end | ... | ... |