BBASDPluginManager.h
5.6 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
//
// BBASDPluginManager.h
// BaiduBoxAppDemo
//
// Created by zhangshuaibing on 2016/12/1.
// Copyright © 2016年 zhangshuaibing. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "BBASDPluginBase.h"
#import "BBASDDefine.h"
@class BBASDPluginBase, BBADispatcherBase, BBASchemeDispatcher;
/// 插件管理核心类,用于调起协议配置信息以及插件的注册&加载
@interface BBASDPluginManager : NSObject
@property (nonatomic, strong, readonly) NSArray *schemes;
@property (nonatomic, copy) SDUBCHandler ubcHandler;
@property (nonatomic, copy) SDGuardHandler sdGuardHandler;
@property (nonatomic, copy) DispatcherHandler dispatcherHandler;
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
/**
@method sharedInstance
@abstract 单例方法
**/
+ (instancetype)sharedInstance;
/**
@abstract 注册配置项:工程启动时调用,用来注册调起协议配置信息
@param schemes 支持的调起协议scheme集合,子集为scheme字符串,如:baiduboxapp
**/
- (void)registerSupportSchemes:(NSArray *)schemes;
/**
@abstract 判断是否支持当前scheme调起
@param scheme scheme名称
@result bool
**/
- (BOOL)isSupportScheme:(NSString *)scheme;
/**
@method registModuleName:actionList:
@abstract 兼容老版协议(无action&无module)
@param moduleName 自定义module名
@param actionList 相应module下action集合
**/
- (void)registerModuleName:(NSString *)moduleName actionList:(NSArray *)actionList;
/**
@method registerRedirectModule:action:toModule:toAction
@abstract 重定向协议(原Module、Action分发到新的toModule、toAction;满足组件化逻辑各有归属的需要)
@param module 协议中的Module
@param action 协议中的action(兼容旧协议,可以为空)
@param toModule 分发目标Module
@param toAction 分发目标action
**/
- (void)registerRedirectModule:(NSString *)module action:(NSString *)action toModule:(NSString*)toModule toAction:(NSString*)toAction;
/**
@abstract 检测是否自定义兼容老版协议(协议格式用例:baiduboxappv5://speedProgressCompleted?minver=5.1.0.0)
判断老版协议中action是否已被配置到重定向action列表内
@param action 老版本action,在重定向后,转换为自定义module下的actions列表内
@result 重定向列表转换后的module&action字典,若未配置返回nil
**/
- (NSDictionary *)checkSDRedirectByAction:(NSString *)action;
/**
@method checkSDRedirectModule:action:
@abstract 检测是否有重定向配置(Module,Action》Module,Action)
@param module 老版本module
@param action 老版本action
@result 重定向列表转换后的module&action字典,若未配置返回nil
**/
- (NSDictionary *)checkSDRedirectModule:(NSString *)module action:(NSString*)action;
/**
@abstract App启动时注册端能力插件名, (注册插件以className去掉前缀后缀的string为Key,不会初始化插件类)
@param className 需要注册的端能力类
@result 插件已存在返回NO,插件未存在并成功注册返回YES
**/
- (BOOL)registerPluginWithClassName:(NSString *)className;
/**
@abstract App启动时注册端能力插件名, 以传入的module为Key (如果module为空,以className去掉前缀后缀的string为Key),不会初始化插件类
@param className 需要注册的端能力类
@param module 端能力调起对应的module参数
@result 插件已存在返回NO,插件未存在并成功注册返回YES
**/
- (BOOL)registerPluginWithClassName:(NSString *)className module:(NSString *)module;
/**
@method registerPluginPrefix:suffix:
@abstract 插件通过前后缀注册,如模块名为Account,拼接前后缀为类名BBAAccountPlugin
@param prefix 注册类名前缀,如BBA
@param suffix 注册类名前缀,如Plugin
**/
- (void)registerPluginPrefix:(NSString *)prefix suffix:(NSString *)suffix;
/**
@method registerDispatcherBlock:
@abstract 注册block,用于捕捉分发时候的dispatcher
@param dispatcherHandler block方法
**/
- (void)registerDispatcherBlock:(DispatcherHandler)dispatcherHandler;
/**
@method registerUBCBlock:
@abstract 注册block,用于打点
@param handler 打点方法
**/
- (void)registerUBCBlock:(SDUBCHandler)handler;
/**
@method registerSDGuardBlock:
@abstract 注册block,用于鉴权,scheme是否可以调起
@param sdGuardHandler 鉴权方法
**/
- (void)registerSDGuardBlock:(SDGuardHandler)sdGuardHandler;
/**
@method pluginByModule:
@abstract 通过module名称获取插件
@result 返回BBASDPluginBase实例
**/
- (BBASDPluginBase *)pluginByModule:(NSString *)module;
/**
@abstract 部分业务有自己的解析逻辑,需要在解析完成后分发之前执行自己的解析逻辑
@param parseFinishHandler 解析完成后分发之前需要执行的逻辑
@param hostStr 在url的host为hostStr时执行block
**/
- (void)registerParseFinishHandler:(SDParseFinishHandler)parseFinishHandler forHostString:(NSString *)hostStr;
/**
@abstract 部分业务有自己的解析逻辑,需要在解析完成后分发之前执行自己的解析逻辑
@param dispatcher BBASchemeDispatcher 类型
**/
- (void)excuteParseFinishHandler:(BBADispatcherBase *)dispatcher;
#pragma mark - Deprecated
/// 统一callback未改造的端能力list
@property (nonatomic, copy) NSMutableDictionary *callbackBlackList __attribute__((deprecated("废弃 需要移除")));
@end