CNLiveCServiceManagerBridge.m
2.86 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
76
77
78
//
// CNLiveCServiceManagerBridge.m
// CNLiveCServiceModule
//
// Created by CNLive on 2021/12/2.
//
#import "CNLiveCServiceManagerBridge.h"
#import "CNLiveServicePresent.h"
#import "CNLiveServiceVC.h"
@implementation CNLiveCServiceManagerBridge
+ (instancetype)shareManager{
static dispatch_once_t onceToken;
static CNLiveCServiceManagerBridge *bridge = nil;
dispatch_once(&onceToken, ^{
bridge = [[CNLiveCServiceManagerBridge alloc] init];
});
return bridge;
}
- (instancetype)init
{
self = [super init];
if (self) {
Class class = NSClassFromString(@"CNLiveCServiceModuleImpl");
self.protocol = [class new];
}
return self;
}
+ (void)jumpServiceController:(NSString *)serviceId type:(NSString *)type to:(NSString *)to shopType:(NSString *)shopType controller:(UIViewController *)controller
{
[CNLiveCServiceManagerBridge jumpServiceType:CNCServiceJumpTypeService service:serviceId type:type to:to shopType:shopType controller:controller];
}
+ (void)jumpServiceType:(CNCServiceJumpType)jumpType service:(NSString *)serviceId type:(NSString *)type to:(NSString *)to shopType:(NSString *)shopType controller:(UIViewController *)controller{
NSDictionary *param = @{
@"serviceId":serviceId,
@"type":type,
@"to":to,
@"shopType":shopType,
};
[CNLiveCServiceManagerBridge jumpViewControllerType:jumpType param:param controller:controller];
}
+ (void)jumpGoodsViewController:(NSString *)goodsId controller:(UIViewController *)controller
{
NSDictionary *param = @{
@"goodsId":goodsId,
};
[CNLiveCServiceManagerBridge jumpViewControllerType:CNCServiceJumpTypeGoods param:param controller:controller];
}
+ (void)jumpGetPageOtherVC:(NSString *)contentId controller:(UIViewController *)controller{
[QMUITips showLoadingInView:controller.view];
[CNLiveServicePresent loadServiceInfoServiceId:contentId result:^(CNLiveSearchModel * _Nonnull model) {
[QMUITips hideAllTips];
[CNLiveCServiceManagerBridge jumpServiceController:model.id type:model.type to:model.to shopType:model.shopType controller:controller];
} error:^{
[QMUITips hideAllTips];
}];
}
+ (void)jumpViewControllerType:(CNCServiceJumpType)type param:(NSDictionary *)param controller:(UIViewController *)controller{
[[CNLiveCServiceManagerBridge shareManager].protocol jumpControllerType:type param:param controller:controller];
}
+ (UIViewController *)viewControllerFromView:(UIView *)view {
for (UIView *next = [view superview]; next; next = next.superview) {
UIResponder *nextResponder = [next nextResponder];
if ([nextResponder isKindOfClass:[UIViewController class]]) {
return (UIViewController *)nextResponder;
}
}
return nil;
}
+ (CNLiveServiceVC *)serviceVC{
CNLiveServiceVC *vc = [[CNLiveServiceVC alloc] init];
return vc;
}
@end