- add getEnvironment in PNObjectConfig
This commit is contained in:
parent
f42c646dcb
commit
872d8a78dd
@ -1,3 +1,5 @@
|
||||
platform :ios, '9.0'
|
||||
|
||||
target 'PNObject_Example' do
|
||||
pod 'PNObject', :path => '../'
|
||||
pod 'PureLayout'
|
||||
|
||||
@ -14,30 +14,31 @@ PODS:
|
||||
- AFNetworking/Serialization (3.1.0)
|
||||
- AFNetworking/UIKit (3.1.0):
|
||||
- AFNetworking/NSURLSession
|
||||
- Bolts (1.8.4):
|
||||
- Bolts/AppLinks (= 1.8.4)
|
||||
- Bolts/Tasks (= 1.8.4)
|
||||
- Bolts/AppLinks (1.8.4):
|
||||
- Bolts (1.9.0):
|
||||
- Bolts/AppLinks (= 1.9.0)
|
||||
- Bolts/Tasks (= 1.9.0)
|
||||
- Bolts/AppLinks (1.9.0):
|
||||
- Bolts/Tasks
|
||||
- Bolts/Tasks (1.8.4)
|
||||
- Bolts/Tasks (1.9.0)
|
||||
- CodFis-Helper (0.1.3)
|
||||
- DDDKeychainWrapper (1.0.0)
|
||||
- DJLocalization (1.2.2):
|
||||
- DJLocalization/Core (= 1.2.2)
|
||||
- DJLocalization/Core (1.2.2)
|
||||
- Expecta (1.0.6)
|
||||
- FBSDKCoreKit (4.26.0):
|
||||
- FBSDKCoreKit (4.29.0):
|
||||
- Bolts (~> 1.7)
|
||||
- FBSDKLoginKit (4.26.0):
|
||||
- FBSDKLoginKit (4.29.0):
|
||||
- FBSDKCoreKit
|
||||
- FBSDKShareKit (4.26.0):
|
||||
- FBSDKShareKit (4.29.0):
|
||||
- FBSDKCoreKit
|
||||
- NSDataAES (0.2.2)
|
||||
- NSDate_Utils (1.0.6)
|
||||
- NSDate_Utils (1.1.0):
|
||||
- DJLocalization
|
||||
- NSString-Helper (1.0.5)
|
||||
- nv-ios-http-status (0.0.1)
|
||||
- PEAR-FileManager-iOS (1.3.1)
|
||||
- PNObject (1.3.2):
|
||||
- PNObject (1.3.3):
|
||||
- AFNetworking
|
||||
- CodFis-Helper
|
||||
- DDDKeychainWrapper
|
||||
@ -55,7 +56,7 @@ PODS:
|
||||
- UIDevice-Utils
|
||||
- PureLayout (3.0.2)
|
||||
- RZDataBinding (2.1.0)
|
||||
- Specta (1.0.6)
|
||||
- Specta (1.0.7)
|
||||
- StrongestPasswordValidator (0.1.2)
|
||||
- UIDevice-Utils (1.0.0)
|
||||
|
||||
@ -71,26 +72,26 @@ EXTERNAL SOURCES:
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
|
||||
Bolts: 8a7995239dbe724f9cba2248b766d48b7ebdd322
|
||||
Bolts: ac6567323eac61e203f6a9763667d0f711be34c8
|
||||
CodFis-Helper: 28be4c74d7202542459d72354f59b1215871de87
|
||||
DDDKeychainWrapper: e681a4daba6448786fa83b4941f58102a33b1897
|
||||
DJLocalization: 0c84029af375647d4104a42ae36be87194c46c47
|
||||
Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5
|
||||
FBSDKCoreKit: c8b8582311ec11b145451d8b9717dc6cc2ae5a76
|
||||
FBSDKLoginKit: f3f03b94c21eb834af243c0a881d48641f47ca60
|
||||
FBSDKShareKit: 320712d8293fde6392872c91eb80ef0da5d73cc3
|
||||
FBSDKCoreKit: 6f139173dc63a1deaff4430a55f2fe5bb222d2af
|
||||
FBSDKLoginKit: 56a057ca6822535ea0faa25f57a7c41edb697fd4
|
||||
FBSDKShareKit: 18a2cd118aef11dd657fe7e8b64bae5c719088b2
|
||||
NSDataAES: 967ea3337476a80e9838a533c25d570a06855ed0
|
||||
NSDate_Utils: c7802a1e0f5ef3acaf39bf55806a1caaa0343d2d
|
||||
NSDate_Utils: c858a89da6e204ecf53aca48dbccb4da4d25bc9e
|
||||
NSString-Helper: 459e1b6a62b3bf7db10f01b0d102548608e945c4
|
||||
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
||||
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
||||
PNObject: 6dcb7b25b6d1ab221b59b7ed4e7c34a6dc50f76e
|
||||
PNObject: 3ad5828da3dae309a09b73da59ae4b56d4b8458e
|
||||
PureLayout: 4d550abe49a94f24c2808b9b95db9131685fe4cd
|
||||
RZDataBinding: 6981e90ddaae2f5e02028323b1043f8c31013109
|
||||
Specta: f506f3a8361de16bc0dcf3b17b75e269072ba465
|
||||
Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66
|
||||
StrongestPasswordValidator: 921e42615bdf353513c6f925bffd4fc29865dbd7
|
||||
UIDevice-Utils: ff37bd042127117572d6ce4c5ff074f4f54ab5ed
|
||||
|
||||
PODFILE CHECKSUM: db08ccdd0a68e33d4a1cceb1843643fbab2f2a8e
|
||||
PODFILE CHECKSUM: fcd5d1cf3426c7c9c5b3e5edcd4b8e5402ee7f2e
|
||||
|
||||
COCOAPODS: 1.3.1
|
||||
|
||||
@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/*!
|
||||
A block that will be called when a token is cancelled.
|
||||
*/
|
||||
typedef void(^BFCancellationBlock)();
|
||||
typedef void(^BFCancellationBlock)(void);
|
||||
|
||||
/*!
|
||||
The consumer view of a CancellationToken.
|
||||
|
||||
4
Example/Pods/Bolts/Bolts/Common/BFExecutor.h
generated
4
Example/Pods/Bolts/Bolts/Common/BFExecutor.h
generated
@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
Returns a new executor that uses the given block to execute continuations.
|
||||
@param block The block to use.
|
||||
*/
|
||||
+ (instancetype)executorWithBlock:(void(^)(void(^block)()))block;
|
||||
+ (instancetype)executorWithBlock:(void(^)(void(^block)(void)))block;
|
||||
|
||||
/*!
|
||||
Returns a new executor that runs continuations on the given queue.
|
||||
@ -55,7 +55,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
Runs the given block using this executor's particular strategy.
|
||||
@param block The block to execute.
|
||||
*/
|
||||
- (void)execute:(void(^)())block;
|
||||
- (void)execute:(void(^)(void))block;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
20
Example/Pods/Bolts/Bolts/Common/BFExecutor.m
generated
20
Example/Pods/Bolts/Bolts/Common/BFExecutor.m
generated
@ -34,12 +34,12 @@ __attribute__((noinline)) static size_t remaining_stack_size(size_t *restrict to
|
||||
// NOTE: If the function is inlined, this value could be incorrect
|
||||
uint8_t *frameAddr = __builtin_frame_address(0);
|
||||
|
||||
return (*totalSize) - (endStack - frameAddr);
|
||||
return (*totalSize) - (size_t)(endStack - frameAddr);
|
||||
}
|
||||
|
||||
@interface BFExecutor ()
|
||||
|
||||
@property (nonatomic, copy) void(^block)(void(^block)());
|
||||
@property (nonatomic, copy) void(^block)(void(^block)(void));
|
||||
|
||||
@end
|
||||
|
||||
@ -51,7 +51,7 @@ __attribute__((noinline)) static size_t remaining_stack_size(size_t *restrict to
|
||||
static BFExecutor *defaultExecutor = NULL;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
defaultExecutor = [self executorWithBlock:^void(void(^block)()) {
|
||||
defaultExecutor = [self executorWithBlock:^void(void(^block)(void)) {
|
||||
// We prefer to run everything possible immediately, so that there is callstack information
|
||||
// when debugging. However, we don't want the stack to get too deep, so if the remaining stack space
|
||||
// is less than 10% of the total space, we dispatch to another GCD queue.
|
||||
@ -74,7 +74,7 @@ __attribute__((noinline)) static size_t remaining_stack_size(size_t *restrict to
|
||||
static BFExecutor *immediateExecutor = NULL;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
immediateExecutor = [self executorWithBlock:^void(void(^block)()) {
|
||||
immediateExecutor = [self executorWithBlock:^void(void(^block)(void)) {
|
||||
block();
|
||||
}];
|
||||
});
|
||||
@ -85,7 +85,7 @@ __attribute__((noinline)) static size_t remaining_stack_size(size_t *restrict to
|
||||
static BFExecutor *mainThreadExecutor = NULL;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
mainThreadExecutor = [self executorWithBlock:^void(void(^block)()) {
|
||||
mainThreadExecutor = [self executorWithBlock:^void(void(^block)(void)) {
|
||||
if (![NSThread isMainThread]) {
|
||||
dispatch_async(dispatch_get_main_queue(), block);
|
||||
} else {
|
||||
@ -98,25 +98,25 @@ __attribute__((noinline)) static size_t remaining_stack_size(size_t *restrict to
|
||||
return mainThreadExecutor;
|
||||
}
|
||||
|
||||
+ (instancetype)executorWithBlock:(void(^)(void(^block)()))block {
|
||||
+ (instancetype)executorWithBlock:(void(^)(void(^block)(void)))block {
|
||||
return [[self alloc] initWithBlock:block];
|
||||
}
|
||||
|
||||
+ (instancetype)executorWithDispatchQueue:(dispatch_queue_t)queue {
|
||||
return [self executorWithBlock:^void(void(^block)()) {
|
||||
return [self executorWithBlock:^void(void(^block)(void)) {
|
||||
dispatch_async(queue, block);
|
||||
}];
|
||||
}
|
||||
|
||||
+ (instancetype)executorWithOperationQueue:(NSOperationQueue *)queue {
|
||||
return [self executorWithBlock:^void(void(^block)()) {
|
||||
return [self executorWithBlock:^void(void(^block)(void)) {
|
||||
[queue addOperation:[NSBlockOperation blockOperationWithBlock:block]];
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Initializer
|
||||
|
||||
- (instancetype)initWithBlock:(void(^)(void(^block)()))block {
|
||||
- (instancetype)initWithBlock:(void(^)(void(^block)(void)))block {
|
||||
self = [super init];
|
||||
if (!self) return self;
|
||||
|
||||
@ -127,7 +127,7 @@ __attribute__((noinline)) static size_t remaining_stack_size(size_t *restrict to
|
||||
|
||||
#pragma mark - Execution
|
||||
|
||||
- (void)execute:(void(^)())block {
|
||||
- (void)execute:(void(^)(void))block {
|
||||
self.block(block);
|
||||
}
|
||||
|
||||
|
||||
25
Example/Pods/Bolts/Bolts/Common/BFGeneric.h
generated
Normal file
25
Example/Pods/Bolts/Bolts/Common/BFGeneric.h
generated
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
This exists to use along with `BFTask` and `BFTaskCompletionSource`.
|
||||
|
||||
Instead of returning a `BFTask` with no generic type, or a generic type of 'NSNull'
|
||||
when there is no usable result from a task, we use the type 'BFVoid', which will always have a value of `nil`.
|
||||
|
||||
This allows you to provide a more enforced API contract to the caller,
|
||||
as sending any message to `BFVoid` will result in a compile time error.
|
||||
*/
|
||||
@class _BFVoid_Nonexistant;
|
||||
typedef _BFVoid_Nonexistant *BFVoid;
|
||||
32
Example/Pods/Bolts/Bolts/Common/BFTask+Exceptions.h
generated
32
Example/Pods/Bolts/Bolts/Common/BFTask+Exceptions.h
generated
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
Returns whether all instances of `BFTask` should automatically @try/@catch exceptions in continuation blocks. Default: `YES`.
|
||||
|
||||
@return Boolean value indicating whether exceptions are being caught.
|
||||
*/
|
||||
extern BOOL BFTaskCatchesExceptions(void)
|
||||
__attribute__((deprecated("This is temporary API and will be removed in a future release.")));
|
||||
|
||||
/**
|
||||
Set whether all instances of `BFTask` should automatically @try/@catch exceptions in continuation blocks. Default: `YES`.
|
||||
|
||||
@param catchExceptions Boolean value indicating whether exceptions shoudl be caught.
|
||||
*/
|
||||
extern void BFTaskSetCatchesExceptions(BOOL catchExceptions)
|
||||
__attribute__((deprecated("This is a temporary API and will be removed in a future release.")));
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
24
Example/Pods/Bolts/Bolts/Common/BFTask+Exceptions.m
generated
24
Example/Pods/Bolts/Bolts/Common/BFTask+Exceptions.m
generated
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import "BFTask+Exceptions.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
static BOOL taskCatchExceptions = YES;
|
||||
|
||||
BOOL BFTaskCatchesExceptions(void) {
|
||||
return taskCatchExceptions;
|
||||
}
|
||||
|
||||
void BFTaskSetCatchesExceptions(BOOL catchExceptions) {
|
||||
taskCatchExceptions = catchExceptions;
|
||||
}
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
83
Example/Pods/Bolts/Bolts/Common/BFTask.h
generated
83
Example/Pods/Bolts/Bolts/Common/BFTask.h
generated
@ -11,6 +11,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <Bolts/BFCancellationToken.h>
|
||||
#import <Bolts/BFGeneric.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@ -24,29 +25,12 @@ extern NSString *const BFTaskErrorDomain;
|
||||
*/
|
||||
extern NSInteger const kBFMultipleErrorsError;
|
||||
|
||||
/*!
|
||||
An exception that is thrown if there was multiple exceptions on <BFTask taskForCompletionOfAllTasks:>.
|
||||
|
||||
@deprecated `BFTask` exception handling is deprecated and will be removed in a future release.
|
||||
*/
|
||||
extern NSString *const BFTaskMultipleExceptionsException
|
||||
__attribute__((deprecated("`BFTask` exception handling is deprecated and will be removed in a future release.")));
|
||||
|
||||
/*!
|
||||
An error userInfo key used if there were multiple errors on <BFTask taskForCompletionOfAllTasks:>.
|
||||
Value type is `NSArray<NSError *> *`.
|
||||
*/
|
||||
extern NSString *const BFTaskMultipleErrorsUserInfoKey;
|
||||
|
||||
/*!
|
||||
An error userInfo key used if there were multiple exceptions on <BFTask taskForCompletionOfAllTasks:>.
|
||||
Value type is `NSArray<NSException *> *`.
|
||||
|
||||
@deprecated `BFTask` exception handling is deprecated and will be removed in a future release.
|
||||
*/
|
||||
extern NSString *const BFTaskMultipleExceptionsUserInfoKey
|
||||
__attribute__((deprecated("`BFTask` exception handling is deprecated and will be removed in a future release.")));
|
||||
|
||||
@class BFExecutor;
|
||||
@class BFTask;
|
||||
|
||||
@ -74,15 +58,6 @@ typedef __nullable id(^BFContinuationBlock)(BFTask<ResultType> *t);
|
||||
*/
|
||||
+ (instancetype)taskWithError:(NSError *)error;
|
||||
|
||||
/*!
|
||||
Creates a task that is already completed with the given exception.
|
||||
@param exception The exception for the task.
|
||||
|
||||
@deprecated `BFTask` exception handling is deprecated and will be removed in a future release.
|
||||
*/
|
||||
+ (instancetype)taskWithException:(NSException *)exception
|
||||
__attribute__((deprecated("`BFTask` exception handling is deprecated and will be removed in a future release.")));
|
||||
|
||||
/*!
|
||||
Creates a task that is already cancelled.
|
||||
*/
|
||||
@ -105,7 +80,7 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
|
||||
|
||||
/*!
|
||||
Returns a task that will be completed once there is at least one successful task.
|
||||
The first task to successuly complete will set the result, all other tasks results are
|
||||
The first task to successuly complete will set the result, all other tasks results are
|
||||
ignored.
|
||||
@param tasks An `NSArray` of the tasks to use as an input.
|
||||
*/
|
||||
@ -116,7 +91,7 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
|
||||
@param millis The approximate number of milliseconds to wait before the
|
||||
task will be finished (with result == nil).
|
||||
*/
|
||||
+ (instancetype)taskWithDelay:(int)millis;
|
||||
+ (BFTask<BFVoid> *)taskWithDelay:(int)millis;
|
||||
|
||||
/*!
|
||||
Returns a task that will be completed a certain amount of time in the future.
|
||||
@ -124,7 +99,7 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
|
||||
task will be finished (with result == nil).
|
||||
@param token The cancellation token (optional).
|
||||
*/
|
||||
+ (instancetype)taskWithDelay:(int)millis cancellationToken:(nullable BFCancellationToken *)token;
|
||||
+ (BFTask<BFVoid> *)taskWithDelay:(int)millis cancellationToken:(nullable BFCancellationToken *)token;
|
||||
|
||||
/*!
|
||||
Returns a task that will be completed after the given block completes with
|
||||
@ -136,7 +111,7 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
|
||||
If block returns a BFTask, then the task returned from
|
||||
this method will not be completed until that task is completed.
|
||||
*/
|
||||
+ (instancetype)taskFromExecutor:(BFExecutor *)executor withBlock:(nullable id (^)())block;
|
||||
+ (instancetype)taskFromExecutor:(BFExecutor *)executor withBlock:(nullable id (^)(void))block;
|
||||
|
||||
// Properties that will be set on the task once it is completed.
|
||||
|
||||
@ -150,21 +125,13 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
|
||||
*/
|
||||
@property (nullable, nonatomic, strong, readonly) NSError *error;
|
||||
|
||||
/*!
|
||||
The exception of a failed task.
|
||||
|
||||
@deprecated `BFTask` exception handling is deprecated and will be removed in a future release.
|
||||
*/
|
||||
@property (nullable, nonatomic, strong, readonly) NSException *exception
|
||||
__attribute__((deprecated("`BFTask` exception handling is deprecated and will be removed in a future release.")));
|
||||
|
||||
/*!
|
||||
Whether this task has been cancelled.
|
||||
*/
|
||||
@property (nonatomic, assign, readonly, getter=isCancelled) BOOL cancelled;
|
||||
|
||||
/*!
|
||||
Whether this task has completed due to an error or exception.
|
||||
Whether this task has completed due to an error.
|
||||
*/
|
||||
@property (nonatomic, assign, readonly, getter=isFaulted) BOOL faulted;
|
||||
|
||||
@ -184,7 +151,7 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
|
||||
If block returns a BFTask, then the task returned from
|
||||
this method will not be completed until that task is completed.
|
||||
*/
|
||||
- (BFTask *)continueWithBlock:(BFContinuationBlock)block;
|
||||
- (BFTask *)continueWithBlock:(BFContinuationBlock)block NS_SWIFT_NAME(continueWith(block:));
|
||||
|
||||
/*!
|
||||
Enqueues the given block to be run once this task is complete.
|
||||
@ -198,7 +165,8 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
|
||||
If block returns a BFTask, then the task returned from
|
||||
this method will not be completed until that task is completed.
|
||||
*/
|
||||
- (BFTask *)continueWithBlock:(BFContinuationBlock)block cancellationToken:(nullable BFCancellationToken *)cancellationToken;
|
||||
- (BFTask *)continueWithBlock:(BFContinuationBlock)block
|
||||
cancellationToken:(nullable BFCancellationToken *)cancellationToken NS_SWIFT_NAME(continueWith(block:cancellationToken:));
|
||||
|
||||
/*!
|
||||
Enqueues the given block to be run once this task is complete.
|
||||
@ -209,7 +177,9 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
|
||||
If block returns a BFTask, then the task returned from
|
||||
this method will not be completed until that task is completed.
|
||||
*/
|
||||
- (BFTask *)continueWithExecutor:(BFExecutor *)executor withBlock:(BFContinuationBlock)block;
|
||||
- (BFTask *)continueWithExecutor:(BFExecutor *)executor
|
||||
withBlock:(BFContinuationBlock)block NS_SWIFT_NAME(continueWith(executor:block:));
|
||||
|
||||
/*!
|
||||
Enqueues the given block to be run once this task is complete.
|
||||
@param executor A BFExecutor responsible for determining how the
|
||||
@ -222,11 +192,12 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
|
||||
*/
|
||||
- (BFTask *)continueWithExecutor:(BFExecutor *)executor
|
||||
block:(BFContinuationBlock)block
|
||||
cancellationToken:(nullable BFCancellationToken *)cancellationToken;
|
||||
cancellationToken:(nullable BFCancellationToken *)cancellationToken
|
||||
NS_SWIFT_NAME(continueWith(executor:block:cancellationToken:));
|
||||
|
||||
/*!
|
||||
Identical to continueWithBlock:, except that the block is only run
|
||||
if this task did not produce a cancellation, error, or exception.
|
||||
if this task did not produce a cancellation or an error.
|
||||
If it did, then the failure will be propagated to the returned
|
||||
task.
|
||||
@param block The block to be run once this task is complete.
|
||||
@ -234,11 +205,11 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
|
||||
If block returns a BFTask, then the task returned from
|
||||
this method will not be completed until that task is completed.
|
||||
*/
|
||||
- (BFTask *)continueWithSuccessBlock:(BFContinuationBlock)block;
|
||||
- (BFTask *)continueWithSuccessBlock:(BFContinuationBlock)block NS_SWIFT_NAME(continueOnSuccessWith(block:));
|
||||
|
||||
/*!
|
||||
Identical to continueWithBlock:, except that the block is only run
|
||||
if this task did not produce a cancellation, error, or exception.
|
||||
if this task did not produce a cancellation or an error.
|
||||
If it did, then the failure will be propagated to the returned
|
||||
task.
|
||||
@param block The block to be run once this task is complete.
|
||||
@ -247,13 +218,14 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
|
||||
If block returns a BFTask, then the task returned from
|
||||
this method will not be completed until that task is completed.
|
||||
*/
|
||||
- (BFTask *)continueWithSuccessBlock:(BFContinuationBlock)block cancellationToken:(nullable BFCancellationToken *)cancellationToken;
|
||||
- (BFTask *)continueWithSuccessBlock:(BFContinuationBlock)block
|
||||
cancellationToken:(nullable BFCancellationToken *)cancellationToken
|
||||
NS_SWIFT_NAME(continueOnSuccessWith(block:cancellationToken:));
|
||||
|
||||
/*!
|
||||
Identical to continueWithExecutor:withBlock:, except that the block
|
||||
is only run if this task did not produce a cancellation, error, or
|
||||
exception. If it did, then the failure will be propagated to the
|
||||
returned task.
|
||||
is only run if this task did not produce a cancellation, error, or an error.
|
||||
If it did, then the failure will be propagated to the returned task.
|
||||
@param executor A BFExecutor responsible for determining how the
|
||||
continuation block will be run.
|
||||
@param block The block to be run once this task is complete.
|
||||
@ -261,13 +233,13 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
|
||||
If block returns a BFTask, then the task returned from
|
||||
this method will not be completed until that task is completed.
|
||||
*/
|
||||
- (BFTask *)continueWithExecutor:(BFExecutor *)executor withSuccessBlock:(BFContinuationBlock)block;
|
||||
- (BFTask *)continueWithExecutor:(BFExecutor *)executor
|
||||
withSuccessBlock:(BFContinuationBlock)block NS_SWIFT_NAME(continueOnSuccessWith(executor:block:));
|
||||
|
||||
/*!
|
||||
Identical to continueWithExecutor:withBlock:, except that the block
|
||||
is only run if this task did not produce a cancellation, error, or
|
||||
exception. If it did, then the failure will be propagated to the
|
||||
returned task.
|
||||
is only run if this task did not produce a cancellation or an error.
|
||||
If it did, then the failure will be propagated to the returned task.
|
||||
@param executor A BFExecutor responsible for determining how the
|
||||
continuation block will be run.
|
||||
@param block The block to be run once this task is complete.
|
||||
@ -278,7 +250,8 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
|
||||
*/
|
||||
- (BFTask *)continueWithExecutor:(BFExecutor *)executor
|
||||
successBlock:(BFContinuationBlock)block
|
||||
cancellationToken:(nullable BFCancellationToken *)cancellationToken;
|
||||
cancellationToken:(nullable BFCancellationToken *)cancellationToken
|
||||
NS_SWIFT_NAME(continueOnSuccessWith(executor:block:cancellationToken:));
|
||||
|
||||
/*!
|
||||
Waits until this operation is completed.
|
||||
|
||||
118
Example/Pods/Bolts/Bolts/Common/BFTask.m
generated
118
Example/Pods/Bolts/Bolts/Common/BFTask.m
generated
@ -13,7 +13,6 @@
|
||||
#import <libkern/OSAtomic.h>
|
||||
|
||||
#import "Bolts.h"
|
||||
#import "BFTask+Exceptions.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@ -24,15 +23,12 @@ __attribute__ ((noinline)) void warnBlockingOperationOnMainThread() {
|
||||
|
||||
NSString *const BFTaskErrorDomain = @"bolts";
|
||||
NSInteger const kBFMultipleErrorsError = 80175001;
|
||||
NSString *const BFTaskMultipleExceptionsException = @"BFMultipleExceptionsException";
|
||||
|
||||
NSString *const BFTaskMultipleErrorsUserInfoKey = @"errors";
|
||||
NSString *const BFTaskMultipleExceptionsUserInfoKey = @"exceptions";
|
||||
|
||||
@interface BFTask () {
|
||||
id _result;
|
||||
NSError *_error;
|
||||
NSException *_exception;
|
||||
}
|
||||
|
||||
@property (nonatomic, assign, readwrite, getter=isCancelled) BOOL cancelled;
|
||||
@ -60,7 +56,7 @@ NSString *const BFTaskMultipleExceptionsUserInfoKey = @"exceptions";
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithResult:(id)result {
|
||||
- (instancetype)initWithResult:(nullable id)result {
|
||||
self = [super init];
|
||||
if (!self) return self;
|
||||
|
||||
@ -78,15 +74,6 @@ NSString *const BFTaskMultipleExceptionsUserInfoKey = @"exceptions";
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithException:(NSException *)exception {
|
||||
self = [super init];
|
||||
if (!self) return self;
|
||||
|
||||
[self trySetException:exception];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initCancelled {
|
||||
self = [super init];
|
||||
if (!self) return self;
|
||||
@ -106,10 +93,6 @@ NSString *const BFTaskMultipleExceptionsUserInfoKey = @"exceptions";
|
||||
return [[self alloc] initWithError:error];
|
||||
}
|
||||
|
||||
+ (instancetype)taskWithException:(NSException *)exception {
|
||||
return [[self alloc] initWithException:exception];
|
||||
}
|
||||
|
||||
+ (instancetype)cancelledTask {
|
||||
return [[self alloc] initCancelled];
|
||||
}
|
||||
@ -123,19 +106,11 @@ NSString *const BFTaskMultipleExceptionsUserInfoKey = @"exceptions";
|
||||
__block int32_t cancelled = 0;
|
||||
NSObject *lock = [[NSObject alloc] init];
|
||||
NSMutableArray *errors = [NSMutableArray array];
|
||||
NSMutableArray *exceptions = [NSMutableArray array];
|
||||
|
||||
BFTaskCompletionSource *tcs = [BFTaskCompletionSource taskCompletionSource];
|
||||
for (BFTask *task in tasks) {
|
||||
[task continueWithBlock:^id(BFTask *t) {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
if (t.exception) {
|
||||
@synchronized (lock) {
|
||||
[exceptions addObject:t.exception];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
} else if (t.error) {
|
||||
if (t.error) {
|
||||
@synchronized (lock) {
|
||||
[errors addObject:t.error];
|
||||
}
|
||||
@ -144,19 +119,7 @@ NSString *const BFTaskMultipleExceptionsUserInfoKey = @"exceptions";
|
||||
}
|
||||
|
||||
if (OSAtomicDecrement32Barrier(&total) == 0) {
|
||||
if (exceptions.count > 0) {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
if (exceptions.count == 1) {
|
||||
tcs.exception = [exceptions firstObject];
|
||||
} else {
|
||||
NSException *exception = [NSException exceptionWithName:BFTaskMultipleExceptionsException
|
||||
reason:@"There were multiple exceptions."
|
||||
userInfo:@{ BFTaskMultipleExceptionsUserInfoKey: exceptions }];
|
||||
tcs.exception = exception;
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
} else if (errors.count > 0) {
|
||||
if (errors.count > 0) {
|
||||
if (errors.count == 1) {
|
||||
tcs.error = [errors firstObject];
|
||||
} else {
|
||||
@ -178,7 +141,7 @@ NSString *const BFTaskMultipleExceptionsUserInfoKey = @"exceptions";
|
||||
}
|
||||
|
||||
+ (instancetype)taskForCompletionOfAllTasksWithResults:(nullable NSArray<BFTask *> *)tasks {
|
||||
return [[self taskForCompletionOfAllTasks:tasks] continueWithSuccessBlock:^id(BFTask *task) {
|
||||
return [[self taskForCompletionOfAllTasks:tasks] continueWithSuccessBlock:^id(BFTask * __unused task) {
|
||||
return [tasks valueForKey:@"result"];
|
||||
}];
|
||||
}
|
||||
@ -195,19 +158,11 @@ NSString *const BFTaskMultipleExceptionsUserInfoKey = @"exceptions";
|
||||
|
||||
NSObject *lock = [NSObject new];
|
||||
NSMutableArray<NSError *> *errors = [NSMutableArray new];
|
||||
NSMutableArray<NSException *> *exceptions = [NSMutableArray new];
|
||||
|
||||
BFTaskCompletionSource *source = [BFTaskCompletionSource taskCompletionSource];
|
||||
for (BFTask *task in tasks) {
|
||||
[task continueWithBlock:^id(BFTask *t) {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
if (t.exception != nil) {
|
||||
@synchronized(lock) {
|
||||
[exceptions addObject:t.exception];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
} else if (t.error != nil) {
|
||||
if (t.error != nil) {
|
||||
@synchronized(lock) {
|
||||
[errors addObject:t.error];
|
||||
}
|
||||
@ -223,18 +178,6 @@ NSString *const BFTaskMultipleExceptionsUserInfoKey = @"exceptions";
|
||||
OSAtomicCompareAndSwap32Barrier(0, 1, &completed)) {
|
||||
if (cancelled > 0) {
|
||||
[source cancel];
|
||||
} else if (exceptions.count > 0) {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
if (exceptions.count == 1) {
|
||||
source.exception = exceptions.firstObject;
|
||||
} else {
|
||||
NSException *exception = [NSException exceptionWithName:BFTaskMultipleExceptionsException
|
||||
reason:@"There were multiple exceptions."
|
||||
userInfo:@{ BFTaskMultipleExceptionsUserInfoKey: exceptions }];
|
||||
source.exception = exception;
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
} else if (errors.count > 0) {
|
||||
if (errors.count == 1) {
|
||||
source.error = errors.firstObject;
|
||||
@ -254,7 +197,7 @@ NSString *const BFTaskMultipleExceptionsUserInfoKey = @"exceptions";
|
||||
}
|
||||
|
||||
|
||||
+ (instancetype)taskWithDelay:(int)millis {
|
||||
+ (BFTask<BFVoid> *)taskWithDelay:(int)millis {
|
||||
BFTaskCompletionSource *tcs = [BFTaskCompletionSource taskCompletionSource];
|
||||
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, millis * NSEC_PER_MSEC);
|
||||
dispatch_after(popTime, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){
|
||||
@ -263,7 +206,7 @@ NSString *const BFTaskMultipleExceptionsUserInfoKey = @"exceptions";
|
||||
return tcs.task;
|
||||
}
|
||||
|
||||
+ (instancetype)taskWithDelay:(int)millis cancellationToken:(nullable BFCancellationToken *)token {
|
||||
+ (BFTask<BFVoid> *)taskWithDelay:(int)millis cancellationToken:(nullable BFCancellationToken *)token {
|
||||
if (token.cancellationRequested) {
|
||||
return [BFTask cancelledTask];
|
||||
}
|
||||
@ -280,7 +223,7 @@ NSString *const BFTaskMultipleExceptionsUserInfoKey = @"exceptions";
|
||||
return tcs.task;
|
||||
}
|
||||
|
||||
+ (instancetype)taskFromExecutor:(BFExecutor *)executor withBlock:(nullable id (^)())block {
|
||||
+ (instancetype)taskFromExecutor:(BFExecutor *)executor withBlock:(nullable id (^)(void))block {
|
||||
return [[self taskWithResult:nil] continueWithExecutor:executor withBlock:^id(BFTask *task) {
|
||||
return block();
|
||||
}];
|
||||
@ -325,25 +268,6 @@ NSString *const BFTaskMultipleExceptionsUserInfoKey = @"exceptions";
|
||||
}
|
||||
}
|
||||
|
||||
- (nullable NSException *)exception {
|
||||
@synchronized(self.lock) {
|
||||
return _exception;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)trySetException:(NSException *)exception {
|
||||
@synchronized(self.lock) {
|
||||
if (self.completed) {
|
||||
return NO;
|
||||
}
|
||||
self.completed = YES;
|
||||
self.faulted = YES;
|
||||
_exception = exception;
|
||||
[self runContinuations];
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)isCancelled {
|
||||
@synchronized(self.lock) {
|
||||
return _cancelled;
|
||||
@ -379,7 +303,7 @@ NSString *const BFTaskMultipleExceptionsUserInfoKey = @"exceptions";
|
||||
[self.condition lock];
|
||||
[self.condition broadcast];
|
||||
[self.condition unlock];
|
||||
for (void (^callback)() in self.callbacks) {
|
||||
for (void (^callback)(void) in self.callbacks) {
|
||||
callback();
|
||||
}
|
||||
[self.callbacks removeAllObjects];
|
||||
@ -404,34 +328,12 @@ NSString *const BFTaskMultipleExceptionsUserInfoKey = @"exceptions";
|
||||
return;
|
||||
}
|
||||
|
||||
id result = nil;
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
if (BFTaskCatchesExceptions()) {
|
||||
@try {
|
||||
result = block(self);
|
||||
} @catch (NSException *exception) {
|
||||
NSLog(@"[Bolts] Warning: `BFTask` caught an exception in the continuation block."
|
||||
@" This behavior is discouraged and will be removed in a future release."
|
||||
@" Caught Exception: %@", exception);
|
||||
tcs.exception = exception;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
result = block(self);
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
id result = block(self);
|
||||
if ([result isKindOfClass:[BFTask class]]) {
|
||||
|
||||
id (^setupWithTask) (BFTask *) = ^id(BFTask *task) {
|
||||
if (cancellationToken.cancellationRequested || task.cancelled) {
|
||||
[tcs cancel];
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
} else if (task.exception) {
|
||||
tcs.exception = task.exception;
|
||||
#pragma clang diagnostic pop
|
||||
} else if (task.error) {
|
||||
tcs.error = task.error;
|
||||
} else {
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class BFTask<ResultType>;
|
||||
@class BFTask<__covariant ResultType>;
|
||||
|
||||
/*!
|
||||
A BFTaskCompletionSource represents the producer side of tasks.
|
||||
@ -36,24 +36,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
Attempting to set this for a completed task will raise an exception.
|
||||
@param result The result of the task.
|
||||
*/
|
||||
- (void)setResult:(nullable ResultType)result;
|
||||
- (void)setResult:(nullable ResultType)result NS_SWIFT_NAME(set(result:));
|
||||
|
||||
/*!
|
||||
Completes the task by setting the error.
|
||||
Attempting to set this for a completed task will raise an exception.
|
||||
@param error The error for the task.
|
||||
*/
|
||||
- (void)setError:(NSError *)error;
|
||||
|
||||
/*!
|
||||
Completes the task by setting an exception.
|
||||
Attempting to set this for a completed task will raise an exception.
|
||||
@param exception The exception for the task.
|
||||
|
||||
@deprecated `BFTask` exception handling is deprecated and will be removed in a future release.
|
||||
*/
|
||||
- (void)setException:(NSException *)exception
|
||||
__attribute__((deprecated("`BFTask` exception handling is deprecated and will be removed in a future release.")));
|
||||
- (void)setError:(NSError *)error NS_SWIFT_NAME(set(error:));
|
||||
|
||||
/*!
|
||||
Completes the task by marking it as cancelled.
|
||||
@ -65,24 +55,14 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
|
||||
Sets the result of the task if it wasn't already completed.
|
||||
@returns whether the new value was set.
|
||||
*/
|
||||
- (BOOL)trySetResult:(nullable ResultType)result;
|
||||
- (BOOL)trySetResult:(nullable ResultType)result NS_SWIFT_NAME(trySet(result:));
|
||||
|
||||
/*!
|
||||
Sets the error of the task if it wasn't already completed.
|
||||
@param error The error for the task.
|
||||
@returns whether the new value was set.
|
||||
*/
|
||||
- (BOOL)trySetError:(NSError *)error;
|
||||
|
||||
/*!
|
||||
Sets the exception of the task if it wasn't already completed.
|
||||
@param exception The exception for the task.
|
||||
@returns whether the new value was set.
|
||||
|
||||
@deprecated `BFTask` exception handling is deprecated and will be removed in a future release.
|
||||
*/
|
||||
- (BOOL)trySetException:(NSException *)exception
|
||||
__attribute__((deprecated("`BFTask` exception handling is deprecated and will be removed in a future release.")));
|
||||
- (BOOL)trySetError:(NSError *)error NS_SWIFT_NAME(trySet(error:));
|
||||
|
||||
/*!
|
||||
Sets the cancellation state of the task if it wasn't already completed.
|
||||
|
||||
@ -18,7 +18,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (BOOL)trySetResult:(nullable id)result;
|
||||
- (BOOL)trySetError:(NSError *)error;
|
||||
- (BOOL)trySetException:(NSException *)exception;
|
||||
- (BOOL)trySetCancelled;
|
||||
|
||||
@end
|
||||
@ -56,13 +55,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setException:(NSException *)exception {
|
||||
if (![self.task trySetException:exception]) {
|
||||
[NSException raise:NSInternalInconsistencyException
|
||||
format:@"Cannot set the exception on a completed task."];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)cancel {
|
||||
if (![self.task trySetCancelled]) {
|
||||
[NSException raise:NSInternalInconsistencyException
|
||||
@ -78,10 +70,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
return [self.task trySetError:error];
|
||||
}
|
||||
|
||||
- (BOOL)trySetException:(NSException *)exception {
|
||||
return [self.task trySetException:exception];
|
||||
}
|
||||
|
||||
- (BOOL)trySetCancelled {
|
||||
return [self.task trySetCancelled];
|
||||
}
|
||||
|
||||
2
Example/Pods/Bolts/Bolts/Common/Bolts.h
generated
2
Example/Pods/Bolts/Bolts/Common/Bolts.h
generated
@ -12,8 +12,8 @@
|
||||
#import <Bolts/BFCancellationTokenRegistration.h>
|
||||
#import <Bolts/BFCancellationTokenSource.h>
|
||||
#import <Bolts/BFExecutor.h>
|
||||
#import <Bolts/BFGeneric.h>
|
||||
#import <Bolts/BFTask.h>
|
||||
#import <Bolts/BFTask+Exceptions.h>
|
||||
#import <Bolts/BFTaskCompletionSource.h>
|
||||
|
||||
#if __has_include(<Bolts/BFAppLink.h>) && TARGET_OS_IPHONE && !TARGET_OS_WATCH && !TARGET_OS_TV
|
||||
|
||||
2
Example/Pods/Bolts/Bolts/Common/Bolts.m
generated
2
Example/Pods/Bolts/Bolts/Common/Bolts.m
generated
@ -12,6 +12,6 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
NSString *const BoltsFrameworkVersionString = @"1.8.4";
|
||||
NSString *const BoltsFrameworkVersionString = @"1.9.0";
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@ -33,6 +33,7 @@ typedef NS_ENUM(NSInteger, BFAppLinkNavigationType) {
|
||||
custom requests with additional navigation and app data attached to them by
|
||||
creating BFAppLinkNavigations themselves.
|
||||
*/
|
||||
NS_EXTENSION_UNAVAILABLE_IOS("Not available in app extension")
|
||||
@interface BFAppLinkNavigation : NSObject
|
||||
|
||||
/*!
|
||||
|
||||
@ -25,6 +25,6 @@
|
||||
@param url The URL to resolve into an App Link.
|
||||
@returns A BFTask that will return a BFAppLink for the given URL.
|
||||
*/
|
||||
- (BFTask *)appLinkFromURLInBackground:(NSURL *)url;
|
||||
- (BFTask *)appLinkFromURLInBackground:(NSURL *)url NS_EXTENSION_UNAVAILABLE_IOS("Not available in app extension");
|
||||
|
||||
@end
|
||||
|
||||
@ -40,6 +40,7 @@
|
||||
A controller class that implements default behavior for a BFAppLinkReturnToRefererView, including
|
||||
the ability to display the view above the navigation bar for navigation-based apps.
|
||||
*/
|
||||
NS_EXTENSION_UNAVAILABLE_IOS("Not available in app extension")
|
||||
@interface BFAppLinkReturnToRefererController : NSObject <BFAppLinkReturnToRefererViewDelegate>
|
||||
|
||||
/*!
|
||||
|
||||
@ -48,6 +48,7 @@ typedef NS_ENUM(NSUInteger, BFIncludeStatusBarInSize) {
|
||||
rather than navigating away. If the view is provided an App Link that does not contain
|
||||
referer data, it will have zero size and no UI will be displayed.
|
||||
*/
|
||||
NS_EXTENSION_UNAVAILABLE_IOS("Not available in app extension")
|
||||
@interface BFAppLinkReturnToRefererView : UIView
|
||||
|
||||
/*!
|
||||
|
||||
@ -143,7 +143,7 @@ static NSString *const BFWebViewAppLinkResolverShouldFallbackKey = @"should_fall
|
||||
}];
|
||||
}
|
||||
|
||||
- (BFTask *)appLinkFromURLInBackground:(NSURL *)url {
|
||||
- (BFTask *)appLinkFromURLInBackground:(NSURL *)url NS_EXTENSION_UNAVAILABLE_IOS("") {
|
||||
return [[self followRedirects:url] continueWithExecutor:[BFExecutor mainThreadExecutor]
|
||||
withSuccessBlock:^id(BFTask *task) {
|
||||
NSData *responseData = task.result[@"data"];
|
||||
@ -200,7 +200,7 @@ static NSString *const BFWebViewAppLinkResolverShouldFallbackKey = @"should_fall
|
||||
continue;
|
||||
}
|
||||
NSMutableDictionary *root = al;
|
||||
for (int i = 1; i < nameComponents.count; i++) {
|
||||
for (NSUInteger i = 1; i < nameComponents.count; i++) {
|
||||
NSMutableArray *children = root[nameComponents[i]];
|
||||
if (!children) {
|
||||
children = [NSMutableArray array];
|
||||
@ -237,26 +237,17 @@ static NSString *const BFWebViewAppLinkResolverShouldFallbackKey = @"should_fall
|
||||
NSMutableArray *linkTargets = [NSMutableArray array];
|
||||
|
||||
NSArray *platformData = nil;
|
||||
switch (UI_USER_INTERFACE_IDIOM()) {
|
||||
case UIUserInterfaceIdiomPad:
|
||||
platformData = @[ appLinkDict[BFWebViewAppLinkResolverIPadKey] ?: @{},
|
||||
appLinkDict[BFWebViewAppLinkResolverIOSKey] ?: @{} ];
|
||||
break;
|
||||
case UIUserInterfaceIdiomPhone:
|
||||
platformData = @[ appLinkDict[BFWebViewAppLinkResolverIPhoneKey] ?: @{},
|
||||
appLinkDict[BFWebViewAppLinkResolverIOSKey] ?: @{} ];
|
||||
break;
|
||||
#ifdef __TVOS_9_0
|
||||
case UIUserInterfaceIdiomTV:
|
||||
#endif
|
||||
#ifdef __IPHONE_9_3
|
||||
case UIUserInterfaceIdiomCarPlay:
|
||||
#endif
|
||||
case UIUserInterfaceIdiomUnspecified:
|
||||
default:
|
||||
// Future-proofing. Other User Interface idioms should only hit ios.
|
||||
platformData = @[ appLinkDict[BFWebViewAppLinkResolverIOSKey] ?: @{} ];
|
||||
break;
|
||||
|
||||
const UIUserInterfaceIdiom idiom = UI_USER_INTERFACE_IDIOM();
|
||||
if (idiom == UIUserInterfaceIdiomPad) {
|
||||
platformData = @[ appLinkDict[BFWebViewAppLinkResolverIPadKey] ?: @{},
|
||||
appLinkDict[BFWebViewAppLinkResolverIOSKey] ?: @{} ];
|
||||
} else if (idiom == UIUserInterfaceIdiomPhone) {
|
||||
platformData = @[ appLinkDict[BFWebViewAppLinkResolverIPhoneKey] ?: @{},
|
||||
appLinkDict[BFWebViewAppLinkResolverIOSKey] ?: @{} ];
|
||||
} else {
|
||||
// Future-proofing. Other User Interface idioms should only hit ios.
|
||||
platformData = @[ appLinkDict[BFWebViewAppLinkResolverIOSKey] ?: @{} ];
|
||||
}
|
||||
|
||||
for (NSArray *platformObjects in platformData) {
|
||||
|
||||
@ -97,6 +97,14 @@ FBSDK_EXTERN NSString *const FBSDKAppEventNameViewedContent;
|
||||
of methods on `FBSDKAppEvents`. Common event names are provided in the `FBAppEventName*` constants.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Parameter key used to specify data for the one or more pieces of content being logged about.
|
||||
* Data should be a JSON encoded string.
|
||||
* Example:
|
||||
* "[{\"id\": \"1234\", \"quantity\": 2, \"item_price\": 5.99}, {\"id\": \"5678\", \"quantity\": 1, \"item_price\": 9.99}]"
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameContent;
|
||||
|
||||
/** Parameter key used to specify an ID for the specific piece of content being logged about. Could be an EAN, article identifier, etc., depending on the nature of the app. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameContentID;
|
||||
|
||||
|
||||
@ -67,6 +67,7 @@ NSString *const FBSDKAppEventNameSpentCredits = @"fb_mobile_spent_cre
|
||||
NSString *const FBSDKAppEventParameterNameCurrency = @"fb_currency";
|
||||
NSString *const FBSDKAppEventParameterNameRegistrationMethod = @"fb_registration_method";
|
||||
NSString *const FBSDKAppEventParameterNameContentType = @"fb_content_type";
|
||||
NSString *const FBSDKAppEventParameterNameContent = @"fb_content";
|
||||
NSString *const FBSDKAppEventParameterNameContentID = @"fb_content_id";
|
||||
NSString *const FBSDKAppEventParameterNameSearchString = @"fb_search_string";
|
||||
NSString *const FBSDKAppEventParameterNameSuccess = @"fb_success";
|
||||
@ -153,6 +154,8 @@ NSString *const FBSDKAppEventParameterDialogOutcome = @"fb_dialog_
|
||||
NSString *const FBSDKAppEventParameterDialogErrorMessage = @"fb_dialog_outcome_error_message";
|
||||
NSString *const FBSDKAppEventParameterDialogMode = @"fb_dialog_mode";
|
||||
NSString *const FBSDKAppEventParameterDialogShareContentType = @"fb_dialog_share_content_type";
|
||||
NSString *const FBSDKAppEventParameterDialogShareContentUUID = @"fb_dialog_share_content_uuid";
|
||||
NSString *const FBSDKAppEventParameterDialogShareContentPageID = @"fb_dialog_share_content_page_id";
|
||||
NSString *const FBSDKAppEventParameterShareTrayActivityName = @"fb_share_tray_activity";
|
||||
NSString *const FBSDKAppEventParameterShareTrayResult = @"fb_share_tray_result";
|
||||
NSString *const FBSDKAppEventParameterLogTime = @"_logTime";
|
||||
@ -173,11 +176,15 @@ NSString *const FBSDKAppEventsDialogShareModeFeedBrowser = @"FeedBrowser";
|
||||
NSString *const FBSDKAppEventsDialogShareModeFeedWeb = @"FeedWeb";
|
||||
NSString *const FBSDKAppEventsDialogShareModeUnknown = @"Unknown";
|
||||
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeOpenGraph = @"OpenGraph";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeStatus = @"Status";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypePhoto = @"Photo";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeVideo = @"Video";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeUnknown = @"Unknown";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeOpenGraph = @"OpenGraph";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeStatus = @"Status";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypePhoto = @"Photo";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeVideo = @"Video";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeCamera = @"Camera";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeMessengerGenericTemplate = @"GenericTemplate";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeMessengerMediaTemplate = @"MediaTemplate";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeMessengerOpenGraphMusicTemplate = @"OpenGraphMusicTemplate";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeUnknown = @"Unknown";
|
||||
|
||||
NSString *const FBSDKAppEventsLoggingResultNotification = @"com.facebook.sdk:FBSDKAppEventsLoggingResultNotification";
|
||||
|
||||
@ -328,7 +335,7 @@ static NSString *g_overrideAppID = nil;
|
||||
[[FBSDKAppEvents singleton] instanceLogEvent:eventName
|
||||
valueToSum:valueToSum
|
||||
parameters:parameters
|
||||
isImplicitlyLogged:NO
|
||||
isImplicitlyLogged:(BOOL)parameters[FBSDKAppEventParameterImplicitlyLogged]
|
||||
accessToken:accessToken];
|
||||
}
|
||||
|
||||
@ -685,7 +692,6 @@ static NSString *g_overrideAppID = nil;
|
||||
if (isImplicitlyLogged) {
|
||||
eventDictionary[FBSDKAppEventParameterImplicitlyLogged] = @"1";
|
||||
}
|
||||
[FBSDKInternalUtility dictionary:eventDictionary setObject:_userID forKey:@"_app_user_id"];
|
||||
|
||||
NSString *currentViewControllerName;
|
||||
if ([NSThread isMainThread]) {
|
||||
@ -783,6 +789,7 @@ static NSString *g_overrideAppID = nil;
|
||||
[FBSDKAppEventsUtility ensureOnMainThread:NSStringFromSelector(_cmd) className:NSStringFromClass([self class])];
|
||||
|
||||
[self fetchServerConfiguration:^(void) {
|
||||
NSString *receipt_data = [appEventsState extractReceiptData];
|
||||
NSString *JSONString = [appEventsState JSONStringForEvents:_serverConfiguration.implicitLoggingEnabled];
|
||||
NSData *encodedEvents = [JSONString dataUsingEncoding:NSUTF8StringEncoding];
|
||||
if (!encodedEvents) {
|
||||
@ -794,6 +801,11 @@ static NSString *g_overrideAppID = nil;
|
||||
activityParametersDictionaryForEvent:@"CUSTOM_APP_EVENTS"
|
||||
implicitEventsOnly:appEventsState.areAllEventsImplicit
|
||||
shouldAccessAdvertisingID:_serverConfiguration.advertisingIDEnabled];
|
||||
NSInteger length = [receipt_data length];
|
||||
if (length > 0) {
|
||||
postParameters[@"receipt_data"] = receipt_data;
|
||||
}
|
||||
|
||||
postParameters[@"custom_events_file"] = encodedEvents;
|
||||
if (appEventsState.numSkipped > 0) {
|
||||
postParameters[@"num_skipped_events"] = [NSString stringWithFormat:@"%lu", (unsigned long)appEventsState.numSkipped];
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#import <Bolts/BFTask.h>
|
||||
#import <Bolts/BFTaskCompletionSource.h>
|
||||
|
||||
#import "FBSDKAccessToken.h"
|
||||
#import "FBSDKGraphRequest+Internal.h"
|
||||
#import "FBSDKGraphRequestConnection.h"
|
||||
#import "FBSDKInternalUtility.h"
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
- Parameter annotation: The annotation as passed to [UIApplicationDelegate application:openURL:sourceApplication:annotation:].
|
||||
|
||||
- Returns: YES if the url was intended for the Facebook SDK, NO if not.
|
||||
*/
|
||||
*/
|
||||
- (BOOL)application:(UIApplication *)application
|
||||
openURL:(NSURL *)url
|
||||
sourceApplication:(NSString *)sourceApplication
|
||||
|
||||
@ -172,6 +172,12 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
completion:completePendingOpenURLBlock];
|
||||
_safariViewController = nil;
|
||||
} else {
|
||||
#ifdef __IPHONE_11_0
|
||||
if (_authenticationSession != nil) {
|
||||
[_authenticationSession cancel];
|
||||
_authenticationSession = nil;
|
||||
}
|
||||
#endif
|
||||
completePendingOpenURLBlock();
|
||||
}
|
||||
if ([pendingURLOpen canOpenURL:url
|
||||
@ -196,6 +202,7 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
// fetch app settings
|
||||
[FBSDKServerConfigurationManager loadServerConfigurationWithCompletionBlock:NULL];
|
||||
|
||||
[self _logSDKInitialize];
|
||||
#if !TARGET_OS_TV
|
||||
FBSDKProfile *cachedProfile = [FBSDKProfile fetchCachedProfile];
|
||||
[FBSDKProfile setCurrentProfile:cachedProfile];
|
||||
@ -234,7 +241,13 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
// _expectingBackground can be YES if the caller started doing work (like login)
|
||||
// within the app delegate's lifecycle like openURL, in which case there
|
||||
// might have been a "didBecomeActive" event pending that we want to ignore.
|
||||
if (!_expectingBackground && !_safariViewController && !_isDismissingSafariViewController) {
|
||||
BOOL notExpectingBackground = !_expectingBackground && !_safariViewController && !_isDismissingSafariViewController;
|
||||
#if !TARGET_OS_TV
|
||||
#ifdef __IPHONE_11_0
|
||||
notExpectingBackground = notExpectingBackground && !_authenticationSession;
|
||||
#endif
|
||||
#endif
|
||||
if (notExpectingBackground) {
|
||||
_active = YES;
|
||||
#if !TARGET_OS_TV
|
||||
[_pendingURLOpen applicationDidBecomeActive:[notification object]];
|
||||
@ -474,6 +487,31 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
accessToken:nil];
|
||||
}
|
||||
|
||||
- (void)_logSDKInitialize
|
||||
{
|
||||
NSMutableDictionary *params = [NSMutableDictionary new];
|
||||
[params setObject:@1 forKey:@"core_lib_included"];
|
||||
if (objc_lookUpClass("FBSDKShareDialog") != nil) {
|
||||
[params setObject:@1 forKey:@"share_lib_included"];
|
||||
}
|
||||
if (objc_lookUpClass("FBSDKLoginManager") != nil) {
|
||||
[params setObject:@1 forKey:@"login_lib_included"];
|
||||
}
|
||||
if (objc_lookUpClass("FBSDKPlacesManager") != nil) {
|
||||
[params setObject:@1 forKey:@"places_lib_included"];
|
||||
}
|
||||
if (objc_lookUpClass("FBSDKMessengerButton") != nil) {
|
||||
[params setObject:@1 forKey:@"messenger_lib_included"];
|
||||
}
|
||||
if (objc_lookUpClass("FBSDKMessengerButton") != nil) {
|
||||
[params setObject:@1 forKey:@"messenger_lib_included"];
|
||||
}
|
||||
if (objc_lookUpClass("FBSDKTVInterfaceFactory.m") != nil) {
|
||||
[params setObject:@1 forKey:@"tv_lib_included"];
|
||||
}
|
||||
[FBSDKAppEvents logEvent:@"fb_sdk_initialize" parameters:params];
|
||||
}
|
||||
|
||||
#pragma mark -- (non-tvos)
|
||||
#if !TARGET_OS_TV
|
||||
- (BOOL)_handleBridgeAPIResponseURL:(NSURL *)responseURL sourceApplication:(NSString *)sourceApplication
|
||||
|
||||
@ -148,7 +148,7 @@ FBSDK_EXTERN NSString *const FBSDKErrorArgumentCollectionKey;
|
||||
FBSDK_EXTERN NSString *const FBSDKErrorArgumentNameKey;
|
||||
|
||||
/**
|
||||
The userInfo key for the invalid argument value for errors with FBSDKInvalidArgumentErrorCode.
|
||||
The userInfo key for the invalid argument value for errors with FBSDKInvalidArgumentErrorCode.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKErrorArgumentValueKey;
|
||||
|
||||
|
||||
@ -44,5 +44,5 @@
|
||||
#import <FBSDKCoreKit/FBSDKDeviceViewControllerBase.h>
|
||||
#endif
|
||||
|
||||
#define FBSDK_VERSION_STRING @"4.26.0"
|
||||
#define FBSDK_TARGET_PLATFORM_VERSION @"v2.10"
|
||||
#define FBSDK_VERSION_STRING @"4.29.0"
|
||||
#define FBSDK_TARGET_PLATFORM_VERSION @"v2.11"
|
||||
|
||||
@ -87,7 +87,7 @@ NSURLSessionDataDelegate
|
||||
@property (nonatomic, retain) NSMutableArray *requests;
|
||||
@property (nonatomic, assign) FBSDKGraphRequestConnectionState state;
|
||||
@property (nonatomic, strong) FBSDKLogger *logger;
|
||||
@property (nonatomic, assign) unsigned long requestStartTime;
|
||||
@property (nonatomic, assign) uint64_t requestStartTime;
|
||||
|
||||
@end
|
||||
|
||||
@ -540,7 +540,7 @@ NSURLSessionDataDelegate
|
||||
error = [FBSDKError errorWithCode:FBSDKGraphRequestProtocolMismatchErrorCode
|
||||
message:@"Unexpected number of results returned from server."];
|
||||
} else {
|
||||
[_logger appendFormat:@"Response <#%lu>\nDuration: %lu msec\nSize: %lu kB\nResponse Body:\n%@\n\n",
|
||||
[_logger appendFormat:@"Response <#%lu>\nDuration: %llu msec\nSize: %lu kB\nResponse Body:\n%@\n\n",
|
||||
(unsigned long)[_logger loggerSerialNumber],
|
||||
[FBSDKInternalUtility currentTimeInMilliseconds] - _requestStartTime,
|
||||
(unsigned long)[data length],
|
||||
|
||||
@ -88,7 +88,7 @@ static FBSDKProfile *g_currentProfile;
|
||||
{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
NSString *path = [self imagePathForPictureMode:FBSDKProfilePictureModeNormal size:size];
|
||||
NSString *path = [self imagePathForPictureMode:mode size:size];
|
||||
#pragma clang diagnostic pop
|
||||
return [FBSDKInternalUtility facebookURLWithHostPrefix:@"graph"
|
||||
path:path
|
||||
@ -278,9 +278,14 @@ static FBSDKProfile *g_currentProfile;
|
||||
{
|
||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
NSData *data = [userDefaults objectForKey:FBSDKProfileUserDefaultsKey];
|
||||
return (data != nil)
|
||||
? [NSKeyedUnarchiver unarchiveObjectWithData:data]
|
||||
: nil;
|
||||
if (data != nil) {
|
||||
@try {
|
||||
return [NSKeyedUnarchiver unarchiveObjectWithData:data];
|
||||
} @catch (NSException *exception) {
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
|
||||
#import "FBSDKSettings+Internal.h"
|
||||
|
||||
#import "FBSDKAccessTokenCache.h"
|
||||
#import "FBSDKCoreKit.h"
|
||||
|
||||
#define FBSDKSETTINGS_PLIST_CONFIGURATION_SETTING_IMPL(TYPE, PLIST_KEY, GETTER, SETTER, DEFAULT_VALUE) \
|
||||
@ -44,7 +45,7 @@ NSString *const FBSDKLoggingBehaviorGraphAPIDebugWarning = @"graph_api_debug_war
|
||||
NSString *const FBSDKLoggingBehaviorGraphAPIDebugInfo = @"graph_api_debug_info";
|
||||
NSString *const FBSDKLoggingBehaviorNetworkRequests = @"network_requests";
|
||||
|
||||
static FBSDKAccessTokenCache *g_tokenCache;
|
||||
static NSObject<FBSDKAccessTokenCaching> *g_tokenCache;
|
||||
static NSMutableSet *g_loggingBehavior;
|
||||
static NSString *g_legacyUserDefaultTokenInformationKeyName = @"FBAccessTokenInformationKey";
|
||||
static NSString *const FBSDKSettingsLimitEventAndDataUsage = @"com.facebook.sdk:FBSDKSettingsLimitEventAndDataUsage";
|
||||
@ -177,12 +178,12 @@ FBSDKSETTINGS_PLIST_CONFIGURATION_SETTING_IMPL(NSNumber, FacebookAutoLogAppEvent
|
||||
|
||||
#pragma mark - Internal
|
||||
|
||||
+ (FBSDKAccessTokenCache *)accessTokenCache
|
||||
+ (NSObject<FBSDKAccessTokenCaching> *)accessTokenCache
|
||||
{
|
||||
return g_tokenCache;
|
||||
}
|
||||
|
||||
- (void)setAccessTokenCache:(FBSDKAccessTokenCache *)cache
|
||||
+ (void)setAccessTokenCache:(NSObject<FBSDKAccessTokenCaching> *)cache
|
||||
{
|
||||
if (g_tokenCache != cache) {
|
||||
g_tokenCache = cache;
|
||||
|
||||
@ -105,6 +105,8 @@ FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKEventAppInviteShareDialogShow
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogMode;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogShareContentType;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogShareContentUUID;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogShareContentPageID;
|
||||
|
||||
/*! Use to log parameters for share tray use */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterShareTrayActivityName;
|
||||
@ -120,6 +122,10 @@ FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeOpenGraph;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeStatus;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypePhoto;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeVideo;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeCamera;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeMessengerGenericTemplate;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeMessengerMediaTemplate;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeMessengerOpenGraphMusicTemplate;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeUnknown;
|
||||
|
||||
|
||||
|
||||
@ -34,5 +34,6 @@
|
||||
- (BOOL)isCompatibleWithAppEventsState:(FBSDKAppEventsState *)appEventsState;
|
||||
- (BOOL)isCompatibleWithTokenString:(NSString *)tokenString appID:(NSString *)appID;
|
||||
- (NSString *)JSONStringForEvents:(BOOL)includeImplicitEvents;
|
||||
- (NSString *)extractReceiptData;
|
||||
|
||||
@end
|
||||
|
||||
@ -29,6 +29,8 @@
|
||||
#define FBSDK_APPEVENTSSTATE_EVENTS_KEY @"events"
|
||||
#define FBSDK_APPEVENTSSTATE_NUMSKIPPED_KEY @"numSkipped"
|
||||
#define FBSDK_APPEVENTSSTATE_TOKENSTRING_KEY @"tokenString"
|
||||
#define FBSDK_APPEVENTSTATE_RECEIPTDATA_KEY @"receipt_data"
|
||||
#define FBSDK_APPEVENTSTATE_RECEIPTID_KEY @"receipt_id"
|
||||
|
||||
@implementation FBSDKAppEventsState
|
||||
{
|
||||
@ -122,6 +124,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)extractReceiptData {
|
||||
NSMutableString *receipts_string = [NSMutableString string];
|
||||
NSInteger transactionId = 1;
|
||||
for (NSMutableDictionary* events in _mutableEvents) {
|
||||
NSMutableDictionary *event = events[@"event"];
|
||||
|
||||
NSString* receipt = event[@"receipt_data"];
|
||||
// Add receipt id as the identifier for receipt data in event parameter.
|
||||
// Receipt data will be sent as post parameter rather than the event parameter
|
||||
if (receipt) {
|
||||
NSString* idKey = [NSString stringWithFormat:@"receipt_%ld", (long)transactionId];
|
||||
event[FBSDK_APPEVENTSTATE_RECEIPTID_KEY] = idKey;
|
||||
NSString* receiptWithId = [NSString stringWithFormat:@"%@::%@;;;", idKey, receipt];
|
||||
[receipts_string appendString:receiptWithId];
|
||||
transactionId++;
|
||||
}
|
||||
}
|
||||
return receipts_string;
|
||||
}
|
||||
|
||||
- (BOOL)areAllEventsImplicit
|
||||
{
|
||||
for (NSDictionary *event in _mutableEvents) {
|
||||
@ -153,9 +175,14 @@
|
||||
if (!includeImplicitEvents && [eventAndImplicitFlag[FBSDK_APPEVENTSTATE_ISIMPLICIT_KEY] boolValue]) {
|
||||
continue;
|
||||
}
|
||||
[events addObject:eventAndImplicitFlag[@"event"]];
|
||||
NSMutableDictionary *event = eventAndImplicitFlag[@"event"];
|
||||
NSAssert(event != nil, @"event cannot be nil");
|
||||
[event removeObjectForKey:FBSDK_APPEVENTSTATE_RECEIPTDATA_KEY];
|
||||
|
||||
[events addObject:event];
|
||||
}
|
||||
|
||||
return [FBSDKInternalUtility JSONStringForObject:events error:NULL invalidObjectHandler:NULL];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -62,6 +62,11 @@
|
||||
|
||||
parameters[@"application_tracking_enabled"] = [@(!FBSDKSettings.limitEventAndDataUsage) stringValue];
|
||||
|
||||
NSString *userID = [FBSDKAppEvents userID];
|
||||
if (userID) {
|
||||
parameters[@"app_user_id"] = userID;
|
||||
}
|
||||
|
||||
[FBSDKAppEventsDeviceInfo extendDictionaryWithDeviceInfo:parameters];
|
||||
|
||||
static dispatch_once_t fetchBundleOnce;
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
#import "FBSDKLogger.h"
|
||||
#import "FBSDKSettings.h"
|
||||
|
||||
static NSString *const FBSDKAppEventParameterImplicitlyLoggedPurchase = @"_implicitlyLoggedPurchaseEvent";
|
||||
static NSString *const FBSDKAppEventParameterImplicitlyLoggedPurchase = @"_implicitlyLogged";
|
||||
static NSString *const FBSDKAppEventNamePurchaseFailed = @"fb_mobile_purchase_failed";
|
||||
static NSString *const FBSDKAppEventParameterNameProductTitle = @"fb_content_title";
|
||||
static NSString *const FBSDKAppEventParameterNameTransactionID = @"fb_transaction_id";
|
||||
@ -121,6 +121,10 @@ static NSMutableArray *g_pendingRequestors;
|
||||
|
||||
- (void)handleTransaction:(SKPaymentTransaction *)transaction
|
||||
{
|
||||
// Ignore restored transaction
|
||||
if (transaction.originalTransaction != nil) {
|
||||
return;
|
||||
}
|
||||
FBSDKPaymentProductRequestor *productRequest = [[FBSDKPaymentProductRequestor alloc] initWithTransaction:transaction];
|
||||
[productRequest resolveProducts];
|
||||
}
|
||||
@ -207,18 +211,18 @@ static NSMutableArray *g_pendingRequestors;
|
||||
|
||||
SKPayment *payment = self.transaction.payment;
|
||||
NSMutableDictionary *eventParameters = [NSMutableDictionary dictionaryWithDictionary: @{
|
||||
FBSDKAppEventParameterNameContentID: payment.productIdentifier ?: @"",
|
||||
FBSDKAppEventParameterNameNumItems: @(payment.quantity),
|
||||
}];
|
||||
FBSDKAppEventParameterNameContentID: payment.productIdentifier ?: @"",
|
||||
FBSDKAppEventParameterNameNumItems: @(payment.quantity),
|
||||
}];
|
||||
double totalAmount = 0;
|
||||
if (product) {
|
||||
totalAmount = payment.quantity * product.price.doubleValue;
|
||||
[eventParameters addEntriesFromDictionary: @{
|
||||
FBSDKAppEventParameterNameCurrency: [product.priceLocale objectForKey:NSLocaleCurrencyCode],
|
||||
FBSDKAppEventParameterNameNumItems: @(payment.quantity),
|
||||
FBSDKAppEventParameterNameProductTitle: [self getTruncatedString:product.localizedTitle],
|
||||
FBSDKAppEventParameterNameDescription: [self getTruncatedString:product.localizedDescription],
|
||||
}];
|
||||
FBSDKAppEventParameterNameCurrency: [product.priceLocale objectForKey:NSLocaleCurrencyCode],
|
||||
FBSDKAppEventParameterNameNumItems: @(payment.quantity),
|
||||
FBSDKAppEventParameterNameProductTitle: [self getTruncatedString:product.localizedTitle],
|
||||
FBSDKAppEventParameterNameDescription: [self getTruncatedString:product.localizedDescription],
|
||||
}];
|
||||
if (transactionID) {
|
||||
[eventParameters setObject:transactionID forKey:FBSDKAppEventParameterNameTransactionID];
|
||||
}
|
||||
@ -266,10 +270,19 @@ static NSMutableArray *g_pendingRequestors;
|
||||
valueToSum:(double)valueToSum
|
||||
parameters:(NSDictionary *)parameters {
|
||||
NSMutableDictionary *eventParameters = [NSMutableDictionary dictionaryWithDictionary:parameters];
|
||||
[eventParameters setObject:@"1" forKey:FBSDKAppEventParameterImplicitlyLoggedPurchase];
|
||||
|
||||
if ([eventName isEqualToString:FBSDKAppEventNamePurchased]) {
|
||||
NSData* receipt = [self fetchDeviceReceipt];
|
||||
if (receipt) {
|
||||
NSString *base64encodedReceipt = [receipt base64EncodedStringWithOptions:0];
|
||||
eventParameters[@"receipt_data"] = base64encodedReceipt;
|
||||
}
|
||||
}
|
||||
|
||||
[eventParameters setObject:@"1"forKey:FBSDKAppEventParameterImplicitlyLoggedPurchase];
|
||||
[FBSDKAppEvents logEvent:eventName
|
||||
valueToSum:valueToSum
|
||||
parameters:parameters];
|
||||
parameters:eventParameters];
|
||||
|
||||
// Unless the behavior is set to only allow explicit flushing, we go ahead and flush, since purchase events
|
||||
// are relatively rare and relatively high value and worth getting across on wire right away.
|
||||
@ -278,4 +291,11 @@ static NSMutableArray *g_pendingRequestors;
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch the current receipt for this application.
|
||||
- (NSData*)fetchDeviceReceipt {
|
||||
NSURL *receiptURL = [[NSBundle bundleForClass:[self class]] appStoreReceiptURL];
|
||||
NSData *receipt = [NSData dataWithContentsOfURL:receiptURL];
|
||||
return receipt;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -60,7 +60,8 @@ NSString *const FBSDKBridgeAPIVersionKey = @"version";
|
||||
_protocolMap = @{
|
||||
@(FBSDKBridgeAPIProtocolTypeNative): @{
|
||||
FBSDK_CANOPENURL_FACEBOOK:[[FBSDKBridgeAPIProtocolNativeV1 alloc] initWithAppScheme:@"fbapi20130214"],
|
||||
FBSDK_CANOPENURL_MESSENGER:[[FBSDKBridgeAPIProtocolNativeV1 alloc] initWithAppScheme:@"fb-messenger-api20140430"]
|
||||
FBSDK_CANOPENURL_MESSENGER:[[FBSDKBridgeAPIProtocolNativeV1 alloc] initWithAppScheme:@"fb-messenger-share-api"],
|
||||
FBSDK_CANOPENURL_MSQRD_PLAYER:[[FBSDKBridgeAPIProtocolNativeV1 alloc] initWithAppScheme:@"msqrdplayer-api20170208"]
|
||||
},
|
||||
@(FBSDKBridgeAPIProtocolTypeWeb): @{
|
||||
@"https": [[FBSDKBridgeAPIProtocolWebV1 alloc] init],
|
||||
|
||||
@ -61,6 +61,7 @@
|
||||
#import "FBSDKInternalUtility.h"
|
||||
#import "FBSDKLogger.h"
|
||||
#import "FBSDKMath.h"
|
||||
#import "FBSDKSettings+Internal.h"
|
||||
#import "FBSDKTypeUtility.h"
|
||||
#import "Network/FBSDKGraphRequest+Internal.h"
|
||||
#import "Network/FBSDKGraphRequestConnection+Internal.h"
|
||||
|
||||
@ -21,7 +21,8 @@
|
||||
|
||||
#define FBSDK_CANOPENURL_FACEBOOK @"fbauth2"
|
||||
#define FBSDK_CANOPENURL_FBAPI @"fbapi"
|
||||
#define FBSDK_CANOPENURL_MESSENGER @"fb-messenger-api"
|
||||
#define FBSDK_CANOPENURL_MESSENGER @"fb-messenger-share-api"
|
||||
#define FBSDK_CANOPENURL_MSQRD_PLAYER @"msqrdplayer"
|
||||
#define FBSDK_CANOPENURL_SHARE_EXTENSION @"fbshareextension"
|
||||
|
||||
typedef NS_ENUM(int32_t, FBSDKUIKitVersion)
|
||||
@ -88,7 +89,7 @@ typedef NS_ENUM(int32_t, FBSDKUIKitVersion)
|
||||
Changes in the system clock will affect this value.
|
||||
- Returns: The number of milliseconds since the Unix Epoch.
|
||||
*/
|
||||
+ (unsigned long)currentTimeInMilliseconds;
|
||||
+ (uint64_t)currentTimeInMilliseconds;
|
||||
|
||||
/**
|
||||
Sets an object for a key in a dictionary if it is not nil.
|
||||
@ -347,6 +348,7 @@ setJSONStringForObject:(id)object
|
||||
|
||||
+ (BOOL)isFacebookAppInstalled;
|
||||
+ (BOOL)isMessengerAppInstalled;
|
||||
+ (BOOL)isMSQRDPlayerAppInstalled;
|
||||
+ (void)checkRegisteredCanOpenURLScheme:(NSString *)urlScheme;
|
||||
+ (BOOL)isRegisteredCanOpenURLScheme:(NSString *)urlScheme;
|
||||
|
||||
|
||||
@ -110,11 +110,11 @@ typedef NS_ENUM(NSUInteger, FBSDKInternalUtilityVersionShift)
|
||||
return value;
|
||||
}
|
||||
|
||||
+ (unsigned long)currentTimeInMilliseconds
|
||||
+ (uint64_t)currentTimeInMilliseconds
|
||||
{
|
||||
struct timeval time;
|
||||
gettimeofday(&time, NULL);
|
||||
return (time.tv_sec * 1000) + (time.tv_usec / 1000);
|
||||
return ((uint64_t)time.tv_sec * 1000) + (time.tv_usec / 1000);
|
||||
}
|
||||
|
||||
+ (BOOL)dictionary:(NSMutableDictionary *)dictionary
|
||||
@ -493,11 +493,7 @@ static NSMapTable *_transientObjects;
|
||||
dispatch_once(&onceToken, ^{
|
||||
[FBSDKInternalUtility checkRegisteredCanOpenURLScheme:FBSDK_CANOPENURL_FACEBOOK];
|
||||
});
|
||||
NSURLComponents *components = [[NSURLComponents alloc] init];
|
||||
components.scheme = FBSDK_CANOPENURL_FACEBOOK;
|
||||
components.path = @"/";
|
||||
return [[UIApplication sharedApplication]
|
||||
canOpenURL:components.URL];
|
||||
return [self _canOpenURLScheme:FBSDK_CANOPENURL_FACEBOOK];
|
||||
}
|
||||
|
||||
+ (BOOL)isMessengerAppInstalled
|
||||
@ -506,12 +502,16 @@ static NSMapTable *_transientObjects;
|
||||
dispatch_once(&onceToken, ^{
|
||||
[FBSDKInternalUtility checkRegisteredCanOpenURLScheme:FBSDK_CANOPENURL_MESSENGER];
|
||||
});
|
||||
NSURLComponents *components = [[NSURLComponents alloc] init];
|
||||
components.scheme = FBSDK_CANOPENURL_MESSENGER;
|
||||
components.path = @"/";
|
||||
return [[UIApplication sharedApplication]
|
||||
canOpenURL:components.URL];
|
||||
return [self _canOpenURLScheme:FBSDK_CANOPENURL_MESSENGER];
|
||||
}
|
||||
|
||||
+ (BOOL)isMSQRDPlayerAppInstalled
|
||||
{
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
[FBSDKInternalUtility checkRegisteredCanOpenURLScheme:FBSDK_CANOPENURL_MSQRD_PLAYER];
|
||||
});
|
||||
return [self _canOpenURLScheme:FBSDK_CANOPENURL_MSQRD_PLAYER];
|
||||
}
|
||||
|
||||
#pragma mark - Object Lifecycle
|
||||
@ -583,6 +583,14 @@ static NSMapTable *_transientObjects;
|
||||
return object;
|
||||
}
|
||||
|
||||
+ (BOOL)_canOpenURLScheme:(NSString *)scheme
|
||||
{
|
||||
NSURLComponents *components = [[NSURLComponents alloc] init];
|
||||
components.scheme = scheme;
|
||||
components.path = @"/";
|
||||
return [[UIApplication sharedApplication] canOpenURL:components.URL];
|
||||
}
|
||||
|
||||
+ (void)validateAppID
|
||||
{
|
||||
if (![FBSDKSettings appID]) {
|
||||
|
||||
@ -163,11 +163,11 @@ static NSMutableDictionary *g_startTimesWithTags = nil;
|
||||
|
||||
// Only log if there's been an associated start time.
|
||||
if (startTimeNumber) {
|
||||
unsigned long elapsed = [FBSDKInternalUtility currentTimeInMilliseconds] - startTimeNumber.unsignedLongValue;
|
||||
uint64_t elapsed = [FBSDKInternalUtility currentTimeInMilliseconds] - startTimeNumber.unsignedLongLongValue;
|
||||
[g_startTimesWithTags removeObjectForKey:tagAsNumber]; // served its purpose, remove
|
||||
|
||||
// Log string is appended with "%d msec", with nothing intervening. This gives the most control to the caller.
|
||||
logString = [NSString stringWithFormat:@"%@%lu msec", logString, elapsed];
|
||||
logString = [NSString stringWithFormat:@"%@%llu msec", logString, elapsed];
|
||||
|
||||
[self singleShotLogEntry:loggingBehavior logEntry:logString];
|
||||
}
|
||||
@ -188,12 +188,12 @@ static NSMutableDictionary *g_startTimesWithTags = nil;
|
||||
@"Unexpectedly large number of outstanding perf logging start times, something is likely wrong."];
|
||||
}
|
||||
|
||||
unsigned long currTime = [FBSDKInternalUtility currentTimeInMilliseconds];
|
||||
uint64_t currTime = [FBSDKInternalUtility currentTimeInMilliseconds];
|
||||
|
||||
// Treat the incoming object tag simply as an address, since it's only used to identify during lifetime. If
|
||||
// we send in as an object, the dictionary will try to copy it.
|
||||
unsigned long tagAsNumber = (unsigned long)(__bridge void *)timestampTag;
|
||||
[g_startTimesWithTags setObject:[NSNumber numberWithUnsignedLong:currTime]
|
||||
[g_startTimesWithTags setObject:@(currTime)
|
||||
forKey:[NSNumber numberWithUnsignedLong:tagAsNumber]];
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,14 +16,15 @@
|
||||
// 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 "FBSDKAccessTokenCache.h"
|
||||
#import "FBSDKSettings.h"
|
||||
#import <FBSDKCoreKit/FBSDKSettings.h>
|
||||
|
||||
@protocol FBSDKAccessTokenCaching;
|
||||
|
||||
@interface FBSDKSettings(Internal)
|
||||
|
||||
+ (FBSDKAccessTokenCache *)accessTokenCache;
|
||||
+ (NSObject<FBSDKAccessTokenCaching> *)accessTokenCache;
|
||||
|
||||
- (void)setAccessTokenCache;
|
||||
+ (void)setAccessTokenCache:(NSObject<FBSDKAccessTokenCaching> *)accessTokenCache;
|
||||
|
||||
+ (NSString *)graphAPIDebugParamValue;
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
|
||||
#import "FBSDKSystemAccountStoreAdapter.h"
|
||||
|
||||
#import "FBSDKAccessToken.h"
|
||||
#import "FBSDKConstants.h"
|
||||
#import "FBSDKDynamicFrameworkLoader.h"
|
||||
#import "FBSDKError.h"
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
@property (nonatomic, retain) NSMutableData *data;
|
||||
@property (nonatomic, copy) FBSDKURLConnectionHandler handler;
|
||||
@property (nonatomic, retain) NSURLResponse *response;
|
||||
@property (nonatomic) unsigned long requestStartTime;
|
||||
@property (nonatomic, assign) uint64_t requestStartTime;
|
||||
@property (nonatomic, readonly) NSUInteger loggerSerialNumber;
|
||||
|
||||
@end
|
||||
@ -83,7 +83,7 @@
|
||||
responseData:(NSData *)responseData {
|
||||
// Basic FBSDKURLConnection logging just prints out the URL. FBSDKGraphRequest logging provides more details.
|
||||
NSString *mimeType = [response MIMEType];
|
||||
NSMutableString *mutableLogEntry = [NSMutableString stringWithFormat:@"FBSDKURLConnection <#%lu>:\n Duration: %lu msec\nResponse Size: %lu kB\n MIME type: %@\n",
|
||||
NSMutableString *mutableLogEntry = [NSMutableString stringWithFormat:@"FBSDKURLConnection <#%lu>:\n Duration: %llu msec\nResponse Size: %lu kB\n MIME type: %@\n",
|
||||
(unsigned long)self.loggerSerialNumber,
|
||||
[FBSDKInternalUtility currentTimeInMilliseconds] - self.requestStartTime,
|
||||
(unsigned long)[responseData length] / 1024,
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
@property (nonatomic, strong) NSURLSessionTask *task;
|
||||
@property (nonatomic, copy) FBSDKURLSessionTaskHandler handler;
|
||||
@property (nonatomic, assign) unsigned long requestStartTime;
|
||||
@property (nonatomic, assign) uint64_t requestStartTime;
|
||||
@property (nonatomic, assign, readonly) NSUInteger loggerSerialNumber;
|
||||
|
||||
@end
|
||||
@ -85,7 +85,7 @@
|
||||
responseData:(NSData *)responseData {
|
||||
// Basic FBSDKURLSessionTask logging just prints out the URL. FBSDKGraphRequest logging provides more details.
|
||||
NSString *mimeType = [response MIMEType];
|
||||
NSMutableString *mutableLogEntry = [NSMutableString stringWithFormat:@"FBSDKURLSessionTask <#%lu>:\n Duration: %lu msec\nResponse Size: %lu kB\n MIME type: %@\n",
|
||||
NSMutableString *mutableLogEntry = [NSMutableString stringWithFormat:@"FBSDKURLSessionTask <#%lu>:\n Duration: %llu msec\nResponse Size: %lu kB\n MIME type: %@\n",
|
||||
(unsigned long)self.loggerSerialNumber,
|
||||
[FBSDKInternalUtility currentTimeInMilliseconds] - self.requestStartTime,
|
||||
(unsigned long)[responseData length] / 1024,
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
static int const FBClientStateChallengeLength = 20;
|
||||
static NSString *const FBSDKExpectedChallengeKey = @"expected_login_challenge";
|
||||
static NSString *const FBSDKOauthPath = @"/dialog/oauth";
|
||||
static NSString *const SFVCCanceledLogin = @"com.apple.SafariServices.Authentication";
|
||||
|
||||
typedef NS_ENUM(NSInteger, FBSDKLoginManagerState) {
|
||||
FBSDKLoginManagerStateIdle,
|
||||
@ -386,6 +387,8 @@ typedef NS_ENUM(NSInteger, FBSDKLoginManagerState) {
|
||||
if (didPerformLogIn) {
|
||||
[_logger startAuthMethod:authMethod];
|
||||
_state = FBSDKLoginManagerStatePerformingLogin;
|
||||
} else if (error && [error.domain isEqualToString:SFVCCanceledLogin]) {
|
||||
[self handleImplicitCancelOfLogIn];
|
||||
} else {
|
||||
if (!error) {
|
||||
error = [NSError errorWithDomain:FBSDKLoginErrorDomain code:FBSDKLoginUnknownErrorCode userInfo:nil];
|
||||
@ -596,7 +599,7 @@ typedef NS_ENUM(NSInteger, FBSDKLoginManagerState) {
|
||||
BOOL isFacebookURL = [[url scheme] hasPrefix:[NSString stringWithFormat:@"fb%@", [FBSDKSettings appID]]] &&
|
||||
[[url host] isEqualToString:@"authorize"];
|
||||
|
||||
BOOL isExpectedSourceApplication = [sourceApplication hasPrefix:@"com.facebook"] || [sourceApplication hasPrefix:@"com.apple"];
|
||||
BOOL isExpectedSourceApplication = [sourceApplication hasPrefix:@"com.facebook"] || [sourceApplication hasPrefix:@"com.apple"] || [sourceApplication hasPrefix:@"com.burbn"];
|
||||
|
||||
return isFacebookURL && isExpectedSourceApplication;
|
||||
}
|
||||
@ -684,7 +687,7 @@ typedef NS_ENUM(NSInteger, FBSDKLoginManagerState) {
|
||||
audience = nil;
|
||||
}
|
||||
|
||||
unsigned long timePriorToSystemAuthUI = [FBSDKInternalUtility currentTimeInMilliseconds];
|
||||
uint64_t timePriorToSystemAuthUI = [FBSDKInternalUtility currentTimeInMilliseconds];
|
||||
|
||||
// the FBSDKSystemAccountStoreAdapter completion handler maintains the strong reference during the the asynchronous operation
|
||||
[[FBSDKSystemAccountStoreAdapter sharedInstance]
|
||||
|
||||
@ -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.
|
||||
*/
|
||||
|
||||
@ -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
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectArguments.h
generated
Normal file
57
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectArguments.h
generated
Normal file
@ -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
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectArguments.m
generated
Normal file
177
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectArguments.m
generated
Normal file
@ -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
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectTextures.h
generated
Normal file
43
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectTextures.h
generated
Normal file
@ -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
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectTextures.m
generated
Normal file
132
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectTextures.m
generated
Normal file
@ -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>
|
||||
|
||||
/**
|
||||
|
||||
@ -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
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareCameraEffectContent.h
generated
Normal file
52
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareCameraEffectContent.h
generated
Normal file
@ -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
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareCameraEffectContent.m
generated
Normal file
163
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareCameraEffectContent.m
generated
Normal file
@ -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
|
||||
@ -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>
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerActionButton.h
generated
Normal file
34
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerActionButton.h
generated
Normal file
@ -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
|
||||
55
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerGenericTemplateContent.h
generated
Normal file
55
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerGenericTemplateContent.h
generated
Normal file
@ -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
|
||||
93
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerGenericTemplateContent.m
generated
Normal file
93
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerGenericTemplateContent.m
generated
Normal file
@ -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
|
||||
56
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerGenericTemplateElement.h
generated
Normal file
56
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerGenericTemplateElement.h
generated
Normal file
@ -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
|
||||
71
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerGenericTemplateElement.m
generated
Normal file
71
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerGenericTemplateElement.m
generated
Normal file
@ -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
|
||||
69
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerMediaTemplateContent.h
generated
Normal file
69
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerMediaTemplateContent.h
generated
Normal file
@ -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
|
||||
110
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerMediaTemplateContent.m
generated
Normal file
110
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerMediaTemplateContent.m
generated
Normal file
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
62
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerURLActionButton.h
generated
Normal file
62
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerURLActionButton.h
generated
Normal file
@ -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
|
||||
82
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerURLActionButton.m
generated
Normal file
82
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerURLActionButton.m
generated
Normal file
@ -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
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
25
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/Internal/FBSDKCameraEffectTextures+Internal.h
generated
Normal file
25
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/Internal/FBSDKCameraEffectTextures+Internal.h
generated
Normal file
@ -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
|
||||
@ -83,6 +83,7 @@
|
||||
{
|
||||
if (![FBSDKAccessToken currentAccessToken]) {
|
||||
_recipientIDs = nil;
|
||||
return;
|
||||
}
|
||||
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"me/apprequestformerrecipients"
|
||||
parameters:@{@"fields":@""}
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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"
|
||||
|
||||
36
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/Internal/FBSDKShareMessengerContentUtility.h
generated
Normal file
36
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/Internal/FBSDKShareMessengerContentUtility.h
generated
Normal file
@ -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
|
||||
264
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/Internal/FBSDKShareMessengerContentUtility.m
generated
Normal file
264
Example/Pods/FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/Internal/FBSDKShareMessengerContentUtility.m
generated
Normal file
@ -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
|
||||
@ -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
|
||||
|
||||
@ -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]]) {
|
||||
|
||||
1
Example/Pods/Headers/Private/Bolts/BFGeneric.h
generated
Symbolic link
1
Example/Pods/Headers/Private/Bolts/BFGeneric.h
generated
Symbolic link
@ -0,0 +1 @@
|
||||
../../../Bolts/Bolts/Common/BFGeneric.h
|
||||
@ -1 +0,0 @@
|
||||
../../../Bolts/Bolts/Common/BFTask+Exceptions.h
|
||||
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectArguments+Internal.h
generated
Symbolic link
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectArguments+Internal.h
generated
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/Internal/FBSDKCameraEffectArguments+Internal.h
|
||||
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectArguments.h
generated
Symbolic link
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectArguments.h
generated
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectArguments.h
|
||||
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectTextures+Internal.h
generated
Symbolic link
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectTextures+Internal.h
generated
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/Internal/FBSDKCameraEffectTextures+Internal.h
|
||||
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectTextures.h
generated
Symbolic link
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectTextures.h
generated
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectTextures.h
|
||||
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKShareCameraEffectContent.h
generated
Symbolic link
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKShareCameraEffectContent.h
generated
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareCameraEffectContent.h
|
||||
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerActionButton.h
generated
Symbolic link
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerActionButton.h
generated
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerActionButton.h
|
||||
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerContentUtility.h
generated
Symbolic link
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerContentUtility.h
generated
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/Internal/FBSDKShareMessengerContentUtility.h
|
||||
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerGenericTemplateContent.h
generated
Symbolic link
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerGenericTemplateContent.h
generated
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerGenericTemplateContent.h
|
||||
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerGenericTemplateElement.h
generated
Symbolic link
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerGenericTemplateElement.h
generated
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerGenericTemplateElement.h
|
||||
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerMediaTemplateContent.h
generated
Symbolic link
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerMediaTemplateContent.h
generated
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerMediaTemplateContent.h
|
||||
@ -0,0 +1 @@
|
||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerOpenGraphMusicTemplateContent.h
|
||||
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerURLActionButton.h
generated
Symbolic link
1
Example/Pods/Headers/Private/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerURLActionButton.h
generated
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerURLActionButton.h
|
||||
1
Example/Pods/Headers/Public/Bolts/BFGeneric.h
generated
Symbolic link
1
Example/Pods/Headers/Public/Bolts/BFGeneric.h
generated
Symbolic link
@ -0,0 +1 @@
|
||||
../../../Bolts/Bolts/Common/BFGeneric.h
|
||||
@ -1 +0,0 @@
|
||||
../../../Bolts/Bolts/Common/BFTask+Exceptions.h
|
||||
1
Example/Pods/Headers/Public/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectArguments.h
generated
Symbolic link
1
Example/Pods/Headers/Public/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectArguments.h
generated
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectArguments.h
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user