BBASMManagerProtocol.h
4.96 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
//
// BBASMManagerProtocol.h
// BBAMNP
//
// Created by baidu on 2019/1/17.
//
#import <Foundation/Foundation.h>
#import <Pyramid/Pyramid.h>
#import "BBASMHostConfigModel.h"
NS_ASSUME_NONNULL_BEGIN
@class BBASchemeDispatcher;
AliasService(BBASMManagerProtocol, bba_smManager)
@protocol BBASMManagerProtocol <NSObject>
/// 小程序webView原始UA + baseUA
@property (nonatomic, copy, readonly) NSString *webViewAppUA;
/// 小程序UA,UA规则:"swan/sdkVersion swan-appName/appVersion",比如:swan/1.7.0 swan-baiduboxapp/11.2.0.0 (Baidu P2 12.0)
@property (nonatomic, copy, readonly) NSString *baseAppUA;
/// 小游戏UA,UA规则:"swanGame/version appName/appVersion",比如:swanGame/1.7 baiduboxapp/11.2.0.0 (Baidu P2 12.0)
@property (nonatomic, copy, readonly) NSString *baseGameUA;
/// 小程序 SDK 版本号 UA (为避免有业务对手百UA有特殊判断,增加了AB实验控制)
/// 该属性值可能为 空字符串
@property (nonatomic, copy, readonly) NSString *sdkVersionUA;
/// 设备屏幕尺寸
@property (nonatomic, assign, readonly) CGSize screenModeSize;
/// iOS 系统版本
@property (nonatomic, copy, readonly) NSString *systemVersion;
/// 宿主方的配置
@property (nonatomic, strong, readonly) BBASMHostConfigModel *hostConfigModel;
/// 设备uuid
@property (nonatomic, copy, readonly) NSString *UUIDString;
+ (id<BBASMManagerProtocol>)sharedInstance;
/// dispatcher是否为小程序的调起协议
+ (BOOL)isMNPScheme:(BBASchemeDispatcher *)dispatcher;
/**
* @brief 小程序启动入口配置 -仅开源宿主使用(application:didFinishLaunchingWithOptions:)
* @param launchOptions 宿主APP启动参数
**/
+ (void)registerAppLaunchOptions:(NSDictionary *)launchOptions;
/// 获取小程序页面栈类名
+ (Class)getMNPPageStackClassName;
/// 获取小游戏页面栈类名
+ (Class)getMNPGamePageStackClassName;
/// 调起小程序
+ (void)openAppUrl:(NSString *)appUrlStr;
/// 关闭当前运行的小程序或小游戏(小程序或小游戏退入到后台)
+ (void)closeCurrentActiveApp;
/// 小程序平台的版本号
+ (NSString *)SDKVersion;
/// 获取设备ID
+ (NSString *)getDeviceIdentity;
/// 启动小程序服务
- (void)start;
/// 当前小程序名称
- (NSString *)currentAppName;
/// 当前小程序slaveWebId
- (NSInteger)currentWebId;
/// Current web-view component's url
- (nullable NSString *)currentWebViewComponentURL;
/// 小程序的masterWebView执行JS语句
- (void)evaluateJavaScript:(NSString *)scriptString
completionHandler:(void (^ _Nullable)(_Nullable id,
NSError * _Nullable error))completionHandler;
/// 小程序的master执行JS Event
+ (void)dispatchEventWithAppId:(NSString *)appID
eventName:(NSString *)eventName
eventParam:(NSDictionary * _Nullable)eventParam
completionHandler:(void (^ _Nullable)(_Nullable id result,
NSError * _Nullable error))completionHandler;
/// 获取小程序首页URL
- (NSString *)homePageURL;
/// 从URL请求小程序调起协议
- (void)generateMNPLaunchDispatcherFromURL:(NSString *)url;
/// 是否开启小程序
- (BOOL)enableMNP;
/// 导航栏点击进去关于页面
- (void)pannelActionEnterAbout:(NSString *)appId;
/**
* 根据AppID获取AppKey
*/
- (NSString *)appkeyWithAppID:(NSString *)appID;
/**
* 弹出viewController
*/
- (void)showViewController:(UIViewController *)controller appID:(NSString *)appID;
/**
* 获取小游戏是否为横屏
*
* @return YES: 横屏, NO: 竖屏
*/
- (BOOL)checkLandscapeOfGameAppWithID:(NSString *)appID;
/**
* 获取当前navigationController
*/
- (UINavigationController *)getCurrentNavigationController;
/**
* @brief 获取userInfoButton相同层级,添加banner广告(11.3)
*
* @param appId appId
* @return gameApp.gameContentView
*/
- (UIView *)getGameAppContentViewWithId:(NSString *)appId;
/**
* @brief 启动小程序随需要的地图服务
*/
- (void)startMapService;
/**
* @brief 生成基础UA,可添加自定义UA
* @param customUA 添加的自定义UA
*
* @return NSString
*/
- (NSString *)webViewAppUAWitCustomUA:(NSString * _Nullable)customUA;
/**
* @brief 主动执行页面、小程序的onHidden事件,优选执行页面的onHidden事件,然后执行小程序的onHidden事件
*
*/
+ (void)dispatchPageAndAppOnHiddenEvent;
/**
* @brief 主动执行小程序、页面的onShow事件,优选执行小程序的onShow事件,然后执行页面的onShow事件
*
*/
+ (void)dispatchAppAndPageOnShowEvent;
/**
* @brief 小程序框架出现异常时,强制清空预加载缓存、页面栈 释放内存
*
*/
+ (void)cleanCurrentInvalidAppStack;
/// 获取updatecore某个节点对应的数据
/// @param node 节点,由一级节点与二级节点构成,格式参考:host/base_info
/// @return 返回该节点对应的数据
+ (NSDictionary *)fetchUpdateCoreDataByNode:(NSString *)node;
@end
NS_ASSUME_NONNULL_END