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 |
|
9febd9
|
21 |
#import <FBSDKCoreKit/FBSDKAccessToken.h> |
W |
22 |
|
bad748
|
23 |
#import <FBSDKShareKit/FBSDKShareOpenGraphObject.h> |
W |
24 |
#import <FBSDKShareKit/FBSDKSharing.h> |
|
25 |
|
e81c27
|
26 |
NS_ASSUME_NONNULL_BEGIN |
H |
27 |
|
9febd9
|
28 |
/** |
W |
29 |
A utility class for sharing through the graph API. Using this class requires an access token that |
|
30 |
has been granted the "publish_actions" permission. |
|
31 |
|
13e53a
|
32 |
FBSDKShareAPI network requests are scheduled on the current run loop in the default run loop mode. |
H |
33 |
If you want to use FBSDKShareAPI in a background thread, you must manage the run loop |
bad748
|
34 |
yourself. |
W |
35 |
*/ |
e81c27
|
36 |
NS_SWIFT_NAME(ShareAPI) |
bad748
|
37 |
@interface FBSDKShareAPI : NSObject <FBSDKSharing> |
e81c27
|
38 |
|
H |
39 |
- (instancetype)init NS_DESIGNATED_INITIALIZER |
|
40 |
NS_SWIFT_UNAVAILABLE("Use init(content:delegate:) instead"); |
|
41 |
+ (instancetype)new NS_UNAVAILABLE; |
bad748
|
42 |
|
9febd9
|
43 |
/** |
W |
44 |
Convenience method to build up a share API with content and a delegate. |
13e53a
|
45 |
@param content The content to be shared. |
H |
46 |
@param delegate The receiver's delegate. |
bad748
|
47 |
*/ |
e81c27
|
48 |
+ (instancetype)apiWithContent:(id<FBSDKSharingContent>)content |
H |
49 |
delegate:(nullable id<FBSDKSharingDelegate>)delegate |
|
50 |
NS_SWIFT_NAME(init(content:delegate:)); |
|
51 |
|
|
52 |
/** |
|
53 |
Convenience method to build up and share a share API with content and a delegate. |
|
54 |
@param content The content to be shared. |
|
55 |
@param delegate The receiver's delegate. |
|
56 |
*/ |
|
57 |
+ (instancetype)shareWithContent:(id<FBSDKSharingContent>)content |
|
58 |
delegate:(nullable id<FBSDKSharingDelegate>)delegate |
|
59 |
NS_SWIFT_UNAVAILABLE("Use init(content:delegate:).share() instead"); |
bad748
|
60 |
|
9febd9
|
61 |
/** |
W |
62 |
The message the person has provided through the custom dialog that will accompany the share content. |
bad748
|
63 |
*/ |
e81c27
|
64 |
@property (nonatomic, copy, nullable) NSString *message; |
bad748
|
65 |
|
9febd9
|
66 |
/** |
W |
67 |
The graph node to which content should be shared. |
bad748
|
68 |
*/ |
W |
69 |
@property (nonatomic, copy) NSString *graphNode; |
|
70 |
|
9febd9
|
71 |
/** |
W |
72 |
The access token used when performing a share. The access token must have the "publish_actions" |
|
73 |
permission granted. |
|
74 |
|
|
75 |
Defaults to [FBSDKAccessToken currentAccessToken]. Setting this to nil will revert the access token to |
|
76 |
[FBSDKAccessToken currentAccessToken]. |
|
77 |
*/ |
e81c27
|
78 |
@property (nonatomic, strong, nullable) FBSDKAccessToken *accessToken; |
9febd9
|
79 |
|
W |
80 |
/** |
|
81 |
A Boolean value that indicates whether the receiver can send the share. |
|
82 |
|
|
83 |
May return NO if the appropriate Facebook app is not installed and is required or an access token is |
bad748
|
84 |
required but not available. This method does not validate the content on the receiver, so this can be checked before |
W |
85 |
building up the content. |
9febd9
|
86 |
|
13e53a
|
87 |
@see [FBSDKSharing validateWithError:] |
H |
88 |
@return YES if the receiver can send, otherwise NO. |
bad748
|
89 |
*/ |
13e53a
|
90 |
@property (nonatomic, readonly) BOOL canShare; |
bad748
|
91 |
|
9febd9
|
92 |
/** |
W |
93 |
Creates an User Owned Open Graph object without an action. |
13e53a
|
94 |
@param openGraphObject The open graph object to create. |
9febd9
|
95 |
|
W |
96 |
Use this method to create an object alone, when an action is not going to be posted with the object. If |
bad748
|
97 |
the object will be used within an action, just put the object in the action and share that as the shareContent and the |
W |
98 |
object will be created in the process. The delegate will be messaged with the results. |
|
99 |
|
|
100 |
Also see https://developers.facebook.com/docs/sharing/opengraph/object-api#objectapi-creatinguser |
|
101 |
|
13e53a
|
102 |
@return YES if the receiver was able to send the request to create the object, otherwise NO. |
bad748
|
103 |
*/ |
W |
104 |
- (BOOL)createOpenGraphObject:(FBSDKShareOpenGraphObject *)openGraphObject; |
|
105 |
|
9febd9
|
106 |
/** |
W |
107 |
Begins the send from the receiver. |
13e53a
|
108 |
@return YES if the receiver was able to send the share, otherwise NO. |
bad748
|
109 |
*/ |
W |
110 |
- (BOOL)share; |
|
111 |
|
|
112 |
@end |
e81c27
|
113 |
|
H |
114 |
NS_ASSUME_NONNULL_END |