- add getEnvironment in PNObjectConfig
This commit is contained in:
1 parent
f42c646dcb
commit
872d8a78dd
123 files changed
+11697
-3828
No files matched your search
+17
-15
@@ -24,65 +24,67 @@
|
||||
@protocol FBSDKAppInviteDialogDelegate;
|
||||
|
||||
/**
|
||||
A dialog for sending App Invites.
|
||||
A dialog for sending App Invites.
|
||||
*/
|
||||
@interface FBSDKAppInviteDialog : NSObject
|
||||
|
||||
/**
|
||||
Convenience method to show a FBSDKAppInviteDialog
|
||||
Convenience method to show a FBSDKAppInviteDialog
|
||||
- Parameter viewController: A UIViewController to present the dialog from.
|
||||
- Parameter content: The content for the app invite.
|
||||
- Parameter delegate: The receiver's delegate.
|
||||
*/
|
||||
- Warning: This method is deprecated.
|
||||
*/
|
||||
+ (instancetype)showFromViewController:(UIViewController *)viewController
|
||||
withContent:(FBSDKAppInviteContent *)content
|
||||
delegate:(id<FBSDKAppInviteDialogDelegate>)delegate;
|
||||
delegate:(id<FBSDKAppInviteDialogDelegate>)delegate
|
||||
__attribute__ ((deprecated("App Invites no longer supported")));
|
||||
|
||||
|
||||
/**
|
||||
|
||||
- Warning:use showFromViewController:withContent:delegate: instead
|
||||
- Warning:use showFromViewController:withContent:delegate: instead
|
||||
*/
|
||||
+ (instancetype)showWithContent:(FBSDKAppInviteContent *)content delegate:(id<FBSDKAppInviteDialogDelegate>)delegate
|
||||
__attribute__ ((deprecated("use showFromViewController:withContent:delegate: instead")));
|
||||
|
||||
/**
|
||||
A UIViewController to present the dialog from.
|
||||
A UIViewController to present the dialog from.
|
||||
|
||||
If not specified, the top most view controller will be automatically determined as best as possible.
|
||||
*/
|
||||
@property (nonatomic, weak) UIViewController *fromViewController;
|
||||
|
||||
/**
|
||||
The receiver's delegate or nil if it doesn't have a delegate.
|
||||
The receiver's delegate or nil if it doesn't have a delegate.
|
||||
*/
|
||||
@property (nonatomic, weak) id<FBSDKAppInviteDialogDelegate> delegate;
|
||||
|
||||
/**
|
||||
The content for app invite.
|
||||
The content for app invite.
|
||||
*/
|
||||
@property (nonatomic, copy) FBSDKAppInviteContent *content;
|
||||
|
||||
/**
|
||||
A Boolean value that indicates whether the receiver can initiate an app invite.
|
||||
A Boolean value that indicates whether the receiver can initiate an app invite.
|
||||
|
||||
May return NO if the appropriate Facebook app is not installed and is required or an access token is
|
||||
required but not available. This method does not validate the content on the receiver, so this can be checked before
|
||||
building up the content.
|
||||
|
||||
- See:validateWithError:
|
||||
- See:validateWithError:
|
||||
- Returns: YES if the receiver can show the dialog, otherwise NO.
|
||||
*/
|
||||
- (BOOL)canShow;
|
||||
|
||||
/**
|
||||
Begins the app invite from the receiver.
|
||||
Begins the app invite from the receiver.
|
||||
- Returns: YES if the receiver was able to show the dialog, otherwise NO.
|
||||
*/
|
||||
- (BOOL)show;
|
||||
|
||||
/**
|
||||
Validates the content on the receiver.
|
||||
Validates the content on the receiver.
|
||||
- Parameter errorRef: If an error occurs, upon return contains an NSError object that describes the problem.
|
||||
- Returns: YES if the content is valid, otherwise NO.
|
||||
*/
|
||||
@@ -91,7 +93,7 @@ __attribute__ ((deprecated("use showFromViewController:withContent:delegate: ins
|
||||
@end
|
||||
|
||||
/**
|
||||
A delegate for FBSDKAppInviteDialog.
|
||||
A delegate for FBSDKAppInviteDialog.
|
||||
|
||||
The delegate is notified with the results of the app invite as long as the application has permissions to
|
||||
receive the information. For example, if the person is not signed into the containing app, the shower may not be able
|
||||
@@ -100,14 +102,14 @@ __attribute__ ((deprecated("use showFromViewController:withContent:delegate: ins
|
||||
@protocol FBSDKAppInviteDialogDelegate <NSObject>
|
||||
|
||||
/**
|
||||
Sent to the delegate when the app invite completes without error.
|
||||
Sent to the delegate when the app invite completes without error.
|
||||
- Parameter appInviteDialog: The FBSDKAppInviteDialog that completed.
|
||||
- Parameter results: The results from the dialog. This may be nil or empty.
|
||||
*/
|
||||
- (void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didCompleteWithResults:(NSDictionary *)results;
|
||||
|
||||
/**
|
||||
Sent to the delegate when the app invite encounters an error.
|
||||
Sent to the delegate when the app invite encounters an error.
|
||||
- Parameter appInviteDialog: The FBSDKAppInviteDialog that completed.
|
||||
- Parameter error: The error.
|
||||
*/
|
||||
|
||||
+4
-161
@@ -46,118 +46,24 @@
|
||||
return [self showFromViewController:nil withContent:content delegate:delegate];
|
||||
}
|
||||
|
||||
|
||||
+ (instancetype)showFromViewController:(UIViewController *)viewController
|
||||
withContent:(FBSDKAppInviteContent *)content
|
||||
delegate:(id<FBSDKAppInviteDialogDelegate>)delegate;
|
||||
{
|
||||
FBSDKAppInviteDialog *appInvite = [[self alloc] init];
|
||||
appInvite.content = content;
|
||||
appInvite.delegate = delegate;
|
||||
appInvite.fromViewController = viewController;
|
||||
[appInvite show];
|
||||
return appInvite;
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - Public Methods
|
||||
|
||||
- (BOOL)canShow
|
||||
{
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)show
|
||||
{
|
||||
NSError *error;
|
||||
if (![self canShow]) {
|
||||
error = [FBSDKShareError errorWithCode:FBSDKShareDialogNotAvailableErrorCode
|
||||
message:@"App invite dialog is not available."];
|
||||
[self _invokeDelegateDidFailWithError:error];
|
||||
return NO;
|
||||
}
|
||||
if (![self validateWithError:&error]) {
|
||||
[self _invokeDelegateDidFailWithError:error];
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSMutableDictionary *parameters = [[NSMutableDictionary alloc] init];
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:self.content.appLinkURL forKey:@"app_link_url"];
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:self.content.appInvitePreviewImageURL forKey:@"preview_image_url"];
|
||||
|
||||
NSString *destination;
|
||||
switch (self.content.destination) {
|
||||
case FBSDKAppInviteDestinationMessenger:
|
||||
destination = @"messenger";
|
||||
break;
|
||||
|
||||
case FBSDKAppInviteDestinationFacebook:
|
||||
destination = @"facebook";
|
||||
break;
|
||||
|
||||
default:
|
||||
destination = @"facebook";
|
||||
break;
|
||||
}
|
||||
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:destination forKey:@"destination"];
|
||||
|
||||
if (self.content.promotionText) {
|
||||
NSString *promotionCode = self.content.promotionCode ?: @"";
|
||||
NSDictionary *deeplinkContext = @{@"promo_code" : promotionCode, @"promo_text" : self.content.promotionText};
|
||||
|
||||
NSError *jsonError = nil;
|
||||
NSString *deeplinkContextString = [FBSDKInternalUtility JSONStringForObject:deeplinkContext error:&jsonError invalidObjectHandler:NULL];
|
||||
if (!jsonError) {
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:promotionCode forKey:@"promo_code"];
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:self.content.promotionText forKey:@"promo_text"];
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:deeplinkContextString forKey:@"deeplink_context"];
|
||||
} else {
|
||||
[FBSDKLogger singleShotLogEntry:FBSDKLoggingBehaviorDeveloperErrors
|
||||
formatString:@"Cannot convert deeplink_contex to json:"];
|
||||
}
|
||||
}
|
||||
|
||||
FBSDKBridgeAPIRequest *webBridgeRequest = [FBSDKBridgeAPIRequest bridgeAPIRequestWithProtocolType:FBSDKBridgeAPIProtocolTypeWeb
|
||||
scheme:FBSDK_SHARE_JS_DIALOG_SCHEME
|
||||
methodName:FBSDK_APP_INVITE_METHOD_NAME
|
||||
methodVersion:nil
|
||||
parameters:parameters
|
||||
userInfo:nil];
|
||||
FBSDKBridgeAPICallbackBlock completionBlock = ^(FBSDKBridgeAPIResponse *response) {
|
||||
[self _handleCompletionWithDialogResults:response.responseParameters error:response.error];
|
||||
};
|
||||
|
||||
[self _logDialogShow];
|
||||
|
||||
FBSDKServerConfiguration *configuration = [FBSDKServerConfigurationManager cachedServerConfiguration];
|
||||
BOOL useSafariViewController = [configuration useSafariViewControllerForDialogName:FBSDKDialogConfigurationNameAppInvite];
|
||||
if ([self _canShowNative]) {
|
||||
FBSDKBridgeAPIRequest *nativeRequest = [FBSDKBridgeAPIRequest bridgeAPIRequestWithProtocolType:FBSDKBridgeAPIProtocolTypeNative
|
||||
scheme:FBSDK_CANOPENURL_FACEBOOK
|
||||
methodName:FBSDK_APP_INVITE_METHOD_NAME
|
||||
methodVersion:FBSDK_APP_INVITE_METHOD_MIN_VERSION
|
||||
parameters:parameters
|
||||
userInfo:nil];
|
||||
void (^nativeCompletionBlock)(FBSDKBridgeAPIResponse *) = ^(FBSDKBridgeAPIResponse *response) {
|
||||
if (response.error.code == FBSDKAppVersionUnsupportedErrorCode) {
|
||||
[[FBSDKApplicationDelegate sharedInstance] openBridgeAPIRequest:webBridgeRequest
|
||||
useSafariViewController:useSafariViewController
|
||||
fromViewController:self.fromViewController
|
||||
completionBlock:completionBlock];
|
||||
} else {
|
||||
completionBlock(response);
|
||||
}
|
||||
};
|
||||
[[FBSDKApplicationDelegate sharedInstance] openBridgeAPIRequest:nativeRequest
|
||||
useSafariViewController:useSafariViewController
|
||||
fromViewController:self.fromViewController
|
||||
completionBlock:nativeCompletionBlock];
|
||||
} else {
|
||||
[[FBSDKApplicationDelegate sharedInstance] openBridgeAPIRequest:webBridgeRequest
|
||||
useSafariViewController:useSafariViewController
|
||||
fromViewController:self.fromViewController
|
||||
completionBlock:completionBlock];
|
||||
}
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)validateWithError:(NSError *__autoreleasing *)errorRef
|
||||
@@ -165,67 +71,4 @@
|
||||
return [FBSDKShareUtility validateAppInviteContent:self.content error:errorRef];
|
||||
}
|
||||
|
||||
#pragma mark - Helper Methods
|
||||
|
||||
- (BOOL)_canShowNative
|
||||
{
|
||||
FBSDKServerConfiguration *configuration = [FBSDKServerConfigurationManager cachedServerConfiguration];
|
||||
BOOL useNativeDialog = [configuration useNativeDialogForDialogName:FBSDKDialogConfigurationNameAppInvite];
|
||||
return (useNativeDialog && [FBSDKInternalUtility isFacebookAppInstalled]);
|
||||
}
|
||||
|
||||
- (void)_handleCompletionWithDialogResults:(NSDictionary *)results error:(NSError *)error
|
||||
{
|
||||
if (error) {
|
||||
[self _invokeDelegateDidFailWithError:error];
|
||||
} else {
|
||||
[self _invokeDelegateDidCompleteWithResults:results];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_invokeDelegateDidCompleteWithResults:(NSDictionary *)results
|
||||
{
|
||||
NSDictionary * parameters =@{
|
||||
FBSDKAppEventParameterDialogOutcome : FBSDKAppEventsDialogOutcomeValue_Completed,
|
||||
};
|
||||
|
||||
[FBSDKAppEvents logImplicitEvent:FBSDKAppEventNameFBSDKEventAppInviteShareDialogResult
|
||||
valueToSum:nil
|
||||
parameters:parameters
|
||||
accessToken:[FBSDKAccessToken currentAccessToken]];
|
||||
|
||||
if (!_delegate) {
|
||||
return;
|
||||
}
|
||||
|
||||
[_delegate appInviteDialog:self didCompleteWithResults:[results copy]];
|
||||
}
|
||||
|
||||
- (void)_invokeDelegateDidFailWithError:(NSError *)error
|
||||
{
|
||||
NSDictionary * parameters =@{
|
||||
FBSDKAppEventParameterDialogOutcome : FBSDKAppEventsDialogOutcomeValue_Failed,
|
||||
FBSDKAppEventParameterDialogErrorMessage : [NSString stringWithFormat:@"%@", error]
|
||||
};
|
||||
|
||||
[FBSDKAppEvents logImplicitEvent:FBSDKAppEventNameFBSDKEventAppInviteShareDialogResult
|
||||
valueToSum:nil
|
||||
parameters:parameters
|
||||
accessToken:[FBSDKAccessToken currentAccessToken]];
|
||||
|
||||
if (!_delegate) {
|
||||
return;
|
||||
}
|
||||
|
||||
[_delegate appInviteDialog:self didFailWithError:error];
|
||||
}
|
||||
|
||||
- (void)_logDialogShow
|
||||
{
|
||||
[FBSDKAppEvents logImplicitEvent:FBSDKAppEventNameFBSDKEventAppInviteShareDialogShow
|
||||
valueToSum:nil
|
||||
parameters:nil
|
||||
accessToken:[FBSDKAccessToken currentAccessToken]];
|
||||
}
|
||||
|
||||
@end
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <FBSDKCoreKit/FBSDKCopying.h>
|
||||
|
||||
/**
|
||||
* A container of arguments for a camera effect.
|
||||
* An argument is a NSString identified by a NSString key.
|
||||
*/
|
||||
@interface FBSDKCameraEffectArguments : NSObject <FBSDKCopying, NSSecureCoding>
|
||||
|
||||
/**
|
||||
Sets a string argument in the container.
|
||||
- Parameter string: The argument
|
||||
- Parameter key: The key for the argument
|
||||
*/
|
||||
- (void)setString:(NSString *)string forKey:(NSString *)key;
|
||||
|
||||
/**
|
||||
Gets a string argument from the container.
|
||||
- Parameter key: The key for the argument
|
||||
- Returns: The string value or nil
|
||||
*/
|
||||
- (NSString *)stringForKey:(NSString *)key;
|
||||
|
||||
/**
|
||||
Sets a string array argument in the container.
|
||||
- Parameter array: The array argument
|
||||
- Parameter key: The key for the argument
|
||||
*/
|
||||
- (void)setArray:(NSArray<NSString *> *)array forKey:(NSString *)key;
|
||||
|
||||
/**
|
||||
Gets an array argument from the container.
|
||||
- Parameter key: The key for the argument
|
||||
- Returns: The array argument
|
||||
*/
|
||||
- (NSArray *)arrayForKey:(NSString *)key;
|
||||
|
||||
@end
|
||||
+177
@@ -0,0 +1,177 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import "FBSDKCameraEffectArguments.h"
|
||||
|
||||
#import "FBSDKCoreKit+Internal.h"
|
||||
#import "FBSDKShareUtility.h"
|
||||
|
||||
static NSString *const FBSDKCameraEffectArgumentsArgumentsKey = @"arguments";
|
||||
|
||||
@implementation FBSDKCameraEffectArguments
|
||||
{
|
||||
NSMutableDictionary *_arguments;
|
||||
}
|
||||
|
||||
#pragma mark - Object Lifecycle
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
_arguments = [NSMutableDictionary new];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setString:(NSString *)string forKey:(NSString *)key
|
||||
{
|
||||
[self _setValue:[string copy] forKey:key];
|
||||
}
|
||||
|
||||
- (NSString *)stringForKey:(NSString *)key
|
||||
{
|
||||
return [self _valueOfClass:[NSString class] forKey:key];
|
||||
}
|
||||
|
||||
- (void)setArray:(NSArray<NSString *> *)array forKey:(NSString *)key
|
||||
{
|
||||
[self _setValue:[array copy] forKey:key];
|
||||
}
|
||||
|
||||
- (NSArray *)arrayForKey:(NSString *)key
|
||||
{
|
||||
return [self _valueOfClass:[NSArray class] forKey:key];
|
||||
}
|
||||
|
||||
- (NSDictionary *)allArguments
|
||||
{
|
||||
return _arguments;
|
||||
}
|
||||
|
||||
#pragma mark - Equality
|
||||
|
||||
- (NSUInteger)hash
|
||||
{
|
||||
return [_arguments hash];
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(id)object
|
||||
{
|
||||
if (self == object) {
|
||||
return YES;
|
||||
}
|
||||
if (![object isKindOfClass:[FBSDKCameraEffectArguments class]]) {
|
||||
return NO;
|
||||
}
|
||||
return [self isEqualToCameraEffectArguments:(FBSDKCameraEffectArguments *)object];
|
||||
}
|
||||
|
||||
- (BOOL)isEqualToCameraEffectArguments:(FBSDKCameraEffectArguments *)object
|
||||
{
|
||||
return [FBSDKInternalUtility object:_arguments isEqualToObject:[object allArguments]];
|
||||
}
|
||||
|
||||
#pragma mark - NSCoding
|
||||
|
||||
+ (BOOL)supportsSecureCoding
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(NSCoder *)decoder
|
||||
{
|
||||
if ((self = [self init])) {
|
||||
_arguments = [decoder decodeObjectOfClass:[NSMutableDictionary class]
|
||||
forKey:FBSDKCameraEffectArgumentsArgumentsKey];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)encoder
|
||||
{
|
||||
[encoder encodeObject:_arguments forKey:FBSDKCameraEffectArgumentsArgumentsKey];
|
||||
}
|
||||
|
||||
#pragma mark - NSCopying
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
FBSDKCameraEffectArguments *copy = [FBSDKCameraEffectArguments new];
|
||||
copy->_arguments = [_arguments copy];
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Helper Methods
|
||||
|
||||
- (void)_setValue:(id)value forKey:(NSString *)key
|
||||
{
|
||||
[FBSDKCameraEffectArguments assertKey:key];
|
||||
if (value) {
|
||||
[FBSDKCameraEffectArguments assertValue:value];
|
||||
_arguments[key] = value;
|
||||
} else {
|
||||
[_arguments removeObjectForKey:key];
|
||||
}
|
||||
}
|
||||
|
||||
- (id)_valueForKey:(NSString *)key
|
||||
{
|
||||
key = [FBSDKTypeUtility stringValue:key];
|
||||
return (key ? [FBSDKTypeUtility objectValue:_arguments[key]] : nil);
|
||||
}
|
||||
|
||||
- (id)_valueOfClass:(__unsafe_unretained Class)cls forKey:(NSString *)key
|
||||
{
|
||||
id value = [self _valueForKey:key];
|
||||
return ([value isKindOfClass:cls] ? value : nil);
|
||||
}
|
||||
|
||||
+ (void)assertKey:(id)key
|
||||
{
|
||||
if ([key isKindOfClass:[NSString class]]) {
|
||||
return;
|
||||
}
|
||||
NSString *reason = [NSString stringWithFormat:@"Invalid key found in CameraEffectArguments: %@", key];
|
||||
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:reason userInfo:nil];
|
||||
}
|
||||
|
||||
+ (void)assertValue:(id)value
|
||||
{
|
||||
BOOL isInvalid = NO;
|
||||
if ([value isKindOfClass:[NSString class]]) {
|
||||
// Strings are always valid.
|
||||
} else if ([value isKindOfClass:[NSArray class]]) {
|
||||
// Allow only string arrays.
|
||||
for (id subValue in (NSArray *)value) {
|
||||
if (![subValue isKindOfClass:[NSString class]]) {
|
||||
isInvalid = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
isInvalid = YES;
|
||||
}
|
||||
|
||||
if (isInvalid) {
|
||||
NSString *reason = [NSString stringWithFormat:@"Invalid value found in CameraEffectArguments: %@", value];
|
||||
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:reason userInfo:nil];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <FBSDKCoreKit/FBSDKCopying.h>
|
||||
|
||||
/**
|
||||
* A container of textures for a camera effect.
|
||||
* A texture for a camera effect is an UIImages identified by a NSString key.
|
||||
*/
|
||||
@interface FBSDKCameraEffectTextures : NSObject <FBSDKCopying, NSSecureCoding>
|
||||
|
||||
/**
|
||||
Sets the image for a texture key.
|
||||
- Parameter image: The UIImage for the texture
|
||||
- Parameter name: The key for the texture
|
||||
*/
|
||||
- (void)setImage:(UIImage *)image forKey:(NSString *)key;
|
||||
|
||||
/**
|
||||
Gets the image for a texture key.
|
||||
- Parameter name: The key for the texture
|
||||
- Returns: The texture UIImage or nil
|
||||
*/
|
||||
- (UIImage *)imageForKey:(NSString *)key;
|
||||
|
||||
@end
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import "FBSDKCameraEffectTextures.h"
|
||||
|
||||
#import "FBSDKCoreKit+Internal.h"
|
||||
#import "FBSDKShareUtility.h"
|
||||
|
||||
static NSString *const FBSDKCameraEffectTexturesTexturesKey = @"textures";
|
||||
|
||||
@implementation FBSDKCameraEffectTextures
|
||||
{
|
||||
NSMutableDictionary<NSString *, UIImage *> *_textures;
|
||||
}
|
||||
|
||||
#pragma mark - Object Lifecycle
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
_textures = [NSMutableDictionary new];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setImage:(UIImage *)image forKey:(NSString *)key
|
||||
{
|
||||
[self _setValue:image forKey:key];
|
||||
}
|
||||
|
||||
- (UIImage *)imageForKey:(NSString *)key
|
||||
{
|
||||
return [self _valueOfClass:[UIImage class] forKey:key];
|
||||
}
|
||||
|
||||
- (NSDictionary<NSString *, UIImage *> *)allTextures
|
||||
{
|
||||
return _textures;
|
||||
}
|
||||
|
||||
#pragma mark - Equality
|
||||
|
||||
- (NSUInteger)hash
|
||||
{
|
||||
return [_textures hash];
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(id)object
|
||||
{
|
||||
if (self == object) {
|
||||
return YES;
|
||||
}
|
||||
if (![object isKindOfClass:[FBSDKCameraEffectTextures class]]) {
|
||||
return NO;
|
||||
}
|
||||
return [self isEqualToCameraEffectTextures:(FBSDKCameraEffectTextures *)object];
|
||||
}
|
||||
|
||||
- (BOOL)isEqualToCameraEffectTextures:(FBSDKCameraEffectTextures *)object
|
||||
{
|
||||
return [FBSDKInternalUtility object:_textures isEqualToObject:[object allTextures]];
|
||||
}
|
||||
|
||||
#pragma mark - NSCoding
|
||||
|
||||
+ (BOOL)supportsSecureCoding
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(NSCoder *)decoder
|
||||
{
|
||||
if ((self = [self init])) {
|
||||
_textures = [decoder decodeObjectOfClass:[NSMutableDictionary class]
|
||||
forKey:FBSDKCameraEffectTexturesTexturesKey];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)encoder
|
||||
{
|
||||
[encoder encodeObject:_textures forKey:FBSDKCameraEffectTexturesTexturesKey];
|
||||
}
|
||||
|
||||
#pragma mark - NSCopying
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
FBSDKCameraEffectTextures *copy = [FBSDKCameraEffectTextures new];
|
||||
copy->_textures = [_textures copy];
|
||||
return copy;
|
||||
}
|
||||
|
||||
#pragma mark - Helper Methods
|
||||
|
||||
- (void)_setValue:(id)value forKey:(NSString *)key
|
||||
{
|
||||
if (value) {
|
||||
_textures[key] = value;
|
||||
} else {
|
||||
[_textures removeObjectForKey:key];
|
||||
}
|
||||
}
|
||||
|
||||
- (id)_valueForKey:(NSString *)key
|
||||
{
|
||||
key = [FBSDKTypeUtility stringValue:key];
|
||||
return (key ? [FBSDKTypeUtility objectValue:_textures[key]] : nil);
|
||||
}
|
||||
|
||||
- (id)_valueOfClass:(__unsafe_unretained Class)cls forKey:(NSString *)key
|
||||
{
|
||||
id value = [self _valueForKey:key];
|
||||
return ([value isKindOfClass:cls] ? value : nil);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -24,6 +24,7 @@
|
||||
#import <FBSDKShareKit/FBSDKLiking.h>
|
||||
|
||||
/**
|
||||
Warning: This class is deprecated.
|
||||
A button to like an object.
|
||||
|
||||
Tapping the receiver will invoke an API call to the Facebook app through a fast-app-switch that allows
|
||||
@@ -31,6 +32,7 @@
|
||||
currentAccessToken has "publish_actions" permission and the object is an Open Graph object, then the like can happen
|
||||
seamlessly without the fast-app-switch.
|
||||
*/
|
||||
__attribute__ ((deprecated))
|
||||
@interface FBSDKLikeButton : FBSDKButton <FBSDKLiking>
|
||||
|
||||
/**
|
||||
|
||||
@@ -83,7 +83,7 @@ typedef NS_ENUM(NSUInteger, FBSDKLikeControlStyle)
|
||||
FBSDK_EXTERN NSString *NSStringFromFBSDKLikeControlStyle(FBSDKLikeControlStyle style);
|
||||
|
||||
/**
|
||||
|
||||
Warning: This class is deprecated.
|
||||
UI control to like an object in the Facebook graph.
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ FBSDK_EXTERN NSString *NSStringFromFBSDKLikeControlStyle(FBSDKLikeControlStyle s
|
||||
fast-app-switch that allows the user to like the object. Upon return to the calling app, the view will update
|
||||
with the new state and send actions for the UIControlEventValueChanged event.
|
||||
*/
|
||||
__attribute__ ((deprecated))
|
||||
@interface FBSDKLikeControl : UIControl <FBSDKLiking>
|
||||
|
||||
/**
|
||||
|
||||
+21
-4
@@ -22,12 +22,14 @@
|
||||
#import "FBSDKShareConstants.h"
|
||||
#import "FBSDKShareDefines.h"
|
||||
#import "FBSDKShareError.h"
|
||||
#import "FBSDKShareMessengerGenericTemplateContent.h"
|
||||
#import "FBSDKShareMessengerMediaTemplateContent.h"
|
||||
#import "FBSDKShareMessengerOpenGraphMusicTemplateContent.h"
|
||||
#import "FBSDKShareOpenGraphContent.h"
|
||||
#import "FBSDKShareUtility.h"
|
||||
#import "FBSDKShareVideoContent.h"
|
||||
|
||||
#define FBSDK_MESSAGE_DIALOG_APP_SCHEME @"fb-messenger-api"
|
||||
#define FBSDK_MESSAGE_METHOD_MIN_VERSION @"20140430"
|
||||
#define FBSDK_MESSAGE_DIALOG_APP_SCHEME @"fb-messenger-share-api"
|
||||
|
||||
@implementation FBSDKMessageDialog
|
||||
|
||||
@@ -87,7 +89,7 @@
|
||||
request = [FBSDKBridgeAPIRequest bridgeAPIRequestWithProtocolType:FBSDKBridgeAPIProtocolTypeNative
|
||||
scheme:FBSDK_MESSAGE_DIALOG_APP_SCHEME
|
||||
methodName:methodName
|
||||
methodVersion:FBSDK_MESSAGE_METHOD_MIN_VERSION
|
||||
methodVersion:nil
|
||||
parameters:parameters
|
||||
userInfo:nil];
|
||||
FBSDKServerConfiguration *configuration = [FBSDKServerConfigurationManager cachedServerConfiguration];
|
||||
@@ -120,6 +122,13 @@
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
if ([shareContent isKindOfClass:[FBSDKShareCameraEffectContent class]]) {
|
||||
if (errorRef != NULL) {
|
||||
*errorRef = [FBSDKShareError requiredArgumentErrorWithName:@"shareContent"
|
||||
message:@"Message dialog does not support camera content."];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
return [FBSDKShareUtility validateShareContent:self.shareContent error:errorRef];
|
||||
}
|
||||
|
||||
@@ -211,11 +220,19 @@
|
||||
contentType = FBSDKAppEventsDialogShareContentTypePhoto;
|
||||
} else if ([self.shareContent isKindOfClass:[FBSDKShareVideoContent class]]) {
|
||||
contentType = FBSDKAppEventsDialogShareContentTypeVideo;
|
||||
} else if ([self.shareContent isKindOfClass:[FBSDKShareMessengerGenericTemplateContent class]]) {
|
||||
contentType = FBSDKAppEventsDialogShareContentTypeMessengerGenericTemplate;
|
||||
} else if ([self.shareContent isKindOfClass:[FBSDKShareMessengerMediaTemplateContent class]]) {
|
||||
contentType = FBSDKAppEventsDialogShareContentTypeMessengerMediaTemplate;
|
||||
} else if ([self.shareContent isKindOfClass:[FBSDKShareMessengerOpenGraphMusicTemplateContent class]]) {
|
||||
contentType = FBSDKAppEventsDialogShareContentTypeMessengerOpenGraphMusicTemplate;
|
||||
} else {
|
||||
contentType = FBSDKAppEventsDialogShareContentTypeUnknown;
|
||||
}
|
||||
|
||||
NSDictionary *parameters = @{FBSDKAppEventParameterDialogShareContentType : contentType};
|
||||
NSDictionary *parameters = @{FBSDKAppEventParameterDialogShareContentType : contentType,
|
||||
FBSDKAppEventParameterDialogShareContentUUID : self.shareContent.shareUUID ?: [NSNull null],
|
||||
FBSDKAppEventParameterDialogShareContentPageID : self.shareContent.pageID ?: [NSNull null]};
|
||||
|
||||
[FBSDKAppEvents logImplicitEvent:FBSDKAppEventNameFBSDKEventMessengerShareDialogShow
|
||||
valueToSum:nil
|
||||
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <FBSDKShareKit/FBSDKCameraEffectArguments.h>
|
||||
#import <FBSDKShareKit/FBSDKCameraEffectTextures.h>
|
||||
#import <FBSDKShareKit/FBSDKSharingContent.h>
|
||||
|
||||
/**
|
||||
A model for content to share with a Facebook camera effect.
|
||||
*/
|
||||
@interface FBSDKShareCameraEffectContent : NSObject <FBSDKSharingContent>
|
||||
|
||||
/**
|
||||
ID of the camera effect to use.
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *effectID;
|
||||
|
||||
/**
|
||||
Arguments for the effect.
|
||||
*/
|
||||
@property (nonatomic, copy) FBSDKCameraEffectArguments *effectArguments;
|
||||
|
||||
/**
|
||||
Textures for the effect.
|
||||
*/
|
||||
@property (nonatomic, copy) FBSDKCameraEffectTextures *effectTextures;
|
||||
|
||||
/**
|
||||
Compares the receiver to another camera effect content.
|
||||
- Parameter content: The other content
|
||||
- Returns: YES if the receiver's values are equal to the other content's values; otherwise NO
|
||||
*/
|
||||
- (BOOL)isEqualToShareCameraEffectContent:(FBSDKShareCameraEffectContent *)content;
|
||||
|
||||
@end
|
||||
+163
@@ -0,0 +1,163 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import "FBSDKShareCameraEffectContent.h"
|
||||
|
||||
#import "FBSDKCoreKit+Internal.h"
|
||||
#import "FBSDKHashtag.h"
|
||||
#import "FBSDKShareUtility.h"
|
||||
|
||||
static NSString *const FBSDKShareCameraEffectContentEffectIDKey = @"effectID";
|
||||
static NSString *const FBSDKShareCameraEffectContentEffectArgumentsKey = @"effectArguments";
|
||||
static NSString *const FBSDKShareCameraEffectContentEffectTexturesKey = @"effectTextures";
|
||||
static NSString *const FBSDKShareCameraEffectContentContentURLKey = @"contentURL";
|
||||
static NSString *const FBSDKShareCameraEffectContentHashtagKey = @"hashtag";
|
||||
static NSString *const FBSDKShareCameraEffectContentPeopleIDsKey = @"peopleIDs";
|
||||
static NSString *const FBSDKShareCameraEffectContentPlaceIDKey = @"placeID";
|
||||
static NSString *const FBSDKShareCameraEffectContentRefKey = @"ref";
|
||||
static NSString *const FBSDKShareCameraEffectContentPageIDKey = @"pageID";
|
||||
static NSString *const FBSDKShareCameraEffectContentUUIDKey = @"uuid";
|
||||
|
||||
@implementation FBSDKShareCameraEffectContent
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
@synthesize effectID = _effectID;
|
||||
@synthesize effectArguments = _effectArguments;
|
||||
@synthesize effectTextures = _effectTextures;
|
||||
@synthesize contentURL = _contentURL;
|
||||
@synthesize hashtag = _hashtag;
|
||||
@synthesize peopleIDs = _peopleIDs;
|
||||
@synthesize placeID = _placeID;
|
||||
@synthesize ref = _ref;
|
||||
@synthesize pageID = _pageID;
|
||||
@synthesize shareUUID = _shareUUID;
|
||||
|
||||
#pragma mark - Initializer
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_shareUUID = [NSUUID UUID].UUIDString;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Equality
|
||||
|
||||
- (NSUInteger)hash
|
||||
{
|
||||
NSUInteger subhashes[] = {
|
||||
[_effectID hash],
|
||||
[_effectArguments hash],
|
||||
[_effectTextures hash],
|
||||
[_contentURL hash],
|
||||
[_hashtag hash],
|
||||
[_peopleIDs hash],
|
||||
[_placeID hash],
|
||||
[_ref hash],
|
||||
[_pageID hash],
|
||||
[_shareUUID hash],
|
||||
};
|
||||
return [FBSDKMath hashWithIntegerArray:subhashes count:sizeof(subhashes) / sizeof(subhashes[0])];
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(id)object
|
||||
{
|
||||
if (self == object) {
|
||||
return YES;
|
||||
}
|
||||
if (![object isKindOfClass:[FBSDKShareCameraEffectContent class]]) {
|
||||
return NO;
|
||||
}
|
||||
return [self isEqualToShareCameraEffectContent:(FBSDKShareCameraEffectContent *)object];
|
||||
}
|
||||
|
||||
- (BOOL)isEqualToShareCameraEffectContent:(FBSDKShareCameraEffectContent *)content
|
||||
{
|
||||
return (content &&
|
||||
[FBSDKInternalUtility object:_effectID isEqualToObject:content.effectID] &&
|
||||
[FBSDKInternalUtility object:_effectArguments isEqualToObject:content.effectArguments] &&
|
||||
[FBSDKInternalUtility object:_effectTextures isEqualToObject:content.effectTextures] &&
|
||||
[FBSDKInternalUtility object:_contentURL isEqualToObject:content.contentURL] &&
|
||||
[FBSDKInternalUtility object:_hashtag isEqualToObject:content.hashtag] &&
|
||||
[FBSDKInternalUtility object:_peopleIDs isEqualToObject:content.peopleIDs] &&
|
||||
[FBSDKInternalUtility object:_placeID isEqualToObject:content.placeID] &&
|
||||
[FBSDKInternalUtility object:_ref isEqualToObject:content.ref] &&
|
||||
[FBSDKInternalUtility object:_shareUUID isEqualToObject:content.shareUUID] &&
|
||||
[FBSDKInternalUtility object:_pageID isEqualToObject:content.pageID]);
|
||||
}
|
||||
|
||||
#pragma mark - NSCoding
|
||||
|
||||
+ (BOOL)supportsSecureCoding
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(NSCoder *)decoder
|
||||
{
|
||||
if ((self = [self init])) {
|
||||
_effectID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDKShareCameraEffectContentEffectIDKey];
|
||||
_effectArguments = [decoder decodeObjectOfClass:[FBSDKCameraEffectArguments class] forKey:FBSDKShareCameraEffectContentEffectArgumentsKey];
|
||||
_effectTextures = [decoder decodeObjectOfClass:[FBSDKCameraEffectTextures class] forKey:FBSDKShareCameraEffectContentEffectTexturesKey];
|
||||
_contentURL = [decoder decodeObjectOfClass:[NSURL class] forKey:FBSDKShareCameraEffectContentContentURLKey];
|
||||
_hashtag = [decoder decodeObjectOfClass:[FBSDKHashtag class] forKey:FBSDKShareCameraEffectContentHashtagKey];
|
||||
_peopleIDs = [decoder decodeObjectOfClass:[NSArray class] forKey:FBSDKShareCameraEffectContentPeopleIDsKey];
|
||||
_placeID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDKShareCameraEffectContentPlaceIDKey];
|
||||
_ref = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDKShareCameraEffectContentRefKey];
|
||||
_pageID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDKShareCameraEffectContentPageIDKey];
|
||||
_shareUUID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDKShareCameraEffectContentUUIDKey];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)encoder
|
||||
{
|
||||
[encoder encodeObject:_effectID forKey:FBSDKShareCameraEffectContentEffectIDKey];
|
||||
[encoder encodeObject:_effectArguments forKey:FBSDKShareCameraEffectContentEffectArgumentsKey];
|
||||
[encoder encodeObject:_effectTextures forKey:FBSDKShareCameraEffectContentEffectTexturesKey];
|
||||
[encoder encodeObject:_contentURL forKey:FBSDKShareCameraEffectContentContentURLKey];
|
||||
[encoder encodeObject:_hashtag forKey:FBSDKShareCameraEffectContentHashtagKey];
|
||||
[encoder encodeObject:_peopleIDs forKey:FBSDKShareCameraEffectContentPeopleIDsKey];
|
||||
[encoder encodeObject:_placeID forKey:FBSDKShareCameraEffectContentPlaceIDKey];
|
||||
[encoder encodeObject:_ref forKey:FBSDKShareCameraEffectContentRefKey];
|
||||
[encoder encodeObject:_pageID forKey:FBSDKShareCameraEffectContentPageIDKey];
|
||||
[encoder encodeObject:_shareUUID forKey:FBSDKShareCameraEffectContentUUIDKey];
|
||||
}
|
||||
|
||||
#pragma mark - NSCopying
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
FBSDKShareCameraEffectContent *copy = [[FBSDKShareCameraEffectContent alloc] init];
|
||||
copy->_effectID = [_effectID copy];
|
||||
copy->_effectArguments = [_effectArguments copy];
|
||||
copy->_effectTextures = [_effectTextures copy];
|
||||
copy->_contentURL = [_contentURL copy];
|
||||
copy->_hashtag = [_hashtag copy];
|
||||
copy->_peopleIDs = [_peopleIDs copy];
|
||||
copy->_placeID = [_placeID copy];
|
||||
copy->_ref = [_ref copy];
|
||||
copy->_pageID = [_pageID copy];
|
||||
copy->_shareUUID = [_shareUUID copy];
|
||||
return copy;
|
||||
}
|
||||
|
||||
@end
|
||||
+55
-2
@@ -36,6 +36,7 @@
|
||||
#import "FBSDKShareVideoContent.h"
|
||||
|
||||
#define FBSDK_SHARE_FEED_METHOD_NAME @"feed"
|
||||
#define FBSDK_SHARE_METHOD_CAMERA_MIN_VERSION @"20170417"
|
||||
#define FBSDK_SHARE_METHOD_MIN_VERSION @"20130410"
|
||||
#define FBSDK_SHARE_METHOD_OG_MIN_VERSION @"20130214"
|
||||
#define FBSDK_SHARE_METHOD_OG_IMAGE_MIN_VERSION @"20130410"
|
||||
@@ -232,6 +233,9 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
||||
|
||||
-(BOOL)_isDefaultToShareSheet
|
||||
{
|
||||
if ([self.shareContent isKindOfClass:[FBSDKShareCameraEffectContent class]]) {
|
||||
return NO;
|
||||
}
|
||||
FBSDKServerConfiguration *configuration = [FBSDKServerConfigurationManager cachedServerConfiguration];
|
||||
return [configuration.defaultShareMode isEqualToString:@"share_sheet"];
|
||||
}
|
||||
@@ -261,6 +265,16 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
||||
(!useNativeDialog && [self _showNativeWithCanShowError:NULL validationError:errorRef]));
|
||||
}
|
||||
|
||||
- (NSString *)_nativeScheme {
|
||||
if ([self.shareContent isKindOfClass:[FBSDKShareCameraEffectContent class]]) {
|
||||
if ([FBSDKInternalUtility isMSQRDPlayerAppInstalled]) {
|
||||
// If installed, launch MSQRD Player for testing effects.
|
||||
return FBSDK_CANOPENURL_MSQRD_PLAYER;
|
||||
}
|
||||
}
|
||||
return FBSDK_CANOPENURL_FACEBOOK;
|
||||
}
|
||||
|
||||
- (void)_loadNativeMethodName:(NSString **)methodNameRef methodVersion:(NSString **)methodVersionRef
|
||||
{
|
||||
if (methodNameRef != NULL) {
|
||||
@@ -288,6 +302,9 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
||||
} else {
|
||||
methodVersion = FBSDK_SHARE_METHOD_OG_MIN_VERSION;
|
||||
}
|
||||
} else if ([shareContent isKindOfClass:[FBSDKShareCameraEffectContent class]]) {
|
||||
methodName = FBSDK_SHARE_CAMERA_METHOD_NAME;
|
||||
methodVersion = FBSDK_SHARE_METHOD_CAMERA_MIN_VERSION;
|
||||
} else {
|
||||
methodName = FBSDK_SHARE_METHOD_NAME;
|
||||
if ([shareContent isKindOfClass:[FBSDKSharePhotoContent class]]) {
|
||||
@@ -313,12 +330,18 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
||||
|
||||
- (BOOL)_canShowShareSheet
|
||||
{
|
||||
if (![FBSDKInternalUtility isFacebookAppInstalled]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
Class composeViewControllerClass = [fbsdkdfl_SLComposeViewControllerClass() class];
|
||||
if (!composeViewControllerClass) {
|
||||
return NO;
|
||||
}
|
||||
// iOS 11 returns NO for `isAvailableForServiceType` but it will still work
|
||||
NSString *facebookServiceType = fbsdkdfl_SLServiceTypeFacebook();
|
||||
if (![composeViewControllerClass isAvailableForServiceType:facebookServiceType]) {
|
||||
NSOperatingSystemVersion iOS11Version = { .majorVersion = 11, .minorVersion = 0, .patchVersion = 0 };
|
||||
if (![FBSDKInternalUtility isOSRunTimeVersionAtLeast:iOS11Version] && ![composeViewControllerClass isAvailableForServiceType:facebookServiceType]) {
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
@@ -587,7 +610,7 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
||||
shouldFailOnDataError:self.shouldFailOnDataError];
|
||||
FBSDKBridgeAPIRequest *request;
|
||||
request = [FBSDKBridgeAPIRequest bridgeAPIRequestWithProtocolType:FBSDKBridgeAPIProtocolTypeNative
|
||||
scheme:FBSDK_CANOPENURL_FACEBOOK
|
||||
scheme:[self _nativeScheme]
|
||||
methodName:methodName
|
||||
methodVersion:methodVersion
|
||||
parameters:parameters
|
||||
@@ -714,12 +737,18 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
||||
|
||||
- (BOOL)_useNativeDialog
|
||||
{
|
||||
if ([self.shareContent isKindOfClass:[FBSDKShareCameraEffectContent class]]) {
|
||||
return YES;
|
||||
}
|
||||
FBSDKServerConfiguration *configuration = [FBSDKServerConfigurationManager cachedServerConfiguration];
|
||||
return [configuration useNativeDialogForDialogName:FBSDKDialogConfigurationNameShare];
|
||||
}
|
||||
|
||||
- (BOOL)_useSafariViewController
|
||||
{
|
||||
if ([self.shareContent isKindOfClass:[FBSDKShareCameraEffectContent class]]) {
|
||||
return NO;
|
||||
}
|
||||
FBSDKServerConfiguration *configuration = [FBSDKServerConfigurationManager cachedServerConfiguration];
|
||||
return [configuration useSafariViewControllerForDialogName:FBSDKDialogConfigurationNameShare];
|
||||
}
|
||||
@@ -808,6 +837,14 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
||||
- (BOOL)_validateShareContentForBrowser:(NSError **)errorRef
|
||||
{
|
||||
id<FBSDKSharingContent> shareContent = self.shareContent;
|
||||
if ([shareContent isKindOfClass:[FBSDKShareCameraEffectContent class]]) {
|
||||
if ((errorRef != NULL) && !*errorRef) {
|
||||
*errorRef = [FBSDKShareError invalidArgumentErrorWithName:@"shareContent"
|
||||
value:shareContent
|
||||
message:@"Camera Content must be shared in `Native` mode."];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
BOOL containsMedia;
|
||||
BOOL containsPhotos;
|
||||
[FBSDKShareUtility testShareContent:shareContent containsMedia:&containsMedia containsPhotos:&containsPhotos containsVideos:NULL];
|
||||
@@ -852,6 +889,13 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
||||
message:@"Feed share dialogs support FBSDKShareLinkContent."];
|
||||
}
|
||||
return NO;
|
||||
} else if ([shareContent isKindOfClass:[FBSDKShareCameraEffectContent class]]) {
|
||||
if ((errorRef != NULL) && !*errorRef) {
|
||||
*errorRef = [FBSDKShareError invalidArgumentErrorWithName:@"shareContent"
|
||||
value:shareContent
|
||||
message:@"Camera Content must be shared in `Native` mode."];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
@@ -916,6 +960,13 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
||||
*errorRef = [FBSDKShareError invalidArgumentErrorWithName:@"shareContent" value:shareContent message:message];
|
||||
}
|
||||
return NO;
|
||||
} else if ([shareContent isKindOfClass:[FBSDKShareCameraEffectContent class]]) {
|
||||
if ((errorRef != NULL) && !*errorRef) {
|
||||
*errorRef = [FBSDKShareError invalidArgumentErrorWithName:@"shareContent"
|
||||
value:shareContent
|
||||
message:@"Camera Content must be shared in `Native` mode."];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
@@ -1003,6 +1054,8 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
||||
contentType = FBSDKAppEventsDialogShareContentTypePhoto;
|
||||
} else if ([self.shareContent isKindOfClass:[FBSDKShareVideoContent class]]) {
|
||||
contentType = FBSDKAppEventsDialogShareContentTypeVideo;
|
||||
} else if ([self.shareContent isKindOfClass:[FBSDKShareCameraEffectContent class]]) {
|
||||
contentType = FBSDKAppEventsDialogShareContentTypeCamera;
|
||||
} else {
|
||||
contentType = FBSDKAppEventsDialogShareContentTypeUnknown;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,13 @@
|
||||
#import <FBSDKShareKit/FBSDKShareAPI.h>
|
||||
#import <FBSDKShareKit/FBSDKShareConstants.h>
|
||||
#import <FBSDKShareKit/FBSDKShareLinkContent.h>
|
||||
#import <FBSDKShareKit/FBSDKShareMediaContent.h>
|
||||
#import <FBSDKShareKit/FBSDKShareMessengerActionButton.h>
|
||||
#import <FBSDKShareKit/FBSDKShareMessengerGenericTemplateContent.h>
|
||||
#import <FBSDKShareKit/FBSDKShareMessengerGenericTemplateElement.h>
|
||||
#import <FBSDKShareKit/FBSDKShareMessengerMediaTemplateContent.h>
|
||||
#import <FBSDKShareKit/FBSDKShareMessengerOpenGraphMusicTemplateContent.h>
|
||||
#import <FBSDKShareKit/FBSDKShareMessengerURLActionButton.h>
|
||||
#import <FBSDKShareKit/FBSDKShareOpenGraphAction.h>
|
||||
#import <FBSDKShareKit/FBSDKShareOpenGraphContent.h>
|
||||
#import <FBSDKShareKit/FBSDKShareOpenGraphObject.h>
|
||||
@@ -45,9 +52,9 @@
|
||||
#import <FBSDKShareKit/FBSDKLikeObjectType.h>
|
||||
#import <FBSDKShareKit/FBSDKMessageDialog.h>
|
||||
#import <FBSDKShareKit/FBSDKShareButton.h>
|
||||
#import <FBSDKShareKit/FBSDKShareCameraEffectContent.h>
|
||||
#import <FBSDKShareKit/FBSDKShareDialog.h>
|
||||
#import <FBSDKShareKit/FBSDKShareDialogMode.h>
|
||||
#import <FBSDKShareKit/FBSDKShareMediaContent.h>
|
||||
#import <FBSDKShareKit/FBSDKSendButton.h>
|
||||
#else
|
||||
#import <FBSDKShareKit/FBSDKDeviceShareViewController.h>
|
||||
|
||||
+28
-1
@@ -30,8 +30,10 @@
|
||||
#define FBSDK_SHARE_STATUS_CONTENT_PEOPLE_IDS_KEY @"peopleIDs"
|
||||
#define FBSDK_SHARE_STATUS_CONTENT_PLACE_ID_KEY @"placeID"
|
||||
#define FBSDK_SHARE_STATUS_CONTENT_REF_KEY @"ref"
|
||||
#define FBSDK_SHARE_STATUS_CONTENT_PAGE_ID_KEY @"pageID"
|
||||
#define FBSDK_SHARE_STATUS_CONTENT_QUOTE_TEXT_KEY @"quote"
|
||||
#define FBSDK_SHARE_STATUS_CONTENT_FEED_PARAMETERS_KEY @"feedParameters"
|
||||
#define FBSDK_SHARE_STATUS_CONTENT_UUID_KEY @"uuid"
|
||||
|
||||
@implementation FBSDKShareLinkContent
|
||||
|
||||
@@ -42,8 +44,23 @@
|
||||
@synthesize peopleIDs = _peopleIDs;
|
||||
@synthesize placeID = _placeID;
|
||||
@synthesize ref = _ref;
|
||||
@synthesize pageID = _pageID;
|
||||
@synthesize feedParameters = _feedParameters;
|
||||
@synthesize quote = _quote;
|
||||
@synthesize shareUUID = _shareUUID;
|
||||
|
||||
#pragma mark - Initializer
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_shareUUID = [NSUUID UUID].UUIDString;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Setters
|
||||
|
||||
- (void)setPeopleIDs:(NSArray *)peopleIDs
|
||||
{
|
||||
@@ -72,9 +89,11 @@
|
||||
[_peopleIDs hash],
|
||||
[_placeID hash],
|
||||
[_ref hash],
|
||||
[_pageID hash],
|
||||
[_contentTitle hash],
|
||||
[_feedParameters hash],
|
||||
[_quote hash],
|
||||
[_shareUUID hash],
|
||||
};
|
||||
return [FBSDKMath hashWithIntegerArray:subhashes count:sizeof(subhashes) / sizeof(subhashes[0])];
|
||||
}
|
||||
@@ -103,7 +122,9 @@
|
||||
[FBSDKInternalUtility object:_imageURL isEqualToObject:content.imageURL] &&
|
||||
[FBSDKInternalUtility object:_peopleIDs isEqualToObject:content.peopleIDs] &&
|
||||
[FBSDKInternalUtility object:_placeID isEqualToObject:content.placeID] &&
|
||||
[FBSDKInternalUtility object:_ref isEqualToObject:content.ref]) &&
|
||||
[FBSDKInternalUtility object:_ref isEqualToObject:content.ref] &&
|
||||
[FBSDKInternalUtility object:_pageID isEqualToObject:content.pageID] &&
|
||||
[FBSDKInternalUtility object:_shareUUID isEqualToObject:content.shareUUID]) &&
|
||||
[FBSDKInternalUtility object:_quote isEqualToObject:content.quote];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
@@ -128,7 +149,9 @@
|
||||
_peopleIDs = [decoder decodeObjectOfClass:[NSArray class] forKey:FBSDK_SHARE_STATUS_CONTENT_PEOPLE_IDS_KEY];
|
||||
_placeID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_STATUS_CONTENT_PLACE_ID_KEY];
|
||||
_ref = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_STATUS_CONTENT_REF_KEY];
|
||||
_pageID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_STATUS_CONTENT_PAGE_ID_KEY];
|
||||
_quote = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_STATUS_CONTENT_QUOTE_TEXT_KEY];
|
||||
_shareUUID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_STATUS_CONTENT_UUID_KEY];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -144,7 +167,9 @@
|
||||
[encoder encodeObject:_peopleIDs forKey:FBSDK_SHARE_STATUS_CONTENT_PEOPLE_IDS_KEY];
|
||||
[encoder encodeObject:_placeID forKey:FBSDK_SHARE_STATUS_CONTENT_PLACE_ID_KEY];
|
||||
[encoder encodeObject:_ref forKey:FBSDK_SHARE_STATUS_CONTENT_REF_KEY];
|
||||
[encoder encodeObject:_pageID forKey:FBSDK_SHARE_STATUS_CONTENT_PAGE_ID_KEY];
|
||||
[encoder encodeObject:_quote forKey:FBSDK_SHARE_STATUS_CONTENT_QUOTE_TEXT_KEY];
|
||||
[encoder encodeObject:_shareUUID forKey:FBSDK_SHARE_STATUS_CONTENT_UUID_KEY];
|
||||
}
|
||||
|
||||
#pragma mark - NSCopying
|
||||
@@ -161,7 +186,9 @@
|
||||
copy->_peopleIDs = [_peopleIDs copy];
|
||||
copy->_placeID = [_placeID copy];
|
||||
copy->_ref = [_ref copy];
|
||||
copy->_pageID = [_pageID copy];
|
||||
copy->_quote = [_quote copy];
|
||||
copy->_shareUUID = [_shareUUID copy];
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
+28
-1
@@ -30,6 +30,8 @@
|
||||
#define FBSDK_SHARE_MEDIA_CONTENT_MEDIA_KEY @"media"
|
||||
#define FBSDK_SHARE_MEDIA_CONTENT_PLACE_ID_KEY @"placeID"
|
||||
#define FBSDK_SHARE_MEDIA_CONTENT_REF_KEY @"ref"
|
||||
#define FBSDK_SHARE_MEDIA_CONTENT_PAGE_ID_KEY @"pageID"
|
||||
#define FBSDK_SHARE_MEDIA_CONTENT_UUID_KEY @"uuid"
|
||||
|
||||
@implementation FBSDKShareMediaContent
|
||||
|
||||
@@ -40,6 +42,21 @@
|
||||
@synthesize peopleIDs = _peopleIDs;
|
||||
@synthesize placeID = _placeID;
|
||||
@synthesize ref = _ref;
|
||||
@synthesize pageID = _pageID;
|
||||
@synthesize shareUUID = _shareUUID;
|
||||
|
||||
#pragma mark - Initializer
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_shareUUID = [NSUUID UUID].UUIDString;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Setters
|
||||
|
||||
- (void)setPeopleIDs:(NSArray *)peopleIDs
|
||||
{
|
||||
@@ -68,6 +85,8 @@
|
||||
[_media hash],
|
||||
[_placeID hash],
|
||||
[_ref hash],
|
||||
[_pageID hash],
|
||||
[_shareUUID hash],
|
||||
};
|
||||
return [FBSDKMath hashWithIntegerArray:subhashes count:sizeof(subhashes) / sizeof(subhashes[0])];
|
||||
}
|
||||
@@ -91,7 +110,9 @@
|
||||
[FBSDKInternalUtility object:_peopleIDs isEqualToObject:content.peopleIDs] &&
|
||||
[FBSDKInternalUtility object:_media isEqualToObject:content.media] &&
|
||||
[FBSDKInternalUtility object:_placeID isEqualToObject:content.placeID] &&
|
||||
[FBSDKInternalUtility object:_ref isEqualToObject:content.ref]);
|
||||
[FBSDKInternalUtility object:_ref isEqualToObject:content.ref] &&
|
||||
[FBSDKInternalUtility object:_shareUUID isEqualToObject:content.shareUUID] &&
|
||||
[FBSDKInternalUtility object:_pageID isEqualToObject:content.pageID]);
|
||||
}
|
||||
|
||||
#pragma mark - NSCoding
|
||||
@@ -111,6 +132,8 @@
|
||||
_media = [decoder decodeObjectOfClasses:classes forKey:FBSDK_SHARE_MEDIA_CONTENT_MEDIA_KEY];
|
||||
_placeID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_MEDIA_CONTENT_PLACE_ID_KEY];
|
||||
_ref = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_MEDIA_CONTENT_REF_KEY];
|
||||
_pageID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_MEDIA_CONTENT_PAGE_ID_KEY];
|
||||
_shareUUID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_MEDIA_CONTENT_UUID_KEY];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -123,6 +146,8 @@
|
||||
[encoder encodeObject:_media forKey:FBSDK_SHARE_MEDIA_CONTENT_MEDIA_KEY];
|
||||
[encoder encodeObject:_placeID forKey:FBSDK_SHARE_MEDIA_CONTENT_PLACE_ID_KEY];
|
||||
[encoder encodeObject:_ref forKey:FBSDK_SHARE_MEDIA_CONTENT_REF_KEY];
|
||||
[encoder encodeObject:_pageID forKey:FBSDK_SHARE_MEDIA_CONTENT_PAGE_ID_KEY];
|
||||
[encoder encodeObject:_shareUUID forKey:FBSDK_SHARE_MEDIA_CONTENT_UUID_KEY];
|
||||
}
|
||||
|
||||
#pragma mark - NSCopying
|
||||
@@ -136,6 +161,8 @@
|
||||
copy->_media = [_media copy];
|
||||
copy->_placeID = [_placeID copy];
|
||||
copy->_ref = [_ref copy];
|
||||
copy->_pageID = [_pageID copy];
|
||||
copy->_shareUUID = [_shareUUID copy];
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <FBSDKCoreKit/FBSDKCopying.h>
|
||||
|
||||
/**
|
||||
A base interface for Messenger share action buttons.
|
||||
*/
|
||||
@protocol FBSDKShareMessengerActionButton <FBSDKCopying, NSSecureCoding>
|
||||
|
||||
/**
|
||||
The title displayed to the user for the button.
|
||||
- Returns: The title for the button.
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *title;
|
||||
|
||||
@end
|
||||
Generated
+55
@@ -0,0 +1,55 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <FBSDKShareKit/FBSDKSharingContent.h>
|
||||
|
||||
@class FBSDKShareMessengerGenericTemplateElement;
|
||||
|
||||
typedef NS_ENUM(NSUInteger, FBSDKShareMessengerGenericTemplateImageAspectRatio) {
|
||||
FBSDKShareMessengerGenericTemplateImageAspectRatioHorizontal = 0,
|
||||
FBSDKShareMessengerGenericTemplateImageAspectRatioSquare
|
||||
};
|
||||
|
||||
/**
|
||||
A model for sharing a generic template element to Messenger. This wrapper element allows
|
||||
specifying whether or not the bubble is sharable and what aspect to render the images.
|
||||
See https://developers.facebook.com/docs/messenger-platform/send-messages/template/generic
|
||||
for more details.
|
||||
*/
|
||||
@interface FBSDKShareMessengerGenericTemplateContent : NSObject <FBSDKSharingContent>
|
||||
|
||||
/**
|
||||
This specifies whether or not this generic template message can be shared again after the
|
||||
initial share. Defaults to false.
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL isSharable;
|
||||
|
||||
/**
|
||||
The aspect ratio for when the image is rendered in the generic template bubble after being
|
||||
shared. Defaults to horizontal.
|
||||
*/
|
||||
@property (nonatomic, assign) FBSDKShareMessengerGenericTemplateImageAspectRatio imageAspectRatio;
|
||||
|
||||
/**
|
||||
A generic template element with a title, optional subtitle, optional image, etc. Required.
|
||||
*/
|
||||
@property (nonatomic, copy) FBSDKShareMessengerGenericTemplateElement *element;
|
||||
|
||||
@end
|
||||
Generated
+93
@@ -0,0 +1,93 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import "FBSDKShareMessengerGenericTemplateContent.h"
|
||||
|
||||
#import "FBSDKShareMessengerGenericTemplateElement.h"
|
||||
|
||||
static NSString *const kGenericTemplatePageIDKey = @"pageID";
|
||||
static NSString *const kGenericTemplateUUIDKey = @"UUID";
|
||||
static NSString *const kGenericTemplateIsSharableKey = @"isSharable";
|
||||
static NSString *const kGenericTemplateImageAspectRatioKey = @"imageAspectRatio";
|
||||
static NSString *const kGenericTemplateElementKey = @"element";
|
||||
|
||||
@implementation FBSDKShareMessengerGenericTemplateContent
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
@synthesize contentURL = _contentURL;
|
||||
@synthesize hashtag = _hashtag;
|
||||
@synthesize peopleIDs = _peopleIDs;
|
||||
@synthesize placeID = _placeID;
|
||||
@synthesize ref = _ref;
|
||||
@synthesize pageID = _pageID;
|
||||
@synthesize shareUUID = _shareUUID;
|
||||
|
||||
#pragma mark - Initializer
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_shareUUID = [NSUUID UUID].UUIDString;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - NSCoding
|
||||
|
||||
+ (BOOL)supportsSecureCoding
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)decoder
|
||||
{
|
||||
if ((self = [self init])) {
|
||||
_pageID = [decoder decodeObjectOfClass:[NSString class] forKey:kGenericTemplatePageIDKey];
|
||||
_isSharable = [decoder decodeBoolForKey:kGenericTemplateIsSharableKey];
|
||||
_imageAspectRatio = [[decoder decodeObjectOfClass:[NSNumber class] forKey:kGenericTemplateImageAspectRatioKey] unsignedIntegerValue];
|
||||
_element = [decoder decodeObjectForKey:kGenericTemplateElementKey];
|
||||
_shareUUID = [decoder decodeObjectOfClass:[NSString class] forKey:kGenericTemplateUUIDKey];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)encoder
|
||||
{
|
||||
[encoder encodeObject:_pageID forKey:kGenericTemplatePageIDKey];
|
||||
[encoder encodeBool:_isSharable forKey:kGenericTemplateIsSharableKey];
|
||||
[encoder encodeObject:@(_imageAspectRatio) forKey:kGenericTemplateImageAspectRatioKey];
|
||||
[encoder encodeObject:_element forKey:kGenericTemplateElementKey];
|
||||
[encoder encodeObject:_shareUUID forKey:kGenericTemplateUUIDKey];
|
||||
}
|
||||
|
||||
#pragma mark - NSCopying
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
FBSDKShareMessengerGenericTemplateContent *copy = [[FBSDKShareMessengerGenericTemplateContent alloc] init];
|
||||
copy->_pageID = [_pageID copy];
|
||||
copy->_isSharable = _isSharable;
|
||||
copy->_imageAspectRatio = _imageAspectRatio;
|
||||
copy->_element = [_element copy];
|
||||
copy->_shareUUID = [_shareUUID copy];
|
||||
return copy;
|
||||
}
|
||||
|
||||
@end
|
||||
Generated
+56
@@ -0,0 +1,56 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <FBSDKCoreKit/FBSDKCopying.h>
|
||||
#import <FBSDKShareKit/FBSDKShareMessengerActionButton.h>
|
||||
|
||||
/**
|
||||
A model for sharing a generic template element to Messenger. This allows specifying title, subtitle,
|
||||
image, default action, and any other buttons. Title is required. See
|
||||
https://developers.facebook.com/docs/messenger-platform/send-messages/template/generic for more details.
|
||||
*/
|
||||
@interface FBSDKShareMessengerGenericTemplateElement : NSObject <FBSDKCopying, NSSecureCoding>
|
||||
|
||||
/**
|
||||
The rendered title for the shared generic template element. Required.
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *title;
|
||||
|
||||
/**
|
||||
The rendered subtitle for the shared generic template element. Optional.
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *subtitle;
|
||||
|
||||
/**
|
||||
The image url that will be downloaded and rendered at the top of the generic template. Optional.
|
||||
*/
|
||||
@property (nonatomic, copy) NSURL *imageURL;
|
||||
|
||||
/**
|
||||
The default action executed when this shared generic tempate is tapped. Title for this button is ignored. Optional.
|
||||
*/
|
||||
@property (nonatomic, copy) id<FBSDKShareMessengerActionButton> defaultAction;
|
||||
|
||||
/**
|
||||
This specifies what action button to show below the generic template. Optional.
|
||||
*/
|
||||
@property (nonatomic, copy) id<FBSDKShareMessengerActionButton> button;
|
||||
|
||||
@end
|
||||
Generated
+71
@@ -0,0 +1,71 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import "FBSDKShareMessengerGenericTemplateElement.h"
|
||||
|
||||
static NSString *const kGenericTemplateTitleKey = @"title";
|
||||
static NSString *const kGenericTemplateSubtitleKey = @"subtitle";
|
||||
static NSString *const kGenericTemplateImageURLKey = @"imageURL";
|
||||
static NSString *const kGenericTemplateDefaultActionKey = @"defaultAction";
|
||||
static NSString *const kGenericTemplateButtonKey = @"button";
|
||||
|
||||
@implementation FBSDKShareMessengerGenericTemplateElement
|
||||
|
||||
#pragma mark - NSCoding
|
||||
|
||||
+ (BOOL)supportsSecureCoding
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)decoder
|
||||
{
|
||||
if ((self = [self init])) {
|
||||
_title = [decoder decodeObjectOfClass:[NSString class] forKey:kGenericTemplateTitleKey];
|
||||
_subtitle = [decoder decodeObjectOfClass:[NSString class] forKey:kGenericTemplateSubtitleKey];
|
||||
_imageURL = [decoder decodeObjectOfClass:[NSURL class] forKey:kGenericTemplateImageURLKey];
|
||||
_defaultAction = [decoder decodeObjectForKey:kGenericTemplateDefaultActionKey];
|
||||
_button = [decoder decodeObjectForKey:kGenericTemplateButtonKey];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)encoder
|
||||
{
|
||||
[encoder encodeObject:_title forKey:kGenericTemplateTitleKey];
|
||||
[encoder encodeObject:_subtitle forKey:kGenericTemplateSubtitleKey];
|
||||
[encoder encodeObject:_imageURL forKey:kGenericTemplateImageURLKey];
|
||||
[encoder encodeObject:_defaultAction forKey:kGenericTemplateDefaultActionKey];
|
||||
[encoder encodeObject:_button forKey:kGenericTemplateButtonKey];
|
||||
}
|
||||
|
||||
#pragma mark - NSCopying
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
FBSDKShareMessengerGenericTemplateElement *copy = [[FBSDKShareMessengerGenericTemplateElement alloc] init];
|
||||
copy->_title = [_title copy];
|
||||
copy->_subtitle = [_subtitle copy];
|
||||
copy->_imageURL = [_imageURL copy];
|
||||
copy->_defaultAction = [_defaultAction copy];
|
||||
copy->_button = [_button copy];
|
||||
return copy;
|
||||
}
|
||||
|
||||
@end
|
||||
Generated
+69
@@ -0,0 +1,69 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <FBSDKShareKit/FBSDKShareMessengerActionButton.h>
|
||||
#import <FBSDKShareKit/FBSDKSharingContent.h>
|
||||
|
||||
typedef NS_ENUM(NSUInteger, FBSDKShareMessengerMediaTemplateMediaType) {
|
||||
FBSDKShareMessengerMediaTemplateMediaTypeImage = 0,
|
||||
FBSDKShareMessengerMediaTemplateMediaTypeVideo
|
||||
};
|
||||
|
||||
/**
|
||||
A model for sharing media template content. See
|
||||
https://developers.facebook.com/docs/messenger-platform/send-messages/template/media for details.
|
||||
*/
|
||||
@interface FBSDKShareMessengerMediaTemplateContent : NSObject <FBSDKSharingContent>
|
||||
|
||||
/**
|
||||
The media type (image or video) for this content. This must match the media type specified in the
|
||||
attachmentID/mediaURL to avoid an error when sharing. Defaults to image.
|
||||
*/
|
||||
@property (nonatomic, assign) FBSDKShareMessengerMediaTemplateMediaType mediaType;
|
||||
|
||||
/**
|
||||
The attachmentID of the item to share. Optional, but either attachmentID or mediaURL must be specified.
|
||||
*/
|
||||
@property (nonatomic, copy, readonly) NSString *attachmentID;
|
||||
|
||||
/**
|
||||
The Facebook url for this piece of media. External urls will not work; this must be a Facebook url.
|
||||
See https://developers.facebook.com/docs/messenger-platform/send-messages/template/media for details.
|
||||
Optional, but either attachmentID or mediaURL must be specified.
|
||||
*/
|
||||
@property (nonatomic, copy, readonly) NSURL *mediaURL;
|
||||
|
||||
/**
|
||||
This specifies what action button to show below the media. Optional.
|
||||
*/
|
||||
@property (nonatomic, copy) id<FBSDKShareMessengerActionButton> button;
|
||||
|
||||
/**
|
||||
Custom initializer to create media template share with attachment id.
|
||||
*/
|
||||
- (instancetype)initWithAttachmentID:(NSString *)attachmentID;
|
||||
|
||||
/**
|
||||
Custom initializer to create media template share with media url. This must be a Facebook url
|
||||
and cannot be an external url.
|
||||
*/
|
||||
- (instancetype)initWithMediaURL:(NSURL *)mediaURL;
|
||||
|
||||
@end
|
||||
Generated
+110
@@ -0,0 +1,110 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import "FBSDKShareMessengerMediaTemplateContent.h"
|
||||
|
||||
#import "FBSDKCoreKit+Internal.h"
|
||||
#import "FBSDKHashtag.h"
|
||||
#import "FBSDKShareUtility.h"
|
||||
|
||||
static NSString *const kMediaTemplatePageIDKey = @"pageID";
|
||||
static NSString *const kMediaTemplateMediaTypeKey = @"mediaType";
|
||||
static NSString *const kMediaTemplateAttachmentIDKey = @"attachmentID";
|
||||
static NSString *const kMediaTemplateMediaURLKey = @"mediaURL";
|
||||
static NSString *const kMediaTemplateButtonKey = @"button";
|
||||
static NSString *const kMediaTemplateUUIDKey = @"uuid";
|
||||
|
||||
@implementation FBSDKShareMessengerMediaTemplateContent
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
@synthesize contentURL = _contentURL;
|
||||
@synthesize hashtag = _hashtag;
|
||||
@synthesize peopleIDs = _peopleIDs;
|
||||
@synthesize placeID = _placeID;
|
||||
@synthesize ref = _ref;
|
||||
@synthesize pageID = _pageID;
|
||||
@synthesize shareUUID = _shareUUID;
|
||||
|
||||
#pragma mark - Initializer
|
||||
|
||||
- (instancetype)initWithAttachmentID:(NSString *)attachmentID
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_attachmentID = [attachmentID copy];
|
||||
_shareUUID = [NSUUID UUID].UUIDString;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithMediaURL:(NSURL *)mediaURL
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_mediaURL = [mediaURL copy];
|
||||
_shareUUID = [NSUUID UUID].UUIDString;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - NSCoding
|
||||
|
||||
+ (BOOL)supportsSecureCoding
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)decoder
|
||||
{
|
||||
if ((self = [self init])) {
|
||||
_pageID = [decoder decodeObjectOfClass:[NSString class] forKey:kMediaTemplatePageIDKey];
|
||||
_mediaType = [[decoder decodeObjectForKey:kMediaTemplateMediaTypeKey] unsignedIntegerValue];
|
||||
_attachmentID = [decoder decodeObjectOfClass:[NSString class] forKey:kMediaTemplateAttachmentIDKey];
|
||||
_mediaURL = [decoder decodeObjectOfClass:[NSURL class] forKey:kMediaTemplateMediaURLKey];
|
||||
_button = [decoder decodeObjectForKey:kMediaTemplateButtonKey];
|
||||
_shareUUID = [decoder decodeObjectOfClass:[NSString class] forKey:kMediaTemplateUUIDKey];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)encoder
|
||||
{
|
||||
[encoder encodeObject:_pageID forKey:kMediaTemplatePageIDKey];
|
||||
[encoder encodeObject:@(_mediaType) forKey:kMediaTemplateMediaTypeKey];
|
||||
[encoder encodeObject:_attachmentID forKey:kMediaTemplateAttachmentIDKey];
|
||||
[encoder encodeObject:_mediaURL forKey:kMediaTemplateMediaURLKey];
|
||||
[encoder encodeObject:_button forKey:kMediaTemplateButtonKey];
|
||||
[encoder encodeObject:_shareUUID forKey:kMediaTemplateUUIDKey];
|
||||
}
|
||||
|
||||
#pragma mark - NSCopying
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
FBSDKShareMessengerMediaTemplateContent *copy = [[FBSDKShareMessengerMediaTemplateContent alloc] init];
|
||||
copy->_pageID = [_pageID copy];
|
||||
copy->_mediaType = _mediaType;
|
||||
copy->_attachmentID = [_attachmentID copy];
|
||||
copy->_mediaURL = [_mediaURL copy];
|
||||
copy->_button = [_button copy];
|
||||
copy->_shareUUID = [_shareUUID copy];
|
||||
return copy;
|
||||
}
|
||||
|
||||
@end
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <FBSDKShareKit/FBSDKShareMessengerActionButton.h>
|
||||
#import <FBSDKShareKit/FBSDKSharingContent.h>
|
||||
|
||||
/**
|
||||
This share content allows sharing a bubble that plays songs with Open Graph music.
|
||||
See https://developers.facebook.com/docs/messenger-platform/send-messages/template/open-graph
|
||||
for details. Passing <FBSDKSharingContent> property pageID is required for this type of share.
|
||||
*/
|
||||
@interface FBSDKShareMessengerOpenGraphMusicTemplateContent : NSObject <FBSDKSharingContent>
|
||||
|
||||
/**
|
||||
This must be an Open Graph music url. Required.
|
||||
*/
|
||||
@property (nonatomic, copy) NSURL *url;
|
||||
|
||||
/**
|
||||
This specifies what action button to show below the open graph music bubble. Optional.
|
||||
*/
|
||||
@property (nonatomic, copy) id<FBSDKShareMessengerActionButton> button;
|
||||
|
||||
@end
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import "FBSDKShareMessengerOpenGraphMusicTemplateContent.h"
|
||||
|
||||
static NSString *const kMusicTemplatePageIDKey = @"pageID";
|
||||
static NSString *const kMusicTemplateURLKey = @"url";
|
||||
static NSString *const kMusicTemplateButtonKey = @"button";
|
||||
static NSString *const kMusicTemplateUUIDKey = @"uuid";
|
||||
|
||||
@implementation FBSDKShareMessengerOpenGraphMusicTemplateContent
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
@synthesize contentURL = _contentURL;
|
||||
@synthesize hashtag = _hashtag;
|
||||
@synthesize peopleIDs = _peopleIDs;
|
||||
@synthesize placeID = _placeID;
|
||||
@synthesize ref = _ref;
|
||||
@synthesize pageID = _pageID;
|
||||
@synthesize shareUUID = _shareUUID;
|
||||
|
||||
#pragma mark - Initializer
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_shareUUID = [NSUUID UUID].UUIDString;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - NSCoding
|
||||
|
||||
+ (BOOL)supportsSecureCoding
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)decoder
|
||||
{
|
||||
if ((self = [self init])) {
|
||||
_pageID = [decoder decodeObjectOfClass:[NSString class] forKey:kMusicTemplatePageIDKey];
|
||||
_url = [decoder decodeObjectOfClass:[NSURL class] forKey:kMusicTemplateURLKey];
|
||||
_button = [decoder decodeObjectForKey:kMusicTemplateButtonKey];
|
||||
_shareUUID = [decoder decodeObjectOfClass:[NSString class] forKey:kMusicTemplateUUIDKey];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)encoder
|
||||
{
|
||||
[encoder encodeObject:_pageID forKey:kMusicTemplatePageIDKey];
|
||||
[encoder encodeObject:_url forKey:kMusicTemplateURLKey];
|
||||
[encoder encodeObject:_button forKey:kMusicTemplateButtonKey];
|
||||
[encoder encodeObject:_shareUUID forKey:kMusicTemplateUUIDKey];
|
||||
}
|
||||
|
||||
#pragma mark - NSCopying
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
FBSDKShareMessengerOpenGraphMusicTemplateContent *copy = [[FBSDKShareMessengerOpenGraphMusicTemplateContent alloc] init];
|
||||
copy->_pageID = [_pageID copy];
|
||||
copy->_url = [_url copy];
|
||||
copy->_button = [_button copy];
|
||||
copy->_shareUUID = [_shareUUID copy];
|
||||
return copy;
|
||||
}
|
||||
|
||||
@end
|
||||
Generated
+62
@@ -0,0 +1,62 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <FBSDKShareKit/FBSDKShareMessengerActionButton.h>
|
||||
|
||||
typedef NS_ENUM(NSUInteger, FBSDKShareMessengerURLActionButtonWebviewHeightRatio) {
|
||||
FBSDKShareMessengerURLActionButtonWebviewHeightRatioFull = 0,
|
||||
FBSDKShareMessengerURLActionButtonWebviewHeightRatioTall,
|
||||
FBSDKShareMessengerURLActionButtonWebviewHeightRatioCompact
|
||||
};
|
||||
|
||||
/**
|
||||
A model for a Messenger share URL action button.
|
||||
*/
|
||||
@interface FBSDKShareMessengerURLActionButton : NSObject <FBSDKShareMessengerActionButton>
|
||||
|
||||
/**
|
||||
The url that this button should open when tapped. Required.
|
||||
*/
|
||||
@property (nonatomic, copy) NSURL *url;
|
||||
|
||||
/**
|
||||
This controls the display height of the webview when shown in the Messenger app. Defaults to Full.
|
||||
*/
|
||||
@property (nonatomic, assign) FBSDKShareMessengerURLActionButtonWebviewHeightRatio webviewHeightRatio;
|
||||
|
||||
/**
|
||||
This must be true if the url is a Messenger Extensions url. Defaults to NO.
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL isMessengerExtensionURL;
|
||||
|
||||
/**
|
||||
This is a fallback url for a Messenger Extensions enabled button. It is used on clients that do not support
|
||||
Messenger Extensions. If this is not defined, the url will be used as a fallback. Optional, but ignored
|
||||
unless isMessengerExtensionURL == YES.
|
||||
*/
|
||||
@property (nonatomic, copy) NSURL *fallbackURL;
|
||||
|
||||
/**
|
||||
This controls whether we want to hide the share button in the webview or not. It is useful to hide the share
|
||||
button when the webview is user-specific and contains sensitive information. Defaults to NO.
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL shouldHideWebviewShareButton;
|
||||
|
||||
@end
|
||||
Generated
+82
@@ -0,0 +1,82 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import "FBSDKShareMessengerURLActionButton.h"
|
||||
|
||||
#import "FBSDKCoreKit+Internal.h"
|
||||
#import "FBSDKShareUtility.h"
|
||||
|
||||
static NSString *const kURLActionButtonTitleKey = @"title";
|
||||
static NSString *const kURLActionButtonURLKey = @"url";
|
||||
static NSString *const kURLActionButtonWebviewHeightRatioKey = @"webviewHeightRatio";
|
||||
static NSString *const kURLActionButtonMessengerExtensionsKey = @"messengerExtensions";
|
||||
static NSString *const kURLActionButtonFallbackURLKey = @"fallbackURL";
|
||||
static NSString *const kURLActionButtonShouldHideWebviewShareButtonKey = @"shouldHideWebviewShareButton";
|
||||
|
||||
@implementation FBSDKShareMessengerURLActionButton
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
@synthesize title = _title;
|
||||
|
||||
#pragma mark - NSCoding
|
||||
|
||||
+ (BOOL)supportsSecureCoding
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)decoder
|
||||
{
|
||||
if ((self = [self init])) {
|
||||
_title = [decoder decodeObjectOfClass:[NSString class] forKey:kURLActionButtonTitleKey];
|
||||
_url = [decoder decodeObjectOfClass:[NSURL class] forKey:kURLActionButtonURLKey];
|
||||
_webviewHeightRatio = [[decoder decodeObjectOfClass:[NSNumber class] forKey:kURLActionButtonWebviewHeightRatioKey] unsignedIntegerValue];
|
||||
_isMessengerExtensionURL = [decoder decodeBoolForKey:kURLActionButtonMessengerExtensionsKey];
|
||||
_fallbackURL = [decoder decodeObjectOfClass:[NSURL class] forKey:kURLActionButtonFallbackURLKey];
|
||||
_shouldHideWebviewShareButton = [decoder decodeBoolForKey:kURLActionButtonShouldHideWebviewShareButtonKey];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)encoder
|
||||
{
|
||||
[encoder encodeObject:_title forKey:kURLActionButtonTitleKey];
|
||||
[encoder encodeObject:_url forKey:kURLActionButtonURLKey];
|
||||
[encoder encodeObject:@(_webviewHeightRatio) forKey:kURLActionButtonWebviewHeightRatioKey];
|
||||
[encoder encodeBool:_isMessengerExtensionURL forKey:kURLActionButtonMessengerExtensionsKey];
|
||||
[encoder encodeObject:_fallbackURL forKey:kURLActionButtonFallbackURLKey];
|
||||
[encoder encodeBool:_shouldHideWebviewShareButton forKey:kURLActionButtonShouldHideWebviewShareButtonKey];
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - NSCopying
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
FBSDKShareMessengerURLActionButton *copy = [[FBSDKShareMessengerURLActionButton alloc] init];
|
||||
copy->_title = [_title copy];
|
||||
copy->_url = [_url copy];
|
||||
copy->_webviewHeightRatio = _webviewHeightRatio;
|
||||
copy->_isMessengerExtensionURL = _isMessengerExtensionURL;
|
||||
copy->_fallbackURL = [_fallbackURL copy];
|
||||
copy->_shouldHideWebviewShareButton = _shouldHideWebviewShareButton;
|
||||
return copy;
|
||||
}
|
||||
|
||||
@end
|
||||
+28
-1
@@ -30,6 +30,8 @@
|
||||
#define FBSDK_SHARE_OPEN_GRAPH_CONTENT_PLACE_ID_KEY @"placeID"
|
||||
#define FBSDK_SHARE_OPEN_GRAPH_CONTENT_PREVIEW_PROPERTY_NAME_KEY @"previewPropertyName"
|
||||
#define FBSDK_SHARE_OPEN_GRAPH_CONTENT_REF_KEY @"ref"
|
||||
#define FBSDK_SHARE_OPEN_GRAPH_CONTENT_PAGE_ID_KEY @"pageID"
|
||||
#define FBSDK_SHARE_OPEN_GRAPH_CONTENT_UUID_KEY @"uuid"
|
||||
|
||||
@implementation FBSDKShareOpenGraphContent
|
||||
|
||||
@@ -40,6 +42,21 @@
|
||||
@synthesize peopleIDs = _peopleIDs;
|
||||
@synthesize placeID = _placeID;
|
||||
@synthesize ref = _ref;
|
||||
@synthesize pageID = _pageID;
|
||||
@synthesize shareUUID = _shareUUID;
|
||||
|
||||
#pragma mark - Initializer
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_shareUUID = [NSUUID UUID].UUIDString;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Setters
|
||||
|
||||
- (void)setPeopleIDs:(NSArray *)peopleIDs
|
||||
{
|
||||
@@ -61,6 +78,8 @@
|
||||
[_placeID hash],
|
||||
[_previewPropertyName hash],
|
||||
[_ref hash],
|
||||
[_pageID hash],
|
||||
[_shareUUID hash],
|
||||
};
|
||||
return [FBSDKMath hashWithIntegerArray:subhashes count:sizeof(subhashes) / sizeof(subhashes[0])];
|
||||
}
|
||||
@@ -85,7 +104,9 @@
|
||||
[FBSDKInternalUtility object:_peopleIDs isEqualToObject:content.peopleIDs] &&
|
||||
[FBSDKInternalUtility object:_placeID isEqualToObject:content.placeID] &&
|
||||
[FBSDKInternalUtility object:_previewPropertyName isEqualToObject:content.previewPropertyName] &&
|
||||
[FBSDKInternalUtility object:_ref isEqualToObject:content.ref]);
|
||||
[FBSDKInternalUtility object:_ref isEqualToObject:content.ref] &&
|
||||
[FBSDKInternalUtility object:_shareUUID isEqualToObject:content.shareUUID] &&
|
||||
[FBSDKInternalUtility object:_pageID isEqualToObject:content.pageID]);
|
||||
}
|
||||
|
||||
#pragma mark - NSCoding
|
||||
@@ -107,6 +128,8 @@
|
||||
_previewPropertyName = [decoder decodeObjectOfClass:[NSString class]
|
||||
forKey:FBSDK_SHARE_OPEN_GRAPH_CONTENT_PREVIEW_PROPERTY_NAME_KEY];
|
||||
_ref = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_OPEN_GRAPH_CONTENT_REF_KEY];
|
||||
_pageID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_OPEN_GRAPH_CONTENT_PAGE_ID_KEY];
|
||||
_shareUUID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_OPEN_GRAPH_CONTENT_UUID_KEY];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -120,6 +143,8 @@
|
||||
[encoder encodeObject:_placeID forKey:FBSDK_SHARE_OPEN_GRAPH_CONTENT_PLACE_ID_KEY];
|
||||
[encoder encodeObject:_previewPropertyName forKey:FBSDK_SHARE_OPEN_GRAPH_CONTENT_PREVIEW_PROPERTY_NAME_KEY];
|
||||
[encoder encodeObject:_ref forKey:FBSDK_SHARE_OPEN_GRAPH_CONTENT_REF_KEY];
|
||||
[encoder encodeObject:_pageID forKey:FBSDK_SHARE_OPEN_GRAPH_CONTENT_PAGE_ID_KEY];
|
||||
[encoder encodeObject:_shareUUID forKey:FBSDK_SHARE_OPEN_GRAPH_CONTENT_UUID_KEY];
|
||||
}
|
||||
|
||||
#pragma mark - NSCopying
|
||||
@@ -134,6 +159,8 @@
|
||||
copy->_placeID = [_placeID copy];
|
||||
copy->_previewPropertyName = [_previewPropertyName copy];
|
||||
copy->_ref = [_ref copy];
|
||||
copy->_pageID = [_pageID copy];
|
||||
copy->_shareUUID = [_shareUUID copy];
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
+28
-1
@@ -29,6 +29,8 @@
|
||||
#define FBSDK_SHARE_PHOTO_CONTENT_PHOTOS_KEY @"photos"
|
||||
#define FBSDK_SHARE_PHOTO_CONTENT_PLACE_ID_KEY @"placeID"
|
||||
#define FBSDK_SHARE_PHOTO_CONTENT_REF_KEY @"ref"
|
||||
#define FBSDK_SHARE_PHOTO_CONTENT_PAGE_ID_KEY @"pageID"
|
||||
#define FBSDK_SHARE_PHOTO_CONTENT_UUID_KEY @"uuid"
|
||||
|
||||
@implementation FBSDKSharePhotoContent
|
||||
|
||||
@@ -39,6 +41,21 @@
|
||||
@synthesize peopleIDs = _peopleIDs;
|
||||
@synthesize placeID = _placeID;
|
||||
@synthesize ref = _ref;
|
||||
@synthesize pageID = _pageID;
|
||||
@synthesize shareUUID = _shareUUID;
|
||||
|
||||
#pragma mark - Initializer
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_shareUUID = [NSUUID UUID].UUIDString;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Setters
|
||||
|
||||
- (void)setPeopleIDs:(NSArray *)peopleIDs
|
||||
{
|
||||
@@ -67,6 +84,8 @@
|
||||
[_photos hash],
|
||||
[_placeID hash],
|
||||
[_ref hash],
|
||||
[_pageID hash],
|
||||
[_shareUUID hash],
|
||||
};
|
||||
return [FBSDKMath hashWithIntegerArray:subhashes count:sizeof(subhashes) / sizeof(subhashes[0])];
|
||||
}
|
||||
@@ -90,7 +109,9 @@
|
||||
[FBSDKInternalUtility object:_peopleIDs isEqualToObject:content.peopleIDs] &&
|
||||
[FBSDKInternalUtility object:_photos isEqualToObject:content.photos] &&
|
||||
[FBSDKInternalUtility object:_placeID isEqualToObject:content.placeID] &&
|
||||
[FBSDKInternalUtility object:_ref isEqualToObject:content.ref]);
|
||||
[FBSDKInternalUtility object:_ref isEqualToObject:content.ref] &&
|
||||
[FBSDKInternalUtility object:_shareUUID isEqualToObject:content.shareUUID] &&
|
||||
[FBSDKInternalUtility object:_pageID isEqualToObject:content.pageID]);
|
||||
}
|
||||
|
||||
#pragma mark - NSCoding
|
||||
@@ -110,6 +131,8 @@
|
||||
_photos = [decoder decodeObjectOfClasses:classes forKey:FBSDK_SHARE_PHOTO_CONTENT_PHOTOS_KEY];
|
||||
_placeID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_PHOTO_CONTENT_PLACE_ID_KEY];
|
||||
_ref = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_PHOTO_CONTENT_REF_KEY];
|
||||
_pageID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_PHOTO_CONTENT_PAGE_ID_KEY];
|
||||
_shareUUID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_PHOTO_CONTENT_UUID_KEY];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -122,6 +145,8 @@
|
||||
[encoder encodeObject:_photos forKey:FBSDK_SHARE_PHOTO_CONTENT_PHOTOS_KEY];
|
||||
[encoder encodeObject:_placeID forKey:FBSDK_SHARE_PHOTO_CONTENT_PLACE_ID_KEY];
|
||||
[encoder encodeObject:_ref forKey:FBSDK_SHARE_PHOTO_CONTENT_REF_KEY];
|
||||
[encoder encodeObject:_pageID forKey:FBSDK_SHARE_PHOTO_CONTENT_PAGE_ID_KEY];
|
||||
[encoder encodeObject:_shareUUID forKey:FBSDK_SHARE_PHOTO_CONTENT_UUID_KEY];
|
||||
}
|
||||
|
||||
#pragma mark - NSCopying
|
||||
@@ -135,6 +160,8 @@
|
||||
copy->_photos = [_photos copy];
|
||||
copy->_placeID = [_placeID copy];
|
||||
copy->_ref = [_ref copy];
|
||||
copy->_pageID = [_pageID copy];
|
||||
copy->_shareUUID = [_shareUUID copy];
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
+27
@@ -28,7 +28,9 @@
|
||||
#define FBSDK_SHARE_VIDEO_CONTENT_PLACE_ID_KEY @"placeID"
|
||||
#define FBSDK_SHARE_VIDEO_CONTENT_PREVIEW_PHOTO_KEY @"previewPhoto"
|
||||
#define FBSDK_SHARE_VIDEO_CONTENT_REF_KEY @"ref"
|
||||
#define FBSDK_SHARE_VIDEO_CONTENT_PAGE_ID_KEY @"pageID"
|
||||
#define FBSDK_SHARE_VIDEO_CONTENT_VIDEO_KEY @"video"
|
||||
#define FBSDK_SHARE_VIDEO_CONTENT_UUID_KEY @"uuid"
|
||||
|
||||
@implementation FBSDKShareVideoContent
|
||||
|
||||
@@ -39,6 +41,21 @@
|
||||
@synthesize peopleIDs = _peopleIDs;
|
||||
@synthesize placeID = _placeID;
|
||||
@synthesize ref = _ref;
|
||||
@synthesize pageID = _pageID;
|
||||
@synthesize shareUUID = _shareUUID;
|
||||
|
||||
#pragma mark - Initializer
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_shareUUID = [NSUUID UUID].UUIDString;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Setters
|
||||
|
||||
- (void)setPeopleIDs:(NSArray *)peopleIDs
|
||||
{
|
||||
@@ -59,7 +76,9 @@
|
||||
[_placeID hash],
|
||||
[_previewPhoto hash],
|
||||
[_ref hash],
|
||||
[_pageID hash],
|
||||
[_video hash],
|
||||
[_shareUUID hash],
|
||||
};
|
||||
return [FBSDKMath hashWithIntegerArray:subhashes count:sizeof(subhashes) / sizeof(subhashes[0])];
|
||||
}
|
||||
@@ -84,6 +103,8 @@
|
||||
[FBSDKInternalUtility object:_placeID isEqualToObject:content.placeID] &&
|
||||
[FBSDKInternalUtility object:_previewPhoto isEqualToObject:content.previewPhoto] &&
|
||||
[FBSDKInternalUtility object:_ref isEqualToObject:content.ref] &&
|
||||
[FBSDKInternalUtility object:_pageID isEqualToObject:content.pageID] &&
|
||||
[FBSDKInternalUtility object:_shareUUID isEqualToObject:content.shareUUID] &&
|
||||
[FBSDKInternalUtility object:_video isEqualToObject:content.video]);
|
||||
}
|
||||
|
||||
@@ -104,7 +125,9 @@
|
||||
_previewPhoto = [decoder decodeObjectOfClass:[FBSDKSharePhoto class]
|
||||
forKey:FBSDK_SHARE_VIDEO_CONTENT_PREVIEW_PHOTO_KEY];
|
||||
_ref = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_VIDEO_CONTENT_REF_KEY];
|
||||
_pageID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_VIDEO_CONTENT_PAGE_ID_KEY];
|
||||
_video = [decoder decodeObjectOfClass:[FBSDKShareVideo class] forKey:FBSDK_SHARE_VIDEO_CONTENT_VIDEO_KEY];
|
||||
_shareUUID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_VIDEO_CONTENT_UUID_KEY];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -117,7 +140,9 @@
|
||||
[encoder encodeObject:_placeID forKey:FBSDK_SHARE_VIDEO_CONTENT_PLACE_ID_KEY];
|
||||
[encoder encodeObject:_previewPhoto forKey:FBSDK_SHARE_VIDEO_CONTENT_PREVIEW_PHOTO_KEY];
|
||||
[encoder encodeObject:_ref forKey:FBSDK_SHARE_VIDEO_CONTENT_REF_KEY];
|
||||
[encoder encodeObject:_pageID forKey:FBSDK_SHARE_VIDEO_CONTENT_PAGE_ID_KEY];
|
||||
[encoder encodeObject:_video forKey:FBSDK_SHARE_VIDEO_CONTENT_VIDEO_KEY];
|
||||
[encoder encodeObject:_shareUUID forKey:FBSDK_SHARE_VIDEO_CONTENT_UUID_KEY];
|
||||
}
|
||||
|
||||
#pragma mark - NSCopying
|
||||
@@ -131,7 +156,9 @@
|
||||
copy->_placeID = [_placeID copy];
|
||||
copy->_previewPhoto = [_previewPhoto copy];
|
||||
copy->_ref = [_ref copy];
|
||||
copy->_pageID = [_pageID copy];
|
||||
copy->_video = [_video copy];
|
||||
copy->_shareUUID = [_shareUUID copy];
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
+12
@@ -62,4 +62,16 @@
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *ref;
|
||||
|
||||
/**
|
||||
For shares into Messenger, this pageID will be used to map the app to page and attach attribution to the share.
|
||||
- Returns: The ID of the Facebok page this share is associated with.
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *pageID;
|
||||
|
||||
/**
|
||||
A unique identifier for a share involving this content, useful for tracking purposes.
|
||||
- Returns: A unique string identifying this share data.
|
||||
*/
|
||||
@property (nonatomic, copy, readonly) NSString *shareUUID;
|
||||
|
||||
@end
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import <FBSDKShareKit/FBSDKCameraEffectArguments.h>
|
||||
|
||||
@interface FBSDKCameraEffectArguments ()
|
||||
|
||||
- (NSDictionary *)allArguments;
|
||||
|
||||
@end
|
||||
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/Internal/FBSDKCameraEffectTextures+Internal.h
Generated
+25
@@ -0,0 +1,25 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import <FBSDKShareKit/FBSDKCameraEffectTextures.h>
|
||||
|
||||
@interface FBSDKCameraEffectTextures ()
|
||||
|
||||
- (NSDictionary<NSString *, UIImage *> *)allTextures;
|
||||
|
||||
@end
|
||||
+1
@@ -83,6 +83,7 @@
|
||||
{
|
||||
if (![FBSDKAccessToken currentAccessToken]) {
|
||||
_recipientIDs = nil;
|
||||
return;
|
||||
}
|
||||
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"me/apprequestformerrecipients"
|
||||
parameters:@{@"fields":@""}
|
||||
|
||||
Generated
+1
-1
@@ -100,7 +100,7 @@ typedef void(^fbsdk_like_action_controller_ensure_verified_object_id_completion_
|
||||
|
||||
#pragma mark - Class Methods
|
||||
|
||||
static BOOL _fbsdkLikeActionControllerDisabled = NO;
|
||||
static BOOL _fbsdkLikeActionControllerDisabled = YES;
|
||||
|
||||
+ (BOOL)isDisabled
|
||||
{
|
||||
|
||||
+1
@@ -19,6 +19,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#define FBSDK_SHARE_JS_DIALOG_SCHEME @"web"
|
||||
#define FBSDK_SHARE_CAMERA_METHOD_NAME @"camera"
|
||||
#define FBSDK_SHARE_METHOD_NAME @"share"
|
||||
#define FBSDK_SHARE_OPEN_GRAPH_METHOD_NAME @"ogshare"
|
||||
#define FBSDK_SHARE_RESULT_COMPLETION_GESTURE_KEY @"completionGesture"
|
||||
|
||||
Generated
+36
@@ -0,0 +1,36 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class FBSDKShareMessengerGenericTemplateContent;
|
||||
@class FBSDKShareMessengerMediaTemplateContent;
|
||||
@class FBSDKShareMessengerOpenGraphMusicTemplateContent;
|
||||
|
||||
@interface FBSDKShareMessengerContentUtility : NSObject
|
||||
|
||||
+ (void)addToParameters:(NSMutableDictionary *)parameters
|
||||
forShareMessengerGenericTemplateContent:(FBSDKShareMessengerGenericTemplateContent *)genericTemplateContent;
|
||||
|
||||
+ (void)addToParameters:(NSMutableDictionary *)parameters
|
||||
forShareMessengerMediaTemplateContent:(FBSDKShareMessengerMediaTemplateContent *)mediaTemplateContent;
|
||||
|
||||
+ (void)addToParameters:(NSMutableDictionary *)parameters
|
||||
forShareMessengerOpenGraphMusicTemplateContent:(FBSDKShareMessengerOpenGraphMusicTemplateContent *)openGraphMusicTemplate;
|
||||
|
||||
@end
|
||||
Generated
+264
@@ -0,0 +1,264 @@
|
||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
//
|
||||
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
||||
// copy, modify, and distribute this software in source code or binary form for use
|
||||
// in connection with the web services and APIs provided by Facebook.
|
||||
//
|
||||
// As with any software that integrates with the Facebook platform, your use of
|
||||
// this software is subject to the Facebook Developer Principles and Policies
|
||||
// [http://developers.facebook.com/policy/]. This copyright notice shall be
|
||||
// included in all copies or substantial portions of the software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import "FBSDKShareMessengerContentUtility.h"
|
||||
|
||||
#import "FBSDKCoreKit+Internal.h"
|
||||
#import "FBSDKShareMessengerGenericTemplateContent.h"
|
||||
#import "FBSDKShareMessengerGenericTemplateElement.h"
|
||||
#import "FBSDKShareMessengerMediaTemplateContent.h"
|
||||
#import "FBSDKShareMessengerOpenGraphMusicTemplateContent.h"
|
||||
#import "FBSDKShareMessengerURLActionButton.h"
|
||||
|
||||
static NSString *const kTemplateTypeKey = @"template_type";
|
||||
static NSString *const kTemplateKey = @"template";
|
||||
static NSString *const kPayloadKey = @"payload";
|
||||
static NSString *const kTypeKey = @"type";
|
||||
static NSString *const kAttachmentKey = @"attachment";
|
||||
static NSString *const kElementsKey = @"elements";
|
||||
static NSString *const kButtonsKey = @"buttons";
|
||||
|
||||
@implementation FBSDKShareMessengerContentUtility
|
||||
|
||||
static void _AddToContentPreviewDictionaryForURLButton(NSMutableDictionary *dictionary,
|
||||
FBSDKShareMessengerURLActionButton *urlButton)
|
||||
{
|
||||
NSString *urlString = urlButton.url.absoluteString;
|
||||
NSString *urlStringPath = urlButton.url.path;
|
||||
NSRange rangeOfPath = [urlString rangeOfString:urlStringPath];
|
||||
NSString *shortURLString = urlString;
|
||||
if (rangeOfPath.location != NSNotFound) {
|
||||
shortURLString = [urlString substringWithRange:NSMakeRange(0, rangeOfPath.location)];
|
||||
}
|
||||
|
||||
NSString *previewString = urlButton.title.length > 0 ? [NSString stringWithFormat:@"%@ - %@", urlButton.title, shortURLString] : shortURLString;
|
||||
[FBSDKInternalUtility dictionary:dictionary setObject:previewString forKey:@"target_display"];
|
||||
[FBSDKInternalUtility dictionary:dictionary setObject:urlButton.url.absoluteString forKey:@"item_url"];
|
||||
}
|
||||
|
||||
static void _AddToContentPreviewDictionaryForButton(NSMutableDictionary *dictionary,
|
||||
id<FBSDKShareMessengerActionButton> button)
|
||||
{
|
||||
if ([button isKindOfClass:[FBSDKShareMessengerURLActionButton class]]) {
|
||||
_AddToContentPreviewDictionaryForURLButton(dictionary, button);
|
||||
}
|
||||
}
|
||||
|
||||
static NSString *_WebviewHeightRatioString(FBSDKShareMessengerURLActionButtonWebviewHeightRatio heightRatio) {
|
||||
switch (heightRatio) {
|
||||
case FBSDKShareMessengerURLActionButtonWebviewHeightRatioFull:
|
||||
return @"full";
|
||||
case FBSDKShareMessengerURLActionButtonWebviewHeightRatioTall:
|
||||
return @"tall";
|
||||
case FBSDKShareMessengerURLActionButtonWebviewHeightRatioCompact:
|
||||
return @"compact";
|
||||
}
|
||||
}
|
||||
|
||||
static NSString *_MediaTypeString(FBSDKShareMessengerMediaTemplateMediaType mediaType)
|
||||
{
|
||||
switch (mediaType) {
|
||||
case FBSDKShareMessengerMediaTemplateMediaTypeImage:
|
||||
return @"image";
|
||||
case FBSDKShareMessengerMediaTemplateMediaTypeVideo:
|
||||
return @"video";
|
||||
}
|
||||
}
|
||||
|
||||
static NSString *_WebviewShareButtonString(BOOL shouldHideWebviewShareButton) {
|
||||
return shouldHideWebviewShareButton ? @"hide" : nil;
|
||||
}
|
||||
|
||||
static NSString *_ImageAspectRatioString(FBSDKShareMessengerGenericTemplateImageAspectRatio imageAspectRatio)
|
||||
{
|
||||
switch (imageAspectRatio) {
|
||||
case FBSDKShareMessengerGenericTemplateImageAspectRatioSquare:
|
||||
return @"square";
|
||||
case FBSDKShareMessengerGenericTemplateImageAspectRatioHorizontal:
|
||||
return @"horizontal";
|
||||
}
|
||||
}
|
||||
|
||||
static NSDictionary *_SerializableButtonFromURLButton(FBSDKShareMessengerURLActionButton *button, BOOL isDefaultAction)
|
||||
{
|
||||
NSMutableDictionary *serializableButton = [NSMutableDictionary dictionary];
|
||||
|
||||
// Strip out title for default action
|
||||
if (!isDefaultAction) {
|
||||
[FBSDKInternalUtility dictionary:serializableButton setObject:button.title forKey:@"title"];
|
||||
}
|
||||
|
||||
[FBSDKInternalUtility dictionary:serializableButton setObject:@"web_url" forKey:@"type"];
|
||||
[FBSDKInternalUtility dictionary:serializableButton setObject:button.url.absoluteString forKey:@"url"];
|
||||
[FBSDKInternalUtility dictionary:serializableButton setObject:_WebviewHeightRatioString(button.webviewHeightRatio) forKey:@"webview_height_ratio"];
|
||||
[FBSDKInternalUtility dictionary:serializableButton setObject:@(button.isMessengerExtensionURL) forKey:@"messenger_extensions"];
|
||||
[FBSDKInternalUtility dictionary:serializableButton setObject:button.fallbackURL.absoluteString forKey:@"fallback_url"];
|
||||
[FBSDKInternalUtility dictionary:serializableButton setObject:_WebviewShareButtonString(button.shouldHideWebviewShareButton) forKey:@"webview_share_button"];
|
||||
return serializableButton;
|
||||
}
|
||||
|
||||
static NSArray *_SerializableButtonsFromButton(id<FBSDKShareMessengerActionButton> button)
|
||||
{
|
||||
// Return NSArray even though there is just one button to match proper json structure
|
||||
NSMutableArray *serializableButtons = [NSMutableArray array];
|
||||
if ([button isKindOfClass:[FBSDKShareMessengerURLActionButton class]]) {
|
||||
[FBSDKInternalUtility array:serializableButtons addObject:_SerializableButtonFromURLButton(button, NO)];
|
||||
}
|
||||
|
||||
return serializableButtons;
|
||||
}
|
||||
|
||||
static NSArray *_SerializableGenericTemplateElementsFromElements(NSArray<FBSDKShareMessengerGenericTemplateElement *> *elements)
|
||||
{
|
||||
NSMutableArray *serializableElements = [NSMutableArray array];
|
||||
for (FBSDKShareMessengerGenericTemplateElement *element in elements) {
|
||||
NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary];
|
||||
[FBSDKInternalUtility dictionary:elementDictionary setObject:element.title forKey:@"title"];
|
||||
[FBSDKInternalUtility dictionary:elementDictionary setObject:element.subtitle forKey:@"subtitle"];
|
||||
[FBSDKInternalUtility dictionary:elementDictionary setObject:element.imageURL.absoluteString forKey:@"image_url"];
|
||||
[FBSDKInternalUtility dictionary:elementDictionary setObject:_SerializableButtonsFromButton(element.button) forKey:kButtonsKey];
|
||||
if ([element.defaultAction isKindOfClass:[FBSDKShareMessengerURLActionButton class]]) {
|
||||
[FBSDKInternalUtility dictionary:elementDictionary setObject:_SerializableButtonFromURLButton(element.defaultAction, YES) forKey:@"default_action"];
|
||||
}
|
||||
|
||||
[serializableElements addObject:elementDictionary];
|
||||
}
|
||||
|
||||
return serializableElements;
|
||||
}
|
||||
|
||||
static NSArray *_SerializableMediaTemplateContentFromContent(FBSDKShareMessengerMediaTemplateContent *mediaTemplateContent)
|
||||
{
|
||||
NSMutableArray *serializableMediaTemplateContent = [NSMutableArray array];
|
||||
|
||||
NSMutableDictionary *mediaTemplateContentDictionary = [NSMutableDictionary dictionary];
|
||||
[FBSDKInternalUtility dictionary:mediaTemplateContentDictionary setObject:_MediaTypeString(mediaTemplateContent.mediaType) forKey:@"media_type"];
|
||||
[FBSDKInternalUtility dictionary:mediaTemplateContentDictionary setObject:mediaTemplateContent.mediaURL.absoluteString forKey:@"url"];
|
||||
[FBSDKInternalUtility dictionary:mediaTemplateContentDictionary setObject:mediaTemplateContent.attachmentID forKey:@"attachment_id"];
|
||||
[FBSDKInternalUtility dictionary:mediaTemplateContentDictionary setObject:_SerializableButtonsFromButton(mediaTemplateContent.button) forKey:kButtonsKey];
|
||||
[serializableMediaTemplateContent addObject:mediaTemplateContentDictionary];
|
||||
|
||||
return serializableMediaTemplateContent;
|
||||
}
|
||||
|
||||
static NSArray *_SerializableOpenGraphMusicTemplateContentFromContent(FBSDKShareMessengerOpenGraphMusicTemplateContent *openGraphMusicTemplateContent)
|
||||
{
|
||||
NSMutableArray *serializableOpenGraphMusicTemplateContent = [NSMutableArray array];
|
||||
|
||||
NSMutableDictionary *openGraphMusicTemplateContentDictionary = [NSMutableDictionary dictionary];
|
||||
[FBSDKInternalUtility dictionary:openGraphMusicTemplateContentDictionary setObject:openGraphMusicTemplateContent.url.absoluteString forKey:@"url"];
|
||||
[FBSDKInternalUtility dictionary:openGraphMusicTemplateContentDictionary setObject:_SerializableButtonsFromButton(openGraphMusicTemplateContent.button) forKey:kButtonsKey];
|
||||
[serializableOpenGraphMusicTemplateContent addObject:openGraphMusicTemplateContentDictionary];
|
||||
|
||||
return serializableOpenGraphMusicTemplateContent;
|
||||
}
|
||||
|
||||
+ (void)_addToParameters:(NSMutableDictionary *)parameters
|
||||
contentForShare:(NSMutableDictionary *)contentForShare
|
||||
contentForPreview:(NSMutableDictionary *)contentForPreview
|
||||
{
|
||||
NSError *error = nil;
|
||||
NSData *contentForShareData = [NSJSONSerialization dataWithJSONObject:contentForShare options:kNilOptions error:&error];
|
||||
if (!error && contentForShareData) {
|
||||
NSString *contentForShareDataString = [[NSString alloc] initWithData:contentForShareData encoding:NSUTF8StringEncoding];
|
||||
|
||||
NSMutableDictionary *messengerShareContent = [NSMutableDictionary dictionary];
|
||||
[FBSDKInternalUtility dictionary:messengerShareContent setObject:contentForShareDataString forKey:@"content_for_share"];
|
||||
[FBSDKInternalUtility dictionary:messengerShareContent setObject:contentForPreview forKey:@"content_for_preview"];
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:messengerShareContent forKey:@"messenger_share_content"];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)addToParameters:(NSMutableDictionary *)parameters
|
||||
forShareMessengerGenericTemplateContent:(FBSDKShareMessengerGenericTemplateContent *)genericTemplateContent
|
||||
{
|
||||
NSMutableDictionary *payload = [NSMutableDictionary dictionary];
|
||||
[payload setObject:@"generic" forKey:kTemplateTypeKey];
|
||||
[payload setObject:@(genericTemplateContent.isSharable) forKey:@"sharable"];
|
||||
[payload setObject:_ImageAspectRatioString(genericTemplateContent.imageAspectRatio) forKey:@"image_aspect_ratio"];
|
||||
[payload setObject:_SerializableGenericTemplateElementsFromElements(@[genericTemplateContent.element]) forKey:kElementsKey];
|
||||
|
||||
NSMutableDictionary *attachment = [NSMutableDictionary dictionary];
|
||||
[attachment setObject:kTemplateKey forKey:kTypeKey];
|
||||
[attachment setObject:payload forKey:kPayloadKey];
|
||||
|
||||
NSMutableDictionary *contentForShare = [NSMutableDictionary dictionary];
|
||||
[contentForShare setObject:attachment forKey:kAttachmentKey];
|
||||
|
||||
FBSDKShareMessengerGenericTemplateElement *firstElement = genericTemplateContent.element;
|
||||
NSMutableDictionary *contentForPreview = [NSMutableDictionary dictionary];
|
||||
[FBSDKInternalUtility dictionary:contentForPreview setObject:@"DEFAULT" forKey:@"preview_type"];
|
||||
[FBSDKInternalUtility dictionary:contentForPreview setObject:firstElement.title forKey:@"title"];
|
||||
[FBSDKInternalUtility dictionary:contentForPreview setObject:firstElement.subtitle forKey:@"subtitle"];
|
||||
[FBSDKInternalUtility dictionary:contentForPreview setObject:firstElement.imageURL.absoluteString forKey:@"image_url"];
|
||||
if (firstElement.button) {
|
||||
_AddToContentPreviewDictionaryForButton(contentForPreview, firstElement.button);
|
||||
} else {
|
||||
_AddToContentPreviewDictionaryForButton(contentForPreview, firstElement.defaultAction);
|
||||
}
|
||||
|
||||
[self _addToParameters:parameters contentForShare:contentForShare contentForPreview:contentForPreview];
|
||||
}
|
||||
|
||||
+ (void)addToParameters:(NSMutableDictionary *)parameters
|
||||
forShareMessengerMediaTemplateContent:(FBSDKShareMessengerMediaTemplateContent *)mediaTemplateContent
|
||||
{
|
||||
NSMutableDictionary *payload = [NSMutableDictionary dictionary];
|
||||
[payload setObject:@"media" forKey:kTemplateTypeKey];
|
||||
[payload setObject:_SerializableMediaTemplateContentFromContent(mediaTemplateContent) forKey:kElementsKey];
|
||||
|
||||
NSMutableDictionary *attachment = [NSMutableDictionary dictionary];
|
||||
[attachment setObject:kTemplateKey forKey:kTypeKey];
|
||||
[attachment setObject:payload forKey:kPayloadKey];
|
||||
|
||||
NSMutableDictionary *contentForShare = [NSMutableDictionary dictionary];
|
||||
[contentForShare setObject:attachment forKey:kAttachmentKey];
|
||||
|
||||
NSMutableDictionary *contentForPreview = [NSMutableDictionary dictionary];
|
||||
[FBSDKInternalUtility dictionary:contentForPreview setObject:@"DEFAULT" forKey:@"preview_type"];
|
||||
[FBSDKInternalUtility dictionary:contentForPreview setObject:mediaTemplateContent.attachmentID forKey:@"attachment_id"];
|
||||
[FBSDKInternalUtility dictionary:contentForPreview setObject:mediaTemplateContent.mediaURL.absoluteString forKey:@"facebook_media_url"];
|
||||
[FBSDKInternalUtility dictionary:contentForPreview setObject:_MediaTypeString(mediaTemplateContent.mediaType) forKey:@"media_type"];
|
||||
_AddToContentPreviewDictionaryForButton(contentForPreview, mediaTemplateContent.button);
|
||||
|
||||
[self _addToParameters:parameters contentForShare:contentForShare contentForPreview:contentForPreview];
|
||||
}
|
||||
|
||||
+ (void)addToParameters:(NSMutableDictionary *)parameters
|
||||
forShareMessengerOpenGraphMusicTemplateContent:(FBSDKShareMessengerOpenGraphMusicTemplateContent *)openGraphMusicTemplate
|
||||
{
|
||||
NSMutableDictionary *payload = [NSMutableDictionary dictionary];
|
||||
[payload setObject:@"open_graph" forKey:kTemplateTypeKey];
|
||||
[payload setObject:_SerializableOpenGraphMusicTemplateContentFromContent(openGraphMusicTemplate) forKey:kElementsKey];
|
||||
|
||||
NSMutableDictionary *attachment = [NSMutableDictionary dictionary];
|
||||
[attachment setObject:kTemplateKey forKey:kTypeKey];
|
||||
[attachment setObject:payload forKey:kPayloadKey];
|
||||
|
||||
NSMutableDictionary *contentForShare = [NSMutableDictionary dictionary];
|
||||
[contentForShare setObject:attachment forKey:kAttachmentKey];
|
||||
|
||||
NSMutableDictionary *contentForPreview = [NSMutableDictionary dictionary];
|
||||
[FBSDKInternalUtility dictionary:contentForPreview setObject:@"OPEN_GRAPH" forKey:@"preview_type"];
|
||||
[FBSDKInternalUtility dictionary:contentForPreview setObject:openGraphMusicTemplate.url.absoluteString forKey:@"open_graph_url"];
|
||||
_AddToContentPreviewDictionaryForButton(contentForPreview, openGraphMusicTemplate.button);
|
||||
|
||||
[self _addToParameters:parameters contentForShare:contentForShare contentForPreview:contentForPreview];
|
||||
}
|
||||
|
||||
@end
|
||||
+3
@@ -28,6 +28,7 @@
|
||||
#if !TARGET_OS_TV
|
||||
#import <FBSDKShareKit/FBSDKAppInviteContent.h>
|
||||
#import <FBSDKShareKit/FBSDKGameRequestContent.h>
|
||||
#import <FBSDKShareKit/FBSDKShareCameraEffectContent.h>
|
||||
#endif
|
||||
|
||||
@interface FBSDKShareUtility : NSObject
|
||||
@@ -69,6 +70,8 @@
|
||||
|
||||
#if !TARGET_OS_TV
|
||||
+ (BOOL)validateAppInviteContent:(FBSDKAppInviteContent *)appInviteContent error:(NSError *__autoreleasing *)errorRef;
|
||||
+ (BOOL)validateShareCameraEffectContent:(FBSDKShareCameraEffectContent *)ShareCameraEffectContent
|
||||
error:(NSError *__autoreleasing *)errorRef;
|
||||
+ (BOOL)validateGameRequestContent:(FBSDKGameRequestContent *)gameRequestContent error:(NSError *__autoreleasing *)errorRef;
|
||||
#endif
|
||||
@end
|
||||
+182
-1
@@ -33,6 +33,17 @@
|
||||
#import "FBSDKShareVideoContent.h"
|
||||
#import "FBSDKSharingContent.h"
|
||||
|
||||
#if !TARGET_OS_TV
|
||||
#import "FBSDKCameraEffectArguments+Internal.h"
|
||||
#import "FBSDKCameraEffectTextures+Internal.h"
|
||||
#import "FBSDKShareMessengerContentUtility.h"
|
||||
#import "FBSDKShareMessengerGenericTemplateContent.h"
|
||||
#import "FBSDKShareMessengerGenericTemplateElement.h"
|
||||
#import "FBSDKShareMessengerMediaTemplateContent.h"
|
||||
#import "FBSDKShareMessengerOpenGraphMusicTemplateContent.h"
|
||||
#import "FBSDKShareMessengerURLActionButton.h"
|
||||
#endif
|
||||
|
||||
@implementation FBSDKShareUtility
|
||||
|
||||
#pragma mark - Class Methods
|
||||
@@ -171,7 +182,7 @@
|
||||
void(^stageImageCompletion)(NSArray<NSString *> *) = ^(NSArray<NSString *> *stagedURIs) {
|
||||
NSString *methodName = @"share";
|
||||
NSMutableDictionary *parameters = [[FBSDKShareUtility parametersForShareContent:content
|
||||
shouldFailOnDataError:NO] mutableCopy];
|
||||
shouldFailOnDataError:NO] mutableCopy];
|
||||
[parameters removeObjectForKey:@"photos"];
|
||||
|
||||
NSString *stagedURIJSONString = [FBSDKInternalUtility JSONStringForObject:stagedURIs
|
||||
@@ -301,6 +312,19 @@
|
||||
[self _addToParameters:parameters forShareVideoContent:(FBSDKShareVideoContent *)shareContent];
|
||||
} else if ([shareContent isKindOfClass:[FBSDKShareOpenGraphContent class]]) {
|
||||
[self _addToParameters:parameters forShareOpenGraphContent:(FBSDKShareOpenGraphContent *)shareContent];
|
||||
#if !TARGET_OS_TV
|
||||
} else if ([shareContent isKindOfClass:[FBSDKShareMessengerGenericTemplateContent class]]) {
|
||||
[FBSDKShareMessengerContentUtility addToParameters:parameters
|
||||
forShareMessengerGenericTemplateContent:(FBSDKShareMessengerGenericTemplateContent *)shareContent];
|
||||
} else if ([shareContent isKindOfClass:[FBSDKShareMessengerMediaTemplateContent class]]) {
|
||||
[FBSDKShareMessengerContentUtility addToParameters:parameters
|
||||
forShareMessengerMediaTemplateContent:(FBSDKShareMessengerMediaTemplateContent *)shareContent];
|
||||
} else if ([shareContent isKindOfClass:[FBSDKShareMessengerOpenGraphMusicTemplateContent class]]) {
|
||||
[FBSDKShareMessengerContentUtility addToParameters:parameters
|
||||
forShareMessengerOpenGraphMusicTemplateContent:(FBSDKShareMessengerOpenGraphMusicTemplateContent *)shareContent];
|
||||
} else if ([shareContent isKindOfClass:[FBSDKShareCameraEffectContent class]]) {
|
||||
[self _addToParameters:parameters forShareCameraEffectContent:(FBSDKShareCameraEffectContent *)shareContent];
|
||||
#endif
|
||||
}
|
||||
return [parameters copy];
|
||||
}
|
||||
@@ -405,6 +429,24 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
+ (BOOL)validateShareCameraEffectContent:(FBSDKShareCameraEffectContent *)ShareCameraEffectContent
|
||||
error:(NSError *__autoreleasing *)errorRef {
|
||||
NSString *effectID = ShareCameraEffectContent.effectID;
|
||||
NSCharacterSet* nonDigitCharacters = [[NSCharacterSet decimalDigitCharacterSet] invertedSet];
|
||||
|
||||
if ([effectID length] > 0) {
|
||||
if ([effectID rangeOfCharacterFromSet:nonDigitCharacters].location != NSNotFound) {
|
||||
if (errorRef != NULL) {
|
||||
*errorRef = [FBSDKError invalidArgumentErrorWithName:@"effectID"
|
||||
value:effectID
|
||||
message:@"Invalid value for effectID, effectID can contain only numerical characters."];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
#endif
|
||||
|
||||
+ (BOOL)validateAssetLibraryURLWithShareVideoContent:(FBSDKShareVideoContent *)videoContent name:(NSString *)name error:(NSError *__autoreleasing *)errorRef
|
||||
@@ -512,6 +554,16 @@
|
||||
return [self validateShareMediaContent:(FBSDKShareMediaContent *)shareContent error:errorRef];
|
||||
} else if ([shareContent isKindOfClass:[FBSDKShareOpenGraphContent class]]) {
|
||||
return [self validateShareOpenGraphContent:(FBSDKShareOpenGraphContent *)shareContent error:errorRef];
|
||||
#if !TARGET_OS_TV
|
||||
} else if ([shareContent isKindOfClass:[FBSDKShareMessengerMediaTemplateContent class]]) {
|
||||
return [self validateMessengerMediaTemplateContent:(FBSDKShareMessengerMediaTemplateContent *)shareContent error:errorRef];
|
||||
} else if ([shareContent isKindOfClass:[FBSDKShareMessengerGenericTemplateContent class]]) {
|
||||
return [self validateMessengerGenericTemplateContent:(FBSDKShareMessengerGenericTemplateContent *)shareContent error:errorRef];
|
||||
} else if ([shareContent isKindOfClass:[FBSDKShareMessengerOpenGraphMusicTemplateContent class]]) {
|
||||
return [self validateMessengerOpenGraphMusicTemplateContent:(FBSDKShareMessengerOpenGraphMusicTemplateContent *)shareContent error:errorRef];
|
||||
} else if ([shareContent isKindOfClass:[FBSDKShareCameraEffectContent class]]) {
|
||||
return [self validateShareCameraEffectContent:(FBSDKShareCameraEffectContent *)shareContent error:errorRef];
|
||||
#endif
|
||||
} else {
|
||||
if (errorRef != NULL) {
|
||||
*errorRef = [FBSDKShareError invalidArgumentErrorWithName:@"shareContent" value:shareContent message:nil];
|
||||
@@ -619,6 +671,82 @@
|
||||
[self _validateRequiredValue:videoURL name:@"videoURL" error:errorRef]);
|
||||
}
|
||||
|
||||
#if !TARGET_OS_TV
|
||||
|
||||
+ (BOOL)validateMessengerMediaTemplateContent:(FBSDKShareMessengerMediaTemplateContent *)messengerMediaTemplateContent
|
||||
error:(NSError *__autoreleasing *)errorRef
|
||||
{
|
||||
if (!messengerMediaTemplateContent.mediaURL && !messengerMediaTemplateContent.attachmentID) {
|
||||
if (errorRef != NULL) {
|
||||
*errorRef = [FBSDKShareError requiredArgumentErrorWithName:@"attachmentID/mediaURL" message:@"Must specify either attachmentID or mediaURL"];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
return [self _validateMessengerActionButton:messengerMediaTemplateContent.button
|
||||
isDefaultActionButton:NO
|
||||
pageID:messengerMediaTemplateContent.pageID
|
||||
error:errorRef];
|
||||
}
|
||||
|
||||
+ (BOOL)validateMessengerGenericTemplateContent:(FBSDKShareMessengerGenericTemplateContent *)genericTemplateContent
|
||||
error:(NSError *__autoreleasing *)errorRef
|
||||
{
|
||||
return [self _validateRequiredValue:genericTemplateContent.element.title name:@"element.title" error:errorRef] &&
|
||||
[self _validateMessengerActionButton:genericTemplateContent.element.defaultAction
|
||||
isDefaultActionButton:YES
|
||||
pageID:genericTemplateContent.pageID
|
||||
error:errorRef] &&
|
||||
[self _validateMessengerActionButton:genericTemplateContent.element.button
|
||||
isDefaultActionButton:NO
|
||||
pageID:genericTemplateContent.pageID
|
||||
error:errorRef];
|
||||
}
|
||||
|
||||
+ (BOOL)validateMessengerOpenGraphMusicTemplateContent:(FBSDKShareMessengerOpenGraphMusicTemplateContent *)openGraphMusicTemplateContent
|
||||
error:(NSError *__autoreleasing *)errorRef
|
||||
{
|
||||
return [self _validateRequiredValue:openGraphMusicTemplateContent.url name:@"url" error:errorRef] &&
|
||||
[self _validateRequiredValue:openGraphMusicTemplateContent.pageID name:@"pageID" error:errorRef] &&
|
||||
[self _validateMessengerActionButton:openGraphMusicTemplateContent.button
|
||||
isDefaultActionButton:NO
|
||||
pageID:openGraphMusicTemplateContent.pageID
|
||||
error:errorRef];
|
||||
}
|
||||
|
||||
+ (BOOL)_validateMessengerActionButton:(id<FBSDKShareMessengerActionButton>)button
|
||||
isDefaultActionButton:(BOOL)isDefaultActionButton
|
||||
pageID:(NSString *)pageID
|
||||
error:(NSError *__autoreleasing *)errorRef
|
||||
{
|
||||
if (!button) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
if ([button isKindOfClass:[FBSDKShareMessengerURLActionButton class]]) {
|
||||
return [self _validateURLActionButton:(FBSDKShareMessengerURLActionButton *)button
|
||||
isDefaultActionButton:isDefaultActionButton
|
||||
pageID:pageID
|
||||
error:errorRef];
|
||||
} else {
|
||||
if (errorRef != NULL) {
|
||||
*errorRef = [FBSDKShareError invalidArgumentErrorWithName:@"buttons" value:button message:nil];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
+ (BOOL)_validateURLActionButton:(FBSDKShareMessengerURLActionButton *)urlActionButton
|
||||
isDefaultActionButton:(BOOL)isDefaultActionButton
|
||||
pageID:(NSString *)pageID
|
||||
error:(NSError *__autoreleasing *)errorRef
|
||||
{
|
||||
return [self _validateRequiredValue:urlActionButton.url name:@"button.url" error:errorRef] &&
|
||||
(!isDefaultActionButton ? [self _validateRequiredValue:urlActionButton.title name:@"button.title" error:errorRef] : YES) &&
|
||||
(urlActionButton.isMessengerExtensionURL ? [self _validateRequiredValue:pageID name:@"content pageID" error:errorRef] : YES);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+ (BOOL)shareMediaContentContainsPhotosAndVideos:(FBSDKShareMediaContent *)shareMediaContent
|
||||
{
|
||||
BOOL containsPhotos = NO;
|
||||
@@ -643,6 +771,10 @@
|
||||
if (hashtagString != nil) {
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:@[hashtagString] forKey:@"hashtags"];
|
||||
}
|
||||
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:shareContent.pageID forKey:@"pageID"];
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:shareContent.shareUUID forKey:@"shareUUID"];
|
||||
|
||||
if ([shareContent isKindOfClass:[FBSDKShareOpenGraphContent class]]) {
|
||||
FBSDKShareOpenGraphAction *action = ((FBSDKShareOpenGraphContent *)shareContent).action;
|
||||
[action setArray:shareContent.peopleIDs forKey:@"tags"];
|
||||
@@ -685,6 +817,12 @@ forShareOpenGraphContent:(FBSDKShareOpenGraphContent *)openGraphContent
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.contentTitle forKey:@"name"];
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.contentDescription forKey:@"description"];
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.imageURL forKey:@"picture"];
|
||||
|
||||
/**
|
||||
Pass link parameter as "messenger_link" due to versioning requirements for message dialog flow.
|
||||
We will only use the new share flow we developed if messenger_link is present, not link.
|
||||
*/
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.contentURL forKey:@"messenger_link"];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
@@ -703,6 +841,49 @@ forShareOpenGraphContent:(FBSDKShareOpenGraphContent *)openGraphContent
|
||||
parameters[@"video"] = videoParameters;
|
||||
}
|
||||
|
||||
#if !TARGET_OS_TV
|
||||
+ (void)_addToParameters:(NSMutableDictionary *)parameters
|
||||
forShareCameraEffectContent:(FBSDKShareCameraEffectContent *)cameraEffectContent
|
||||
{
|
||||
[FBSDKInternalUtility dictionary:parameters
|
||||
setObject:cameraEffectContent.effectID
|
||||
forKey:@"effect_id"];
|
||||
[FBSDKInternalUtility dictionary:parameters
|
||||
setObject:[self _convertCameraEffectArguments:cameraEffectContent.effectArguments]
|
||||
forKey:@"effect_arguments"];
|
||||
[FBSDKInternalUtility dictionary:parameters
|
||||
setObject:[self _convertCameraEffectTextures:cameraEffectContent.effectTextures]
|
||||
forKey:@"effect_textures"];
|
||||
}
|
||||
|
||||
+ (NSString *)_convertCameraEffectArguments:(FBSDKCameraEffectArguments *)arguments
|
||||
{
|
||||
// Convert a camera effect arguments container to a JSON string.
|
||||
if (arguments == nil) {
|
||||
return nil;
|
||||
}
|
||||
return [FBSDKInternalUtility JSONStringForObject:[arguments allArguments]
|
||||
error:NULL
|
||||
invalidObjectHandler:NULL];
|
||||
}
|
||||
|
||||
+ (NSData *)_convertCameraEffectTextures:(FBSDKCameraEffectTextures *)textures
|
||||
{
|
||||
if (textures == nil) {
|
||||
return nil;
|
||||
}
|
||||
// Convert the entire textures dictionary into one NSData, because
|
||||
// the existing API protocol only allows one value to be put into the pasteboard.
|
||||
NSDictionary *texturesDict = [textures allTextures];
|
||||
NSMutableDictionary *texturesDataDict = [NSMutableDictionary dictionaryWithCapacity:texturesDict.count];
|
||||
[texturesDict enumerateKeysAndObjectsUsingBlock:^(NSString *key, UIImage *img, BOOL *stop) {
|
||||
// Convert UIImages to NSData, because UIImage is not archivable.
|
||||
[texturesDataDict setObject:UIImagePNGRepresentation(img) forKey:key];
|
||||
}];
|
||||
return [NSKeyedArchiver archivedDataWithRootObject:texturesDataDict];
|
||||
}
|
||||
#endif
|
||||
|
||||
+ (id)_convertObject:(id)object
|
||||
{
|
||||
if ([object isKindOfClass:[FBSDKShareOpenGraphValueContainer class]]) {
|
||||
|
||||
Reference in new issue
Block a user