Commit 86930834f697ebfdd2d554e130eafbd91f5a4294

Authored by yanglingyu
1 parent a59f0ce2

no message

CNLiveVideoClassifyKit/Classes/Controller/CNLiveClassifySegmentController.m
... ... @@ -399,12 +399,6 @@ static CGFloat moveHeight = 50;
399 399 }
400 400 }
401 401 }
402   -- (void)listScrollViewDidScroll:(UIScrollView *)scrollView {
403   - CGPoint point = scrollView.contentOffset;
404   - CGFloat offsetY = point.y - self.lastOffsetY;
405   -
406   - [self scrollViewUpDowm:offsetY>0?YES:NO];
407   -}
408 402 -(void)scrollViewUpDowm:(BOOL)isUp
409 403 {
410 404 [UIView animateWithDuration:0.3 animations:^{
... ... @@ -535,23 +529,19 @@ static CGFloat moveHeight = 50;
535 529 CNLiveSubSegmentController *subVC = [[CNLiveSubSegmentController alloc] initWithModel:model];
536 530 subVC.isBlack = isBlack;
537 531 weakself
538   - subVC.scrollViewDidScrollBlock = ^(UIScrollView * _Nonnull scrollView) {
539   - [weakSelf listScrollViewDidScroll:scrollView];
540   - };
541   - subVC.willBeginDragging = ^(CGFloat lastOffsetY) {
542   - weakSelf.lastOffsetY = lastOffsetY;
  532 + subVC.scrollViewDidScrollBlock = ^(BOOL isUp) {
  533 + [self scrollViewUpDowm:isUp];
543 534 };
  535 +
544 536 return subVC;
545 537 }
546 538 self.topBgImg.frame = CGRectMake(0, 0, KScreenWidth, self.topBgImgHeight - 50);
547   - CNLiveListManager *list = [[CNLiveListManager alloc] initWithModel:model black:isBlack];
  539 + CNLiveListManager *list = [[CNLiveListManager shareListManager] model:model black:isBlack];
548 540 weakself
549   - list.scrollViewDidScrollBlock = ^(UIScrollView * _Nonnull scrollView) {
550   - [weakSelf listScrollViewDidScroll:scrollView];
551   - };
552   - list.willBeginDragging = ^(CGFloat lastOffsetY) {
553   - weakSelf.lastOffsetY = lastOffsetY;
  541 + list.scrollViewDidScrollBlock = ^(BOOL isUp) {
  542 + [self scrollViewUpDowm:isUp];
554 543 };
  544 +
555 545 return list;
556 546 }
557 547 #pragma mark - Public
... ...
CNLiveVideoClassifyKit/Classes/Controller/CNLiveSubSegmentController.h
... ... @@ -15,8 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
15 15 @property (nonatomic, assign) BOOL isBlack;
16 16  
17 17 -(instancetype)initWithModel:(CNCategoryGetChannelModel *)model;
18   -@property (nonatomic, copy) void (^scrollViewDidScrollBlock)(UIScrollView *);
19   -@property (nonatomic, copy) void (^willBeginDragging)(CGFloat );
  18 +@property (nonatomic, copy) void (^scrollViewDidScrollBlock)(BOOL isUp);
20 19  
21 20 // 一级频道显示隐藏时二级频道右侧的搜索按钮变宽变窄控制
22 21 - (void)layoutRightSubViewWithShow:(BOOL)show;
... ...
CNLiveVideoClassifyKit/Classes/Controller/CNLiveSubSegmentController.m
... ... @@ -140,14 +140,12 @@
140 140 -(id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index
141 141 {
142 142 CNCategoryGetChannelModel *model = self.pageListArr[index];
143   - CNLiveListManager *list = [[CNLiveListManager alloc] initWithModel:model black:self.isBlack];
  143 + CNLiveListManager *list = [[CNLiveListManager shareListManager] model:model black:isBlack];
144 144 weakself
145   - list.scrollViewDidScrollBlock = ^(UIScrollView * _Nonnull scrollView) {
146   - !weakSelf.scrollViewDidScrollBlock ?: weakSelf.scrollViewDidScrollBlock(scrollView);
147   - };
148   - list.willBeginDragging = ^(CGFloat lastOffsetY) {
149   - !weakSelf.willBeginDragging ?: weakSelf.willBeginDragging(lastOffsetY);
150   - };
  145 + list.scrollViewDidScrollBlock = ^(BOOL isUp) {
  146 + !weakSelf.scrollViewDidScrollBlock ?: weakSelf.scrollViewDidScrollBlock(isUp);
  147 + }};
  148 +
151 149 return list;
152 150 }
153 151 #pragma mark - JXCategoryListContentViewDelegate
... ...
CNLiveVideoClassifyKit/Classes/Manager/CNLiveListManager.h
... ... @@ -11,10 +11,13 @@
11 11 NS_ASSUME_NONNULL_BEGIN
12 12  
13 13 @interface CNLiveListManager : NSObject<JXCategoryListContentViewDelegate>
14   -@property (nonatomic, copy) void (^scrollViewDidScrollBlock)(UIScrollView *);
15   -@property (nonatomic, copy) void (^willBeginDragging)(CGFloat);
  14 +@property (nonatomic, copy) void (^scrollViewDidScrollBlock)(BOOL isUp);
16 15  
17   --(instancetype)initWithModel:(CNCategoryGetChannelModel *)model black:(BOOL)black;
  16 ++(instancetype)shareListManager;
  17 +
  18 +-(void)model:(CNCategoryGetChannelModel *)model black:(BOOL)black;
  19 +
  20 +- (void)requestWebViewForScrollView:(nonnull UIScrollView *)scrollView isBeginDragging:(BOOL)isBeginDragging;
18 21 @end
19 22  
20 23 NS_ASSUME_NONNULL_END
... ...
CNLiveVideoClassifyKit/Classes/Manager/CNLiveListManager.m
... ... @@ -10,29 +10,37 @@
10 10 #import <CNLiveCWebViewModule/CNLiveCWebViewModule.h>
11 11 #import <CNLiveCWebViewModule/CNLiveSubWebViewController.h>
12 12  
13   -@interface CNLiveListManager()<UIScrollViewDelegate>
  13 +@interface CNLiveListManager()
14 14 {
15   - NSDictionary *_paramDic;
  15 + BOOL _black;
16 16 CNCategoryGetChannelModel *_model;
17 17 }
18 18 @end
19 19  
20 20 @implementation CNLiveListManager
21   --(instancetype)initWithModel:(CNCategoryGetChannelModel *)model black:(BOOL)black
  21 +
  22 ++(instancetype)shareListManager
22 23 {
23   - self = [super init];
24   - if (self) {
25   - _model = model;
26   - _paramDic = @{
27   - @"title": model.showName,
28   - @"intercept": @(YES),
29   - @"isBlack":@(black)
30   -
31   - };
32   - }
33   - return self;
  24 + static dispatch_once_t onceToken;
  25 + static CNLiveListManager *manager = nil;
  26 + dispatch_once(&onceToken, ^{
  27 + manager = [[CNLiveListManager alloc] init];
  28 + });
  29 + return manager;
34 30 }
35 31  
  32 +
  33 +-(void)model:(CNCategoryGetChannelModel *)model black:(BOOL)black
  34 +{
  35 + _model = model;
  36 + _black = black;
  37 +}
  38 +- (void)requestWebViewForScrollView:(nonnull UIScrollView *)scrollView isBeginDragging:(BOOL)isBeginDragging
  39 +{
  40 +
  41 +}
  42 +
  43 +
36 44 #pragma mark - JXCategoryListContentViewDelegate
37 45  
38 46 /**
... ... @@ -40,16 +48,28 @@
40 48 */
41 49 - (UIView *)listView {
42 50 if ([_model.pageType isEqualToString:@"4"] || [_model.pageType isEqualToString:@"5"]){
43   -
  51 + Class class = NSClassFromString(@"CNAmuseChinaViewController");
  52 + QMUICommonViewController *vc = [class new];
  53 + SEL black = NSSelectorFromString(@"setIsBlack");
  54 +// SEL bgColor = NSSelectorFromString(@"setBgColor");
  55 +// SEL title = NSSelectorFromString(@"setTitle");
  56 +// SEL backgroundImg = NSSelectorFromString(@"setBackgroundImg");
  57 +// SEL channelId = NSSelectorFromString(@"setChannelId");
  58 +// SEL channelName = NSSelectorFromString(@"setChannelName");
  59 +// SEL pageId = NSSelectorFromString(@"setPageId");
  60 +// SEL delegate = NSSelectorFromString(@"setDelegate");
  61 + [vc performSelector:black withObject:_model.statusBarColor];
  62 + return vc.view;
44 63 }
  64 + NSDictionary * paramDic= @{
  65 + @"title": model.showName,
  66 + @"intercept": @(YES),
  67 + @"isBlack":@(black)
  68 +
  69 + };
45 70 CNLiveSubWebViewController *subVC = [CNLiveCWebViewModule showWebVCWithLunchForWebURL:_model.thirdUrl
46   - ParamDict:_paramDic ShowType:CNLiveWebViewLunchShowTypeHidden];
47   -// for (UIView*subView in subVC.view.subviews) {
48   -// if ([subView isKindOfClass:[WKWebView class]]) {
49   -// WKWebView *webView = (WKWebView *)subView;
50   -// [webView.scrollView addObserver:self forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionOld context:NULL];
51   -// }
52   -// }
  71 + ParamDict:paramDic ShowType:CNLiveWebViewLunchShowTypeHidden];
  72 +
53 73  
54 74 return subVC.view;
55 75 }
... ...
CNLiveVideoClassifyKit/Classes/Manager/CNLiveVideoClassifyProtocol.h
... ... @@ -7,7 +7,6 @@
7 7 /* CNLiveVideoClassifyProtocol_h */
8 8 //
9 9  
10   -#imp
11 10 /**
12 11 *与主工程交互
13 12 */
... ...
Example/CNLiveVideoClassifyKit.xcodeproj/project.pbxproj
... ... @@ -9,6 +9,7 @@
9 9 /* Begin PBXBuildFile section */
10 10 083CB9C326D4ED2000E21EBC /* CNliveCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 0816338E26BE298900B076D6 /* CNliveCollectionViewCell.m */; };
11 11 08DAFBDE26E8A2660099999A /* CNTools.m in Sources */ = {isa = PBXBuildFile; fileRef = 08DAFBDC26E8A2660099999A /* CNTools.m */; };
  12 + 08DAFBE326E9B63F0099999A /* CNLiveWebViewModuleImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = 08DAFBE226E9B63F0099999A /* CNLiveWebViewModuleImpl.m */; };
