BBPModuleProtocol.h
2.12 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
//
// BBPModuleProtocol.h
// Pyramid
//
// Created by jilutao on 31/07/2017.
// Copyright © 2017 Baidu. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Pyramid/PyramidDefines.h>
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000
#import <UserNotifications/UserNotifications.h>
#endif
/**
组件优先级,层级越低应该优先级越高,需要根据逻辑来指定优先级
*/
typedef NS_ENUM(NSInteger, BBPModulePriority) {
BBPModulePriorityDefault = 0,
BBPModulePriorityLow = 100,
BBPModulePriorityModdle = 500,
BBPModulePriorityHigh = 1000
};
@class BBPContext;
NS_ASSUME_NONNULL_BEGIN
/**
组件基础协议,获取优先级,系统事件,生命周期和自定义事件
*/
@protocol BBPModuleProtocol <UIApplicationDelegate, UNUserNotificationCenterDelegate>
@optional
/**
组件加载的优先级,值越大优先级越高,不实现该方法为最低优先级,对应层级上,层级越低应该优先级越高
@return 优先级
*/
+ (NSInteger)modulePriority;
/**
是否支持用户同意隐私弹窗协议之前启动 module,如果支持,将会在用户同意隐私弹窗协议之前启动,即 module 会收到生命周期回调
@return 是否支持
*/
+ (BOOL)supportPrivacyPolicy;
/**
触发注册组件,Pyramid初始化时调用,尽量不要有耗时操作
@param context App上下文
*/
- (void)moduleRegister:(BBPContext *)context;
/**
触发初始化组件,App环境搭建(App启动必要数据)完成事件后或者手动调用,可以有耗时操作
@param context App上下文
*/
- (void)moduleInit:(BBPContext *)context;
/**
触发销毁组件
@param context App上下文
*/
- (void)moduleTearDown:(BBPContext *)context;
/**
触发自定义事件
@param event 事件名称
@param customParam App上下文
*/
- (void)moduleDidCustomEvent:(BDPPyramidEvent)event customParam:(id)customParam;
/**
环境搭建(App启动必要数据)完成事件
@param context App上下文
*/
- (void)applicationEnvironmentDidSetup:(BBPContext *)context;
/**
KeyWindow显示完成
*/
- (void)applicationMakeKeyWindowAndVisible;
@end
NS_ASSUME_NONNULL_END