commit | author | age
|
9f077b
|
1 |
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. |
H |
2 |
// |
|
3 |
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, |
|
4 |
// copy, modify, and distribute this software in source code or binary form for use |
|
5 |
// in connection with the web services and APIs provided by Facebook. |
|
6 |
// |
|
7 |
// As with any software that integrates with the Facebook platform, your use of |
|
8 |
// this software is subject to the Facebook Developer Principles and Policies |
|
9 |
// [http://developers.facebook.com/policy/]. This copyright notice shall be |
|
10 |
// included in all copies or substantial portions of the software. |
|
11 |
// |
|
12 |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
13 |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
|
14 |
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
|
15 |
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
|
16 |
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
|
17 |
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
18 |
|
|
19 |
#import <Foundation/Foundation.h> |
|
20 |
|
|
21 |
#import <FBSDKLoginKit/FBSDKDeviceLoginCodeInfo.h> |
|
22 |
#import <FBSDKLoginKit/FBSDKDeviceLoginManagerResult.h> |
|
23 |
|
|
24 |
NS_ASSUME_NONNULL_BEGIN |
|
25 |
|
|
26 |
@class FBSDKDeviceLoginManager; |
|
27 |
|
|
28 |
/*! |
|
29 |
@abstract A delegate for `FBSDKDeviceLoginManager`. |
|
30 |
*/ |
|
31 |
@protocol FBSDKDeviceLoginManagerDelegate <NSObject> |
|
32 |
|
|
33 |
/*! |
|
34 |
@abstract Indicates the device login flow has started. You should parse `codeInfo` to |
|
35 |
present the code to the user to enter. |
|
36 |
@param loginManager the login manager instance. |
|
37 |
@param codeInfo the code info data. |
|
38 |
*/ |
|
39 |
- (void)deviceLoginManager:(FBSDKDeviceLoginManager *)loginManager startedWithCodeInfo:(FBSDKDeviceLoginCodeInfo *)codeInfo; |
|
40 |
|
|
41 |
/*! |
|
42 |
@abstract Indicates the device login flow has finished. |
|
43 |
@param loginManager the login manager instance. |
|
44 |
@param result the results of the login flow. |
|
45 |
@param error the error, if available. |
|
46 |
@discussion The flow can be finished if the user completed the flow, cancelled, or if the code has expired. |
|
47 |
*/ |
|
48 |
- (void)deviceLoginManager:(FBSDKDeviceLoginManager *)loginManager |
|
49 |
completedWithResult:(nullable FBSDKDeviceLoginManagerResult *)result |
|
50 |
error:(nullable NSError *)error; |
|
51 |
|
|
52 |
@end |
|
53 |
|
|
54 |
/*! |
|
55 |
@abstract Use this class to perform a device login flow. |
|
56 |
@discussion The device login flow starts by requesting a code from the device login API. |
|
57 |
This class informs the delegate when this code is received. You should then present the |
|
58 |
code to the user to enter. In the meantime, this class polls the device login API |
|
59 |
periodically and informs the delegate of the results. |
|
60 |
|
|
61 |
See [Facebook Device Login](https://developers.facebook.com/docs/facebook-login/for-devices). |
|
62 |
*/ |
|
63 |
@interface FBSDKDeviceLoginManager : NSObject <NSNetServiceDelegate> |
|
64 |
|
|
65 |
/*! |
|
66 |
@abstract Initializes a new instance. |
|
67 |
@param permissions permissions to request. |
|
68 |
*/ |
|
69 |
- (instancetype)initWithPermissions:(nullable NSArray<NSString *> *)permissions |
|
70 |
enableSmartLogin:(BOOL)enableSmartLogin |
|
71 |
NS_DESIGNATED_INITIALIZER; |
|
72 |
|
|
73 |
- (instancetype)init NS_UNAVAILABLE; |
|
74 |
+ (instancetype)new NS_UNAVAILABLE; |
|
75 |
|
|
76 |
/*! |
|
77 |
@abstract the delegate. |
|
78 |
*/ |
|
79 |
@property (nonatomic, weak) id<FBSDKDeviceLoginManagerDelegate> delegate; |
|
80 |
|
|
81 |
/*! |
|
82 |
@abstract the requested permissions. |
|
83 |
*/ |
|
84 |
@property (nullable, nonatomic, copy, readonly) NSArray<NSString *> *permissions; |
|
85 |
|
|
86 |
/*! |
|
87 |
@abstract the optional URL to redirect the user to after they complete the login. |
|
88 |
@discussion the URL must be configured in your App Settings -> Advanced -> OAuth Redirect URIs |
|
89 |
*/ |
|
90 |
@property (nullable, nonatomic, copy) NSURL *redirectURL; |
|
91 |
|
|
92 |
/*! |
|
93 |
@abstract Starts the device login flow |
|
94 |
@discussion This instance will retain self until the flow is finished or cancelled. |
|
95 |
*/ |
|
96 |
- (void)start; |
|
97 |
|
|
98 |
/*! |
|
99 |
@abstract Attempts to cancel the device login flow. |
|
100 |
*/ |
|
101 |
- (void)cancel; |
|
102 |
|
|
103 |
@end |
|
104 |
|
|
105 |
NS_ASSUME_NONNULL_END |