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 |
#if TARGET_OS_TV |
|
10 |
|
|
11 |
// This is an unfortunate hack for Swift Package Manager support. |
|
12 |
// SPM does not allow us to conditionally exclude Swift files for compilation by platform. |
|
13 |
// |
|
14 |
// So to support tvOS with SPM we need to use runtime availability checks in the Swift files. |
|
15 |
// This means that even though the Swift extension of ShareDialog will never be run for tvOS |
|
16 |
// targets, it still needs to be able to compile. Hence we need to declare it here. |
|
17 |
// |
|
18 |
// The way to fix this is to remove extensions of ObjC types in Swift. |
|
19 |
|
|
20 |
NS_SWIFT_NAME(ShareDialog) |
|
21 |
@interface FBSDKShareDialog : NSObject |
|
22 |
@end |
|
23 |
|
|
24 |
#else |
|
25 |
|
|
26 |
#import <UIKit/UIKit.h> |
|
27 |
|
|
28 |
#import <FBSDKShareKit/FBSDKShareDialogMode.h> |
|
29 |
#import <FBSDKShareKit/FBSDKSharing.h> |
|
30 |
#import <FBSDKShareKit/FBSDKSharingContent.h> |
|
31 |
|
|
32 |
NS_ASSUME_NONNULL_BEGIN |
|
33 |
|
|
34 |
/** |
|
35 |
A dialog for sharing content on Facebook. |
|
36 |
*/ |
|
37 |
NS_SWIFT_NAME(ShareDialog) |
|
38 |
@interface FBSDKShareDialog : NSObject <FBSDKSharingDialog> |
|
39 |
|
|
40 |
- (instancetype)init NS_UNAVAILABLE |
|
41 |
DEPRECATED_MSG_ATTRIBUTE("`init` is deprecated and will be removed in the next major release. Please use one of the other available initializers"); |
|
42 |
+ (instancetype)new NS_UNAVAILABLE |
|
43 |
DEPRECATED_MSG_ATTRIBUTE("`new` is deprecated and will be removed in the next major release. Please use one of the other available initializers"); |
|
44 |
|
|
45 |
/** |
|
46 |
Convenience initializer to initialize an `FBSDKShareDialog` with a view controller, content and delegate. |
|
47 |
@param viewController A view controller from which to present the dialog, if appropriate. |
|
48 |
@param content The content to be shared. |
|
49 |
@param delegate The dialog's delegate. |
|
50 |
*/ |
|
51 |
- (instancetype)initWithViewController:(nullable UIViewController *)viewController |
|
52 |
content:(nullable id<FBSDKSharingContent>)content |
|
53 |
delegate:(nullable id<FBSDKSharingDelegate>)delegate; |
|
54 |
|
|
55 |
/** |
|
56 |
Convenience method to create an `FBSDKShareDialog` with a view controller, content and delegate. |
|
57 |
@param viewController A view controller from which to present the dialog, if appropriate. |
|
58 |
@param content The content to be shared. |
|
59 |
@param delegate The dialog's delegate. |
|
60 |
*/ |
|
61 |
+ (instancetype)dialogWithViewController:(nullable UIViewController *)viewController |
|
62 |
withContent:(nullable id<FBSDKSharingContent>)content |
|
63 |
delegate:(nullable id<FBSDKSharingDelegate>)delegate |
|
64 |
NS_SWIFT_UNAVAILABLE("Use `init(viewController:content:delegate:)"); |
|
65 |
|
|
66 |
/** |
|
67 |
Convenience method to show an `FBSDKShareDialog` with a view controller, content and delegate. |
|
68 |
@param viewController A view controller from which to present the dialog, if appropriate. |
|
69 |
@param content The content to be shared. |
|
70 |
@param delegate The dialog's delegate. |
|
71 |
*/ |
|
72 |
+ (instancetype)showFromViewController:(nullable UIViewController *)viewController |
|
73 |
withContent:(nullable id<FBSDKSharingContent>)content |
|
74 |
delegate:(nullable id<FBSDKSharingDelegate>)delegate |
|
75 |
NS_SWIFT_UNAVAILABLE("Use init(viewController:content:delegate:).show() instead"); |
|
76 |
|
|
77 |
/** |
|
78 |
A UIViewController from which to present the dialog. |
|
79 |
|
|
80 |
If not specified, the topmost view controller will be automatically determined as best as possible. |
|
81 |
*/ |
|
82 |
@property (nonatomic, weak) UIViewController *fromViewController; |
|
83 |
|
|
84 |
/** |
|
85 |
The mode with which to display the dialog. |
|
86 |
|
|
87 |
Defaults to `FBSDKShareDialogModeAutomatic`, which will automatically choose the best available mode. |
|
88 |
*/ |
|
89 |
@property (nonatomic, assign) FBSDKShareDialogMode mode; |
|
90 |
|
|
91 |
@end |
|
92 |
|
|
93 |
NS_ASSUME_NONNULL_END |
|
94 |
|
|
95 |
#endif |