CNBBASMJumpService.m
2.42 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
//
// CNBBASMJumpService.m
// AFNetworking
//
// Created by CNLive on 2021/11/2.
//
#import "CNBBASMJumpService.h"
#import <CNLiveEnvironment/CNLiveEnvironment.h>
#import <BBAMNP/BBASMManager.h>
#import <BBAMNP/BBAMNP.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:";
//获取zip
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)accountLogout
{
[Pyramid.bba_MNP removeAllLocalServicesInHistory];
[Pyramid.bba_MNP unionAccountLogOut];
}
+ (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