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 |
|
b11815
|
96 |
|
L |
97 |
|
|
98 |
|
d1f6ab
|
99 |
/*! |
H |
100 |
@discussion 账号管理界面协议 |
|
101 |
- - - |
|
102 |
*/ |
|
103 |
@protocol WAAcctManagerDelegate <NSObject> |
|
104 |
|
|
105 |
@required |
|
106 |
/*! |
|
107 |
@abstract 新建账户回调接口 |
|
108 |
@param result 新建账户的账户信息 |
|
109 |
*/ |
|
110 |
-(void)newAcctDidCompleteWithResult:(WALoginResult*)result; |
|
111 |
/*! |
|
112 |
@abstract 切换账户回调接口 |
|
113 |
@param result 切换账户的账户信息 |
|
114 |
*/ |
|
115 |
-(void)switchAcctDidCompleteWithResult:(WALoginResult*)result; |
b11815
|
116 |
|
L |
117 |
/*! |
|
118 |
@abstract 绑定账号回调接口 |
|
119 |
@param bindResult 绑定账号信息 |
|
120 |
*/ |
|
121 |
-(void)bindAccountDidCompleteWithResult:(WABindingResult*)bindResult; |
d560f4
|
122 |
|
L |
123 |
|
|
124 |
/*! |
|
125 |
@abstract 实名认证成功回调接口 |
|
126 |
@param certificationInfo 实名认证信息 |
|
127 |
*/ |
|
128 |
-(void)realNameAuthtDidCompleteWithResult:(WACertificationInfo*)certificationInfo; |
|
129 |
|
d1f6ab
|
130 |
@end |
H |
131 |
|
56b891
|
132 |
/*! |
L |
133 |
@discussion 用户中心 |
|
134 |
- - - |
|
135 |
*/ |
|
136 |
@protocol WAUserCenterNoticeDelegate <NSObject> |
|
137 |
/*! |
|
138 |
@abstract 获取用户中心数据回调接口 |
|
139 |
@param result 用户中心数据信息 |
|
140 |
*/ |
|
141 |
- (void)userCenterNoticeWithResult:(WAUserCenterResult *)result; |
|
142 |
|
|
143 |
@end |
|
144 |
|
|
145 |
/*! |
|
146 |
@discussion 用户中心 |
|
147 |
- - - |
|
148 |
*/ |
|
149 |
@protocol WAUserCenterNoticeUIDelegate <NSObject> |
|
150 |
/*! |
|
151 |
@abstract 用户中心界面关闭回调接口 |
|
152 |
*/ |
|
153 |
- (void)userCenterNoticeClose; |
|
154 |
/*! |
|
155 |
@abstract 用户中心界面错误回调接口 |
|
156 |
@param error 用户中心错误信息 |
|
157 |
*/ |
|
158 |
- (void)userCenterNoticeError:(NSError *)error; |
|
159 |
|
|
160 |
@end |
|
161 |
|
d1f6ab
|
162 |
|
H |
163 |
/*! |
|
164 |
@discussion WAUserProxy 是用户模块的代理类。功能包括设置登录流程、登录、登出、绑定、解绑、查询当前用户绑定的第三方平台账户列表、切换账号、创建账号等等。 |
|
165 |
- - - |
|
166 |
*/ |
|
167 |
|
|
168 |
@interface WAUserProxy : NSObject |
|
169 |
|
|
170 |
/*! |
|
171 |
@discussion 设置登录流程 |
|
172 |
@param flowType 常量WA_LOGIN_FLOW_TYPE_DEFAULT是默认模式,表示切换新账户的时候不进行设备绑定操作,下次调用匿名登录还是登录之前的账户。常量WA_LOGIN_FLOW_TYPE_REBIND切换新账户的时候将当前设备的clientId绑定到新账户中,下一次匿名登录的时候将会登录到新账户。 |
|
173 |
*/ |
|
174 |
+(void)setLoginFlowType:(int)flowType; |
|
175 |
|
|
176 |
/*! |
|
177 |
@discussion 获取登录流程 |
|
178 |
*/ |
|
179 |
+(int)getLoginFlowType; |
|
180 |
|
|
181 |
/*! |
|
182 |
@discussion 登录接口 |
|
183 |
@param platform 登录平台:目前的登录平台有Facebook,Apple,GUEST,对应的常量分别是WA_PLATFORM_FACEBOOK,WA_PLATFORM_APPLE,WA_PLATFORM_WINGA。 |
|
184 |
@param extInfo 扩展信息 |
|
185 |
@param delegate 委托 |
|
186 |
*/ |
|
187 |
+(void)loginWithPlatform:(NSString *const)platform extInfo:(NSString*)extInfo delegate:(id<WALoginDelegate>)delegate; |
|
188 |
/*! |
|
189 |
@discussion 登出接口 |
|
190 |
*/ |
|
191 |
+(void)logout; |
|
192 |
|
|
193 |
/*! |
|
194 |
@discussion 绑定账户接口 |
|
195 |
@param platform 绑定平台:目前有Facebook,Apple,对应的常量分别为WA_PLATFORM_FACEBOOK,WA_PLATFORM_APPLE |
|
196 |
@param extInfo 扩展信息 |
|
197 |
@param delegate 委托 |
|
198 |
*/ |
|
199 |
+(void)bindingAccountWithPlatform:(NSString *const)platform extInfo:(NSString*)extInfo delegate:(id<WAAccountBindingDelegate>)delegate; |
|
200 |
/*! |
|
201 |
@discussion 查询绑定的第三方平台账户列表 |
|
202 |
@param block 回调 |
|
203 |
@error 错误 |
|
204 |
@accounts 数组accounts存放着WAAccount类型的对象. |
|
205 |
*/ |
|
206 |
+(void)queryBoundAccountWithCompleteBlock:(void(^)(NSError* error,NSArray<WAAccount *>* accounts))block; |
|
207 |
/*! |
|
208 |
@discussion 解绑账号接口 |
|
209 |
@param platform 解绑平台(WAAccount中的platform) |
|
210 |
@param pUserId 第三方平台用户id(WAAccount中的pUserId) |
|
211 |
*/ |
|
212 |
+(void)unBindAccountWithPlatform:(NSString *const)platform platformUserId:(NSString*)pUserId completeBlock:(void(^)(NSError* error))completeBlock; |
|
213 |
/*! |
|
214 |
@discussion 切换账号接口 |
|
215 |
@param platform 切换平台 |
2e0222
|
216 |
@param completeBlock 回调结果:包括error(错误)和result(登录结果) |
d1f6ab
|
217 |
*/ |
H |
218 |
+(void)switchAccountWithPlatform:(NSString *const)platform completeBlock:(void(^)(NSError* error,WALoginResult* result))completeBlock; |
|
219 |
|
|
220 |
/*! |
|
221 |
@discussion 创建账号接口 |
2e0222
|
222 |
@param completeBlock 回调结果:包括error(错误)和result(创建结果) |
d1f6ab
|
223 |
*/ |
H |
224 |
+(void)createNewAccountWithCompleteBlock:(void(^)(NSError* error,WALoginResult* result))completeBlock; |
|
225 |
|
|
226 |
|
|
227 |
/*! |
|
228 |
@abstract 调用此方法打开登录界面 |
|
229 |
@param delegate 委托 |
|
230 |
@param cacheEnabled 是否缓存登录方式 当该参数为YES,默认以上次登录方式登录,不会弹出登录选择框。 |
|
231 |
*/ |
|
232 |
+(void)login:(id<WALoginViewDelegate>)delegate cacheEnabled:(BOOL)cacheEnabled; |
|
233 |
/*! |
|
234 |
@abstract 调用此方法隐藏登录界面 |
|
235 |
*/ |
|
236 |
+(void)hide; |
|
237 |
/*! |
|
238 |
@abstract 清除登录方式的缓存 清除缓存之后会再次弹出登录选择框 |
|
239 |
*/ |
|
240 |
+(void)clearLoginCache; |
|
241 |
/*! |
|
242 |
@abstract 调用此方法打开账户管理界面 |
|
243 |
@param delegate 委托 |
|
244 |
*/ |
|
245 |
+(void)openAccountManager:(id<WAAcctManagerDelegate>)delegate; |
|
246 |
|
b11815
|
247 |
|
L |
248 |
/*! |
|
249 |
@abstract 调用此方法打开账户管理界面 |
|
250 |
@param delegate 委托 |
|
251 |
*/ |
|
252 |
+(void)openAccountCenter:(id<WAAcctManagerDelegate>)delegate; |
|
253 |
|
|
254 |
|
|
255 |
|
|
256 |
|
|
257 |
+(BOOL)isBoundPlatformAccount; |
d1f6ab
|
258 |
/*! |
H |
259 |
@abstract 获取账户信息 |
|
260 |
@param platform 平台 |
|
261 |
*/ |
|
262 |
+(WAAppUser*)getAccountInfoWithPlatform:(NSString *const)platform; |
|
263 |
|
|
264 |
//+(NSString*)transferWithPlatform:(NSString *const)platform; |
|
265 |
|
56b891
|
266 |
+ (void)getUserCenterNotice:(id<WAUserCenterNoticeDelegate>)delegate; |
L |
267 |
|
|
268 |
+ (void)showUserCenterNoticeUI:(id<WAUserCenterNoticeUIDelegate>)delegate; |
|
269 |
|
d1f6ab
|
270 |
/*! |
H |
271 |
@discussion 处理UIApplicationDelegate的方法[-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions]传递过来的参数。 |
|
272 |
*/ |
|
273 |
+ (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; |
|
274 |
|
|
275 |
/*! |
2e0222
|
276 |
@discussion 处理UIApplicationDelegate的方法[- (void)applicationDidBecomeActive:(UIApplication *)application]传递过来的参数。 |
d1f6ab
|
277 |
*/ |
2e0222
|
278 |
+(void)applicationDidBecomeActive:(UIApplication *)application; |
H |
279 |
|
|
280 |
/*! |
|
281 |
@discussion 处理UIApplicationDelegate的方法[- (void)applicationWillEnterForeground:(UIApplication *)application]传递过来的参数。 |
|
282 |
*/ |
|
283 |
+(void)applicationWillEnterForeground:(UIApplication *)application; |
|
284 |
|
|
285 |
/*! |
|
286 |
@discussion 处理UIApplicationDelegate的方法[- (void)applicationDidEnterBackground:(UIApplication *)application]传递过来的参数。 |
|
287 |
*/ |
|
288 |
+(void)applicationDidEnterBackground:(UIApplication *)application; |
d1f6ab
|
289 |
|
H |
290 |
/*! |
|
291 |
@discussion 处理UIApplicationDelegate的方法[-(BOOL)application:(UIApplication *)application |
|
292 |
openURL:(NSURL *)url |
|
293 |
sourceApplication:(NSString *)sourceApplication |
|
294 |
annotation:(id)annotation]传递过来的参数。 |
|
295 |
*/ |
|
296 |
+(BOOL)application:(UIApplication *)application |
|
297 |
openURL:(NSURL *)url |
|
298 |
sourceApplication:(NSString *)sourceApplication |
|
299 |
annotation:(id)annotation; |
|
300 |
|
|
301 |
/*! |
|
302 |
@discussion (tip:CP无需关注)此方法为成功登录第三方平台之后调用。根据第三方平台的pUserId,pToken,platform构建一个WALoginResult实例作为参数调用此方法。此方法将会调用WindAnalytics的登录接口。 |
|
303 |
@param result 登录结果 |
|
304 |
@param delegate 委托 |
|
305 |
*/ |
|
306 |
+(void)loginWithResult:(WALoginResult*)result delegate:(id<WALoginDelegate>)delegate; |
|
307 |
|
|
308 |
+(void)loginWithResult:(WALoginResult*)result extInfo:(NSString*)extInfo delegate:(id<WALoginDelegate>)delegate; |
|
309 |
|
|
310 |
/*! |
|
311 |
@discussion (tip:CP无需关注)设置当前的登录平台 |
|
312 |
*/ |
|
313 |
+(void)setCurrentLoginPlatform:(NSString *const)platform; |
|
314 |
/*! |
|
315 |
@discussion (tip:CP无需关注)获取当前的登录平台 |
|
316 |
*/ |
|
317 |
+(NSString*)getCurrentLoginPlatform; |
|
318 |
/*! |
|
319 |
@discussion (tip:CP无需关注)获取当前的登录结果 |
|
320 |
*/ |
|
321 |
+(WALoginResult*)getCurrentLoginResult; |
|
322 |
|
|
323 |
/*! |
|
324 |
@discussion (tip:CP无需关注)获取用户模块组件 |
|
325 |
*/ |
|
326 |
+(NSArray*)getUserComponents; |
28ea02
|
327 |
|
L |
328 |
+(void)queryUserCertificationInfo:(void(^)(WACertificationInfo *certificationInfo,NSError *error))callBackBlock; |
|
329 |
|
d560f4
|
330 |
|
L |
331 |
/*! |
|
332 |
@discussion 检测是否可以打开账号绑定、账号切换、实名认证接口 |
|
333 |
*/ |
|
334 |
+ (BOOL)canOpenAccoutbind; |
|
335 |
+ (BOOL)canOpenAccoutSwitch; |
|
336 |
+ (BOOL)canOpenRealNameAuth; |
|
337 |
|
|
338 |
/*! |
|
339 |
@discussion 打开账户绑定界面 |
|
340 |
*/ |
|
341 |
+ (void)openAccoutbindManager:(void(^)(NSError* error,WABindingResult * bindResult))block; |
|
342 |
|
|
343 |
|
|
344 |
/*! |
|
345 |
@discussion 打开账户切换界面 |
|
346 |
*/ |
|
347 |
+ (void)openAccoutSwithchManager:(void(^)(NSError* error,WALoginResult * loginResult))block; |
|
348 |
|
|
349 |
|
|
350 |
/*! |
|
351 |
@discussion 打开实名认证界面 |
|
352 |
*/ |
|
353 |
+ (void)openRealNameAuthManager:(void(^)(NSError* error,WACertificationInfo * certificationInfo))block; |
|
354 |
|
|
355 |
|
d1f6ab
|
356 |
@end |