commit | author | age
|
dcdc07
|
1 |
// |
W |
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 登录成功 |
|
24 |
@param results 登录结果 |
|
25 |
*/ |
|
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 切换平台 |
|
167 |
@param error 错误 |
|
168 |
@param result 登录结果 |
|
169 |
*/ |
|
170 |
+(void)switchAccountWithPlatform:(NSString *const)platform completeBlock:(void(^)(NSError* error,WALoginResult* result))completeBlock; |
|
171 |
|
|
172 |
/*! |
|
173 |
@discussion 创建账号接口 |
|
174 |
@param error 错误 |
|
175 |
@param result 创建结果 |
|
176 |
*/ |
|
177 |
+(void)createNewAccountWithCompleteBlock:(void(^)(NSError* error,WALoginResult* result))completeBlock; |
|
178 |
|
|
179 |
|
|
180 |
/*! |
|
181 |
@abstract 调用此方法打开登录界面 |
|
182 |
@param delegate 委托 |
|
183 |
@param cacheEnabled 是否缓存登录方式 当该参数为YES,默认以上次登录方式登录,不会弹出登录选择框。 |
|
184 |
*/ |
|
185 |
+(void)login:(id<WALoginViewDelegate>)delegate cacheEnabled:(BOOL)cacheEnabled; |
|
186 |
/*! |
|
187 |
@abstract 调用此方法隐藏登录界面 |
|
188 |
*/ |
|
189 |
+(void)hide; |
|
190 |
/*! |
|
191 |
@abstract 清除登录方式的缓存 清除缓存之后会再次弹出登录选择框 |
|
192 |
*/ |
|
193 |
+(void)clearLoginCache; |
|
194 |
/*! |
|
195 |
@abstract 调用此方法打开账户管理界面 |
|
196 |
@param delegate 委托 |
|
197 |
*/ |
|
198 |
+(void)openAccountManager:(id<WAAcctManagerDelegate>)delegate; |
|
199 |
|
|
200 |
/*! |
|
201 |
@abstract 获取账户信息 |
|
202 |
@param platform 平台 |
|
203 |
*/ |
|
204 |
+(WAAppUser*)getAccountInfoWithPlatform:(NSString *const)platform; |
|
205 |
|
|
206 |
//+(NSString*)transferWithPlatform:(NSString *const)platform; |
|
207 |
|
|
208 |
/*! |
|
209 |
@discussion 处理UIApplicationDelegate的方法[-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions]传递过来的参数。 |
|
210 |
*/ |
|
211 |
+ (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; |
|
212 |
|
|
213 |
/*! |
|
214 |
@discussion 处理UIApplicationDelegate的方法[+ (void)applicationDidBecomeActive:(UIApplication *)application]传递过来的参数。 |
|
215 |
*/ |
|
216 |
+ (void)applicationDidBecomeActive:(UIApplication *)application; |
|
217 |
|
|
218 |
/*! |
|
219 |
@discussion 处理UIApplicationDelegate的方法[-(BOOL)application:(UIApplication *)application |
|
220 |
openURL:(NSURL *)url |
|
221 |
sourceApplication:(NSString *)sourceApplication |
|
222 |
annotation:(id)annotation]传递过来的参数。 |
|
223 |
*/ |
|
224 |
+(BOOL)application:(UIApplication *)application |
|
225 |
openURL:(NSURL *)url |
|
226 |
sourceApplication:(NSString *)sourceApplication |
|
227 |
annotation:(id)annotation; |
|
228 |
|
|
229 |
/*! |
|
230 |
@discussion (tip:CP无需关注)此方法为成功登录第三方平台之后调用。根据第三方平台的pUserId,pToken,platform构建一个WALoginResult实例作为参数调用此方法。此方法将会调用WindAnalytics的登录接口。 |
|
231 |
@param result 登录结果 |
|
232 |
@param delegate 委托 |
|
233 |
*/ |
|
234 |
+(void)loginWithResult:(WALoginResult*)result delegate:(id<WALoginDelegate>)delegate; |
|
235 |
|
|
236 |
+(void)loginWithResult:(WALoginResult*)result extInfo:(NSString*)extInfo delegate:(id<WALoginDelegate>)delegate; |
|
237 |
|
|
238 |
/*! |
|
239 |
@discussion (tip:CP无需关注)设置当前的登录平台 |
|
240 |
*/ |
|
241 |
+(void)setCurrentLoginPlatform:(NSString *const)platform; |
|
242 |
/*! |
|
243 |
@discussion (tip:CP无需关注)获取当前的登录平台 |
|
244 |
*/ |
|
245 |
+(NSString*)getCurrentLoginPlatform; |
|
246 |
/*! |
|
247 |
@discussion (tip:CP无需关注)获取当前的登录结果 |
|
248 |
*/ |
|
249 |
+(WALoginResult*)getCurrentLoginResult; |
|
250 |
|
|
251 |
/*! |
|
252 |
@discussion (tip:CP无需关注)获取用户模块组件 |
|
253 |
*/ |
|
254 |
+(NSArray*)getUserComponents; |
|
255 |
@end |