DouyinOpenSDKShare.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. //
  2. // BDOpenPlatformShareRequest.h
  3. //
  4. // Created by ByteDance on 2019/7/8.
  5. // Copyright (c) 2018年 ByteDance Ltd. All rights reserved.
  6. #import "DouyinOpenSDKObjects.h"
  7. #import "DouyinOpenSDKApplicationDelegate.h"
  8. NS_ASSUME_NONNULL_BEGIN
  9. typedef NS_ENUM(NSUInteger, DouyinOpenSDKShareMediaType) {
  10. DouyinOpenSDKShareMediaTypeImage = 0, //!< Map to PHAssetMediaTypeImage
  11. DouyinOpenSDKShareMediaTypeVideo, //!< Map to PHAssetMediaTypeVideo
  12. };
  13. typedef NS_ENUM(NSUInteger, DouyinOpenSDKLandedPageType) {
  14. DouyinOpenSDKLandedPageClip = 0,//!< Landed to Clip ViewController
  15. DouyinOpenSDKLandedPageEdit,//!< Landed to Edit ViewController
  16. DouyinOpenSDKLandedPagePublish,//!< Landed to Edit ViewController
  17. };
  18. typedef NS_ENUM(NSUInteger, DouyinOpenSDKShareAction) {
  19. DouyinOpenSDKShareTypePublishMedia,
  20. DouyinOpenSDKShareTypeShareContentToIM,
  21. DouyinOpenSDKShareTypeCapture,
  22. };
  23. typedef NS_ENUM(NSInteger, DouyinOpenSDKShareRespState) {
  24. DouyinOpenSDKShareRespStateSuccess = 20000, //!< Success
  25. DouyinOpenSDKShareRespStateUnknownError = 20001, //!< Unknown or current SDK version unclassified error
  26. DouyinOpenSDKShareRespStateParamValidError = 20002, //!< Params parsing error, media resource type difference you pass
  27. DouyinOpenSDKShareRespStateSharePermissionDenied = 20003, //!< Not enough permissions to operation.
  28. DouyinOpenSDKShareRespStateUserNotLogin = 20004, //!< User not login
  29. DouyinOpenSDKShareRespStateNotHavePhotoLibraryPermission = 20005, //!< Has no album permissions
  30. DouyinOpenSDKShareRespStateNetworkError = 20006, //!< Network error
  31. DouyinOpenSDKShareRespStateVideoTimeLimitError = 20007, //!< Video length doesn't meet requirements
  32. DouyinOpenSDKShareRespStatePhotoResolutionError = 20008, //!< Photo doesn't meet requirements
  33. DouyinOpenSDKShareRespTimeStampError = 20009, //!< Timestamp check failed
  34. DouyinOpenSDKShareRespStateHandleMediaError = 20010, //!< Processing photo resources faild
  35. DouyinOpenSDKShareRespStateVideoResolutionError = 20011, //!< Video resolution doesn't meet requirements
  36. DouyinOpenSDKShareRespStateVideoFormatError = 20012, //!< Video format is not supported
  37. DouyinOpenSDKShareRespStateCancel = 20013, //!< Sharing canceled
  38. DouyinOpenSDKShareRespStateHaveUploadingTask = 20014, //!< Another video is currently uploading
  39. DouyinOpenSDKShareRespStateSaveAsDraft = 20015, //!< Users store shared content for draft or user accounts are not allowed to post videos
  40. DouyinOpenSDKShareRespStatePublishFailed = 20016, //!< Post share content failed
  41. DouyinOpenSDKShareRespStateMediaInIcloudError = 21001, //!< Downloading from iCloud faild
  42. DouyinOpenSDKShareRespStateParamsParsingError = 21002, //!< Internal params parsing error
  43. DouyinOpenSDKShareRespStateGetMediaError = 21003, //!< Media resources do not exist
  44. };
  45. DouyinOpenSDKShareRespState DouyinOpenSDKStringToShareState(NSString *string);
  46. @class DouyinOpenSDKShareResponse;
  47. typedef void(^DouyinOpenSDKShareCompleteBlock)(DouyinOpenSDKShareResponse *Response);
  48. @interface DouyinOpenSDKShareLink : NSObject
  49. @property (nonatomic, copy) NSString *linkTitle;
  50. @property (nonatomic, copy) NSString *linkDescription;
  51. @property (nonatomic, copy) NSString *linkURLString;
  52. @property (nonatomic, copy) NSString *linkCoverURLString;
  53. @end
  54. @interface DouyinOpenSDKShareRequest : DouyinOpenSDKBaseRequest
  55. /**
  56. The local identifier of the video or image shared by the your application to Open Platform in the **Photo Album**. The content must be all images or video.
  57. - The aspect ratio of the images or videos should between: [1/2.2, 2.2]
  58. - If mediaType is Image:
  59. - The number of images should be more than one and up to 12.
  60. - If mediaType is Video:
  61. - Total video duration should be longer than 3 seconds.
  62. - No more than 12 videos can be shared
  63. - Video with brand logo or watermark will lead to video deleted or account banned. Make sure your applications share contents without watermark.
  64. */
  65. @property (nonatomic, strong) NSArray *localIdentifiers;
  66. @property (nonatomic, assign) DouyinOpenSDKShareAction shareAction;
  67. /**
  68. Which page do you want to land on?
  69. Defualt is Clip Viewcontroller
  70. */
  71. @property (nonatomic, assign) DouyinOpenSDKLandedPageType landedPageType;
  72. /**
  73. To associate your video with a hashtag, set the hashtag property on the request. The length cannot exceed 35
  74. */
  75. @property (nonatomic, copy) NSString *hashtag;
  76. /**
  77. The Media type of localIdentifiers in Album, All attachment localIdentifiers must be the same type
  78. */
  79. @property (nonatomic, assign) DouyinOpenSDKShareMediaType mediaType;
  80. /**
  81. Used to identify the uniqueness of the request, and finally returned by App when jumping back to the third-party program
  82. */
  83. @property (nonatomic, copy, nullable) NSString *state;
  84. @property (nonatomic, strong) DouyinOpenSDKShareLink *shareLink;
  85. @property (nonatomic, copy) NSDictionary *customPlatformInfo;
  86. /**
  87. * @brief Send share request to Open Platform.
  88. *
  89. * @param completed The async result call back. You can get result in share response.isSucceed;
  90. *
  91. * @return Share request is valid will return YES;
  92. */
  93. - (BOOL)sendShareRequestWithCompleteBlock:(DouyinOpenSDKShareCompleteBlock) completed;
  94. @end
  95. @interface DouyinOpenSDKShareResponse : DouyinOpenSDKBaseResponse
  96. /**
  97. Used to identify the uniqueness of the request, and finally returned by App when jumping back to the third-party program
  98. */
  99. @property (nonatomic, copy, nullable) NSString *state;
  100. @property (nonatomic, assign) DouyinOpenSDKShareRespState shareState;
  101. @end
  102. NS_ASSUME_NONNULL_END