commit | author | age
|
2e29a3
|
1 |
/* |
L |
2 |
* Copyright (c) Meta Platforms, Inc. and affiliates. |
|
3 |
* All rights reserved. |
|
4 |
* |
|
5 |
* This source code is licensed under the license found in the |
|
6 |
* LICENSE file in the root directory of this source tree. |
|
7 |
*/ |
|
8 |
|
|
9 |
#import <Foundation/Foundation.h> |
|
10 |
|
|
11 |
#import <FBSDKShareKit/FBSDKSharingContent.h> |
|
12 |
|
|
13 |
NS_ASSUME_NONNULL_BEGIN |
|
14 |
|
|
15 |
@protocol FBSDKSharingDelegate; |
|
16 |
|
|
17 |
/** |
|
18 |
The common interface for components that initiate sharing. |
|
19 |
|
|
20 |
@see FBSDKShareDialog |
|
21 |
|
|
22 |
@see FBSDKMessageDialog |
|
23 |
*/ |
|
24 |
NS_SWIFT_NAME(Sharing) |
|
25 |
@protocol FBSDKSharing <NSObject> |
|
26 |
|
|
27 |
/** |
|
28 |
The receiver's delegate or nil if it doesn't have a delegate. |
|
29 |
*/ |
|
30 |
@property (nonatomic, weak) id<FBSDKSharingDelegate> delegate; |
|
31 |
|
|
32 |
/** |
|
33 |
The content to be shared. |
|
34 |
*/ |
|
35 |
@property (nullable, nonatomic, copy) id<FBSDKSharingContent> shareContent; |
|
36 |
|
|
37 |
/** |
|
38 |
A Boolean value that indicates whether the receiver should fail if it finds an error with the share content. |
|
39 |
|
|
40 |
If NO, the sharer will still be displayed without the data that was mis-configured. For example, an |
|
41 |
invalid placeID specified on the shareContent would produce a data error. |
|
42 |
*/ |
|
43 |
@property (nonatomic, assign) BOOL shouldFailOnDataError; |
|
44 |
|
|
45 |
/** |
|
46 |
Validates the content on the receiver. |
|
47 |
@param errorRef If an error occurs, upon return contains an NSError object that describes the problem. |
|
48 |
@return YES if the content is valid, otherwise NO. |
|
49 |
*/ |
|
50 |
- (BOOL)validateWithError:(NSError **)errorRef; |
|
51 |
|
|
52 |
@end |
|
53 |
|
|
54 |
/** |
|
55 |
The common interface for dialogs that initiate sharing. |
|
56 |
*/ |
|
57 |
NS_SWIFT_NAME(SharingDialog) |
|
58 |
@protocol FBSDKSharingDialog <FBSDKSharing> |
|
59 |
|
|
60 |
/** |
|
61 |
A Boolean value that indicates whether the receiver can initiate a share. |
|
62 |
|
|
63 |
May return NO if the appropriate Facebook app is not installed and is required or an access token is |
|
64 |
required but not available. This method does not validate the content on the receiver, so this can be checked before |
|
65 |
building up the content. |
|
66 |
|
|
67 |
@see [FBSDKSharing validateWithError:] |
|
68 |
@return YES if the receiver can share, otherwise NO. |
|
69 |
*/ |
|
70 |
@property (nonatomic, readonly) BOOL canShow; |
|
71 |
|
|
72 |
/** |
|
73 |
Shows the dialog. |
|
74 |
@return YES if the receiver was able to begin sharing, otherwise NO. |
|
75 |
*/ |
|
76 |
- (BOOL)show; |
|
77 |
|
|
78 |
@end |
|
79 |
|
|
80 |
/** |
|
81 |
A delegate for FBSDKSharing. |
|
82 |
|
|
83 |
The delegate is notified with the results of the sharer as long as the application has permissions to |
|
84 |
receive the information. For example, if the person is not signed into the containing app, the sharer may not be able |
|
85 |
to distinguish between completion of a share and cancellation. |
|
86 |
*/ |
|
87 |
NS_SWIFT_NAME(SharingDelegate) |
|
88 |
@protocol FBSDKSharingDelegate |
|
89 |
|
|
90 |
/** |
|
91 |
Sent to the delegate when the share completes without error or cancellation. |
|
92 |
@param sharer The FBSDKSharing that completed. |
|
93 |
@param results The results from the sharer. This may be nil or empty. |
|
94 |
*/ |
|
95 |
- (void)sharer:(id<FBSDKSharing>)sharer didCompleteWithResults:(NSDictionary<NSString *, id> *)results; |
|
96 |
|
|
97 |
/** |
|
98 |
Sent to the delegate when the sharer encounters an error. |
|
99 |
@param sharer The FBSDKSharing that completed. |
|
100 |
@param error The error. |
|
101 |
*/ |
|
102 |
- (void)sharer:(id<FBSDKSharing>)sharer didFailWithError:(NSError *)error; |
|
103 |
|
|
104 |
/** |
|
105 |
Sent to the delegate when the sharer is cancelled. |
|
106 |
@param sharer The FBSDKSharing that completed. |
|
107 |
*/ |
|
108 |
- (void)sharerDidCancel:(id<FBSDKSharing>)sharer; |
|
109 |
|
|
110 |
@end |
|
111 |
|
|
112 |
NS_ASSUME_NONNULL_END |