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