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 <UIKit/UIKit.h> |
|
10 |
|
|
11 |
#import <FBSDKCoreKit/FBSDKCoreKit.h> |
|
12 |
#import <FBSDKShareKit/FBSDKShareMediaContent.h> |
|
13 |
#import <FBSDKShareKit/FBSDKSharingValidation.h> |
|
14 |
|
|
15 |
NS_ASSUME_NONNULL_BEGIN |
|
16 |
|
|
17 |
@class PHAsset; |
|
18 |
|
|
19 |
/** |
|
20 |
A photo for sharing. |
|
21 |
*/ |
|
22 |
NS_SWIFT_NAME(SharePhoto) |
|
23 |
@interface FBSDKSharePhoto : NSObject <NSSecureCoding, NSCopying, NSObject, FBSDKShareMedia, FBSDKSharingValidation> |
|
24 |
|
|
25 |
/** |
|
26 |
Convenience method to build a new photo object with an image. |
|
27 |
@param image If the photo is resident in memory, this method supplies the data |
|
28 |
@param userGenerated Specifies whether the photo represented by the receiver was generated by the user or by the |
|
29 |
application |
|
30 |
*/ |
|
31 |
+ (instancetype)photoWithImage:(UIImage *)image userGenerated:(BOOL)userGenerated; |
|
32 |
|
|
33 |
/** |
|
34 |
Convenience method to build a new photo object with an imageURL. |
|
35 |
@param imageURL The URL to the photo |
|
36 |
@param userGenerated Specifies whether the photo represented by the receiver was generated by the user or by the |
|
37 |
application |
|
38 |
|
|
39 |
This method should only be used when adding photo content to open graph stories. |
|
40 |
For example, if you're trying to share a photo from the web by itself, download the image and use |
|
41 |
`photoWithImage:userGenerated:` instead. |
|
42 |
*/ |
|
43 |
+ (instancetype)photoWithImageURL:(NSURL *)imageURL userGenerated:(BOOL)userGenerated; |
|
44 |
|
|
45 |
/** |
|
46 |
Convenience method to build a new photo object with a PHAsset. |
|
47 |
- Parameter photoAsset: The PHAsset that represents the photo in the Photos library. |
|
48 |
- Parameter userGenerated: Specifies whether the photo represented by the receiver was generated by the user or by the |
|
49 |
application |
|
50 |
*/ |
|
51 |
+ (instancetype)photoWithPhotoAsset:(PHAsset *)photoAsset userGenerated:(BOOL)userGenerated; |
|
52 |
|
|
53 |
/** |
|
54 |
If the photo is resident in memory, this method supplies the data. |
|
55 |
@return UIImage representation of the photo |
|
56 |
*/ |
|
57 |
@property (nullable, nonatomic, strong) UIImage *image; |
|
58 |
|
|
59 |
/** |
|
60 |
The URL to the photo. |
|
61 |
@return URL that points to a network location or the location of the photo on disk |
|
62 |
*/ |
|
63 |
@property (nullable, nonatomic, copy) NSURL *imageURL; |
|
64 |
|
|
65 |
/** |
|
66 |
The representation of the photo in the Photos library. |
|
67 |
- Returns: PHAsset that represents the photo in the Photos library. |
|
68 |
*/ |
|
69 |
@property (nullable, nonatomic, copy) PHAsset *photoAsset; |
|
70 |
|
|
71 |
/** |
|
72 |
Specifies whether the photo represented by the receiver was generated by the user or by the application. |
|
73 |
@return YES if the photo is user-generated, otherwise NO |
|
74 |
*/ |
|
75 |
@property (nonatomic, getter = isUserGenerated, assign) BOOL userGenerated; |
|
76 |
|
|
77 |
/** |
|
78 |
The user generated caption for the photo. Note that the 'caption' must come from |
|
79 |
* the user, as pre-filled content is forbidden by the Platform Policies (2.3). |
|
80 |
@return the Photo's caption if exists else returns null. |
|
81 |
*/ |
|
82 |
@property (nullable, nonatomic, copy) NSString *caption; |
|
83 |
|
|
84 |
/** |
|
85 |
Compares the receiver to another photo. |
|
86 |
@param photo The other photo |
|
87 |
@return YES if the receiver's values are equal to the other photo's values; otherwise NO |
|
88 |
*/ |
|
89 |
- (BOOL)isEqualToSharePhoto:(FBSDKSharePhoto *)photo; |
|
90 |
|
|
91 |
@end |
|
92 |
|
|
93 |
NS_ASSUME_NONNULL_END |