commit | author | age
|
3eceb5
|
1 |
// |
W |
2 |
// VKAuthorizationResult.h |
|
3 |
// |
|
4 |
// Copyright (c) 2015 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 "VKAccessToken.h" |
|
24 |
#import "VKError.h" |
|
25 |
|
|
26 |
typedef NS_ENUM(NSUInteger, VKAuthorizationState) { |
|
27 |
/// Authorization state unknown, probably ready to work or something went wrong |
|
28 |
VKAuthorizationUnknown, |
|
29 |
/// SDK initialized and ready to authorize |
|
30 |
VKAuthorizationInitialized, |
|
31 |
/// Authorization state pending, probably we're trying to load auth information |
|
32 |
VKAuthorizationPending, |
|
33 |
/// Started external authorization process |
|
34 |
VKAuthorizationExternal, |
|
35 |
/// Started in app authorization process, using SafariViewController |
|
36 |
VKAuthorizationSafariInApp, |
|
37 |
/// Started in app authorization process, using webview |
|
38 |
VKAuthorizationWebview, |
|
39 |
/// User authorized |
|
40 |
VKAuthorizationAuthorized, |
|
41 |
/// An error occured, try to wake up session later |
|
42 |
VKAuthorizationError, |
|
43 |
}; |
|
44 |
|
|
45 |
/** |
|
46 |
When authorization is completed or failed with error, object of this class will be send in vkSdkAccessAuthorizationFinishedWithResult: method. |
|
47 |
*/ |
|
48 |
@interface VKAuthorizationResult : VKObject |
|
49 |
|
|
50 |
/// Access token recieved after successfull authorization |
|
51 |
@property(nonatomic, readonly, strong) VKAccessToken *token; |
|
52 |
|
|
53 |
/// Available information about current user of SDK. Notice that info is available in SDK-delegate vkSdkAuthorizationStateUpdatedWithResult: method. |
|
54 |
@property(nonatomic, readonly, strong) VKUser *user; |
|
55 |
|
|
56 |
/// If some error or authorization cancelation happened, this field contains basic error information |
|
57 |
@property(nonatomic, readonly, strong) NSError *error; |
|
58 |
|
|
59 |
/// Current state of authorization |
|
60 |
@property(nonatomic, readonly, assign) VKAuthorizationState state; |
|
61 |
|
|
62 |
@end |
|
63 |
|
|
64 |
/** |
|
65 |
* This is mutable version of VKAuthorizationResult class |
|
66 |
*/ |
|
67 |
@interface VKMutableAuthorizationResult : VKAuthorizationResult |
|
68 |
|
|
69 |
@property(nonatomic, readwrite, strong) VKAccessToken *token; |
|
70 |
|
|
71 |
@property(nonatomic, readwrite, strong) VKUser *user; |
|
72 |
|
|
73 |
@property(nonatomic, readwrite, strong) NSError *error; |
|
74 |
|
|
75 |
@property(nonatomic, readwrite, assign) VKAuthorizationState state; |
|
76 |
|
b80c10
|
77 |
@end |