CNLiveListManager.m
2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//
// CNLiveListManager.m
// CNLiveVideoClassifyKit
//
// Created by CNLive on 2021/9/8.
//
#import "CNLiveListManager.h"
#import "CNCategoryGetChannelModel.h"
#import <CNLiveCWebViewModule/CNLiveCWebViewModule.h>
#import <CNLiveCWebViewModule/CNLiveSubWebViewController.h>
#import "CNLiveVideoClassifyProtocol.h"
@interface CNLiveListManager()
{
BOOL _black;
CNCategoryGetChannelModel *_model;
CGFloat beginoffsetY;
}
@end
@implementation CNLiveListManager
+(instancetype)shareListManager
{
static dispatch_once_t onceToken;
static CNLiveListManager *manager = nil;
dispatch_once(&onceToken, ^{
manager = [[CNLiveListManager alloc] init];
});
return manager;
}
-(void)model:(CNCategoryGetChannelModel *)model black:(BOOL)black
{
_model = model;
_black = black;
}
- (void)requestWebViewForScrollView:(nonnull UIScrollView *)scrollView isBeginDragging:(BOOL)isBeginDragging
{
if (isBeginDragging) {
beginoffsetY = scrollView.offsetY;
}else
{
if (scrollView.offsetY - beginoffsetY>2) {
!self.scrollViewDidScrollBlock ?: self.scrollViewDidScrollBlock(YES);
}else if (scrollView.offsetY - beginoffsetY<-2) {
!self.scrollViewDidScrollBlock ?: self.scrollViewDidScrollBlock(NO);
}
}
}
#pragma mark - JXCategoryListContentViewDelegate
/**
实现 <JXCategoryListContentViewDelegate> 协议方法,返回该视图控制器所拥有的「视图」
*/
- (UIView *)listView {
if ([_model.pageType isEqualToString:@"4"] || [_model.pageType isEqualToString:@"5"]){
Class class = NSClassFromString(@"CNLiveClassifyKitImpl");
// [[BeeHive shareInstance] registerService:cnlivevid service:<#(__unsafe_unretained Class)#>];
}
NSDictionary * paramDic= @{
@"title": _model.showName,
@"intercept": @(YES),
@"isBlack":@(_black)
};
CNLiveSubWebViewController *subVC = [CNLiveCWebViewModule showWebVCWithLunchForWebURL:_model.thirdUrl
ParamDict:paramDic ShowType:CNLiveWebViewLunchShowTypeHidden];
[self.contentVC addChildViewController:subVC];
return subVC.view;
}
@end