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 |
*/ |
e81c27
|
31 |
NS_SWIFT_NAME(DeviceLoginManagerDelegate) |
9f077b
|
32 |
@protocol FBSDKDeviceLoginManagerDelegate <NSObject> |
H |
33 |
|
|
34 |
/*! |
|
35 |
@abstract Indicates the device login flow has started. You should parse `codeInfo` to |
|
36 |
present the code to the user to enter. |
|
37 |
@param loginManager the login manager instance. |
|
38 |
@param codeInfo the code info data. |
|
39 |
*/ |
e81c27
|
40 |
- (void)deviceLoginManager:(FBSDKDeviceLoginManager *)loginManager |
H |
41 |
startedWithCodeInfo:(FBSDKDeviceLoginCodeInfo *)codeInfo; |
9f077b
|
42 |
|
H |
43 |
/*! |
|
44 |
@abstract Indicates the device login flow has finished. |
|
45 |
@param loginManager the login manager instance. |
|
46 |
@param result the results of the login flow. |
|
47 |
@param error the error, if available. |
|
48 |
@discussion The flow can be finished if the user completed the flow, cancelled, or if the code has expired. |
|
49 |
*/ |
|
50 |
- (void)deviceLoginManager:(FBSDKDeviceLoginManager *)loginManager |
|
51 |
completedWithResult:(nullable FBSDKDeviceLoginManagerResult *)result |
|
52 |
error:(nullable NSError *)error; |
|
53 |
|
|
54 |
@end |
|
55 |
|
|
56 |
/*! |
|
57 |
@abstract Use this class to perform a device login flow. |
|
58 |
@discussion The device login flow starts by requesting a code from the device login API. |
|
59 |
This class informs the delegate when this code is received. You should then present the |
|
60 |
code to the user to enter. In the meantime, this class polls the device login API |
|
61 |
periodically and informs the delegate of the results. |
|
62 |
|
|
63 |
See [Facebook Device Login](https://developers.facebook.com/docs/facebook-login/for-devices). |
|
64 |
*/ |
e81c27
|
65 |
NS_SWIFT_NAME(DeviceLoginManager) |
9f077b
|
66 |
@interface FBSDKDeviceLoginManager : NSObject <NSNetServiceDelegate> |
H |
67 |
|
|
68 |
/*! |
|
69 |
@abstract Initializes a new instance. |
|
70 |
@param permissions permissions to request. |
|
71 |
*/ |
e81c27
|
72 |
- (instancetype)initWithPermissions:(NSArray<NSString *> *)permissions |
9f077b
|
73 |
enableSmartLogin:(BOOL)enableSmartLogin |
H |
74 |
NS_DESIGNATED_INITIALIZER; |
|
75 |
|
|
76 |
- (instancetype)init NS_UNAVAILABLE; |
|
77 |
+ (instancetype)new NS_UNAVAILABLE; |
|
78 |
|
|
79 |
/*! |
|
80 |
@abstract the delegate. |
|
81 |
*/ |
|
82 |
@property (nonatomic, weak) id<FBSDKDeviceLoginManagerDelegate> delegate; |
|
83 |
|
|
84 |
/*! |
|
85 |
@abstract the requested permissions. |
|
86 |
*/ |
e81c27
|
87 |
@property (nonatomic, copy, readonly) NSArray<NSString *> *permissions; |
9f077b
|
88 |
|
H |
89 |
/*! |
|
90 |
@abstract the optional URL to redirect the user to after they complete the login. |
|
91 |
@discussion the URL must be configured in your App Settings -> Advanced -> OAuth Redirect URIs |
|
92 |
*/ |
|
93 |
@property (nullable, nonatomic, copy) NSURL *redirectURL; |
|
94 |
|
|
95 |
/*! |
|
96 |
@abstract Starts the device login flow |
|
97 |
@discussion This instance will retain self until the flow is finished or cancelled. |
|
98 |
*/ |
|
99 |
- (void)start; |
|
100 |
|
|
101 |
/*! |
|
102 |
@abstract Attempts to cancel the device login flow. |
|
103 |
*/ |
|
104 |
- (void)cancel; |
|
105 |
|
|
106 |
@end |
|
107 |
|
|
108 |
NS_ASSUME_NONNULL_END |