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