commit | author | age
|
bad748
|
1 |
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. |
W |
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 <UIKit/UIKit.h> |
|
20 |
|
|
21 |
#import <FBSDKCoreKit/FBSDKButton.h> |
|
22 |
|
|
23 |
#import <FBSDKLoginKit/FBSDKLoginManager.h> |
|
24 |
|
|
25 |
#import "FBSDKTooltipView.h" |
|
26 |
|
e81c27
|
27 |
NS_ASSUME_NONNULL_BEGIN |
H |
28 |
|
bad748
|
29 |
@protocol FBSDKLoginButtonDelegate; |
W |
30 |
|
9febd9
|
31 |
/** |
W |
32 |
NS_ENUM(NSUInteger, FBSDKLoginButtonTooltipBehavior) |
|
33 |
Indicates the desired login tooltip behavior. |
bad748
|
34 |
*/ |
W |
35 |
typedef NS_ENUM(NSUInteger, FBSDKLoginButtonTooltipBehavior) |
|
36 |
{ |
9febd9
|
37 |
/** The default behavior. The tooltip will only be displayed if |
bad748
|
38 |
the app is eligible (determined by possible server round trip) */ |
W |
39 |
FBSDKLoginButtonTooltipBehaviorAutomatic = 0, |
9febd9
|
40 |
/** Force display of the tooltip (typically for UI testing) */ |
bad748
|
41 |
FBSDKLoginButtonTooltipBehaviorForceDisplay = 1, |
9febd9
|
42 |
/** Force disable. In this case you can still exert more refined |
bad748
|
43 |
control by manually constructing a `FBSDKLoginTooltipView` instance. */ |
W |
44 |
FBSDKLoginButtonTooltipBehaviorDisable = 2 |
e81c27
|
45 |
} NS_SWIFT_NAME(FBLoginButton.TooltipBehavior); |
bad748
|
46 |
|
9febd9
|
47 |
/** |
W |
48 |
A button that initiates a log in or log out flow upon tapping. |
|
49 |
|
|
50 |
`FBSDKLoginButton` works with `[FBSDKAccessToken currentAccessToken]` to |
bad748
|
51 |
determine what to display, and automatically starts authentication when tapped (i.e., |
W |
52 |
you do not need to manually subscribe action targets). |
|
53 |
|
|
54 |
Like `FBSDKLoginManager`, you should make sure your app delegate is connected to |
|
55 |
`FBSDKApplicationDelegate` in order for the button's delegate to receive messages. |
|
56 |
|
|
57 |
`FBSDKLoginButton` has a fixed height of @c 30 pixels, but you may change the width. `initWithFrame:CGRectZero` |
|
58 |
will size the button to its minimum frame. |
|
59 |
*/ |
e81c27
|
60 |
NS_SWIFT_NAME(FBLoginButton) |
bad748
|
61 |
@interface FBSDKLoginButton : FBSDKButton |
W |
62 |
|
9febd9
|
63 |
/** |
W |
64 |
The default audience to use, if publish permissions are requested at login time. |
bad748
|
65 |
*/ |
W |
66 |
@property (assign, nonatomic) FBSDKDefaultAudience defaultAudience; |
9febd9
|
67 |
/** |
W |
68 |
Gets or sets the delegate. |
bad748
|
69 |
*/ |
W |
70 |
@property (weak, nonatomic) IBOutlet id<FBSDKLoginButtonDelegate> delegate; |
9febd9
|
71 |
/** |
W |
72 |
Gets or sets the login behavior to use |
bad748
|
73 |
*/ |
88188e
|
74 |
@property (assign, nonatomic) FBSDKLoginBehavior loginBehavior |
L |
75 |
DEPRECATED_MSG_ATTRIBUTE("All login flows utilize the browser. This will be removed in the next major release"); |
bad748
|
76 |
|
e81c27
|
77 |
/*! |
H |
78 |
@abstract The permissions to request. |
|
79 |
@discussion To provide the best experience, you should minimize the number of permissions you request, and only ask for them when needed. |
|
80 |
For example, do not ask for "user_location" until you the information is actually used by the app. |
9febd9
|
81 |
|
bad748
|
82 |
Note this is converted to NSSet and is only |
W |
83 |
an NSArray for the convenience of literal syntax. |
|
84 |
|
e81c27
|
85 |
See [the permissions guide]( https://developers.facebook.com/docs/facebook-login/permissions/ ) for more details. |
bad748
|
86 |
*/ |
e81c27
|
87 |
@property (copy, nonatomic) NSArray<NSString *> *permissions; |
9febd9
|
88 |
/** |
W |
89 |
Gets or sets the desired tooltip behavior. |
bad748
|
90 |
*/ |
W |
91 |
@property (assign, nonatomic) FBSDKLoginButtonTooltipBehavior tooltipBehavior; |
9febd9
|
92 |
/** |
W |
93 |
Gets or sets the desired tooltip color style. |
bad748
|
94 |
*/ |
W |
95 |
@property (assign, nonatomic) FBSDKTooltipColorStyle tooltipColorStyle; |
|
96 |
|
|
97 |
@end |
|
98 |
|
9febd9
|
99 |
/** |
bad748
|
100 |
@protocol |
9febd9
|
101 |
A delegate for `FBSDKLoginButton` |
bad748
|
102 |
*/ |
e81c27
|
103 |
NS_SWIFT_NAME(LoginButtonDelegate) |
bad748
|
104 |
@protocol FBSDKLoginButtonDelegate <NSObject> |
W |
105 |
|
|
106 |
@required |
9febd9
|
107 |
/** |
W |
108 |
Sent to the delegate when the button was used to login. |
13e53a
|
109 |
@param loginButton the sender |
H |
110 |
@param result The results of the login |
|
111 |
@param error The error (if any) from the login |
bad748
|
112 |
*/ |
37c026
|
113 |
- (void)loginButton:(FBSDKLoginButton *)loginButton |
e81c27
|
114 |
didCompleteWithResult:(nullable FBSDKLoginManagerLoginResult *)result |
H |
115 |
error:(nullable NSError *)error; |
bad748
|
116 |
|
9febd9
|
117 |
/** |
W |
118 |
Sent to the delegate when the button was used to logout. |
13e53a
|
119 |
@param loginButton The button that was clicked. |
bad748
|
120 |
*/ |
W |
121 |
- (void)loginButtonDidLogOut:(FBSDKLoginButton *)loginButton; |
|
122 |
|
|
123 |
@optional |
9febd9
|
124 |
/** |
W |
125 |
Sent to the delegate when the button is about to login. |
13e53a
|
126 |
@param loginButton the sender |
H |
127 |
@return YES if the login should be allowed to proceed, NO otherwise |
bad748
|
128 |
*/ |
e81c27
|
129 |
- (BOOL)loginButtonWillLogin:(FBSDKLoginButton *)loginButton; |
bad748
|
130 |
|
W |
131 |
@end |
e81c27
|
132 |
|
H |
133 |
NS_ASSUME_NONNULL_END |