CNBBASMJumpService.m
2.17 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
//
// CNBBASMJumpService.m
// AFNetworking
//
// Created by CNLive on 2021/11/2.
//
#import "CNBBASMJumpService.h"
#import <CNLiveEnvironment/CNLiveEnvironment.h>
#import <BBAMNP/BBASMManager.h>
#import <BainuoCashierSDK/BDNCashierSDK.h>
#import <CNLiveBeeHive/BHRouter.h>
@interface CNBBASMJumpService()<BHModuleProtocol>
@end
//主要的跳转类型
static NSString *const CNLiveBBASMRouterWithMainkey = @"com.cnlive.CNLiveNetAdd://call.service.beehive/CNLiveBBASMModuleService.CNliveBBASMModuleProtocol.";
static NSString *const CNLiveBBASMShareMethod = @"shareBBASMWithParams:";
static NSString *const CNLiveBBASMGetPluginDesC = @"getPluginDescriptionPath";
@BeeHiveService(CNBBASMJumpProtocol, CNBBASMJumpService)
@implementation CNBBASMJumpService
-(void)modSetUp:(BHContext *)context
{
[[BHRouter globalRouter] addPathComponent:@"CNLiveBBASMModuleService" forClass:NSClassFromString(@"CNLiveBBASMModuleService")];
[[BHRouter globalRouter] addPathComponent:@"CNBBASMJumpService" forClass:NSClassFromString(@"CNBBASMJumpService")];
}
- (void)registerBBASMManager:(NSDictionary *)launchOptions
{
dispatch_async(dispatch_get_main_queue(), ^{
[BBASMManager registerAppLaunchOptions:launchOptions];
});
}
- (void)openBBASMModule:(NSString *)urlStr
{
if ([urlStr containsString:@"://swan/"] ||
[urlStr containsString:@"://swangame/"]) {
[Pyramid.bba_smManager openAppUrl:urlStr];
}
}
- (BOOL)cashierHandleOpenUrl:(NSURL *)url
{
BOOL result = [BDNCashierSDK handleOpenURL:url];
return result;
}
+ (void)shareBBASMWithParams:(NSDictionary *)params
{
NSURL * url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",CNLiveBBASMRouterWithMainkey,CNLiveBBASMShareMethod]];
[BHRouter openURL:url withParams:@{@"CNLiveBBASMModuleService":@{@"params":params}}];
}
+ (NSString *)getPluginDescriptionPath{
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",CNLiveBBASMRouterWithMainkey,CNLiveBBASMGetPluginDesC]];
__block NSString *pluginDes = nil;
[BHRouter openURL:url withParams:nil andThen:^(NSString *pathComponentKey, id obj, id returnValue) {
pluginDes = returnValue;
}];
return pluginDes;
}
@end