commit | author | age
|
3eceb5
|
1 |
// |
W |
2 |
// VKAuthorizeController.h |
|
3 |
// |
|
4 |
// Copyright (c) 2014 VK.com |
|
5 |
// |
|
6 |
// Permission is hereby granted, free of charge, to any person obtaining a copy of |
|
7 |
// this software and associated documentation files (the "Software"), to deal in |
|
8 |
// the Software without restriction, including without limitation the rights to |
|
9 |
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
|
10 |
// the Software, and to permit persons to whom the Software is furnished to do so, |
|
11 |
// subject to the following conditions: |
|
12 |
// |
|
13 |
// The above copyright notice and this permission notice shall be included in all |
|
14 |
// copies or substantial portions of the Software. |
|
15 |
// |
|
16 |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
17 |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
|
18 |
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
|
19 |
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
|
20 |
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
|
21 |
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
22 |
|
|
23 |
#import <UIKit/UIKit.h> |
|
24 |
#import "VKSdk.h" |
|
25 |
extern NSString *VK_AUTHORIZE_URL_STRING; |
|
26 |
|
|
27 |
typedef NS_ENUM(NSInteger, VKAuthorizationType) { |
|
28 |
VKAuthorizationTypeWebView, |
|
29 |
VKAuthorizationTypeSafari, |
|
30 |
VKAuthorizationTypeApp |
|
31 |
}; |
|
32 |
|
b80c10
|
33 |
@interface VKNavigationController : UINavigationController |
H |
34 |
|
|
35 |
@end |
|
36 |
|
3eceb5
|
37 |
@interface VKAuthorizationContext : VKObject |
W |
38 |
@property (nonatomic, readonly, strong) NSString *clientId; |
|
39 |
@property (nonatomic, readonly, strong) NSString *displayType; |
|
40 |
@property (nonatomic, readonly, strong) NSArray<NSString*> *scope; |
|
41 |
@property (nonatomic, readonly) BOOL revoke; |
|
42 |
|
|
43 |
/** |
|
44 |
Prepare context for building oauth url |
|
45 |
@param authType type of authorization will be used |
|
46 |
@param clientId id of the application |
|
47 |
@param displayType selected display type |
|
48 |
@param scope requested scope for application |
|
49 |
@param revoke If YES, user will see permissions list and allow to logout (if logged in already) |
|
50 |
@return Prepared context, which must be passed into buildAuthorizationURLWithContext: method |
|
51 |
*/ |
|
52 |
+(instancetype) contextWithAuthType:(VKAuthorizationType) authType |
|
53 |
clientId:(NSString*)clientId |
|
54 |
displayType:(NSString*)displayType |
|
55 |
scope:(NSArray<NSString*>*)scope |
|
56 |
revoke:(BOOL) revoke; |
|
57 |
|
|
58 |
@end |
|
59 |
|
|
60 |
/** |
|
61 |
Controller for authorization through webview (if VK app not available) |
|
62 |
*/ |
60b963
|
63 |
@interface VKAuthorizeController : UIViewController |
3eceb5
|
64 |
|
W |
65 |
/** |
60b963
|
66 |
Causes web view in standard UINavigationController be presented in SDK delegate |
3eceb5
|
67 |
@param appId Identifier of VK application |
W |
68 |
@param permissions Permissions that user specified for application |
|
69 |
@param revoke If YES, user will see permissions list and allow to logout (if logged in already) |
|
70 |
@param displayType Defines view of authorization screen |
|
71 |
*/ |
|
72 |
+ (void)presentForAuthorizeWithAppId:(NSString *)appId |
|
73 |
andPermissions:(NSArray *)permissions |
|
74 |
revokeAccess:(BOOL)revoke |
|
75 |
displayType:(VKDisplayType)displayType; |
|
76 |
|
|
77 |
/** |
60b963
|
78 |
Causes web view in standard UINavigationController be presented for user validation |
3eceb5
|
79 |
@param validationError validation error returned by API |
W |
80 |
*/ |
|
81 |
+ (void)presentForValidation:(VKError *)validationError; |
|
82 |
|
|
83 |
+ (NSURL *)buildAuthorizationURLWithContext:(VKAuthorizationContext*) ctx; |
|
84 |
|
|
85 |
@end |