12 13 14963F4E510A1E5865D15ED8 /* Pods_CNLiveVideoClassifyKit_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7743536FE5FB6796BFAA55B5 /* Pods_CNLiveVideoClassifyKit_Tests.framework */; };
13 14 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
14 15 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; };
... ... @@ -43,6 +44,8 @@
43 44 0816338E26BE298900B076D6 /* CNliveCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNliveCollectionViewCell.m; sourceTree = "<group>"; };
44 45 08DAFBDC26E8A2660099999A /* CNTools.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNTools.m; sourceTree = "<group>"; };
45 46 08DAFBDD26E8A2660099999A /* CNTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNTools.h; sourceTree = "<group>"; };
  47 + 08DAFBE126E9B63F0099999A /* CNLiveWebViewModuleImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveWebViewModuleImpl.h; sourceTree = "<group>"; };
  48 + 08DAFBE226E9B63F0099999A /* CNLiveWebViewModuleImpl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveWebViewModuleImpl.m; sourceTree = "<group>"; };
46 49 24BF123CDE580DC9CCCE1718 /* Pods-CNLiveVideoClassifyKit_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveVideoClassifyKit_Example.release.xcconfig"; path = "Target Support Files/Pods-CNLiveVideoClassifyKit_Example/Pods-CNLiveVideoClassifyKit_Example.release.xcconfig"; sourceTree = "<group>"; };
47 50 3A8AB8DB19B4EF9ACF33573D /* Pods-CNLiveVideoClassifyKit_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveVideoClassifyKit_Tests.release.xcconfig"; path = "Target Support Files/Pods-CNLiveVideoClassifyKit_Tests/Pods-CNLiveVideoClassifyKit_Tests.release.xcconfig"; sourceTree = "<group>"; };
48 51 5793570C0C400C4B3B4942CE /* Pods-CNLiveVideoClassifyKit_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveVideoClassifyKit_Example.debug.xcconfig"; path = "Target Support Files/Pods-CNLiveVideoClassifyKit_Example/Pods-CNLiveVideoClassifyKit_Example.debug.xcconfig"; sourceTree = "<group>"; };
... ... @@ -147,6 +150,8 @@
147 150 0816338E26BE298900B076D6 /* CNliveCollectionViewCell.m */,
148 151 08DAFBDD26E8A2660099999A /* CNTools.h */,
149 152 08DAFBDC26E8A2660099999A /* CNTools.m */,
  153 + 08DAFBE126E9B63F0099999A /* CNLiveWebViewModuleImpl.h */,
  154 + 08DAFBE226E9B63F0099999A /* CNLiveWebViewModuleImpl.m */,
