Compare commits
No commits in common. "master" and "1.3.2" have entirely different histories.
@ -1,5 +1,3 @@
|
|||||||
platform :ios, '9.0'
|
|
||||||
|
|
||||||
target 'PNObject_Example' do
|
target 'PNObject_Example' do
|
||||||
pod 'PNObject', :path => '../'
|
pod 'PNObject', :path => '../'
|
||||||
pod 'PureLayout'
|
pod 'PureLayout'
|
||||||
|
|||||||
@ -14,31 +14,30 @@ PODS:
|
|||||||
- AFNetworking/Serialization (3.1.0)
|
- AFNetworking/Serialization (3.1.0)
|
||||||
- AFNetworking/UIKit (3.1.0):
|
- AFNetworking/UIKit (3.1.0):
|
||||||
- AFNetworking/NSURLSession
|
- AFNetworking/NSURLSession
|
||||||
- Bolts (1.9.0):
|
- Bolts (1.8.4):
|
||||||
- Bolts/AppLinks (= 1.9.0)
|
- Bolts/AppLinks (= 1.8.4)
|
||||||
- Bolts/Tasks (= 1.9.0)
|
- Bolts/Tasks (= 1.8.4)
|
||||||
- Bolts/AppLinks (1.9.0):
|
- Bolts/AppLinks (1.8.4):
|
||||||
- Bolts/Tasks
|
- Bolts/Tasks
|
||||||
- Bolts/Tasks (1.9.0)
|
- Bolts/Tasks (1.8.4)
|
||||||
- CodFis-Helper (0.1.3)
|
- CodFis-Helper (0.1.3)
|
||||||
- DDDKeychainWrapper (1.0.0)
|
- DDDKeychainWrapper (1.0.0)
|
||||||
- DJLocalization (1.2.2):
|
- DJLocalization (1.2.2):
|
||||||
- DJLocalization/Core (= 1.2.2)
|
- DJLocalization/Core (= 1.2.2)
|
||||||
- DJLocalization/Core (1.2.2)
|
- DJLocalization/Core (1.2.2)
|
||||||
- Expecta (1.0.6)
|
- Expecta (1.0.6)
|
||||||
- FBSDKCoreKit (4.29.0):
|
- FBSDKCoreKit (4.26.0):
|
||||||
- Bolts (~> 1.7)
|
- Bolts (~> 1.7)
|
||||||
- FBSDKLoginKit (4.29.0):
|
- FBSDKLoginKit (4.26.0):
|
||||||
- FBSDKCoreKit
|
- FBSDKCoreKit
|
||||||
- FBSDKShareKit (4.29.0):
|
- FBSDKShareKit (4.26.0):
|
||||||
- FBSDKCoreKit
|
- FBSDKCoreKit
|
||||||
- NSDataAES (0.2.2)
|
- NSDataAES (0.2.2)
|
||||||
- NSDate_Utils (1.1.0):
|
- NSDate_Utils (1.0.6)
|
||||||
- DJLocalization
|
|
||||||
- NSString-Helper (1.0.5)
|
- NSString-Helper (1.0.5)
|
||||||
- nv-ios-http-status (0.0.1)
|
- nv-ios-http-status (0.0.1)
|
||||||
- PEAR-FileManager-iOS (1.3.1)
|
- PEAR-FileManager-iOS (1.3.1)
|
||||||
- PNObject (1.3.4):
|
- PNObject (1.3.2):
|
||||||
- AFNetworking
|
- AFNetworking
|
||||||
- CodFis-Helper
|
- CodFis-Helper
|
||||||
- DDDKeychainWrapper
|
- DDDKeychainWrapper
|
||||||
@ -56,7 +55,7 @@ PODS:
|
|||||||
- UIDevice-Utils
|
- UIDevice-Utils
|
||||||
- PureLayout (3.0.2)
|
- PureLayout (3.0.2)
|
||||||
- RZDataBinding (2.1.0)
|
- RZDataBinding (2.1.0)
|
||||||
- Specta (1.0.7)
|
- Specta (1.0.6)
|
||||||
- StrongestPasswordValidator (0.1.2)
|
- StrongestPasswordValidator (0.1.2)
|
||||||
- UIDevice-Utils (1.0.0)
|
- UIDevice-Utils (1.0.0)
|
||||||
|
|
||||||
@ -72,26 +71,26 @@ EXTERNAL SOURCES:
|
|||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
|
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
|
||||||
Bolts: ac6567323eac61e203f6a9763667d0f711be34c8
|
Bolts: 8a7995239dbe724f9cba2248b766d48b7ebdd322
|
||||||
CodFis-Helper: 28be4c74d7202542459d72354f59b1215871de87
|
CodFis-Helper: 28be4c74d7202542459d72354f59b1215871de87
|
||||||
DDDKeychainWrapper: e681a4daba6448786fa83b4941f58102a33b1897
|
DDDKeychainWrapper: e681a4daba6448786fa83b4941f58102a33b1897
|
||||||
DJLocalization: 0c84029af375647d4104a42ae36be87194c46c47
|
DJLocalization: 0c84029af375647d4104a42ae36be87194c46c47
|
||||||
Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5
|
Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5
|
||||||
FBSDKCoreKit: 6f139173dc63a1deaff4430a55f2fe5bb222d2af
|
FBSDKCoreKit: c8b8582311ec11b145451d8b9717dc6cc2ae5a76
|
||||||
FBSDKLoginKit: 56a057ca6822535ea0faa25f57a7c41edb697fd4
|
FBSDKLoginKit: f3f03b94c21eb834af243c0a881d48641f47ca60
|
||||||
FBSDKShareKit: 18a2cd118aef11dd657fe7e8b64bae5c719088b2
|
FBSDKShareKit: 320712d8293fde6392872c91eb80ef0da5d73cc3
|
||||||
NSDataAES: 967ea3337476a80e9838a533c25d570a06855ed0
|
NSDataAES: 967ea3337476a80e9838a533c25d570a06855ed0
|
||||||
NSDate_Utils: c858a89da6e204ecf53aca48dbccb4da4d25bc9e
|
NSDate_Utils: c7802a1e0f5ef3acaf39bf55806a1caaa0343d2d
|
||||||
NSString-Helper: 459e1b6a62b3bf7db10f01b0d102548608e945c4
|
NSString-Helper: 459e1b6a62b3bf7db10f01b0d102548608e945c4
|
||||||
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
||||||
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
||||||
PNObject: 8dc560680a7a48060ed309b019ca4fc41505cc07
|
PNObject: 6dcb7b25b6d1ab221b59b7ed4e7c34a6dc50f76e
|
||||||
PureLayout: 4d550abe49a94f24c2808b9b95db9131685fe4cd
|
PureLayout: 4d550abe49a94f24c2808b9b95db9131685fe4cd
|
||||||
RZDataBinding: 6981e90ddaae2f5e02028323b1043f8c31013109
|
RZDataBinding: 6981e90ddaae2f5e02028323b1043f8c31013109
|
||||||
Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66
|
Specta: f506f3a8361de16bc0dcf3b17b75e269072ba465
|
||||||
StrongestPasswordValidator: 921e42615bdf353513c6f925bffd4fc29865dbd7
|
StrongestPasswordValidator: 921e42615bdf353513c6f925bffd4fc29865dbd7
|
||||||
UIDevice-Utils: ff37bd042127117572d6ce4c5ff074f4f54ab5ed
|
UIDevice-Utils: ff37bd042127117572d6ce4c5ff074f4f54ab5ed
|
||||||
|
|
||||||
PODFILE CHECKSUM: fcd5d1cf3426c7c9c5b3e5edcd4b8e5402ee7f2e
|
PODFILE CHECKSUM: db08ccdd0a68e33d4a1cceb1843643fbab2f2a8e
|
||||||
|
|
||||||
COCOAPODS: 1.3.1
|
COCOAPODS: 1.3.1
|
||||||
|
|||||||
@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/*!
|
/*!
|
||||||
A block that will be called when a token is cancelled.
|
A block that will be called when a token is cancelled.
|
||||||
*/
|
*/
|
||||||
typedef void(^BFCancellationBlock)(void);
|
typedef void(^BFCancellationBlock)();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
The consumer view of a CancellationToken.
|
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.
|
Returns a new executor that uses the given block to execute continuations.
|
||||||
@param block The block to use.
|
@param block The block to use.
|
||||||
*/
|
*/
|
||||||
+ (instancetype)executorWithBlock:(void(^)(void(^block)(void)))block;
|
+ (instancetype)executorWithBlock:(void(^)(void(^block)()))block;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns a new executor that runs continuations on the given queue.
|
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.
|
Runs the given block using this executor's particular strategy.
|
||||||
@param block The block to execute.
|
@param block The block to execute.
|
||||||
*/
|
*/
|
||||||
- (void)execute:(void(^)(void))block;
|
- (void)execute:(void(^)())block;
|
||||||
|
|
||||||
@end
|
@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
|
// NOTE: If the function is inlined, this value could be incorrect
|
||||||
uint8_t *frameAddr = __builtin_frame_address(0);
|
uint8_t *frameAddr = __builtin_frame_address(0);
|
||||||
|
|
||||||
return (*totalSize) - (size_t)(endStack - frameAddr);
|
return (*totalSize) - (endStack - frameAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@interface BFExecutor ()
|
@interface BFExecutor ()
|
||||||
|
|
||||||
@property (nonatomic, copy) void(^block)(void(^block)(void));
|
@property (nonatomic, copy) void(^block)(void(^block)());
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ __attribute__((noinline)) static size_t remaining_stack_size(size_t *restrict to
|
|||||||
static BFExecutor *defaultExecutor = NULL;
|
static BFExecutor *defaultExecutor = NULL;
|
||||||
static dispatch_once_t onceToken;
|
static dispatch_once_t onceToken;
|
||||||
dispatch_once(&onceToken, ^{
|
dispatch_once(&onceToken, ^{
|
||||||
defaultExecutor = [self executorWithBlock:^void(void(^block)(void)) {
|
defaultExecutor = [self executorWithBlock:^void(void(^block)()) {
|
||||||
// We prefer to run everything possible immediately, so that there is callstack information
|
// 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
|
// 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.
|
// 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 BFExecutor *immediateExecutor = NULL;
|
||||||
static dispatch_once_t onceToken;
|
static dispatch_once_t onceToken;
|
||||||
dispatch_once(&onceToken, ^{
|
dispatch_once(&onceToken, ^{
|
||||||
immediateExecutor = [self executorWithBlock:^void(void(^block)(void)) {
|
immediateExecutor = [self executorWithBlock:^void(void(^block)()) {
|
||||||
block();
|
block();
|
||||||
}];
|
}];
|
||||||
});
|
});
|
||||||
@ -85,7 +85,7 @@ __attribute__((noinline)) static size_t remaining_stack_size(size_t *restrict to
|
|||||||
static BFExecutor *mainThreadExecutor = NULL;
|
static BFExecutor *mainThreadExecutor = NULL;
|
||||||
static dispatch_once_t onceToken;
|
static dispatch_once_t onceToken;
|
||||||
dispatch_once(&onceToken, ^{
|
dispatch_once(&onceToken, ^{
|
||||||
mainThreadExecutor = [self executorWithBlock:^void(void(^block)(void)) {
|
mainThreadExecutor = [self executorWithBlock:^void(void(^block)()) {
|
||||||
if (![NSThread isMainThread]) {
|
if (![NSThread isMainThread]) {
|
||||||
dispatch_async(dispatch_get_main_queue(), block);
|
dispatch_async(dispatch_get_main_queue(), block);
|
||||||
} else {
|
} else {
|
||||||
@ -98,25 +98,25 @@ __attribute__((noinline)) static size_t remaining_stack_size(size_t *restrict to
|
|||||||
return mainThreadExecutor;
|
return mainThreadExecutor;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (instancetype)executorWithBlock:(void(^)(void(^block)(void)))block {
|
+ (instancetype)executorWithBlock:(void(^)(void(^block)()))block {
|
||||||
return [[self alloc] initWithBlock:block];
|
return [[self alloc] initWithBlock:block];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (instancetype)executorWithDispatchQueue:(dispatch_queue_t)queue {
|
+ (instancetype)executorWithDispatchQueue:(dispatch_queue_t)queue {
|
||||||
return [self executorWithBlock:^void(void(^block)(void)) {
|
return [self executorWithBlock:^void(void(^block)()) {
|
||||||
dispatch_async(queue, block);
|
dispatch_async(queue, block);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (instancetype)executorWithOperationQueue:(NSOperationQueue *)queue {
|
+ (instancetype)executorWithOperationQueue:(NSOperationQueue *)queue {
|
||||||
return [self executorWithBlock:^void(void(^block)(void)) {
|
return [self executorWithBlock:^void(void(^block)()) {
|
||||||
[queue addOperation:[NSBlockOperation blockOperationWithBlock:block]];
|
[queue addOperation:[NSBlockOperation blockOperationWithBlock:block]];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Initializer
|
#pragma mark - Initializer
|
||||||
|
|
||||||
- (instancetype)initWithBlock:(void(^)(void(^block)(void)))block {
|
- (instancetype)initWithBlock:(void(^)(void(^block)()))block {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (!self) return self;
|
if (!self) return self;
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ __attribute__((noinline)) static size_t remaining_stack_size(size_t *restrict to
|
|||||||
|
|
||||||
#pragma mark - Execution
|
#pragma mark - Execution
|
||||||
|
|
||||||
- (void)execute:(void(^)(void))block {
|
- (void)execute:(void(^)())block {
|
||||||
self.block(block);
|
self.block(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
25
Example/Pods/Bolts/Bolts/Common/BFGeneric.h
generated
25
Example/Pods/Bolts/Bolts/Common/BFGeneric.h
generated
@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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
Normal file
32
Example/Pods/Bolts/Bolts/Common/BFTask+Exceptions.h
generated
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* 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
Normal file
24
Example/Pods/Bolts/Bolts/Common/BFTask+Exceptions.m
generated
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* 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,7 +11,6 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import <Bolts/BFCancellationToken.h>
|
#import <Bolts/BFCancellationToken.h>
|
||||||
#import <Bolts/BFGeneric.h>
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@ -25,12 +24,29 @@ extern NSString *const BFTaskErrorDomain;
|
|||||||
*/
|
*/
|
||||||
extern NSInteger const kBFMultipleErrorsError;
|
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:>.
|
An error userInfo key used if there were multiple errors on <BFTask taskForCompletionOfAllTasks:>.
|
||||||
Value type is `NSArray<NSError *> *`.
|
Value type is `NSArray<NSError *> *`.
|
||||||
*/
|
*/
|
||||||
extern NSString *const BFTaskMultipleErrorsUserInfoKey;
|
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 BFExecutor;
|
||||||
@class BFTask;
|
@class BFTask;
|
||||||
|
|
||||||
@ -58,6 +74,15 @@ typedef __nullable id(^BFContinuationBlock)(BFTask<ResultType> *t);
|
|||||||
*/
|
*/
|
||||||
+ (instancetype)taskWithError:(NSError *)error;
|
+ (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.
|
Creates a task that is already cancelled.
|
||||||
*/
|
*/
|
||||||
@ -80,7 +105,7 @@ typedef __nullable id(^BFContinuationBlock)(BFTask<ResultType> *t);
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns a task that will be completed once there is at least one successful task.
|
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.
|
ignored.
|
||||||
@param tasks An `NSArray` of the tasks to use as an input.
|
@param tasks An `NSArray` of the tasks to use as an input.
|
||||||
*/
|
*/
|
||||||
@ -91,7 +116,7 @@ typedef __nullable id(^BFContinuationBlock)(BFTask<ResultType> *t);
|
|||||||
@param millis The approximate number of milliseconds to wait before the
|
@param millis The approximate number of milliseconds to wait before the
|
||||||
task will be finished (with result == nil).
|
task will be finished (with result == nil).
|
||||||
*/
|
*/
|
||||||
+ (BFTask<BFVoid> *)taskWithDelay:(int)millis;
|
+ (instancetype)taskWithDelay:(int)millis;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns a task that will be completed a certain amount of time in the future.
|
Returns a task that will be completed a certain amount of time in the future.
|
||||||
@ -99,7 +124,7 @@ typedef __nullable id(^BFContinuationBlock)(BFTask<ResultType> *t);
|
|||||||
task will be finished (with result == nil).
|
task will be finished (with result == nil).
|
||||||
@param token The cancellation token (optional).
|
@param token The cancellation token (optional).
|
||||||
*/
|
*/
|
||||||
+ (BFTask<BFVoid> *)taskWithDelay:(int)millis cancellationToken:(nullable BFCancellationToken *)token;
|
+ (instancetype)taskWithDelay:(int)millis cancellationToken:(nullable BFCancellationToken *)token;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns a task that will be completed after the given block completes with
|
Returns a task that will be completed after the given block completes with
|
||||||
@ -111,7 +136,7 @@ typedef __nullable id(^BFContinuationBlock)(BFTask<ResultType> *t);
|
|||||||
If block returns a BFTask, then the task returned from
|
If block returns a BFTask, then the task returned from
|
||||||
this method will not be completed until that task is completed.
|
this method will not be completed until that task is completed.
|
||||||
*/
|
*/
|
||||||
+ (instancetype)taskFromExecutor:(BFExecutor *)executor withBlock:(nullable id (^)(void))block;
|
+ (instancetype)taskFromExecutor:(BFExecutor *)executor withBlock:(nullable id (^)())block;
|
||||||
|
|
||||||
// Properties that will be set on the task once it is completed.
|
// Properties that will be set on the task once it is completed.
|
||||||
|
|
||||||
@ -125,13 +150,21 @@ typedef __nullable id(^BFContinuationBlock)(BFTask<ResultType> *t);
|
|||||||
*/
|
*/
|
||||||
@property (nullable, nonatomic, strong, readonly) NSError *error;
|
@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.
|
Whether this task has been cancelled.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, assign, readonly, getter=isCancelled) BOOL cancelled;
|
@property (nonatomic, assign, readonly, getter=isCancelled) BOOL cancelled;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Whether this task has completed due to an error.
|
Whether this task has completed due to an error or exception.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, assign, readonly, getter=isFaulted) BOOL faulted;
|
@property (nonatomic, assign, readonly, getter=isFaulted) BOOL faulted;
|
||||||
|
|
||||||
@ -151,7 +184,7 @@ typedef __nullable id(^BFContinuationBlock)(BFTask<ResultType> *t);
|
|||||||
If block returns a BFTask, then the task returned from
|
If block returns a BFTask, then the task returned from
|
||||||
this method will not be completed until that task is completed.
|
this method will not be completed until that task is completed.
|
||||||
*/
|
*/
|
||||||
- (BFTask *)continueWithBlock:(BFContinuationBlock)block NS_SWIFT_NAME(continueWith(block:));
|
- (BFTask *)continueWithBlock:(BFContinuationBlock)block;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Enqueues the given block to be run once this task is complete.
|
Enqueues the given block to be run once this task is complete.
|
||||||
@ -165,8 +198,7 @@ typedef __nullable id(^BFContinuationBlock)(BFTask<ResultType> *t);
|
|||||||
If block returns a BFTask, then the task returned from
|
If block returns a BFTask, then the task returned from
|
||||||
this method will not be completed until that task is completed.
|
this method will not be completed until that task is completed.
|
||||||
*/
|
*/
|
||||||
- (BFTask *)continueWithBlock:(BFContinuationBlock)block
|
- (BFTask *)continueWithBlock:(BFContinuationBlock)block cancellationToken:(nullable BFCancellationToken *)cancellationToken;
|
||||||
cancellationToken:(nullable BFCancellationToken *)cancellationToken NS_SWIFT_NAME(continueWith(block:cancellationToken:));
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Enqueues the given block to be run once this task is complete.
|
Enqueues the given block to be run once this task is complete.
|
||||||
@ -177,9 +209,7 @@ typedef __nullable id(^BFContinuationBlock)(BFTask<ResultType> *t);
|
|||||||
If block returns a BFTask, then the task returned from
|
If block returns a BFTask, then the task returned from
|
||||||
this method will not be completed until that task is completed.
|
this method will not be completed until that task is completed.
|
||||||
*/
|
*/
|
||||||
- (BFTask *)continueWithExecutor:(BFExecutor *)executor
|
- (BFTask *)continueWithExecutor:(BFExecutor *)executor withBlock:(BFContinuationBlock)block;
|
||||||
withBlock:(BFContinuationBlock)block NS_SWIFT_NAME(continueWith(executor:block:));
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Enqueues the given block to be run once this task is complete.
|
Enqueues the given block to be run once this task is complete.
|
||||||
@param executor A BFExecutor responsible for determining how the
|
@param executor A BFExecutor responsible for determining how the
|
||||||
@ -192,12 +222,11 @@ typedef __nullable id(^BFContinuationBlock)(BFTask<ResultType> *t);
|
|||||||
*/
|
*/
|
||||||
- (BFTask *)continueWithExecutor:(BFExecutor *)executor
|
- (BFTask *)continueWithExecutor:(BFExecutor *)executor
|
||||||
block:(BFContinuationBlock)block
|
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
|
Identical to continueWithBlock:, except that the block is only run
|
||||||
if this task did not produce a cancellation or an error.
|
if this task did not produce a cancellation, error, or exception.
|
||||||
If it did, then the failure will be propagated to the returned
|
If it did, then the failure will be propagated to the returned
|
||||||
task.
|
task.
|
||||||
@param block The block to be run once this task is complete.
|
@param block The block to be run once this task is complete.
|
||||||
@ -205,11 +234,11 @@ NS_SWIFT_NAME(continueWith(executor:block:cancellationToken:));
|
|||||||
If block returns a BFTask, then the task returned from
|
If block returns a BFTask, then the task returned from
|
||||||
this method will not be completed until that task is completed.
|
this method will not be completed until that task is completed.
|
||||||
*/
|
*/
|
||||||
- (BFTask *)continueWithSuccessBlock:(BFContinuationBlock)block NS_SWIFT_NAME(continueOnSuccessWith(block:));
|
- (BFTask *)continueWithSuccessBlock:(BFContinuationBlock)block;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Identical to continueWithBlock:, except that the block is only run
|
Identical to continueWithBlock:, except that the block is only run
|
||||||
if this task did not produce a cancellation or an error.
|
if this task did not produce a cancellation, error, or exception.
|
||||||
If it did, then the failure will be propagated to the returned
|
If it did, then the failure will be propagated to the returned
|
||||||
task.
|
task.
|
||||||
@param block The block to be run once this task is complete.
|
@param block The block to be run once this task is complete.
|
||||||
@ -218,14 +247,13 @@ NS_SWIFT_NAME(continueWith(executor:block:cancellationToken:));
|
|||||||
If block returns a BFTask, then the task returned from
|
If block returns a BFTask, then the task returned from
|
||||||
this method will not be completed until that task is completed.
|
this method will not be completed until that task is completed.
|
||||||
*/
|
*/
|
||||||
- (BFTask *)continueWithSuccessBlock:(BFContinuationBlock)block
|
- (BFTask *)continueWithSuccessBlock:(BFContinuationBlock)block cancellationToken:(nullable BFCancellationToken *)cancellationToken;
|
||||||
cancellationToken:(nullable BFCancellationToken *)cancellationToken
|
|
||||||
NS_SWIFT_NAME(continueOnSuccessWith(block:cancellationToken:));
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Identical to continueWithExecutor:withBlock:, except that the block
|
Identical to continueWithExecutor:withBlock:, except that the block
|
||||||
is only run if this task did not produce a cancellation, error, or an error.
|
is only run if this task did not produce a cancellation, error, or
|
||||||
If it did, then the failure will be propagated to the returned task.
|
exception. If it did, then the failure will be propagated to the
|
||||||
|
returned task.
|
||||||
@param executor A BFExecutor responsible for determining how the
|
@param executor A BFExecutor responsible for determining how the
|
||||||
continuation block will be run.
|
continuation block will be run.
|
||||||
@param block The block to be run once this task is complete.
|
@param block The block to be run once this task is complete.
|
||||||
@ -233,13 +261,13 @@ NS_SWIFT_NAME(continueOnSuccessWith(block:cancellationToken:));
|
|||||||
If block returns a BFTask, then the task returned from
|
If block returns a BFTask, then the task returned from
|
||||||
this method will not be completed until that task is completed.
|
this method will not be completed until that task is completed.
|
||||||
*/
|
*/
|
||||||
- (BFTask *)continueWithExecutor:(BFExecutor *)executor
|
- (BFTask *)continueWithExecutor:(BFExecutor *)executor withSuccessBlock:(BFContinuationBlock)block;
|
||||||
withSuccessBlock:(BFContinuationBlock)block NS_SWIFT_NAME(continueOnSuccessWith(executor:block:));
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Identical to continueWithExecutor:withBlock:, except that the block
|
Identical to continueWithExecutor:withBlock:, except that the block
|
||||||
is only run if this task did not produce a cancellation or an error.
|
is only run if this task did not produce a cancellation, error, or
|
||||||
If it did, then the failure will be propagated to the returned task.
|
exception. If it did, then the failure will be propagated to the
|
||||||
|
returned task.
|
||||||
@param executor A BFExecutor responsible for determining how the
|
@param executor A BFExecutor responsible for determining how the
|
||||||
continuation block will be run.
|
continuation block will be run.
|
||||||
@param block The block to be run once this task is complete.
|
@param block The block to be run once this task is complete.
|
||||||
@ -250,8 +278,7 @@ NS_SWIFT_NAME(continueOnSuccessWith(block:cancellationToken:));
|
|||||||
*/
|
*/
|
||||||
- (BFTask *)continueWithExecutor:(BFExecutor *)executor
|
- (BFTask *)continueWithExecutor:(BFExecutor *)executor
|
||||||
successBlock:(BFContinuationBlock)block
|
successBlock:(BFContinuationBlock)block
|
||||||
cancellationToken:(nullable BFCancellationToken *)cancellationToken
|
cancellationToken:(nullable BFCancellationToken *)cancellationToken;
|
||||||
NS_SWIFT_NAME(continueOnSuccessWith(executor:block:cancellationToken:));
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Waits until this operation is completed.
|
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,6 +13,7 @@
|
|||||||
#import <libkern/OSAtomic.h>
|
#import <libkern/OSAtomic.h>
|
||||||
|
|
||||||
#import "Bolts.h"
|
#import "Bolts.h"
|
||||||
|
#import "BFTask+Exceptions.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@ -23,12 +24,15 @@ __attribute__ ((noinline)) void warnBlockingOperationOnMainThread() {
|
|||||||
|
|
||||||
NSString *const BFTaskErrorDomain = @"bolts";
|
NSString *const BFTaskErrorDomain = @"bolts";
|
||||||
NSInteger const kBFMultipleErrorsError = 80175001;
|
NSInteger const kBFMultipleErrorsError = 80175001;
|
||||||
|
NSString *const BFTaskMultipleExceptionsException = @"BFMultipleExceptionsException";
|
||||||
|
|
||||||
NSString *const BFTaskMultipleErrorsUserInfoKey = @"errors";
|
NSString *const BFTaskMultipleErrorsUserInfoKey = @"errors";
|
||||||
|
NSString *const BFTaskMultipleExceptionsUserInfoKey = @"exceptions";
|
||||||
|
|
||||||
@interface BFTask () {
|
@interface BFTask () {
|
||||||
id _result;
|
id _result;
|
||||||
NSError *_error;
|
NSError *_error;
|
||||||
|
NSException *_exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (nonatomic, assign, readwrite, getter=isCancelled) BOOL cancelled;
|
@property (nonatomic, assign, readwrite, getter=isCancelled) BOOL cancelled;
|
||||||
@ -56,7 +60,7 @@ NSString *const BFTaskMultipleErrorsUserInfoKey = @"errors";
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithResult:(nullable id)result {
|
- (instancetype)initWithResult:(id)result {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (!self) return self;
|
if (!self) return self;
|
||||||
|
|
||||||
@ -74,6 +78,15 @@ NSString *const BFTaskMultipleErrorsUserInfoKey = @"errors";
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (instancetype)initWithException:(NSException *)exception {
|
||||||
|
self = [super init];
|
||||||
|
if (!self) return self;
|
||||||
|
|
||||||
|
[self trySetException:exception];
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
- (instancetype)initCancelled {
|
- (instancetype)initCancelled {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (!self) return self;
|
if (!self) return self;
|
||||||
@ -93,6 +106,10 @@ NSString *const BFTaskMultipleErrorsUserInfoKey = @"errors";
|
|||||||
return [[self alloc] initWithError:error];
|
return [[self alloc] initWithError:error];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (instancetype)taskWithException:(NSException *)exception {
|
||||||
|
return [[self alloc] initWithException:exception];
|
||||||
|
}
|
||||||
|
|
||||||
+ (instancetype)cancelledTask {
|
+ (instancetype)cancelledTask {
|
||||||
return [[self alloc] initCancelled];
|
return [[self alloc] initCancelled];
|
||||||
}
|
}
|
||||||
@ -106,11 +123,19 @@ NSString *const BFTaskMultipleErrorsUserInfoKey = @"errors";
|
|||||||
__block int32_t cancelled = 0;
|
__block int32_t cancelled = 0;
|
||||||
NSObject *lock = [[NSObject alloc] init];
|
NSObject *lock = [[NSObject alloc] init];
|
||||||
NSMutableArray *errors = [NSMutableArray array];
|
NSMutableArray *errors = [NSMutableArray array];
|
||||||
|
NSMutableArray *exceptions = [NSMutableArray array];
|
||||||
|
|
||||||
BFTaskCompletionSource *tcs = [BFTaskCompletionSource taskCompletionSource];
|
BFTaskCompletionSource *tcs = [BFTaskCompletionSource taskCompletionSource];
|
||||||
for (BFTask *task in tasks) {
|
for (BFTask *task in tasks) {
|
||||||
[task continueWithBlock:^id(BFTask *t) {
|
[task continueWithBlock:^id(BFTask *t) {
|
||||||
if (t.error) {
|
#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) {
|
||||||
@synchronized (lock) {
|
@synchronized (lock) {
|
||||||
[errors addObject:t.error];
|
[errors addObject:t.error];
|
||||||
}
|
}
|
||||||
@ -119,7 +144,19 @@ NSString *const BFTaskMultipleErrorsUserInfoKey = @"errors";
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (OSAtomicDecrement32Barrier(&total) == 0) {
|
if (OSAtomicDecrement32Barrier(&total) == 0) {
|
||||||
if (errors.count > 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 == 1) {
|
if (errors.count == 1) {
|
||||||
tcs.error = [errors firstObject];
|
tcs.error = [errors firstObject];
|
||||||
} else {
|
} else {
|
||||||
@ -141,7 +178,7 @@ NSString *const BFTaskMultipleErrorsUserInfoKey = @"errors";
|
|||||||
}
|
}
|
||||||
|
|
||||||
+ (instancetype)taskForCompletionOfAllTasksWithResults:(nullable NSArray<BFTask *> *)tasks {
|
+ (instancetype)taskForCompletionOfAllTasksWithResults:(nullable NSArray<BFTask *> *)tasks {
|
||||||
return [[self taskForCompletionOfAllTasks:tasks] continueWithSuccessBlock:^id(BFTask * __unused task) {
|
return [[self taskForCompletionOfAllTasks:tasks] continueWithSuccessBlock:^id(BFTask *task) {
|
||||||
return [tasks valueForKey:@"result"];
|
return [tasks valueForKey:@"result"];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
@ -158,11 +195,19 @@ NSString *const BFTaskMultipleErrorsUserInfoKey = @"errors";
|
|||||||
|
|
||||||
NSObject *lock = [NSObject new];
|
NSObject *lock = [NSObject new];
|
||||||
NSMutableArray<NSError *> *errors = [NSMutableArray new];
|
NSMutableArray<NSError *> *errors = [NSMutableArray new];
|
||||||
|
NSMutableArray<NSException *> *exceptions = [NSMutableArray new];
|
||||||
|
|
||||||
BFTaskCompletionSource *source = [BFTaskCompletionSource taskCompletionSource];
|
BFTaskCompletionSource *source = [BFTaskCompletionSource taskCompletionSource];
|
||||||
for (BFTask *task in tasks) {
|
for (BFTask *task in tasks) {
|
||||||
[task continueWithBlock:^id(BFTask *t) {
|
[task continueWithBlock:^id(BFTask *t) {
|
||||||
if (t.error != nil) {
|
#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) {
|
||||||
@synchronized(lock) {
|
@synchronized(lock) {
|
||||||
[errors addObject:t.error];
|
[errors addObject:t.error];
|
||||||
}
|
}
|
||||||
@ -178,6 +223,18 @@ NSString *const BFTaskMultipleErrorsUserInfoKey = @"errors";
|
|||||||
OSAtomicCompareAndSwap32Barrier(0, 1, &completed)) {
|
OSAtomicCompareAndSwap32Barrier(0, 1, &completed)) {
|
||||||
if (cancelled > 0) {
|
if (cancelled > 0) {
|
||||||
[source cancel];
|
[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) {
|
} else if (errors.count > 0) {
|
||||||
if (errors.count == 1) {
|
if (errors.count == 1) {
|
||||||
source.error = errors.firstObject;
|
source.error = errors.firstObject;
|
||||||
@ -197,7 +254,7 @@ NSString *const BFTaskMultipleErrorsUserInfoKey = @"errors";
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
+ (BFTask<BFVoid> *)taskWithDelay:(int)millis {
|
+ (instancetype)taskWithDelay:(int)millis {
|
||||||
BFTaskCompletionSource *tcs = [BFTaskCompletionSource taskCompletionSource];
|
BFTaskCompletionSource *tcs = [BFTaskCompletionSource taskCompletionSource];
|
||||||
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, millis * NSEC_PER_MSEC);
|
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){
|
dispatch_after(popTime, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){
|
||||||
@ -206,7 +263,7 @@ NSString *const BFTaskMultipleErrorsUserInfoKey = @"errors";
|
|||||||
return tcs.task;
|
return tcs.task;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (BFTask<BFVoid> *)taskWithDelay:(int)millis cancellationToken:(nullable BFCancellationToken *)token {
|
+ (instancetype)taskWithDelay:(int)millis cancellationToken:(nullable BFCancellationToken *)token {
|
||||||
if (token.cancellationRequested) {
|
if (token.cancellationRequested) {
|
||||||
return [BFTask cancelledTask];
|
return [BFTask cancelledTask];
|
||||||
}
|
}
|
||||||
@ -223,7 +280,7 @@ NSString *const BFTaskMultipleErrorsUserInfoKey = @"errors";
|
|||||||
return tcs.task;
|
return tcs.task;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (instancetype)taskFromExecutor:(BFExecutor *)executor withBlock:(nullable id (^)(void))block {
|
+ (instancetype)taskFromExecutor:(BFExecutor *)executor withBlock:(nullable id (^)())block {
|
||||||
return [[self taskWithResult:nil] continueWithExecutor:executor withBlock:^id(BFTask *task) {
|
return [[self taskWithResult:nil] continueWithExecutor:executor withBlock:^id(BFTask *task) {
|
||||||
return block();
|
return block();
|
||||||
}];
|
}];
|
||||||
@ -268,6 +325,25 @@ NSString *const BFTaskMultipleErrorsUserInfoKey = @"errors";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (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 {
|
- (BOOL)isCancelled {
|
||||||
@synchronized(self.lock) {
|
@synchronized(self.lock) {
|
||||||
return _cancelled;
|
return _cancelled;
|
||||||
@ -303,7 +379,7 @@ NSString *const BFTaskMultipleErrorsUserInfoKey = @"errors";
|
|||||||
[self.condition lock];
|
[self.condition lock];
|
||||||
[self.condition broadcast];
|
[self.condition broadcast];
|
||||||
[self.condition unlock];
|
[self.condition unlock];
|
||||||
for (void (^callback)(void) in self.callbacks) {
|
for (void (^callback)() in self.callbacks) {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
[self.callbacks removeAllObjects];
|
[self.callbacks removeAllObjects];
|
||||||
@ -328,12 +404,34 @@ NSString *const BFTaskMultipleErrorsUserInfoKey = @"errors";
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
id result = block(self);
|
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
|
||||||
|
|
||||||
if ([result isKindOfClass:[BFTask class]]) {
|
if ([result isKindOfClass:[BFTask class]]) {
|
||||||
|
|
||||||
id (^setupWithTask) (BFTask *) = ^id(BFTask *task) {
|
id (^setupWithTask) (BFTask *) = ^id(BFTask *task) {
|
||||||
if (cancellationToken.cancellationRequested || task.cancelled) {
|
if (cancellationToken.cancellationRequested || task.cancelled) {
|
||||||
[tcs cancel];
|
[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) {
|
} else if (task.error) {
|
||||||
tcs.error = task.error;
|
tcs.error = task.error;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@class BFTask<__covariant ResultType>;
|
@class BFTask<ResultType>;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
A BFTaskCompletionSource represents the producer side of tasks.
|
A BFTaskCompletionSource represents the producer side of tasks.
|
||||||
@ -36,14 +36,24 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
Attempting to set this for a completed task will raise an exception.
|
Attempting to set this for a completed task will raise an exception.
|
||||||
@param result The result of the task.
|
@param result The result of the task.
|
||||||
*/
|
*/
|
||||||
- (void)setResult:(nullable ResultType)result NS_SWIFT_NAME(set(result:));
|
- (void)setResult:(nullable ResultType)result;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Completes the task by setting the error.
|
Completes the task by setting the error.
|
||||||
Attempting to set this for a completed task will raise an exception.
|
Attempting to set this for a completed task will raise an exception.
|
||||||
@param error The error for the task.
|
@param error The error for the task.
|
||||||
*/
|
*/
|
||||||
- (void)setError:(NSError *)error NS_SWIFT_NAME(set(error:));
|
- (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.")));
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Completes the task by marking it as cancelled.
|
Completes the task by marking it as cancelled.
|
||||||
@ -55,14 +65,24 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
Sets the result of the task if it wasn't already completed.
|
Sets the result of the task if it wasn't already completed.
|
||||||
@returns whether the new value was set.
|
@returns whether the new value was set.
|
||||||
*/
|
*/
|
||||||
- (BOOL)trySetResult:(nullable ResultType)result NS_SWIFT_NAME(trySet(result:));
|
- (BOOL)trySetResult:(nullable ResultType)result;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Sets the error of the task if it wasn't already completed.
|
Sets the error of the task if it wasn't already completed.
|
||||||
@param error The error for the task.
|
@param error The error for the task.
|
||||||
@returns whether the new value was set.
|
@returns whether the new value was set.
|
||||||
*/
|
*/
|
||||||
- (BOOL)trySetError:(NSError *)error NS_SWIFT_NAME(trySet(error:));
|
- (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.")));
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Sets the cancellation state of the task if it wasn't already completed.
|
Sets the cancellation state of the task if it wasn't already completed.
|
||||||
|
|||||||
@ -18,6 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
- (BOOL)trySetResult:(nullable id)result;
|
- (BOOL)trySetResult:(nullable id)result;
|
||||||
- (BOOL)trySetError:(NSError *)error;
|
- (BOOL)trySetError:(NSError *)error;
|
||||||
|
- (BOOL)trySetException:(NSException *)exception;
|
||||||
- (BOOL)trySetCancelled;
|
- (BOOL)trySetCancelled;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@ -55,6 +56,13 @@ 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 {
|
- (void)cancel {
|
||||||
if (![self.task trySetCancelled]) {
|
if (![self.task trySetCancelled]) {
|
||||||
[NSException raise:NSInternalInconsistencyException
|
[NSException raise:NSInternalInconsistencyException
|
||||||
@ -70,6 +78,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
return [self.task trySetError:error];
|
return [self.task trySetError:error];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)trySetException:(NSException *)exception {
|
||||||
|
return [self.task trySetException:exception];
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL)trySetCancelled {
|
- (BOOL)trySetCancelled {
|
||||||
return [self.task 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/BFCancellationTokenRegistration.h>
|
||||||
#import <Bolts/BFCancellationTokenSource.h>
|
#import <Bolts/BFCancellationTokenSource.h>
|
||||||
#import <Bolts/BFExecutor.h>
|
#import <Bolts/BFExecutor.h>
|
||||||
#import <Bolts/BFGeneric.h>
|
|
||||||
#import <Bolts/BFTask.h>
|
#import <Bolts/BFTask.h>
|
||||||
|
#import <Bolts/BFTask+Exceptions.h>
|
||||||
#import <Bolts/BFTaskCompletionSource.h>
|
#import <Bolts/BFTaskCompletionSource.h>
|
||||||
|
|
||||||
#if __has_include(<Bolts/BFAppLink.h>) && TARGET_OS_IPHONE && !TARGET_OS_WATCH && !TARGET_OS_TV
|
#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
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
NSString *const BoltsFrameworkVersionString = @"1.9.0";
|
NSString *const BoltsFrameworkVersionString = @"1.8.4";
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|||||||
@ -33,7 +33,6 @@ typedef NS_ENUM(NSInteger, BFAppLinkNavigationType) {
|
|||||||
custom requests with additional navigation and app data attached to them by
|
custom requests with additional navigation and app data attached to them by
|
||||||
creating BFAppLinkNavigations themselves.
|
creating BFAppLinkNavigations themselves.
|
||||||
*/
|
*/
|
||||||
NS_EXTENSION_UNAVAILABLE_IOS("Not available in app extension")
|
|
||||||
@interface BFAppLinkNavigation : NSObject
|
@interface BFAppLinkNavigation : NSObject
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@ -25,6 +25,6 @@
|
|||||||
@param url The URL to resolve into an App Link.
|
@param url The URL to resolve into an App Link.
|
||||||
@returns A BFTask that will return a BFAppLink for the given URL.
|
@returns A BFTask that will return a BFAppLink for the given URL.
|
||||||
*/
|
*/
|
||||||
- (BFTask *)appLinkFromURLInBackground:(NSURL *)url NS_EXTENSION_UNAVAILABLE_IOS("Not available in app extension");
|
- (BFTask *)appLinkFromURLInBackground:(NSURL *)url;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -40,7 +40,6 @@
|
|||||||
A controller class that implements default behavior for a BFAppLinkReturnToRefererView, including
|
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.
|
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>
|
@interface BFAppLinkReturnToRefererController : NSObject <BFAppLinkReturnToRefererViewDelegate>
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@ -48,7 +48,6 @@ typedef NS_ENUM(NSUInteger, BFIncludeStatusBarInSize) {
|
|||||||
rather than navigating away. If the view is provided an App Link that does not contain
|
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.
|
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
|
@interface BFAppLinkReturnToRefererView : UIView
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@ -143,7 +143,7 @@ static NSString *const BFWebViewAppLinkResolverShouldFallbackKey = @"should_fall
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BFTask *)appLinkFromURLInBackground:(NSURL *)url NS_EXTENSION_UNAVAILABLE_IOS("") {
|
- (BFTask *)appLinkFromURLInBackground:(NSURL *)url {
|
||||||
return [[self followRedirects:url] continueWithExecutor:[BFExecutor mainThreadExecutor]
|
return [[self followRedirects:url] continueWithExecutor:[BFExecutor mainThreadExecutor]
|
||||||
withSuccessBlock:^id(BFTask *task) {
|
withSuccessBlock:^id(BFTask *task) {
|
||||||
NSData *responseData = task.result[@"data"];
|
NSData *responseData = task.result[@"data"];
|
||||||
@ -200,7 +200,7 @@ static NSString *const BFWebViewAppLinkResolverShouldFallbackKey = @"should_fall
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
NSMutableDictionary *root = al;
|
NSMutableDictionary *root = al;
|
||||||
for (NSUInteger i = 1; i < nameComponents.count; i++) {
|
for (int i = 1; i < nameComponents.count; i++) {
|
||||||
NSMutableArray *children = root[nameComponents[i]];
|
NSMutableArray *children = root[nameComponents[i]];
|
||||||
if (!children) {
|
if (!children) {
|
||||||
children = [NSMutableArray array];
|
children = [NSMutableArray array];
|
||||||
@ -237,17 +237,26 @@ static NSString *const BFWebViewAppLinkResolverShouldFallbackKey = @"should_fall
|
|||||||
NSMutableArray *linkTargets = [NSMutableArray array];
|
NSMutableArray *linkTargets = [NSMutableArray array];
|
||||||
|
|
||||||
NSArray *platformData = nil;
|
NSArray *platformData = nil;
|
||||||
|
switch (UI_USER_INTERFACE_IDIOM()) {
|
||||||
const UIUserInterfaceIdiom idiom = UI_USER_INTERFACE_IDIOM();
|
case UIUserInterfaceIdiomPad:
|
||||||
if (idiom == UIUserInterfaceIdiomPad) {
|
platformData = @[ appLinkDict[BFWebViewAppLinkResolverIPadKey] ?: @{},
|
||||||
platformData = @[ appLinkDict[BFWebViewAppLinkResolverIPadKey] ?: @{},
|
appLinkDict[BFWebViewAppLinkResolverIOSKey] ?: @{} ];
|
||||||
appLinkDict[BFWebViewAppLinkResolverIOSKey] ?: @{} ];
|
break;
|
||||||
} else if (idiom == UIUserInterfaceIdiomPhone) {
|
case UIUserInterfaceIdiomPhone:
|
||||||
platformData = @[ appLinkDict[BFWebViewAppLinkResolverIPhoneKey] ?: @{},
|
platformData = @[ appLinkDict[BFWebViewAppLinkResolverIPhoneKey] ?: @{},
|
||||||
appLinkDict[BFWebViewAppLinkResolverIOSKey] ?: @{} ];
|
appLinkDict[BFWebViewAppLinkResolverIOSKey] ?: @{} ];
|
||||||
} else {
|
break;
|
||||||
// Future-proofing. Other User Interface idioms should only hit ios.
|
#ifdef __TVOS_9_0
|
||||||
platformData = @[ appLinkDict[BFWebViewAppLinkResolverIOSKey] ?: @{} ];
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (NSArray *platformObjects in platformData) {
|
for (NSArray *platformObjects in platformData) {
|
||||||
|
|||||||
@ -97,14 +97,6 @@ FBSDK_EXTERN NSString *const FBSDKAppEventNameViewedContent;
|
|||||||
of methods on `FBSDKAppEvents`. Common event names are provided in the `FBAppEventName*` constants.
|
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. */
|
/** 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;
|
FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameContentID;
|
||||||
|
|
||||||
|
|||||||
@ -67,7 +67,6 @@ NSString *const FBSDKAppEventNameSpentCredits = @"fb_mobile_spent_cre
|
|||||||
NSString *const FBSDKAppEventParameterNameCurrency = @"fb_currency";
|
NSString *const FBSDKAppEventParameterNameCurrency = @"fb_currency";
|
||||||
NSString *const FBSDKAppEventParameterNameRegistrationMethod = @"fb_registration_method";
|
NSString *const FBSDKAppEventParameterNameRegistrationMethod = @"fb_registration_method";
|
||||||
NSString *const FBSDKAppEventParameterNameContentType = @"fb_content_type";
|
NSString *const FBSDKAppEventParameterNameContentType = @"fb_content_type";
|
||||||
NSString *const FBSDKAppEventParameterNameContent = @"fb_content";
|
|
||||||
NSString *const FBSDKAppEventParameterNameContentID = @"fb_content_id";
|
NSString *const FBSDKAppEventParameterNameContentID = @"fb_content_id";
|
||||||
NSString *const FBSDKAppEventParameterNameSearchString = @"fb_search_string";
|
NSString *const FBSDKAppEventParameterNameSearchString = @"fb_search_string";
|
||||||
NSString *const FBSDKAppEventParameterNameSuccess = @"fb_success";
|
NSString *const FBSDKAppEventParameterNameSuccess = @"fb_success";
|
||||||
@ -154,8 +153,6 @@ NSString *const FBSDKAppEventParameterDialogOutcome = @"fb_dialog_
|
|||||||
NSString *const FBSDKAppEventParameterDialogErrorMessage = @"fb_dialog_outcome_error_message";
|
NSString *const FBSDKAppEventParameterDialogErrorMessage = @"fb_dialog_outcome_error_message";
|
||||||
NSString *const FBSDKAppEventParameterDialogMode = @"fb_dialog_mode";
|
NSString *const FBSDKAppEventParameterDialogMode = @"fb_dialog_mode";
|
||||||
NSString *const FBSDKAppEventParameterDialogShareContentType = @"fb_dialog_share_content_type";
|
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 FBSDKAppEventParameterShareTrayActivityName = @"fb_share_tray_activity";
|
||||||
NSString *const FBSDKAppEventParameterShareTrayResult = @"fb_share_tray_result";
|
NSString *const FBSDKAppEventParameterShareTrayResult = @"fb_share_tray_result";
|
||||||
NSString *const FBSDKAppEventParameterLogTime = @"_logTime";
|
NSString *const FBSDKAppEventParameterLogTime = @"_logTime";
|
||||||
@ -176,15 +173,11 @@ NSString *const FBSDKAppEventsDialogShareModeFeedBrowser = @"FeedBrowser";
|
|||||||
NSString *const FBSDKAppEventsDialogShareModeFeedWeb = @"FeedWeb";
|
NSString *const FBSDKAppEventsDialogShareModeFeedWeb = @"FeedWeb";
|
||||||
NSString *const FBSDKAppEventsDialogShareModeUnknown = @"Unknown";
|
NSString *const FBSDKAppEventsDialogShareModeUnknown = @"Unknown";
|
||||||
|
|
||||||
NSString *const FBSDKAppEventsDialogShareContentTypeOpenGraph = @"OpenGraph";
|
NSString *const FBSDKAppEventsDialogShareContentTypeOpenGraph = @"OpenGraph";
|
||||||
NSString *const FBSDKAppEventsDialogShareContentTypeStatus = @"Status";
|
NSString *const FBSDKAppEventsDialogShareContentTypeStatus = @"Status";
|
||||||
NSString *const FBSDKAppEventsDialogShareContentTypePhoto = @"Photo";
|
NSString *const FBSDKAppEventsDialogShareContentTypePhoto = @"Photo";
|
||||||
NSString *const FBSDKAppEventsDialogShareContentTypeVideo = @"Video";
|
NSString *const FBSDKAppEventsDialogShareContentTypeVideo = @"Video";
|
||||||
NSString *const FBSDKAppEventsDialogShareContentTypeCamera = @"Camera";
|
NSString *const FBSDKAppEventsDialogShareContentTypeUnknown = @"Unknown";
|
||||||
NSString *const FBSDKAppEventsDialogShareContentTypeMessengerGenericTemplate = @"GenericTemplate";
|
|
||||||
NSString *const FBSDKAppEventsDialogShareContentTypeMessengerMediaTemplate = @"MediaTemplate";
|
|
||||||
NSString *const FBSDKAppEventsDialogShareContentTypeMessengerOpenGraphMusicTemplate = @"OpenGraphMusicTemplate";
|
|
||||||
NSString *const FBSDKAppEventsDialogShareContentTypeUnknown = @"Unknown";
|
|
||||||
|
|
||||||
NSString *const FBSDKAppEventsLoggingResultNotification = @"com.facebook.sdk:FBSDKAppEventsLoggingResultNotification";
|
NSString *const FBSDKAppEventsLoggingResultNotification = @"com.facebook.sdk:FBSDKAppEventsLoggingResultNotification";
|
||||||
|
|
||||||
@ -335,7 +328,7 @@ static NSString *g_overrideAppID = nil;
|
|||||||
[[FBSDKAppEvents singleton] instanceLogEvent:eventName
|
[[FBSDKAppEvents singleton] instanceLogEvent:eventName
|
||||||
valueToSum:valueToSum
|
valueToSum:valueToSum
|
||||||
parameters:parameters
|
parameters:parameters
|
||||||
isImplicitlyLogged:(BOOL)parameters[FBSDKAppEventParameterImplicitlyLogged]
|
isImplicitlyLogged:NO
|
||||||
accessToken:accessToken];
|
accessToken:accessToken];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,6 +685,7 @@ static NSString *g_overrideAppID = nil;
|
|||||||
if (isImplicitlyLogged) {
|
if (isImplicitlyLogged) {
|
||||||
eventDictionary[FBSDKAppEventParameterImplicitlyLogged] = @"1";
|
eventDictionary[FBSDKAppEventParameterImplicitlyLogged] = @"1";
|
||||||
}
|
}
|
||||||
|
[FBSDKInternalUtility dictionary:eventDictionary setObject:_userID forKey:@"_app_user_id"];
|
||||||
|
|
||||||
NSString *currentViewControllerName;
|
NSString *currentViewControllerName;
|
||||||
if ([NSThread isMainThread]) {
|
if ([NSThread isMainThread]) {
|
||||||
@ -789,7 +783,6 @@ static NSString *g_overrideAppID = nil;
|
|||||||
[FBSDKAppEventsUtility ensureOnMainThread:NSStringFromSelector(_cmd) className:NSStringFromClass([self class])];
|
[FBSDKAppEventsUtility ensureOnMainThread:NSStringFromSelector(_cmd) className:NSStringFromClass([self class])];
|
||||||
|
|
||||||
[self fetchServerConfiguration:^(void) {
|
[self fetchServerConfiguration:^(void) {
|
||||||
NSString *receipt_data = [appEventsState extractReceiptData];
|
|
||||||
NSString *JSONString = [appEventsState JSONStringForEvents:_serverConfiguration.implicitLoggingEnabled];
|
NSString *JSONString = [appEventsState JSONStringForEvents:_serverConfiguration.implicitLoggingEnabled];
|
||||||
NSData *encodedEvents = [JSONString dataUsingEncoding:NSUTF8StringEncoding];
|
NSData *encodedEvents = [JSONString dataUsingEncoding:NSUTF8StringEncoding];
|
||||||
if (!encodedEvents) {
|
if (!encodedEvents) {
|
||||||
@ -801,11 +794,6 @@ static NSString *g_overrideAppID = nil;
|
|||||||
activityParametersDictionaryForEvent:@"CUSTOM_APP_EVENTS"
|
activityParametersDictionaryForEvent:@"CUSTOM_APP_EVENTS"
|
||||||
implicitEventsOnly:appEventsState.areAllEventsImplicit
|
implicitEventsOnly:appEventsState.areAllEventsImplicit
|
||||||
shouldAccessAdvertisingID:_serverConfiguration.advertisingIDEnabled];
|
shouldAccessAdvertisingID:_serverConfiguration.advertisingIDEnabled];
|
||||||
NSInteger length = [receipt_data length];
|
|
||||||
if (length > 0) {
|
|
||||||
postParameters[@"receipt_data"] = receipt_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
postParameters[@"custom_events_file"] = encodedEvents;
|
postParameters[@"custom_events_file"] = encodedEvents;
|
||||||
if (appEventsState.numSkipped > 0) {
|
if (appEventsState.numSkipped > 0) {
|
||||||
postParameters[@"num_skipped_events"] = [NSString stringWithFormat:@"%lu", (unsigned long)appEventsState.numSkipped];
|
postParameters[@"num_skipped_events"] = [NSString stringWithFormat:@"%lu", (unsigned long)appEventsState.numSkipped];
|
||||||
|
|||||||
@ -25,7 +25,6 @@
|
|||||||
#import <Bolts/BFTask.h>
|
#import <Bolts/BFTask.h>
|
||||||
#import <Bolts/BFTaskCompletionSource.h>
|
#import <Bolts/BFTaskCompletionSource.h>
|
||||||
|
|
||||||
#import "FBSDKAccessToken.h"
|
|
||||||
#import "FBSDKGraphRequest+Internal.h"
|
#import "FBSDKGraphRequest+Internal.h"
|
||||||
#import "FBSDKGraphRequestConnection.h"
|
#import "FBSDKGraphRequestConnection.h"
|
||||||
#import "FBSDKInternalUtility.h"
|
#import "FBSDKInternalUtility.h"
|
||||||
|
|||||||
@ -50,7 +50,7 @@
|
|||||||
- Parameter annotation: The annotation as passed to [UIApplicationDelegate application:openURL:sourceApplication:annotation:].
|
- 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.
|
- Returns: YES if the url was intended for the Facebook SDK, NO if not.
|
||||||
*/
|
*/
|
||||||
- (BOOL)application:(UIApplication *)application
|
- (BOOL)application:(UIApplication *)application
|
||||||
openURL:(NSURL *)url
|
openURL:(NSURL *)url
|
||||||
sourceApplication:(NSString *)sourceApplication
|
sourceApplication:(NSString *)sourceApplication
|
||||||
|
|||||||
@ -172,12 +172,6 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
|||||||
completion:completePendingOpenURLBlock];
|
completion:completePendingOpenURLBlock];
|
||||||
_safariViewController = nil;
|
_safariViewController = nil;
|
||||||
} else {
|
} else {
|
||||||
#ifdef __IPHONE_11_0
|
|
||||||
if (_authenticationSession != nil) {
|
|
||||||
[_authenticationSession cancel];
|
|
||||||
_authenticationSession = nil;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
completePendingOpenURLBlock();
|
completePendingOpenURLBlock();
|
||||||
}
|
}
|
||||||
if ([pendingURLOpen canOpenURL:url
|
if ([pendingURLOpen canOpenURL:url
|
||||||
@ -202,7 +196,6 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
|||||||
// fetch app settings
|
// fetch app settings
|
||||||
[FBSDKServerConfigurationManager loadServerConfigurationWithCompletionBlock:NULL];
|
[FBSDKServerConfigurationManager loadServerConfigurationWithCompletionBlock:NULL];
|
||||||
|
|
||||||
[self _logSDKInitialize];
|
|
||||||
#if !TARGET_OS_TV
|
#if !TARGET_OS_TV
|
||||||
FBSDKProfile *cachedProfile = [FBSDKProfile fetchCachedProfile];
|
FBSDKProfile *cachedProfile = [FBSDKProfile fetchCachedProfile];
|
||||||
[FBSDKProfile setCurrentProfile:cachedProfile];
|
[FBSDKProfile setCurrentProfile:cachedProfile];
|
||||||
@ -241,13 +234,7 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
|||||||
// _expectingBackground can be YES if the caller started doing work (like login)
|
// _expectingBackground can be YES if the caller started doing work (like login)
|
||||||
// within the app delegate's lifecycle like openURL, in which case there
|
// within the app delegate's lifecycle like openURL, in which case there
|
||||||
// might have been a "didBecomeActive" event pending that we want to ignore.
|
// might have been a "didBecomeActive" event pending that we want to ignore.
|
||||||
BOOL notExpectingBackground = !_expectingBackground && !_safariViewController && !_isDismissingSafariViewController;
|
if (!_expectingBackground && !_safariViewController && !_isDismissingSafariViewController) {
|
||||||
#if !TARGET_OS_TV
|
|
||||||
#ifdef __IPHONE_11_0
|
|
||||||
notExpectingBackground = notExpectingBackground && !_authenticationSession;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
if (notExpectingBackground) {
|
|
||||||
_active = YES;
|
_active = YES;
|
||||||
#if !TARGET_OS_TV
|
#if !TARGET_OS_TV
|
||||||
[_pendingURLOpen applicationDidBecomeActive:[notification object]];
|
[_pendingURLOpen applicationDidBecomeActive:[notification object]];
|
||||||
@ -487,31 +474,6 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
|||||||
accessToken:nil];
|
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)
|
#pragma mark -- (non-tvos)
|
||||||
#if !TARGET_OS_TV
|
#if !TARGET_OS_TV
|
||||||
- (BOOL)_handleBridgeAPIResponseURL:(NSURL *)responseURL sourceApplication:(NSString *)sourceApplication
|
- (BOOL)_handleBridgeAPIResponseURL:(NSURL *)responseURL sourceApplication:(NSString *)sourceApplication
|
||||||
|
|||||||
@ -148,7 +148,7 @@ FBSDK_EXTERN NSString *const FBSDKErrorArgumentCollectionKey;
|
|||||||
FBSDK_EXTERN NSString *const FBSDKErrorArgumentNameKey;
|
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;
|
FBSDK_EXTERN NSString *const FBSDKErrorArgumentValueKey;
|
||||||
|
|
||||||
|
|||||||
@ -44,5 +44,5 @@
|
|||||||
#import <FBSDKCoreKit/FBSDKDeviceViewControllerBase.h>
|
#import <FBSDKCoreKit/FBSDKDeviceViewControllerBase.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FBSDK_VERSION_STRING @"4.29.0"
|
#define FBSDK_VERSION_STRING @"4.26.0"
|
||||||
#define FBSDK_TARGET_PLATFORM_VERSION @"v2.11"
|
#define FBSDK_TARGET_PLATFORM_VERSION @"v2.10"
|
||||||
|
|||||||
@ -87,7 +87,7 @@ NSURLSessionDataDelegate
|
|||||||
@property (nonatomic, retain) NSMutableArray *requests;
|
@property (nonatomic, retain) NSMutableArray *requests;
|
||||||
@property (nonatomic, assign) FBSDKGraphRequestConnectionState state;
|
@property (nonatomic, assign) FBSDKGraphRequestConnectionState state;
|
||||||
@property (nonatomic, strong) FBSDKLogger *logger;
|
@property (nonatomic, strong) FBSDKLogger *logger;
|
||||||
@property (nonatomic, assign) uint64_t requestStartTime;
|
@property (nonatomic, assign) unsigned long requestStartTime;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -540,7 +540,7 @@ NSURLSessionDataDelegate
|
|||||||
error = [FBSDKError errorWithCode:FBSDKGraphRequestProtocolMismatchErrorCode
|
error = [FBSDKError errorWithCode:FBSDKGraphRequestProtocolMismatchErrorCode
|
||||||
message:@"Unexpected number of results returned from server."];
|
message:@"Unexpected number of results returned from server."];
|
||||||
} else {
|
} else {
|
||||||
[_logger appendFormat:@"Response <#%lu>\nDuration: %llu msec\nSize: %lu kB\nResponse Body:\n%@\n\n",
|
[_logger appendFormat:@"Response <#%lu>\nDuration: %lu msec\nSize: %lu kB\nResponse Body:\n%@\n\n",
|
||||||
(unsigned long)[_logger loggerSerialNumber],
|
(unsigned long)[_logger loggerSerialNumber],
|
||||||
[FBSDKInternalUtility currentTimeInMilliseconds] - _requestStartTime,
|
[FBSDKInternalUtility currentTimeInMilliseconds] - _requestStartTime,
|
||||||
(unsigned long)[data length],
|
(unsigned long)[data length],
|
||||||
|
|||||||
@ -88,7 +88,7 @@ static FBSDKProfile *g_currentProfile;
|
|||||||
{
|
{
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
NSString *path = [self imagePathForPictureMode:mode size:size];
|
NSString *path = [self imagePathForPictureMode:FBSDKProfilePictureModeNormal size:size];
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
return [FBSDKInternalUtility facebookURLWithHostPrefix:@"graph"
|
return [FBSDKInternalUtility facebookURLWithHostPrefix:@"graph"
|
||||||
path:path
|
path:path
|
||||||
@ -278,14 +278,9 @@ static FBSDKProfile *g_currentProfile;
|
|||||||
{
|
{
|
||||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
||||||
NSData *data = [userDefaults objectForKey:FBSDKProfileUserDefaultsKey];
|
NSData *data = [userDefaults objectForKey:FBSDKProfileUserDefaultsKey];
|
||||||
if (data != nil) {
|
return (data != nil)
|
||||||
@try {
|
? [NSKeyedUnarchiver unarchiveObjectWithData:data]
|
||||||
return [NSKeyedUnarchiver unarchiveObjectWithData:data];
|
: nil;
|
||||||
} @catch (NSException *exception) {
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
#import "FBSDKSettings+Internal.h"
|
#import "FBSDKSettings+Internal.h"
|
||||||
|
|
||||||
#import "FBSDKAccessTokenCache.h"
|
|
||||||
#import "FBSDKCoreKit.h"
|
#import "FBSDKCoreKit.h"
|
||||||
|
|
||||||
#define FBSDKSETTINGS_PLIST_CONFIGURATION_SETTING_IMPL(TYPE, PLIST_KEY, GETTER, SETTER, DEFAULT_VALUE) \
|
#define FBSDKSETTINGS_PLIST_CONFIGURATION_SETTING_IMPL(TYPE, PLIST_KEY, GETTER, SETTER, DEFAULT_VALUE) \
|
||||||
@ -45,7 +44,7 @@ NSString *const FBSDKLoggingBehaviorGraphAPIDebugWarning = @"graph_api_debug_war
|
|||||||
NSString *const FBSDKLoggingBehaviorGraphAPIDebugInfo = @"graph_api_debug_info";
|
NSString *const FBSDKLoggingBehaviorGraphAPIDebugInfo = @"graph_api_debug_info";
|
||||||
NSString *const FBSDKLoggingBehaviorNetworkRequests = @"network_requests";
|
NSString *const FBSDKLoggingBehaviorNetworkRequests = @"network_requests";
|
||||||
|
|
||||||
static NSObject<FBSDKAccessTokenCaching> *g_tokenCache;
|
static FBSDKAccessTokenCache *g_tokenCache;
|
||||||
static NSMutableSet *g_loggingBehavior;
|
static NSMutableSet *g_loggingBehavior;
|
||||||
static NSString *g_legacyUserDefaultTokenInformationKeyName = @"FBAccessTokenInformationKey";
|
static NSString *g_legacyUserDefaultTokenInformationKeyName = @"FBAccessTokenInformationKey";
|
||||||
static NSString *const FBSDKSettingsLimitEventAndDataUsage = @"com.facebook.sdk:FBSDKSettingsLimitEventAndDataUsage";
|
static NSString *const FBSDKSettingsLimitEventAndDataUsage = @"com.facebook.sdk:FBSDKSettingsLimitEventAndDataUsage";
|
||||||
@ -178,12 +177,12 @@ FBSDKSETTINGS_PLIST_CONFIGURATION_SETTING_IMPL(NSNumber, FacebookAutoLogAppEvent
|
|||||||
|
|
||||||
#pragma mark - Internal
|
#pragma mark - Internal
|
||||||
|
|
||||||
+ (NSObject<FBSDKAccessTokenCaching> *)accessTokenCache
|
+ (FBSDKAccessTokenCache *)accessTokenCache
|
||||||
{
|
{
|
||||||
return g_tokenCache;
|
return g_tokenCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void)setAccessTokenCache:(NSObject<FBSDKAccessTokenCaching> *)cache
|
- (void)setAccessTokenCache:(FBSDKAccessTokenCache *)cache
|
||||||
{
|
{
|
||||||
if (g_tokenCache != cache) {
|
if (g_tokenCache != cache) {
|
||||||
g_tokenCache = cache;
|
g_tokenCache = cache;
|
||||||
|
|||||||
@ -105,8 +105,6 @@ FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKEventAppInviteShareDialogShow
|
|||||||
|
|
||||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogMode;
|
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogMode;
|
||||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogShareContentType;
|
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogShareContentType;
|
||||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogShareContentUUID;
|
|
||||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogShareContentPageID;
|
|
||||||
|
|
||||||
/*! Use to log parameters for share tray use */
|
/*! Use to log parameters for share tray use */
|
||||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterShareTrayActivityName;
|
FBSDK_EXTERN NSString *const FBSDKAppEventParameterShareTrayActivityName;
|
||||||
@ -122,10 +120,6 @@ FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeOpenGraph;
|
|||||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeStatus;
|
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeStatus;
|
||||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypePhoto;
|
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypePhoto;
|
||||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeVideo;
|
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;
|
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeUnknown;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -34,6 +34,5 @@
|
|||||||
- (BOOL)isCompatibleWithAppEventsState:(FBSDKAppEventsState *)appEventsState;
|
- (BOOL)isCompatibleWithAppEventsState:(FBSDKAppEventsState *)appEventsState;
|
||||||
- (BOOL)isCompatibleWithTokenString:(NSString *)tokenString appID:(NSString *)appID;
|
- (BOOL)isCompatibleWithTokenString:(NSString *)tokenString appID:(NSString *)appID;
|
||||||
- (NSString *)JSONStringForEvents:(BOOL)includeImplicitEvents;
|
- (NSString *)JSONStringForEvents:(BOOL)includeImplicitEvents;
|
||||||
- (NSString *)extractReceiptData;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -29,8 +29,6 @@
|
|||||||
#define FBSDK_APPEVENTSSTATE_EVENTS_KEY @"events"
|
#define FBSDK_APPEVENTSSTATE_EVENTS_KEY @"events"
|
||||||
#define FBSDK_APPEVENTSSTATE_NUMSKIPPED_KEY @"numSkipped"
|
#define FBSDK_APPEVENTSSTATE_NUMSKIPPED_KEY @"numSkipped"
|
||||||
#define FBSDK_APPEVENTSSTATE_TOKENSTRING_KEY @"tokenString"
|
#define FBSDK_APPEVENTSSTATE_TOKENSTRING_KEY @"tokenString"
|
||||||
#define FBSDK_APPEVENTSTATE_RECEIPTDATA_KEY @"receipt_data"
|
|
||||||
#define FBSDK_APPEVENTSTATE_RECEIPTID_KEY @"receipt_id"
|
|
||||||
|
|
||||||
@implementation FBSDKAppEventsState
|
@implementation FBSDKAppEventsState
|
||||||
{
|
{
|
||||||
@ -124,26 +122,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (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
|
- (BOOL)areAllEventsImplicit
|
||||||
{
|
{
|
||||||
for (NSDictionary *event in _mutableEvents) {
|
for (NSDictionary *event in _mutableEvents) {
|
||||||
@ -175,14 +153,9 @@
|
|||||||
if (!includeImplicitEvents && [eventAndImplicitFlag[FBSDK_APPEVENTSTATE_ISIMPLICIT_KEY] boolValue]) {
|
if (!includeImplicitEvents && [eventAndImplicitFlag[FBSDK_APPEVENTSTATE_ISIMPLICIT_KEY] boolValue]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
NSMutableDictionary *event = eventAndImplicitFlag[@"event"];
|
[events addObject: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];
|
return [FBSDKInternalUtility JSONStringForObject:events error:NULL invalidObjectHandler:NULL];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -62,11 +62,6 @@
|
|||||||
|
|
||||||
parameters[@"application_tracking_enabled"] = [@(!FBSDKSettings.limitEventAndDataUsage) stringValue];
|
parameters[@"application_tracking_enabled"] = [@(!FBSDKSettings.limitEventAndDataUsage) stringValue];
|
||||||
|
|
||||||
NSString *userID = [FBSDKAppEvents userID];
|
|
||||||
if (userID) {
|
|
||||||
parameters[@"app_user_id"] = userID;
|
|
||||||
}
|
|
||||||
|
|
||||||
[FBSDKAppEventsDeviceInfo extendDictionaryWithDeviceInfo:parameters];
|
[FBSDKAppEventsDeviceInfo extendDictionaryWithDeviceInfo:parameters];
|
||||||
|
|
||||||
static dispatch_once_t fetchBundleOnce;
|
static dispatch_once_t fetchBundleOnce;
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
#import "FBSDKLogger.h"
|
#import "FBSDKLogger.h"
|
||||||
#import "FBSDKSettings.h"
|
#import "FBSDKSettings.h"
|
||||||
|
|
||||||
static NSString *const FBSDKAppEventParameterImplicitlyLoggedPurchase = @"_implicitlyLogged";
|
static NSString *const FBSDKAppEventParameterImplicitlyLoggedPurchase = @"_implicitlyLoggedPurchaseEvent";
|
||||||
static NSString *const FBSDKAppEventNamePurchaseFailed = @"fb_mobile_purchase_failed";
|
static NSString *const FBSDKAppEventNamePurchaseFailed = @"fb_mobile_purchase_failed";
|
||||||
static NSString *const FBSDKAppEventParameterNameProductTitle = @"fb_content_title";
|
static NSString *const FBSDKAppEventParameterNameProductTitle = @"fb_content_title";
|
||||||
static NSString *const FBSDKAppEventParameterNameTransactionID = @"fb_transaction_id";
|
static NSString *const FBSDKAppEventParameterNameTransactionID = @"fb_transaction_id";
|
||||||
@ -121,10 +121,6 @@ static NSMutableArray *g_pendingRequestors;
|
|||||||
|
|
||||||
- (void)handleTransaction:(SKPaymentTransaction *)transaction
|
- (void)handleTransaction:(SKPaymentTransaction *)transaction
|
||||||
{
|
{
|
||||||
// Ignore restored transaction
|
|
||||||
if (transaction.originalTransaction != nil) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
FBSDKPaymentProductRequestor *productRequest = [[FBSDKPaymentProductRequestor alloc] initWithTransaction:transaction];
|
FBSDKPaymentProductRequestor *productRequest = [[FBSDKPaymentProductRequestor alloc] initWithTransaction:transaction];
|
||||||
[productRequest resolveProducts];
|
[productRequest resolveProducts];
|
||||||
}
|
}
|
||||||
@ -211,18 +207,18 @@ static NSMutableArray *g_pendingRequestors;
|
|||||||
|
|
||||||
SKPayment *payment = self.transaction.payment;
|
SKPayment *payment = self.transaction.payment;
|
||||||
NSMutableDictionary *eventParameters = [NSMutableDictionary dictionaryWithDictionary: @{
|
NSMutableDictionary *eventParameters = [NSMutableDictionary dictionaryWithDictionary: @{
|
||||||
FBSDKAppEventParameterNameContentID: payment.productIdentifier ?: @"",
|
FBSDKAppEventParameterNameContentID: payment.productIdentifier ?: @"",
|
||||||
FBSDKAppEventParameterNameNumItems: @(payment.quantity),
|
FBSDKAppEventParameterNameNumItems: @(payment.quantity),
|
||||||
}];
|
}];
|
||||||
double totalAmount = 0;
|
double totalAmount = 0;
|
||||||
if (product) {
|
if (product) {
|
||||||
totalAmount = payment.quantity * product.price.doubleValue;
|
totalAmount = payment.quantity * product.price.doubleValue;
|
||||||
[eventParameters addEntriesFromDictionary: @{
|
[eventParameters addEntriesFromDictionary: @{
|
||||||
FBSDKAppEventParameterNameCurrency: [product.priceLocale objectForKey:NSLocaleCurrencyCode],
|
FBSDKAppEventParameterNameCurrency: [product.priceLocale objectForKey:NSLocaleCurrencyCode],
|
||||||
FBSDKAppEventParameterNameNumItems: @(payment.quantity),
|
FBSDKAppEventParameterNameNumItems: @(payment.quantity),
|
||||||
FBSDKAppEventParameterNameProductTitle: [self getTruncatedString:product.localizedTitle],
|
FBSDKAppEventParameterNameProductTitle: [self getTruncatedString:product.localizedTitle],
|
||||||
FBSDKAppEventParameterNameDescription: [self getTruncatedString:product.localizedDescription],
|
FBSDKAppEventParameterNameDescription: [self getTruncatedString:product.localizedDescription],
|
||||||
}];
|
}];
|
||||||
if (transactionID) {
|
if (transactionID) {
|
||||||
[eventParameters setObject:transactionID forKey:FBSDKAppEventParameterNameTransactionID];
|
[eventParameters setObject:transactionID forKey:FBSDKAppEventParameterNameTransactionID];
|
||||||
}
|
}
|
||||||
@ -270,19 +266,10 @@ static NSMutableArray *g_pendingRequestors;
|
|||||||
valueToSum:(double)valueToSum
|
valueToSum:(double)valueToSum
|
||||||
parameters:(NSDictionary *)parameters {
|
parameters:(NSDictionary *)parameters {
|
||||||
NSMutableDictionary *eventParameters = [NSMutableDictionary dictionaryWithDictionary: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
|
[FBSDKAppEvents logEvent:eventName
|
||||||
valueToSum:valueToSum
|
valueToSum:valueToSum
|
||||||
parameters:eventParameters];
|
parameters:parameters];
|
||||||
|
|
||||||
// Unless the behavior is set to only allow explicit flushing, we go ahead and flush, since purchase events
|
// 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.
|
// are relatively rare and relatively high value and worth getting across on wire right away.
|
||||||
@ -291,11 +278,4 @@ 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
|
@end
|
||||||
|
|||||||
@ -60,8 +60,7 @@ NSString *const FBSDKBridgeAPIVersionKey = @"version";
|
|||||||
_protocolMap = @{
|
_protocolMap = @{
|
||||||
@(FBSDKBridgeAPIProtocolTypeNative): @{
|
@(FBSDKBridgeAPIProtocolTypeNative): @{
|
||||||
FBSDK_CANOPENURL_FACEBOOK:[[FBSDKBridgeAPIProtocolNativeV1 alloc] initWithAppScheme:@"fbapi20130214"],
|
FBSDK_CANOPENURL_FACEBOOK:[[FBSDKBridgeAPIProtocolNativeV1 alloc] initWithAppScheme:@"fbapi20130214"],
|
||||||
FBSDK_CANOPENURL_MESSENGER:[[FBSDKBridgeAPIProtocolNativeV1 alloc] initWithAppScheme:@"fb-messenger-share-api"],
|
FBSDK_CANOPENURL_MESSENGER:[[FBSDKBridgeAPIProtocolNativeV1 alloc] initWithAppScheme:@"fb-messenger-api20140430"]
|
||||||
FBSDK_CANOPENURL_MSQRD_PLAYER:[[FBSDKBridgeAPIProtocolNativeV1 alloc] initWithAppScheme:@"msqrdplayer-api20170208"]
|
|
||||||
},
|
},
|
||||||
@(FBSDKBridgeAPIProtocolTypeWeb): @{
|
@(FBSDKBridgeAPIProtocolTypeWeb): @{
|
||||||
@"https": [[FBSDKBridgeAPIProtocolWebV1 alloc] init],
|
@"https": [[FBSDKBridgeAPIProtocolWebV1 alloc] init],
|
||||||
|
|||||||
@ -61,7 +61,6 @@
|
|||||||
#import "FBSDKInternalUtility.h"
|
#import "FBSDKInternalUtility.h"
|
||||||
#import "FBSDKLogger.h"
|
#import "FBSDKLogger.h"
|
||||||
#import "FBSDKMath.h"
|
#import "FBSDKMath.h"
|
||||||
#import "FBSDKSettings+Internal.h"
|
|
||||||
#import "FBSDKTypeUtility.h"
|
#import "FBSDKTypeUtility.h"
|
||||||
#import "Network/FBSDKGraphRequest+Internal.h"
|
#import "Network/FBSDKGraphRequest+Internal.h"
|
||||||
#import "Network/FBSDKGraphRequestConnection+Internal.h"
|
#import "Network/FBSDKGraphRequestConnection+Internal.h"
|
||||||
|
|||||||
@ -21,8 +21,7 @@
|
|||||||
|
|
||||||
#define FBSDK_CANOPENURL_FACEBOOK @"fbauth2"
|
#define FBSDK_CANOPENURL_FACEBOOK @"fbauth2"
|
||||||
#define FBSDK_CANOPENURL_FBAPI @"fbapi"
|
#define FBSDK_CANOPENURL_FBAPI @"fbapi"
|
||||||
#define FBSDK_CANOPENURL_MESSENGER @"fb-messenger-share-api"
|
#define FBSDK_CANOPENURL_MESSENGER @"fb-messenger-api"
|
||||||
#define FBSDK_CANOPENURL_MSQRD_PLAYER @"msqrdplayer"
|
|
||||||
#define FBSDK_CANOPENURL_SHARE_EXTENSION @"fbshareextension"
|
#define FBSDK_CANOPENURL_SHARE_EXTENSION @"fbshareextension"
|
||||||
|
|
||||||
typedef NS_ENUM(int32_t, FBSDKUIKitVersion)
|
typedef NS_ENUM(int32_t, FBSDKUIKitVersion)
|
||||||
@ -89,7 +88,7 @@ typedef NS_ENUM(int32_t, FBSDKUIKitVersion)
|
|||||||
Changes in the system clock will affect this value.
|
Changes in the system clock will affect this value.
|
||||||
- Returns: The number of milliseconds since the Unix Epoch.
|
- Returns: The number of milliseconds since the Unix Epoch.
|
||||||
*/
|
*/
|
||||||
+ (uint64_t)currentTimeInMilliseconds;
|
+ (unsigned long)currentTimeInMilliseconds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets an object for a key in a dictionary if it is not nil.
|
Sets an object for a key in a dictionary if it is not nil.
|
||||||
@ -348,7 +347,6 @@ setJSONStringForObject:(id)object
|
|||||||
|
|
||||||
+ (BOOL)isFacebookAppInstalled;
|
+ (BOOL)isFacebookAppInstalled;
|
||||||
+ (BOOL)isMessengerAppInstalled;
|
+ (BOOL)isMessengerAppInstalled;
|
||||||
+ (BOOL)isMSQRDPlayerAppInstalled;
|
|
||||||
+ (void)checkRegisteredCanOpenURLScheme:(NSString *)urlScheme;
|
+ (void)checkRegisteredCanOpenURLScheme:(NSString *)urlScheme;
|
||||||
+ (BOOL)isRegisteredCanOpenURLScheme:(NSString *)urlScheme;
|
+ (BOOL)isRegisteredCanOpenURLScheme:(NSString *)urlScheme;
|
||||||
|
|
||||||
|
|||||||
@ -110,11 +110,11 @@ typedef NS_ENUM(NSUInteger, FBSDKInternalUtilityVersionShift)
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (uint64_t)currentTimeInMilliseconds
|
+ (unsigned long)currentTimeInMilliseconds
|
||||||
{
|
{
|
||||||
struct timeval time;
|
struct timeval time;
|
||||||
gettimeofday(&time, NULL);
|
gettimeofday(&time, NULL);
|
||||||
return ((uint64_t)time.tv_sec * 1000) + (time.tv_usec / 1000);
|
return (time.tv_sec * 1000) + (time.tv_usec / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (BOOL)dictionary:(NSMutableDictionary *)dictionary
|
+ (BOOL)dictionary:(NSMutableDictionary *)dictionary
|
||||||
@ -493,7 +493,11 @@ static NSMapTable *_transientObjects;
|
|||||||
dispatch_once(&onceToken, ^{
|
dispatch_once(&onceToken, ^{
|
||||||
[FBSDKInternalUtility checkRegisteredCanOpenURLScheme:FBSDK_CANOPENURL_FACEBOOK];
|
[FBSDKInternalUtility checkRegisteredCanOpenURLScheme:FBSDK_CANOPENURL_FACEBOOK];
|
||||||
});
|
});
|
||||||
return [self _canOpenURLScheme:FBSDK_CANOPENURL_FACEBOOK];
|
NSURLComponents *components = [[NSURLComponents alloc] init];
|
||||||
|
components.scheme = FBSDK_CANOPENURL_FACEBOOK;
|
||||||
|
components.path = @"/";
|
||||||
|
return [[UIApplication sharedApplication]
|
||||||
|
canOpenURL:components.URL];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (BOOL)isMessengerAppInstalled
|
+ (BOOL)isMessengerAppInstalled
|
||||||
@ -502,16 +506,12 @@ static NSMapTable *_transientObjects;
|
|||||||
dispatch_once(&onceToken, ^{
|
dispatch_once(&onceToken, ^{
|
||||||
[FBSDKInternalUtility checkRegisteredCanOpenURLScheme:FBSDK_CANOPENURL_MESSENGER];
|
[FBSDKInternalUtility checkRegisteredCanOpenURLScheme:FBSDK_CANOPENURL_MESSENGER];
|
||||||
});
|
});
|
||||||
return [self _canOpenURLScheme:FBSDK_CANOPENURL_MESSENGER];
|
NSURLComponents *components = [[NSURLComponents alloc] init];
|
||||||
}
|
components.scheme = FBSDK_CANOPENURL_MESSENGER;
|
||||||
|
components.path = @"/";
|
||||||
|
return [[UIApplication sharedApplication]
|
||||||
|
canOpenURL:components.URL];
|
||||||
|
|
||||||
+ (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
|
#pragma mark - Object Lifecycle
|
||||||
@ -583,14 +583,6 @@ static NSMapTable *_transientObjects;
|
|||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (BOOL)_canOpenURLScheme:(NSString *)scheme
|
|
||||||
{
|
|
||||||
NSURLComponents *components = [[NSURLComponents alloc] init];
|
|
||||||
components.scheme = scheme;
|
|
||||||
components.path = @"/";
|
|
||||||
return [[UIApplication sharedApplication] canOpenURL:components.URL];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (void)validateAppID
|
+ (void)validateAppID
|
||||||
{
|
{
|
||||||
if (![FBSDKSettings appID]) {
|
if (![FBSDKSettings appID]) {
|
||||||
|
|||||||
@ -163,11 +163,11 @@ static NSMutableDictionary *g_startTimesWithTags = nil;
|
|||||||
|
|
||||||
// Only log if there's been an associated start time.
|
// Only log if there's been an associated start time.
|
||||||
if (startTimeNumber) {
|
if (startTimeNumber) {
|
||||||
uint64_t elapsed = [FBSDKInternalUtility currentTimeInMilliseconds] - startTimeNumber.unsignedLongLongValue;
|
unsigned long elapsed = [FBSDKInternalUtility currentTimeInMilliseconds] - startTimeNumber.unsignedLongValue;
|
||||||
[g_startTimesWithTags removeObjectForKey:tagAsNumber]; // served its purpose, remove
|
[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.
|
// Log string is appended with "%d msec", with nothing intervening. This gives the most control to the caller.
|
||||||
logString = [NSString stringWithFormat:@"%@%llu msec", logString, elapsed];
|
logString = [NSString stringWithFormat:@"%@%lu msec", logString, elapsed];
|
||||||
|
|
||||||
[self singleShotLogEntry:loggingBehavior logEntry:logString];
|
[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."];
|
@"Unexpectedly large number of outstanding perf logging start times, something is likely wrong."];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t currTime = [FBSDKInternalUtility currentTimeInMilliseconds];
|
unsigned long currTime = [FBSDKInternalUtility currentTimeInMilliseconds];
|
||||||
|
|
||||||
// Treat the incoming object tag simply as an address, since it's only used to identify during lifetime. If
|
// 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.
|
// we send in as an object, the dictionary will try to copy it.
|
||||||
unsigned long tagAsNumber = (unsigned long)(__bridge void *)timestampTag;
|
unsigned long tagAsNumber = (unsigned long)(__bridge void *)timestampTag;
|
||||||
[g_startTimesWithTags setObject:@(currTime)
|
[g_startTimesWithTags setObject:[NSNumber numberWithUnsignedLong:currTime]
|
||||||
forKey:[NSNumber numberWithUnsignedLong:tagAsNumber]];
|
forKey:[NSNumber numberWithUnsignedLong:tagAsNumber]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,15 +16,14 @@
|
|||||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
// 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.
|
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#import <FBSDKCoreKit/FBSDKSettings.h>
|
#import "FBSDKAccessTokenCache.h"
|
||||||
|
#import "FBSDKSettings.h"
|
||||||
@protocol FBSDKAccessTokenCaching;
|
|
||||||
|
|
||||||
@interface FBSDKSettings(Internal)
|
@interface FBSDKSettings(Internal)
|
||||||
|
|
||||||
+ (NSObject<FBSDKAccessTokenCaching> *)accessTokenCache;
|
+ (FBSDKAccessTokenCache *)accessTokenCache;
|
||||||
|
|
||||||
+ (void)setAccessTokenCache:(NSObject<FBSDKAccessTokenCaching> *)accessTokenCache;
|
- (void)setAccessTokenCache;
|
||||||
|
|
||||||
+ (NSString *)graphAPIDebugParamValue;
|
+ (NSString *)graphAPIDebugParamValue;
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
#import "FBSDKSystemAccountStoreAdapter.h"
|
#import "FBSDKSystemAccountStoreAdapter.h"
|
||||||
|
|
||||||
#import "FBSDKAccessToken.h"
|
|
||||||
#import "FBSDKConstants.h"
|
#import "FBSDKConstants.h"
|
||||||
#import "FBSDKDynamicFrameworkLoader.h"
|
#import "FBSDKDynamicFrameworkLoader.h"
|
||||||
#import "FBSDKError.h"
|
#import "FBSDKError.h"
|
||||||
|
|||||||
@ -29,7 +29,7 @@
|
|||||||
@property (nonatomic, retain) NSMutableData *data;
|
@property (nonatomic, retain) NSMutableData *data;
|
||||||
@property (nonatomic, copy) FBSDKURLConnectionHandler handler;
|
@property (nonatomic, copy) FBSDKURLConnectionHandler handler;
|
||||||
@property (nonatomic, retain) NSURLResponse *response;
|
@property (nonatomic, retain) NSURLResponse *response;
|
||||||
@property (nonatomic, assign) uint64_t requestStartTime;
|
@property (nonatomic) unsigned long requestStartTime;
|
||||||
@property (nonatomic, readonly) NSUInteger loggerSerialNumber;
|
@property (nonatomic, readonly) NSUInteger loggerSerialNumber;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@ -83,7 +83,7 @@
|
|||||||
responseData:(NSData *)responseData {
|
responseData:(NSData *)responseData {
|
||||||
// Basic FBSDKURLConnection logging just prints out the URL. FBSDKGraphRequest logging provides more details.
|
// Basic FBSDKURLConnection logging just prints out the URL. FBSDKGraphRequest logging provides more details.
|
||||||
NSString *mimeType = [response MIMEType];
|
NSString *mimeType = [response MIMEType];
|
||||||
NSMutableString *mutableLogEntry = [NSMutableString stringWithFormat:@"FBSDKURLConnection <#%lu>:\n Duration: %llu msec\nResponse Size: %lu kB\n MIME type: %@\n",
|
NSMutableString *mutableLogEntry = [NSMutableString stringWithFormat:@"FBSDKURLConnection <#%lu>:\n Duration: %lu msec\nResponse Size: %lu kB\n MIME type: %@\n",
|
||||||
(unsigned long)self.loggerSerialNumber,
|
(unsigned long)self.loggerSerialNumber,
|
||||||
[FBSDKInternalUtility currentTimeInMilliseconds] - self.requestStartTime,
|
[FBSDKInternalUtility currentTimeInMilliseconds] - self.requestStartTime,
|
||||||
(unsigned long)[responseData length] / 1024,
|
(unsigned long)[responseData length] / 1024,
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
@property (nonatomic, strong) NSURLSessionTask *task;
|
@property (nonatomic, strong) NSURLSessionTask *task;
|
||||||
@property (nonatomic, copy) FBSDKURLSessionTaskHandler handler;
|
@property (nonatomic, copy) FBSDKURLSessionTaskHandler handler;
|
||||||
@property (nonatomic, assign) uint64_t requestStartTime;
|
@property (nonatomic, assign) unsigned long requestStartTime;
|
||||||
@property (nonatomic, assign, readonly) NSUInteger loggerSerialNumber;
|
@property (nonatomic, assign, readonly) NSUInteger loggerSerialNumber;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@ -85,7 +85,7 @@
|
|||||||
responseData:(NSData *)responseData {
|
responseData:(NSData *)responseData {
|
||||||
// Basic FBSDKURLSessionTask logging just prints out the URL. FBSDKGraphRequest logging provides more details.
|
// Basic FBSDKURLSessionTask logging just prints out the URL. FBSDKGraphRequest logging provides more details.
|
||||||
NSString *mimeType = [response MIMEType];
|
NSString *mimeType = [response MIMEType];
|
||||||
NSMutableString *mutableLogEntry = [NSMutableString stringWithFormat:@"FBSDKURLSessionTask <#%lu>:\n Duration: %llu msec\nResponse Size: %lu kB\n MIME type: %@\n",
|
NSMutableString *mutableLogEntry = [NSMutableString stringWithFormat:@"FBSDKURLSessionTask <#%lu>:\n Duration: %lu msec\nResponse Size: %lu kB\n MIME type: %@\n",
|
||||||
(unsigned long)self.loggerSerialNumber,
|
(unsigned long)self.loggerSerialNumber,
|
||||||
[FBSDKInternalUtility currentTimeInMilliseconds] - self.requestStartTime,
|
[FBSDKInternalUtility currentTimeInMilliseconds] - self.requestStartTime,
|
||||||
(unsigned long)[responseData length] / 1024,
|
(unsigned long)[responseData length] / 1024,
|
||||||
|
|||||||
@ -33,7 +33,6 @@
|
|||||||
static int const FBClientStateChallengeLength = 20;
|
static int const FBClientStateChallengeLength = 20;
|
||||||
static NSString *const FBSDKExpectedChallengeKey = @"expected_login_challenge";
|
static NSString *const FBSDKExpectedChallengeKey = @"expected_login_challenge";
|
||||||
static NSString *const FBSDKOauthPath = @"/dialog/oauth";
|
static NSString *const FBSDKOauthPath = @"/dialog/oauth";
|
||||||
static NSString *const SFVCCanceledLogin = @"com.apple.SafariServices.Authentication";
|
|
||||||
|
|
||||||
typedef NS_ENUM(NSInteger, FBSDKLoginManagerState) {
|
typedef NS_ENUM(NSInteger, FBSDKLoginManagerState) {
|
||||||
FBSDKLoginManagerStateIdle,
|
FBSDKLoginManagerStateIdle,
|
||||||
@ -387,8 +386,6 @@ typedef NS_ENUM(NSInteger, FBSDKLoginManagerState) {
|
|||||||
if (didPerformLogIn) {
|
if (didPerformLogIn) {
|
||||||
[_logger startAuthMethod:authMethod];
|
[_logger startAuthMethod:authMethod];
|
||||||
_state = FBSDKLoginManagerStatePerformingLogin;
|
_state = FBSDKLoginManagerStatePerformingLogin;
|
||||||
} else if (error && [error.domain isEqualToString:SFVCCanceledLogin]) {
|
|
||||||
[self handleImplicitCancelOfLogIn];
|
|
||||||
} else {
|
} else {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
error = [NSError errorWithDomain:FBSDKLoginErrorDomain code:FBSDKLoginUnknownErrorCode userInfo:nil];
|
error = [NSError errorWithDomain:FBSDKLoginErrorDomain code:FBSDKLoginUnknownErrorCode userInfo:nil];
|
||||||
@ -599,7 +596,7 @@ typedef NS_ENUM(NSInteger, FBSDKLoginManagerState) {
|
|||||||
BOOL isFacebookURL = [[url scheme] hasPrefix:[NSString stringWithFormat:@"fb%@", [FBSDKSettings appID]]] &&
|
BOOL isFacebookURL = [[url scheme] hasPrefix:[NSString stringWithFormat:@"fb%@", [FBSDKSettings appID]]] &&
|
||||||
[[url host] isEqualToString:@"authorize"];
|
[[url host] isEqualToString:@"authorize"];
|
||||||
|
|
||||||
BOOL isExpectedSourceApplication = [sourceApplication hasPrefix:@"com.facebook"] || [sourceApplication hasPrefix:@"com.apple"] || [sourceApplication hasPrefix:@"com.burbn"];
|
BOOL isExpectedSourceApplication = [sourceApplication hasPrefix:@"com.facebook"] || [sourceApplication hasPrefix:@"com.apple"];
|
||||||
|
|
||||||
return isFacebookURL && isExpectedSourceApplication;
|
return isFacebookURL && isExpectedSourceApplication;
|
||||||
}
|
}
|
||||||
@ -687,7 +684,7 @@ typedef NS_ENUM(NSInteger, FBSDKLoginManagerState) {
|
|||||||
audience = nil;
|
audience = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t timePriorToSystemAuthUI = [FBSDKInternalUtility currentTimeInMilliseconds];
|
unsigned long timePriorToSystemAuthUI = [FBSDKInternalUtility currentTimeInMilliseconds];
|
||||||
|
|
||||||
// the FBSDKSystemAccountStoreAdapter completion handler maintains the strong reference during the the asynchronous operation
|
// the FBSDKSystemAccountStoreAdapter completion handler maintains the strong reference during the the asynchronous operation
|
||||||
[[FBSDKSystemAccountStoreAdapter sharedInstance]
|
[[FBSDKSystemAccountStoreAdapter sharedInstance]
|
||||||
|
|||||||
@ -24,67 +24,65 @@
|
|||||||
@protocol FBSDKAppInviteDialogDelegate;
|
@protocol FBSDKAppInviteDialogDelegate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A dialog for sending App Invites.
|
A dialog for sending App Invites.
|
||||||
*/
|
*/
|
||||||
@interface FBSDKAppInviteDialog : NSObject
|
@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 viewController: A UIViewController to present the dialog from.
|
||||||
- Parameter content: The content for the app invite.
|
- Parameter content: The content for the app invite.
|
||||||
- Parameter delegate: The receiver's delegate.
|
- Parameter delegate: The receiver's delegate.
|
||||||
- Warning: This method is deprecated.
|
*/
|
||||||
*/
|
|
||||||
+ (instancetype)showFromViewController:(UIViewController *)viewController
|
+ (instancetype)showFromViewController:(UIViewController *)viewController
|
||||||
withContent:(FBSDKAppInviteContent *)content
|
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
|
+ (instancetype)showWithContent:(FBSDKAppInviteContent *)content delegate:(id<FBSDKAppInviteDialogDelegate>)delegate
|
||||||
__attribute__ ((deprecated("use showFromViewController:withContent:delegate: instead")));
|
__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.
|
If not specified, the top most view controller will be automatically determined as best as possible.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, weak) UIViewController *fromViewController;
|
@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;
|
@property (nonatomic, weak) id<FBSDKAppInviteDialogDelegate> delegate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The content for app invite.
|
The content for app invite.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, copy) FBSDKAppInviteContent *content;
|
@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
|
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
|
required but not available. This method does not validate the content on the receiver, so this can be checked before
|
||||||
building up the content.
|
building up the content.
|
||||||
|
|
||||||
- See:validateWithError:
|
- See:validateWithError:
|
||||||
- Returns: YES if the receiver can show the dialog, otherwise NO.
|
- Returns: YES if the receiver can show the dialog, otherwise NO.
|
||||||
*/
|
*/
|
||||||
- (BOOL)canShow;
|
- (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.
|
- Returns: YES if the receiver was able to show the dialog, otherwise NO.
|
||||||
*/
|
*/
|
||||||
- (BOOL)show;
|
- (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.
|
- 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.
|
- Returns: YES if the content is valid, otherwise NO.
|
||||||
*/
|
*/
|
||||||
@ -93,7 +91,7 @@ __attribute__ ((deprecated("use showFromViewController:withContent:delegate: ins
|
|||||||
@end
|
@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
|
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
|
receive the information. For example, if the person is not signed into the containing app, the shower may not be able
|
||||||
@ -102,14 +100,14 @@ __attribute__ ((deprecated("use showFromViewController:withContent:delegate: ins
|
|||||||
@protocol FBSDKAppInviteDialogDelegate <NSObject>
|
@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 appInviteDialog: The FBSDKAppInviteDialog that completed.
|
||||||
- Parameter results: The results from the dialog. This may be nil or empty.
|
- Parameter results: The results from the dialog. This may be nil or empty.
|
||||||
*/
|
*/
|
||||||
- (void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didCompleteWithResults:(NSDictionary *)results;
|
- (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 appInviteDialog: The FBSDKAppInviteDialog that completed.
|
||||||
- Parameter error: The error.
|
- Parameter error: The error.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -46,24 +46,118 @@
|
|||||||
return [self showFromViewController:nil withContent:content delegate:delegate];
|
return [self showFromViewController:nil withContent:content delegate:delegate];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
+ (instancetype)showFromViewController:(UIViewController *)viewController
|
+ (instancetype)showFromViewController:(UIViewController *)viewController
|
||||||
withContent:(FBSDKAppInviteContent *)content
|
withContent:(FBSDKAppInviteContent *)content
|
||||||
delegate:(id<FBSDKAppInviteDialogDelegate>)delegate;
|
delegate:(id<FBSDKAppInviteDialogDelegate>)delegate;
|
||||||
{
|
{
|
||||||
return nil;
|
FBSDKAppInviteDialog *appInvite = [[self alloc] init];
|
||||||
|
appInvite.content = content;
|
||||||
|
appInvite.delegate = delegate;
|
||||||
|
appInvite.fromViewController = viewController;
|
||||||
|
[appInvite show];
|
||||||
|
return appInvite;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Public Methods
|
#pragma mark - Public Methods
|
||||||
|
|
||||||
- (BOOL)canShow
|
- (BOOL)canShow
|
||||||
{
|
{
|
||||||
return NO;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)show
|
- (BOOL)show
|
||||||
{
|
{
|
||||||
return NO;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)validateWithError:(NSError *__autoreleasing *)errorRef
|
- (BOOL)validateWithError:(NSError *__autoreleasing *)errorRef
|
||||||
@ -71,4 +165,67 @@
|
|||||||
return [FBSDKShareUtility validateAppInviteContent:self.content error:errorRef];
|
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
|
@end
|
||||||
|
|||||||
@ -1,57 +0,0 @@
|
|||||||
// 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
|
|
||||||
@ -1,177 +0,0 @@
|
|||||||
// 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
|
|
||||||
@ -1,43 +0,0 @@
|
|||||||
// 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
|
|
||||||
@ -1,132 +0,0 @@
|
|||||||
// 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,7 +24,6 @@
|
|||||||
#import <FBSDKShareKit/FBSDKLiking.h>
|
#import <FBSDKShareKit/FBSDKLiking.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Warning: This class is deprecated.
|
|
||||||
A button to like an object.
|
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
|
Tapping the receiver will invoke an API call to the Facebook app through a fast-app-switch that allows
|
||||||
@ -32,7 +31,6 @@
|
|||||||
currentAccessToken has "publish_actions" permission and the object is an Open Graph object, then the like can happen
|
currentAccessToken has "publish_actions" permission and the object is an Open Graph object, then the like can happen
|
||||||
seamlessly without the fast-app-switch.
|
seamlessly without the fast-app-switch.
|
||||||
*/
|
*/
|
||||||
__attribute__ ((deprecated))
|
|
||||||
@interface FBSDKLikeButton : FBSDKButton <FBSDKLiking>
|
@interface FBSDKLikeButton : FBSDKButton <FBSDKLiking>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -83,7 +83,7 @@ typedef NS_ENUM(NSUInteger, FBSDKLikeControlStyle)
|
|||||||
FBSDK_EXTERN NSString *NSStringFromFBSDKLikeControlStyle(FBSDKLikeControlStyle style);
|
FBSDK_EXTERN NSString *NSStringFromFBSDKLikeControlStyle(FBSDKLikeControlStyle style);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Warning: This class is deprecated.
|
|
||||||
UI control to like an object in the Facebook graph.
|
UI control to like an object in the Facebook graph.
|
||||||
|
|
||||||
|
|
||||||
@ -91,7 +91,6 @@ 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
|
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.
|
with the new state and send actions for the UIControlEventValueChanged event.
|
||||||
*/
|
*/
|
||||||
__attribute__ ((deprecated))
|
|
||||||
@interface FBSDKLikeControl : UIControl <FBSDKLiking>
|
@interface FBSDKLikeControl : UIControl <FBSDKLiking>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -22,14 +22,12 @@
|
|||||||
#import "FBSDKShareConstants.h"
|
#import "FBSDKShareConstants.h"
|
||||||
#import "FBSDKShareDefines.h"
|
#import "FBSDKShareDefines.h"
|
||||||
#import "FBSDKShareError.h"
|
#import "FBSDKShareError.h"
|
||||||
#import "FBSDKShareMessengerGenericTemplateContent.h"
|
|
||||||
#import "FBSDKShareMessengerMediaTemplateContent.h"
|
|
||||||
#import "FBSDKShareMessengerOpenGraphMusicTemplateContent.h"
|
|
||||||
#import "FBSDKShareOpenGraphContent.h"
|
#import "FBSDKShareOpenGraphContent.h"
|
||||||
#import "FBSDKShareUtility.h"
|
#import "FBSDKShareUtility.h"
|
||||||
#import "FBSDKShareVideoContent.h"
|
#import "FBSDKShareVideoContent.h"
|
||||||
|
|
||||||
#define FBSDK_MESSAGE_DIALOG_APP_SCHEME @"fb-messenger-share-api"
|
#define FBSDK_MESSAGE_DIALOG_APP_SCHEME @"fb-messenger-api"
|
||||||
|
#define FBSDK_MESSAGE_METHOD_MIN_VERSION @"20140430"
|
||||||
|
|
||||||
@implementation FBSDKMessageDialog
|
@implementation FBSDKMessageDialog
|
||||||
|
|
||||||
@ -89,7 +87,7 @@
|
|||||||
request = [FBSDKBridgeAPIRequest bridgeAPIRequestWithProtocolType:FBSDKBridgeAPIProtocolTypeNative
|
request = [FBSDKBridgeAPIRequest bridgeAPIRequestWithProtocolType:FBSDKBridgeAPIProtocolTypeNative
|
||||||
scheme:FBSDK_MESSAGE_DIALOG_APP_SCHEME
|
scheme:FBSDK_MESSAGE_DIALOG_APP_SCHEME
|
||||||
methodName:methodName
|
methodName:methodName
|
||||||
methodVersion:nil
|
methodVersion:FBSDK_MESSAGE_METHOD_MIN_VERSION
|
||||||
parameters:parameters
|
parameters:parameters
|
||||||
userInfo:nil];
|
userInfo:nil];
|
||||||
FBSDKServerConfiguration *configuration = [FBSDKServerConfigurationManager cachedServerConfiguration];
|
FBSDKServerConfiguration *configuration = [FBSDKServerConfigurationManager cachedServerConfiguration];
|
||||||
@ -122,13 +120,6 @@
|
|||||||
return NO;
|
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];
|
return [FBSDKShareUtility validateShareContent:self.shareContent error:errorRef];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,19 +211,11 @@
|
|||||||
contentType = FBSDKAppEventsDialogShareContentTypePhoto;
|
contentType = FBSDKAppEventsDialogShareContentTypePhoto;
|
||||||
} else if ([self.shareContent isKindOfClass:[FBSDKShareVideoContent class]]) {
|
} else if ([self.shareContent isKindOfClass:[FBSDKShareVideoContent class]]) {
|
||||||
contentType = FBSDKAppEventsDialogShareContentTypeVideo;
|
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 {
|
} else {
|
||||||
contentType = FBSDKAppEventsDialogShareContentTypeUnknown;
|
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
|
[FBSDKAppEvents logImplicitEvent:FBSDKAppEventNameFBSDKEventMessengerShareDialogShow
|
||||||
valueToSum:nil
|
valueToSum:nil
|
||||||
|
|||||||
@ -1,52 +0,0 @@
|
|||||||
// 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
|
|
||||||
@ -1,163 +0,0 @@
|
|||||||
// 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,7 +36,6 @@
|
|||||||
#import "FBSDKShareVideoContent.h"
|
#import "FBSDKShareVideoContent.h"
|
||||||
|
|
||||||
#define FBSDK_SHARE_FEED_METHOD_NAME @"feed"
|
#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_MIN_VERSION @"20130410"
|
||||||
#define FBSDK_SHARE_METHOD_OG_MIN_VERSION @"20130214"
|
#define FBSDK_SHARE_METHOD_OG_MIN_VERSION @"20130214"
|
||||||
#define FBSDK_SHARE_METHOD_OG_IMAGE_MIN_VERSION @"20130410"
|
#define FBSDK_SHARE_METHOD_OG_IMAGE_MIN_VERSION @"20130410"
|
||||||
@ -233,9 +232,6 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
|||||||
|
|
||||||
-(BOOL)_isDefaultToShareSheet
|
-(BOOL)_isDefaultToShareSheet
|
||||||
{
|
{
|
||||||
if ([self.shareContent isKindOfClass:[FBSDKShareCameraEffectContent class]]) {
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
FBSDKServerConfiguration *configuration = [FBSDKServerConfigurationManager cachedServerConfiguration];
|
FBSDKServerConfiguration *configuration = [FBSDKServerConfigurationManager cachedServerConfiguration];
|
||||||
return [configuration.defaultShareMode isEqualToString:@"share_sheet"];
|
return [configuration.defaultShareMode isEqualToString:@"share_sheet"];
|
||||||
}
|
}
|
||||||
@ -265,16 +261,6 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
|||||||
(!useNativeDialog && [self _showNativeWithCanShowError:NULL validationError:errorRef]));
|
(!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
|
- (void)_loadNativeMethodName:(NSString **)methodNameRef methodVersion:(NSString **)methodVersionRef
|
||||||
{
|
{
|
||||||
if (methodNameRef != NULL) {
|
if (methodNameRef != NULL) {
|
||||||
@ -302,9 +288,6 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
|||||||
} else {
|
} else {
|
||||||
methodVersion = FBSDK_SHARE_METHOD_OG_MIN_VERSION;
|
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 {
|
} else {
|
||||||
methodName = FBSDK_SHARE_METHOD_NAME;
|
methodName = FBSDK_SHARE_METHOD_NAME;
|
||||||
if ([shareContent isKindOfClass:[FBSDKSharePhotoContent class]]) {
|
if ([shareContent isKindOfClass:[FBSDKSharePhotoContent class]]) {
|
||||||
@ -330,18 +313,12 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
|||||||
|
|
||||||
- (BOOL)_canShowShareSheet
|
- (BOOL)_canShowShareSheet
|
||||||
{
|
{
|
||||||
if (![FBSDKInternalUtility isFacebookAppInstalled]) {
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
Class composeViewControllerClass = [fbsdkdfl_SLComposeViewControllerClass() class];
|
Class composeViewControllerClass = [fbsdkdfl_SLComposeViewControllerClass() class];
|
||||||
if (!composeViewControllerClass) {
|
if (!composeViewControllerClass) {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
// iOS 11 returns NO for `isAvailableForServiceType` but it will still work
|
|
||||||
NSString *facebookServiceType = fbsdkdfl_SLServiceTypeFacebook();
|
NSString *facebookServiceType = fbsdkdfl_SLServiceTypeFacebook();
|
||||||
NSOperatingSystemVersion iOS11Version = { .majorVersion = 11, .minorVersion = 0, .patchVersion = 0 };
|
if (![composeViewControllerClass isAvailableForServiceType:facebookServiceType]) {
|
||||||
if (![FBSDKInternalUtility isOSRunTimeVersionAtLeast:iOS11Version] && ![composeViewControllerClass isAvailableForServiceType:facebookServiceType]) {
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
return YES;
|
return YES;
|
||||||
@ -610,7 +587,7 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
|||||||
shouldFailOnDataError:self.shouldFailOnDataError];
|
shouldFailOnDataError:self.shouldFailOnDataError];
|
||||||
FBSDKBridgeAPIRequest *request;
|
FBSDKBridgeAPIRequest *request;
|
||||||
request = [FBSDKBridgeAPIRequest bridgeAPIRequestWithProtocolType:FBSDKBridgeAPIProtocolTypeNative
|
request = [FBSDKBridgeAPIRequest bridgeAPIRequestWithProtocolType:FBSDKBridgeAPIProtocolTypeNative
|
||||||
scheme:[self _nativeScheme]
|
scheme:FBSDK_CANOPENURL_FACEBOOK
|
||||||
methodName:methodName
|
methodName:methodName
|
||||||
methodVersion:methodVersion
|
methodVersion:methodVersion
|
||||||
parameters:parameters
|
parameters:parameters
|
||||||
@ -737,18 +714,12 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
|||||||
|
|
||||||
- (BOOL)_useNativeDialog
|
- (BOOL)_useNativeDialog
|
||||||
{
|
{
|
||||||
if ([self.shareContent isKindOfClass:[FBSDKShareCameraEffectContent class]]) {
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
FBSDKServerConfiguration *configuration = [FBSDKServerConfigurationManager cachedServerConfiguration];
|
FBSDKServerConfiguration *configuration = [FBSDKServerConfigurationManager cachedServerConfiguration];
|
||||||
return [configuration useNativeDialogForDialogName:FBSDKDialogConfigurationNameShare];
|
return [configuration useNativeDialogForDialogName:FBSDKDialogConfigurationNameShare];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)_useSafariViewController
|
- (BOOL)_useSafariViewController
|
||||||
{
|
{
|
||||||
if ([self.shareContent isKindOfClass:[FBSDKShareCameraEffectContent class]]) {
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
FBSDKServerConfiguration *configuration = [FBSDKServerConfigurationManager cachedServerConfiguration];
|
FBSDKServerConfiguration *configuration = [FBSDKServerConfigurationManager cachedServerConfiguration];
|
||||||
return [configuration useSafariViewControllerForDialogName:FBSDKDialogConfigurationNameShare];
|
return [configuration useSafariViewControllerForDialogName:FBSDKDialogConfigurationNameShare];
|
||||||
}
|
}
|
||||||
@ -837,14 +808,6 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
|||||||
- (BOOL)_validateShareContentForBrowser:(NSError **)errorRef
|
- (BOOL)_validateShareContentForBrowser:(NSError **)errorRef
|
||||||
{
|
{
|
||||||
id<FBSDKSharingContent> shareContent = self.shareContent;
|
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 containsMedia;
|
||||||
BOOL containsPhotos;
|
BOOL containsPhotos;
|
||||||
[FBSDKShareUtility testShareContent:shareContent containsMedia:&containsMedia containsPhotos:&containsPhotos containsVideos:NULL];
|
[FBSDKShareUtility testShareContent:shareContent containsMedia:&containsMedia containsPhotos:&containsPhotos containsVideos:NULL];
|
||||||
@ -889,13 +852,6 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
|||||||
message:@"Feed share dialogs support FBSDKShareLinkContent."];
|
message:@"Feed share dialogs support FBSDKShareLinkContent."];
|
||||||
}
|
}
|
||||||
return NO;
|
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;
|
return YES;
|
||||||
}
|
}
|
||||||
@ -960,13 +916,6 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
|||||||
*errorRef = [FBSDKShareError invalidArgumentErrorWithName:@"shareContent" value:shareContent message:message];
|
*errorRef = [FBSDKShareError invalidArgumentErrorWithName:@"shareContent" value:shareContent message:message];
|
||||||
}
|
}
|
||||||
return NO;
|
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;
|
return YES;
|
||||||
}
|
}
|
||||||
@ -1054,8 +1003,6 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
|
|||||||
contentType = FBSDKAppEventsDialogShareContentTypePhoto;
|
contentType = FBSDKAppEventsDialogShareContentTypePhoto;
|
||||||
} else if ([self.shareContent isKindOfClass:[FBSDKShareVideoContent class]]) {
|
} else if ([self.shareContent isKindOfClass:[FBSDKShareVideoContent class]]) {
|
||||||
contentType = FBSDKAppEventsDialogShareContentTypeVideo;
|
contentType = FBSDKAppEventsDialogShareContentTypeVideo;
|
||||||
} else if ([self.shareContent isKindOfClass:[FBSDKShareCameraEffectContent class]]) {
|
|
||||||
contentType = FBSDKAppEventsDialogShareContentTypeCamera;
|
|
||||||
} else {
|
} else {
|
||||||
contentType = FBSDKAppEventsDialogShareContentTypeUnknown;
|
contentType = FBSDKAppEventsDialogShareContentTypeUnknown;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,13 +22,6 @@
|
|||||||
#import <FBSDKShareKit/FBSDKShareAPI.h>
|
#import <FBSDKShareKit/FBSDKShareAPI.h>
|
||||||
#import <FBSDKShareKit/FBSDKShareConstants.h>
|
#import <FBSDKShareKit/FBSDKShareConstants.h>
|
||||||
#import <FBSDKShareKit/FBSDKShareLinkContent.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/FBSDKShareOpenGraphAction.h>
|
||||||
#import <FBSDKShareKit/FBSDKShareOpenGraphContent.h>
|
#import <FBSDKShareKit/FBSDKShareOpenGraphContent.h>
|
||||||
#import <FBSDKShareKit/FBSDKShareOpenGraphObject.h>
|
#import <FBSDKShareKit/FBSDKShareOpenGraphObject.h>
|
||||||
@ -52,9 +45,9 @@
|
|||||||
#import <FBSDKShareKit/FBSDKLikeObjectType.h>
|
#import <FBSDKShareKit/FBSDKLikeObjectType.h>
|
||||||
#import <FBSDKShareKit/FBSDKMessageDialog.h>
|
#import <FBSDKShareKit/FBSDKMessageDialog.h>
|
||||||
#import <FBSDKShareKit/FBSDKShareButton.h>
|
#import <FBSDKShareKit/FBSDKShareButton.h>
|
||||||
#import <FBSDKShareKit/FBSDKShareCameraEffectContent.h>
|
|
||||||
#import <FBSDKShareKit/FBSDKShareDialog.h>
|
#import <FBSDKShareKit/FBSDKShareDialog.h>
|
||||||
#import <FBSDKShareKit/FBSDKShareDialogMode.h>
|
#import <FBSDKShareKit/FBSDKShareDialogMode.h>
|
||||||
|
#import <FBSDKShareKit/FBSDKShareMediaContent.h>
|
||||||
#import <FBSDKShareKit/FBSDKSendButton.h>
|
#import <FBSDKShareKit/FBSDKSendButton.h>
|
||||||
#else
|
#else
|
||||||
#import <FBSDKShareKit/FBSDKDeviceShareViewController.h>
|
#import <FBSDKShareKit/FBSDKDeviceShareViewController.h>
|
||||||
|
|||||||
@ -30,10 +30,8 @@
|
|||||||
#define FBSDK_SHARE_STATUS_CONTENT_PEOPLE_IDS_KEY @"peopleIDs"
|
#define FBSDK_SHARE_STATUS_CONTENT_PEOPLE_IDS_KEY @"peopleIDs"
|
||||||
#define FBSDK_SHARE_STATUS_CONTENT_PLACE_ID_KEY @"placeID"
|
#define FBSDK_SHARE_STATUS_CONTENT_PLACE_ID_KEY @"placeID"
|
||||||
#define FBSDK_SHARE_STATUS_CONTENT_REF_KEY @"ref"
|
#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_QUOTE_TEXT_KEY @"quote"
|
||||||
#define FBSDK_SHARE_STATUS_CONTENT_FEED_PARAMETERS_KEY @"feedParameters"
|
#define FBSDK_SHARE_STATUS_CONTENT_FEED_PARAMETERS_KEY @"feedParameters"
|
||||||
#define FBSDK_SHARE_STATUS_CONTENT_UUID_KEY @"uuid"
|
|
||||||
|
|
||||||
@implementation FBSDKShareLinkContent
|
@implementation FBSDKShareLinkContent
|
||||||
|
|
||||||
@ -44,23 +42,8 @@
|
|||||||
@synthesize peopleIDs = _peopleIDs;
|
@synthesize peopleIDs = _peopleIDs;
|
||||||
@synthesize placeID = _placeID;
|
@synthesize placeID = _placeID;
|
||||||
@synthesize ref = _ref;
|
@synthesize ref = _ref;
|
||||||
@synthesize pageID = _pageID;
|
|
||||||
@synthesize feedParameters = _feedParameters;
|
@synthesize feedParameters = _feedParameters;
|
||||||
@synthesize quote = _quote;
|
@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
|
- (void)setPeopleIDs:(NSArray *)peopleIDs
|
||||||
{
|
{
|
||||||
@ -89,11 +72,9 @@
|
|||||||
[_peopleIDs hash],
|
[_peopleIDs hash],
|
||||||
[_placeID hash],
|
[_placeID hash],
|
||||||
[_ref hash],
|
[_ref hash],
|
||||||
[_pageID hash],
|
|
||||||
[_contentTitle hash],
|
[_contentTitle hash],
|
||||||
[_feedParameters hash],
|
[_feedParameters hash],
|
||||||
[_quote hash],
|
[_quote hash],
|
||||||
[_shareUUID hash],
|
|
||||||
};
|
};
|
||||||
return [FBSDKMath hashWithIntegerArray:subhashes count:sizeof(subhashes) / sizeof(subhashes[0])];
|
return [FBSDKMath hashWithIntegerArray:subhashes count:sizeof(subhashes) / sizeof(subhashes[0])];
|
||||||
}
|
}
|
||||||
@ -122,9 +103,7 @@
|
|||||||
[FBSDKInternalUtility object:_imageURL isEqualToObject:content.imageURL] &&
|
[FBSDKInternalUtility object:_imageURL isEqualToObject:content.imageURL] &&
|
||||||
[FBSDKInternalUtility object:_peopleIDs isEqualToObject:content.peopleIDs] &&
|
[FBSDKInternalUtility object:_peopleIDs isEqualToObject:content.peopleIDs] &&
|
||||||
[FBSDKInternalUtility object:_placeID isEqualToObject:content.placeID] &&
|
[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];
|
[FBSDKInternalUtility object:_quote isEqualToObject:content.quote];
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
}
|
}
|
||||||
@ -149,9 +128,7 @@
|
|||||||
_peopleIDs = [decoder decodeObjectOfClass:[NSArray class] forKey:FBSDK_SHARE_STATUS_CONTENT_PEOPLE_IDS_KEY];
|
_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];
|
_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];
|
_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];
|
_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;
|
return self;
|
||||||
}
|
}
|
||||||
@ -167,9 +144,7 @@
|
|||||||
[encoder encodeObject:_peopleIDs forKey:FBSDK_SHARE_STATUS_CONTENT_PEOPLE_IDS_KEY];
|
[encoder encodeObject:_peopleIDs forKey:FBSDK_SHARE_STATUS_CONTENT_PEOPLE_IDS_KEY];
|
||||||
[encoder encodeObject:_placeID forKey:FBSDK_SHARE_STATUS_CONTENT_PLACE_ID_KEY];
|
[encoder encodeObject:_placeID forKey:FBSDK_SHARE_STATUS_CONTENT_PLACE_ID_KEY];
|
||||||
[encoder encodeObject:_ref forKey:FBSDK_SHARE_STATUS_CONTENT_REF_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:_quote forKey:FBSDK_SHARE_STATUS_CONTENT_QUOTE_TEXT_KEY];
|
||||||
[encoder encodeObject:_shareUUID forKey:FBSDK_SHARE_STATUS_CONTENT_UUID_KEY];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - NSCopying
|
#pragma mark - NSCopying
|
||||||
@ -186,9 +161,7 @@
|
|||||||
copy->_peopleIDs = [_peopleIDs copy];
|
copy->_peopleIDs = [_peopleIDs copy];
|
||||||
copy->_placeID = [_placeID copy];
|
copy->_placeID = [_placeID copy];
|
||||||
copy->_ref = [_ref copy];
|
copy->_ref = [_ref copy];
|
||||||
copy->_pageID = [_pageID copy];
|
|
||||||
copy->_quote = [_quote copy];
|
copy->_quote = [_quote copy];
|
||||||
copy->_shareUUID = [_shareUUID copy];
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,8 +30,6 @@
|
|||||||
#define FBSDK_SHARE_MEDIA_CONTENT_MEDIA_KEY @"media"
|
#define FBSDK_SHARE_MEDIA_CONTENT_MEDIA_KEY @"media"
|
||||||
#define FBSDK_SHARE_MEDIA_CONTENT_PLACE_ID_KEY @"placeID"
|
#define FBSDK_SHARE_MEDIA_CONTENT_PLACE_ID_KEY @"placeID"
|
||||||
#define FBSDK_SHARE_MEDIA_CONTENT_REF_KEY @"ref"
|
#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
|
@implementation FBSDKShareMediaContent
|
||||||
|
|
||||||
@ -42,21 +40,6 @@
|
|||||||
@synthesize peopleIDs = _peopleIDs;
|
@synthesize peopleIDs = _peopleIDs;
|
||||||
@synthesize placeID = _placeID;
|
@synthesize placeID = _placeID;
|
||||||
@synthesize ref = _ref;
|
@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
|
- (void)setPeopleIDs:(NSArray *)peopleIDs
|
||||||
{
|
{
|
||||||
@ -85,8 +68,6 @@
|
|||||||
[_media hash],
|
[_media hash],
|
||||||
[_placeID hash],
|
[_placeID hash],
|
||||||
[_ref hash],
|
[_ref hash],
|
||||||
[_pageID hash],
|
|
||||||
[_shareUUID hash],
|
|
||||||
};
|
};
|
||||||
return [FBSDKMath hashWithIntegerArray:subhashes count:sizeof(subhashes) / sizeof(subhashes[0])];
|
return [FBSDKMath hashWithIntegerArray:subhashes count:sizeof(subhashes) / sizeof(subhashes[0])];
|
||||||
}
|
}
|
||||||
@ -110,9 +91,7 @@
|
|||||||
[FBSDKInternalUtility object:_peopleIDs isEqualToObject:content.peopleIDs] &&
|
[FBSDKInternalUtility object:_peopleIDs isEqualToObject:content.peopleIDs] &&
|
||||||
[FBSDKInternalUtility object:_media isEqualToObject:content.media] &&
|
[FBSDKInternalUtility object:_media isEqualToObject:content.media] &&
|
||||||
[FBSDKInternalUtility object:_placeID isEqualToObject:content.placeID] &&
|
[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
|
#pragma mark - NSCoding
|
||||||
@ -132,8 +111,6 @@
|
|||||||
_media = [decoder decodeObjectOfClasses:classes forKey:FBSDK_SHARE_MEDIA_CONTENT_MEDIA_KEY];
|
_media = [decoder decodeObjectOfClasses:classes forKey:FBSDK_SHARE_MEDIA_CONTENT_MEDIA_KEY];
|
||||||
_placeID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_MEDIA_CONTENT_PLACE_ID_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];
|
_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;
|
return self;
|
||||||
}
|
}
|
||||||
@ -146,8 +123,6 @@
|
|||||||
[encoder encodeObject:_media forKey:FBSDK_SHARE_MEDIA_CONTENT_MEDIA_KEY];
|
[encoder encodeObject:_media forKey:FBSDK_SHARE_MEDIA_CONTENT_MEDIA_KEY];
|
||||||
[encoder encodeObject:_placeID forKey:FBSDK_SHARE_MEDIA_CONTENT_PLACE_ID_KEY];
|
[encoder encodeObject:_placeID forKey:FBSDK_SHARE_MEDIA_CONTENT_PLACE_ID_KEY];
|
||||||
[encoder encodeObject:_ref forKey:FBSDK_SHARE_MEDIA_CONTENT_REF_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
|
#pragma mark - NSCopying
|
||||||
@ -161,8 +136,6 @@
|
|||||||
copy->_media = [_media copy];
|
copy->_media = [_media copy];
|
||||||
copy->_placeID = [_placeID copy];
|
copy->_placeID = [_placeID copy];
|
||||||
copy->_ref = [_ref copy];
|
copy->_ref = [_ref copy];
|
||||||
copy->_pageID = [_pageID copy];
|
|
||||||
copy->_shareUUID = [_shareUUID copy];
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,34 +0,0 @@
|
|||||||
// 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
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
// 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
|
|
||||||
@ -1,93 +0,0 @@
|
|||||||
// 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
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
// 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
|
|
||||||
@ -1,71 +0,0 @@
|
|||||||
// 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
|
|
||||||
@ -1,69 +0,0 @@
|
|||||||
// 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
|
|
||||||
@ -1,110 +0,0 @@
|
|||||||
// 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
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
// 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
|
|
||||||
@ -1,87 +0,0 @@
|
|||||||
// 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
|
|
||||||
@ -1,62 +0,0 @@
|
|||||||
// 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
|
|
||||||
@ -1,82 +0,0 @@
|
|||||||
// 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,8 +30,6 @@
|
|||||||
#define FBSDK_SHARE_OPEN_GRAPH_CONTENT_PLACE_ID_KEY @"placeID"
|
#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_PREVIEW_PROPERTY_NAME_KEY @"previewPropertyName"
|
||||||
#define FBSDK_SHARE_OPEN_GRAPH_CONTENT_REF_KEY @"ref"
|
#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
|
@implementation FBSDKShareOpenGraphContent
|
||||||
|
|
||||||
@ -42,21 +40,6 @@
|
|||||||
@synthesize peopleIDs = _peopleIDs;
|
@synthesize peopleIDs = _peopleIDs;
|
||||||
@synthesize placeID = _placeID;
|
@synthesize placeID = _placeID;
|
||||||
@synthesize ref = _ref;
|
@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
|
- (void)setPeopleIDs:(NSArray *)peopleIDs
|
||||||
{
|
{
|
||||||
@ -78,8 +61,6 @@
|
|||||||
[_placeID hash],
|
[_placeID hash],
|
||||||
[_previewPropertyName hash],
|
[_previewPropertyName hash],
|
||||||
[_ref hash],
|
[_ref hash],
|
||||||
[_pageID hash],
|
|
||||||
[_shareUUID hash],
|
|
||||||
};
|
};
|
||||||
return [FBSDKMath hashWithIntegerArray:subhashes count:sizeof(subhashes) / sizeof(subhashes[0])];
|
return [FBSDKMath hashWithIntegerArray:subhashes count:sizeof(subhashes) / sizeof(subhashes[0])];
|
||||||
}
|
}
|
||||||
@ -104,9 +85,7 @@
|
|||||||
[FBSDKInternalUtility object:_peopleIDs isEqualToObject:content.peopleIDs] &&
|
[FBSDKInternalUtility object:_peopleIDs isEqualToObject:content.peopleIDs] &&
|
||||||
[FBSDKInternalUtility object:_placeID isEqualToObject:content.placeID] &&
|
[FBSDKInternalUtility object:_placeID isEqualToObject:content.placeID] &&
|
||||||
[FBSDKInternalUtility object:_previewPropertyName isEqualToObject:content.previewPropertyName] &&
|
[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
|
#pragma mark - NSCoding
|
||||||
@ -128,8 +107,6 @@
|
|||||||
_previewPropertyName = [decoder decodeObjectOfClass:[NSString class]
|
_previewPropertyName = [decoder decodeObjectOfClass:[NSString class]
|
||||||
forKey:FBSDK_SHARE_OPEN_GRAPH_CONTENT_PREVIEW_PROPERTY_NAME_KEY];
|
forKey:FBSDK_SHARE_OPEN_GRAPH_CONTENT_PREVIEW_PROPERTY_NAME_KEY];
|
||||||
_ref = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_OPEN_GRAPH_CONTENT_REF_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;
|
return self;
|
||||||
}
|
}
|
||||||
@ -143,8 +120,6 @@
|
|||||||
[encoder encodeObject:_placeID forKey:FBSDK_SHARE_OPEN_GRAPH_CONTENT_PLACE_ID_KEY];
|
[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:_previewPropertyName forKey:FBSDK_SHARE_OPEN_GRAPH_CONTENT_PREVIEW_PROPERTY_NAME_KEY];
|
||||||
[encoder encodeObject:_ref forKey:FBSDK_SHARE_OPEN_GRAPH_CONTENT_REF_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
|
#pragma mark - NSCopying
|
||||||
@ -159,8 +134,6 @@
|
|||||||
copy->_placeID = [_placeID copy];
|
copy->_placeID = [_placeID copy];
|
||||||
copy->_previewPropertyName = [_previewPropertyName copy];
|
copy->_previewPropertyName = [_previewPropertyName copy];
|
||||||
copy->_ref = [_ref copy];
|
copy->_ref = [_ref copy];
|
||||||
copy->_pageID = [_pageID copy];
|
|
||||||
copy->_shareUUID = [_shareUUID copy];
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,8 +29,6 @@
|
|||||||
#define FBSDK_SHARE_PHOTO_CONTENT_PHOTOS_KEY @"photos"
|
#define FBSDK_SHARE_PHOTO_CONTENT_PHOTOS_KEY @"photos"
|
||||||
#define FBSDK_SHARE_PHOTO_CONTENT_PLACE_ID_KEY @"placeID"
|
#define FBSDK_SHARE_PHOTO_CONTENT_PLACE_ID_KEY @"placeID"
|
||||||
#define FBSDK_SHARE_PHOTO_CONTENT_REF_KEY @"ref"
|
#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
|
@implementation FBSDKSharePhotoContent
|
||||||
|
|
||||||
@ -41,21 +39,6 @@
|
|||||||
@synthesize peopleIDs = _peopleIDs;
|
@synthesize peopleIDs = _peopleIDs;
|
||||||
@synthesize placeID = _placeID;
|
@synthesize placeID = _placeID;
|
||||||
@synthesize ref = _ref;
|
@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
|
- (void)setPeopleIDs:(NSArray *)peopleIDs
|
||||||
{
|
{
|
||||||
@ -84,8 +67,6 @@
|
|||||||
[_photos hash],
|
[_photos hash],
|
||||||
[_placeID hash],
|
[_placeID hash],
|
||||||
[_ref hash],
|
[_ref hash],
|
||||||
[_pageID hash],
|
|
||||||
[_shareUUID hash],
|
|
||||||
};
|
};
|
||||||
return [FBSDKMath hashWithIntegerArray:subhashes count:sizeof(subhashes) / sizeof(subhashes[0])];
|
return [FBSDKMath hashWithIntegerArray:subhashes count:sizeof(subhashes) / sizeof(subhashes[0])];
|
||||||
}
|
}
|
||||||
@ -109,9 +90,7 @@
|
|||||||
[FBSDKInternalUtility object:_peopleIDs isEqualToObject:content.peopleIDs] &&
|
[FBSDKInternalUtility object:_peopleIDs isEqualToObject:content.peopleIDs] &&
|
||||||
[FBSDKInternalUtility object:_photos isEqualToObject:content.photos] &&
|
[FBSDKInternalUtility object:_photos isEqualToObject:content.photos] &&
|
||||||
[FBSDKInternalUtility object:_placeID isEqualToObject:content.placeID] &&
|
[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
|
#pragma mark - NSCoding
|
||||||
@ -131,8 +110,6 @@
|
|||||||
_photos = [decoder decodeObjectOfClasses:classes forKey:FBSDK_SHARE_PHOTO_CONTENT_PHOTOS_KEY];
|
_photos = [decoder decodeObjectOfClasses:classes forKey:FBSDK_SHARE_PHOTO_CONTENT_PHOTOS_KEY];
|
||||||
_placeID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_PHOTO_CONTENT_PLACE_ID_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];
|
_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;
|
return self;
|
||||||
}
|
}
|
||||||
@ -145,8 +122,6 @@
|
|||||||
[encoder encodeObject:_photos forKey:FBSDK_SHARE_PHOTO_CONTENT_PHOTOS_KEY];
|
[encoder encodeObject:_photos forKey:FBSDK_SHARE_PHOTO_CONTENT_PHOTOS_KEY];
|
||||||
[encoder encodeObject:_placeID forKey:FBSDK_SHARE_PHOTO_CONTENT_PLACE_ID_KEY];
|
[encoder encodeObject:_placeID forKey:FBSDK_SHARE_PHOTO_CONTENT_PLACE_ID_KEY];
|
||||||
[encoder encodeObject:_ref forKey:FBSDK_SHARE_PHOTO_CONTENT_REF_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
|
#pragma mark - NSCopying
|
||||||
@ -160,8 +135,6 @@
|
|||||||
copy->_photos = [_photos copy];
|
copy->_photos = [_photos copy];
|
||||||
copy->_placeID = [_placeID copy];
|
copy->_placeID = [_placeID copy];
|
||||||
copy->_ref = [_ref copy];
|
copy->_ref = [_ref copy];
|
||||||
copy->_pageID = [_pageID copy];
|
|
||||||
copy->_shareUUID = [_shareUUID copy];
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,9 +28,7 @@
|
|||||||
#define FBSDK_SHARE_VIDEO_CONTENT_PLACE_ID_KEY @"placeID"
|
#define FBSDK_SHARE_VIDEO_CONTENT_PLACE_ID_KEY @"placeID"
|
||||||
#define FBSDK_SHARE_VIDEO_CONTENT_PREVIEW_PHOTO_KEY @"previewPhoto"
|
#define FBSDK_SHARE_VIDEO_CONTENT_PREVIEW_PHOTO_KEY @"previewPhoto"
|
||||||
#define FBSDK_SHARE_VIDEO_CONTENT_REF_KEY @"ref"
|
#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_VIDEO_KEY @"video"
|
||||||
#define FBSDK_SHARE_VIDEO_CONTENT_UUID_KEY @"uuid"
|
|
||||||
|
|
||||||
@implementation FBSDKShareVideoContent
|
@implementation FBSDKShareVideoContent
|
||||||
|
|
||||||
@ -41,21 +39,6 @@
|
|||||||
@synthesize peopleIDs = _peopleIDs;
|
@synthesize peopleIDs = _peopleIDs;
|
||||||
@synthesize placeID = _placeID;
|
@synthesize placeID = _placeID;
|
||||||
@synthesize ref = _ref;
|
@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
|
- (void)setPeopleIDs:(NSArray *)peopleIDs
|
||||||
{
|
{
|
||||||
@ -76,9 +59,7 @@
|
|||||||
[_placeID hash],
|
[_placeID hash],
|
||||||
[_previewPhoto hash],
|
[_previewPhoto hash],
|
||||||
[_ref hash],
|
[_ref hash],
|
||||||
[_pageID hash],
|
|
||||||
[_video hash],
|
[_video hash],
|
||||||
[_shareUUID hash],
|
|
||||||
};
|
};
|
||||||
return [FBSDKMath hashWithIntegerArray:subhashes count:sizeof(subhashes) / sizeof(subhashes[0])];
|
return [FBSDKMath hashWithIntegerArray:subhashes count:sizeof(subhashes) / sizeof(subhashes[0])];
|
||||||
}
|
}
|
||||||
@ -103,8 +84,6 @@
|
|||||||
[FBSDKInternalUtility object:_placeID isEqualToObject:content.placeID] &&
|
[FBSDKInternalUtility object:_placeID isEqualToObject:content.placeID] &&
|
||||||
[FBSDKInternalUtility object:_previewPhoto isEqualToObject:content.previewPhoto] &&
|
[FBSDKInternalUtility object:_previewPhoto isEqualToObject:content.previewPhoto] &&
|
||||||
[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:_video isEqualToObject:content.video]);
|
[FBSDKInternalUtility object:_video isEqualToObject:content.video]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,9 +104,7 @@
|
|||||||
_previewPhoto = [decoder decodeObjectOfClass:[FBSDKSharePhoto class]
|
_previewPhoto = [decoder decodeObjectOfClass:[FBSDKSharePhoto class]
|
||||||
forKey:FBSDK_SHARE_VIDEO_CONTENT_PREVIEW_PHOTO_KEY];
|
forKey:FBSDK_SHARE_VIDEO_CONTENT_PREVIEW_PHOTO_KEY];
|
||||||
_ref = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_SHARE_VIDEO_CONTENT_REF_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];
|
_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;
|
return self;
|
||||||
}
|
}
|
||||||
@ -140,9 +117,7 @@
|
|||||||
[encoder encodeObject:_placeID forKey:FBSDK_SHARE_VIDEO_CONTENT_PLACE_ID_KEY];
|
[encoder encodeObject:_placeID forKey:FBSDK_SHARE_VIDEO_CONTENT_PLACE_ID_KEY];
|
||||||
[encoder encodeObject:_previewPhoto forKey:FBSDK_SHARE_VIDEO_CONTENT_PREVIEW_PHOTO_KEY];
|
[encoder encodeObject:_previewPhoto forKey:FBSDK_SHARE_VIDEO_CONTENT_PREVIEW_PHOTO_KEY];
|
||||||
[encoder encodeObject:_ref forKey:FBSDK_SHARE_VIDEO_CONTENT_REF_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:_video forKey:FBSDK_SHARE_VIDEO_CONTENT_VIDEO_KEY];
|
||||||
[encoder encodeObject:_shareUUID forKey:FBSDK_SHARE_VIDEO_CONTENT_UUID_KEY];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - NSCopying
|
#pragma mark - NSCopying
|
||||||
@ -156,9 +131,7 @@
|
|||||||
copy->_placeID = [_placeID copy];
|
copy->_placeID = [_placeID copy];
|
||||||
copy->_previewPhoto = [_previewPhoto copy];
|
copy->_previewPhoto = [_previewPhoto copy];
|
||||||
copy->_ref = [_ref copy];
|
copy->_ref = [_ref copy];
|
||||||
copy->_pageID = [_pageID copy];
|
|
||||||
copy->_video = [_video copy];
|
copy->_video = [_video copy];
|
||||||
copy->_shareUUID = [_shareUUID copy];
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -62,16 +62,4 @@
|
|||||||
*/
|
*/
|
||||||
@property (nonatomic, copy) NSString *ref;
|
@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
|
@end
|
||||||
|
|||||||
@ -1,25 +0,0 @@
|
|||||||
// 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
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
// 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,7 +83,6 @@
|
|||||||
{
|
{
|
||||||
if (![FBSDKAccessToken currentAccessToken]) {
|
if (![FBSDKAccessToken currentAccessToken]) {
|
||||||
_recipientIDs = nil;
|
_recipientIDs = nil;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"me/apprequestformerrecipients"
|
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"me/apprequestformerrecipients"
|
||||||
parameters:@{@"fields":@""}
|
parameters:@{@"fields":@""}
|
||||||
|
|||||||
@ -100,7 +100,7 @@ typedef void(^fbsdk_like_action_controller_ensure_verified_object_id_completion_
|
|||||||
|
|
||||||
#pragma mark - Class Methods
|
#pragma mark - Class Methods
|
||||||
|
|
||||||
static BOOL _fbsdkLikeActionControllerDisabled = YES;
|
static BOOL _fbsdkLikeActionControllerDisabled = NO;
|
||||||
|
|
||||||
+ (BOOL)isDisabled
|
+ (BOOL)isDisabled
|
||||||
{
|
{
|
||||||
|
|||||||
@ -19,7 +19,6 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#define FBSDK_SHARE_JS_DIALOG_SCHEME @"web"
|
#define FBSDK_SHARE_JS_DIALOG_SCHEME @"web"
|
||||||
#define FBSDK_SHARE_CAMERA_METHOD_NAME @"camera"
|
|
||||||
#define FBSDK_SHARE_METHOD_NAME @"share"
|
#define FBSDK_SHARE_METHOD_NAME @"share"
|
||||||
#define FBSDK_SHARE_OPEN_GRAPH_METHOD_NAME @"ogshare"
|
#define FBSDK_SHARE_OPEN_GRAPH_METHOD_NAME @"ogshare"
|
||||||
#define FBSDK_SHARE_RESULT_COMPLETION_GESTURE_KEY @"completionGesture"
|
#define FBSDK_SHARE_RESULT_COMPLETION_GESTURE_KEY @"completionGesture"
|
||||||
|
|||||||
@ -1,36 +0,0 @@
|
|||||||
// 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
|
|
||||||
@ -1,264 +0,0 @@
|
|||||||
// 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,7 +28,6 @@
|
|||||||
#if !TARGET_OS_TV
|
#if !TARGET_OS_TV
|
||||||
#import <FBSDKShareKit/FBSDKAppInviteContent.h>
|
#import <FBSDKShareKit/FBSDKAppInviteContent.h>
|
||||||
#import <FBSDKShareKit/FBSDKGameRequestContent.h>
|
#import <FBSDKShareKit/FBSDKGameRequestContent.h>
|
||||||
#import <FBSDKShareKit/FBSDKShareCameraEffectContent.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@interface FBSDKShareUtility : NSObject
|
@interface FBSDKShareUtility : NSObject
|
||||||
@ -70,8 +69,6 @@
|
|||||||
|
|
||||||
#if !TARGET_OS_TV
|
#if !TARGET_OS_TV
|
||||||
+ (BOOL)validateAppInviteContent:(FBSDKAppInviteContent *)appInviteContent error:(NSError *__autoreleasing *)errorRef;
|
+ (BOOL)validateAppInviteContent:(FBSDKAppInviteContent *)appInviteContent error:(NSError *__autoreleasing *)errorRef;
|
||||||
+ (BOOL)validateShareCameraEffectContent:(FBSDKShareCameraEffectContent *)ShareCameraEffectContent
|
|
||||||
error:(NSError *__autoreleasing *)errorRef;
|
|
||||||
+ (BOOL)validateGameRequestContent:(FBSDKGameRequestContent *)gameRequestContent error:(NSError *__autoreleasing *)errorRef;
|
+ (BOOL)validateGameRequestContent:(FBSDKGameRequestContent *)gameRequestContent error:(NSError *__autoreleasing *)errorRef;
|
||||||
#endif
|
#endif
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -33,17 +33,6 @@
|
|||||||
#import "FBSDKShareVideoContent.h"
|
#import "FBSDKShareVideoContent.h"
|
||||||
#import "FBSDKSharingContent.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
|
@implementation FBSDKShareUtility
|
||||||
|
|
||||||
#pragma mark - Class Methods
|
#pragma mark - Class Methods
|
||||||
@ -182,7 +171,7 @@
|
|||||||
void(^stageImageCompletion)(NSArray<NSString *> *) = ^(NSArray<NSString *> *stagedURIs) {
|
void(^stageImageCompletion)(NSArray<NSString *> *) = ^(NSArray<NSString *> *stagedURIs) {
|
||||||
NSString *methodName = @"share";
|
NSString *methodName = @"share";
|
||||||
NSMutableDictionary *parameters = [[FBSDKShareUtility parametersForShareContent:content
|
NSMutableDictionary *parameters = [[FBSDKShareUtility parametersForShareContent:content
|
||||||
shouldFailOnDataError:NO] mutableCopy];
|
shouldFailOnDataError:NO] mutableCopy];
|
||||||
[parameters removeObjectForKey:@"photos"];
|
[parameters removeObjectForKey:@"photos"];
|
||||||
|
|
||||||
NSString *stagedURIJSONString = [FBSDKInternalUtility JSONStringForObject:stagedURIs
|
NSString *stagedURIJSONString = [FBSDKInternalUtility JSONStringForObject:stagedURIs
|
||||||
@ -312,19 +301,6 @@
|
|||||||
[self _addToParameters:parameters forShareVideoContent:(FBSDKShareVideoContent *)shareContent];
|
[self _addToParameters:parameters forShareVideoContent:(FBSDKShareVideoContent *)shareContent];
|
||||||
} else if ([shareContent isKindOfClass:[FBSDKShareOpenGraphContent class]]) {
|
} else if ([shareContent isKindOfClass:[FBSDKShareOpenGraphContent class]]) {
|
||||||
[self _addToParameters:parameters forShareOpenGraphContent:(FBSDKShareOpenGraphContent *)shareContent];
|
[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];
|
return [parameters copy];
|
||||||
}
|
}
|
||||||
@ -429,24 +405,6 @@
|
|||||||
return YES;
|
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
|
#endif
|
||||||
|
|
||||||
+ (BOOL)validateAssetLibraryURLWithShareVideoContent:(FBSDKShareVideoContent *)videoContent name:(NSString *)name error:(NSError *__autoreleasing *)errorRef
|
+ (BOOL)validateAssetLibraryURLWithShareVideoContent:(FBSDKShareVideoContent *)videoContent name:(NSString *)name error:(NSError *__autoreleasing *)errorRef
|
||||||
@ -554,16 +512,6 @@
|
|||||||
return [self validateShareMediaContent:(FBSDKShareMediaContent *)shareContent error:errorRef];
|
return [self validateShareMediaContent:(FBSDKShareMediaContent *)shareContent error:errorRef];
|
||||||
} else if ([shareContent isKindOfClass:[FBSDKShareOpenGraphContent class]]) {
|
} else if ([shareContent isKindOfClass:[FBSDKShareOpenGraphContent class]]) {
|
||||||
return [self validateShareOpenGraphContent:(FBSDKShareOpenGraphContent *)shareContent error:errorRef];
|
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 {
|
} else {
|
||||||
if (errorRef != NULL) {
|
if (errorRef != NULL) {
|
||||||
*errorRef = [FBSDKShareError invalidArgumentErrorWithName:@"shareContent" value:shareContent message:nil];
|
*errorRef = [FBSDKShareError invalidArgumentErrorWithName:@"shareContent" value:shareContent message:nil];
|
||||||
@ -671,82 +619,6 @@
|
|||||||
[self _validateRequiredValue:videoURL name:@"videoURL" error:errorRef]);
|
[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)shareMediaContentContainsPhotosAndVideos:(FBSDKShareMediaContent *)shareMediaContent
|
||||||
{
|
{
|
||||||
BOOL containsPhotos = NO;
|
BOOL containsPhotos = NO;
|
||||||
@ -771,10 +643,6 @@
|
|||||||
if (hashtagString != nil) {
|
if (hashtagString != nil) {
|
||||||
[FBSDKInternalUtility dictionary:parameters setObject:@[hashtagString] forKey:@"hashtags"];
|
[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]]) {
|
if ([shareContent isKindOfClass:[FBSDKShareOpenGraphContent class]]) {
|
||||||
FBSDKShareOpenGraphAction *action = ((FBSDKShareOpenGraphContent *)shareContent).action;
|
FBSDKShareOpenGraphAction *action = ((FBSDKShareOpenGraphContent *)shareContent).action;
|
||||||
[action setArray:shareContent.peopleIDs forKey:@"tags"];
|
[action setArray:shareContent.peopleIDs forKey:@"tags"];
|
||||||
@ -817,12 +685,6 @@ forShareOpenGraphContent:(FBSDKShareOpenGraphContent *)openGraphContent
|
|||||||
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.contentTitle forKey:@"name"];
|
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.contentTitle forKey:@"name"];
|
||||||
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.contentDescription forKey:@"description"];
|
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.contentDescription forKey:@"description"];
|
||||||
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.imageURL forKey:@"picture"];
|
[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
|
#pragma clang diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -841,49 +703,6 @@ forShareOpenGraphContent:(FBSDKShareOpenGraphContent *)openGraphContent
|
|||||||
parameters[@"video"] = videoParameters;
|
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
|
+ (id)_convertObject:(id)object
|
||||||
{
|
{
|
||||||
if ([object isKindOfClass:[FBSDKShareOpenGraphValueContainer class]]) {
|
if ([object isKindOfClass:[FBSDKShareOpenGraphValueContainer class]]) {
|
||||||
|
|||||||
1
Example/Pods/Headers/Private/Bolts/BFGeneric.h
generated
1
Example/Pods/Headers/Private/Bolts/BFGeneric.h
generated
@ -1 +0,0 @@
|
|||||||
../../../Bolts/Bolts/Common/BFGeneric.h
|
|
||||||
1
Example/Pods/Headers/Private/Bolts/BFTask+Exceptions.h
generated
Symbolic link
1
Example/Pods/Headers/Private/Bolts/BFTask+Exceptions.h
generated
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../Bolts/Bolts/Common/BFTask+Exceptions.h
|
||||||
@ -1 +0,0 @@
|
|||||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/Internal/FBSDKCameraEffectArguments+Internal.h
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectArguments.h
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/Internal/FBSDKCameraEffectTextures+Internal.h
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKCameraEffectTextures.h
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareCameraEffectContent.h
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerActionButton.h
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/Internal/FBSDKShareMessengerContentUtility.h
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerGenericTemplateContent.h
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerGenericTemplateElement.h
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerMediaTemplateContent.h
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerOpenGraphMusicTemplateContent.h
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../../../../FBSDKShareKit/FBSDKShareKit/FBSDKShareKit/FBSDKShareMessengerURLActionButton.h
|
|
||||||
1
Example/Pods/Headers/Public/Bolts/BFGeneric.h
generated
1
Example/Pods/Headers/Public/Bolts/BFGeneric.h
generated
@ -1 +0,0 @@
|
|||||||
../../../Bolts/Bolts/Common/BFGeneric.h
|
|
||||||
1
Example/Pods/Headers/Public/Bolts/BFTask+Exceptions.h
generated
Symbolic link
1
Example/Pods/Headers/Public/Bolts/BFTask+Exceptions.h
generated
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../Bolts/Bolts/Common/BFTask+Exceptions.h
|
||||||
@ -1 +0,0 @@
|
|||||||
../../../../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