Blame view

ios/GameSDKDemo/letsgameDemo/VKSdk.framework/Versions/A/Headers/VKSdk.h 8.63 KB
23a302b86   alexYang   GameSDK 的iOS分支提交,...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
  //
  //  VKSdk.h
  //
  //  Copyright (c) 2014 VK.com
  //
  //  Permission is hereby granted, free of charge, to any person obtaining a copy of
  //  this software and associated documentation files (the "Software"), to deal in
  //  the Software without restriction, including without limitation the rights to
  //  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  //  the Software, and to permit persons to whom the Software is furnished to do so,
  //  subject to the following conditions:
  //
  //  The above copyright notice and this permission notice shall be included in all
  //  copies or substantial portions of the Software.
  //
  //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  //  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  //  FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  //  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  //  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  //  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  //
  //  --------------------------------------------------------------------------------
  //
  //  Modified by Ruslan Kavetsky
  
  #import <Foundation/Foundation.h>
  #import "VKAccessToken.h"
  #import "VKPermissions.h"
  #import "VKUtil.h"
  #import "VKApi.h"
  #import "VKApiConst.h"
  #import "VKSdkVersion.h"
  #import "VKCaptchaViewController.h"
  #import "VKRequest.h"
  #import "VKBatchRequest.h"
  #import "NSError+VKError.h"
  #import "VKApiModels.h"
  #import "VKUploadImage.h"
  #import "VKShareDialogController.h"
  #import "VKActivity.h"
  #import "VKAuthorizationResult.h"
  
  typedef NS_OPTIONS(NSUInteger, VKAuthorizationOptions) {
      VKAuthorizationOptionsUnlimitedToken = 1 << 0,
      VKAuthorizationOptionsDisableSafariController = 1 << 1,
  };
  
  typedef NS_ENUM(NSUInteger, VKAuthorizationState) {
      VKAuthorizationUnknown, // Authorization state unknown, probably something went wrong
      VKAuthorizationInitialized, // SDK initialized and ready to authorize
      VKAuthorizationPending, // Authorization state pending, probably we're trying to load auth information
      VKAuthorizationExternal, // Started external authorization process
      VKAuthorizationSafariInApp, // Started in app authorization process, using SafariViewController
      VKAuthorizationWebview, // Started in app authorization process, using webview
      VKAuthorizationAuthorized, // User authorized
      VKAuthorizationError, // An error occured, try to wake up session later
  };
  
  /**
   SDK events delegate protocol.
   You should implement it, typically as main view controller or as application delegate.
  */
  @protocol VKSdkDelegate <NSObject>
  @required
  
  /**
   Notifies delegate about authorization was completed successfully, and token received
   @param result contains new token or error, retrieved after VK authorization
   */
  - (void)vkSdkAccessAuthorizationFinishedWithResult:(VKAuthorizationResult *)result;
  
  /**
   Notifies delegate about access error, mostly connected with user deauthorized application
   */
  - (void)vkSdkUserAuthorizationFailed:(VKError *)result;
  
  @optional
  
  /**
   Notifies delegate about access token changed
   @param newToken new token for API requests
   @param oldToken previous used token
   */
  - (void)vkSdkAccessTokenUpdated:(VKAccessToken *)newToken oldToken:(VKAccessToken *)oldToken;
  
  /**
   Notifies delegate about existing token has expired
   @param expiredToken old token that has expired
   */
  - (void)vkSdkTokenHasExpired:(VKAccessToken *)expiredToken;
  
  @end
  
  
  @protocol VKSdkUIDelegate <NSObject>
  /**
   Pass view controller that should be presented to user. Usually, it's an authorization window
   @param controller view controller that must be shown to user
   */
  - (void)vkSdkShouldPresentViewController:(UIViewController *)controller;
  
  /**
   Calls when user must perform captcha-check
   @param captchaError error returned from API. You can load captcha image from <b>captchaImg</b> property.
   After user answered current captcha, call answerCaptcha: method with user entered answer.
   */
  - (void)vkSdkNeedCaptchaEnter:(VKError *)captchaError;
  
  @optional
  /**
   * Called when a controller presented by SDK will be dismissed
   */
  - (void)vkSdkWillDismissViewController:(UIViewController *)controller;
  
  /**
   * Called when a controller presented by SDK did dismiss
   */
  - (void)vkSdkDidDismissViewController:(UIViewController *)controller;
  
  
  
  @end
  
  
  /**
  Entry point for using VK sdk. Should be initialized at application start
  */
  @interface VKSdk : NSObject
  
  ///-------------------------------
  /// @name Delegate
  ///-------------------------------
  @property(nonatomic, readwrite, weak) id <VKSdkUIDelegate> uiDelegate;
  
  /// Returns a last app_id used for initializing the SDK
  @property(nonatomic, readonly, copy) NSString *currentAppId;
  
  /// API version for making requests
  @property(nonatomic, readonly, copy) NSString *apiVersion;
  ///-------------------------------
  /// @name Initialization
  ///-------------------------------
  /**
  Returns instance of VK sdk. You should never use that directly
  */
  + (instancetype)instance;
  
  /**
  Initialize SDK with responder for global SDK events with default api version from VK_SDK_API_VERSION
  @param appId your application id (if you haven't, you can create standalone application here https://vk.com/editapp?act=create )
  */
  + (instancetype)initializeWithAppId:(NSString *)appId;
  
  /**
  Initialize SDK with responder for global SDK events
  @param appId your application id (if you haven't, you can create standalone application here https://vk.com/editapp?act=create )
  @param apiVersion if you want to use latest API version, pass required version here
  */
  + (instancetype)initializeWithAppId:(NSString *)appId
                           apiVersion:(NSString *)version;
  
  /**
   Adds a weak object reference to an object implementing the VKSdkDelegate protocol
   */
  - (void)registerDelegate:(id <VKSdkDelegate>)delegate;
  
  /**
   Removes an object reference SDK delegate
   */
  - (void)unregisterDelegate:(id <VKSdkDelegate>)delegate;
  
  ///-------------------------------
  /// @name Authentication in VK
  ///-------------------------------
  
  /**
  Starts authorization process to retrieve unlimited token. If VKapp is available in system, it will opens and requests access from user.
  Otherwise Mobile Safari will be opened for access request.
  @param permissions array of permissions for your applications. All permissions you can
  */
  + (void)authorize:(NSArray *)permissions;
  
  /**
   Starts authorization process. If VKapp is available in system, it will opens and requests access from user.
   Otherwise Mobile Safari will be opened for access request.
   @param permissions array of permissions for your applications. All permissions you can
   @param options special options
   */
  + (void)authorize:(NSArray *)permissions withOptions:(VKAuthorizationOptions)options;
  
  ///-------------------------------
  /// @name Access token methods
  ///-------------------------------
  
  /**
  Returns token for API requests
  @return Received access token or nil, if user not yet authorized
  */
  + (VKAccessToken *)accessToken;
  
  ///-------------------------------
  /// @name Other methods
  ///-------------------------------
  
  /**
  Checks passed URL for access token
  @param passedUrl url from external application
  @param sourceApplication source application
  @return YES if parsed successfully
  */
  + (BOOL)processOpenURL:(NSURL *)passedUrl fromApplication:(NSString *)sourceApplication;
  
  
  /**
   Checks if somebody logged in with SDK (call after wakeUpSession)
   */
  + (BOOL)isLoggedIn;
  
  /**
   This method is trying to retrieve token from storage, and check application still permitted to use user access token
   */
  + (void)wakeUpSession:(NSArray *)permissions completeBlock:(void (^)(VKAuthorizationState, NSError *))wakeUpBlock;
  
  /**
  Forces logout using OAuth (with VKAuthorizeController). Removes all cookies for *.vk.com.
  Has no effect for logout in VK app
  */
  + (void)forceLogout;
  
  /**
  * Checks if there is some application, which may process authorize url
  */
  + (BOOL)vkAppMayExists;
  
  /**
  Check existing permissions
  @param permissions array of permissions you want to check
  */
  - (BOOL)hasPermissions:(NSArray *)permissions;
  
  /**
  Enables or disables scheduling for requests
  */
  + (void)setSchedulerEnabled:(BOOL)enabled;
  
  // Deny allocating more SDK
  + (instancetype)alloc NS_UNAVAILABLE;
  
  - (instancetype)init NS_UNAVAILABLE;
  
  + (instancetype)new NS_UNAVAILABLE;
  
  @end
  
  @interface VKAccessToken (HttpsRequired)
  - (void)setAccessTokenRequiredHTTPS;
  
  - (void)notifyTokenExpired;
  @end
  
  @interface VKError (CaptchaRequest)
  - (void)notifyCaptchaRequired;
  
  - (void)notiftAuthorizationFailed;
  @end
  
  @interface UIViewController (VKController)
  
  - (void)vks_presentViewControllerThroughDelegate;
  
  - (void)vks_viewControllerWillDismiss;
  
  - (void)vks_viewControllerDidDismiss;
  
  @end