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 |
|
|
27 |
@protocol FBSDKLoginButtonDelegate; |
|
28 |
|
9febd9
|
29 |
/** |
W |
30 |
NS_ENUM(NSUInteger, FBSDKLoginButtonTooltipBehavior) |
|
31 |
Indicates the desired login tooltip behavior. |
bad748
|
32 |
*/ |
W |
33 |
typedef NS_ENUM(NSUInteger, FBSDKLoginButtonTooltipBehavior) |
|
34 |
{ |
9febd9
|
35 |
/** The default behavior. The tooltip will only be displayed if |
bad748
|
36 |
the app is eligible (determined by possible server round trip) */ |
W |
37 |
FBSDKLoginButtonTooltipBehaviorAutomatic = 0, |
9febd9
|
38 |
/** Force display of the tooltip (typically for UI testing) */ |
bad748
|
39 |
FBSDKLoginButtonTooltipBehaviorForceDisplay = 1, |
9febd9
|
40 |
/** Force disable. In this case you can still exert more refined |
bad748
|
41 |
control by manually constructing a `FBSDKLoginTooltipView` instance. */ |
W |
42 |
FBSDKLoginButtonTooltipBehaviorDisable = 2 |
|
43 |
}; |
|
44 |
|
9febd9
|
45 |
/** |
W |
46 |
A button that initiates a log in or log out flow upon tapping. |
|
47 |
|
|
48 |
`FBSDKLoginButton` works with `[FBSDKAccessToken currentAccessToken]` to |
bad748
|
49 |
determine what to display, and automatically starts authentication when tapped (i.e., |
W |
50 |
you do not need to manually subscribe action targets). |
|
51 |
|
|
52 |
Like `FBSDKLoginManager`, you should make sure your app delegate is connected to |
|
53 |
`FBSDKApplicationDelegate` in order for the button's delegate to receive messages. |
|
54 |
|
|
55 |
`FBSDKLoginButton` has a fixed height of @c 30 pixels, but you may change the width. `initWithFrame:CGRectZero` |
|
56 |
will size the button to its minimum frame. |
|
57 |
*/ |
|
58 |
@interface FBSDKLoginButton : FBSDKButton |
|
59 |
|
9febd9
|
60 |
/** |
W |
61 |
The default audience to use, if publish permissions are requested at login time. |
bad748
|
62 |
*/ |
W |
63 |
@property (assign, nonatomic) FBSDKDefaultAudience defaultAudience; |
9febd9
|
64 |
/** |
W |
65 |
Gets or sets the delegate. |
bad748
|
66 |
*/ |
W |
67 |
@property (weak, nonatomic) IBOutlet id<FBSDKLoginButtonDelegate> delegate; |
9febd9
|
68 |
/** |
W |
69 |
Gets or sets the login behavior to use |
bad748
|
70 |
*/ |
W |
71 |
@property (assign, nonatomic) FBSDKLoginBehavior loginBehavior; |
9febd9
|
72 |
/** |
W |
73 |
The publish permissions to request. |
bad748
|
74 |
|
9febd9
|
75 |
|
W |
76 |
Use `defaultAudience` to specify the default audience to publish to. |
bad748
|
77 |
Note this is converted to NSSet and is only |
W |
78 |
an NSArray for the convenience of literal syntax. |
|
79 |
*/ |
|
80 |
@property (copy, nonatomic) NSArray *publishPermissions; |
9febd9
|
81 |
/** |
W |
82 |
The read permissions to request. |
bad748
|
83 |
|
9febd9
|
84 |
|
W |
85 |
Note, that if read permissions are specified, then publish permissions should not be specified. This is converted to NSSet and is only |
bad748
|
86 |
an NSArray for the convenience of literal syntax. |
W |
87 |
*/ |
|
88 |
@property (copy, nonatomic) NSArray *readPermissions; |
9febd9
|
89 |
/** |
W |
90 |
Gets or sets the desired tooltip behavior. |
bad748
|
91 |
*/ |
W |
92 |
@property (assign, nonatomic) FBSDKLoginButtonTooltipBehavior tooltipBehavior; |
9febd9
|
93 |
/** |
W |
94 |
Gets or sets the desired tooltip color style. |
bad748
|
95 |
*/ |
W |
96 |
@property (assign, nonatomic) FBSDKTooltipColorStyle tooltipColorStyle; |
|
97 |
|
|
98 |
@end |
|
99 |
|
9febd9
|
100 |
/** |
bad748
|
101 |
@protocol |
9febd9
|
102 |
A delegate for `FBSDKLoginButton` |
bad748
|
103 |
*/ |
W |
104 |
@protocol FBSDKLoginButtonDelegate <NSObject> |
|
105 |
|
|
106 |
@required |
9febd9
|
107 |
/** |
W |
108 |
Sent to the delegate when the button was used to login. |
|
109 |
- Parameter loginButton: the sender |
|
110 |
- Parameter result: The results of the login |
|
111 |
- Parameter error: The error (if any) from the login |
bad748
|
112 |
*/ |
37c026
|
113 |
- (void)loginButton:(FBSDKLoginButton *)loginButton |
bad748
|
114 |
didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result |
W |
115 |
error:(NSError *)error; |
|
116 |
|
9febd9
|
117 |
/** |
W |
118 |
Sent to the delegate when the button was used to logout. |
|
119 |
- Parameter 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. |
|
126 |
- Parameter loginButton: the sender |
|
127 |
- Returns: YES if the login should be allowed to proceed, NO otherwise |
bad748
|
128 |
*/ |
W |
129 |
- (BOOL) loginButtonWillLogin:(FBSDKLoginButton *)loginButton; |
|
130 |
|
|
131 |
@end |