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