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