- Upgrade libraries
This commit is contained in:
78 files changed
+2039
-1220
No files matched your search
@@ -268,10 +268,12 @@ static NSMutableArray *g_pendingFBSDKShareAPI;
|
||||
[self _addCommonParameters:parameters content:linkContent];
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:self.message forKey:@"message"];
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.contentURL forKey:@"link"];
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.imageURL forKey:@"picture"];
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.contentTitle forKey:@"name"];
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.contentDescription forKey:@"description"];
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
[[[FBSDKGraphRequest alloc] initWithGraphPath:[self _graphPathWithSuffix:@"feed", nil]
|
||||
parameters:parameters
|
||||
tokenString:self.accessToken.tokenString
|
||||
|
||||
+43
-32
@@ -109,20 +109,25 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
||||
|
||||
- (BOOL)canShow
|
||||
{
|
||||
switch (self.mode) {
|
||||
case FBSDKShareDialogModeAutomatic:
|
||||
case FBSDKShareDialogModeBrowser:
|
||||
case FBSDKShareDialogModeFeedBrowser:
|
||||
case FBSDKShareDialogModeFeedWeb:
|
||||
case FBSDKShareDialogModeWeb:{
|
||||
return YES;
|
||||
}
|
||||
case FBSDKShareDialogModeNative:{
|
||||
return [self _canShowNative];
|
||||
}
|
||||
case FBSDKShareDialogModeShareSheet:{
|
||||
return [self _canShowShareSheet];
|
||||
if (!self.shareContent) {
|
||||
switch (self.mode) {
|
||||
case FBSDKShareDialogModeAutomatic:
|
||||
case FBSDKShareDialogModeBrowser:
|
||||
case FBSDKShareDialogModeFeedBrowser:
|
||||
case FBSDKShareDialogModeFeedWeb:
|
||||
case FBSDKShareDialogModeWeb:{
|
||||
return YES;
|
||||
}
|
||||
case FBSDKShareDialogModeNative:{
|
||||
return [self _canShowNative];
|
||||
}
|
||||
case FBSDKShareDialogModeShareSheet:{
|
||||
return [self _canShowShareSheet];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
NSError *error = nil;
|
||||
return [self _validateWithError:&error];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,10 +200,10 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
||||
}
|
||||
message:results[@"error_message"]
|
||||
underlyingError:nil];
|
||||
[self _handleWebResponseParameters:nil error:error];
|
||||
[self _handleWebResponseParameters:nil error:error cancelled: NO];
|
||||
} else {
|
||||
// not all web dialogs report cancellation, so assume that the share has completed with no additional information
|
||||
[self _handleWebResponseParameters:results error:nil];
|
||||
[self _handleWebResponseParameters:results error:nil cancelled: NO];
|
||||
}
|
||||
[FBSDKInternalUtility unregisterTransientObject:self];
|
||||
}
|
||||
@@ -433,14 +438,16 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
||||
return URLs;
|
||||
}
|
||||
|
||||
- (void)_handleWebResponseParameters:(NSDictionary *)webResponseParameters error:(NSError *)error
|
||||
- (void)_handleWebResponseParameters:(NSDictionary *)webResponseParameters
|
||||
error:(NSError *)error
|
||||
cancelled:(BOOL)isCancelled
|
||||
{
|
||||
if (error) {
|
||||
[self _invokeDelegateDidFailWithError:error];
|
||||
return;
|
||||
} else {
|
||||
NSString *completionGesture = webResponseParameters[FBSDK_SHARE_RESULT_COMPLETION_GESTURE_KEY];
|
||||
if ([completionGesture isEqualToString:FBSDK_SHARE_RESULT_COMPLETION_GESTURE_VALUE_CANCEL]) {
|
||||
if ([completionGesture isEqualToString:FBSDK_SHARE_RESULT_COMPLETION_GESTURE_VALUE_CANCEL] || isCancelled) {
|
||||
[self _invokeDelegateDidCancel];
|
||||
} else {
|
||||
// not all web dialogs report cancellation, so assume that the share has completed with no additional information
|
||||
@@ -477,7 +484,7 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
||||
void(^completion)(BOOL, NSString *, NSDictionary *) = ^(BOOL successfullyBuilt, NSString *cMethodName, NSDictionary *cParameters) {
|
||||
if (successfullyBuilt) {
|
||||
FBSDKBridgeAPICallbackBlock completionBlock = ^(FBSDKBridgeAPIResponse *response) {
|
||||
[self _handleWebResponseParameters:response.responseParameters error:response.error];
|
||||
[self _handleWebResponseParameters:response.responseParameters error:response.error cancelled: response.isCancelled];
|
||||
[FBSDKInternalUtility unregisterTransientObject:self];
|
||||
};
|
||||
FBSDKBridgeAPIRequest *request;
|
||||
@@ -504,7 +511,7 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
||||
return NO;
|
||||
}
|
||||
FBSDKBridgeAPICallbackBlock completionBlock = ^(FBSDKBridgeAPIResponse *response) {
|
||||
[self _handleWebResponseParameters:response.responseParameters error:response.error];
|
||||
[self _handleWebResponseParameters:response.responseParameters error:response.error cancelled: response.isCancelled];
|
||||
[FBSDKInternalUtility unregisterTransientObject:self];
|
||||
};
|
||||
FBSDKBridgeAPIRequest *request;
|
||||
@@ -530,7 +537,7 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
||||
id<FBSDKSharingContent> shareContent = self.shareContent;
|
||||
NSDictionary *parameters = [FBSDKShareUtility feedShareDictionaryForContent:shareContent];
|
||||
FBSDKBridgeAPICallbackBlock completionBlock = ^(FBSDKBridgeAPIResponse *response) {
|
||||
[self _handleWebResponseParameters:response.responseParameters error:response.error];
|
||||
[self _handleWebResponseParameters:response.responseParameters error:response.error cancelled:response.isCancelled];
|
||||
[FBSDKInternalUtility unregisterTransientObject:self];
|
||||
};
|
||||
FBSDKBridgeAPIRequest *request;
|
||||
@@ -794,18 +801,6 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
} else if ([shareContent isKindOfClass:[FBSDKShareMediaContent class]]) {
|
||||
FBSDKShareMediaContent *mediaContent = (FBSDKShareMediaContent *)shareContent;
|
||||
if ([FBSDKShareUtility shareMediaContentContainsPhotosAndVideos:mediaContent] &&
|
||||
self.mode == FBSDKShareDialogModeShareSheet &&
|
||||
![self _canUseMMPInShareSheet]) {
|
||||
if ((errorRef != NULL) && !*errorRef) {
|
||||
*errorRef = [FBSDKShareError invalidArgumentErrorWithName:@"shareContent"
|
||||
value:shareContent
|
||||
message:@"Multimedia content (photos + videos) is only supported if Facebook for iOS version 52 and above is installed"];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
@@ -898,6 +893,7 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
||||
[self _validateVideoURL:((FBSDKShareVideoContent *)shareContent).video.videoURL error:errorRef]);
|
||||
} else if ([shareContent isKindOfClass:[FBSDKShareMediaContent class]]) {
|
||||
return ([self _canUseFBShareSheet] &&
|
||||
[self _validateShareMediaContentAvailability:shareContent error:errorRef] &&
|
||||
[FBSDKShareUtility validateShareMediaContent:(FBSDKShareMediaContent *)shareContent error:errorRef]);
|
||||
} else if ([shareContent isKindOfClass:[FBSDKShareOpenGraphContent class]]) {
|
||||
FBSDKShareOpenGraphContent *ogContent = (FBSDKShareOpenGraphContent *)shareContent;
|
||||
@@ -936,6 +932,21 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)_validateShareMediaContentAvailability:(FBSDKShareMediaContent *)shareContent error:(NSError **)errorRef
|
||||
{
|
||||
if ([FBSDKShareUtility shareMediaContentContainsPhotosAndVideos:shareContent] &&
|
||||
self.mode == FBSDKShareDialogModeShareSheet &&
|
||||
![self _canUseMMPInShareSheet]) {
|
||||
if ((errorRef != NULL) && !*errorRef) {
|
||||
*errorRef = [FBSDKShareError invalidArgumentErrorWithName:@"shareContent"
|
||||
value:shareContent
|
||||
message:@"Multimedia content (photos + videos) is only supported if Facebook for iOS version 52 and above is installed"];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)_invokeDelegateDidCancel
|
||||
{
|
||||
NSDictionary * parameters = @{
|
||||
|
||||
+15
-3
@@ -31,22 +31,34 @@
|
||||
If not specified, this field is automatically populated by information scraped from the contentURL,
|
||||
typically the title of the page. This value may be discarded for specially handled links (ex: iTunes URLs).
|
||||
- Returns: The description of the link
|
||||
|
||||
@deprecated `contentDescription` is deprecated from Graph API 2.9.
|
||||
For more information, see https://developers.facebook.com/docs/apps/changelog#v2_9_deprecations.
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *contentDescription;
|
||||
@property (nonatomic, readonly) NSString *contentDescription
|
||||
DEPRECATED_MSG_ATTRIBUTE("`contentDescription` is deprecated from Graph API 2.9");
|
||||
|
||||
/**
|
||||
The title to display for this link.
|
||||
|
||||
This value may be discarded for specially handled links (ex: iTunes URLs).
|
||||
- Returns: The link title
|
||||
|
||||
@deprecated `contentTitle` is deprecated from Graph API 2.9.
|
||||
For more information, see https://developers.facebook.com/docs/apps/changelog#v2_9_deprecations
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *contentTitle;
|
||||
@property (nonatomic, readonly) NSString *contentTitle
|
||||
DEPRECATED_MSG_ATTRIBUTE("`contentTitle` is deprecated from Graph API 2.9");
|
||||
|
||||
/**
|
||||
The URL of a picture to attach to this content.
|
||||
- Returns: The network URL of an image
|
||||
|
||||
@deprecated `imageURL` is deprecated from Graph API 2.9.
|
||||
For more information, see https://developers.facebook.com/docs/apps/changelog#v2_9_deprecations
|
||||
*/
|
||||
@property (nonatomic, copy) NSURL *imageURL;
|
||||
@property (nonatomic, readonly) NSURL *imageURL
|
||||
DEPRECATED_MSG_ATTRIBUTE("`imageURL` is deprecated from Graph API 2.9");
|
||||
|
||||
/**
|
||||
Some quote text of the link.
|
||||
|
||||
+3
@@ -92,6 +92,8 @@
|
||||
|
||||
- (BOOL)isEqualToShareLinkContent:(FBSDKShareLinkContent *)content
|
||||
{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
return (content &&
|
||||
[FBSDKInternalUtility object:_contentDescription isEqualToObject:content.contentDescription] &&
|
||||
[FBSDKInternalUtility object:_contentTitle isEqualToObject:content.contentTitle] &&
|
||||
@@ -103,6 +105,7 @@
|
||||
[FBSDKInternalUtility object:_placeID isEqualToObject:content.placeID] &&
|
||||
[FBSDKInternalUtility object:_ref isEqualToObject:content.ref]) &&
|
||||
[FBSDKInternalUtility object:_quote isEqualToObject:content.quote];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
#pragma mark - NSCoding
|
||||
|
||||
+23
-3
@@ -239,6 +239,8 @@
|
||||
+ (NSDictionary *)feedShareDictionaryForContent:(id<FBSDKSharingContent>)content
|
||||
{
|
||||
NSMutableDictionary *parameters = nil;
|
||||
#pragma clang diagnostic pop
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
if ([content isKindOfClass:[FBSDKShareLinkContent class]]) {
|
||||
FBSDKShareLinkContent *linkContent = (FBSDKShareLinkContent *)content;
|
||||
parameters = [[NSMutableDictionary alloc] initWithDictionary:linkContent.feedParameters];
|
||||
@@ -250,6 +252,7 @@
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.imageURL forKey:@"picture"];
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.ref forKey:@"ref"];
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
return [parameters copy];
|
||||
}
|
||||
|
||||
@@ -556,6 +559,7 @@
|
||||
![self _validateArray:medias minCount:1 maxCount:20 name:@"photos" error:errorRef]) {
|
||||
return NO;
|
||||
}
|
||||
int videoCount = 0;
|
||||
for (id media in medias) {
|
||||
if ([media isKindOfClass:[FBSDKSharePhoto class]]) {
|
||||
FBSDKSharePhoto *photo = (FBSDKSharePhoto *)media;
|
||||
@@ -568,10 +572,21 @@
|
||||
return NO;
|
||||
}
|
||||
} else if ([media isKindOfClass:[FBSDKShareVideo class]]) {
|
||||
if (videoCount > 0) {
|
||||
if (errorRef != NULL) {
|
||||
*errorRef = [FBSDKShareError invalidArgumentErrorWithName:@"media"
|
||||
value:media
|
||||
message:@"Only 1 video is allowed"];
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
videoCount++;
|
||||
FBSDKShareVideo *video = (FBSDKShareVideo *)media;
|
||||
NSURL *videoURL = video.videoURL;
|
||||
return ([self _validateRequiredValue:video name:@"video" error:errorRef] &&
|
||||
[self _validateRequiredValue:videoURL name:@"videoURL" error:errorRef]);
|
||||
if (![self _validateRequiredValue:video name:@"video" error:errorRef] &&
|
||||
[self _validateRequiredValue:videoURL name:@"videoURL" error:errorRef]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (errorRef != NULL) {
|
||||
@@ -585,12 +600,14 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
+ (BOOL)validateShareLinkContent:(FBSDKShareLinkContent *)linkContent error:(NSError *__autoreleasing *)errorRef
|
||||
{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
return ([self _validateRequiredValue:linkContent name:@"shareContent" error:errorRef] &&
|
||||
[self _validateNetworkURL:linkContent.contentURL name:@"contentURL" error:errorRef] &&
|
||||
[self _validateNetworkURL:linkContent.imageURL name:@"imageURL" error:errorRef]);
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
+ (BOOL)validateShareVideoContent:(FBSDKShareVideoContent *)videoContent error:(NSError *__autoreleasing *)errorRef
|
||||
@@ -662,10 +679,13 @@ forShareOpenGraphContent:(FBSDKShareOpenGraphContent *)openGraphContent
|
||||
+ (void)_addToParameters:(NSMutableDictionary *)parameters
|
||||
forShareLinkContent:(FBSDKShareLinkContent *)linkContent
|
||||
{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.contentURL forKey:@"link"];
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.contentTitle forKey:@"name"];
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.contentDescription forKey:@"description"];
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.imageURL forKey:@"picture"];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
+ (void)_addToParameters:(NSMutableDictionary *)parameters
|
||||
|
||||
Generated
+1
-1
@@ -20,7 +20,7 @@ FEATURES
|
||||
* Sharing - https://developers.facebook.com/docs/sharing
|
||||
* App Links - https://developers.facebook.com/docs/applinks
|
||||
* Graph API - https://developers.facebook.com/docs/ios/graph
|
||||
* Analytics for Apps - https://developers.facebook.com/docs/analytics
|
||||
* Analytics - https://developers.facebook.com/docs/analytics
|
||||
|
||||
GIVE FEEDBACK
|
||||
-------------
|
||||
|
||||
Reference in new issue
Block a user