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 <Foundation/Foundation.h> |
|
20 |
#import <UIKit/UIKit.h> |
|
21 |
|
|
22 |
#import <FBSDKShareKit/FBSDKAppInviteContent.h> |
|
23 |
|
|
24 |
@protocol FBSDKAppInviteDialogDelegate; |
|
25 |
|
9febd9
|
26 |
/** |
W |
27 |
A dialog for sending App Invites. |
bad748
|
28 |
*/ |
W |
29 |
@interface FBSDKAppInviteDialog : NSObject |
|
30 |
|
9febd9
|
31 |
/** |
W |
32 |
Convenience method to show a FBSDKAppInviteDialog |
|
33 |
- Parameter viewController: A UIViewController to present the dialog from. |
|
34 |
- Parameter content: The content for the app invite. |
|
35 |
- Parameter delegate: The receiver's delegate. |
bad748
|
36 |
*/ |
W |
37 |
+ (instancetype)showFromViewController:(UIViewController *)viewController |
|
38 |
withContent:(FBSDKAppInviteContent *)content |
|
39 |
delegate:(id<FBSDKAppInviteDialogDelegate>)delegate; |
|
40 |
|
|
41 |
|
9febd9
|
42 |
/** |
W |
43 |
|
|
44 |
- Warning:use showFromViewController:withContent:delegate: instead |
bad748
|
45 |
*/ |
W |
46 |
+ (instancetype)showWithContent:(FBSDKAppInviteContent *)content delegate:(id<FBSDKAppInviteDialogDelegate>)delegate |
|
47 |
__attribute__ ((deprecated("use showFromViewController:withContent:delegate: instead"))); |
|
48 |
|
9febd9
|
49 |
/** |
W |
50 |
A UIViewController to present the dialog from. |
|
51 |
|
|
52 |
If not specified, the top most view controller will be automatically determined as best as possible. |
bad748
|
53 |
*/ |
W |
54 |
@property (nonatomic, weak) UIViewController *fromViewController; |
|
55 |
|
9febd9
|
56 |
/** |
W |
57 |
The receiver's delegate or nil if it doesn't have a delegate. |
bad748
|
58 |
*/ |
W |
59 |
@property (nonatomic, weak) id<FBSDKAppInviteDialogDelegate> delegate; |
|
60 |
|
9febd9
|
61 |
/** |
W |
62 |
The content for app invite. |
bad748
|
63 |
*/ |
W |
64 |
@property (nonatomic, copy) FBSDKAppInviteContent *content; |
|
65 |
|
9febd9
|
66 |
/** |
W |
67 |
A Boolean value that indicates whether the receiver can initiate an app invite. |
|
68 |
|
|
69 |
May return NO if the appropriate Facebook app is not installed and is required or an access token is |
bad748
|
70 |
required but not available. This method does not validate the content on the receiver, so this can be checked before |
W |
71 |
building up the content. |
9febd9
|
72 |
|
W |
73 |
- See:validateWithError: |
|
74 |
- Returns: YES if the receiver can show the dialog, otherwise NO. |
bad748
|
75 |
*/ |
W |
76 |
- (BOOL)canShow; |
|
77 |
|
9febd9
|
78 |
/** |
W |
79 |
Begins the app invite from the receiver. |
|
80 |
- Returns: YES if the receiver was able to show the dialog, otherwise NO. |
bad748
|
81 |
*/ |
W |
82 |
- (BOOL)show; |
|
83 |
|
9febd9
|
84 |
/** |
W |
85 |
Validates the content on the receiver. |
|
86 |
- Parameter errorRef: If an error occurs, upon return contains an NSError object that describes the problem. |
|
87 |
- Returns: YES if the content is valid, otherwise NO. |
bad748
|
88 |
*/ |
W |
89 |
- (BOOL)validateWithError:(NSError *__autoreleasing *)errorRef; |
|
90 |
|
|
91 |
@end |
|
92 |
|
9febd9
|
93 |
/** |
W |
94 |
A delegate for FBSDKAppInviteDialog. |
|
95 |
|
|
96 |
The delegate is notified with the results of the app invite as long as the application has permissions to |
bad748
|
97 |
receive the information. For example, if the person is not signed into the containing app, the shower may not be able |
W |
98 |
to distinguish between completion of an app invite and cancellation. |
|
99 |
*/ |
|
100 |
@protocol FBSDKAppInviteDialogDelegate <NSObject> |
|
101 |
|
9febd9
|
102 |
/** |
W |
103 |
Sent to the delegate when the app invite completes without error. |
|
104 |
- Parameter appInviteDialog: The FBSDKAppInviteDialog that completed. |
|
105 |
- Parameter results: The results from the dialog. This may be nil or empty. |
bad748
|
106 |
*/ |
W |
107 |
- (void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didCompleteWithResults:(NSDictionary *)results; |
|
108 |
|
9febd9
|
109 |
/** |
W |
110 |
Sent to the delegate when the app invite encounters an error. |
|
111 |
- Parameter appInviteDialog: The FBSDKAppInviteDialog that completed. |
|
112 |
- Parameter error: The error. |
bad748
|
113 |
*/ |
W |
114 |
- (void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didFailWithError:(NSError *)error; |
|
115 |
|
|
116 |
@end |