150 155 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */,
151 156 6003F5A8195388D20070C39A /* Images.xcassets */,
152 157 6003F594195388D20070C39A /* Supporting Files */,
... ... @@ -428,6 +433,7 @@
428 433 6003F59E195388D20070C39A /* CNLIVEAppDelegate.m in Sources */,
429 434 6003F5A7195388D20070C39A /* CNLIVEViewController.m in Sources */,
430 435 6003F59A195388D20070C39A /* main.m in Sources */,
  436 + 08DAFBE326E9B63F0099999A /* CNLiveWebViewModuleImpl.m in Sources */,
431 437 08DAFBDE26E8A2660099999A /* CNTools.m in Sources */,
432 438 );
433 439 runOnlyForDeploymentPostprocessing = 0;
... ...
Example/CNLiveVideoClassifyKit/CNLiveWebViewModuleImpl.h 0 → 100644
  1 +//
  2 +// CNLiveWebViewModuleImpl.h
  3 +// CNLiveCWebViewModule_Example
  4 +//
  5 +// Created by open on 2021/1/15.
  6 +// Copyright © 2021 woshiliushiyu. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +#import <CNLiveCWebViewModule/CNLiveCWebViewModule.h>
  11 +#import <CNLiveCWebViewModule/CNLiveWebViewModuleHeader.h>
  12 +
  13 +NS_ASSUME_NONNULL_BEGIN
  14 +
  15 +@interface CNLiveWebViewModuleImpl : NSObject<CNLiveWebViewModuleProtocol>
  16 +
  17 +@end
  18 +
  19 +NS_ASSUME_NONNULL_END
