commit | author | age
|
d1f6ab
|
1 |
// |
H |
2 |
// WAUserProxy.h |
|
3 |
// WASdkIntfUI |
|
4 |
// |
|
5 |
// Created by GHW-T-01 on 16/3/1. |
|
6 |
// Copyright © 2016年 GHW-T-01. All rights reserved. |
|
7 |
// |
|
8 |
|
|
9 |
#import <Foundation/Foundation.h> |
|
10 |
#import <UIKit/UIKit.h> |
|
11 |
#import "WALoginResult.h" |
|
12 |
#import "WABindingResult.h" |
|
13 |
#import "WAAccount.h" |
56b891
|
14 |
#import "WAUserCenterResult.h" |
d1f6ab
|
15 |
#import "WAAppUser.h" |
28ea02
|
16 |
#import "WACertificationInfo.h" |
d1f6ab
|
17 |
/*! |
H |
18 |
@discussion 登录协议 |
|
19 |
- - - |
|
20 |
*/ |
|
21 |
@protocol WALoginDelegate <NSObject> |
|
22 |
|
|
23 |
@required |
|
24 |
/*! |
|
25 |
@abstract 登录成功 |
2e0222
|
26 |
@param result 登录结果 |
d1f6ab
|
27 |
*/ |
H |
28 |
-(void)loginDidCompleteWithResults:(WALoginResult*)result; |
|
29 |
/*! |
|
30 |
@abstract 登录失败 |
|
31 |
@param result 登录的用户信息 注:这不是登录结果,由于登录失败所以userId是空的.但如果第三方平台(Facebook,Apple)授权成功,pUserId,pToken,extends不为空,可用于提示用户. |
|
32 |
@param error 错误 |
|
33 |
*/ |
|
34 |
-(void)loginDidFailWithError:(NSError*)error andResult:(WALoginResult*)result; |
|
35 |
@optional |
|
36 |
/*! |
|
37 |
@abstract 用户取消登录 |
|
38 |
@param result 登录的账户信息 (注:返回的result只有platform有值) |
|
39 |
*/ |
|
40 |
-(void)loginDidCancel:(WALoginResult*)result; |
|
41 |
|
|
42 |
@end |
|
43 |
|
|
44 |
/*! |
|
45 |
@discussion 账户绑定协议 |
|
46 |
- - - |
|
47 |
*/ |
|
48 |
@protocol WAAccountBindingDelegate <NSObject> |
|
49 |
|
|
50 |
@required |
|
51 |
/*! |
|
52 |
@abstract 绑定成功 |
|
53 |
@param result 绑定的账户信息 |
|
54 |
*/ |
|
55 |
-(void)bindingDidCompleteWithResult:(WABindingResult*)result; |
|
56 |
/*! |
|
57 |
@abstract 绑定失败 |
|
58 |
@param result 绑定的账户信息 |
|
59 |
@param error 错误 |
|
60 |
*/ |
|
61 |
-(void)bindingDidFailWithError:(NSError*)error andResult:(WABindingResult*)result; |
|
62 |
@optional |
|
63 |
/*! |
|
64 |
@abstract 绑定取消 |
|
65 |
@param result 绑定的账户信息(注:返回的result只有platform有值) |
|
66 |
*/ |
|
67 |
-(void)bindingDidCancel:(WABindingResult*)result; |
|
68 |
@end |
|
69 |
|
|
70 |
/*! |
|
71 |
@discussion 登录界面协议 |
|
72 |
- - - |
|
73 |
*/ |
|
74 |
@protocol WALoginViewDelegate <NSObject> |
|
75 |
|
|
76 |
@required |
|
77 |
/*! |
|
78 |
@abstract 登录成功 |
|
79 |
@param result 登录的用户信息 |
|
80 |
*/ |
|
81 |
-(void)loginViewDidCompleteWithResult:(WALoginResult*)result; |
|
82 |
/*! |
|
83 |
@abstract 登录失败 |
|
84 |
@param result 登录的用户信息 注:这不是登录结果,由于登录失败所以userId是空的.但如果第三方平台(Facebook,Apple)授权成功,pUserId,pToken,extends不为空,可用于提示用户. |
|
85 |
@param error 错误 |
|
86 |
*/ |
|
87 |
-(void)loginViewDidFailWithError:(NSError*)error andResult:(WALoginResult*)result; |
|
88 |
@optional |
|
89 |
/*! |
|
90 |
@abstract 用户取消登录 |
|
91 |
@param result 登录的用户信息(只有platform非空). |
|
92 |
*/ |
|
93 |
-(void)loginViewDidCancel:(WALoginResult*)result; |
|
94 |
@end |
|
95 |
|
|
96 |
/*! |
|
97 |
@discussion 账号管理界面协议 |
|
98 |
- - - |
|
99 |
*/ |
|
100 |
@protocol WAAcctManagerDelegate <NSObject> |
|
101 |
|
|
102 |
@required |
|
103 |
/*! |
|
104 |
@abstract 新建账户回调接口 |
|
105 |
@param result 新建账户的账户信息 |
|
106 |
*/ |
|
107 |
-(void)newAcctDidCompleteWithResult:(WALoginResult*)result; |
|
108 |
/*! |
|
109 |
@abstract 切换账户回调接口 |
|
110 |
@param result 切换账户的账户信息 |
|
111 |
*/ |
|
112 |
-(void)switchAcctDidCompleteWithResult:(WALoginResult*)result; |
|
113 |
@end |
|
114 |
|
56b891
|
115 |
/*! |
L |
116 |
@discussion 用户中心 |
|
117 |
- - - |
|
118 |
*/ |
|
119 |
@protocol WAUserCenterNoticeDelegate <NSObject> |
|
120 |
/*! |
|
121 |
@abstract 获取用户中心数据回调接口 |
|
122 |
@param result 用户中心数据信息 |
|
123 |
*/ |
|
124 |
- (void)userCenterNoticeWithResult:(WAUserCenterResult *)result; |
|
125 |
|
|
126 |
@end |
|
127 |
|
|
128 |
/*! |
|
129 |
@discussion 用户中心 |
|
130 |
- - - |
|
131 |
*/ |
|
132 |
@protocol WAUserCenterNoticeUIDelegate <NSObject> |
|
133 |
/*! |
|
134 |
@abstract 用户中心界面关闭回调接口 |
|
135 |
*/ |
|
136 |
- (void)userCenterNoticeClose; |
|
137 |
/*! |
|
138 |
@abstract 用户中心界面错误回调接口 |
|
139 |
@param error 用户中心错误信息 |
|
140 |
*/ |
|
141 |
- (void)userCenterNoticeError:(NSError *)error; |
|
142 |
|
|
143 |
@end |
|
144 |
|
d1f6ab
|
145 |
|
H |
146 |
/*! |
|
147 |
@discussion WAUserProxy 是用户模块的代理类。功能包括设置登录流程、登录、登出、绑定、解绑、查询当前用户绑定的第三方平台账户列表、切换账号、创建账号等等。 |
|
148 |
- - - |
|
149 |
*/ |
|
150 |
|
|
151 |
@interface WAUserProxy : NSObject |
|
152 |
|
|
153 |
/*! |
|
154 |
@discussion 设置登录流程 |
|
155 |
@param flowType 常量WA_LOGIN_FLOW_TYPE_DEFAULT是默认模式,表示切换新账户的时候不进行设备绑定操作,下次调用匿名登录还是登录之前的账户。常量WA_LOGIN_FLOW_TYPE_REBIND切换新账户的时候将当前设备的clientId绑定到新账户中,下一次匿名登录的时候将会登录到新账户。 |
|
156 |
*/ |
|
157 |
+(void)setLoginFlowType:(int)flowType; |
|
158 |
|
|
159 |
/*! |
|
160 |
@discussion 获取登录流程 |
|
161 |
*/ |
|
162 |
+(int)getLoginFlowType; |
|
163 |
|
|
164 |
/*! |
|
165 |
@discussion 登录接口 |
|
166 |
@param platform 登录平台:目前的登录平台有Facebook,Apple,GUEST,对应的常量分别是WA_PLATFORM_FACEBOOK,WA_PLATFORM_APPLE,WA_PLATFORM_WINGA。 |
|
167 |
@param extInfo 扩展信息 |
|
168 |
@param delegate 委托 |
|
169 |
*/ |
|
170 |
+(void)loginWithPlatform:(NSString *const)platform extInfo:(NSString*)extInfo delegate:(id<WALoginDelegate>)delegate; |
|
171 |
/*! |
|
172 |
@discussion 登出接口 |
|
173 |
*/ |
|
174 |
+(void)logout; |
|
175 |
|
|
176 |
/*! |
|
177 |
@discussion 绑定账户接口 |
|
178 |
@param platform 绑定平台:目前有Facebook,Apple,对应的常量分别为WA_PLATFORM_FACEBOOK,WA_PLATFORM_APPLE |
|
179 |
@param extInfo 扩展信息 |
|
180 |
@param delegate 委托 |
|
181 |
*/ |
|
182 |
+(void)bindingAccountWithPlatform:(NSString *const)platform extInfo:(NSString*)extInfo delegate:(id<WAAccountBindingDelegate>)delegate; |
|
183 |
/*! |
|
184 |
@discussion 查询绑定的第三方平台账户列表 |
|
185 |
@param block 回调 |
|
186 |
@error 错误 |
|
187 |
@accounts 数组accounts存放着WAAccount类型的对象. |
|
188 |
*/ |
|
189 |
+(void)queryBoundAccountWithCompleteBlock:(void(^)(NSError* error,NSArray<WAAccount *>* accounts))block; |
|
190 |
/*! |
|
191 |
@discussion 解绑账号接口 |
|
192 |
@param platform 解绑平台(WAAccount中的platform) |
|
193 |
@param pUserId 第三方平台用户id(WAAccount中的pUserId) |
|
194 |
*/ |
|
195 |
+(void)unBindAccountWithPlatform:(NSString *const)platform platformUserId:(NSString*)pUserId completeBlock:(void(^)(NSError* error))completeBlock; |
|
196 |
/*! |
|
197 |
@discussion 切换账号接口 |
|
198 |
@param platform 切换平台 |
2e0222
|
199 |
@param completeBlock 回调结果:包括error(错误)和result(登录结果) |
d1f6ab
|
200 |
*/ |
H |
201 |
+(void)switchAccountWithPlatform:(NSString *const)platform completeBlock:(void(^)(NSError* error,WALoginResult* result))completeBlock; |
|
202 |
|
|
203 |
/*! |
|
204 |
@discussion 创建账号接口 |
2e0222
|
205 |
@param completeBlock 回调结果:包括error(错误)和result(创建结果) |
d1f6ab
|
206 |
*/ |
H |
207 |
+(void)createNewAccountWithCompleteBlock:(void(^)(NSError* error,WALoginResult* result))completeBlock; |
|
208 |
|
|
209 |
|
|
210 |
/*! |
|
211 |
@abstract 调用此方法打开登录界面 |
|
212 |
@param delegate 委托 |
|
213 |
@param cacheEnabled 是否缓存登录方式 当该参数为YES,默认以上次登录方式登录,不会弹出登录选择框。 |
|
214 |
*/ |
|
215 |
+(void)login:(id<WALoginViewDelegate>)delegate cacheEnabled:(BOOL)cacheEnabled; |
|
216 |
/*! |
|
217 |
@abstract 调用此方法隐藏登录界面 |
|
218 |
*/ |
|
219 |
+(void)hide; |
|
220 |
/*! |
|
221 |
@abstract 清除登录方式的缓存 清除缓存之后会再次弹出登录选择框 |
|
222 |
*/ |
|
223 |
+(void)clearLoginCache; |
|
224 |
/*! |
|
225 |
@abstract 调用此方法打开账户管理界面 |
|
226 |
@param delegate 委托 |
|
227 |
*/ |
|
228 |
+(void)openAccountManager:(id<WAAcctManagerDelegate>)delegate; |
|
229 |
|
|
230 |
/*! |
|
231 |
@abstract 获取账户信息 |
|
232 |
@param platform 平台 |
|
233 |
*/ |
|
234 |
+(WAAppUser*)getAccountInfoWithPlatform:(NSString *const)platform; |
|
235 |
|
|
236 |
//+(NSString*)transferWithPlatform:(NSString *const)platform; |
|
237 |
|
56b891
|
238 |
+ (void)getUserCenterNotice:(id<WAUserCenterNoticeDelegate>)delegate; |
L |
239 |
|
|
240 |
+ (void)showUserCenterNoticeUI:(id<WAUserCenterNoticeUIDelegate>)delegate; |
|
241 |
|
d1f6ab
|
242 |
/*! |
H |
243 |
@discussion 处理UIApplicationDelegate的方法[-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions]传递过来的参数。 |
|
244 |
*/ |
|
245 |
+ (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; |
|
246 |
|
|
247 |
/*! |
2e0222
|
248 |
@discussion 处理UIApplicationDelegate的方法[- (void)applicationDidBecomeActive:(UIApplication *)application]传递过来的参数。 |
d1f6ab
|
249 |
*/ |
2e0222
|
250 |
+(void)applicationDidBecomeActive:(UIApplication *)application; |
H |
251 |
|
|
252 |
/*! |
|
253 |
@discussion 处理UIApplicationDelegate的方法[- (void)applicationWillEnterForeground:(UIApplication *)application]传递过来的参数。 |
|
254 |
*/ |
|
255 |
+(void)applicationWillEnterForeground:(UIApplication *)application; |
|
256 |
|
|
257 |
/*! |
|
258 |
@discussion 处理UIApplicationDelegate的方法[- (void)applicationDidEnterBackground:(UIApplication *)application]传递过来的参数。 |
|
259 |
*/ |
|
260 |
+(void)applicationDidEnterBackground:(UIApplication *)application; |
d1f6ab
|
261 |
|
H |
262 |
/*! |
|
263 |
@discussion 处理UIApplicationDelegate的方法[-(BOOL)application:(UIApplication *)application |
|
264 |
openURL:(NSURL *)url |
|
265 |
sourceApplication:(NSString *)sourceApplication |
|
266 |
annotation:(id)annotation]传递过来的参数。 |
|
267 |
*/ |
|
268 |
+(BOOL)application:(UIApplication *)application |
|
269 |
openURL:(NSURL *)url |
|
270 |
sourceApplication:(NSString *)sourceApplication |
|
271 |
annotation:(id)annotation; |
|
272 |
|
|
273 |
/*! |
|
274 |
@discussion (tip:CP无需关注)此方法为成功登录第三方平台之后调用。根据第三方平台的pUserId,pToken,platform构建一个WALoginResult实例作为参数调用此方法。此方法将会调用WindAnalytics的登录接口。 |
|
275 |
@param result 登录结果 |
|
276 |
@param delegate 委托 |
|
277 |
*/ |
|
278 |
+(void)loginWithResult:(WALoginResult*)result delegate:(id<WALoginDelegate>)delegate; |
|
279 |
|
|
280 |
+(void)loginWithResult:(WALoginResult*)result extInfo:(NSString*)extInfo delegate:(id<WALoginDelegate>)delegate; |
|
281 |
|
|
282 |
/*! |
|
283 |
@discussion (tip:CP无需关注)设置当前的登录平台 |
|
284 |
*/ |
|
285 |
+(void)setCurrentLoginPlatform:(NSString *const)platform; |
|
286 |
/*! |
|
287 |
@discussion (tip:CP无需关注)获取当前的登录平台 |
|
288 |
*/ |
|
289 |
+(NSString*)getCurrentLoginPlatform; |
|
290 |
/*! |
|
291 |
@discussion (tip:CP无需关注)获取当前的登录结果 |
|
292 |
*/ |
|
293 |
+(WALoginResult*)getCurrentLoginResult; |
|
294 |
|
|
295 |
/*! |
|
296 |
@discussion (tip:CP无需关注)获取用户模块组件 |
|
297 |
*/ |
|
298 |
+(NSArray*)getUserComponents; |
28ea02
|
299 |
|
L |
300 |
+(void)queryUserCertificationInfo:(void(^)(WACertificationInfo *certificationInfo,NSError *error))callBackBlock; |
|
301 |
|
d1f6ab
|
302 |
@end |