... ...
Example/CNLiveVideoClassifyKit/CNLiveWebViewModuleImpl.m 0 → 100644
  1 +//
  2 +// CNLiveWebViewModuleImpl.m
  3 +// CNLiveCWebViewModule_Example
  4 +//
  5 +// Created by open on 2021/1/15.
  6 +// Copyright © 2021 woshiliushiyu. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveWebViewModuleImpl.h"
  10 +#import <CNLiveCWebViewModule/CNLiveWebViewModuleEnum.h>
  11 +#import <CNLiveVideoClassifyKit/CNLiveListManager.h>
  12 +
  13 +@implementation CNLiveWebViewModuleImpl
  14 +
  15 +/// 调用工程中复制Appdelegate参数方法
  16 +/// @param shareTaskId 分享动作方法
  17 +/// @param shareId 分享id
  18 +/// @param shareUrl 分享链接
  19 +-(void)requestWebViewShareContentShareTaskId:(NSString *)shareTaskId
  20 + ShareId:(NSString *)shareId
  21 + ShareUrl:(NSString *)shareUrl
  22 +{
  23 +
  24 +}
  25 +
  26 +/// 调用工程中分享功能
  27 +/// @param shareName 分享标题
  28 +/// @param shareDesc 分享描述
  29 +/// @param shareUrl 分享链接
  30 +/// @param shareImg 分享图片地址
  31 +/// @param imageArray 动作按钮图片集合
  32 +/// @param titleArray 动作按钮标题集合
  33 +/// @param fromType 调用平台
  34 +-(void)requestWebViewShareClickWithShareName:(NSString *)shareName
  35 + ShareDesc:(NSString *)shareDesc
  36 + ShareUrl:(NSString *)shareUrl
  37 + ShareImg:(NSString *)shareImg
  38 + ImageArray:(NSArray *)imageArray
  39 + TitleArray:(NSArray *)titleArray
  40 + PlatformType:(CNLiveWebSharePlatformType)fromType
  41 +{
  42 + NSLog(@"调用分享方法");
  43 +}
  44 +
  45 +/// 与H5交互方法
  46 +/// @param handleName 交互key通着这个值进行点击判别
  47 +/// @param webBridge 桥接文件
  48 +/// @param resultData 交互参数
  49 +-(void)requestWebViewBridgeClickWithHandlerName:(NSString *)handleName
  50 + WebBridge:(WKWebViewJavascriptBridge *)webBridge
  51 + FromVC:(CNLiveWebViewController *)fromVC
  52 + ResultData:(id)resultData
  53 + CompleterBlock:(nonnull void (^)(id _Nonnull))completerBlock
  54 +{
  55 + NSLog(@"交互方法响应了=>%@ 参数=>%@",handleName,resultData);
  56 + if ([handleName isEqualToString:kCNLiveWebForJSRegisterKWIdentifier]) {
  57 +
  58 + }
  59 +}
  60 +
  61 +/// 调用主工程中支付宝支付方法
  62 +/// @param contentURL 内容url
  63 +/// @param completerBlock 完成回调
  64 +-(BOOL)requestWebViewWithAlipayForContentUrl:(NSString *)contentURL
  65 + CompleterBlock:(void(^)(NSDictionary *result))completerBlock
  66 +{
  67 +
  68 + return YES;
  69 +}
  70 +
  71 +/// 目击者视频下载
  72 +/// @param videoURL 下载地址
  73 +-(void)requestWebViewDownLoadWitnessVideoWithVideoURL:(NSString *)videoURL
  74 +{
  75 +
  76 +}
  77 +
  78 +/// 设置跳转工程中其他界面的方法
  79 +/// @param contentURL 内容URL
  80 +-(void)requestWebViewSkipManagerForContentURL:(NSString *)contentURL
  81 +{
  82 +
  83 +}
  84 +
  85 +/// 设置跳转工程中其他界面的方法(输入)
  86 +/// @param inputURL 内容URL
  87 +-(void)requestWebViewSkipManagerForInputURL:(NSString *)inputURL
  88 +{
  89 +
  90 +}
  91 +
  92 +/// 通过设置改方法为YES 则工程中所有调用网页入口方法都会转为 requestWebViewWithSkipWebViewForWebURL:方法进行响应
  93 +-(BOOL)requestWebViewWithSkipNewWebViewOrJunBoWebView
  94 +{
  95 + return NO;
  96 +}
  97 +
  98 +/// 通过设置 requestWebViewWithSkipNewWebViewOrJunBoWebView 方法返回NO时调用改方法
  99 +/// @param webUrl 链接地址
  100 +/// @param paramDict 参数字典
  101 +/// @param showType 显示类型
  102 +-(CNLiveWebViewController *)requestWebViewWithSkipWebViewForWebURL:(NSString *)webUrl
  103 + ParamDict:(NSDictionary *)paramDict
  104 + ShowType:(CNLiveWebViewLunchShowType)showType
  105 +{
  106 + NSLog(@"用老webView跳转到这个地址=>%@",webUrl);
  107 + return [CNLiveWebViewController new];
  108 +}
  109 +
  110 +/// 获取注册JS方法回调,用于实现方法:
  111 +/// responseWebViewWithWebViewToJavascriptBridgeForBridgeName
  112 +/// responseWebViewWithJavascriptBridgeToWebViewForBridgeName
  113 +-(void)requestWebViewRegisterJavascriptBridgeMethod
  114 +{
  115 +
  116 +}
  117 +
  118 +- (void)requestWebViewForScrollView:(nonnull UIScrollView *)scrollView isBeginDragging:(BOOL)isBeginDragging {
  119 + [CNLiveListManager sha]
  120 +}
  121 +
  122 +
  123 +
  124 +@end
... ...
Example/CNLiveVideoClassifyKit/CNTools.m
... ... @@ -66,7 +66,7 @@ static NSString * const CNDarenDownloadShareSourceUrl = @&quot;CNDarenDownloadShareSo
66 66 [[NSNotificationCenter defaultCenter] postNotificationName:CNWjjClassifyChannelsRequestHideLoadingNotifiName object:nil userInfo:nil];
67 67 }
68 68 [CNTools manager].channelsRequesting = NO;
69   - [BHConFig set:ChannelsRequested boolValue:YES];
  69 + [BHConfig set:ChannelsRequested boolValue:YES];
70 70 }];
71 71  
72 72 }
... ...