- add client custom identifier to save credentials
This commit is contained in:
parent
99e06e67db
commit
1629110349
@ -26,12 +26,21 @@ PODS:
|
||||
- DJLocalization/Core (= 1.2.2)
|
||||
- DJLocalization/Core (1.2.2)
|
||||
- Expecta (1.0.6)
|
||||
- FBSDKCoreKit (4.37.0):
|
||||
- Bolts (~> 1.7)
|
||||
- FBSDKLoginKit (4.37.0):
|
||||
- Facebook-iOS-SDK (4.38.0):
|
||||
- Bolts (~> 1.9)
|
||||
- Facebook-iOS-SDK/CoreKit (= 4.38.0)
|
||||
- Facebook-iOS-SDK/MarketingKit (= 4.38.0)
|
||||
- Facebook-iOS-SDK/CoreKit (4.38.0):
|
||||
- Bolts (~> 1.9)
|
||||
- FBSDKCoreKit
|
||||
- Facebook-iOS-SDK/MarketingKit (4.38.0):
|
||||
- Bolts (~> 1.9)
|
||||
- Facebook-iOS-SDK/CoreKit
|
||||
- FBSDKMarketingKit
|
||||
- FBSDKCoreKit (4.39.0):
|
||||
- Bolts (~> 1.9)
|
||||
- FBSDKMarketingKit (4.38.0):
|
||||
- FBSDKCoreKit
|
||||
- FBSDKShareKit (4.37.0):
|
||||
- FBSDKCoreKit (~> 4.37.0)
|
||||
- NSDataAES (0.2.2)
|
||||
- NSDate_Utils (1.1.0):
|
||||
- DJLocalization
|
||||
@ -43,9 +52,7 @@ PODS:
|
||||
- CodFis-Helper
|
||||
- DDDKeychainWrapper
|
||||
- DJLocalization
|
||||
- FBSDKCoreKit
|
||||
- FBSDKLoginKit
|
||||
- FBSDKShareKit
|
||||
- Facebook-iOS-SDK
|
||||
- NSDataAES
|
||||
- NSDate_Utils
|
||||
- NSString-Helper
|
||||
@ -54,7 +61,7 @@ PODS:
|
||||
- RZDataBinding
|
||||
- StrongestPasswordValidator
|
||||
- UIDevice-Utils
|
||||
- PureLayout (3.1.2)
|
||||
- PureLayout (3.1.4)
|
||||
- RZDataBinding (2.1.1)
|
||||
- Specta (1.0.7)
|
||||
- StrongestPasswordValidator (0.1.2)
|
||||
@ -74,9 +81,9 @@ SPEC REPOS:
|
||||
- DDDKeychainWrapper
|
||||
- DJLocalization
|
||||
- Expecta
|
||||
- Facebook-iOS-SDK
|
||||
- FBSDKCoreKit
|
||||
- FBSDKLoginKit
|
||||
- FBSDKShareKit
|
||||
- FBSDKMarketingKit
|
||||
- NSDataAES
|
||||
- NSDate_Utils
|
||||
- NSString-Helper
|
||||
@ -99,16 +106,16 @@ SPEC CHECKSUMS:
|
||||
DDDKeychainWrapper: e681a4daba6448786fa83b4941f58102a33b1897
|
||||
DJLocalization: 0c84029af375647d4104a42ae36be87194c46c47
|
||||
Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5
|
||||
FBSDKCoreKit: fe5f3474499a81963e11e3f3a5c753d0a95ca2b4
|
||||
FBSDKLoginKit: 2f7249686d1e30ce8a5ef5400eedf50b3e3df332
|
||||
FBSDKShareKit: 52e0083222c38e930eb6878007478326599195c3
|
||||
Facebook-iOS-SDK: 9077b67c4178ea46c62997bcf2b6314ca6555440
|
||||
FBSDKCoreKit: 1e3981faefab8c88edfaa9eecd94aab02d99a9bc
|
||||
FBSDKMarketingKit: e609f39d74ab273cf52e2f8b7e8829ed412b2827
|
||||
NSDataAES: 967ea3337476a80e9838a533c25d570a06855ed0
|
||||
NSDate_Utils: c858a89da6e204ecf53aca48dbccb4da4d25bc9e
|
||||
NSString-Helper: 1c259caa6c845e79e0bb45ee25e34f95d86d2317
|
||||
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
||||
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
||||
PNObject: d92d660eb43b9385e7148e42598b8a7d3a785834
|
||||
PureLayout: 4634d0b61e3b5021166e8ec7c18e9e0ca0720c8b
|
||||
PNObject: 11e8fe8e955d327a9832ed63f6720f60b877d66a
|
||||
PureLayout: f08c01b8dec00bb14a1fefa3de4c7d9c265df85e
|
||||
RZDataBinding: 289e2fbdce8b9585afef69def83425c5d380ffbd
|
||||
Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66
|
||||
StrongestPasswordValidator: 921e42615bdf353513c6f925bffd4fc29865dbd7
|
||||
|
||||
@ -20,7 +20,8 @@
|
||||
|
||||
#import <FBSDKCoreKit/FBSDKCopying.h>
|
||||
#import <FBSDKCoreKit/FBSDKGraphRequestConnection.h>
|
||||
#import <FBSDKCoreKit/FBSDKMacros.h>
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
|
||||
|
||||
/**
|
||||
Notification indicating that the `currentAccessToken` has changed.
|
||||
@ -29,7 +30,20 @@
|
||||
`FBSDKAccessTokenChangeOldKey` and
|
||||
`FBSDKAccessTokenChangeNewKey`.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKAccessTokenDidChangeNotification;
|
||||
FOUNDATION_EXPORT NSNotificationName const FBSDKAccessTokenDidChangeNotification;
|
||||
|
||||
#else
|
||||
|
||||
/**
|
||||
Notification indicating that the `currentAccessToken` has changed.
|
||||
|
||||
the userInfo dictionary of the notification will contain keys
|
||||
`FBSDKAccessTokenChangeOldKey` and
|
||||
`FBSDKAccessTokenChangeNewKey`.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAccessTokenDidChangeNotification;
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
A key in the notification's userInfo that will be set
|
||||
@ -44,27 +58,33 @@ FBSDK_EXTERN NSString *const FBSDKAccessTokenDidChangeNotification;
|
||||
of an access token, this key will also exist since the access token
|
||||
is moving from a null state (no user) to a non-null state (user).
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKAccessTokenDidChangeUserID;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAccessTokenDidChangeUserIDKey;
|
||||
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAccessTokenDidChangeUserID
|
||||
DEPRECATED_MSG_ATTRIBUTE("Renamed `FBSDKAccessTokenDidChangeUserIDKey`");
|
||||
|
||||
/*
|
||||
key in notification's userInfo object for getting the old token.
|
||||
|
||||
If there was no old token, the key will not be present.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKAccessTokenChangeOldKey;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAccessTokenChangeOldKey;
|
||||
|
||||
/*
|
||||
key in notification's userInfo object for getting the new token.
|
||||
|
||||
If there is no new token, the key will not be present.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKAccessTokenChangeNewKey;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAccessTokenChangeNewKey;
|
||||
|
||||
/*
|
||||
A key in the notification's userInfo that will be set
|
||||
if and only if the token has expired.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKAccessTokenDidExpire;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAccessTokenDidExpireKey;
|
||||
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAccessTokenDidExpire
|
||||
DEPRECATED_MSG_ATTRIBUTE("Renamed `FBSDKAccessTokenDidExpireKey`");
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -23,10 +23,21 @@
|
||||
#import "FBSDKMath.h"
|
||||
#import "FBSDKSettings+Internal.h"
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
|
||||
|
||||
NSNotificationName const FBSDKAccessTokenDidChangeNotification = @"com.facebook.sdk.FBSDKAccessTokenData.FBSDKAccessTokenDidChangeNotification";
|
||||
|
||||
#else
|
||||
|
||||
NSString *const FBSDKAccessTokenDidChangeNotification = @"com.facebook.sdk.FBSDKAccessTokenData.FBSDKAccessTokenDidChangeNotification";
|
||||
|
||||
#endif
|
||||
|
||||
NSString *const FBSDKAccessTokenDidChangeUserIDKey = @"FBSDKAccessTokenDidChangeUserID";
|
||||
NSString *const FBSDKAccessTokenDidChangeUserID = @"FBSDKAccessTokenDidChangeUserID";
|
||||
NSString *const FBSDKAccessTokenChangeNewKey = @"FBSDKAccessToken";
|
||||
NSString *const FBSDKAccessTokenChangeOldKey = @"FBSDKAccessTokenOld";
|
||||
NSString *const FBSDKAccessTokenDidExpireKey = @"FBSDKAccessTokenDidExpire";
|
||||
NSString *const FBSDKAccessTokenDidExpire = @"FBSDKAccessTokenDidExpire";
|
||||
|
||||
static FBSDKAccessToken *g_currentAccessToken;
|
||||
@ -43,11 +54,6 @@ static FBSDKAccessToken *g_currentAccessToken;
|
||||
|
||||
@implementation FBSDKAccessToken
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
|
||||
- (instancetype)initWithTokenString:(NSString *)tokenString
|
||||
permissions:(NSArray *)permissions
|
||||
declinedPermissions:(NSArray *)declinedPermissions
|
||||
@ -117,7 +123,7 @@ static FBSDKAccessToken *g_currentAccessToken;
|
||||
[FBSDKInternalUtility dictionary:userInfo setObject:g_currentAccessToken forKey:FBSDKAccessTokenChangeOldKey];
|
||||
// We set this flag also when the current Access Token was not valid, since there might be legacy code relying on it
|
||||
if (![g_currentAccessToken.userID isEqualToString:token.userID] || ![self currentAccessTokenIsActive]) {
|
||||
userInfo[FBSDKAccessTokenDidChangeUserID] = @YES;
|
||||
userInfo[FBSDKAccessTokenDidChangeUserIDKey] = @YES;
|
||||
}
|
||||
|
||||
g_currentAccessToken = token;
|
||||
@ -128,7 +134,7 @@ static FBSDKAccessToken *g_currentAccessToken;
|
||||
[FBSDKInternalUtility deleteFacebookCookies];
|
||||
}
|
||||
|
||||
[[FBSDKSettings accessTokenCache] cacheAccessToken:token];
|
||||
[FBSDKSettings accessTokenCache].accessToken = token;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:FBSDKAccessTokenDidChangeNotification
|
||||
object:[self class]
|
||||
userInfo:userInfo];
|
||||
@ -149,7 +155,7 @@ static FBSDKAccessToken *g_currentAccessToken;
|
||||
[connection start];
|
||||
} else {
|
||||
if (completionHandler) {
|
||||
completionHandler(nil, nil, [FBSDKError errorWithCode:FBSDKAccessTokenRequiredErrorCode message:@"No current access token to refresh"]);
|
||||
completionHandler(nil, nil, [NSError fbErrorWithCode:FBSDKErrorAccessTokenRequired message:@"No current access token to refresh"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -159,14 +165,14 @@ static FBSDKAccessToken *g_currentAccessToken;
|
||||
- (NSUInteger)hash
|
||||
{
|
||||
NSUInteger subhashes[] = {
|
||||
[self.tokenString hash],
|
||||
[self.permissions hash],
|
||||
[self.declinedPermissions hash],
|
||||
[self.appID hash],
|
||||
[self.userID hash],
|
||||
[self.refreshDate hash],
|
||||
[self.expirationDate hash],
|
||||
[self.dataAccessExpirationDate hash]
|
||||
self.tokenString.hash,
|
||||
self.permissions.hash,
|
||||
self.declinedPermissions.hash,
|
||||
self.appID.hash,
|
||||
self.userID.hash,
|
||||
self.refreshDate.hash,
|
||||
self.expirationDate.hash,
|
||||
self.dataAccessExpirationDate.hash
|
||||
};
|
||||
return [FBSDKMath hashWithIntegerArray:subhashes count:sizeof(subhashes) / sizeof(subhashes[0])];
|
||||
}
|
||||
@ -210,7 +216,7 @@ static FBSDKAccessToken *g_currentAccessToken;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(NSCoder *)decoder
|
||||
- (instancetype)initWithCoder:(NSCoder *)decoder
|
||||
{
|
||||
NSString *appID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDK_ACCESSTOKEN_APPID_KEY];
|
||||
NSSet *declinedPermissions = [decoder decodeObjectOfClass:[NSSet class] forKey:FBSDK_ACCESSTOKEN_DECLINEDPERMISSIONS_KEY];
|
||||
@ -222,8 +228,8 @@ static FBSDKAccessToken *g_currentAccessToken;
|
||||
NSDate *dataAccessExpirationDate = [decoder decodeObjectOfClass:[NSDate class] forKey:FBSDK_ACCESSTOKEN_DATA_EXPIRATIONDATE_KEY];
|
||||
|
||||
return [self initWithTokenString:tokenString
|
||||
permissions:[permissions allObjects]
|
||||
declinedPermissions:[declinedPermissions allObjects]
|
||||
permissions:permissions.allObjects
|
||||
declinedPermissions:declinedPermissions.allObjects
|
||||
appID:appID
|
||||
userID:userID
|
||||
expirationDate:expirationDate
|
||||
|
||||
@ -24,16 +24,23 @@
|
||||
|
||||
#import <FBSDKCoreKit/FBSDKGraphRequestConnection.h>
|
||||
|
||||
#import "FBSDKMacros.h"
|
||||
|
||||
@class FBSDKAccessToken;
|
||||
@class FBSDKGraphRequest;
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
|
||||
|
||||
/** NSNotificationCenter name indicating a result of a failed log flush attempt. The posted object will be an NSError instance. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsLoggingResultNotification;
|
||||
FOUNDATION_EXPORT NSNotificationName const FBSDKAppEventsLoggingResultNotification;
|
||||
|
||||
#else
|
||||
|
||||
/** NSNotificationCenter name indicating a result of a failed log flush attempt. The posted object will be an NSError instance. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsLoggingResultNotification;
|
||||
|
||||
#endif
|
||||
|
||||
/** optional plist key ("FacebookLoggingOverrideAppID") for setting `loggingOverrideAppID` */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsOverrideAppIDBundleKey;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsOverrideAppIDBundleKey;
|
||||
|
||||
/**
|
||||
|
||||
@ -100,70 +107,70 @@ typedef NS_ENUM(NSUInteger, FBSDKProductCondition)
|
||||
*/
|
||||
|
||||
/** Log this event when the user has achieved a level in the app. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameAchievedLevel;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameAchievedLevel;
|
||||
|
||||
/** Log this event when the user has entered their payment info. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameAddedPaymentInfo;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameAddedPaymentInfo;
|
||||
|
||||
/** Log this event when the user has added an item to their cart. The valueToSum passed to logEvent should be the item's price. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameAddedToCart;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameAddedToCart;
|
||||
|
||||
/** Log this event when the user has added an item to their wishlist. The valueToSum passed to logEvent should be the item's price. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameAddedToWishlist;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameAddedToWishlist;
|
||||
|
||||
/** Log this event when a user has completed registration with the app. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameCompletedRegistration;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameCompletedRegistration;
|
||||
|
||||
/** Log this event when the user has completed a tutorial in the app. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameCompletedTutorial;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameCompletedTutorial;
|
||||
|
||||
/** Log this event when the user has entered the checkout process. The valueToSum passed to logEvent should be the total price in the cart. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameInitiatedCheckout;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameInitiatedCheckout;
|
||||
|
||||
/** Log this event when the user has rated an item in the app. The valueToSum passed to logEvent should be the numeric rating. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameRated;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameRated;
|
||||
|
||||
/** Log this event when a user has performed a search within the app. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameSearched;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameSearched;
|
||||
|
||||
/** Log this event when the user has spent app credits. The valueToSum passed to logEvent should be the number of credits spent. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameSpentCredits;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameSpentCredits;
|
||||
|
||||
/** Log this event when the user has unlocked an achievement in the app. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameUnlockedAchievement;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameUnlockedAchievement;
|
||||
|
||||
/** Log this event when a user has viewed a form of content in the app. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameViewedContent;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameViewedContent;
|
||||
|
||||
/** A telephone/SMS, email, chat or other type of contact between a customer and your business. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameContact;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameContact;
|
||||
|
||||
/** The customization of products through a configuration tool or other application your business owns. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameCustomizeProduct;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameCustomizeProduct;
|
||||
|
||||
/** The donation of funds to your organization or cause. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameDonate;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameDonate;
|
||||
|
||||
/** When a person finds one of your locations via web or application, with an intention to visit (example: find product at a local store). */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFindLocation;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFindLocation;
|
||||
|
||||
/** The booking of an appointment to visit one of your locations. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameSchedule;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameSchedule;
|
||||
|
||||
/** The start of a free trial of a product or service you offer (example: trial subscription). */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameStartTrial;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameStartTrial;
|
||||
|
||||
/** The submission of an application for a product, service or program you offer (example: credit card, educational program or job).. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameSubmitApplication;
|
||||
/** The submission of an application for a product, service or program you offer (example: credit card, educational program or job). */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameSubmitApplication;
|
||||
|
||||
/** The start of a paid subscription for a product or service you offer. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameSubscribe;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameSubscribe;
|
||||
|
||||
/** Log this event when the user views an ad. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameAdImpression;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameAdImpression;
|
||||
|
||||
/** Log this event when the user clicks an ad. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameAdClick;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameAdClick;
|
||||
|
||||
/**
|
||||
@methodgroup Predefined event name parameters for common additional information to accompany events logged through the `logEvent` family
|
||||
@ -176,40 +183,104 @@ FBSDK_EXTERN NSString *const FBSDKAppEventNameAdClick;
|
||||
* Example:
|
||||
* "[{\"id\": \"1234\", \"quantity\": 2, \"item_price\": 5.99}, {\"id\": \"5678\", \"quantity\": 1, \"item_price\": 9.99}]"
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameContent;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterNameContent;
|
||||
|
||||
/** Parameter key used to specify an ID for the specific piece of content being logged about. Could be an EAN, article identifier, etc., depending on the nature of the app. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameContentID;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterNameContentID;
|
||||
|
||||
/** Parameter key used to specify a generic content type/family for the logged event, e.g. "music", "photo", "video". Options to use will vary based upon what the app is all about. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameContentType;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterNameContentType;
|
||||
|
||||
/** Parameter key used to specify currency used with logged event. E.g. "USD", "EUR", "GBP". See ISO-4217 for specific values. One reference for these is <http://en.wikipedia.org/wiki/ISO_4217>. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameCurrency;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterNameCurrency;
|
||||
|
||||
/** Parameter key used to specify a description appropriate to the event being logged. E.g., the name of the achievement unlocked in the `FBAppEventNameAchievementUnlocked` event. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameDescription;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterNameDescription;
|
||||
|
||||
/** Parameter key used to specify the level achieved in a `FBAppEventNameAchieved` event. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameLevel;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterNameLevel;
|
||||
|
||||
/** Parameter key used to specify the maximum rating available for the `FBAppEventNameRate` event. E.g., "5" or "10". */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameMaxRatingValue;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterNameMaxRatingValue;
|
||||
|
||||
/** Parameter key used to specify how many items are being processed for an `FBAppEventNameInitiatedCheckout` or `FBAppEventNamePurchased` event. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameNumItems;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterNameNumItems;
|
||||
|
||||
/** Parameter key used to specify whether payment info is available for the `FBAppEventNameInitiatedCheckout` event. `FBSDKAppEventParameterValueYes` and `FBSDKAppEventParameterValueNo` are good canonical values to use for this parameter. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterNamePaymentInfoAvailable;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterNamePaymentInfoAvailable;
|
||||
|
||||
/** Parameter key used to specify method user has used to register for the app, e.g., "Facebook", "email", "Twitter", etc */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameRegistrationMethod;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterNameRegistrationMethod;
|
||||
|
||||
/** Parameter key used to specify the string provided by the user for a search operation. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameSearchString;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterNameSearchString;
|
||||
|
||||
/** Parameter key used to specify whether the activity being logged about was successful or not. `FBSDKAppEventParameterValueYes` and `FBSDKAppEventParameterValueNo` are good canonical values to use for this parameter. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameSuccess;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterNameSuccess;
|
||||
|
||||
/**
|
||||
@methodgroup Predefined event name parameters for common additional information to accompany events logged through the `logProductItem` method on `FBSDKAppEvents`.
|
||||
*/
|
||||
|
||||
/** Parameter key used to specify the product item's custom label 0. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductCustomLabel0;
|
||||
|
||||
/** Parameter key used to specify the product item's custom label 1. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductCustomLabel1;
|
||||
|
||||
/** Parameter key used to specify the product item's custom label 2. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductCustomLabel2;
|
||||
|
||||
/** Parameter key used to specify the product item's custom label 3. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductCustomLabel3;
|
||||
|
||||
/** Parameter key used to specify the product item's custom label 4. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductCustomLabel4;
|
||||
|
||||
/** Parameter key used to specify the product item's AppLink app URL for iOS. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductAppLinkIOSUrl;
|
||||
|
||||
/** Parameter key used to specify the product item's AppLink app ID for iOS App Store. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductAppLinkIOSAppStoreID;
|
||||
|
||||
/** Parameter key used to specify the product item's AppLink app name for iOS. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductAppLinkIOSAppName;
|
||||
|
||||
/** Parameter key used to specify the product item's AppLink app URL for iPhone. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductAppLinkIPhoneUrl;
|
||||
|
||||
/** Parameter key used to specify the product item's AppLink app ID for iPhone App Store. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductAppLinkIPhoneAppStoreID;
|
||||
|
||||
/** Parameter key used to specify the product item's AppLink app name for iPhone. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductAppLinkIPhoneAppName;
|
||||
|
||||
/** Parameter key used to specify the product item's AppLink app URL for iPad. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductAppLinkIPadUrl;
|
||||
|
||||
/** Parameter key used to specify the product item's AppLink app ID for iPad App Store. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductAppLinkIPadAppStoreID;
|
||||
|
||||
/** Parameter key used to specify the product item's AppLink app name for iPad. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductAppLinkIPadAppName;
|
||||
|
||||
/** Parameter key used to specify the product item's AppLink app URL for Android. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductAppLinkAndroidUrl;
|
||||
|
||||
/** Parameter key used to specify the product item's AppLink fully-qualified package name for intent generation. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductAppLinkAndroidPackage;
|
||||
|
||||
/** Parameter key used to specify the product item's AppLink app name for Android. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductAppLinkAndroidAppName;
|
||||
|
||||
/** Parameter key used to specify the product item's AppLink app URL for Windows Phone. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductAppLinkWindowsPhoneUrl;
|
||||
|
||||
/** Parameter key used to specify the product item's AppLink app ID, as a GUID, for App Store. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductAppLinkWindowsPhoneAppID;
|
||||
|
||||
/** Parameter key used to specify the product item's AppLink app name for Windows Phone. */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterProductAppLinkWindowsPhoneAppName;
|
||||
|
||||
/*
|
||||
@methodgroup Predefined values to assign to event parameters that accompany events logged through the `logEvent` family
|
||||
@ -217,19 +288,19 @@ FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameSuccess;
|
||||
*/
|
||||
|
||||
/** Yes-valued parameter value to be used with parameter keys that need a Yes/No value */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterValueYes;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterValueYes;
|
||||
|
||||
/** No-valued parameter value to be used with parameter keys that need a Yes/No value */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterValueNo;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterValueNo;
|
||||
|
||||
/** Parameter key used to specify the type of ad in an FBSDKAppEventNameAdImpression
|
||||
* or FBSDKAppEventNameAdClick event.
|
||||
* E.g. "banner", "interstitial", "rewarded_video", "native" */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameAdType;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterNameAdType;
|
||||
|
||||
/** Parameter key used to specify the unique ID for all events within a subscription
|
||||
* in an FBSDKAppEventNameSubscribe or FBSDKAppEventNameStartTrial event. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameOrderID;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterNameOrderID;
|
||||
|
||||
/**
|
||||
|
||||
@ -530,7 +601,7 @@ FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameOrderID;
|
||||
+ (void)activateApp;
|
||||
|
||||
/*
|
||||
* Push Notifications Registration
|
||||
* Push Notifications Registration and Uninstall Tracking
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -544,6 +615,17 @@ FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameOrderID;
|
||||
*/
|
||||
+ (void)setPushNotificationsDeviceToken:(NSData *)deviceToken;
|
||||
|
||||
/**
|
||||
Sets and sends device token string to register the current application for push notifications.
|
||||
|
||||
|
||||
|
||||
Sets and sends a device token string
|
||||
|
||||
@param deviceTokenString Device token string.
|
||||
*/
|
||||
+ (void)setPushNotificationsDeviceTokenString:(NSString *)deviceTokenString;
|
||||
|
||||
/*
|
||||
* Control over event batching/flushing
|
||||
*/
|
||||
@ -677,16 +759,16 @@ FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameOrderID;
|
||||
@param zip user's zip
|
||||
@param country user's country
|
||||
*/
|
||||
+ (void)setUserEmail:(nullable NSString *)email
|
||||
firstName:(nullable NSString *)firstName
|
||||
lastName:(nullable NSString *)lastName
|
||||
phone:(nullable NSString *)phone
|
||||
dateOfBirth:(nullable NSString *)dateOfBirth
|
||||
gender:(nullable NSString *)gender
|
||||
city:(nullable NSString *)city
|
||||
state:(nullable NSString *)state
|
||||
zip:(nullable NSString *)zip
|
||||
country:(nullable NSString *)country;
|
||||
+ (void)setUserEmail:(NSString *)email
|
||||
firstName:(NSString *)firstName
|
||||
lastName:(NSString *)lastName
|
||||
phone:(NSString *)phone
|
||||
dateOfBirth:(NSString *)dateOfBirth
|
||||
gender:(NSString *)gender
|
||||
city:(NSString *)city
|
||||
state:(NSString *)state
|
||||
zip:(NSString *)zip
|
||||
country:(NSString *)country;
|
||||
/*
|
||||
Returns the set user data else nil
|
||||
*/
|
||||
@ -719,4 +801,22 @@ FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameOrderID;
|
||||
+ (void)augmentHybridWKWebView:(WKWebView *)webView;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Unity helper functions
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
Set if the Unity is already initialized
|
||||
|
||||
@param isUnityInit whether Unity is initialized.
|
||||
|
||||
*/
|
||||
+ (void)setIsUnityInit:(BOOL)isUnityInit;
|
||||
|
||||
/*
|
||||
Send event binding to Unity
|
||||
*/
|
||||
+ (void)sendEventBindingsToUnity;
|
||||
|
||||
@end
|
||||
|
||||
@ -19,6 +19,8 @@
|
||||
#import "FBSDKAppEvents.h"
|
||||
#import "FBSDKAppEvents+Internal.h"
|
||||
|
||||
#import <objc/runtime.h>
|
||||
|
||||
#import <UIKit/UIApplication.h>
|
||||
|
||||
#import "FBSDKAccessToken.h"
|
||||
@ -97,6 +99,31 @@ NSString *const FBSDKAppEventParameterLaunchSource = @"fb_mobile_l
|
||||
NSString *const FBSDKAppEventParameterNameAdType = @"ad_type";
|
||||
NSString *const FBSDKAppEventParameterNameOrderID = @"fb_order_id";
|
||||
|
||||
//
|
||||
// Public event parameter names for DPA Catalog
|
||||
//
|
||||
|
||||
NSString *const FBSDKAppEventParameterProductCustomLabel0 = @"fb_product_custom_label_0";
|
||||
NSString *const FBSDKAppEventParameterProductCustomLabel1 = @"fb_product_custom_label_1";
|
||||
NSString *const FBSDKAppEventParameterProductCustomLabel2 = @"fb_product_custom_label_2";
|
||||
NSString *const FBSDKAppEventParameterProductCustomLabel3 = @"fb_product_custom_label_3";
|
||||
NSString *const FBSDKAppEventParameterProductCustomLabel4 = @"fb_product_custom_label_4";
|
||||
NSString *const FBSDKAppEventParameterProductAppLinkIOSUrl = @"fb_product_applink_ios_url";
|
||||
NSString *const FBSDKAppEventParameterProductAppLinkIOSAppStoreID = @"fb_product_applink_ios_app_store_id";
|
||||
NSString *const FBSDKAppEventParameterProductAppLinkIOSAppName = @"fb_product_applink_ios_app_name";
|
||||
NSString *const FBSDKAppEventParameterProductAppLinkIPhoneUrl = @"fb_product_applink_iphone_url";
|
||||
NSString *const FBSDKAppEventParameterProductAppLinkIPhoneAppStoreID = @"fb_product_applink_iphone_app_store_id";
|
||||
NSString *const FBSDKAppEventParameterProductAppLinkIPhoneAppName = @"fb_product_applink_iphone_app_name";
|
||||
NSString *const FBSDKAppEventParameterProductAppLinkIPadUrl = @"fb_product_applink_ipad_url";
|
||||
NSString *const FBSDKAppEventParameterProductAppLinkIPadAppStoreID = @"fb_product_applink_ipad_app_store_id";
|
||||
NSString *const FBSDKAppEventParameterProductAppLinkIPadAppName = @"fb_product_applink_ipad_app_name";
|
||||
NSString *const FBSDKAppEventParameterProductAppLinkAndroidUrl = @"fb_product_applink_android_url";
|
||||
NSString *const FBSDKAppEventParameterProductAppLinkAndroidPackage = @"fb_product_applink_android_package";
|
||||
NSString *const FBSDKAppEventParameterProductAppLinkAndroidAppName = @"fb_product_applink_android_app_name";
|
||||
NSString *const FBSDKAppEventParameterProductAppLinkWindowsPhoneUrl = @"fb_product_applink_windows_phone_url";
|
||||
NSString *const FBSDKAppEventParameterProductAppLinkWindowsPhoneAppID = @"fb_product_applink_windows_phone_app_id";
|
||||
NSString *const FBSDKAppEventParameterProductAppLinkWindowsPhoneAppName = @"fb_product_applink_windows_phone_app_name";
|
||||
|
||||
//
|
||||
// Public event parameter values
|
||||
//
|
||||
@ -238,8 +265,16 @@ NSString *const FBSDKAppEventsDialogShareContentTypeMessengerMediaTemplate
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeMessengerOpenGraphMusicTemplate = @"OpenGraphMusicTemplate";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeUnknown = @"Unknown";
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
|
||||
|
||||
NSNotificationName const FBSDKAppEventsLoggingResultNotification = @"com.facebook.sdk:FBSDKAppEventsLoggingResultNotification";
|
||||
|
||||
#else
|
||||
|
||||
NSString *const FBSDKAppEventsLoggingResultNotification = @"com.facebook.sdk:FBSDKAppEventsLoggingResultNotification";
|
||||
|
||||
#endif
|
||||
|
||||
NSString *const FBSDKAppEventsOverrideAppIDBundleKey = @"FacebookLoggingOverrideAppID";
|
||||
|
||||
//
|
||||
@ -271,11 +306,19 @@ NSString *const FBSDKAPPEventsWKWebViewMessagesProtocolKey = @"fbmq-0.1";
|
||||
#define FLUSH_PERIOD_IN_SECONDS 15
|
||||
#define USER_ID_USER_DEFAULTS_KEY @"com.facebook.sdk.appevents.userid"
|
||||
|
||||
#define FBUnityUtilityClassName "FBUnityUtility"
|
||||
#define FBUnityUtilityUpdateBindingsSelector @"triggerUpdateBindings:"
|
||||
|
||||
#define UNINSTALL_TRACKING_DEVICE_ID_KEY @"device_id"
|
||||
#define UNINSTALL_TRACKING_PLATFORM_KEY @"platform"
|
||||
#define UNINSTALL_TRACKING_DEVICE_TOKEN_KEY @"device_token"
|
||||
#define UNINSTALL_TRACKING_TOKEN_ENDPOINT @"app_push_device_token"
|
||||
|
||||
static NSString *g_overrideAppID = nil;
|
||||
|
||||
@interface FBSDKAppEvents ()
|
||||
|
||||
@property (nonatomic, readwrite) FBSDKAppEventsFlushBehavior flushBehavior;
|
||||
@property (nonatomic, assign) FBSDKAppEventsFlushBehavior flushBehavior;
|
||||
//for testing only.
|
||||
@property (nonatomic, assign) BOOL disableTimer;
|
||||
|
||||
@ -294,6 +337,7 @@ static NSString *g_overrideAppID = nil;
|
||||
FBSDKEventBindingManager *_eventBindingManager;
|
||||
#endif
|
||||
NSString *_userID;
|
||||
BOOL _isUnityInit;
|
||||
}
|
||||
|
||||
#pragma mark - Object Lifecycle
|
||||
@ -319,6 +363,7 @@ static NSString *g_overrideAppID = nil;
|
||||
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
_userID = [defaults stringForKey:USER_ID_USER_DEFAULTS_KEY];
|
||||
[self fetchServerConfiguration:nil];
|
||||
}
|
||||
|
||||
return self;
|
||||
@ -380,7 +425,7 @@ static NSString *g_overrideAppID = nil;
|
||||
parameters:(NSDictionary *)parameters
|
||||
{
|
||||
[FBSDKAppEvents logEvent:eventName
|
||||
valueToSum:[NSNumber numberWithDouble:valueToSum]
|
||||
valueToSum:@(valueToSum)
|
||||
parameters:parameters
|
||||
accessToken:nil];
|
||||
}
|
||||
@ -432,7 +477,7 @@ static NSString *g_overrideAppID = nil;
|
||||
}
|
||||
|
||||
[FBSDKAppEvents logEvent:FBSDKAppEventNamePurchased
|
||||
valueToSum:[NSNumber numberWithDouble:purchaseAmount]
|
||||
valueToSum:@(purchaseAmount)
|
||||
parameters:newParameters
|
||||
accessToken:accessToken];
|
||||
|
||||
@ -523,7 +568,7 @@ static NSString *g_overrideAppID = nil;
|
||||
[dict setValuesForKeysWithDictionary:parameters];
|
||||
}
|
||||
|
||||
[dict setObject:itemID forKey:FBSDKAppEventParameterProductItemID];
|
||||
dict[FBSDKAppEventParameterProductItemID] = itemID;
|
||||
|
||||
NSString *avail = nil;
|
||||
switch (availability) {
|
||||
@ -539,7 +584,7 @@ static NSString *g_overrideAppID = nil;
|
||||
avail = @"DISCONTINUED"; break;
|
||||
}
|
||||
if (avail) {
|
||||
[dict setObject:avail forKey:FBSDKAppEventParameterProductAvailability];
|
||||
dict[FBSDKAppEventParameterProductAvailability] = avail;
|
||||
}
|
||||
|
||||
NSString *cond = nil;
|
||||
@ -552,23 +597,23 @@ static NSString *g_overrideAppID = nil;
|
||||
cond = @"USED"; break;
|
||||
}
|
||||
if (cond) {
|
||||
[dict setObject:cond forKey:FBSDKAppEventParameterProductCondition];
|
||||
dict[FBSDKAppEventParameterProductCondition] = cond;
|
||||
}
|
||||
|
||||
[dict setObject:description forKey:FBSDKAppEventParameterProductDescription];
|
||||
[dict setObject:imageLink forKey:FBSDKAppEventParameterProductImageLink];
|
||||
[dict setObject:link forKey:FBSDKAppEventParameterProductLink];
|
||||
[dict setObject:title forKey:FBSDKAppEventParameterProductTitle];
|
||||
[dict setObject:[NSString stringWithFormat:@"%.3lf", priceAmount] forKey:FBSDKAppEventParameterProductPriceAmount];
|
||||
[dict setObject:currency forKey:FBSDKAppEventParameterProductPriceCurrency];
|
||||
dict[FBSDKAppEventParameterProductDescription] = description;
|
||||
dict[FBSDKAppEventParameterProductImageLink] = imageLink;
|
||||
dict[FBSDKAppEventParameterProductLink] = link;
|
||||
dict[FBSDKAppEventParameterProductTitle] = title;
|
||||
dict[FBSDKAppEventParameterProductPriceAmount] = [NSString stringWithFormat:@"%.3lf", priceAmount];
|
||||
dict[FBSDKAppEventParameterProductPriceCurrency] = currency;
|
||||
if (gtin) {
|
||||
[dict setObject:gtin forKey:FBSDKAppEventParameterProductGTIN];
|
||||
dict[FBSDKAppEventParameterProductGTIN] = gtin;
|
||||
}
|
||||
if (mpn) {
|
||||
[dict setObject:mpn forKey:FBSDKAppEventParameterProductMPN];
|
||||
dict[FBSDKAppEventParameterProductMPN] = mpn;
|
||||
}
|
||||
if (brand) {
|
||||
[dict setObject:brand forKey:FBSDKAppEventParameterProductBrand];
|
||||
dict[FBSDKAppEventParameterProductBrand] = brand;
|
||||
}
|
||||
|
||||
[FBSDKAppEvents logEvent:FBSDKAppEventNameProductCatalogUpdate
|
||||
@ -595,6 +640,11 @@ static NSString *g_overrideAppID = nil;
|
||||
+ (void)setPushNotificationsDeviceToken:(NSData *)deviceToken
|
||||
{
|
||||
NSString *deviceTokenString = [FBSDKInternalUtility hexadecimalStringFromData:deviceToken];
|
||||
[FBSDKAppEvents setPushNotificationsDeviceTokenString:deviceTokenString];
|
||||
}
|
||||
|
||||
+ (void)setPushNotificationsDeviceTokenString:(NSString *)deviceTokenString
|
||||
{
|
||||
if (deviceTokenString == nil) {
|
||||
[FBSDKAppEvents singleton].pushNotificationsDeviceTokenString = nil;
|
||||
return;
|
||||
@ -609,6 +659,23 @@ static NSString *g_overrideAppID = nil;
|
||||
if ([FBSDKAppEvents flushBehavior] != FBSDKAppEventsFlushBehaviorExplicitOnly) {
|
||||
[[FBSDKAppEvents singleton] flushForReason:FBSDKAppEventsFlushReasonEagerlyFlushingEvent];
|
||||
}
|
||||
|
||||
// Update device push token for uninstall tracking
|
||||
[FBSDKServerConfigurationManager loadServerConfigurationWithCompletionBlock:^(FBSDKServerConfiguration *serverConfiguration, NSError *error) {
|
||||
if (serverConfiguration.uninstallTrackingEnabled) {
|
||||
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
|
||||
initWithGraphPath:[NSString stringWithFormat:@"%@/%@",
|
||||
[FBSDKSettings appID], UNINSTALL_TRACKING_TOKEN_ENDPOINT]
|
||||
parameters:@{
|
||||
UNINSTALL_TRACKING_DEVICE_TOKEN_KEY: deviceTokenString,
|
||||
UNINSTALL_TRACKING_PLATFORM_KEY: @"ios",
|
||||
// advertiserID could be 0s if user select limit ad tracking
|
||||
UNINSTALL_TRACKING_DEVICE_ID_KEY: [FBSDKAppEventsUtility advertiserID] ?: @""
|
||||
}
|
||||
HTTPMethod:@"POST"];
|
||||
[request startWithCompletionHandler:nil];
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
@ -668,16 +735,16 @@ static NSString *g_overrideAppID = nil;
|
||||
[FBSDKUserDataStore setUserDataAndHash:userData];
|
||||
}
|
||||
|
||||
+ (void)setUserEmail:(nullable NSString *)email
|
||||
firstName:(nullable NSString *)firstName
|
||||
lastName:(nullable NSString *)lastName
|
||||
phone:(nullable NSString *)phone
|
||||
dateOfBirth:(nullable NSString *)dateOfBirth
|
||||
gender:(nullable NSString *)gender
|
||||
city:(nullable NSString *)city
|
||||
state:(nullable NSString *)state
|
||||
zip:(nullable NSString *)zip
|
||||
country:(nullable NSString *)country
|
||||
+ (void)setUserEmail:(NSString *)email
|
||||
firstName:(NSString *)firstName
|
||||
lastName:(NSString *)lastName
|
||||
phone:(NSString *)phone
|
||||
dateOfBirth:(NSString *)dateOfBirth
|
||||
gender:(NSString *)gender
|
||||
city:(NSString *)city
|
||||
state:(NSString *)state
|
||||
zip:(NSString *)zip
|
||||
country:(NSString *)country
|
||||
{
|
||||
[FBSDKUserDataStore setUserDataAndHash:email
|
||||
firstName:firstName
|
||||
@ -716,7 +783,7 @@ static NSString *g_overrideAppID = nil;
|
||||
|
||||
if (userID.length == 0) {
|
||||
[FBSDKLogger singleShotLogEntry:FBSDKLoggingBehaviorDeveloperErrors logEntry:@"Missing [FBSDKAppEvents userID] for [FBSDKAppEvents updateUserProperties:]"];
|
||||
NSError *error = [FBSDKError requiredArgumentErrorWithName:@"userID" message:@"Missing [FBSDKAppEvents userID] for [FBSDKAppEvents updateUserProperties:]"];
|
||||
NSError *error = [NSError fbRequiredArgumentErrorWithName:@"userID" message:@"Missing [FBSDKAppEvents userID] for [FBSDKAppEvents updateUserProperties:]"];
|
||||
if (handler) {
|
||||
handler(nil, nil, error);
|
||||
}
|
||||
@ -731,7 +798,7 @@ static NSString *g_overrideAppID = nil;
|
||||
__block NSError *invalidObjectError;
|
||||
NSString *dataJSONString = [FBSDKInternalUtility JSONStringForObject:@[dataDictionary] error:&error invalidObjectHandler:^id(id object, BOOL *stop) {
|
||||
*stop = YES;
|
||||
invalidObjectError = [FBSDKError unknownErrorWithMessage:@"The values in the properties dictionary must be NSStrings or NSNumbers"];
|
||||
invalidObjectError = [NSError fbUnknownErrorWithMessage:@"The values in the properties dictionary must be NSStrings or NSNumbers"];
|
||||
return nil;
|
||||
}];
|
||||
if (!error) {
|
||||
@ -785,6 +852,33 @@ static NSString *g_overrideAppID = nil;
|
||||
}
|
||||
#endif
|
||||
|
||||
+ (void)setIsUnityInit:(BOOL)isUnityInit
|
||||
{
|
||||
[FBSDKAppEvents singleton]->_isUnityInit = isUnityInit;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
|
||||
+ (void)sendEventBindingsToUnity
|
||||
{
|
||||
// Send event bindings to Unity only Unity is initialized
|
||||
if ([FBSDKAppEvents singleton]->_isUnityInit
|
||||
&& [FBSDKAppEvents singleton]->_serverConfiguration
|
||||
&& [NSJSONSerialization isValidJSONObject:[FBSDKAppEvents singleton]->_serverConfiguration.eventBindings]
|
||||
) {
|
||||
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:[FBSDKAppEvents singleton]->_serverConfiguration.eventBindings ?: @""
|
||||
options:0
|
||||
error:nil];
|
||||
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
||||
Class classFBUnityUtility = objc_lookUpClass(FBUnityUtilityClassName);
|
||||
SEL updateBindingSelector = NSSelectorFromString(FBUnityUtilityUpdateBindingsSelector);
|
||||
if ([classFBUnityUtility respondsToSelector:updateBindingSelector]) {
|
||||
[classFBUnityUtility performSelector:updateBindingSelector withObject:jsonString];
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
#pragma mark - Internal Methods
|
||||
|
||||
+ (void)logImplicitEvent:(NSString *)eventName
|
||||
@ -837,7 +931,7 @@ static NSString *g_overrideAppID = nil;
|
||||
- (void)publishInstall
|
||||
{
|
||||
NSString *appID = [self appID];
|
||||
if ([appID length] == 0) {
|
||||
if (appID.length == 0) {
|
||||
[FBSDKLogger singleShotLogEntry:FBSDKLoggingBehaviorDeveloperErrors logEntry:@"Missing [FBSDKAppEvents appID] for [FBSDKAppEvents publishInstall:]"];
|
||||
return;
|
||||
}
|
||||
@ -875,8 +969,12 @@ static NSString *g_overrideAppID = nil;
|
||||
[_eventBindingManager start];
|
||||
}
|
||||
|
||||
[_eventBindingManager updateBindings:[FBSDKEventBindingManager
|
||||
parseArray:_serverConfiguration.eventBindings]];
|
||||
if ([FBSDKInternalUtility isUnity]) {
|
||||
[FBSDKAppEvents sendEventBindingsToUnity];
|
||||
} else {
|
||||
[_eventBindingManager updateBindings:[FBSDKEventBindingManager
|
||||
parseArray:_serverConfiguration.eventBindings]];
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1046,7 +1144,7 @@ static NSString *g_overrideAppID = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
if ([appEventsState.appID length] == 0) {
|
||||
if (appEventsState.appID.length == 0) {
|
||||
[FBSDKLogger singleShotLogEntry:FBSDKLoggingBehaviorDeveloperErrors logEntry:@"Missing [FBSDKAppEvents appEventsState.appID] for [FBSDKAppEvents flushOnMainQueue:]"];
|
||||
return;
|
||||
}
|
||||
@ -1065,7 +1163,7 @@ static NSString *g_overrideAppID = nil;
|
||||
activityParametersDictionaryForEvent:@"CUSTOM_APP_EVENTS"
|
||||
implicitEventsOnly:appEventsState.areAllEventsImplicit
|
||||
shouldAccessAdvertisingID:self->_serverConfiguration.advertisingIDEnabled];
|
||||
NSInteger length = [receipt_data length];
|
||||
NSInteger length = receipt_data.length;
|
||||
if (length > 0) {
|
||||
postParameters[@"receipt_data"] = receipt_data;
|
||||
}
|
||||
@ -1097,7 +1195,6 @@ static NSString *g_overrideAppID = nil;
|
||||
prettyPrintedJsonEvents];
|
||||
}
|
||||
|
||||
[FBSDKAppEventsUtility logAndNotify:[NSString stringWithFormat:@"param %@", postParameters]];
|
||||
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:[NSString stringWithFormat:@"%@/activities", appEventsState.appID]
|
||||
parameters:postParameters
|
||||
tokenString:appEventsState.tokenString
|
||||
@ -1138,7 +1235,7 @@ static NSString *g_overrideAppID = nil;
|
||||
if (flushResult == FlushResultServerError) {
|
||||
// Only log events that developer can do something with (i.e., if parameters are incorrect).
|
||||
// as opposed to cases where the token is bad.
|
||||
if ([error.userInfo[FBSDKGraphRequestErrorCategoryKey] unsignedIntegerValue] == FBSDKGraphRequestErrorCategoryOther) {
|
||||
if ([error.userInfo[FBSDKGraphRequestErrorKey] unsignedIntegerValue] == FBSDKGraphRequestErrorOther) {
|
||||
NSString *message = [NSString stringWithFormat:@"Failed to send AppEvents: %@", error];
|
||||
[FBSDKAppEventsUtility logAndNotify:message allowLogAsDeveloperError:!appEventsState.areAllEventsImplicit];
|
||||
}
|
||||
@ -1164,7 +1261,7 @@ static NSString *g_overrideAppID = nil;
|
||||
break;
|
||||
|
||||
case FlushResultServerError:
|
||||
resultString = [NSString stringWithFormat:@"Server Error - %@", [error description]];
|
||||
resultString = [NSString stringWithFormat:@"Server Error - %@", error.description];
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -30,11 +30,11 @@ NSString *const FBSDKAppLinkVersion = @"1.0";
|
||||
|
||||
@interface FBSDKAppLink ()
|
||||
|
||||
@property (nonatomic, strong, readwrite) NSURL *sourceURL;
|
||||
@property (nonatomic, copy, readwrite) NSArray<FBSDKAppLinkTarget *> *targets;
|
||||
@property (nonatomic, strong, readwrite) NSURL *webURL;
|
||||
@property (nonatomic, strong) NSURL *sourceURL;
|
||||
@property (nonatomic, copy) NSArray<FBSDKAppLinkTarget *> *targets;
|
||||
@property (nonatomic, strong) NSURL *webURL;
|
||||
|
||||
@property (nonatomic, assign, readwrite, getter=isBackToReferrer) BOOL backToReferrer;
|
||||
@property (nonatomic, assign, getter=isBackToReferrer) BOOL backToReferrer;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@ -69,6 +69,12 @@ NS_EXTENSION_UNAVAILABLE_IOS("Not available in app extension")
|
||||
/*! The AppLink to navigate to */
|
||||
@property (nonatomic, strong, readonly) FBSDKAppLink *appLink;
|
||||
|
||||
/*!
|
||||
Return navigation type for current instance.
|
||||
No-side-effect version of navigate:
|
||||
*/
|
||||
@property (nonatomic, readonly) FBSDKAppLinkNavigationType navigationType;
|
||||
|
||||
/*! Creates an AppLinkNavigation with the given link, extras, and App Link data */
|
||||
+ (instancetype)navigationWithAppLink:(FBSDKAppLink *)appLink
|
||||
extras:(NSDictionary<NSString *, id> *)extras
|
||||
@ -103,12 +109,6 @@ NS_EXTENSION_UNAVAILABLE_IOS("Not available in app extension")
|
||||
*/
|
||||
+ (FBSDKAppLinkNavigationType)navigationTypeForLink:(FBSDKAppLink *)link;
|
||||
|
||||
/*!
|
||||
Return navigation type for current instance.
|
||||
No-side-effect version of navigate:
|
||||
*/
|
||||
- (FBSDKAppLinkNavigationType)navigationType;
|
||||
|
||||
/*! Navigates to a URL (an asynchronous action) and returns a FBSDKNavigationType */
|
||||
+ (void)navigateToURL:(NSURL *)destination handler:(FBSDKAppLinkNavigationHandler)handler;
|
||||
|
||||
|
||||
@ -37,9 +37,9 @@ static id<FBSDKAppLinkResolving> defaultResolver;
|
||||
|
||||
@interface FBSDKAppLinkNavigation ()
|
||||
|
||||
@property (nonatomic, copy, readwrite) NSDictionary<NSString *, id> *extras;
|
||||
@property (nonatomic, copy, readwrite) NSDictionary<NSString *, id> *appLinkData;
|
||||
@property (nonatomic, strong, readwrite) FBSDKAppLink *appLink;
|
||||
@property (nonatomic, copy) NSDictionary<NSString *, id> *extras;
|
||||
@property (nonatomic, copy) NSDictionary<NSString *, id> *appLinkData;
|
||||
@property (nonatomic, strong) FBSDKAppLink *appLink;
|
||||
|
||||
@end
|
||||
|
||||
@ -61,15 +61,7 @@ static id<FBSDKAppLinkResolving> defaultResolver;
|
||||
}
|
||||
|
||||
- (NSString *)stringByEscapingQueryString:(NSString *)string {
|
||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_0 || __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_9
|
||||
return [string stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
||||
#else
|
||||
return (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(NULL,
|
||||
(CFStringRef)string,
|
||||
NULL,
|
||||
(CFStringRef) @":/?#[]@!$&'()*+,;=",
|
||||
kCFStringEncodingUTF8));
|
||||
#endif
|
||||
}
|
||||
|
||||
- (NSURL *)appLinkURLWithTargetURL:(NSURL *)targetUrl error:(NSError **)error {
|
||||
@ -96,7 +88,7 @@ static id<FBSDKAppLinkResolving> defaultResolver;
|
||||
NSString *encoded = [self stringByEscapingQueryString:jsonString];
|
||||
|
||||
NSString *endUrlString = [NSString stringWithFormat:@"%@%@%@=%@",
|
||||
[targetUrl absoluteString],
|
||||
targetUrl.absoluteString,
|
||||
targetUrl.query ? @"&" : @"?",
|
||||
FBSDKAppLinkDataParameterName,
|
||||
encoded];
|
||||
@ -158,8 +150,8 @@ static id<FBSDKAppLinkResolving> defaultResolver;
|
||||
NSMutableDictionary<NSString *, id> *logData =
|
||||
[[NSMutableDictionary alloc] init];
|
||||
|
||||
NSString *outputURLScheme = [outputURL scheme];
|
||||
NSString *outputURLString = [outputURL absoluteString];
|
||||
NSString *outputURLScheme = outputURL.scheme;
|
||||
NSString *outputURLString = outputURL.absoluteString;
|
||||
if (outputURLScheme) {
|
||||
logData[@"outputURLScheme"] = outputURLScheme;
|
||||
}
|
||||
@ -167,9 +159,9 @@ static id<FBSDKAppLinkResolving> defaultResolver;
|
||||
logData[@"outputURL"] = outputURLString;
|
||||
}
|
||||
|
||||
NSString *sourceURLString = [self.appLink.sourceURL absoluteString];
|
||||
NSString *sourceURLHost = [self.appLink.sourceURL host];
|
||||
NSString *sourceURLScheme = [self.appLink.sourceURL scheme];
|
||||
NSString *sourceURLString = self.appLink.sourceURL.absoluteString;
|
||||
NSString *sourceURLHost = self.appLink.sourceURL.host;
|
||||
NSString *sourceURLScheme = self.appLink.sourceURL.scheme;
|
||||
if (sourceURLString) {
|
||||
logData[@"sourceURL"] = sourceURLString;
|
||||
}
|
||||
@ -179,8 +171,8 @@ static id<FBSDKAppLinkResolving> defaultResolver;
|
||||
if (sourceURLScheme) {
|
||||
logData[@"sourceScheme"] = sourceURLScheme;
|
||||
}
|
||||
if ([error localizedDescription]) {
|
||||
logData[@"error"] = [error localizedDescription];
|
||||
if (error.localizedDescription) {
|
||||
logData[@"error"] = error.localizedDescription;
|
||||
}
|
||||
NSString *success = nil; //no
|
||||
NSString *linkType = nil; // unknown;
|
||||
@ -207,7 +199,7 @@ static id<FBSDKAppLinkResolving> defaultResolver;
|
||||
logData[@"type"] = linkType;
|
||||
}
|
||||
|
||||
if ([self.appLink isBackToReferrer]) {
|
||||
if (self.appLink.backToReferrer) {
|
||||
[FBSDKMeasurementEvent postNotificationForEventName:FBSDKAppLinkNavigateBackToReferrerEventName args:logData];
|
||||
} else {
|
||||
[FBSDKMeasurementEvent postNotificationForEventName:FBSDKAppLinkNavigateOutEventName args:logData];
|
||||
|
||||
@ -102,10 +102,8 @@ static Class g_BFTaskClass;
|
||||
appLinks[url] = self.cachedFBSDKAppLinks[url];
|
||||
} else {
|
||||
[toFind addObject:url];
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
NSString *toFindString = [url.absoluteString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
#pragma clang diagnostic pop
|
||||
NSCharacterSet *urlAllowedSet = [NSCharacterSet URLQueryAllowedCharacterSet];
|
||||
NSString *toFindString = [url.absoluteString stringByAddingPercentEncodingWithAllowedCharacters:urlAllowedSet];
|
||||
if (toFindString) {
|
||||
[toFindStrings addObject:toFindString];
|
||||
}
|
||||
@ -147,25 +145,25 @@ static Class g_BFTaskClass;
|
||||
return;
|
||||
}
|
||||
for (NSURL *url in toFind) {
|
||||
id nestedObject = [[result objectForKey:url.absoluteString] objectForKey:kAppLinksKey];
|
||||
id nestedObject = result[url.absoluteString][kAppLinksKey];
|
||||
NSMutableArray *rawTargets = [NSMutableArray array];
|
||||
if (idiomSpecificField) {
|
||||
[rawTargets addObjectsFromArray:[nestedObject objectForKey:idiomSpecificField]];
|
||||
[rawTargets addObjectsFromArray:nestedObject[idiomSpecificField]];
|
||||
}
|
||||
[rawTargets addObjectsFromArray:[nestedObject objectForKey:kIOSKey]];
|
||||
[rawTargets addObjectsFromArray:nestedObject[kIOSKey]];
|
||||
|
||||
NSMutableArray<FBSDKAppLinkTarget *> *targets = [NSMutableArray arrayWithCapacity:rawTargets.count];
|
||||
for (id rawTarget in rawTargets) {
|
||||
[targets addObject:[FBSDKAppLinkTarget appLinkTargetWithURL:[NSURL URLWithString:[rawTarget objectForKey:kURLKey]]
|
||||
appStoreId:[rawTarget objectForKey:kIOSAppStoreIdKey]
|
||||
appName:[rawTarget objectForKey:kIOSAppNameKey]]];
|
||||
[targets addObject:[FBSDKAppLinkTarget appLinkTargetWithURL:[NSURL URLWithString:rawTarget[kURLKey]]
|
||||
appStoreId:rawTarget[kIOSAppStoreIdKey]
|
||||
appName:rawTarget[kIOSAppNameKey]]];
|
||||
}
|
||||
|
||||
id webTarget = [nestedObject objectForKey:kWebKey];
|
||||
NSString *webFallbackString = [webTarget objectForKey:kURLKey];
|
||||
id webTarget = nestedObject[kWebKey];
|
||||
NSString *webFallbackString = webTarget[kURLKey];
|
||||
NSURL *fallbackUrl = webFallbackString ? [NSURL URLWithString:webFallbackString] : url;
|
||||
|
||||
NSNumber *shouldFallback = [webTarget objectForKey:kShouldFallbackKey];
|
||||
NSNumber *shouldFallback = webTarget[kShouldFallbackKey];
|
||||
if (shouldFallback && !shouldFallback.boolValue) {
|
||||
fallbackUrl = nil;
|
||||
}
|
||||
@ -198,10 +196,8 @@ static Class g_BFTaskClass;
|
||||
appLinks[url] = self.cachedBFAppLinks[url];
|
||||
} else {
|
||||
[toFind addObject:url];
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
[toFindStrings addObject:[url.absoluteString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
|
||||
#pragma clang diagnostic pop
|
||||
NSCharacterSet *urlAllowedSet = [NSCharacterSet URLQueryAllowedCharacterSet];
|
||||
[toFindStrings addObject:[url.absoluteString stringByAddingPercentEncodingWithAllowedCharacters:urlAllowedSet]];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,25 +236,25 @@ static Class g_BFTaskClass;
|
||||
return;
|
||||
}
|
||||
for (NSURL *url in toFind) {
|
||||
id nestedObject = [[result objectForKey:url.absoluteString] objectForKey:kAppLinksKey];
|
||||
id nestedObject = result[url.absoluteString][kAppLinksKey];
|
||||
NSMutableArray *rawTargets = [NSMutableArray array];
|
||||
if (idiomSpecificField) {
|
||||
[rawTargets addObjectsFromArray:[nestedObject objectForKey:idiomSpecificField]];
|
||||
[rawTargets addObjectsFromArray:nestedObject[idiomSpecificField]];
|
||||
}
|
||||
[rawTargets addObjectsFromArray:[nestedObject objectForKey:kIOSKey]];
|
||||
[rawTargets addObjectsFromArray:nestedObject[kIOSKey]];
|
||||
|
||||
NSMutableArray<BFAppLinkTarget *> *targets = [NSMutableArray arrayWithCapacity:rawTargets.count];
|
||||
for (id rawTarget in rawTargets) {
|
||||
[targets addObject:[g_BFAppLinkTargetClass appLinkTargetWithURL:[NSURL URLWithString:[rawTarget objectForKey:kURLKey]]
|
||||
appStoreId:[rawTarget objectForKey:kIOSAppStoreIdKey]
|
||||
appName:[rawTarget objectForKey:kIOSAppNameKey]]];
|
||||
[targets addObject:[g_BFAppLinkTargetClass appLinkTargetWithURL:[NSURL URLWithString:rawTarget[kURLKey]]
|
||||
appStoreId:rawTarget[kIOSAppStoreIdKey]
|
||||
appName:rawTarget[kIOSAppNameKey]]];
|
||||
}
|
||||
|
||||
id webTarget = [nestedObject objectForKey:kWebKey];
|
||||
NSString *webFallbackString = [webTarget objectForKey:kURLKey];
|
||||
id webTarget = nestedObject[kWebKey];
|
||||
NSString *webFallbackString = webTarget[kURLKey];
|
||||
NSURL *fallbackUrl = webFallbackString ? [NSURL URLWithString:webFallbackString] : url;
|
||||
|
||||
NSNumber *shouldFallback = [webTarget objectForKey:kShouldFallbackKey];
|
||||
NSNumber *shouldFallback = webTarget[kShouldFallbackKey];
|
||||
if (shouldFallback && !shouldFallback.boolValue) {
|
||||
fallbackUrl = nil;
|
||||
}
|
||||
@ -288,7 +284,7 @@ static Class g_BFTaskClass;
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
+ (id)resolver
|
||||
+ (instancetype)resolver
|
||||
{
|
||||
return [[self alloc] initWithUserInterfaceIdiom:UI_USER_INTERFACE_IDIOM()];
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ static const CFTimeInterval kFBSDKViewAnimationDuration = 0.25f;
|
||||
#pragma mark - Private
|
||||
|
||||
- (void)statusBarFrameWillChange:(NSNotification *)notification {
|
||||
NSValue *rectValue = [[notification userInfo] valueForKey:UIApplicationStatusBarFrameUserInfoKey];
|
||||
NSValue *rectValue = [notification.userInfo valueForKey:UIApplicationStatusBarFrameUserInfoKey];
|
||||
CGRect newFrame;
|
||||
[rectValue getValue:&newFrame];
|
||||
|
||||
@ -145,7 +145,7 @@ static const CFTimeInterval kFBSDKViewAnimationDuration = 0.25f;
|
||||
}
|
||||
|
||||
- (void)statusBarFrameDidChange:(NSNotification *)notification {
|
||||
NSValue *rectValue = [[notification userInfo] valueForKey:UIApplicationStatusBarFrameUserInfoKey];
|
||||
NSValue *rectValue = [notification.userInfo valueForKey:UIApplicationStatusBarFrameUserInfoKey];
|
||||
CGRect newFrame;
|
||||
[rectValue getValue:&newFrame];
|
||||
|
||||
|
||||
@ -89,11 +89,7 @@ static const CGFloat FBSDKCloseButtonHeight = 12.0;
|
||||
_labelView.font = [UIFont systemFontOfSize:[UIFont smallSystemFontSize]];
|
||||
_labelView.textColor = [UIColor whiteColor];
|
||||
_labelView.backgroundColor = [UIColor clearColor];
|
||||
#ifdef __IPHONE_6_0
|
||||
_labelView.textAlignment = NSTextAlignmentCenter;
|
||||
#else
|
||||
_labelView.textAlignment = UITextAlignmentCenter;
|
||||
#endif
|
||||
_labelView.clipsToBounds = YES;
|
||||
[self updateLabelText];
|
||||
[self addSubview:_labelView];
|
||||
@ -156,7 +152,7 @@ static const CGFloat FBSDKCloseButtonHeight = 12.0;
|
||||
include = YES;
|
||||
break;
|
||||
case FBSDKIncludeStatusBarInSizeIOS7AndLater: {
|
||||
float systemVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
|
||||
float systemVersion = [UIDevice currentDevice].systemVersion.floatValue;
|
||||
include = (systemVersion >= 7.0);
|
||||
break;
|
||||
}
|
||||
@ -209,7 +205,7 @@ static const CGFloat FBSDKCloseButtonHeight = 12.0;
|
||||
#pragma mark - Private
|
||||
|
||||
- (void)updateLabelText {
|
||||
NSString *appName = (_refererAppLink && _refererAppLink.targets[0]) ? [_refererAppLink.targets[0] appName] : nil;
|
||||
NSString *appName = (_refererAppLink && _refererAppLink.targets[0]) ? _refererAppLink.targets[0].appName : nil;
|
||||
_labelView.text = [self localizedLabelForReferer:appName];
|
||||
}
|
||||
|
||||
@ -226,8 +222,8 @@ static const CGFloat FBSDKCloseButtonHeight = 12.0;
|
||||
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
|
||||
CGContextSetStrokeColorWithColor(context, [color CGColor]);
|
||||
CGContextSetFillColorWithColor(context, [color CGColor]);
|
||||
CGContextSetStrokeColorWithColor(context, color.CGColor);
|
||||
CGContextSetFillColorWithColor(context, color.CGColor);
|
||||
|
||||
CGContextSetLineWidth(context, 1.25f);
|
||||
|
||||
@ -269,7 +265,7 @@ static const CGFloat FBSDKCloseButtonHeight = 12.0;
|
||||
}
|
||||
|
||||
- (void)updateHidden {
|
||||
[super setHidden:_explicitlyHidden || _closed || !self.hasRefererData];
|
||||
super.hidden = _explicitlyHidden || _closed || !self.hasRefererData;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -20,9 +20,9 @@
|
||||
|
||||
@interface FBSDKAppLinkTarget ()
|
||||
|
||||
@property (nonatomic, strong, readwrite) NSURL *URL;
|
||||
@property (nonatomic, copy, readwrite) NSString *appStoreId;
|
||||
@property (nonatomic, copy, readwrite) NSString *appName;
|
||||
@property (nonatomic, strong) NSURL *URL;
|
||||
@property (nonatomic, copy) NSString *appStoreId;
|
||||
@property (nonatomic, copy) NSString *appName;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ typedef void (^FBSDKDeferredAppInviteHandler)(NSURL *url);
|
||||
@warning This method is no longer available and will always return NO.
|
||||
*/
|
||||
+ (BOOL)fetchDeferredAppInvite:(FBSDKDeferredAppInviteHandler)handler
|
||||
__attribute__((deprecated("This method is no longer available.")));;
|
||||
DEPRECATED_MSG_ATTRIBUTE("This method is no longer available.");
|
||||
|
||||
/*
|
||||
Call this method to fetch promotion code from the url, if it's present. This function
|
||||
|
||||
@ -63,10 +63,10 @@ static NSString *const FBSDKDeferredAppLinkEvent = @"DEFERRED_APP_LINK";
|
||||
NSString *createTimeUtc = result[@"click_time"];
|
||||
if (createTimeUtc) {
|
||||
// append/translate the create_time_utc so it can be used by clients
|
||||
NSString *modifiedURLString = [[applinkURL absoluteString]
|
||||
NSString *modifiedURLString = [applinkURL.absoluteString
|
||||
stringByAppendingFormat:@"%@fb_click_time_utc=%@",
|
||||
([applinkURL query]) ? @"&" : @"?" ,
|
||||
createTimeUtc ];
|
||||
(applinkURL.query) ? @"&" : @"?" ,
|
||||
createTimeUtc];
|
||||
applinkURL = [NSURL URLWithString:modifiedURLString];
|
||||
}
|
||||
}
|
||||
@ -88,12 +88,12 @@ static NSString *const FBSDKDeferredAppLinkEvent = @"DEFERRED_APP_LINK";
|
||||
+ (NSString*)appInvitePromotionCodeFromURL:(NSURL*)url;
|
||||
{
|
||||
BFURL *parsedUrl = [[FBSDKInternalUtility resolveBoltsClassWithName:@"BFURL"] URLWithURL:url];
|
||||
NSDictionary *extras = [parsedUrl appLinkExtras];
|
||||
NSDictionary *extras = parsedUrl.appLinkExtras;
|
||||
if (extras) {
|
||||
NSString *deeplinkContextString = extras[@"deeplink_context"];
|
||||
|
||||
// Parse deeplinkContext and extract promo code
|
||||
if ([deeplinkContextString length] > 0) {
|
||||
if (deeplinkContextString.length > 0) {
|
||||
NSError *error = nil;
|
||||
NSDictionary *deeplinkContextData = [FBSDKInternalUtility objectForJSONString:deeplinkContextString error:&error];
|
||||
if (!error && [deeplinkContextData isKindOfClass:[NSDictionary class]]) {
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
#import "FBSDKConstants.h"
|
||||
#import "FBSDKDynamicFrameworkLoader.h"
|
||||
#import "FBSDKError.h"
|
||||
#import "FBSDKGateKeeperManager.h"
|
||||
#import "FBSDKInternalUtility.h"
|
||||
#import "FBSDKLogger.h"
|
||||
#import "FBSDKServerConfiguration.h"
|
||||
@ -45,8 +46,16 @@
|
||||
#import "FBSDKProfile+Internal.h"
|
||||
#endif
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
|
||||
|
||||
NSNotificationName const FBSDKApplicationDidBecomeActiveNotification = @"com.facebook.sdk.FBSDKApplicationDidBecomeActiveNotification";
|
||||
|
||||
#else
|
||||
|
||||
NSString *const FBSDKApplicationDidBecomeActiveNotification = @"com.facebook.sdk.FBSDKApplicationDidBecomeActiveNotification";
|
||||
|
||||
#endif
|
||||
|
||||
static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
|
||||
@implementation FBSDKApplicationDelegate
|
||||
@ -95,7 +104,6 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
[FBSDKTimeSpentData registerAutoResetSourceApplication];
|
||||
|
||||
[FBSDKInternalUtility validateFacebookReservedURLSchemes];
|
||||
|
||||
// Remove the observer
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
@ -141,10 +149,14 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
openURL:(NSURL *)url
|
||||
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
|
||||
{
|
||||
return [self application:application
|
||||
openURL:url
|
||||
sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
|
||||
annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];
|
||||
if (@available(iOS 9.0, *)) {
|
||||
return [self application:application
|
||||
openURL:url
|
||||
sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
|
||||
annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -208,12 +220,14 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
}
|
||||
|
||||
_isAppLaunched = YES;
|
||||
FBSDKAccessToken *cachedToken = [[FBSDKSettings accessTokenCache] fetchAccessToken];
|
||||
FBSDKAccessToken *cachedToken = [FBSDKSettings accessTokenCache].accessToken;
|
||||
[FBSDKAccessToken setCurrentAccessToken:cachedToken];
|
||||
// fetch app settings
|
||||
[FBSDKServerConfigurationManager loadServerConfigurationWithCompletionBlock:NULL];
|
||||
// fetch gate keepers
|
||||
[FBSDKGateKeeperManager loadGateKeepers];
|
||||
|
||||
if ([[FBSDKSettings autoLogAppEventsEnabled] boolValue]) {
|
||||
if ([FBSDKSettings autoLogAppEventsEnabled].boolValue) {
|
||||
[self _logSDKInitialize];
|
||||
}
|
||||
#if !TARGET_OS_TV
|
||||
@ -249,7 +263,7 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
- (void)applicationDidBecomeActive:(NSNotification *)notification
|
||||
{
|
||||
// Auto log basic events in case autoLogAppEventsEnabled is set
|
||||
if ([[FBSDKSettings autoLogAppEventsEnabled] boolValue]) {
|
||||
if ([FBSDKSettings autoLogAppEventsEnabled].boolValue) {
|
||||
[FBSDKAppEvents activateApp];
|
||||
}
|
||||
// _expectingBackground can be YES if the caller started doing work (like login)
|
||||
@ -267,7 +281,7 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
if (notExpectingBackground) {
|
||||
_active = YES;
|
||||
#if !TARGET_OS_TV
|
||||
[_pendingURLOpen applicationDidBecomeActive:[notification object]];
|
||||
[_pendingURLOpen applicationDidBecomeActive:notification.object];
|
||||
[self _cancelBridgeRequest];
|
||||
#endif
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:FBSDKApplicationDidBecomeActiveNotification object:self];
|
||||
@ -288,9 +302,11 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
// Dispatch openURL calls to prevent hangs if we're inside the current app delegate's openURL flow already
|
||||
NSOperatingSystemVersion iOS10Version = { .majorVersion = 10, .minorVersion = 0, .patchVersion = 0 };
|
||||
if ([FBSDKInternalUtility isOSRunTimeVersionAtLeast:iOS10Version]) {
|
||||
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) {
|
||||
handler(success, nil);
|
||||
}];
|
||||
if (@available(iOS 10.0, *)) {
|
||||
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) {
|
||||
handler(success, nil);
|
||||
}];
|
||||
}
|
||||
} else {
|
||||
BOOL opened = [[UIApplication sharedApplication] openURL:url];
|
||||
|
||||
@ -332,10 +348,10 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
self->_pendingRequestCompletionBlock = nil;
|
||||
NSError *openedURLError;
|
||||
if ([request.scheme hasPrefix:@"http"]) {
|
||||
openedURLError = [FBSDKError errorWithCode:FBSDKBrowserUnavailableErrorCode
|
||||
openedURLError = [NSError fbErrorWithCode:FBSDKErrorBrowserUnavailable
|
||||
message:@"the app switch failed because the browser is unavailable"];
|
||||
} else {
|
||||
openedURLError = [FBSDKError errorWithCode:FBSDKAppVersionUnsupportedErrorCode
|
||||
openedURLError = [NSError fbErrorWithCode:FBSDKErrorAppVersionUnsupported
|
||||
message:@"the app switch failed because the destination app is out of date"];
|
||||
}
|
||||
FBSDKBridgeAPIResponse *response = [FBSDKBridgeAPIResponse bridgeAPIResponseWithRequest:request
|
||||
@ -409,7 +425,7 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
|
||||
NSURLComponents *components = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO];
|
||||
NSURLQueryItem *sfvcQueryItem = [[NSURLQueryItem alloc] initWithName:@"sfvc" value:@"1"];
|
||||
[components setQueryItems:[components.queryItems arrayByAddingObject:sfvcQueryItem]];
|
||||
components.queryItems = [components.queryItems arrayByAddingObject:sfvcQueryItem];
|
||||
url = components.URL;
|
||||
FBSDKContainerViewController *container = [[FBSDKContainerViewController alloc] init];
|
||||
container.delegate = self;
|
||||
@ -499,8 +515,8 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
NSURL *targetURL = [targetURLString isKindOfClass:[NSString class]] ? [NSURL URLWithString:targetURLString] : nil;
|
||||
|
||||
NSMutableDictionary *logData = [[NSMutableDictionary alloc] init];
|
||||
[FBSDKInternalUtility dictionary:logData setObject:[targetURL absoluteString] forKey:@"targetURL"];
|
||||
[FBSDKInternalUtility dictionary:logData setObject:[targetURL host] forKey:@"targetURLHost"];
|
||||
[FBSDKInternalUtility dictionary:logData setObject:targetURL.absoluteString forKey:@"targetURL"];
|
||||
[FBSDKInternalUtility dictionary:logData setObject:targetURL.host forKey:@"targetURLHost"];
|
||||
|
||||
NSDictionary *refererData = applinkData[@"referer_data"];
|
||||
if (refererData) {
|
||||
@ -508,8 +524,8 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
[FBSDKInternalUtility dictionary:logData setObject:refererData[@"url"] forKey:@"referralURL"];
|
||||
[FBSDKInternalUtility dictionary:logData setObject:refererData[@"app_name"] forKey:@"referralAppName"];
|
||||
}
|
||||
[FBSDKInternalUtility dictionary:logData setObject:[url absoluteString] forKey:@"inputURL"];
|
||||
[FBSDKInternalUtility dictionary:logData setObject:[url scheme] forKey:@"inputURLScheme"];
|
||||
[FBSDKInternalUtility dictionary:logData setObject:url.absoluteString forKey:@"inputURL"];
|
||||
[FBSDKInternalUtility dictionary:logData setObject:url.scheme forKey:@"inputURLScheme"];
|
||||
|
||||
[FBSDKAppEvents logImplicitEvent:FBSDKAppLinkInboundEvent
|
||||
valueToSum:nil
|
||||
@ -520,27 +536,27 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
- (void)_logSDKInitialize
|
||||
{
|
||||
NSMutableDictionary *params = [NSMutableDictionary new];
|
||||
[params setObject:@1 forKey:@"core_lib_included"];
|
||||
params[@"core_lib_included"] = @1;
|
||||
if (objc_lookUpClass("FBSDKShareDialog") != nil) {
|
||||
[params setObject:@1 forKey:@"share_lib_included"];
|
||||
params[@"share_lib_included"] = @1;
|
||||
}
|
||||
if (objc_lookUpClass("FBSDKLoginManager") != nil) {
|
||||
[params setObject:@1 forKey:@"login_lib_included"];
|
||||
params[@"login_lib_included"] = @1;
|
||||
}
|
||||
if (objc_lookUpClass("FBSDKPlacesManager") != nil) {
|
||||
[params setObject:@1 forKey:@"places_lib_included"];
|
||||
params[@"places_lib_included"] = @1;
|
||||
}
|
||||
if (objc_lookUpClass("FBSDKMessengerButton") != nil) {
|
||||
[params setObject:@1 forKey:@"messenger_lib_included"];
|
||||
params[@"messenger_lib_included"] = @1;
|
||||
}
|
||||
if (objc_lookUpClass("FBSDKMessengerButton") != nil) {
|
||||
[params setObject:@1 forKey:@"messenger_lib_included"];
|
||||
params[@"messenger_lib_included"] = @1;
|
||||
}
|
||||
if (objc_lookUpClass("FBSDKTVInterfaceFactory.m") != nil) {
|
||||
[params setObject:@1 forKey:@"tv_lib_included"];
|
||||
params[@"tv_lib_included"] = @1;
|
||||
}
|
||||
if (objc_lookUpClass("FBSDKAutoLog") != nil) {
|
||||
[params setObject:@1 forKey:@"marketing_lib_included"];
|
||||
params[@"marketing_lib_included"] = @1;
|
||||
}
|
||||
[FBSDKAppEvents logEvent:@"fb_sdk_initialize" parameters:params];
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@
|
||||
|
||||
- (CGRect)imageRectForContentRect:(CGRect)contentRect
|
||||
{
|
||||
if ([self isHidden] || CGRectIsEmpty(self.bounds)) {
|
||||
if (self.hidden || CGRectIsEmpty(self.bounds)) {
|
||||
return CGRectZero;
|
||||
}
|
||||
CGRect imageRect = UIEdgeInsetsInsetRect(contentRect, self.imageEdgeInsets);
|
||||
@ -101,9 +101,9 @@
|
||||
{
|
||||
// automatic impression tracking if the button conforms to FBSDKButtonImpressionTracking
|
||||
if ([self conformsToProtocol:@protocol(FBSDKButtonImpressionTracking)]) {
|
||||
NSString *eventName = [(id<FBSDKButtonImpressionTracking>)self impressionTrackingEventName];
|
||||
NSString *identifier = [(id<FBSDKButtonImpressionTracking>)self impressionTrackingIdentifier];
|
||||
NSDictionary *parameters = [(id<FBSDKButtonImpressionTracking>)self analyticsParameters];
|
||||
NSString *eventName = ((id<FBSDKButtonImpressionTracking>)self).impressionTrackingEventName;
|
||||
NSString *identifier = ((id<FBSDKButtonImpressionTracking>)self).impressionTrackingIdentifier;
|
||||
NSDictionary<NSString *, id> *parameters = ((id<FBSDKButtonImpressionTracking>)self).analyticsParameters;
|
||||
if (eventName && identifier) {
|
||||
FBSDKViewImpressionTracker *impressionTracker = [FBSDKViewImpressionTracker impressionTrackerWithEventName:eventName];
|
||||
[impressionTracker logImpressionWithIdentifier:identifier parameters:parameters];
|
||||
@ -114,7 +114,7 @@
|
||||
|
||||
- (CGSize)sizeThatFits:(CGSize)size
|
||||
{
|
||||
if ([self isHidden]) {
|
||||
if (self.hidden) {
|
||||
return CGSizeZero;
|
||||
}
|
||||
CGSize normalSize = [self sizeThatFits:size title:[self titleForState:UIControlStateNormal]];
|
||||
@ -131,7 +131,7 @@
|
||||
|
||||
- (CGRect)titleRectForContentRect:(CGRect)contentRect
|
||||
{
|
||||
if ([self isHidden] || CGRectIsEmpty(self.bounds)) {
|
||||
if (self.hidden || CGRectIsEmpty(self.bounds)) {
|
||||
return CGRectZero;
|
||||
}
|
||||
CGRect imageRect = [self imageRectForContentRect:contentRect];
|
||||
@ -174,9 +174,9 @@
|
||||
|
||||
- (void)checkImplicitlyDisabled
|
||||
{
|
||||
BOOL enabled = !_isExplicitlyDisabled && ![self isImplicitlyDisabled];
|
||||
BOOL currentEnabled = [self isEnabled];
|
||||
[super setEnabled:enabled];
|
||||
BOOL enabled = !_isExplicitlyDisabled && !self.implicitlyDisabled;
|
||||
BOOL currentEnabled = self.enabled;
|
||||
super.enabled = enabled;
|
||||
if (currentEnabled != enabled) {
|
||||
[self invalidateIntrinsicContentSize];
|
||||
[self setNeedsLayout];
|
||||
|
||||
@ -18,195 +18,300 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <FBSDKCoreKit/FBSDKMacros.h>
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
|
||||
|
||||
/**
|
||||
The error domain for all errors from FBSDKCoreKit.
|
||||
The error domain for all errors from FBSDKCoreKit.
|
||||
|
||||
Error codes from the SDK in the range 0-99 are reserved for this domain.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKErrorDomain;
|
||||
FOUNDATION_EXPORT NSErrorDomain const FBSDKErrorDomain;
|
||||
|
||||
#else
|
||||
|
||||
/**
|
||||
NS_ENUM(NSInteger, FBSDKErrorCode)
|
||||
Error codes for FBSDKErrorDomain.
|
||||
The error domain for all errors from FBSDKCoreKit.
|
||||
|
||||
Error codes from the SDK in the range 0-99 are reserved for this domain.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, FBSDKErrorCode)
|
||||
{
|
||||
/**
|
||||
Reserved.
|
||||
*/
|
||||
FBSDKReservedErrorCode = 0,
|
||||
FOUNDATION_EXPORT NSString *const FBSDKErrorDomain;
|
||||
|
||||
/**
|
||||
The error code for errors from invalid encryption on incoming encryption URLs.
|
||||
*/
|
||||
FBSDKEncryptionErrorCode,
|
||||
#endif
|
||||
|
||||
/**
|
||||
The error code for errors from invalid arguments to SDK methods.
|
||||
*/
|
||||
FBSDKInvalidArgumentErrorCode,
|
||||
|
||||
/**
|
||||
The error code for unknown errors.
|
||||
*/
|
||||
FBSDKUnknownErrorCode,
|
||||
|
||||
/**
|
||||
A request failed due to a network error. Use NSUnderlyingErrorKey to retrieve
|
||||
the error object from the NSURLConnection for more information.
|
||||
*/
|
||||
FBSDKNetworkErrorCode,
|
||||
|
||||
/**
|
||||
The error code for errors encountered during an App Events flush.
|
||||
*/
|
||||
FBSDKAppEventsFlushErrorCode,
|
||||
|
||||
/**
|
||||
An endpoint that returns a binary response was used with FBSDKGraphRequestConnection.
|
||||
|
||||
Endpoints that return image/jpg, etc. should be accessed using NSURLRequest
|
||||
*/
|
||||
FBSDKGraphRequestNonTextMimeTypeReturnedErrorCode,
|
||||
|
||||
/**
|
||||
The operation failed because the server returned an unexpected response.
|
||||
|
||||
You can get this error if you are not using the most recent SDK, or you are accessing a version of the
|
||||
Graph API incompatible with the current SDK.
|
||||
*/
|
||||
FBSDKGraphRequestProtocolMismatchErrorCode,
|
||||
|
||||
/**
|
||||
The Graph API returned an error.
|
||||
|
||||
See below for useful userInfo keys (beginning with FBSDKGraphRequestError*)
|
||||
*/
|
||||
FBSDKGraphRequestGraphAPIErrorCode,
|
||||
|
||||
/**
|
||||
The specified dialog configuration is not available.
|
||||
|
||||
This error may signify that the configuration for the dialogs has not yet been downloaded from the server
|
||||
or that the dialog is unavailable. Subsequent attempts to use the dialog may succeed as the configuration is loaded.
|
||||
*/
|
||||
FBSDKDialogUnavailableErrorCode,
|
||||
|
||||
/**
|
||||
Indicates an operation failed because a required access token was not found.
|
||||
*/
|
||||
FBSDKAccessTokenRequiredErrorCode,
|
||||
|
||||
/**
|
||||
Indicates an app switch (typically for a dialog) failed because the destination app is out of date.
|
||||
*/
|
||||
FBSDKAppVersionUnsupportedErrorCode,
|
||||
|
||||
/**
|
||||
Indicates an app switch to the browser (typically for a dialog) failed.
|
||||
*/
|
||||
FBSDKBrowserUnavailableErrorCode,
|
||||
|
||||
/**
|
||||
|
||||
@warning use FBSDKBrowserUnavailableErrorCode instead
|
||||
*/
|
||||
FBSDKBrowswerUnavailableErrorCode __attribute__ ((deprecated("use FBSDKBrowserUnavailableErrorCode instead"))) = FBSDKBrowserUnavailableErrorCode,
|
||||
};
|
||||
|
||||
/**
|
||||
NS_ENUM(NSUInteger, FBSDKGraphRequestErrorCategory)
|
||||
Describes the category of Facebook error. See `FBSDKGraphRequestErrorCategoryKey`.
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, FBSDKGraphRequestErrorCategory)
|
||||
{
|
||||
/** The default error category that is not known to be recoverable. Check `FBSDKLocalizedErrorDescriptionKey` for a user facing message. */
|
||||
FBSDKGraphRequestErrorCategoryOther = 0,
|
||||
/** Indicates the error is temporary (such as server throttling). While a recoveryAttempter will be provided with the error instance, the attempt is guaranteed to succeed so you can simply retry the operation if you do not want to present an alert. */
|
||||
FBSDKGraphRequestErrorCategoryTransient = 1,
|
||||
/** Indicates the error can be recovered (such as requiring a login). A recoveryAttempter will be provided with the error instance that can take UI action. */
|
||||
FBSDKGraphRequestErrorCategoryRecoverable = 2
|
||||
};
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0
|
||||
|
||||
/*
|
||||
@methodgroup error userInfo keys
|
||||
*/
|
||||
|
||||
/**
|
||||
The userInfo key for the invalid collection for errors with FBSDKInvalidArgumentErrorCode.
|
||||
The userInfo key for the invalid collection for errors with FBSDKErrorInvalidArgument.
|
||||
|
||||
If the invalid argument is a collection, the collection can be found with this key and the individual
|
||||
invalid item can be found with FBSDKErrorArgumentValueKey.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKErrorArgumentCollectionKey;
|
||||
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKErrorArgumentCollectionKey;
|
||||
|
||||
/**
|
||||
The userInfo key for the invalid argument name for errors with FBSDKInvalidArgumentErrorCode.
|
||||
The userInfo key for the invalid argument name for errors with FBSDKErrorInvalidArgument.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKErrorArgumentNameKey;
|
||||
FOUNDATION_EXPORT NSErrorUserInfoKey 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 FBSDKErrorInvalidArgument.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKErrorArgumentValueKey;
|
||||
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKErrorArgumentValueKey;
|
||||
|
||||
/**
|
||||
The userInfo key for the message for developers in NSErrors that originate from the SDK.
|
||||
The userInfo key for the message for developers in NSErrors that originate from the SDK.
|
||||
|
||||
The developer message will not be localized and is not intended to be presented within the app.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKErrorDeveloperMessageKey;
|
||||
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKErrorDeveloperMessageKey;
|
||||
|
||||
/**
|
||||
The userInfo key describing a localized description that can be presented to the user.
|
||||
The userInfo key describing a localized description that can be presented to the user.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKErrorLocalizedDescriptionKey;
|
||||
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKErrorLocalizedDescriptionKey;
|
||||
|
||||
/**
|
||||
The userInfo key describing a localized title that can be presented to the user, used with `FBSDKLocalizedErrorDescriptionKey`.
|
||||
The userInfo key describing a localized title that can be presented to the user, used with `FBSDKLocalizedErrorDescriptionKey`.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKErrorLocalizedTitleKey;
|
||||
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKErrorLocalizedTitleKey;
|
||||
|
||||
/*
|
||||
@methodgroup FBSDKGraphRequest error userInfo keys
|
||||
*/
|
||||
|
||||
/**
|
||||
The userInfo key describing the error category, for error recovery purposes.
|
||||
The userInfo key describing the error category, for error recovery purposes.
|
||||
|
||||
See `FBSDKGraphErrorRecoveryProcessor` and `[FBSDKGraphRequest disableErrorRecovery]`.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorCategoryKey;
|
||||
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKGraphRequestErrorKey;
|
||||
|
||||
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKGraphRequestErrorCategoryKey
|
||||
DEPRECATED_MSG_ATTRIBUTE("use FBSDKGraphRequestErrorKey instead");
|
||||
|
||||
/*
|
||||
The userInfo key for the Graph API error code.
|
||||
The userInfo key for the Graph API error code.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorGraphErrorCode;
|
||||
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKGraphRequestErrorGraphErrorCodeKey;
|
||||
|
||||
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKGraphRequestErrorGraphErrorCode
|
||||
DEPRECATED_MSG_ATTRIBUTE("use FBSDKGraphRequestErrorGraphErrorCodeKey instead");
|
||||
|
||||
/*
|
||||
The userInfo key for the Graph API error subcode.
|
||||
The userInfo key for the Graph API error subcode.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorGraphErrorSubcode;
|
||||
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKGraphRequestErrorGraphErrorSubcodeKey;
|
||||
|
||||
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKGraphRequestErrorGraphErrorSubcode
|
||||
DEPRECATED_MSG_ATTRIBUTE("use FBSDKGraphRequestErrorGraphErrorSubcodeKey instead");
|
||||
|
||||
/*
|
||||
The userInfo key for the HTTP status code.
|
||||
The userInfo key for the HTTP status code.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorHTTPStatusCodeKey;
|
||||
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKGraphRequestErrorHTTPStatusCodeKey;
|
||||
|
||||
/*
|
||||
The userInfo key for the raw JSON response.
|
||||
The userInfo key for the raw JSON response.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKGraphRequestErrorParsedJSONResponseKey;
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
@methodgroup error userInfo keys
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorParsedJSONResponseKey;
|
||||
|
||||
/**
|
||||
a formal protocol very similar to the informal protocol NSErrorRecoveryAttempting
|
||||
The userInfo key for the invalid collection for errors with FBSDKErrorInvalidArgument.
|
||||
|
||||
If the invalid argument is a collection, the collection can be found with this key and the individual
|
||||
invalid item can be found with FBSDKErrorArgumentValueKey.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString *const FBSDKErrorArgumentCollectionKey;
|
||||
|
||||
/**
|
||||
The userInfo key for the invalid argument name for errors with FBSDKErrorInvalidArgument.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString *const FBSDKErrorArgumentNameKey;
|
||||
|
||||
/**
|
||||
The userInfo key for the invalid argument value for errors with FBSDKErrorInvalidArgument.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString *const FBSDKErrorArgumentValueKey;
|
||||
|
||||
/**
|
||||
The userInfo key for the message for developers in NSErrors that originate from the SDK.
|
||||
|
||||
The developer message will not be localized and is not intended to be presented within the app.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString *const FBSDKErrorDeveloperMessageKey;
|
||||
|
||||
/**
|
||||
The userInfo key describing a localized description that can be presented to the user.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString *const FBSDKErrorLocalizedDescriptionKey;
|
||||
|
||||
/**
|
||||
The userInfo key describing a localized title that can be presented to the user, used with `FBSDKLocalizedErrorDescriptionKey`.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString *const FBSDKErrorLocalizedTitleKey;
|
||||
|
||||
/*
|
||||
@methodgroup FBSDKGraphRequest error userInfo keys
|
||||
*/
|
||||
|
||||
/**
|
||||
The userInfo key describing the error category, for error recovery purposes.
|
||||
|
||||
See `FBSDKGraphErrorRecoveryProcessor` and `[FBSDKGraphRequest disableErrorRecovery]`.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString *const FBSDKGraphRequestErrorKey;
|
||||
|
||||
FOUNDATION_EXPORT NSString *const FBSDKGraphRequestErrorCategoryKey
|
||||
DEPRECATED_MSG_ATTRIBUTE("use FBSDKGraphRequestErrorKey instead");
|
||||
|
||||
/*
|
||||
The userInfo key for the Graph API error code.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString *const FBSDKGraphRequestErrorGraphErrorCodeKey;
|
||||
|
||||
FOUNDATION_EXPORT NSString *const FBSDKGraphRequestErrorGraphErrorCode
|
||||
DEPRECATED_MSG_ATTRIBUTE("use FBSDKGraphRequestErrorGraphErrorCodeKey instead");
|
||||
|
||||
/*
|
||||
The userInfo key for the Graph API error subcode.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString *const FBSDKGraphRequestErrorGraphErrorSubcodeKey;
|
||||
|
||||
FOUNDATION_EXPORT NSString *const FBSDKGraphRequestErrorGraphErrorSubcode
|
||||
DEPRECATED_MSG_ATTRIBUTE("use FBSDKGraphRequestErrorGraphErrorSubcodeKey instead");
|
||||
|
||||
/*
|
||||
The userInfo key for the HTTP status code.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString *const FBSDKGraphRequestErrorHTTPStatusCodeKey;
|
||||
|
||||
/*
|
||||
The userInfo key for the raw JSON response.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString *const FBSDKGraphRequestErrorParsedJSONResponseKey;
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef NS_ERROR_ENUM
|
||||
#define NS_ERROR_ENUM(_domain, _name) \
|
||||
enum _name: NSInteger _name; \
|
||||
enum __attribute__((ns_error_domain(_domain))) _name: NSInteger
|
||||
#endif
|
||||
|
||||
/**
|
||||
FBSDKError
|
||||
Error codes for FBSDKErrorDomain.
|
||||
*/
|
||||
typedef NS_ERROR_ENUM(FBSDKErrorDomain, FBSDKError)
|
||||
{
|
||||
/**
|
||||
Reserved.
|
||||
*/
|
||||
FBSDKErrorReserved = 0,
|
||||
|
||||
/**
|
||||
The error code for errors from invalid encryption on incoming encryption URLs.
|
||||
*/
|
||||
FBSDKErrorEncryption,
|
||||
|
||||
/**
|
||||
The error code for errors from invalid arguments to SDK methods.
|
||||
*/
|
||||
FBSDKErrorInvalidArgument,
|
||||
|
||||
/**
|
||||
The error code for unknown errors.
|
||||
*/
|
||||
FBSDKErrorUnknown,
|
||||
|
||||
/**
|
||||
A request failed due to a network error. Use NSUnderlyingErrorKey to retrieve
|
||||
the error object from the NSURLSession for more information.
|
||||
*/
|
||||
FBSDKErrorNetwork,
|
||||
|
||||
/**
|
||||
The error code for errors encountered during an App Events flush.
|
||||
*/
|
||||
FBSDKErrorAppEventsFlush,
|
||||
|
||||
/**
|
||||
An endpoint that returns a binary response was used with FBSDKGraphRequestConnection.
|
||||
|
||||
Endpoints that return image/jpg, etc. should be accessed using NSURLRequest
|
||||
*/
|
||||
FBSDKErrorGraphRequestNonTextMimeTypeReturned,
|
||||
|
||||
/**
|
||||
The operation failed because the server returned an unexpected response.
|
||||
|
||||
You can get this error if you are not using the most recent SDK, or you are accessing a version of the
|
||||
Graph API incompatible with the current SDK.
|
||||
*/
|
||||
FBSDKErrorGraphRequestProtocolMismatch,
|
||||
|
||||
/**
|
||||
The Graph API returned an error.
|
||||
|
||||
See below for useful userInfo keys (beginning with FBSDKGraphRequestError*)
|
||||
*/
|
||||
FBSDKErrorGraphRequestGraphAPI,
|
||||
|
||||
/**
|
||||
The specified dialog configuration is not available.
|
||||
|
||||
This error may signify that the configuration for the dialogs has not yet been downloaded from the server
|
||||
or that the dialog is unavailable. Subsequent attempts to use the dialog may succeed as the configuration is loaded.
|
||||
*/
|
||||
FBSDKErrorDialogUnavailable,
|
||||
|
||||
/**
|
||||
Indicates an operation failed because a required access token was not found.
|
||||
*/
|
||||
FBSDKErrorAccessTokenRequired,
|
||||
|
||||
/**
|
||||
Indicates an app switch (typically for a dialog) failed because the destination app is out of date.
|
||||
*/
|
||||
FBSDKErrorAppVersionUnsupported,
|
||||
|
||||
/**
|
||||
Indicates an app switch to the browser (typically for a dialog) failed.
|
||||
*/
|
||||
FBSDKErrorBrowserUnavailable,
|
||||
};
|
||||
|
||||
/**
|
||||
FBSDKGraphRequestError
|
||||
Describes the category of Facebook error. See `FBSDKGraphRequestErrorKey`.
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, FBSDKGraphRequestError)
|
||||
{
|
||||
/** The default error category that is not known to be recoverable. Check `FBSDKLocalizedErrorDescriptionKey` for a user facing message. */
|
||||
FBSDKGraphRequestErrorOther = 0,
|
||||
/** Indicates the error is temporary (such as server throttling). While a recoveryAttempter will be provided with the error instance, the attempt is guaranteed to succeed so you can simply retry the operation if you do not want to present an alert. */
|
||||
FBSDKGraphRequestErrorTransient = 1,
|
||||
/** Indicates the error can be recovered (such as requiring a login). A recoveryAttempter will be provided with the error instance that can take UI action. */
|
||||
FBSDKGraphRequestErrorRecoverable = 2
|
||||
};
|
||||
|
||||
/**
|
||||
a formal protocol very similar to the informal protocol NSErrorRecoveryAttempting
|
||||
*/
|
||||
@protocol FBSDKErrorRecoveryAttempting<NSObject>
|
||||
|
||||
/**
|
||||
attempt the recovery
|
||||
attempt the recovery
|
||||
@param error the error
|
||||
@param recoveryOptionIndex the selected option index
|
||||
@param delegate the delegate
|
||||
@ -223,3 +328,34 @@ FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorParsedJSONResponseKey;
|
||||
- (void)attemptRecoveryFromError:(NSError *)error optionIndex:(NSUInteger)recoveryOptionIndex delegate:(id)delegate didRecoverSelector:(SEL)didRecoverSelector contextInfo:(void *)contextInfo;
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
Deprecated
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, FBSDKErrorCode)
|
||||
{
|
||||
FBSDKReservedErrorCode DEPRECATED_MSG_ATTRIBUTE("use FBSDKErrorReserved instead") = 0,
|
||||
FBSDKEncryptionErrorCode DEPRECATED_MSG_ATTRIBUTE("use FBSDKErrorEncryption instead"),
|
||||
FBSDKInvalidArgumentErrorCode DEPRECATED_MSG_ATTRIBUTE("use FBSDKErrorInvalidArgument instead"),
|
||||
FBSDKUnknownErrorCode DEPRECATED_MSG_ATTRIBUTE("use FBSDKErrorUnknown instead"),
|
||||
FBSDKNetworkErrorCode DEPRECATED_MSG_ATTRIBUTE("use FBSDKErrorNetwork instead"),
|
||||
FBSDKAppEventsFlushErrorCode DEPRECATED_MSG_ATTRIBUTE("use FBSDKErrorAppEventsFlush instead"),
|
||||
FBSDKGraphRequestNonTextMimeTypeReturnedErrorCode DEPRECATED_MSG_ATTRIBUTE("use FBSDKErrorGraphRequestNonTextMimeTypeReturned instead"),
|
||||
FBSDKGraphRequestProtocolMismatchErrorCode DEPRECATED_MSG_ATTRIBUTE("use FBSDKErrorGraphRequestProtocolMismatch instead"),
|
||||
FBSDKGraphRequestGraphAPIErrorCode DEPRECATED_MSG_ATTRIBUTE("use FBSDKErrorGraphRequestGraphAPI instead"),
|
||||
FBSDKDialogUnavailableErrorCode DEPRECATED_MSG_ATTRIBUTE("use FBSDKErrorDialogUnavailable instead"),
|
||||
FBSDKAccessTokenRequiredErrorCode DEPRECATED_MSG_ATTRIBUTE("use FBSDKErrorAccessTokenRequired instead"),
|
||||
FBSDKAppVersionUnsupportedErrorCode DEPRECATED_MSG_ATTRIBUTE("use FBSDKErrorAppVersionUnsupported instead"),
|
||||
FBSDKBrowserUnavailableErrorCode DEPRECATED_MSG_ATTRIBUTE("use FBSDKErrorBrowserUnavailable instead"),
|
||||
FBSDKBrowswerUnavailableErrorCode DEPRECATED_MSG_ATTRIBUTE("use FBSDKErrorBrowserUnavailable instead") = FBSDKBrowserUnavailableErrorCode,
|
||||
} DEPRECATED_MSG_ATTRIBUTE("use FBSDKError instead");
|
||||
|
||||
/**
|
||||
Deprecated
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, FBSDKGraphRequestErrorCategory)
|
||||
{
|
||||
FBSDKGraphRequestErrorCategoryOther DEPRECATED_MSG_ATTRIBUTE("use FBSDKGraphRequestErrorOther instead") = 0,
|
||||
FBSDKGraphRequestErrorCategoryTransient DEPRECATED_MSG_ATTRIBUTE("use FBSDKGraphRequestErrorTransient instead") = 1,
|
||||
FBSDKGraphRequestErrorCategoryRecoverable DEPRECATED_MSG_ATTRIBUTE("use FBSDKGraphRequestErrorRecoverable instead") = 2
|
||||
} DEPRECATED_MSG_ATTRIBUTE("use FBSDKGraphRequestError instead");
|
||||
|
||||
@ -18,8 +18,37 @@
|
||||
|
||||
#import "FBSDKConstants.h"
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
|
||||
|
||||
NSErrorDomain const FBSDKErrorDomain = @"com.facebook.sdk.core";
|
||||
|
||||
#else
|
||||
|
||||
NSString *const FBSDKErrorDomain = @"com.facebook.sdk.core";
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
|
||||
|
||||
NSErrorUserInfoKey const FBSDKErrorArgumentCollectionKey = @"com.facebook.sdk:FBSDKErrorArgumentCollectionKey";
|
||||
NSErrorUserInfoKey const FBSDKErrorArgumentNameKey = @"com.facebook.sdk:FBSDKErrorArgumentNameKey";
|
||||
NSErrorUserInfoKey const FBSDKErrorArgumentValueKey = @"com.facebook.sdk:FBSDKErrorArgumentValueKey";
|
||||
NSErrorUserInfoKey const FBSDKErrorDeveloperMessageKey = @"com.facebook.sdk:FBSDKErrorDeveloperMessageKey";
|
||||
NSErrorUserInfoKey const FBSDKErrorLocalizedDescriptionKey = @"com.facebook.sdk:FBSDKErrorLocalizedDescriptionKey";
|
||||
NSErrorUserInfoKey const FBSDKErrorLocalizedTitleKey = @"com.facebook.sdk:FBSDKErrorLocalizedErrorTitleKey";
|
||||
|
||||
NSErrorUserInfoKey const FBSDKGraphRequestErrorKey = @"com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey";
|
||||
NSErrorUserInfoKey const FBSDKGraphRequestErrorCategoryKey = @"com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey";
|
||||
NSErrorUserInfoKey const FBSDKGraphRequestErrorGraphErrorCodeKey = @"com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode";
|
||||
NSErrorUserInfoKey const FBSDKGraphRequestErrorGraphErrorCode = @"com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode";
|
||||
NSErrorUserInfoKey const FBSDKGraphRequestErrorGraphErrorSubcodeKey = @"com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorSubcode";
|
||||
NSErrorUserInfoKey const FBSDKGraphRequestErrorGraphErrorSubcode = @"com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorSubcode";
|
||||
NSErrorUserInfoKey const FBSDKGraphRequestErrorHTTPStatusCodeKey = @"com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey";
|
||||
NSErrorUserInfoKey const FBSDKGraphRequestErrorParsedJSONResponseKey = @"com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey";
|
||||
|
||||
#else
|
||||
|
||||
NSString *const FBSDKErrorArgumentCollectionKey = @"com.facebook.sdk:FBSDKErrorArgumentCollectionKey";
|
||||
NSString *const FBSDKErrorArgumentNameKey = @"com.facebook.sdk:FBSDKErrorArgumentNameKey";
|
||||
NSString *const FBSDKErrorArgumentValueKey = @"com.facebook.sdk:FBSDKErrorArgumentValueKey";
|
||||
@ -27,8 +56,13 @@ NSString *const FBSDKErrorDeveloperMessageKey = @"com.facebook.sdk:FBSDKErrorDev
|
||||
NSString *const FBSDKErrorLocalizedDescriptionKey = @"com.facebook.sdk:FBSDKErrorLocalizedDescriptionKey";
|
||||
NSString *const FBSDKErrorLocalizedTitleKey = @"com.facebook.sdk:FBSDKErrorLocalizedErrorTitleKey";
|
||||
|
||||
NSString *const FBSDKGraphRequestErrorKey = @"com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey";
|
||||
NSString *const FBSDKGraphRequestErrorCategoryKey = @"com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey";
|
||||
NSString *const FBSDKGraphRequestErrorGraphErrorCodeKey = @"com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode";
|
||||
NSString *const FBSDKGraphRequestErrorGraphErrorCode = @"com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode";
|
||||
NSString *const FBSDKGraphRequestErrorGraphErrorSubcodeKey = @"com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorSubcode";
|
||||
NSString *const FBSDKGraphRequestErrorGraphErrorSubcode = @"com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorSubcode";
|
||||
NSString *const FBSDKGraphRequestErrorHTTPStatusCodeKey = @"com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey";
|
||||
NSString *const FBSDKGraphRequestErrorParsedJSONResponseKey = @"com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey";
|
||||
|
||||
#endif
|
||||
|
||||
@ -53,5 +53,5 @@
|
||||
#import <FBSDKCoreKit/FBSDKDeviceViewControllerBase.h>
|
||||
#endif
|
||||
|
||||
#define FBSDK_VERSION_STRING @"4.37.0"
|
||||
#define FBSDK_TARGET_PLATFORM_VERSION @"v3.1"
|
||||
#define FBSDK_VERSION_STRING @"4.39.0"
|
||||
#define FBSDK_TARGET_PLATFORM_VERSION @"v3.2"
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
|
||||
return NO if the processor should not process the error. For example,
|
||||
if you want to prevent alerts of localized messages but otherwise perform retries and recoveries,
|
||||
you could return NO for errors where userInfo[FBSDKGraphRequestErrorCategoryKey] equal to FBSDKGraphRequestErrorCategoryOther
|
||||
you could return NO for errors where userInfo[FBSDKGraphRequestErrorKey] equal to FBSDKGraphRequestErrorOther
|
||||
*/
|
||||
- (BOOL)processorWillProcessError:(FBSDKGraphErrorRecoveryProcessor *)processor error:(NSError *)error;
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
Facebook NSErrors can contain FBSDKErrorRecoveryAttempting instances to recover from errors, or
|
||||
localized messages to present to the user. This class will process the instances as follows:
|
||||
|
||||
1. If the error is temporary as indicated by FBSDKGraphRequestErrorCategoryKey, assume the recovery succeeded and
|
||||
1. If the error is temporary as indicated by FBSDKGraphRequestErrorKey, assume the recovery succeeded and
|
||||
notify the delegate.
|
||||
2. If a FBSDKErrorRecoveryAttempting instance is available, display an alert (dispatched to main thread)
|
||||
with the recovery options and call the instance's [ attemptRecoveryFromError:optionIndex:...].
|
||||
|
||||
@ -20,17 +20,13 @@
|
||||
#import "FBSDKCoreKit+Internal.h"
|
||||
#import "FBSDKErrorRecoveryAttempter.h"
|
||||
|
||||
@interface FBSDKGraphErrorRecoveryProcessor()<UIAlertViewDelegate>
|
||||
@interface FBSDKGraphErrorRecoveryProcessor()
|
||||
{
|
||||
FBSDKErrorRecoveryAttempter *_recoveryAttempter;
|
||||
NSError *_error;
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
UIAlertView *_alertView;
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
@property (nonatomic, strong, readwrite) id<FBSDKGraphErrorRecoveryProcessorDelegate>delegate;
|
||||
@property (nonatomic, strong) id<FBSDKGraphErrorRecoveryProcessorDelegate>delegate;
|
||||
|
||||
@end
|
||||
|
||||
@ -38,9 +34,7 @@
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if (_alertView) {
|
||||
_alertView.delegate = nil;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (BOOL)processError:(NSError *)error request:(FBSDKGraphRequest *)request delegate:(id<FBSDKGraphErrorRecoveryProcessorDelegate>) delegate
|
||||
@ -52,13 +46,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
FBSDKGraphRequestErrorCategory errorCategory = [error.userInfo[FBSDKGraphRequestErrorCategoryKey] unsignedIntegerValue];
|
||||
FBSDKGraphRequestError errorCategory = [error.userInfo[FBSDKGraphRequestErrorKey] unsignedIntegerValue];
|
||||
switch (errorCategory) {
|
||||
case FBSDKGraphRequestErrorCategoryTransient :
|
||||
case FBSDKGraphRequestErrorTransient :
|
||||
[self.delegate processorDidAttemptRecovery:self didRecover:YES error:nil];
|
||||
self.delegate = nil;
|
||||
return YES;
|
||||
case FBSDKGraphRequestErrorCategoryRecoverable :
|
||||
case FBSDKGraphRequestErrorRecoverable :
|
||||
if ([request.tokenString isEqualToString:[FBSDKAccessToken currentAccessToken].tokenString]) {
|
||||
_recoveryAttempter = error.recoveryAttempter;
|
||||
BOOL isLoginRecoveryAttempter = [_recoveryAttempter isKindOfClass:NSClassFromString(@"_FBSDKLoginRecoveryAttempter")];
|
||||
@ -78,7 +72,7 @@
|
||||
return NO;
|
||||
};
|
||||
|
||||
if ([request.tokenString isEqualToString:[[FBSDKSystemAccountStoreAdapter sharedInstance] accessTokenString]] &&
|
||||
if ([request.tokenString isEqualToString:[FBSDKSystemAccountStoreAdapter sharedInstance].accessTokenString] &&
|
||||
isLoginRecoveryAttempter) {
|
||||
// special system auth case: if user has granted permissions we can simply renew. On a successful
|
||||
// renew, treat this as immediately recovered without the standard alert prompty.
|
||||
@ -101,7 +95,7 @@
|
||||
return standardRecoveryWork();
|
||||
}
|
||||
return NO;
|
||||
case FBSDKGraphRequestErrorCategoryOther :
|
||||
case FBSDKGraphRequestErrorOther :
|
||||
if ([request.tokenString isEqualToString:[FBSDKAccessToken currentAccessToken].tokenString]) {
|
||||
NSString *message = error.userInfo[FBSDKErrorLocalizedDescriptionKey];
|
||||
NSString *title = error.userInfo[FBSDKErrorLocalizedTitleKey];
|
||||
@ -120,93 +114,53 @@
|
||||
return NO;
|
||||
}
|
||||
|
||||
#pragma mark - UIAlertView and UIAlertController support
|
||||
#pragma mark - UIAlertController support
|
||||
|
||||
- (void)displayAlertWithRecoverySuggestion:(NSString *)recoverySuggestion recoveryOptionsTitles:(NSArray<NSString *> *)recoveryOptionsTitles
|
||||
{
|
||||
if ([UIAlertController class]) {
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
|
||||
message:recoverySuggestion
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
for (NSUInteger i = 0; i < recoveryOptionsTitles.count; i++) {
|
||||
NSString *title = recoveryOptionsTitles[i];
|
||||
UIAlertAction *option = [UIAlertAction actionWithTitle:title
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * _Nonnull action) {
|
||||
[self->_recoveryAttempter attemptRecoveryFromError:self->_error
|
||||
optionIndex:i
|
||||
delegate:self
|
||||
didRecoverSelector:@selector(didPresentErrorWithRecovery:contextInfo:)
|
||||
contextInfo:nil];
|
||||
}];
|
||||
[alertController addAction:option];
|
||||
}
|
||||
UIViewController *topMostViewController = [FBSDKInternalUtility topMostViewController];
|
||||
[topMostViewController presentViewController:alertController
|
||||
animated:YES
|
||||
completion:nil];
|
||||
} else {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
_alertView = [[UIAlertView alloc] initWithTitle:nil
|
||||
message:recoverySuggestion
|
||||
delegate:self
|
||||
cancelButtonTitle:nil
|
||||
otherButtonTitles:nil];
|
||||
#pragma clang diagnostic pop
|
||||
for (NSString *option in recoveryOptionsTitles) {
|
||||
[_alertView addButtonWithTitle:option];
|
||||
}
|
||||
[_alertView show];
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
|
||||
message:recoverySuggestion
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
for (NSUInteger i = 0; i < recoveryOptionsTitles.count; i++) {
|
||||
NSString *title = recoveryOptionsTitles[i];
|
||||
UIAlertAction *option = [UIAlertAction actionWithTitle:title
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * _Nonnull action) {
|
||||
[self->_recoveryAttempter attemptRecoveryFromError:self->_error
|
||||
optionIndex:i
|
||||
delegate:self
|
||||
didRecoverSelector:@selector(didPresentErrorWithRecovery:contextInfo:)
|
||||
contextInfo:nil];
|
||||
}];
|
||||
[alertController addAction:option];
|
||||
}
|
||||
UIViewController *topMostViewController = [FBSDKInternalUtility topMostViewController];
|
||||
[topMostViewController presentViewController:alertController
|
||||
animated:YES
|
||||
completion:nil];
|
||||
}
|
||||
|
||||
- (void)displayAlertWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)localizedOK
|
||||
{
|
||||
if ([UIAlertController class]) {
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
|
||||
message:message
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *OKAction = [UIAlertAction actionWithTitle:localizedOK
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction * _Nonnull action) {
|
||||
[self->_recoveryAttempter attemptRecoveryFromError:self->_error
|
||||
optionIndex:0
|
||||
delegate:self
|
||||
didRecoverSelector:@selector(didPresentErrorWithRecovery:contextInfo:)
|
||||
contextInfo:nil];
|
||||
}];
|
||||
[alertController addAction:OKAction];
|
||||
UIViewController *topMostViewController = [FBSDKInternalUtility topMostViewController];
|
||||
[topMostViewController presentViewController:alertController
|
||||
animated:YES
|
||||
completion:nil];
|
||||
} else {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
[[[UIAlertView alloc] initWithTitle:title
|
||||
message:message
|
||||
delegate:nil
|
||||
cancelButtonTitle:localizedOK
|
||||
otherButtonTitles:nil] show];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
|
||||
message:message
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *OKAction = [UIAlertAction actionWithTitle:localizedOK
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction * _Nonnull action) {
|
||||
[self->_recoveryAttempter attemptRecoveryFromError:self->_error
|
||||
optionIndex:0
|
||||
delegate:self
|
||||
didRecoverSelector:@selector(didPresentErrorWithRecovery:contextInfo:)
|
||||
contextInfo:nil];
|
||||
}];
|
||||
[alertController addAction:OKAction];
|
||||
UIViewController *topMostViewController = [FBSDKInternalUtility topMostViewController];
|
||||
[topMostViewController presentViewController:alertController
|
||||
animated:YES
|
||||
completion:nil];
|
||||
}
|
||||
|
||||
#pragma mark - UIAlertViewDelegate
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
|
||||
{
|
||||
[_recoveryAttempter attemptRecoveryFromError:_error optionIndex:buttonIndex delegate:self didRecoverSelector:@selector(didPresentErrorWithRecovery:contextInfo:) contextInfo:nil];
|
||||
if (_alertView) {
|
||||
_alertView.delegate = nil;
|
||||
_alertView = nil;
|
||||
}
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
#pragma mark - FBSDKErrorRecoveryAttempting "delegate"
|
||||
|
||||
- (void)didPresentErrorWithRecovery:(BOOL)didRecover contextInfo:(void *)contextInfo
|
||||
|
||||
@ -43,6 +43,9 @@
|
||||
*/
|
||||
@interface FBSDKGraphRequest : NSObject
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
Initializes a new instance that use use `[FBSDKAccessToken currentAccessToken]`.
|
||||
@param graphPath the graph path (e.g., @"me").
|
||||
|
||||
@ -38,11 +38,6 @@ static NSString *const kPostHTTPMethod = @"POST";
|
||||
|
||||
@implementation FBSDKGraphRequest
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
|
||||
- (instancetype)initWithGraphPath:(NSString *)graphPath
|
||||
parameters:(NSDictionary *)parameters {
|
||||
return [self initWithGraphPath:graphPath
|
||||
@ -154,10 +149,9 @@ static NSString *const kPostHTTPMethod = @"POST";
|
||||
forBatch:(BOOL)forBatch {
|
||||
params = [self preprocessParams: params];
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
NSURL *parsedURL = [NSURL URLWithString:[baseUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
|
||||
#pragma clang pop
|
||||
NSCharacterSet *urlAllowedSet = [NSCharacterSet URLFragmentAllowedCharacterSet];
|
||||
NSURL *parsedURL = [NSURL URLWithString:[baseUrl stringByAddingPercentEncodingWithAllowedCharacters:urlAllowedSet]];
|
||||
|
||||
if ([httpMethod isEqualToString:kPostHTTPMethod] && !forBatch) {
|
||||
return baseUrl;
|
||||
}
|
||||
@ -181,7 +175,7 @@ static NSString *const kPostHTTPMethod = @"POST";
|
||||
NSString *debugValue = [FBSDKSettings graphAPIDebugParamValue];
|
||||
if (debugValue) {
|
||||
NSMutableDictionary *mutableParams = [NSMutableDictionary dictionaryWithDictionary:params];
|
||||
[mutableParams setObject:debugValue forKey:@"debug"];
|
||||
mutableParams[@"debug"] = debugValue;
|
||||
return mutableParams;
|
||||
}
|
||||
|
||||
@ -209,7 +203,7 @@ static NSString *const kPostHTTPMethod = @"POST";
|
||||
if (self.HTTPMethod) {
|
||||
[result appendFormat:@", HTTPMethod: %@", self.HTTPMethod];
|
||||
}
|
||||
[result appendFormat:@", parameters: %@>", [self.parameters description]];
|
||||
[result appendFormat:@", parameters: %@>", self.parameters.description];
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <FBSDKCoreKit/FBSDKMacros.h>
|
||||
|
||||
@class FBSDKGraphRequest;
|
||||
@class FBSDKGraphRequestConnection;
|
||||
|
||||
@ -118,7 +116,7 @@ typedef void (^FBSDKGraphRequestHandler)(FBSDKGraphRequestConnection *connection
|
||||
|
||||
The byte count arguments refer to the aggregated <FBSDKGraphRequest> objects, not a particular <FBSDKGraphRequest>.
|
||||
|
||||
Like `NSURLConnection`, the values may change in unexpected ways if data needs to be resent.
|
||||
Like `NSURLSession`, the values may change in unexpected ways if data needs to be resent.
|
||||
|
||||
@param connection The request connection transmitting data to a remote host
|
||||
@param bytesWritten The number of bytes sent in the last transmission
|
||||
@ -153,7 +151,7 @@ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite;
|
||||
/**
|
||||
Gets or sets the timeout interval to wait for a response before giving up.
|
||||
*/
|
||||
@property (nonatomic) NSTimeInterval timeout;
|
||||
@property (nonatomic, assign) NSTimeInterval timeout;
|
||||
|
||||
/**
|
||||
The raw response that was returned from the server. (readonly)
|
||||
@ -222,9 +220,14 @@ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite;
|
||||
completion or cancellation of the connection. This request can be named
|
||||
to allow for using the request's response in a subsequent request.
|
||||
*/
|
||||
- (void)addRequest:(FBSDKGraphRequest *)request
|
||||
batchEntryName:(NSString *)name
|
||||
completionHandler:(FBSDKGraphRequestHandler)handler;
|
||||
|
||||
- (void)addRequest:(FBSDKGraphRequest *)request
|
||||
completionHandler:(FBSDKGraphRequestHandler)handler
|
||||
batchEntryName:(NSString *)name;
|
||||
batchEntryName:(NSString *)name
|
||||
DEPRECATED_MSG_ATTRIBUTE("Renamed `addRequest:batchEntryName:completionHandler:`");
|
||||
|
||||
/**
|
||||
@method
|
||||
@ -245,9 +248,14 @@ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite;
|
||||
completion or cancellation of the connection. This request can be named
|
||||
to allow for using the request's response in a subsequent request.
|
||||
*/
|
||||
- (void)addRequest:(FBSDKGraphRequest *)request
|
||||
batchParameters:(NSDictionary<NSString *, id> *)batchParameters
|
||||
completionHandler:(FBSDKGraphRequestHandler)handler;
|
||||
|
||||
- (void)addRequest:(FBSDKGraphRequest *)request
|
||||
completionHandler:(FBSDKGraphRequestHandler)handler
|
||||
batchParameters:(NSDictionary *)batchParameters;
|
||||
batchParameters:(NSDictionary *)batchParameters
|
||||
DEPRECATED_MSG_ATTRIBUTE("Renamed `addRequest:batchParameters:completionHandler:`");
|
||||
|
||||
/**
|
||||
@methodgroup Instance methods
|
||||
@ -289,8 +297,6 @@ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite;
|
||||
|
||||
By default, a connection is scheduled on the current thread in the default mode when it is created.
|
||||
You cannot reschedule a connection after it has started.
|
||||
|
||||
This is very similar to `[NSURLConnection setDelegateQueue:]`.
|
||||
*/
|
||||
- (void)setDelegateQueue:(NSOperationQueue *)queue;
|
||||
|
||||
@ -307,7 +313,10 @@ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite;
|
||||
|
||||
@param version This is a string in the form @"v2.0" which will be used for the version part of an API path
|
||||
*/
|
||||
- (void)overrideVersionPartWith:(NSString *)version;
|
||||
- (void)overrideGraphAPIVersion:(NSString *)version;
|
||||
|
||||
- (void)overrideVersionPartWith:(NSString *)version
|
||||
DEPRECATED_MSG_ATTRIBUTE("Renamed `overrideGraphAPIVersion`");
|
||||
|
||||
@end
|
||||
|
||||
@ -320,4 +329,4 @@ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite;
|
||||
will be wrapped into a dictionary using this const as the key. This only applies for very few Graph API
|
||||
prior to v2.1.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKNonJSONResponseProperty;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKNonJSONResponseProperty;
|
||||
|
||||
@ -154,20 +154,20 @@ NSURLSessionDataDelegate
|
||||
- (void)addRequest:(FBSDKGraphRequest *)request
|
||||
completionHandler:(FBSDKGraphRequestHandler)handler
|
||||
{
|
||||
[self addRequest:request completionHandler:handler batchEntryName:nil];
|
||||
[self addRequest:request batchEntryName:nil completionHandler:handler];
|
||||
}
|
||||
|
||||
- (void)addRequest:(FBSDKGraphRequest *)request
|
||||
completionHandler:(FBSDKGraphRequestHandler)handler
|
||||
batchEntryName:(NSString *)name
|
||||
completionHandler:(FBSDKGraphRequestHandler)handler
|
||||
{
|
||||
NSDictionary *batchParams = (name)? @{kBatchEntryName : name } : nil;
|
||||
[self addRequest:request completionHandler:handler batchParameters:batchParams];
|
||||
[self addRequest:request batchParameters:batchParams completionHandler:handler];
|
||||
}
|
||||
|
||||
- (void)addRequest:(FBSDKGraphRequest *)request
|
||||
batchParameters:(NSDictionary<NSString *, id> *)batchParameters
|
||||
completionHandler:(FBSDKGraphRequestHandler)handler
|
||||
batchParameters:(NSDictionary *)batchParameters
|
||||
{
|
||||
if (self.state != kStateCreated) {
|
||||
@throw [NSException exceptionWithName:NSInternalInconsistencyException
|
||||
@ -181,6 +181,20 @@ NSURLSessionDataDelegate
|
||||
[self.requests addObject:metadata];
|
||||
}
|
||||
|
||||
- (void)addRequest:(FBSDKGraphRequest *)request
|
||||
completionHandler:(FBSDKGraphRequestHandler)handler
|
||||
batchEntryName:(NSString *)name
|
||||
{
|
||||
[self addRequest:request batchEntryName:name completionHandler:handler];
|
||||
}
|
||||
|
||||
- (void)addRequest:(FBSDKGraphRequest *)request
|
||||
completionHandler:(FBSDKGraphRequestHandler)handler
|
||||
batchParameters:(NSDictionary *)batchParameters
|
||||
{
|
||||
[self addRequest:request batchParameters:batchParameters completionHandler:handler];
|
||||
}
|
||||
|
||||
- (void)cancel
|
||||
{
|
||||
self.state = kStateCancelled;
|
||||
@ -188,13 +202,18 @@ NSURLSessionDataDelegate
|
||||
[self cleanUpSession];
|
||||
}
|
||||
|
||||
- (void)overrideVersionPartWith:(NSString *)version
|
||||
- (void)overrideGraphAPIVersion:(NSString *)version
|
||||
{
|
||||
if (![_overrideVersionPart isEqualToString:version]) {
|
||||
_overrideVersionPart = [version copy];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)overrideVersionPartWith:(NSString *)version
|
||||
{
|
||||
[self overrideGraphAPIVersion:version];
|
||||
}
|
||||
|
||||
- (void)start
|
||||
{
|
||||
static dispatch_once_t onceToken;
|
||||
@ -284,13 +303,13 @@ NSURLSessionDataDelegate
|
||||
if ([FBSDKGraphRequest isAttachment:value]) {
|
||||
NSString *name = [NSString stringWithFormat:@"%@%lu",
|
||||
kBatchFileNamePrefix,
|
||||
(unsigned long)[attachments count]];
|
||||
(unsigned long)attachments.count];
|
||||
[attachmentNames addObject:name];
|
||||
attachments[name] = value;
|
||||
}
|
||||
}];
|
||||
|
||||
if ([attachmentNames count]) {
|
||||
if (attachmentNames.count) {
|
||||
requestElement[kBatchAttachmentKey] = [attachmentNames componentsJoinedByString:@","];
|
||||
}
|
||||
|
||||
@ -412,16 +431,16 @@ NSURLSessionDataDelegate
|
||||
|
||||
[self _validateFieldsParamForGetRequests:requests];
|
||||
|
||||
if ([requests count] == 1) {
|
||||
FBSDKGraphRequestMetadata *metadata = [requests objectAtIndex:0];
|
||||
if (requests.count == 1) {
|
||||
FBSDKGraphRequestMetadata *metadata = requests[0];
|
||||
NSURL *url = [NSURL URLWithString:[self urlStringForSingleRequest:metadata.request forBatch:NO]];
|
||||
request = [NSMutableURLRequest requestWithURL:url
|
||||
cachePolicy:NSURLRequestUseProtocolCachePolicy
|
||||
timeoutInterval:timeout];
|
||||
|
||||
// HTTP methods are case-sensitive; be helpful in case someone provided a mixed case one.
|
||||
NSString *httpMethod = [metadata.request.HTTPMethod uppercaseString];
|
||||
[request setHTTPMethod:httpMethod];
|
||||
NSString *httpMethod = metadata.request.HTTPMethod.uppercaseString;
|
||||
request.HTTPMethod = httpMethod;
|
||||
[self appendAttachments:metadata.request.parameters
|
||||
toBody:body
|
||||
addFormData:[httpMethod isEqualToString:@"POST"]
|
||||
@ -457,11 +476,11 @@ NSURLSessionDataDelegate
|
||||
request = [NSMutableURLRequest requestWithURL:url
|
||||
cachePolicy:NSURLRequestUseProtocolCachePolicy
|
||||
timeoutInterval:timeout];
|
||||
[request setHTTPMethod:@"POST"];
|
||||
request.HTTPMethod = @"POST";
|
||||
}
|
||||
|
||||
[request setHTTPBody:[body data]];
|
||||
NSUInteger bodyLength = [[body data] length] / 1024;
|
||||
request.HTTPBody = body.data;
|
||||
NSUInteger bodyLength = body.data.length / 1024;
|
||||
|
||||
[request setValue:[FBSDKGraphRequestConnection userAgent] forHTTPHeaderField:@"User-Agent"];
|
||||
[request setValue:[body mimeContentType] forHTTPHeaderField:@"Content-Type"];
|
||||
@ -501,17 +520,17 @@ NSURLSessionDataDelegate
|
||||
NSString *prefix = kGraphURLPrefix;
|
||||
// We special case a graph post to <id>/videos and send it to graph-video.facebook.com
|
||||
// We only do this for non batch post requests
|
||||
NSString *graphPath = [request.graphPath lowercaseString];
|
||||
if ([[request.HTTPMethod uppercaseString] isEqualToString:@"POST"] &&
|
||||
NSString *graphPath = request.graphPath.lowercaseString;
|
||||
if ([request.HTTPMethod.uppercaseString isEqualToString:@"POST"] &&
|
||||
[graphPath hasSuffix:@"/videos"]) {
|
||||
graphPath = [graphPath stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"/"]];
|
||||
NSArray *components = [graphPath componentsSeparatedByString:@"/"];
|
||||
if ([components count] == 2) {
|
||||
if (components.count == 2) {
|
||||
prefix = kGraphVideoURLPrefix;
|
||||
}
|
||||
}
|
||||
|
||||
baseURL = [[FBSDKInternalUtility facebookURLWithHostPrefix:prefix path:request.graphPath queryParameters:nil defaultVersion:request.version error:NULL] absoluteString];
|
||||
baseURL = [FBSDKInternalUtility facebookURLWithHostPrefix:prefix path:request.graphPath queryParameters:nil defaultVersion:request.version error:NULL].absoluteString;
|
||||
}
|
||||
|
||||
NSString *url = [FBSDKGraphRequest serializeURL:baseURL
|
||||
@ -544,7 +563,7 @@ NSURLSessionDataDelegate
|
||||
NSInteger statusCode = _URLResponse.statusCode;
|
||||
|
||||
if (!error && [response.MIMEType hasPrefix:@"image"]) {
|
||||
error = [FBSDKError errorWithCode:FBSDKGraphRequestNonTextMimeTypeReturnedErrorCode
|
||||
error = [NSError fbErrorWithCode:FBSDKErrorGraphRequestNonTextMimeTypeReturned
|
||||
message:@"Response is a non-text MIME type; endpoints that return images and other "
|
||||
@"binary data should be fetched using NSURLRequest and NSURLSession"];
|
||||
} else {
|
||||
@ -553,28 +572,28 @@ NSURLSessionDataDelegate
|
||||
statusCode:statusCode];
|
||||
}
|
||||
} else if (!error) {
|
||||
error = [FBSDKError errorWithCode:FBSDKUnknownErrorCode
|
||||
error = [NSError fbErrorWithCode:FBSDKErrorUnknown
|
||||
message:@"Missing NSURLResponse"];
|
||||
}
|
||||
|
||||
if (!error) {
|
||||
if ([self.requests count] != [results count]) {
|
||||
error = [FBSDKError errorWithCode:FBSDKGraphRequestProtocolMismatchErrorCode
|
||||
if (self.requests.count != results.count) {
|
||||
error = [NSError fbErrorWithCode:FBSDKErrorGraphRequestProtocolMismatch
|
||||
message:@"Unexpected number of results returned from server."];
|
||||
} else {
|
||||
[_logger appendFormat:@"Response <#%lu>\nDuration: %llu msec\nSize: %lu kB\nResponse Body:\n%@\n\n",
|
||||
(unsigned long)[_logger loggerSerialNumber],
|
||||
(unsigned long)_logger.loggerSerialNumber,
|
||||
[FBSDKInternalUtility currentTimeInMilliseconds] - _requestStartTime,
|
||||
(unsigned long)[data length],
|
||||
(unsigned long)data.length,
|
||||
results];
|
||||
}
|
||||
}
|
||||
|
||||
if (error) {
|
||||
[_logger appendFormat:@"Response <#%lu> <Error>:\n%@\n%@\n",
|
||||
(unsigned long)[_logger loggerSerialNumber],
|
||||
[error localizedDescription],
|
||||
[error userInfo]];
|
||||
(unsigned long)_logger.loggerSerialNumber,
|
||||
error.localizedDescription,
|
||||
error.userInfo];
|
||||
}
|
||||
[_logger emitToNSLog];
|
||||
|
||||
@ -607,7 +626,7 @@ NSURLSessionDataDelegate
|
||||
id response = [self parseJSONOrOtherwise:responseUTF8 error:error];
|
||||
|
||||
if (responseUTF8 == nil) {
|
||||
NSString *base64Data = [data length] != 0 ? [data base64EncodedStringWithOptions:0] : @"";
|
||||
NSString *base64Data = data.length != 0 ? [data base64EncodedStringWithOptions:0] : @"";
|
||||
if (base64Data != nil) {
|
||||
[FBSDKAppEvents logImplicitEvent:@"fb_response_invalid_utf8"
|
||||
valueToSum:nil
|
||||
@ -619,13 +638,13 @@ NSURLSessionDataDelegate
|
||||
NSDictionary *responseError = nil;
|
||||
if (!response) {
|
||||
if ((error != NULL) && (*error == nil)) {
|
||||
*error = [self errorWithCode:FBSDKUnknownErrorCode
|
||||
*error = [self errorWithCode:FBSDKErrorUnknown
|
||||
statusCode:statusCode
|
||||
parsedJSONResponse:nil
|
||||
innerError:nil
|
||||
message:@"The server returned an unexpected response."];
|
||||
}
|
||||
} else if ([self.requests count] == 1) {
|
||||
} else if (self.requests.count == 1) {
|
||||
// response is the entry, so put it in a dictionary under "body" and add
|
||||
// that to array of responses.
|
||||
[results addObject:@{
|
||||
@ -666,7 +685,7 @@ NSURLSessionDataDelegate
|
||||
[results addObject:result];
|
||||
}
|
||||
} else if (error != NULL) {
|
||||
*error = [self errorWithCode:FBSDKGraphRequestProtocolMismatchErrorCode
|
||||
*error = [self errorWithCode:FBSDKErrorGraphRequestProtocolMismatch
|
||||
statusCode:statusCode
|
||||
parsedJSONResponse:results
|
||||
innerError:nil
|
||||
@ -703,11 +722,11 @@ NSURLSessionDataDelegate
|
||||
- (void)completeWithResults:(NSArray *)results
|
||||
networkError:(NSError *)networkError
|
||||
{
|
||||
NSUInteger count = [self.requests count];
|
||||
NSUInteger count = self.requests.count;
|
||||
_expectingResults = count;
|
||||
NSUInteger disabledRecoveryCount = 0;
|
||||
for (FBSDKGraphRequestMetadata *metadata in self.requests) {
|
||||
if ([metadata.request isGraphErrorRecoveryDisabled]) {
|
||||
if (metadata.request.graphErrorRecoveryDisabled) {
|
||||
disabledRecoveryCount++;
|
||||
}
|
||||
}
|
||||
@ -716,7 +735,7 @@ NSURLSessionDataDelegate
|
||||
#endif
|
||||
|
||||
[self.requests enumerateObjectsUsingBlock:^(FBSDKGraphRequestMetadata *metadata, NSUInteger i, BOOL *stop) {
|
||||
id result = networkError ? nil : [results objectAtIndex:i];
|
||||
id result = networkError ? nil : results[i];
|
||||
NSError *resultError = networkError ?: [self errorFromResult:result request:metadata.request];
|
||||
|
||||
id body = nil;
|
||||
@ -726,7 +745,7 @@ NSURLSessionDataDelegate
|
||||
}
|
||||
|
||||
#if !TARGET_OS_TV
|
||||
if (resultError && ![metadata.request isGraphErrorRecoveryDisabled] && isSingleRequestToRecover) {
|
||||
if (resultError && !metadata.request.graphErrorRecoveryDisabled && isSingleRequestToRecover) {
|
||||
self->_recoveringRequestMetadata = metadata;
|
||||
self->_errorRecoveryProcessor = [[FBSDKGraphErrorRecoveryProcessor alloc] init];
|
||||
if ([self->_errorRecoveryProcessor processError:resultError request:metadata.request delegate:self]) {
|
||||
@ -748,7 +767,7 @@ NSURLSessionDataDelegate
|
||||
- (void)processResultBody:(NSDictionary *)body error:(NSError *)error metadata:(FBSDKGraphRequestMetadata *)metadata canNotifyDelegate:(BOOL)canNotifyDelegate
|
||||
{
|
||||
void (^finishAndInvokeCompletionHandler)(void) = ^{
|
||||
NSDictionary *graphDebugDict = [body objectForKey:@"__debug__"];
|
||||
NSDictionary<NSString *, id> *graphDebugDict = body[@"__debug__"];
|
||||
if ([graphDebugDict isKindOfClass:[NSDictionary class]]) {
|
||||
[self processResultDebugDictionary: graphDebugDict];
|
||||
}
|
||||
@ -781,8 +800,8 @@ NSURLSessionDataDelegate
|
||||
BOOL isAccountStoreLogin = [metadataTokenString isEqualToString:accountStoreTokenString];
|
||||
|
||||
if ([metadataTokenString isEqualToString:currentTokenString] || isAccountStoreLogin) {
|
||||
NSInteger errorCode = [error.userInfo[FBSDKGraphRequestErrorGraphErrorCode] integerValue];
|
||||
NSInteger errorSubcode = [error.userInfo[FBSDKGraphRequestErrorGraphErrorSubcode] integerValue];
|
||||
NSInteger errorCode = [error.userInfo[FBSDKGraphRequestErrorGraphErrorCodeKey] integerValue];
|
||||
NSInteger errorSubcode = [error.userInfo[FBSDKGraphRequestErrorGraphErrorSubcodeKey] integerValue];
|
||||
if (errorCode == 190 || errorCode == 102) {
|
||||
if (isAccountStoreLogin) {
|
||||
if (errorSubcode == 460) {
|
||||
@ -821,7 +840,7 @@ NSURLSessionDataDelegate
|
||||
- (void)processResultDebugDictionary:(NSDictionary *)dict
|
||||
{
|
||||
NSArray *messages = [FBSDKTypeUtility arrayValue:dict[@"messages"]];
|
||||
if (![messages count]) {
|
||||
if (!messages.count) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -854,8 +873,8 @@ NSURLSessionDataDelegate
|
||||
|
||||
if ([errorDictionary isKindOfClass:[NSDictionary class]]) {
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
|
||||
[FBSDKInternalUtility dictionary:userInfo setObject:errorDictionary[@"code"] forKey:FBSDKGraphRequestErrorGraphErrorCode];
|
||||
[FBSDKInternalUtility dictionary:userInfo setObject:errorDictionary[@"error_subcode"] forKey:FBSDKGraphRequestErrorGraphErrorSubcode];
|
||||
[FBSDKInternalUtility dictionary:userInfo setObject:errorDictionary[@"code"] forKey:FBSDKGraphRequestErrorGraphErrorCodeKey];
|
||||
[FBSDKInternalUtility dictionary:userInfo setObject:errorDictionary[@"error_subcode"] forKey:FBSDKGraphRequestErrorGraphErrorSubcodeKey];
|
||||
//"message" is preferred over error_msg or error_reason.
|
||||
[FBSDKInternalUtility dictionary:userInfo setObject:errorDictionary[@"error_msg"] forKey:FBSDKErrorDeveloperMessageKey];
|
||||
[FBSDKInternalUtility dictionary:userInfo setObject:errorDictionary[@"error_reason"] forKey:FBSDKErrorDeveloperMessageKey];
|
||||
@ -867,20 +886,20 @@ NSURLSessionDataDelegate
|
||||
[FBSDKInternalUtility dictionary:userInfo setObject:result forKey:FBSDKGraphRequestErrorParsedJSONResponseKey];
|
||||
|
||||
FBSDKErrorRecoveryConfiguration *recoveryConfiguration = [g_errorConfiguration
|
||||
recoveryConfigurationForCode:[userInfo[FBSDKGraphRequestErrorGraphErrorCode] stringValue]
|
||||
subcode:[userInfo[FBSDKGraphRequestErrorGraphErrorSubcode] stringValue]
|
||||
recoveryConfigurationForCode:[userInfo[FBSDKGraphRequestErrorGraphErrorCodeKey] stringValue]
|
||||
subcode:[userInfo[FBSDKGraphRequestErrorGraphErrorSubcodeKey] stringValue]
|
||||
request:request];
|
||||
if ([errorDictionary[@"is_transient"] boolValue]) {
|
||||
userInfo[FBSDKGraphRequestErrorCategoryKey] = @(FBSDKGraphRequestErrorCategoryTransient);
|
||||
userInfo[FBSDKGraphRequestErrorKey] = @(FBSDKGraphRequestErrorTransient);
|
||||
} else {
|
||||
[FBSDKInternalUtility dictionary:userInfo setObject:@(recoveryConfiguration.errorCategory) forKey:FBSDKGraphRequestErrorCategoryKey];
|
||||
[FBSDKInternalUtility dictionary:userInfo setObject:@(recoveryConfiguration.errorCategory) forKey:FBSDKGraphRequestErrorKey];
|
||||
}
|
||||
[FBSDKInternalUtility dictionary:userInfo setObject:recoveryConfiguration.localizedRecoveryDescription forKey:NSLocalizedRecoverySuggestionErrorKey];
|
||||
[FBSDKInternalUtility dictionary:userInfo setObject:recoveryConfiguration.localizedRecoveryOptionDescriptions forKey:NSLocalizedRecoveryOptionsErrorKey];
|
||||
FBSDKErrorRecoveryAttempter *attempter = [FBSDKErrorRecoveryAttempter recoveryAttempterFromConfiguration:recoveryConfiguration];
|
||||
[FBSDKInternalUtility dictionary:userInfo setObject:attempter forKey:NSRecoveryAttempterErrorKey];
|
||||
|
||||
return [FBSDKError errorWithCode:FBSDKGraphRequestGraphAPIErrorCode
|
||||
return [NSError fbErrorWithCode:FBSDKErrorGraphRequestGraphAPI
|
||||
userInfo:userInfo
|
||||
message:nil
|
||||
underlyingError:nil];
|
||||
@ -890,7 +909,7 @@ NSURLSessionDataDelegate
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSError *)errorWithCode:(FBSDKErrorCode)code
|
||||
- (NSError *)errorWithCode:(FBSDKError)code
|
||||
statusCode:(NSInteger)statusCode
|
||||
parsedJSONResponse:(id)response
|
||||
innerError:(NSError *)innerError
|
||||
@ -927,8 +946,8 @@ NSURLSessionDataDelegate
|
||||
{
|
||||
if (_logger.isActive) {
|
||||
[_logger appendFormat:@"Request <#%lu>:\n", (unsigned long)_logger.loggerSerialNumber];
|
||||
[_logger appendKey:@"URL" value:[[request URL] absoluteString]];
|
||||
[_logger appendKey:@"Method" value:[request HTTPMethod]];
|
||||
[_logger appendKey:@"URL" value:request.URL.absoluteString];
|
||||
[_logger appendKey:@"Method" value:request.HTTPMethod];
|
||||
[_logger appendKey:@"UserAgent" value:[request valueForHTTPHeaderField:@"User-Agent"]];
|
||||
[_logger appendKey:@"MIME" value:[request valueForHTTPHeaderField:@"Content-Type"]];
|
||||
|
||||
@ -1054,7 +1073,7 @@ totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend
|
||||
if (comma) {
|
||||
[result appendString:@",\n"];
|
||||
}
|
||||
[result appendString:[request description]];
|
||||
[result appendString:request.description];
|
||||
comma = YES;
|
||||
}
|
||||
[result appendString:@"\n)>"];
|
||||
|
||||
@ -23,6 +23,9 @@
|
||||
*/
|
||||
@interface FBSDKGraphRequestDataAttachment : NSObject
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
Initializes the receiver with the attachment data and metadata.
|
||||
@param data The attachment data (retained, not copied)
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
|
||||
#import "FBSDKGraphRequestDataAttachment.h"
|
||||
|
||||
#import "FBSDKMacros.h"
|
||||
|
||||
@implementation FBSDKGraphRequestDataAttachment
|
||||
|
||||
- (instancetype)initWithData:(NSData *)data filename:(NSString *)filename contentType:(NSString *)contentType
|
||||
@ -32,10 +30,4 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
FBSDK_NOT_DESIGNATED_INITIALIZER(initWithData:filename:contentType:);
|
||||
return [self initWithData:nil filename:nil contentType:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -17,23 +17,3 @@
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define FBSDK_EXTERN extern "C" __attribute__((visibility ("default")))
|
||||
#else
|
||||
#define FBSDK_EXTERN extern __attribute__((visibility ("default")))
|
||||
#endif
|
||||
|
||||
#define FBSDK_STATIC_INLINE static inline
|
||||
|
||||
#define FBSDK_NO_DESIGNATED_INITIALIZER() \
|
||||
@throw [NSException exceptionWithName:NSInvalidArgumentException \
|
||||
reason:[NSString stringWithFormat:@"unrecognized selector sent to instance %p", self] \
|
||||
userInfo:nil]
|
||||
|
||||
#define FBSDK_NOT_DESIGNATED_INITIALIZER(DESIGNATED_INITIALIZER) \
|
||||
@throw [NSException exceptionWithName:NSInvalidArgumentException \
|
||||
reason:[NSString stringWithFormat:@"Please use the designated initializer [%p %@]", \
|
||||
self, \
|
||||
NSStringFromSelector(@selector(DESIGNATED_INITIALIZER))] \
|
||||
userInfo:nil]
|
||||
|
||||
@ -20,8 +20,20 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
|
||||
|
||||
/*! The name of the notification posted by FBSDKMeasurementEvent */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKMeasurementEventNotificationName;
|
||||
FOUNDATION_EXPORT NSNotificationName const FBSDKMeasurementEventNotification;
|
||||
|
||||
#else
|
||||
|
||||
/*! The name of the notification posted by FBSDKMeasurementEvent */
|
||||
FOUNDATION_EXPORT NSString *const FBSDKMeasurementEventNotification;
|
||||
|
||||
#endif
|
||||
|
||||
FOUNDATION_EXPORT NSString *const FBSDKMeasurementEventNotificationName
|
||||
DEPRECATED_MSG_ATTRIBUTE("Use `FBSDKMeasurementEventNotification` instead");
|
||||
|
||||
/*! Defines keys in the userInfo object for the notification named FBSDKMeasurementEventNotificationName */
|
||||
/*! The string field for the name of the event */
|
||||
|
||||
@ -18,6 +18,16 @@
|
||||
|
||||
#import "FBSDKMeasurementEvent_Internal.h"
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
|
||||
|
||||
NSNotificationName const FBSDKMeasurementEventNotification = @"com.facebook.facebook-objc-sdk.measurement_event";
|
||||
|
||||
#else
|
||||
|
||||
NSString *const FBSDKMeasurementEventNotification = @"com.facebook.facebook-objc-sdk.measurement_event";
|
||||
|
||||
#endif
|
||||
|
||||
NSString *const FBSDKMeasurementEventNotificationName = @"com.facebook.facebook-objc-sdk.measurement_event";
|
||||
|
||||
NSString *const FBSDKMeasurementEventNameKey = @"event_name";
|
||||
@ -46,7 +56,7 @@ NSString *const FBSDKAppLinkNavigateBackToReferrerEventName = @"al_ref_back_out"
|
||||
NSDictionary<NSString *, id> *userInfo = @{FBSDKMeasurementEventNameKey : _name,
|
||||
FBSDKMeasurementEventArgsKey : _args};
|
||||
|
||||
[center postNotificationName:FBSDKMeasurementEventNotificationName
|
||||
[center postNotificationName:FBSDKMeasurementEventNotification
|
||||
object:self
|
||||
userInfo:userInfo];
|
||||
}
|
||||
|
||||
@ -14,11 +14,12 @@
|
||||
// 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.
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
|
||||
|
||||
#import "FBSDKMacros.h"
|
||||
#import "FBSDKProfilePictureView.h"
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
|
||||
|
||||
/**
|
||||
Notification indicating that the `currentProfile` has changed.
|
||||
|
||||
@ -26,19 +27,32 @@
|
||||
`FBSDKProfileChangeOldKey` and
|
||||
`FBSDKProfileChangeNewKey`.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKProfileDidChangeNotification;
|
||||
FOUNDATION_EXPORT NSNotificationName const FBSDKProfileDidChangeNotification;
|
||||
|
||||
#else
|
||||
|
||||
/**
|
||||
Notification indicating that the `currentProfile` has changed.
|
||||
|
||||
the userInfo dictionary of the notification will contain keys
|
||||
`FBSDKProfileChangeOldKey` and
|
||||
`FBSDKProfileChangeNewKey`.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString *const FBSDKProfileDidChangeNotification;
|
||||
|
||||
#endif
|
||||
|
||||
/* key in notification's userInfo object for getting the old profile.
|
||||
|
||||
If there was no old profile, the key will not be present.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKProfileChangeOldKey;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKProfileChangeOldKey;
|
||||
|
||||
/* key in notification's userInfo object for getting the new profile.
|
||||
|
||||
If there is no new profile, the key will not be present.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKProfileChangeNewKey;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKProfileChangeNewKey;
|
||||
|
||||
/**
|
||||
Represents an immutable Facebook profile
|
||||
@ -54,6 +68,9 @@ FBSDK_EXTERN NSString *const FBSDKProfileChangeNewKey;
|
||||
*/
|
||||
@interface FBSDKProfile : NSObject<NSCopying, NSSecureCoding>
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
initializes a new instance.
|
||||
@param userID the user ID
|
||||
@ -156,7 +173,7 @@ FBSDK_EXTERN NSString *const FBSDKProfileChangeNewKey;
|
||||
@param size The height and width. This will be rounded to integer precision.
|
||||
*/
|
||||
- (NSString *)imagePathForPictureMode:(FBSDKProfilePictureMode)mode size:(CGSize)size
|
||||
__attribute__ ((deprecated("use imageURLForPictureMode:size: instead")));
|
||||
DEPRECATED_MSG_ATTRIBUTE("use imageURLForPictureMode:size: instead");
|
||||
|
||||
/**
|
||||
Returns YES if the profile is equivalent to the receiver.
|
||||
|
||||
@ -20,7 +20,16 @@
|
||||
|
||||
#import "FBSDKCoreKit+Internal.h"
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
|
||||
|
||||
NSNotificationName const FBSDKProfileDidChangeNotification = @"com.facebook.sdk.FBSDKProfile.FBSDKProfileDidChangeNotification";;
|
||||
|
||||
#else
|
||||
|
||||
NSString *const FBSDKProfileDidChangeNotification = @"com.facebook.sdk.FBSDKProfile.FBSDKProfileDidChangeNotification";;
|
||||
|
||||
#endif
|
||||
|
||||
NSString *const FBSDKProfileChangeOldKey = @"FBSDKProfileOld";
|
||||
NSString *const FBSDKProfileChangeNewKey = @"FBSDKProfileNew";
|
||||
static NSString *const FBSDKProfileUserDefaultsKey = @"com.facebook.sdk.FBSDKProfile.currentProfile";
|
||||
@ -39,11 +48,6 @@ static FBSDKProfile *g_currentProfile;
|
||||
|
||||
@implementation FBSDKProfile
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
|
||||
- (instancetype)initWithUserID:(NSString *)userID
|
||||
firstName:(NSString *)firstName
|
||||
middleName:(NSString *)middleName
|
||||
@ -140,13 +144,13 @@ static FBSDKProfile *g_currentProfile;
|
||||
- (NSUInteger)hash
|
||||
{
|
||||
NSUInteger subhashes[] = {
|
||||
[self.userID hash],
|
||||
[self.firstName hash],
|
||||
[self.middleName hash],
|
||||
[self.lastName hash],
|
||||
[self.name hash],
|
||||
[self.linkURL hash],
|
||||
[self.refreshDate hash]
|
||||
self.userID.hash,
|
||||
self.firstName.hash,
|
||||
self.middleName.hash,
|
||||
self.lastName.hash,
|
||||
self.name.hash,
|
||||
self.linkURL.hash,
|
||||
self.refreshDate.hash
|
||||
};
|
||||
return [FBSDKMath hashWithIntegerArray:subhashes count:sizeof(subhashes) / sizeof(subhashes[0])];
|
||||
}
|
||||
@ -179,7 +183,7 @@ static FBSDKProfile *g_currentProfile;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(NSCoder *)decoder
|
||||
- (instancetype)initWithCoder:(NSCoder *)decoder
|
||||
{
|
||||
NSString *userID = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDKPROFILE_USERID_KEY];
|
||||
NSString *firstName = [decoder decodeObjectOfClass:[NSString class] forKey:FBSDKPROFILE_FIRSTNAME_KEY];
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
#import "FBSDKInternalUtility.h"
|
||||
#import "FBSDKMaleSilhouetteIcon.h"
|
||||
#import "FBSDKMath.h"
|
||||
#import "FBSDKURLConnection.h"
|
||||
#import "FBSDKUtility.h"
|
||||
|
||||
@interface FBSDKProfilePictureViewState : NSObject
|
||||
@ -70,7 +69,7 @@
|
||||
(NSUInteger)_size.height,
|
||||
(NSUInteger)_scale,
|
||||
(NSUInteger)_pictureMode,
|
||||
[_profileID hash],
|
||||
_profileID.hash,
|
||||
};
|
||||
return [FBSDKMath hashWithIntegerArray:subhashes count:sizeof(subhashes) / sizeof(subhashes[0])];
|
||||
}
|
||||
@ -120,7 +119,7 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(NSCoder *)decoder
|
||||
- (instancetype)initWithCoder:(NSCoder *)decoder
|
||||
{
|
||||
if ((self = [super initWithCoder:decoder])) {
|
||||
[self _configureProfilePictureView];
|
||||
@ -139,7 +138,7 @@
|
||||
{
|
||||
CGRect currentBounds = self.bounds;
|
||||
if (!CGRectEqualToRect(currentBounds, bounds)) {
|
||||
[super setBounds:bounds];
|
||||
super.bounds = bounds;
|
||||
if (!CGSizeEqualToSize(currentBounds.size, bounds.size)) {
|
||||
_placeholderImageIsValid = NO;
|
||||
[self setNeedsImageUpdate];
|
||||
@ -156,7 +155,7 @@
|
||||
{
|
||||
if (_imageView.contentMode != contentMode) {
|
||||
_imageView.contentMode = contentMode;
|
||||
[super setContentMode:contentMode];
|
||||
super.contentMode = contentMode;
|
||||
[self setNeedsImageUpdate];
|
||||
}
|
||||
}
|
||||
@ -212,16 +211,16 @@
|
||||
if (!imageURL) {
|
||||
return;
|
||||
}
|
||||
FBSDKURLConnectionHandler completionHandler = ^(FBSDKURLConnection *connection,
|
||||
NSError *error,
|
||||
NSURLResponse *response,
|
||||
NSData *responseData) {
|
||||
if (!error && [responseData length]) {
|
||||
completionBlock(responseData);
|
||||
}
|
||||
};
|
||||
|
||||
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:imageURL];
|
||||
[[[FBSDKURLConnection alloc] initWithRequest:request completionHandler:completionHandler] start];
|
||||
NSURLSession *session = [NSURLSession sharedSession];
|
||||
[[session
|
||||
dataTaskWithRequest:request
|
||||
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
|
||||
if (!error && data.length) {
|
||||
completionBlock(data);
|
||||
}
|
||||
}] resume];
|
||||
}
|
||||
|
||||
+ (NSURL *)_imageURLWithState:(FBSDKProfilePictureViewState *)state
|
||||
@ -241,7 +240,7 @@
|
||||
|
||||
- (void)_accessTokenDidChangeNotification:(NSNotification *)notification
|
||||
{
|
||||
if (![_profileID isEqualToString:@"me"] || !notification.userInfo[FBSDKAccessTokenDidChangeUserID]) {
|
||||
if (![_profileID isEqualToString:@"me"] || !notification.userInfo[FBSDKAccessTokenDidChangeUserIDKey]) {
|
||||
return;
|
||||
}
|
||||
_lastState = nil;
|
||||
@ -328,7 +327,7 @@
|
||||
// leave the current value until the new resolution image is downloaded
|
||||
BOOL imageShouldFit = [self _imageShouldFit];
|
||||
UIScreen *screen = self.window.screen ?: [UIScreen mainScreen];
|
||||
CGFloat scale = [screen scale];
|
||||
CGFloat scale = screen.scale;
|
||||
CGSize imageSize = [self _imageSize:imageShouldFit scale:scale];
|
||||
FBSDKProfilePictureViewState *state = [[FBSDKProfilePictureViewState alloc] initWithProfileID:_profileID
|
||||
size:imageSize
|
||||
|
||||
@ -18,46 +18,47 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <FBSDKCoreKit/FBSDKMacros.h>
|
||||
|
||||
/*
|
||||
* Constants defining logging behavior. Use with <[FBSDKSettings setLoggingBehavior]>.
|
||||
*/
|
||||
|
||||
/** Include access token in logging. */
|
||||
FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorAccessTokens;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKLoggingBehaviorAccessTokens;
|
||||
|
||||
/** Log performance characteristics */
|
||||
FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorPerformanceCharacteristics;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKLoggingBehaviorPerformanceCharacteristics;
|
||||
|
||||
/** Log FBSDKAppEvents interactions */
|
||||
FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorAppEvents;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKLoggingBehaviorAppEvents;
|
||||
|
||||
/** Log Informational occurrences */
|
||||
FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorInformational;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKLoggingBehaviorInformational;
|
||||
|
||||
/** Log cache errors. */
|
||||
FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorCacheErrors;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKLoggingBehaviorCacheErrors;
|
||||
|
||||
/** Log errors from SDK UI controls */
|
||||
FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorUIControlErrors;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKLoggingBehaviorUIControlErrors;
|
||||
|
||||
/** Log debug warnings from API response, i.e. when friends fields requested, but user_friends permission isn't granted. */
|
||||
FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorGraphAPIDebugWarning;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKLoggingBehaviorGraphAPIDebugWarning;
|
||||
|
||||
/** Log warnings from API response, i.e. when requested feature will be deprecated in next version of API.
|
||||
Info is the lowest level of severity, using it will result in logging all previously mentioned levels.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorGraphAPIDebugInfo;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKLoggingBehaviorGraphAPIDebugInfo;
|
||||
|
||||
/** Log errors from SDK network requests */
|
||||
FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorNetworkRequests;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKLoggingBehaviorNetworkRequests;
|
||||
|
||||
/** Log errors likely to be preventable by the developer. This is in the default set of enabled logging behaviors. */
|
||||
FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorDeveloperErrors;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKLoggingBehaviorDeveloperErrors;
|
||||
|
||||
@interface FBSDKSettings : NSObject
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
Get the Facebook App ID used by the SDK.
|
||||
|
||||
@ -177,6 +178,18 @@ FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorDeveloperErrors;
|
||||
*/
|
||||
+ (void)setCodelessDebugLogEnabled:(NSNumber *)CodelessDebugLogEnabled;
|
||||
|
||||
/**
|
||||
Flag which controls whether advertiserID could be collected.
|
||||
If not explicitly set, the default is 1 - true
|
||||
*/
|
||||
+ (NSNumber *)advertiserIDCollectionEnabled;
|
||||
|
||||
/**
|
||||
Set the flag which controls ontrols whether advertiserID could be collected.
|
||||
@param AdvertiserIDCollectionEnabled Flag value, expressed as a value from 0 - false or 1 - true.
|
||||
*/
|
||||
+ (void)setAdvertiserIDCollectionEnabled:(NSNumber *)AdvertiserIDCollectionEnabled;
|
||||
|
||||
/**
|
||||
Gets whether data such as that generated through FBSDKAppEvents and sent to Facebook should be restricted from being used for other than analytics and conversions. Defaults to NO. This value is stored on the device and persists across app launches.
|
||||
*/
|
||||
|
||||
@ -77,6 +77,8 @@ FBSDKSETTINGS_PLIST_CONFIGURATION_SETTING_IMPL(NSNumber, FacebookAutoLogAppEvent
|
||||
setAutoLogAppEventsEnabled, @1);
|
||||
FBSDKSETTINGS_PLIST_CONFIGURATION_SETTING_IMPL(NSNumber, FacebookCodelessDebugLogEnabled, codelessDebugLogEnabled,
|
||||
setCodelessDebugLogEnabled, @0);
|
||||
FBSDKSETTINGS_PLIST_CONFIGURATION_SETTING_IMPL(NSNumber, FacebookAdvertiserIDCollectionEnabled, advertiserIDCollectionEnabled,
|
||||
setAdvertiserIDCollectionEnabled, @1);
|
||||
|
||||
+ (void)setGraphErrorRecoveryDisabled:(BOOL)disableGraphErrorRecovery {
|
||||
g_disableErrorRecovery = disableGraphErrorRecovery;
|
||||
@ -88,7 +90,7 @@ FBSDKSETTINGS_PLIST_CONFIGURATION_SETTING_IMPL(NSNumber, FacebookCodelessDebugLo
|
||||
|
||||
+ (CGFloat)JPEGCompressionQuality
|
||||
{
|
||||
return [[self _JPEGCompressionQualityNumber] floatValue];
|
||||
return [self _JPEGCompressionQualityNumber].floatValue;
|
||||
}
|
||||
|
||||
+ (void)setJPEGCompressionQuality:(CGFloat)JPEGCompressionQuality
|
||||
@ -173,14 +175,6 @@ FBSDKSETTINGS_PLIST_CONFIGURATION_SETTING_IMPL(NSNumber, FacebookCodelessDebugLo
|
||||
return FBSDK_VERSION_STRING;
|
||||
}
|
||||
|
||||
#pragma mark - Object Lifecycle
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
FBSDK_NO_DESIGNATED_INITIALIZER();
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - Internal
|
||||
|
||||
+ (NSObject<FBSDKAccessTokenCaching> *)accessTokenCache
|
||||
|
||||
@ -48,6 +48,9 @@ typedef void (^FBSDKTestUsersManagerRemoveTestAccountHandler)(NSError *error) ;
|
||||
*/
|
||||
@interface FBSDKTestUsersManager : NSObject
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
construct or return the shared instance
|
||||
@param appID the Facebook app id
|
||||
|
||||
@ -48,12 +48,6 @@ static NSMutableDictionary *gInstancesDictionary;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
FBSDK_NOT_DESIGNATED_INITIALIZER(initWithAppID:appSecret:);
|
||||
return [self initWithAppID:nil appSecret:nil];
|
||||
}
|
||||
|
||||
+ (instancetype)sharedInstanceForAppID:(NSString *)appID appSecret:(NSString *)appSecret {
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
@ -132,7 +126,7 @@ static NSMutableDictionary *gInstancesDictionary;
|
||||
completionHandler:(FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)handler {
|
||||
NSDictionary *params = @{
|
||||
@"installed" : @"true",
|
||||
@"permissions" : [[permissions allObjects] componentsJoinedByString:@","],
|
||||
@"permissions" : [permissions.allObjects componentsJoinedByString:@","],
|
||||
@"access_token" : self.appAccessToken
|
||||
};
|
||||
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:[NSString stringWithFormat:kFBGraphAPITestUsersPathFormat, _appID]
|
||||
@ -166,8 +160,8 @@ static NSMutableDictionary *gInstancesDictionary;
|
||||
__block int expectedCount = 2;
|
||||
void (^complete)(NSError *) = ^(NSError *error) {
|
||||
// ignore if they're already friends or pending request
|
||||
if ([error.userInfo[FBSDKGraphRequestErrorGraphErrorCode] integerValue] == 522 ||
|
||||
[error.userInfo[FBSDKGraphRequestErrorGraphErrorCode] integerValue] == 520) {
|
||||
if ([error.userInfo[FBSDKGraphRequestErrorGraphErrorCodeKey] integerValue] == 522 ||
|
||||
[error.userInfo[FBSDKGraphRequestErrorGraphErrorCodeKey] integerValue] == 520) {
|
||||
error = nil;
|
||||
}
|
||||
if (--expectedCount == 0 || error) {
|
||||
@ -185,12 +179,16 @@ static NSMutableDictionary *gInstancesDictionary;
|
||||
version:nil
|
||||
HTTPMethod:@"POST"];
|
||||
FBSDKGraphRequestConnection *conn = [[FBSDKGraphRequestConnection alloc] init];
|
||||
[conn addRequest:one completionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
|
||||
[conn addRequest:one
|
||||
batchEntryName:@"first"
|
||||
completionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
|
||||
complete(error);
|
||||
} batchEntryName:@"first"];
|
||||
[conn addRequest:two completionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
|
||||
}];
|
||||
[conn addRequest:two
|
||||
batchParameters:@{ @"depends_on" : @"first"}
|
||||
completionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
|
||||
complete(error);
|
||||
} batchParameters:@{ @"depends_on" : @"first"} ];
|
||||
}];
|
||||
[conn start];
|
||||
}
|
||||
|
||||
@ -211,7 +209,7 @@ static NSMutableDictionary *gInstancesDictionary;
|
||||
#pragma mark - private methods
|
||||
- (FBSDKAccessToken *)tokenDataForTokenString:(NSString *)tokenString permissions:(NSSet *)permissions userId:(NSString *)userId{
|
||||
return [[FBSDKAccessToken alloc] initWithTokenString:tokenString
|
||||
permissions:[permissions allObjects]
|
||||
permissions:permissions.allObjects
|
||||
declinedPermissions:nil
|
||||
appID:_appID
|
||||
userID:userId
|
||||
|
||||
@ -88,14 +88,14 @@
|
||||
if (sourceApplication) {
|
||||
logData[@"sourceApplication"] = sourceApplication;
|
||||
}
|
||||
if ([_targetURL absoluteString]) {
|
||||
logData[@"targetURL"] = [_targetURL absoluteString];
|
||||
if (_targetURL.absoluteString) {
|
||||
logData[@"targetURL"] = _targetURL.absoluteString;
|
||||
}
|
||||
if ([_inputURL absoluteString]) {
|
||||
logData[@"inputURL"] = [_inputURL absoluteString];
|
||||
if (_inputURL.absoluteString) {
|
||||
logData[@"inputURL"] = _inputURL.absoluteString;
|
||||
}
|
||||
if ([_inputURL scheme]) {
|
||||
logData[@"inputURLScheme"] = [_inputURL scheme];
|
||||
if (_inputURL.scheme) {
|
||||
logData[@"inputURLScheme"] = _inputURL.scheme;
|
||||
}
|
||||
logData[@"forRenderBackToReferrerBar"] = forRenderBackToReferrerBar ? EVENT_YES_VAL : EVENT_NO_VAL;
|
||||
logData[@"forOpenUrl"] = forOpenURLEvent ? EVENT_YES_VAL : EVENT_NO_VAL;
|
||||
|
||||
@ -23,6 +23,9 @@
|
||||
*/
|
||||
@interface FBSDKUtility : NSObject
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
Parses a query string into a dictionary.
|
||||
@param queryString The query string value.
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
|
||||
#import "FBSDKInternalUtility.h"
|
||||
#import "FBSDKMacros.h"
|
||||
|
||||
@implementation FBSDKUtility
|
||||
|
||||
@ -31,7 +30,7 @@
|
||||
NSArray *parts = [queryString componentsSeparatedByString:@"&"];
|
||||
|
||||
for (NSString *part in parts) {
|
||||
if ([part length] == 0) {
|
||||
if (part.length == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -63,23 +62,18 @@
|
||||
|
||||
+ (NSString *)URLDecode:(NSString *)value
|
||||
{
|
||||
value = [value stringByReplacingOccurrencesOfString:@"+" withString:@" "];
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
value = [value stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
#pragma clang diagnostic pop
|
||||
return value;
|
||||
return [value
|
||||
stringByReplacingOccurrencesOfString:@"+"
|
||||
withString:@" "].stringByRemovingPercentEncoding;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
+ (NSString *)URLEncode:(NSString *)value
|
||||
{
|
||||
return (__bridge_transfer NSString *)CFURLCreateStringByAddingPercentEscapes(NULL,
|
||||
(CFStringRef)value,
|
||||
NULL, // characters to leave unescaped
|
||||
CFSTR(":!*();@/&?+$,='"),
|
||||
kCFStringEncodingUTF8);
|
||||
NSCharacterSet *urlAllowedSet = [NSCharacterSet
|
||||
characterSetWithCharactersInString:@" !*();:'@&=+$,/?%#[]\""].invertedSet;
|
||||
return [value stringByAddingPercentEncodingWithAllowedCharacters:urlAllowedSet];
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
@ -133,10 +127,4 @@
|
||||
return encryptedStuff;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
FBSDK_NO_DESIGNATED_INITIALIZER();
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -139,14 +139,10 @@ static NSString *const FBSDKWebViewAppLinkResolverShouldFallbackKey = @"should_f
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
|
||||
[request setValue:FBSDKWebViewAppLinkResolverMetaTagPrefix forHTTPHeaderField:FBSDKWebViewAppLinkResolverPreferHeader];
|
||||
|
||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_0 || __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_9
|
||||
NSURLSession *session = [NSURLSession sharedSession];
|
||||
[[session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
|
||||
completion(response, data, error);
|
||||
}] resume];
|
||||
#else
|
||||
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:completion];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)appLinkFromURL:(NSURL *)url handler:(FBSDKAppLinkFromURLHandler)handler
|
||||
@ -293,7 +289,7 @@ static NSString *const FBSDKWebViewAppLinkResolverShouldFallbackKey = @"should_f
|
||||
NSURL *webUrl = destination;
|
||||
|
||||
if (shouldFallbackString &&
|
||||
[@[ @"no", @"false", @"0" ] containsObject:[shouldFallbackString lowercaseString]]) {
|
||||
[@[ @"no", @"false", @"0" ] containsObject:shouldFallbackString.lowercaseString]) {
|
||||
webUrl = nil;
|
||||
}
|
||||
if (webUrl && webUrlString) {
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "FBSDKCoreKit+Internal.h"
|
||||
@interface FBSDKCodelessIndexer : NSObject
|
||||
|
||||
@interface FBSDKShareError : FBSDKError
|
||||
+ (NSString *)extInfo;
|
||||
|
||||
@end
|
||||
322
Example/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/Internal/AppEvents/Codeless/FBSDKCodelessIndexer.m
generated
Normal file
322
Example/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/Internal/AppEvents/Codeless/FBSDKCodelessIndexer.m
generated
Normal file
@ -0,0 +1,322 @@
|
||||
// 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 "FBSDKCodelessIndexer.h"
|
||||
|
||||
#import <objc/runtime.h>
|
||||
#import <sys/sysctl.h>
|
||||
#import <sys/utsname.h>
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <FBSDKCoreKit/FBSDKGraphRequest.h>
|
||||
#import <FBSDKCoreKit/FBSDKSettings.h>
|
||||
|
||||
#import "FBSDKCoreKit+Internal.h"
|
||||
|
||||
@implementation FBSDKCodelessIndexer
|
||||
|
||||
static BOOL _isCodelessIndexing;
|
||||
static BOOL _isCheckingSession;
|
||||
static BOOL _isCodelessIndexingEnabled;
|
||||
|
||||
static NSString *_deviceSessionID;
|
||||
static NSTimer *_appIndexingTimer;
|
||||
static NSString *_lastTreeHash;
|
||||
|
||||
+ (void)load
|
||||
{
|
||||
#if TARGET_OS_SIMULATOR
|
||||
[self setupGesture];
|
||||
#else
|
||||
[FBSDKServerConfigurationManager loadServerConfigurationWithCompletionBlock:^(FBSDKServerConfiguration *serverConfiguration, NSError *error) {
|
||||
if (serverConfiguration.codelessSetupEnabled) {
|
||||
[self setupGesture];
|
||||
}
|
||||
}];
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (void)setupGesture
|
||||
{
|
||||
[UIApplication sharedApplication].applicationSupportsShakeToEdit = YES;
|
||||
Class class = [UIApplication class];
|
||||
|
||||
[FBSDKSwizzler swizzleSelector:@selector(motionBegan:withEvent:) onClass:class withBlock:^{
|
||||
if ([FBSDKServerConfigurationManager cachedServerConfiguration].isCodelessEventsEnabled) {
|
||||
[self checkCodelessIndexingSession];
|
||||
}
|
||||
} named:@"motionBegan"];
|
||||
}
|
||||
|
||||
|
||||
|
||||
+ (void)checkCodelessIndexingSession
|
||||
{
|
||||
if (_isCheckingSession) return;
|
||||
|
||||
_isCheckingSession = YES;
|
||||
NSDictionary *parameters = @{
|
||||
CODELESS_INDEXING_SESSION_ID_KEY: [self currentSessionDeviceID],
|
||||
CODELESS_INDEXING_EXT_INFO_KEY: [self extInfo]
|
||||
};
|
||||
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
|
||||
initWithGraphPath:[NSString stringWithFormat:@"%@/%@",
|
||||
[FBSDKSettings appID], CODELESS_INDEXING_SESSION_ENDPOINT]
|
||||
parameters: parameters
|
||||
HTTPMethod:@"POST"];
|
||||
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
|
||||
_isCheckingSession = NO;
|
||||
if ([result isKindOfClass:[NSDictionary class]]) {
|
||||
_isCodelessIndexingEnabled = [((NSDictionary *)result)[CODELESS_INDEXING_STATUS_KEY] boolValue];
|
||||
if (_isCodelessIndexingEnabled) {
|
||||
_lastTreeHash = nil;
|
||||
if (!_appIndexingTimer) {
|
||||
_appIndexingTimer = [NSTimer timerWithTimeInterval:CODELESS_INDEXING_UPLOAD_INTERVAL_IN_SECONDS
|
||||
target:self
|
||||
selector:@selector(startIndexing)
|
||||
userInfo:nil
|
||||
repeats:YES];
|
||||
|
||||
[[NSRunLoop mainRunLoop] addTimer:_appIndexingTimer forMode:NSDefaultRunLoopMode];
|
||||
}
|
||||
} else {
|
||||
_deviceSessionID = nil;
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
+ (NSString *)currentSessionDeviceID
|
||||
{
|
||||
if (!_deviceSessionID) {
|
||||
_deviceSessionID = [NSUUID UUID].UUIDString;
|
||||
}
|
||||
return _deviceSessionID;
|
||||
}
|
||||
|
||||
+ (NSString *)extInfo
|
||||
{
|
||||
struct utsname systemInfo;
|
||||
uname(&systemInfo);
|
||||
NSString *machine = @(systemInfo.machine);
|
||||
NSString *advertiserID = [FBSDKAppEventsUtility advertiserID] ?: @"";
|
||||
machine = machine ?: @"";
|
||||
NSString *debugStatus = [FBSDKAppEventsUtility isDebugBuild] ? @"1" : @"0";
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
NSString *isSimulator = @"1";
|
||||
#else
|
||||
NSString *isSimulator = @"0";
|
||||
#endif
|
||||
NSLocale *locale = [NSLocale currentLocale];
|
||||
NSString *languageCode = [locale objectForKey:NSLocaleLanguageCode];
|
||||
NSString *countryCode = [locale objectForKey:NSLocaleCountryCode];
|
||||
NSString *localeString = locale.localeIdentifier;
|
||||
if (languageCode && countryCode) {
|
||||
localeString = [NSString stringWithFormat:@"%@_%@", languageCode, countryCode];
|
||||
}
|
||||
|
||||
NSString *extinfo = [FBSDKInternalUtility JSONStringForObject:@[machine,
|
||||
advertiserID,
|
||||
debugStatus,
|
||||
isSimulator,
|
||||
localeString]
|
||||
error:NULL
|
||||
invalidObjectHandler:NULL];
|
||||
|
||||
return extinfo ?: @"";
|
||||
}
|
||||
|
||||
+ (void)startIndexing {
|
||||
if (!_isCodelessIndexingEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (UIApplicationStateActive != [UIApplication sharedApplication].applicationState) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If userAgentSuffix begins with Unity, trigger unity code to upload view hierarchy
|
||||
NSString *userAgentSuffix = [FBSDKSettings userAgentSuffix];
|
||||
if (userAgentSuffix != nil && [userAgentSuffix hasPrefix:@"Unity"]) {
|
||||
Class FBUnityUtility = objc_lookUpClass("FBUnityUtility");
|
||||
SEL selector = NSSelectorFromString(@"triggerUploadViewHierarchy");
|
||||
if (FBUnityUtility && selector && [FBUnityUtility respondsToSelector:selector]) {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
|
||||
[FBUnityUtility performSelector:selector];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
} else {
|
||||
[self uploadIndexing];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)uploadIndexing
|
||||
{
|
||||
if (_isCodelessIndexing) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *tree = [FBSDKCodelessIndexer currentViewTree];
|
||||
|
||||
[self uploadIndexing:tree];
|
||||
}
|
||||
|
||||
+ (void)uploadIndexing:(NSString *)tree
|
||||
{
|
||||
if (_isCodelessIndexing) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!tree) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *currentTreeHash = [FBSDKUtility SHA256Hash:tree];
|
||||
if (_lastTreeHash && [_lastTreeHash isEqualToString:currentTreeHash]) {
|
||||
return;
|
||||
}
|
||||
|
||||
_lastTreeHash = currentTreeHash;
|
||||
|
||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||
NSString *version = [mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
|
||||
|
||||
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
|
||||
initWithGraphPath:[NSString stringWithFormat:@"%@/%@",
|
||||
[FBSDKSettings appID], CODELESS_INDEXING_ENDPOINT]
|
||||
parameters:@{
|
||||
CODELESS_INDEXING_TREE_KEY: tree,
|
||||
CODELESS_INDEXING_APP_VERSION_KEY: version ?: @"",
|
||||
CODELESS_INDEXING_PLATFORM_KEY: @"iOS",
|
||||
CODELESS_INDEXING_SESSION_ID_KEY: [self currentSessionDeviceID]
|
||||
}
|
||||
HTTPMethod:@"POST"];
|
||||
_isCodelessIndexing = YES;
|
||||
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
|
||||
_isCodelessIndexing = NO;
|
||||
if ([result isKindOfClass:[NSDictionary class]]) {
|
||||
_isCodelessIndexingEnabled = [result[CODELESS_INDEXING_STATUS_KEY] boolValue];
|
||||
if (!_isCodelessIndexingEnabled) {
|
||||
_deviceSessionID = nil;
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
+ (NSString *)currentViewTree
|
||||
{
|
||||
NSMutableArray *trees = [NSMutableArray array];
|
||||
|
||||
NSArray *windows = [UIApplication sharedApplication].windows;
|
||||
for (UIWindow *window in windows) {
|
||||
NSDictionary *tree = [FBSDKCodelessIndexer recursiveCaptureTree:window];
|
||||
if (tree) {
|
||||
if (window.isKeyWindow) {
|
||||
[trees insertObject:tree atIndex:0];
|
||||
} else {
|
||||
[trees addObject:tree];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (0 == trees.count) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSArray *viewTrees = [trees reverseObjectEnumerator].allObjects;
|
||||
|
||||
NSData *data = UIImageJPEGRepresentation([FBSDKCodelessIndexer screenshot], 0.5);
|
||||
NSString *screenshot = [data base64EncodedStringWithOptions:0];
|
||||
|
||||
NSMutableDictionary *treeInfo = [NSMutableDictionary dictionary];
|
||||
|
||||
treeInfo[@"view"] = viewTrees;
|
||||
treeInfo[@"screenshot"] = screenshot ?: @"";
|
||||
|
||||
NSString *tree = nil;
|
||||
data = [NSJSONSerialization dataWithJSONObject:treeInfo options:0 error:nil];
|
||||
if (data) {
|
||||
tree = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
|
||||
}
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
+ (NSDictionary<NSString *, id> *)recursiveCaptureTree:(NSObject *)obj
|
||||
{
|
||||
if (!obj) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSMutableDictionary *result = [FBSDKViewHierarchy getDetailAttributesOf:obj];
|
||||
|
||||
NSArray *children = [FBSDKViewHierarchy getChildren:obj];
|
||||
NSMutableArray *childrenTrees = [NSMutableArray array];
|
||||
for (NSObject *child in children) {
|
||||
NSDictionary *objTree = [self recursiveCaptureTree:child];
|
||||
[childrenTrees addObject:objTree];
|
||||
}
|
||||
|
||||
if (childrenTrees.count > 0) {
|
||||
[result setValue:[childrenTrees copy] forKey:CODELESS_VIEW_TREE_CHILDREN_KEY];
|
||||
}
|
||||
|
||||
return [result copy];
|
||||
}
|
||||
|
||||
+ (UIImage *)screenshot {
|
||||
UIWindow *window = [UIApplication sharedApplication].delegate.window;
|
||||
|
||||
UIGraphicsBeginImageContext(window.bounds.size);
|
||||
[window drawViewHierarchyInRect:window.bounds afterScreenUpdates:YES];
|
||||
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
+ (NSDictionary<NSString *, NSNumber *> *)dimensionOf:(NSObject *)obj
|
||||
{
|
||||
UIView *view = nil;
|
||||
|
||||
if ([obj isKindOfClass:[UIView class]]) {
|
||||
view = (UIView *)obj;
|
||||
} else if ([obj isKindOfClass:[UIViewController class]]) {
|
||||
view = ((UIViewController *)obj).view;
|
||||
}
|
||||
|
||||
CGRect frame = view.frame;
|
||||
CGPoint offset = CGPointZero;
|
||||
|
||||
if ([view isKindOfClass:[UIScrollView class]])
|
||||
offset = ((UIScrollView *)view).contentOffset;
|
||||
|
||||
return @{
|
||||
CODELESS_VIEW_TREE_TOP_KEY: @((int)frame.origin.y),
|
||||
CODELESS_VIEW_TREE_LEFT_KEY: @((int)frame.origin.x),
|
||||
CODELESS_VIEW_TREE_WIDTH_KEY: @((int)frame.size.width),
|
||||
CODELESS_VIEW_TREE_HEIGHT_KEY: @((int)frame.size.height),
|
||||
CODELESS_VIEW_TREE_OFFSET_X_KEY: @((int)offset.x),
|
||||
CODELESS_VIEW_TREE_OFFSET_Y_KEY: @((int)offset.y),
|
||||
CODELESS_VIEW_TREE_VISIBILITY_KEY: view.isHidden ? @4 : @0
|
||||
};
|
||||
}
|
||||
|
||||
@end
|
||||
@ -37,12 +37,49 @@
|
||||
#define CODELESS_MAPPING_HINT_KEY @"hint"
|
||||
#define CODELESS_MAPPING_PARAMETERS_KEY @"parameters"
|
||||
#define CODELESS_MAPPING_PARAMETER_NAME_KEY @"name"
|
||||
#define CODELESS_MAPPING_PARAMETER_VALUE_KEY @"value"
|
||||
#define CODELESS_MAPPING_PARAMETER_VALUE_KEY @"value"
|
||||
|
||||
#define CODELESS_MAPPING_PARENT_CLASS_NAME @".."
|
||||
#define CODELESS_MAPPING_CURRENT_CLASS_NAME @"."
|
||||
|
||||
#define ReactNativeClassRCTView @"RCTView"
|
||||
#define ReactNativeClassRCTRootView @"RCTRootView"
|
||||
#define ReactNativeClassRCTView "RCTView"
|
||||
#define ReactNativeClassRCTRootView "RCTRootView"
|
||||
|
||||
#define CODELESS_INDEXING_UPLOAD_INTERVAL_IN_SECONDS 1
|
||||
#define CODELESS_INDEXING_STATUS_KEY @"is_app_indexing_enabled"
|
||||
#define CODELESS_INDEXING_SESSION_ID_KEY @"device_session_id"
|
||||
#define CODELESS_INDEXING_APP_VERSION_KEY @"app_version"
|
||||
#define CODELESS_INDEXING_SDK_VERSION_KEY @"sdk_version"
|
||||
#define CODELESS_INDEXING_PLATFORM_KEY @"platform"
|
||||
#define CODELESS_INDEXING_TREE_KEY @"tree"
|
||||
#define CODELESS_INDEXING_SCREENSHOT_KEY @"screenshot"
|
||||
#define CODELESS_INDEXING_EXT_INFO_KEY @"extinfo"
|
||||
|
||||
#define CODELESS_INDEXING_ENDPOINT @"app_indexing"
|
||||
#define CODELESS_INDEXING_SESSION_ENDPOINT @"app_indexing_session"
|
||||
|
||||
// keys for view tree
|
||||
#define CODELESS_VIEW_TREE_CLASS_NAME_KEY @"classname"
|
||||
#define CODELESS_VIEW_TREE_CLASS_TYPE_BIT_MASK_KEY @"classtypebitmask"
|
||||
#define CODELESS_VIEW_TREE_TEXT_KEY @"text"
|
||||
#define CODELESS_VIEW_TREE_DESC_KEY @"description"
|
||||
#define CODELESS_VIEW_TREE_DIMENSION_KEY @"dimension"
|
||||
#define CODELESS_VIEW_TREE_TAG_KEY @"tag"
|
||||
#define CODELESS_VIEW_TREE_CHILDREN_KEY @"childviews"
|
||||
#define CODELESS_VIEW_TREE_HINT_KEY @"hint"
|
||||
#define CODELESS_VIEW_TREE_ACTIONS_KEY @"actions"
|
||||
|
||||
#define CODELESS_VIEW_TREE_TOP_KEY @"top"
|
||||
#define CODELESS_VIEW_TREE_LEFT_KEY @"left"
|
||||
#define CODELESS_VIEW_TREE_WIDTH_KEY @"width"
|
||||
#define CODELESS_VIEW_TREE_HEIGHT_KEY @"height"
|
||||
#define CODELESS_VIEW_TREE_OFFSET_X_KEY @"scrollx"
|
||||
#define CODELESS_VIEW_TREE_OFFSET_Y_KEY @"scrolly"
|
||||
#define CODELESS_VIEW_TREE_VISIBILITY_KEY @"visibility"
|
||||
|
||||
#define CODELESS_VIEW_TREE_TEXT_STYLE_KEY @"text_style"
|
||||
#define CODELESS_VIEW_TREE_TEXT_IS_BOLD_KEY @"is_bold"
|
||||
#define CODELESS_VIEW_TREE_TEXT_IS_ITALIC_KEY @"is_italic"
|
||||
#define CODELESS_VIEW_TREE_TEXT_SIZE_KEY @"font_size"
|
||||
|
||||
#endif /* FBSDKCodelessMacros_h */
|
||||
|
||||
@ -25,15 +25,14 @@
|
||||
|
||||
- (instancetype)initWithJSON:(NSDictionary *)dict {
|
||||
if (self = [super init]) {
|
||||
_name = [[dict objectForKey:CODELESS_MAPPING_PARAMETER_NAME_KEY] copy];
|
||||
_value = [[dict objectForKey:CODELESS_MAPPING_PARAMETER_VALUE_KEY] copy];
|
||||
_pathType = [[dict objectForKey:CODELESS_MAPPING_PATH_TYPE_KEY] copy];
|
||||
_name = [dict[CODELESS_MAPPING_PARAMETER_NAME_KEY] copy];
|
||||
_value = [dict[CODELESS_MAPPING_PARAMETER_VALUE_KEY] copy];
|
||||
_pathType = [dict[CODELESS_MAPPING_PATH_TYPE_KEY] copy];
|
||||
|
||||
NSArray *ary = [dict objectForKey:CODELESS_MAPPING_PATH_KEY];
|
||||
NSArray *ary = dict[CODELESS_MAPPING_PATH_KEY];
|
||||
NSMutableArray *mut = [NSMutableArray array];
|
||||
for (NSDictionary *info in ary) {
|
||||
FBSDKCodelessPathComponent *component = [[FBSDKCodelessPathComponent alloc]
|
||||
initWithJSON:info];
|
||||
FBSDKCodelessPathComponent *component = [[FBSDKCodelessPathComponent alloc] initWithJSON:info];
|
||||
[mut addObject:component];
|
||||
}
|
||||
_path = [mut copy];
|
||||
|
||||
@ -24,32 +24,32 @@
|
||||
|
||||
- (instancetype)initWithJSON:(NSDictionary *)dict {
|
||||
if (self = [super init]) {
|
||||
_className = [[dict objectForKey:CODELESS_MAPPING_CLASS_NAME_KEY] copy];
|
||||
_text = [[dict objectForKey:CODELESS_MAPPING_TEXT_KEY] copy];
|
||||
_hint = [[dict objectForKey:CODELESS_MAPPING_HINT_KEY] copy];
|
||||
_desc = [[dict objectForKey:CODELESS_MAPPING_DESC_KEY] copy];
|
||||
_className = [dict[CODELESS_MAPPING_CLASS_NAME_KEY] copy];
|
||||
_text = [dict[CODELESS_MAPPING_TEXT_KEY] copy];
|
||||
_hint = [dict[CODELESS_MAPPING_HINT_KEY] copy];
|
||||
_desc = [dict[CODELESS_MAPPING_DESC_KEY] copy];
|
||||
|
||||
|
||||
if ([dict objectForKey:CODELESS_MAPPING_INDEX_KEY]) {
|
||||
_index = [[dict objectForKey:CODELESS_MAPPING_INDEX_KEY] intValue];
|
||||
if (dict[CODELESS_MAPPING_INDEX_KEY]) {
|
||||
_index = [dict[CODELESS_MAPPING_INDEX_KEY] intValue];
|
||||
} else {
|
||||
_index = -1;
|
||||
}
|
||||
|
||||
if ([dict objectForKey:CODELESS_MAPPING_SECTION_KEY]) {
|
||||
_section = [[dict objectForKey:CODELESS_MAPPING_SECTION_KEY] intValue];
|
||||
if (dict[CODELESS_MAPPING_SECTION_KEY]) {
|
||||
_section = [dict[CODELESS_MAPPING_SECTION_KEY] intValue];
|
||||
} else {
|
||||
_section = -1;
|
||||
}
|
||||
|
||||
if ([dict objectForKey:CODELESS_MAPPING_ROW_KEY]) {
|
||||
_row = [[dict objectForKey:CODELESS_MAPPING_ROW_KEY] intValue];
|
||||
if (dict[CODELESS_MAPPING_ROW_KEY]) {
|
||||
_row = [dict[CODELESS_MAPPING_ROW_KEY] intValue];
|
||||
} else {
|
||||
_row = -1;
|
||||
}
|
||||
|
||||
_tag = [[dict objectForKey:CODELESS_MAPPING_TAG_KEY] intValue];
|
||||
_matchBitmask = [[dict objectForKey:CODELESS_MAPPING_MATCH_BITMASK_KEY] intValue];
|
||||
_tag = [dict[CODELESS_MAPPING_TAG_KEY] intValue];
|
||||
_matchBitmask = [dict[CODELESS_MAPPING_MATCH_BITMASK_KEY] intValue];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
@ -37,25 +37,23 @@
|
||||
- (FBSDKEventBinding *)initWithJSON:(NSDictionary *)dict
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
_eventName = [[dict objectForKey:CODELESS_MAPPING_EVENT_NAME_KEY] copy];
|
||||
_eventType = [[dict objectForKey:CODELESS_MAPPING_EVENT_TYPE_KEY] copy];
|
||||
_appVersion = [[dict objectForKey:CODELESS_MAPPING_APP_VERSION_KEY] copy];
|
||||
_pathType = [[dict objectForKey:CODELESS_MAPPING_PATH_TYPE_KEY] copy];
|
||||
_eventName = [dict[CODELESS_MAPPING_EVENT_NAME_KEY] copy];
|
||||
_eventType = [dict[CODELESS_MAPPING_EVENT_TYPE_KEY] copy];
|
||||
_appVersion = [dict[CODELESS_MAPPING_APP_VERSION_KEY] copy];
|
||||
_pathType = [dict[CODELESS_MAPPING_PATH_TYPE_KEY] copy];
|
||||
|
||||
NSArray *pathComponents = [dict objectForKey:CODELESS_MAPPING_PATH_KEY];
|
||||
NSArray *pathComponents = dict[CODELESS_MAPPING_PATH_KEY];
|
||||
NSMutableArray *mut = [NSMutableArray array];
|
||||
for (NSDictionary *info in pathComponents) {
|
||||
FBSDKCodelessPathComponent *component = [[FBSDKCodelessPathComponent alloc]
|
||||
initWithJSON:info];
|
||||
FBSDKCodelessPathComponent *component = [[FBSDKCodelessPathComponent alloc] initWithJSON:info];
|
||||
[mut addObject:component];
|
||||
}
|
||||
_path = [mut copy];
|
||||
|
||||
NSArray *parameters = [dict objectForKey:CODELESS_MAPPING_PARAMETERS_KEY];
|
||||
NSArray *parameters = dict[CODELESS_MAPPING_PARAMETERS_KEY];
|
||||
mut = [NSMutableArray array];
|
||||
for (NSDictionary *info in parameters) {
|
||||
FBSDKCodelessParameterComponent *component = [[FBSDKCodelessParameterComponent alloc]
|
||||
initWithJSON:info];
|
||||
FBSDKCodelessParameterComponent *component = [[FBSDKCodelessParameterComponent alloc] initWithJSON:info];
|
||||
[mut addObject:component];
|
||||
}
|
||||
_parameters = [mut copy];
|
||||
@ -67,7 +65,7 @@
|
||||
{
|
||||
UIView *sourceView = [sender isKindOfClass:[UIView class]] ? (UIView *)sender : nil;
|
||||
NSMutableDictionary *params = [NSMutableDictionary dictionary];
|
||||
[params setObject:@"1" forKey:CODELESS_CODELESS_EVENT_KEY];
|
||||
params[CODELESS_CODELESS_EVENT_KEY] = @"1";
|
||||
for (FBSDKCodelessParameterComponent *component in self.parameters) {
|
||||
NSString *text = component.value;
|
||||
if (!text || text.length == 0) {
|
||||
@ -78,9 +76,9 @@
|
||||
if (text) {
|
||||
if ([component.name isEqualToString:PARAMETER_NAME_PRICE]) {
|
||||
NSNumber *value = [FBSDKAppEventsUtility getNumberValue:text];
|
||||
[params setObject:value forKey:component.name];
|
||||
params[component.name] = value;
|
||||
} else {
|
||||
[params setObject:text forKey:component.name];
|
||||
params[component.name] = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -162,8 +160,8 @@ pathComponent:(FBSDKCodelessPathComponent *)component
|
||||
NSInteger idxPath = path.count - i - 1;
|
||||
NSInteger idxViewPath = viewPath.count - i - 1;
|
||||
|
||||
FBSDKCodelessPathComponent *pathComponent = [path objectAtIndex:idxPath];
|
||||
FBSDKCodelessPathComponent *viewPathComponent = [viewPath objectAtIndex:idxViewPath];
|
||||
FBSDKCodelessPathComponent *pathComponent = path[idxPath];
|
||||
FBSDKCodelessPathComponent *viewPathComponent = viewPath[idxViewPath];
|
||||
|
||||
if (![pathComponent.className isEqualToString:viewPathComponent.className]) {
|
||||
return NO;
|
||||
@ -206,7 +204,7 @@ pathComponent:(FBSDKCodelessPathComponent *)component
|
||||
return nil;
|
||||
}
|
||||
|
||||
FBSDKCodelessPathComponent *pathComponent = [path objectAtIndex:level];
|
||||
FBSDKCodelessPathComponent *pathComponent = path[level];
|
||||
|
||||
// If found parent, skip to next level
|
||||
if ([pathComponent.className isEqualToString:CODELESS_MAPPING_PARENT_CLASS_NAME]) {
|
||||
@ -232,7 +230,7 @@ pathComponent:(FBSDKCodelessPathComponent *)component
|
||||
if (path.count - 1 == level) {
|
||||
int index = pathComponent.index;
|
||||
if (index >= 0) {
|
||||
NSObject *child = index < children.count ? [children objectAtIndex:index] : nil;
|
||||
NSObject *child = index < children.count ? children[index] : nil;
|
||||
if ([self match:child pathComponent:pathComponent]) {
|
||||
return child;
|
||||
}
|
||||
|
||||
@ -18,6 +18,8 @@
|
||||
|
||||
#import "FBSDKEventBindingManager.h"
|
||||
|
||||
#import <objc/runtime.h>
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "FBSDKCodelessMacros.h"
|
||||
@ -27,14 +29,13 @@
|
||||
#import "FBSDKTypeUtility.h"
|
||||
#import "FBSDKViewHierarchy.h"
|
||||
|
||||
#define ReactNativeEventNameKey @"eventName"
|
||||
#define ReactNativeViewTagKey @"viewTag"
|
||||
#define ReactNativeTouchEndEventName @"touchEnd"
|
||||
#define ReactNativeTargetKey @"target"
|
||||
#define ReactNativeTouchEndEventName @"topTouchEnd"
|
||||
|
||||
#define ReactNativeClassRCTTextView @"RCTTextView"
|
||||
#define ReactNativeClassRCTImageView @"RCTImageVIew"
|
||||
#define ReactNativeClassRCTEventDispatcher @"RCTEventDispatcher"
|
||||
#define ReactNativeClassRCTTouchEvent @"RCTTouchEvent"
|
||||
#define ReactNativeClassRCTTextView "RCTTextView"
|
||||
#define ReactNativeClassRCTImageView "RCTImageVIew"
|
||||
#define ReactNativeClassRCTEventDispatcher "RCTEventDispatcher"
|
||||
#define ReactNativeClassRCTTouchEvent "RCTTouchEvent"
|
||||
|
||||
static void fb_dispatch_on_main_thread(dispatch_block_t block) {
|
||||
dispatch_async(dispatch_get_main_queue(), block);
|
||||
@ -59,7 +60,7 @@ static void fb_dispatch_on_default_thread(dispatch_block_t block) {
|
||||
- (id)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
isStarted = false;
|
||||
isStarted = NO;
|
||||
hasReactNative = NO;
|
||||
reactBindings = [NSMutableDictionary dictionary];
|
||||
|
||||
@ -68,12 +69,12 @@ static void fb_dispatch_on_default_thread(dispatch_block_t block) {
|
||||
[classes addObject:[UITableView class]];
|
||||
[classes addObject:[UICollectionView class]];
|
||||
// ReactNative
|
||||
Class classRCTRootView = NSClassFromString(ReactNativeClassRCTRootView);
|
||||
Class classRCTRootView = objc_lookUpClass(ReactNativeClassRCTRootView);
|
||||
if (classRCTRootView != nil) {
|
||||
hasReactNative = YES;
|
||||
Class classRCTView = NSClassFromString(ReactNativeClassRCTView);
|
||||
Class classRCTTextView = NSClassFromString(ReactNativeClassRCTTextView);
|
||||
Class classRCTImageView = NSClassFromString(ReactNativeClassRCTImageView);
|
||||
Class classRCTView = objc_lookUpClass(ReactNativeClassRCTView);
|
||||
Class classRCTTextView = objc_lookUpClass(ReactNativeClassRCTTextView);
|
||||
Class classRCTImageView = objc_lookUpClass(ReactNativeClassRCTImageView);
|
||||
if (classRCTView) {
|
||||
[classes addObject:classRCTView];
|
||||
}
|
||||
@ -121,7 +122,7 @@ static void fb_dispatch_on_default_thread(dispatch_block_t block) {
|
||||
if (isStarted) {
|
||||
return;
|
||||
}
|
||||
isStarted = true;
|
||||
isStarted = YES;
|
||||
|
||||
void (^blockToSuperview)(id view) = ^(id view) {
|
||||
[self matchView:view delegate:nil];
|
||||
@ -132,45 +133,47 @@ static void fb_dispatch_on_default_thread(dispatch_block_t block) {
|
||||
};
|
||||
|
||||
[FBSDKSwizzler swizzleSelector:@selector(didMoveToSuperview)
|
||||
onClass:[UIControl class]
|
||||
withBlock:blockToSuperview named:@"map_control"];
|
||||
onClass:[UIControl class]
|
||||
withBlock:blockToSuperview named:@"map_control"];
|
||||
[FBSDKSwizzler swizzleSelector:@selector(didMoveToWindow)
|
||||
onClass:[UIControl class]
|
||||
withBlock:blockToWindow named:@"map_control"];
|
||||
onClass:[UIControl class]
|
||||
withBlock:blockToWindow named:@"map_control"];
|
||||
|
||||
|
||||
// ReactNative
|
||||
if (hasReactNative) { // If app is built via ReactNative
|
||||
Class classRCTView = NSClassFromString(ReactNativeClassRCTView);
|
||||
Class classRCTTextView = NSClassFromString(ReactNativeClassRCTTextView);
|
||||
Class classRCTImageView = NSClassFromString(ReactNativeClassRCTImageView);
|
||||
Class classRCTEventDispatcher = NSClassFromString(ReactNativeClassRCTEventDispatcher);
|
||||
Class classRCTView = objc_lookUpClass(ReactNativeClassRCTView);
|
||||
Class classRCTTextView = objc_lookUpClass(ReactNativeClassRCTTextView);
|
||||
Class classRCTImageView = objc_lookUpClass(ReactNativeClassRCTImageView);
|
||||
Class classRCTEventDispatcher = objc_lookUpClass(ReactNativeClassRCTEventDispatcher);
|
||||
|
||||
// All react-native views would be added tp RCTRootView, so no need to check didMoveToWindow
|
||||
[FBSDKSwizzler swizzleSelector:@selector(didMoveToSuperview)
|
||||
onClass:classRCTView
|
||||
withBlock:blockToSuperview
|
||||
named:@"match_react_native"];
|
||||
onClass:classRCTView
|
||||
withBlock:blockToSuperview
|
||||
named:@"match_react_native"];
|
||||
[FBSDKSwizzler swizzleSelector:@selector(didMoveToSuperview)
|
||||
onClass:classRCTTextView
|
||||
withBlock:blockToSuperview
|
||||
named:@"match_react_native"];
|
||||
onClass:classRCTTextView
|
||||
withBlock:blockToSuperview
|
||||
named:@"match_react_native"];
|
||||
[FBSDKSwizzler swizzleSelector:@selector(didMoveToSuperview)
|
||||
onClass:classRCTImageView
|
||||
withBlock:blockToSuperview
|
||||
named:@"match_react_native"];
|
||||
onClass:classRCTImageView
|
||||
withBlock:blockToSuperview
|
||||
named:@"match_react_native"];
|
||||
|
||||
[FBSDKSwizzler swizzleSelector:@selector(dispatchEvent:) onClass:classRCTEventDispatcher withBlock:^(id dispatcher, SEL command, id event){
|
||||
if ([event isKindOfClass:NSClassFromString(ReactNativeClassRCTTouchEvent)]) {
|
||||
if ([event isKindOfClass:objc_lookUpClass(ReactNativeClassRCTTouchEvent)]) {
|
||||
@try {
|
||||
NSString *eventName = [event valueForKeyPath:ReactNativeEventNameKey];
|
||||
NSNumber *viewTag = [event valueForKeyPath:ReactNativeViewTagKey];
|
||||
|
||||
if ([eventName isEqualToString:ReactNativeTouchEndEventName]
|
||||
&& nil != viewTag) {
|
||||
FBSDKEventBinding *eventBinding = [self->reactBindings objectForKey:viewTag];
|
||||
if (eventBinding) {
|
||||
[eventBinding trackEvent:nil];
|
||||
NSArray<id> *eventArgs = [event arguments];
|
||||
NSString *eventName = eventArgs[0];
|
||||
NSArray<NSDictionary *> *touches = eventArgs[1];
|
||||
if (eventName && touches && [eventName isEqualToString:ReactNativeTouchEndEventName]) {
|
||||
for (NSDictionary<NSString *, id> *touch in touches) {
|
||||
NSNumber *targetTag = touch[ReactNativeTargetKey];
|
||||
FBSDKEventBinding *eventBinding = self->reactBindings[targetTag];
|
||||
if (eventBinding) {
|
||||
[eventBinding trackEvent:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -193,9 +196,9 @@ static void fb_dispatch_on_default_thread(dispatch_block_t block) {
|
||||
[self matchView:tableView delegate:delegate];
|
||||
};
|
||||
[FBSDKSwizzler swizzleSelector:@selector(setDelegate:)
|
||||
onClass:[UITableView class]
|
||||
withBlock:tableViewBlock
|
||||
named:@"match_table_view"];
|
||||
onClass:[UITableView class]
|
||||
withBlock:tableViewBlock
|
||||
named:@"match_table_view"];
|
||||
// UICollectionView
|
||||
void (^collectionViewBlock)(UICollectionView *collectionView,
|
||||
SEL cmd,
|
||||
@ -208,9 +211,9 @@ static void fb_dispatch_on_default_thread(dispatch_block_t block) {
|
||||
[self matchView:collectionView delegate:delegate];
|
||||
};
|
||||
[FBSDKSwizzler swizzleSelector:@selector(setDelegate:)
|
||||
onClass:[UICollectionView class]
|
||||
withBlock:collectionViewBlock
|
||||
named:@"handle_collection_view"];
|
||||
onClass:[UICollectionView class]
|
||||
withBlock:collectionViewBlock
|
||||
named:@"handle_collection_view"];
|
||||
}
|
||||
|
||||
- (void)rematchBindings {
|
||||
@ -284,12 +287,17 @@ static void fb_dispatch_on_default_thread(dispatch_block_t block) {
|
||||
}
|
||||
} else if (self->hasReactNative
|
||||
&& [view respondsToSelector:@selector(reactTag)]) {
|
||||
NSNumber *reactTag = [view performSelector:@selector(reactTag)];
|
||||
for (FBSDKEventBinding *binding in self->eventBindings) {
|
||||
if ([FBSDKEventBinding isPath:binding.path matchViewPath:path]) {
|
||||
fb_dispatch_on_main_thread(^{
|
||||
if (reactTag && [reactTag isKindOfClass:[NSNumber class]]) {
|
||||
[self->reactBindings setObject:binding forKey:reactTag];
|
||||
// React Native touchable event is targeted at first subview,
|
||||
// so extract the first subview and set the binding for it
|
||||
UIView *reactView = view.subviews.firstObject;
|
||||
if (reactView) {
|
||||
NSNumber *reactTag = [FBSDKViewHierarchy getViewReactTag:reactView];
|
||||
if (reactTag != nil) {
|
||||
self->reactBindings[reactTag] = binding;
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
@ -310,7 +318,7 @@ static void fb_dispatch_on_default_thread(dispatch_block_t block) {
|
||||
}
|
||||
|
||||
if (matchedBindings.count > 0) {
|
||||
NSArray *bindings = [matchedBindings allObjects];
|
||||
NSArray *bindings = matchedBindings.allObjects;
|
||||
void (^block)(id, SEL, id, id) = ^(id target, SEL command, UITableView *tableView, NSIndexPath *indexPath) {
|
||||
fb_dispatch_on_main_thread(^{
|
||||
for (FBSDKEventBinding *binding in bindings) {
|
||||
@ -324,9 +332,9 @@ static void fb_dispatch_on_default_thread(dispatch_block_t block) {
|
||||
});
|
||||
};
|
||||
[FBSDKSwizzler swizzleSelector:@selector(tableView:didSelectRowAtIndexPath:)
|
||||
onClass:[delegate class]
|
||||
withBlock:block
|
||||
named:@"handle_table_view"];
|
||||
onClass:[delegate class]
|
||||
withBlock:block
|
||||
named:@"handle_table_view"];
|
||||
}
|
||||
});
|
||||
} else if ([view isKindOfClass:[UICollectionView class]]
|
||||
@ -344,7 +352,7 @@ static void fb_dispatch_on_default_thread(dispatch_block_t block) {
|
||||
}
|
||||
|
||||
if (matchedBindings.count > 0) {
|
||||
NSArray *bindings = [matchedBindings allObjects];
|
||||
NSArray *bindings = matchedBindings.allObjects;
|
||||
void (^block)(id, SEL, id, id) = ^(id target, SEL command, UICollectionView *collectionView, NSIndexPath *indexPath) {
|
||||
fb_dispatch_on_main_thread(^{
|
||||
for (FBSDKEventBinding *binding in bindings) {
|
||||
@ -358,9 +366,9 @@ static void fb_dispatch_on_default_thread(dispatch_block_t block) {
|
||||
});
|
||||
};
|
||||
[FBSDKSwizzler swizzleSelector:@selector(collectionView:didSelectItemAtIndexPath:)
|
||||
onClass:[delegate class]
|
||||
withBlock:block
|
||||
named:@"handle_collection_view"];
|
||||
onClass:[delegate class]
|
||||
withBlock:block
|
||||
named:@"handle_collection_view"];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -22,12 +22,17 @@
|
||||
@interface FBSDKViewHierarchy : NSObject
|
||||
|
||||
+ (NSObject *)getParent:(NSObject *)obj;
|
||||
+ (NSArray *)getChildren:(NSObject *)obj;
|
||||
+ (NSArray *)getPath:(NSObject *)obj;
|
||||
+ (NSArray<NSObject *> *)getChildren:(NSObject *)obj;
|
||||
+ (NSArray<NSObject *> *)getPath:(NSObject *)obj;
|
||||
+ (NSMutableDictionary<NSString *, id> *)getDetailAttributesOf:(NSObject *)obj;
|
||||
|
||||
+ (NSString *)getText:(NSObject *)obj;
|
||||
+ (NSString *)getHint:(NSObject *)obj;
|
||||
+ (NSIndexPath *)getIndexPath:(NSObject *)obj;
|
||||
+ (NSUInteger)getClassBitmask:(NSObject *)obj;
|
||||
+ (UITableView *)getParentTableView:(UIView *)cell;
|
||||
+ (UICollectionView *)getParentCollectionView:(UIView *)cell;
|
||||
+ (NSInteger)getTag:(NSObject *)obj;
|
||||
+ (NSNumber *)getViewReactTag:(UIView *)view;
|
||||
|
||||
@end
|
||||
|
||||
@ -28,9 +28,33 @@
|
||||
|
||||
#define MAX_VIEW_HIERARCHY_LEVEL 35
|
||||
|
||||
typedef NS_ENUM(NSUInteger, FBCodelessClassBitmask) {
|
||||
/*! Indicates that the class is subclass of UIControl */
|
||||
FBCodelessClassBitmaskUIControl = 1 << 3,
|
||||
/*! Indicates that the class is subclass of UIControl */
|
||||
FBCodelessClassBitmaskUIButton = 1 << 4,
|
||||
/*! Indicates that the class is ReactNative Button */
|
||||
FBCodelessClassBitmaskReactNativeButton = 1 << 6,
|
||||
/*! Indicates that the class is UITableViewCell */
|
||||
FBCodelessClassBitmaskUITableViewCell = 1 << 7,
|
||||
/*! Indicates that the class is UICollectionViewCell */
|
||||
FBCodelessClassBitmaskUICollectionViewCell = 1 << 8,
|
||||
/*! Indicates that the class is UILabel */
|
||||
FBCodelessClassBitmaskLabel = 1 << 10,
|
||||
/*! Indicates that the class is UITextView or UITextField*/
|
||||
FBCodelessClassBitmaskInput = 1 << 11,
|
||||
/*! Indicates that the class is UIPicker*/
|
||||
FBCodelessClassBitmaskPicker = 1 << 12,
|
||||
/*! Indicates that the class is UISwitch*/
|
||||
FBCodelessClassBitmaskSwitch = 1 << 13,
|
||||
/*! Indicates that the class is UIViewController*/
|
||||
FBCodelessClassBitmaskUIViewController = 1 << 17,
|
||||
};
|
||||
|
||||
@implementation FBSDKViewHierarchy
|
||||
|
||||
+ (NSArray*)getChildren:(NSObject*)obj {
|
||||
+ (NSArray*)getChildren:(NSObject*)obj
|
||||
{
|
||||
if ([obj isKindOfClass:[UIControl class]]) {
|
||||
return nil;
|
||||
}
|
||||
@ -40,7 +64,7 @@
|
||||
// children of window should be viewcontroller
|
||||
if ([obj isKindOfClass:[UIWindow class]]) {
|
||||
UIViewController *rootVC = ((UIWindow *)obj).rootViewController;
|
||||
NSArray *subviews = [(UIWindow *)obj subviews];
|
||||
NSArray<UIView *> *subviews = ((UIWindow *)obj).subviews;
|
||||
for (UIView *child in subviews) {
|
||||
if (child != rootVC.view) {
|
||||
UIViewController *vc = [FBSDKViewHierarchy getParentViewController:child];
|
||||
@ -56,7 +80,7 @@
|
||||
}
|
||||
}
|
||||
} else if ([obj isKindOfClass:[UIView class]]) {
|
||||
NSArray *subviews = [[(UIView *)obj subviews] copy];
|
||||
NSArray<UIView *> *subviews = [((UIView *)obj).subviews copy];
|
||||
for (UIView *child in subviews) {
|
||||
UIViewController *vc = [FBSDKViewHierarchy getParentViewController:child];
|
||||
if (vc && vc.view == child) {
|
||||
@ -66,8 +90,8 @@
|
||||
}
|
||||
}
|
||||
} else if ([obj isKindOfClass:[UINavigationController class]]) {
|
||||
UIViewController *vc = [(UINavigationController*)obj visibleViewController];
|
||||
UIViewController *tc = [(UINavigationController*)obj topViewController];
|
||||
UIViewController *vc = ((UINavigationController*)obj).visibleViewController;
|
||||
UIViewController *tc = ((UINavigationController*)obj).topViewController;
|
||||
NSArray *nextChildren = [FBSDKViewHierarchy getChildren:((UIViewController*)obj).view];
|
||||
for (NSObject *child in nextChildren) {
|
||||
if (tc && [self isView:child superViewOfView:tc.view]) {
|
||||
@ -91,7 +115,7 @@
|
||||
[children addObject:vc];
|
||||
}
|
||||
} else if ([obj isKindOfClass:[UITabBarController class]]) {
|
||||
UIViewController *vc = [(UITabBarController *)obj selectedViewController];
|
||||
UIViewController *vc = ((UITabBarController *)obj).selectedViewController;
|
||||
NSArray *nextChildren = [FBSDKViewHierarchy getChildren:((UIViewController*)obj).view];
|
||||
for (NSObject *child in nextChildren) {
|
||||
if (vc && [self isView:child superViewOfView:vc.view]) {
|
||||
@ -116,7 +140,7 @@
|
||||
[children addObjectsFromArray:nextChildren];
|
||||
}
|
||||
}
|
||||
for (NSObject *child in [vc childViewControllers]) {
|
||||
for (NSObject *child in vc.childViewControllers) {
|
||||
[children addObject:child];
|
||||
}
|
||||
UIViewController *presentedVC = vc.presentedViewController;
|
||||
@ -130,7 +154,7 @@
|
||||
+ (NSObject *)getParent:(NSObject *)obj
|
||||
{
|
||||
if ([obj isKindOfClass:[UIView class]]) {
|
||||
UIView *superview = [(UIView *)obj superview];
|
||||
UIView *superview = ((UIView *)obj).superview;
|
||||
UIViewController *superviewViewController = [FBSDKViewHierarchy
|
||||
getParentViewController:superview];
|
||||
if (superviewViewController && superviewViewController.view == superview) {
|
||||
@ -142,10 +166,10 @@
|
||||
}
|
||||
else if ([obj isKindOfClass:[UIViewController class]]) {
|
||||
UIViewController *vc = (UIViewController *)obj;
|
||||
UIViewController *parentVC = [vc parentViewController];
|
||||
UIViewController *presentingVC = [vc presentingViewController];
|
||||
UINavigationController *nav = [vc navigationController];
|
||||
UITabBarController *tab = [vc tabBarController];
|
||||
UIViewController *parentVC = vc.parentViewController;
|
||||
UIViewController *presentingVC = vc.presentingViewController;
|
||||
UINavigationController *nav = vc.navigationController;
|
||||
UITabBarController *tab = vc.tabBarController;
|
||||
|
||||
if (nav) {
|
||||
return nav;
|
||||
@ -159,7 +183,7 @@
|
||||
return parentVC;
|
||||
}
|
||||
|
||||
if (presentingVC && [presentingVC presentedViewController] == vc) {
|
||||
if (presentingVC && presentingVC.presentedViewController == vc) {
|
||||
return presentingVC;
|
||||
}
|
||||
|
||||
@ -172,11 +196,13 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSArray *)getPath:(NSObject *)obj {
|
||||
+ (NSArray *)getPath:(NSObject *)obj
|
||||
{
|
||||
return [FBSDKViewHierarchy getPath:obj limit:MAX_VIEW_HIERARCHY_LEVEL];
|
||||
}
|
||||
|
||||
+ (NSArray *)getPath:(NSObject *)obj limit:(int)limit {
|
||||
+ (NSArray *)getPath:(NSObject *)obj limit:(int)limit
|
||||
{
|
||||
if (!obj || limit <= 0) {
|
||||
return nil;
|
||||
}
|
||||
@ -191,61 +217,7 @@
|
||||
path = [NSMutableArray array];
|
||||
}
|
||||
|
||||
NSMutableDictionary *componentInfo = [NSMutableDictionary dictionary];
|
||||
[componentInfo setObject:NSStringFromClass([obj class])
|
||||
forKey:CODELESS_MAPPING_CLASS_NAME_KEY];
|
||||
|
||||
NSString *text = [FBSDKViewHierarchy getText:obj];
|
||||
if (text) {
|
||||
[componentInfo setObject:text forKey:CODELESS_MAPPING_TEXT_KEY];
|
||||
}
|
||||
|
||||
if (parent != nil) {
|
||||
NSArray *children = [FBSDKViewHierarchy getChildren:parent];
|
||||
NSUInteger index = [children indexOfObject:obj];
|
||||
if (index != NSNotFound) {
|
||||
[componentInfo setObject:@(index)
|
||||
forKey:CODELESS_MAPPING_INDEX_KEY];
|
||||
}
|
||||
} else {
|
||||
[componentInfo setObject:@0 forKey:CODELESS_MAPPING_INDEX_KEY];
|
||||
}
|
||||
|
||||
if ([obj isKindOfClass:[UIView class]]) {
|
||||
[componentInfo setObject:@(((UIView *)obj).tag)
|
||||
forKey:CODELESS_MAPPING_TAG_KEY];
|
||||
|
||||
// Handle UITableViewCell & UICollectionViewCell
|
||||
if ([obj isKindOfClass:[UITableViewCell class]]) {
|
||||
UITableView *tableView = [FBSDKViewHierarchy getParentTableView:(UIView *)obj];
|
||||
NSIndexPath *indexPath = [tableView indexPathForCell:(UITableViewCell *)obj];
|
||||
if (indexPath) {
|
||||
[componentInfo setObject:@(indexPath.section)
|
||||
forKey:CODELESS_MAPPING_SECTION_KEY];
|
||||
[componentInfo setObject:@(indexPath.row)
|
||||
forKey:CODELESS_MAPPING_ROW_KEY];
|
||||
}
|
||||
} else if ([obj isKindOfClass:[UICollectionViewCell class]]) {
|
||||
UICollectionView *collectionView = [FBSDKViewHierarchy getParentCollectionView:(UIView *)obj];
|
||||
NSIndexPath *indexPath = [collectionView indexPathForCell:(UICollectionViewCell *)obj];
|
||||
if (indexPath) {
|
||||
[componentInfo setObject:@(indexPath.section)
|
||||
forKey:CODELESS_MAPPING_SECTION_KEY];
|
||||
[componentInfo setObject:@(indexPath.row)
|
||||
forKey:CODELESS_MAPPING_ROW_KEY];
|
||||
}
|
||||
} else if ([obj isKindOfClass:[UITextField class]]) {
|
||||
NSString *hint = [FBSDKViewHierarchy getHint:obj];
|
||||
if (hint) {
|
||||
[componentInfo setObject:hint forKey:CODELESS_MAPPING_HINT_KEY];
|
||||
}
|
||||
}
|
||||
} else if ([obj isKindOfClass:[UINavigationController class]]) {
|
||||
NSString *hint = [FBSDKViewHierarchy getHint:obj];
|
||||
if (hint) {
|
||||
[componentInfo setObject:hint forKey:CODELESS_MAPPING_HINT_KEY];
|
||||
}
|
||||
}
|
||||
NSDictionary *componentInfo = [FBSDKViewHierarchy getAttributesOf:obj parent:parent];
|
||||
|
||||
FBSDKCodelessPathComponent *pathComponent = [[FBSDKCodelessPathComponent alloc]
|
||||
initWithJSON:componentInfo];
|
||||
@ -254,18 +226,114 @@
|
||||
return [NSArray arrayWithArray:path];
|
||||
}
|
||||
|
||||
+ (NSString *)getText:(NSObject *)obj {
|
||||
+ (NSDictionary<NSString *, id> *)getAttributesOf:(NSObject *)obj parent:(NSObject *)parent
|
||||
{
|
||||
NSMutableDictionary *componentInfo = [NSMutableDictionary dictionary];
|
||||
componentInfo[CODELESS_MAPPING_CLASS_NAME_KEY] = NSStringFromClass([obj class]);
|
||||
|
||||
NSString *text = [FBSDKViewHierarchy getText:obj];
|
||||
if (text) {
|
||||
componentInfo[CODELESS_MAPPING_TEXT_KEY] = text;
|
||||
}
|
||||
|
||||
NSString *hint = [FBSDKViewHierarchy getHint:obj];
|
||||
if (hint) {
|
||||
componentInfo[CODELESS_MAPPING_HINT_KEY] = hint;
|
||||
}
|
||||
|
||||
NSIndexPath *indexPath = [FBSDKViewHierarchy getIndexPath:obj];
|
||||
if (indexPath) {
|
||||
componentInfo[CODELESS_MAPPING_SECTION_KEY] = @(indexPath.section);
|
||||
componentInfo[CODELESS_MAPPING_ROW_KEY] = @(indexPath.row);
|
||||
}
|
||||
|
||||
if (parent != nil) {
|
||||
NSArray *children = [FBSDKViewHierarchy getChildren:parent];
|
||||
NSUInteger index = [children indexOfObject:obj];
|
||||
if (index != NSNotFound) {
|
||||
componentInfo[CODELESS_MAPPING_INDEX_KEY] = @(index);
|
||||
}
|
||||
} else {
|
||||
componentInfo[CODELESS_MAPPING_INDEX_KEY] = @0;
|
||||
}
|
||||
|
||||
componentInfo[CODELESS_VIEW_TREE_TAG_KEY] = @([FBSDKViewHierarchy getTag:obj]);
|
||||
|
||||
return [componentInfo copy];
|
||||
}
|
||||
|
||||
+ (NSMutableDictionary<NSString *, id> *)getDetailAttributesOf:(NSObject *)obj
|
||||
{
|
||||
if (!obj) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSObject *parent = [FBSDKViewHierarchy getParent:obj];
|
||||
|
||||
NSDictionary *simpleAttributes = [FBSDKViewHierarchy getAttributesOf:obj parent:parent];
|
||||
|
||||
NSMutableDictionary *result = [NSMutableDictionary dictionaryWithDictionary:simpleAttributes];
|
||||
|
||||
NSString *className = NSStringFromClass([obj class]);
|
||||
result[CODELESS_VIEW_TREE_CLASS_NAME_KEY] = className;
|
||||
|
||||
NSUInteger classBitmask = [FBSDKViewHierarchy getClassBitmask:obj];
|
||||
result[CODELESS_VIEW_TREE_CLASS_TYPE_BIT_MASK_KEY] = [NSString stringWithFormat:@"%lu", (unsigned long)classBitmask];
|
||||
|
||||
if ([obj isKindOfClass:[UIControl class]]) {
|
||||
// Get actions of UIControl
|
||||
UIControl *control = (UIControl *)obj;
|
||||
NSMutableSet *actions = [NSMutableSet set];
|
||||
NSSet *targets = control.allTargets;
|
||||
for (NSObject *target in targets) {
|
||||
NSArray *ary = [control actionsForTarget:target forControlEvent:0];
|
||||
if (ary.count > 0) {
|
||||
[actions addObjectsFromArray:ary];
|
||||
}
|
||||
}
|
||||
if (targets.count > 0) {
|
||||
result[CODELESS_VIEW_TREE_ACTIONS_KEY] = actions.allObjects;
|
||||
}
|
||||
}
|
||||
|
||||
result[CODELESS_VIEW_TREE_DIMENSION_KEY] = [FBSDKViewHierarchy getDimensionOf:obj];
|
||||
|
||||
NSDictionary<NSString *, id> *textStyle = [FBSDKViewHierarchy getTextStyle:obj];
|
||||
if (textStyle) {
|
||||
result[CODELESS_VIEW_TREE_TEXT_STYLE_KEY] = textStyle;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
+ (NSIndexPath *)getIndexPath:(NSObject *)obj
|
||||
{
|
||||
NSIndexPath *indexPath = nil;
|
||||
|
||||
if ([obj isKindOfClass:[UITableViewCell class]]) {
|
||||
UITableView *tableView = [FBSDKViewHierarchy getParentTableView:(UIView *)obj];
|
||||
indexPath = [tableView indexPathForCell:(UITableViewCell *)obj];
|
||||
} else if ([obj isKindOfClass:[UICollectionViewCell class]]) {
|
||||
UICollectionView *collectionView = [FBSDKViewHierarchy getParentCollectionView:(UIView *)obj];
|
||||
indexPath = [collectionView indexPathForCell:(UICollectionViewCell *)obj];
|
||||
}
|
||||
|
||||
return indexPath;
|
||||
}
|
||||
|
||||
+ (NSString *)getText:(NSObject *)obj
|
||||
{
|
||||
NSString *text = nil;
|
||||
|
||||
if ([obj isKindOfClass:[UIButton class]]) {
|
||||
text = [(UIButton *)obj currentTitle];
|
||||
text = ((UIButton *)obj).currentTitle;
|
||||
} else if ([obj isKindOfClass:[UITextView class]] ||
|
||||
[obj isKindOfClass:[UITextField class]] ||
|
||||
[obj isKindOfClass:[UILabel class]]) {
|
||||
text = [(UILabel *)obj text];
|
||||
text = ((UILabel *)obj).text;
|
||||
} else if ([obj isKindOfClass:[UIPickerView class]]) {
|
||||
UIPickerView *picker = (UIPickerView *)obj;
|
||||
NSInteger sections = [picker numberOfComponents];
|
||||
NSInteger sections = picker.numberOfComponents;
|
||||
NSMutableArray *titles = [NSMutableArray array];
|
||||
|
||||
for (NSInteger i = 0; i < sections; i++) {
|
||||
@ -276,9 +344,9 @@
|
||||
title = [picker.delegate pickerView:picker titleForRow:row forComponent:i];
|
||||
} else if ([picker.delegate
|
||||
respondsToSelector:@selector(pickerView:attributedTitleForRow:forComponent:)]) {
|
||||
title = [[picker.delegate
|
||||
pickerView:picker
|
||||
attributedTitleForRow:row forComponent:i] string];
|
||||
title = [picker.delegate
|
||||
pickerView:picker
|
||||
attributedTitleForRow:row forComponent:i].string;
|
||||
}
|
||||
[titles addObject:title ?: @""];
|
||||
}
|
||||
@ -291,23 +359,23 @@
|
||||
} else if ([obj isKindOfClass:[UIDatePicker class]]) {
|
||||
UIDatePicker *picker = (UIDatePicker *)obj;
|
||||
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
|
||||
[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ssZ"];
|
||||
formatter.dateFormat = @"yyyy-MM-dd HH:mm:ssZ";
|
||||
text = [formatter stringFromDate:picker.date];
|
||||
} else if ([obj isKindOfClass:NSClassFromString(@"RCTTextView")]) {
|
||||
} else if ([obj isKindOfClass:objc_lookUpClass("RCTTextView")]) {
|
||||
NSTextStorage *textStorage = [FBSDKAppEventsUtility getVariable:@"_textStorage"
|
||||
fromInstance:obj];
|
||||
if (textStorage) {
|
||||
text = [textStorage string];
|
||||
text = textStorage.string;
|
||||
}
|
||||
} else if ([obj isKindOfClass:NSClassFromString(@"RCTBaseTextInputView")]) {
|
||||
} else if ([obj isKindOfClass:objc_lookUpClass("RCTBaseTextInputView")]) {
|
||||
NSAttributedString *attributedText = [FBSDKAppEventsUtility getVariable:@"attributedText"
|
||||
fromInstance:obj];
|
||||
text = [attributedText string];
|
||||
text = attributedText.string;
|
||||
}
|
||||
|
||||
if ([obj conformsToProtocol:@protocol(UITextInput)]) {
|
||||
id<UITextInput> input = (id<UITextInput>)obj;
|
||||
if ([input isSecureTextEntry]) {
|
||||
if (input.secureTextEntry) {
|
||||
text = nil;
|
||||
} else {
|
||||
switch (input.keyboardType) {
|
||||
@ -320,16 +388,50 @@
|
||||
}
|
||||
}
|
||||
|
||||
if ([FBSDKAppEventsUtility isSensitiveUserData:text]) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
return text.length > 0 ? text : nil;
|
||||
}
|
||||
|
||||
+ (NSString *)getHint:(NSObject *)obj {
|
||||
+ (NSDictionary<NSString *, id> *)getTextStyle:(NSObject *)obj
|
||||
{
|
||||
UIFont *font = nil;
|
||||
if ([obj isKindOfClass:[UIButton class]]) {
|
||||
font = ((UIButton *)obj).titleLabel.font;
|
||||
} else if ([obj isKindOfClass:[UILabel class]]) {
|
||||
font = ((UILabel *)obj).font;
|
||||
} else if ([obj isKindOfClass:[UITextField class]]) {
|
||||
font = ((UITextField *)obj).font;
|
||||
} else if ([obj isKindOfClass:[UITextView class]]) {
|
||||
font = ((UITextView *)obj).font;
|
||||
}
|
||||
|
||||
if (font) {
|
||||
UIFontDescriptorSymbolicTraits traits = font.fontDescriptor.symbolicTraits;
|
||||
BOOL isBold = (traits & UIFontDescriptorTraitBold) != 0;
|
||||
BOOL isItalic = (traits & UIFontDescriptorTraitItalic) != 0;
|
||||
CGFloat fontSize = font.pointSize;
|
||||
|
||||
return @{
|
||||
CODELESS_VIEW_TREE_TEXT_IS_BOLD_KEY: @(isBold),
|
||||
CODELESS_VIEW_TREE_TEXT_IS_ITALIC_KEY: @(isItalic),
|
||||
CODELESS_VIEW_TREE_TEXT_SIZE_KEY: @(fontSize)
|
||||
};
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSString *)getHint:(NSObject *)obj
|
||||
{
|
||||
NSString *hint = nil;
|
||||
|
||||
if ([obj isKindOfClass:[UITextField class]]) {
|
||||
hint = [(UITextField *)obj placeholder];
|
||||
hint = ((UITextField *)obj).placeholder;
|
||||
} else if ([obj isKindOfClass:[UINavigationController class]]) {
|
||||
UIViewController *top = [(UINavigationController *)obj topViewController];
|
||||
UIViewController *top = ((UINavigationController *)obj).topViewController;
|
||||
if (top) {
|
||||
hint = NSStringFromClass([top class]);
|
||||
}
|
||||
@ -338,7 +440,86 @@
|
||||
return hint.length > 0 ? hint : nil;
|
||||
}
|
||||
|
||||
+ (BOOL)isView:(NSObject *)obj1 superViewOfView:(UIView *)obj2 {
|
||||
+ (NSUInteger)getClassBitmask:(NSObject *)obj
|
||||
{
|
||||
NSUInteger bitmask = 0;
|
||||
|
||||
if ([obj isKindOfClass:[UIView class]]) {
|
||||
if ([obj isKindOfClass:[UIControl class]]) {
|
||||
bitmask |= FBCodelessClassBitmaskUIControl;
|
||||
if ([obj isKindOfClass:[UIButton class]]) {
|
||||
bitmask |= FBCodelessClassBitmaskUIButton;
|
||||
} else if ([obj isKindOfClass:[UISwitch class]]) {
|
||||
bitmask |= FBCodelessClassBitmaskSwitch;
|
||||
}else if ([obj isKindOfClass:[UIDatePicker class]]) {
|
||||
bitmask |= FBCodelessClassBitmaskPicker;
|
||||
}
|
||||
} else if ([obj isKindOfClass:[UITableViewCell class]]) {
|
||||
bitmask |= FBCodelessClassBitmaskUITableViewCell;
|
||||
} else if ([obj isKindOfClass:[UICollectionViewCell class]]) {
|
||||
bitmask |= FBCodelessClassBitmaskUICollectionViewCell;
|
||||
} else if ([obj isKindOfClass:[UIPickerView class]]) {
|
||||
bitmask |= FBCodelessClassBitmaskPicker;
|
||||
} else if ([obj isKindOfClass:[UILabel class]]) {
|
||||
bitmask |= FBCodelessClassBitmaskLabel;
|
||||
}
|
||||
|
||||
if ([FBSDKViewHierarchy isRCTButton:((UIView *)obj)]) {
|
||||
bitmask |= FBCodelessClassBitmaskReactNativeButton;
|
||||
}
|
||||
|
||||
// Check selector of UITextInput protocol instead of checking conformsToProtocol
|
||||
if ([obj respondsToSelector:@selector(textInRange:)]) {
|
||||
bitmask |= FBCodelessClassBitmaskInput;
|
||||
}
|
||||
} else if ([obj isKindOfClass:[UIViewController class]]) {
|
||||
bitmask |= FBCodelessClassBitmaskUIViewController;
|
||||
}
|
||||
|
||||
return bitmask;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wundeclared-selector"
|
||||
+ (BOOL)isRCTButton:(UIView *)view
|
||||
{
|
||||
if (view == nil) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
Class classRCTView = objc_lookUpClass(ReactNativeClassRCTView);
|
||||
if (classRCTView && [view isKindOfClass:classRCTView] &&
|
||||
[view respondsToSelector:@selector(reactTagAtPoint:)] &&
|
||||
[view respondsToSelector:@selector(reactTag)] &&
|
||||
view.userInteractionEnabled) {
|
||||
NSNumber *reactTag = [view performSelector:@selector(reactTagAtPoint:)
|
||||
withObject:[NSValue valueWithCGPoint:view.frame.origin]];
|
||||
// We get the reactTag at upper left of the view and thus check with its first subview
|
||||
UIView *subView = view.subviews.firstObject;
|
||||
NSNumber *subViewReactTag = [FBSDKViewHierarchy getViewReactTag:subView];
|
||||
if (reactTag != nil && subViewReactTag != nil && ![subView isKindOfClass:classRCTView] && [reactTag isEqualToNumber:subViewReactTag]) {
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
+ (NSNumber *)getViewReactTag:(UIView *)view
|
||||
{
|
||||
if (view != nil && [view respondsToSelector:@selector(reactTag)]) {
|
||||
NSNumber *reactTag = [view performSelector:@selector(reactTag)];
|
||||
if (reactTag != nil && [reactTag isKindOfClass:[NSNumber class]]) {
|
||||
return reactTag;
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
+ (BOOL)isView:(NSObject *)obj1 superViewOfView:(UIView *)obj2
|
||||
{
|
||||
if (![obj1 isKindOfClass:[UIView class]]
|
||||
|| ![obj2 isKindOfClass:[UIView class]]) {
|
||||
return NO;
|
||||
@ -347,7 +528,7 @@
|
||||
UIView *view2 = (UIView *)obj2;
|
||||
UIView *superview = view2;
|
||||
while (superview) {
|
||||
superview = [superview superview];
|
||||
superview = superview.superview;
|
||||
if (superview == view1) {
|
||||
return YES;
|
||||
}
|
||||
@ -356,11 +537,12 @@
|
||||
return NO;
|
||||
}
|
||||
|
||||
+ (UIViewController *)getParentViewController:(UIView *)view {
|
||||
+ (UIViewController *)getParentViewController:(UIView *)view
|
||||
{
|
||||
UIResponder *parentResponder = view;
|
||||
|
||||
while (parentResponder) {
|
||||
parentResponder = [parentResponder nextResponder];
|
||||
parentResponder = parentResponder.nextResponder;
|
||||
if ([parentResponder isKindOfClass:[UIViewController class]]) {
|
||||
return (UIViewController *)parentResponder;
|
||||
}
|
||||
@ -369,26 +551,66 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (UITableView *)getParentTableView:(UIView *)cell {
|
||||
+ (UITableView *)getParentTableView:(UIView *)cell
|
||||
{
|
||||
UIView *superview = cell.superview;
|
||||
while (superview) {
|
||||
if ([superview isKindOfClass:[UITableView class]]) {
|
||||
return (UITableView *)superview;
|
||||
}
|
||||
superview = [superview superview];
|
||||
superview = superview.superview;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (UICollectionView *)getParentCollectionView:(UIView *)cell {
|
||||
+ (UICollectionView *)getParentCollectionView:(UIView *)cell
|
||||
{
|
||||
UIView *superview = cell.superview;
|
||||
while (superview) {
|
||||
if ([superview isKindOfClass:[UICollectionView class]]) {
|
||||
return (UICollectionView *)superview;
|
||||
}
|
||||
superview = [superview superview];
|
||||
superview = superview.superview;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSInteger)getTag:(NSObject *)obj
|
||||
{
|
||||
if ([obj isKindOfClass:[UIView class]]) {
|
||||
return ((UIView *)obj).tag;
|
||||
} else if ([obj isKindOfClass:[UIViewController class]]) {
|
||||
return ((UIViewController *)obj).view.tag;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ (NSDictionary<NSString *, NSNumber *> *)getDimensionOf:(NSObject *)obj
|
||||
{
|
||||
UIView *view = nil;
|
||||
|
||||
if ([obj isKindOfClass:[UIView class]]) {
|
||||
view = (UIView *)obj;
|
||||
} else if ([obj isKindOfClass:[UIViewController class]]) {
|
||||
view = ((UIViewController *)obj).view;
|
||||
}
|
||||
|
||||
CGRect frame = view.frame;
|
||||
CGPoint offset = CGPointZero;
|
||||
|
||||
if ([view isKindOfClass:[UIScrollView class]])
|
||||
offset = ((UIScrollView *)view).contentOffset;
|
||||
|
||||
return @{
|
||||
CODELESS_VIEW_TREE_TOP_KEY: @((int)frame.origin.y),
|
||||
CODELESS_VIEW_TREE_LEFT_KEY: @((int)frame.origin.x),
|
||||
CODELESS_VIEW_TREE_WIDTH_KEY: @((int)frame.size.width),
|
||||
CODELESS_VIEW_TREE_HEIGHT_KEY: @((int)frame.size.height),
|
||||
CODELESS_VIEW_TREE_OFFSET_X_KEY: @((int)offset.x),
|
||||
CODELESS_VIEW_TREE_OFFSET_Y_KEY: @((int)offset.y),
|
||||
CODELESS_VIEW_TREE_VISIBILITY_KEY: view.isHidden ? @4 : @0
|
||||
};
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import <FBSDKCoreKit/FBSDKAppEvents.h>
|
||||
#import <FBSDKCoreKit/FBSDKMacros.h>
|
||||
|
||||
#import "FBSDKAppEventsUtility.h"
|
||||
|
||||
@ -25,178 +24,178 @@
|
||||
|
||||
// Internally known event names
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNamePurchased;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNamePurchased;
|
||||
|
||||
/** Use to log that the share dialog was launched */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameShareSheetLaunch;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameShareSheetLaunch;
|
||||
|
||||
/** Use to log that the share dialog was dismissed */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameShareSheetDismiss;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameShareSheetDismiss;
|
||||
|
||||
/** Use to log that the permissions UI was launched */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNamePermissionsUILaunch;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNamePermissionsUILaunch;
|
||||
|
||||
/** Use to log that the permissions UI was dismissed */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNamePermissionsUIDismiss;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNamePermissionsUIDismiss;
|
||||
|
||||
/** Use to log that the login view was used */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameLoginViewUsage;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameLoginViewUsage;
|
||||
|
||||
/*! Use to log that the share tray launched. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameShareTrayDidLaunch;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameShareTrayDidLaunch;
|
||||
|
||||
/*! Use to log that the person selected a sharing target. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameShareTrayDidSelectActivity;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameShareTrayDidSelectActivity;
|
||||
|
||||
// Internally known event parameters
|
||||
|
||||
/** String parameter specifying the outcome of a dialog invocation */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogOutcome;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterDialogOutcome;
|
||||
|
||||
/** Parameter key used to specify which application launches this application. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterLaunchSource;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterLaunchSource;
|
||||
|
||||
/** Use to log the result of a call to FBDialogs presentShareDialogWithParams: */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBDialogsPresentShareDialog;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBDialogsPresentShareDialog;
|
||||
|
||||
/** Use to log the result of a call to FBDialogs presentShareDialogWithOpenGraphActionParams: */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBDialogsPresentShareDialogOG;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBDialogsPresentShareDialogOG;
|
||||
|
||||
/** Use to log the result of a call to FBDialogs presentLikeDialogWithLikeParams: */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBDialogsPresentLikeDialogOG;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBDialogsPresentLikeDialogOG;
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBDialogsPresentShareDialogPhoto;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBDialogsPresentMessageDialog;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBDialogsPresentMessageDialogPhoto;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBDialogsPresentMessageDialogOG;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBDialogsPresentShareDialogPhoto;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBDialogsPresentMessageDialog;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBDialogsPresentMessageDialogPhoto;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBDialogsPresentMessageDialogOG;
|
||||
|
||||
/** Use to log the start of an auth request that cannot be fulfilled by the token cache */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSessionAuthStart;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSessionAuthStart;
|
||||
|
||||
/** Use to log the end of an auth request that was not fulfilled by the token cache */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSessionAuthEnd;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSessionAuthEnd;
|
||||
|
||||
/** Use to log the start of a specific auth method as part of an auth request */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSessionAuthMethodStart;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSessionAuthMethodStart;
|
||||
|
||||
/** Use to log the end of the last tried auth method as part of an auth request */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSessionAuthMethodEnd;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSessionAuthMethodEnd;
|
||||
|
||||
/** Use to log the timestamp for the transition to the Facebook native login dialog */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBDialogsNativeLoginDialogStart;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBDialogsNativeLoginDialogStart;
|
||||
|
||||
/** Use to log the timestamp for the transition back to the app after the Facebook native login dialog */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBDialogsNativeLoginDialogEnd;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBDialogsNativeLoginDialogEnd;
|
||||
|
||||
/** Use to log the e2e timestamp metrics for web login */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBDialogsWebLoginCompleted;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBDialogsWebLoginCompleted;
|
||||
|
||||
/** Use to log the result of the App Switch OS AlertView. Only available on OS >= iOS10 */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSessionFASLoginDialogResult;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSessionFASLoginDialogResult;
|
||||
|
||||
/** Use to log the live streaming events from sdk */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLiveStreamingStart;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLiveStreamingStop;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLiveStreamingPause;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLiveStreamingResume;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLiveStreamingError;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLiveStreamingUpdateStatus;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLiveStreamingVideoID;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLiveStreamingMic;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLiveStreamingCamera;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLiveStreamingStart;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLiveStreamingStop;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLiveStreamingPause;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLiveStreamingResume;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLiveStreamingError;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLiveStreamingUpdateStatus;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLiveStreamingVideoID;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLiveStreamingMic;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLiveStreamingCamera;
|
||||
|
||||
/** Use to log the results of a share dialog */
|
||||
FBSDK_EXTERN NSString *const FBSDLAppEventNameFBSDKEventShareDialogResult;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKEventMessengerShareDialogResult;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKEventAppInviteShareDialogResult;
|
||||
FOUNDATION_EXPORT NSString *const FBSDLAppEventNameFBSDKEventShareDialogResult;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKEventMessengerShareDialogResult;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKEventAppInviteShareDialogResult;
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKEventShareDialogShow;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKEventMessengerShareDialogShow;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKEventAppInviteShareDialogShow;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKEventShareDialogShow;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKEventMessengerShareDialogShow;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKEventAppInviteShareDialogShow;
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogMode;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogShareContentType;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogShareContentUUID;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogShareContentPageID;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterDialogMode;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterDialogShareContentType;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterDialogShareContentUUID;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterDialogShareContentPageID;
|
||||
|
||||
/*! Use to log parameters for share tray use */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterShareTrayActivityName;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterShareTrayResult;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterShareTrayActivityName;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterShareTrayResult;
|
||||
|
||||
/*! Use to log parameters for live streaming*/
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterLiveStreamingPrevStatus;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterLiveStreamingStatus;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterLiveStreamingError;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterLiveStreamingVideoID;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterLiveStreamingMicEnabled;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterLiveStreamingCameraEnabled;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterLiveStreamingPrevStatus;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterLiveStreamingStatus;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterLiveStreamingError;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterLiveStreamingVideoID;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterLiveStreamingMicEnabled;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterLiveStreamingCameraEnabled;
|
||||
|
||||
// Internally known event parameter values
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogOutcomeValue_Completed;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogOutcomeValue_Cancelled;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogOutcomeValue_Failed;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogOutcomeValue_Completed;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogOutcomeValue_Cancelled;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogOutcomeValue_Failed;
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeOpenGraph;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeStatus;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypePhoto;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeVideo;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeCamera;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeMessengerGenericTemplate;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeMessengerMediaTemplate;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeMessengerOpenGraphMusicTemplate;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeUnknown;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogShareContentTypeOpenGraph;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogShareContentTypeStatus;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogShareContentTypePhoto;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogShareContentTypeVideo;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogShareContentTypeCamera;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogShareContentTypeMessengerGenericTemplate;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogShareContentTypeMessengerMediaTemplate;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogShareContentTypeMessengerOpenGraphMusicTemplate;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogShareContentTypeUnknown;
|
||||
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareModeAutomatic;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareModeBrowser;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareModeNative;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareModeShareSheet;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareModeWeb;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareModeFeedBrowser;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareModeFeedWeb;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareModeUnknown;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogShareModeAutomatic;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogShareModeBrowser;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogShareModeNative;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogShareModeShareSheet;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogShareModeWeb;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogShareModeFeedBrowser;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogShareModeFeedWeb;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsDialogShareModeUnknown;
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsNativeLoginDialogStartTime;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsNativeLoginDialogEndTime;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsNativeLoginDialogStartTime;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsNativeLoginDialogEndTime;
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsWebLoginE2E;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsWebLoginE2E;
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLikeButtonImpression;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLoginButtonImpression;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKSendButtonImpression;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKShareButtonImpression;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLiveStreamingButtonImpression;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLikeButtonImpression;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLoginButtonImpression;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKSendButtonImpression;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKShareButtonImpression;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLiveStreamingButtonImpression;
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKSmartLoginService;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKSmartLoginService;
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLikeButtonDidTap;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLoginButtonDidTap;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKSendButtonDidTap;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKShareButtonDidTap;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLiveStreamingButtonDidTap;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLikeButtonDidTap;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLoginButtonDidTap;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKSendButtonDidTap;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKShareButtonDidTap;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLiveStreamingButtonDidTap;
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLikeControlDidDisable;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLikeControlDidLike;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLikeControlDidPresentDialog;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLikeControlDidTap;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLikeControlDidUnlike;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLikeControlError;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLikeControlImpression;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKLikeControlNetworkUnavailable;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLikeControlDidDisable;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLikeControlDidLike;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLikeControlDidPresentDialog;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLikeControlDidTap;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLikeControlDidUnlike;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLikeControlError;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLikeControlImpression;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventNameFBSDKLikeControlNetworkUnavailable;
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogErrorMessage;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterLogTime;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterDialogErrorMessage;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventParameterLogTime;
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsWKWebViewMessagesHandlerKey;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsWKWebViewMessagesActionKey;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsWKWebViewMessagesEventKey;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsWKWebViewMessagesParamsKey;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsWKWebViewMessagesPixelTrackKey;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsWKWebViewMessagesPixelTrackCustomKey;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsWKWebViewMessagesPixelTrackSingleKey;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsWKWebViewMessagesPixelTrackSingleCustomKey;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsWKWebViewMessagesPixelIDKey;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsWKWebViewMessagesHandlerKey;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsWKWebViewMessagesActionKey;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsWKWebViewMessagesEventKey;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsWKWebViewMessagesParamsKey;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsWKWebViewMessagesPixelTrackKey;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsWKWebViewMessagesPixelTrackCustomKey;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsWKWebViewMessagesPixelTrackSingleKey;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsWKWebViewMessagesPixelTrackSingleCustomKey;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKAppEventsWKWebViewMessagesPixelIDKey;
|
||||
|
||||
@interface FBSDKAppEvents (Internal)
|
||||
|
||||
|
||||
@ -147,7 +147,7 @@ static const u_int FB_GIGABYTE = 1024 * 1024 * 1024; // bytes
|
||||
_shortVersion = [mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
|
||||
|
||||
// Locale stuff
|
||||
_language = [[NSLocale currentLocale] localeIdentifier];
|
||||
_language = [NSLocale currentLocale].localeIdentifier;
|
||||
|
||||
// Device stuff
|
||||
UIDevice *device = [UIDevice currentDevice];
|
||||
@ -165,7 +165,7 @@ static const u_int FB_GIGABYTE = 1024 * 1024 * 1024; // bytes
|
||||
_machine = @(systemInfo.machine);
|
||||
|
||||
// Disk space stuff
|
||||
float totalDiskSpace = [[FBSDKAppEventsDeviceInfo _getTotalDiskSpace] floatValue];
|
||||
float totalDiskSpace = [FBSDKAppEventsDeviceInfo _getTotalDiskSpace].floatValue;
|
||||
_totalDiskSpaceGB = (unsigned long long)round(totalDiskSpace / FB_GIGABYTE);
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ static const u_int FB_GIGABYTE = 1024 * 1024 * 1024; // bytes
|
||||
}
|
||||
|
||||
// Remaining disk space
|
||||
float remainingDiskSpace = [[FBSDKAppEventsDeviceInfo _getRemainingDiskSpace] floatValue];
|
||||
float remainingDiskSpace = [FBSDKAppEventsDeviceInfo _getRemainingDiskSpace].floatValue;
|
||||
unsigned long long newRemainingDiskSpaceGB = (unsigned long long)round(remainingDiskSpace / FB_GIGABYTE);
|
||||
if (_remainingDiskSpaceGB != newRemainingDiskSpaceGB) {
|
||||
_remainingDiskSpaceGB = newRemainingDiskSpaceGB;
|
||||
@ -237,14 +237,14 @@ static const u_int FB_GIGABYTE = 1024 * 1024 * 1024; // bytes
|
||||
{
|
||||
NSDictionary *attrs = [[[NSFileManager alloc] init] attributesOfFileSystemForPath:NSHomeDirectory()
|
||||
error:nil];
|
||||
return [attrs objectForKey:NSFileSystemSize];
|
||||
return attrs[NSFileSystemSize];
|
||||
}
|
||||
|
||||
+ (NSNumber *)_getRemainingDiskSpace
|
||||
{
|
||||
NSDictionary *attrs = [[[NSFileManager alloc] init] attributesOfFileSystemForPath:NSHomeDirectory()
|
||||
error:nil];
|
||||
return [attrs objectForKey:NSFileSystemFreeSize];
|
||||
return attrs[NSFileSystemFreeSize];
|
||||
}
|
||||
|
||||
+ (uint)_coreCount
|
||||
@ -270,8 +270,8 @@ static const u_int FB_GIGABYTE = 1024 * 1024 * 1024; // bytes
|
||||
#else
|
||||
// Dynamically load class for this so calling app doesn't need to link framework in.
|
||||
CTTelephonyNetworkInfo *networkInfo = [[fbsdkdfl_CTTelephonyNetworkInfoClass() alloc] init];
|
||||
CTCarrier *carrier = [networkInfo subscriberCellularProvider];
|
||||
return [carrier carrierName] ?: @"NoCarrier";
|
||||
CTCarrier *carrier = networkInfo.subscriberCellularProvider;
|
||||
return carrier.carrierName ?: @"NoCarrier";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -21,16 +21,18 @@
|
||||
// this type is not thread safe.
|
||||
@interface FBSDKAppEventsState : NSObject<NSCopying, NSSecureCoding>
|
||||
|
||||
@property (readonly, copy) NSArray *events;
|
||||
@property (readonly, assign) NSUInteger numSkipped;
|
||||
@property (readonly, copy) NSString *tokenString;
|
||||
@property (readonly, copy) NSString *appID;
|
||||
@property (nonatomic, readonly, copy) NSArray *events;
|
||||
@property (nonatomic, readonly, assign) NSUInteger numSkipped;
|
||||
@property (nonatomic, readonly, copy) NSString *tokenString;
|
||||
@property (nonatomic, readonly, copy) NSString *appID;
|
||||
@property (nonatomic, readonly) BOOL areAllEventsImplicit;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
- (instancetype)initWithToken:(NSString *)tokenString appID:(NSString *)appID NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (void)addEvent:(NSDictionary *)eventDictionary isImplicit:(BOOL)isImplicit;
|
||||
- (void)addEventsFromAppEventState:(FBSDKAppEventsState *)appEventsState;
|
||||
- (BOOL)areAllEventsImplicit;
|
||||
- (BOOL)isCompatibleWithAppEventsState:(FBSDKAppEventsState *)appEventsState;
|
||||
- (BOOL)isCompatibleWithTokenString:(NSString *)tokenString appID:(NSString *)appID;
|
||||
- (NSString *)JSONStringForEvents:(BOOL)includeImplicitEvents;
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
#import "FBSDKAppEventsState.h"
|
||||
|
||||
#import "FBSDKInternalUtility.h"
|
||||
#import "FBSDKMacros.h"
|
||||
|
||||
#define FBSDK_APPEVENTSTATE_ISIMPLICIT_KEY @"isImplicit"
|
||||
|
||||
@ -37,12 +36,6 @@
|
||||
NSMutableArray *_mutableEvents;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
FBSDK_NOT_DESIGNATED_INITIALIZER(initWithToken:appID:);
|
||||
return [self initWithToken:nil appID:nil];
|
||||
}
|
||||
|
||||
- (instancetype)initWithToken:(NSString *)tokenString appID:(NSString *)appID
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
|
||||
@ -1,118 +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 "FBSDKAppEventsUninstall.h"
|
||||
|
||||
#import <objc/runtime.h>
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <UserNotifications/UserNotifications.h>
|
||||
|
||||
#import "FBSDKAppEventsUtility.h"
|
||||
#import "FBSDKGraphRequest.h"
|
||||
#import "FBSDKLogger.h"
|
||||
#import "FBSDKServerConfigurationManager.h"
|
||||
#import "FBSDKSettings.h"
|
||||
#import "FBSDKSwizzler.h"
|
||||
|
||||
#define UNINSTALL_TRACKING_DEVICE_ID_KEY @"device_id"
|
||||
#define UNINSTALL_TRACKING_PLATFORM_KEY @"platform"
|
||||
#define UNINSTALL_TRACKING_DEVICE_TOKEN_KEY @"device_token"
|
||||
#define UNINSTALL_TRACKING_TOKEN_ENDPOINT @"app_push_device_token"
|
||||
|
||||
@implementation FBSDKAppEventsUninstall
|
||||
|
||||
+ (void)load
|
||||
{
|
||||
[FBSDKAppEventsUninstall installSwizzler];
|
||||
}
|
||||
|
||||
+ (NSString *)stringWithDeviceToken:(NSData *)deviceToken {
|
||||
const char *data = [deviceToken bytes];
|
||||
NSMutableString *token = [NSMutableString string];
|
||||
|
||||
for (NSUInteger i = 0; i < [deviceToken length]; i++) {
|
||||
[token appendFormat:@"%02.2hhX", data[i]];
|
||||
}
|
||||
|
||||
return [token copy];
|
||||
}
|
||||
|
||||
+ (void)installSwizzler
|
||||
{
|
||||
Class cls = [[UIApplication sharedApplication].delegate class];
|
||||
SEL selector = @selector(application:didRegisterForRemoteNotificationsWithDeviceToken:);
|
||||
BOOL hasMethod = class_getInstanceMethod(cls, selector) != nil;
|
||||
void (^block)(id) = ^(NSData *deviceToken) {
|
||||
NSString *tokenString = [self stringWithDeviceToken:deviceToken];
|
||||
[FBSDKLogger singleShotLogEntry:FBSDKLoggingBehaviorInformational
|
||||
logEntry:[NSString stringWithFormat:@"Register token from Swizzling: %@", tokenString]];
|
||||
// try upload token immediately after receiving it from swizzling
|
||||
[self updateAndUploadToken:tokenString];
|
||||
};
|
||||
|
||||
if (!hasMethod)
|
||||
{
|
||||
void (^registerBlock)(id, id, id) = ^(id _, id __, NSData *deviceToken)
|
||||
{
|
||||
block(deviceToken);
|
||||
};
|
||||
IMP imp = imp_implementationWithBlock(registerBlock);
|
||||
struct objc_method_description desc = protocol_getMethodDescription(@protocol(UIApplicationDelegate),
|
||||
selector, NO, YES);
|
||||
const char *types = desc.types;
|
||||
class_addMethod(cls, selector, imp, types);
|
||||
} else
|
||||
{
|
||||
void (^registerBlock)(id, SEL, id, id) = ^(id _, SEL __, id ___, NSData *deviceToken)
|
||||
{
|
||||
block(deviceToken);
|
||||
};
|
||||
[FBSDKSwizzler swizzleSelector:selector
|
||||
onClass:cls
|
||||
withBlock:registerBlock
|
||||
named:@"map_control"];
|
||||
}
|
||||
}
|
||||
|
||||
// Token is updated when (changed OR not uploaded)
|
||||
// Token is uploaded when enabled AND (changed OR not uploaded)
|
||||
+ (void)updateAndUploadToken:(NSString *)tokenString
|
||||
{
|
||||
if (!tokenString) {
|
||||
return;
|
||||
}
|
||||
|
||||
[FBSDKServerConfigurationManager loadServerConfigurationWithCompletionBlock:^(FBSDKServerConfiguration *serverConfiguration, NSError *error) {
|
||||
if (serverConfiguration.uninstallTrackingEnabled) {
|
||||
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
|
||||
initWithGraphPath:[NSString stringWithFormat:@"%@/%@",
|
||||
[FBSDKSettings appID], UNINSTALL_TRACKING_TOKEN_ENDPOINT]
|
||||
parameters:@{
|
||||
UNINSTALL_TRACKING_DEVICE_TOKEN_KEY: tokenString,
|
||||
UNINSTALL_TRACKING_PLATFORM_KEY: @"ios",
|
||||
// advertiserID could be 0s if user select limit ad tracking
|
||||
UNINSTALL_TRACKING_DEVICE_ID_KEY: [FBSDKAppEventsUtility advertiserID]?:@""
|
||||
}
|
||||
HTTPMethod:@"POST"];
|
||||
[request startWithCompletionHandler:nil];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
@ -39,6 +39,9 @@ typedef NS_ENUM(NSUInteger, FBSDKAppEventsFlushReason)
|
||||
|
||||
@interface FBSDKAppEventsUtility : NSObject
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
|
||||
+ (NSMutableDictionary *)activityParametersDictionaryForEvent:(NSString *)eventCategory
|
||||
implicitEventsOnly:(BOOL)implicitEventsOnly
|
||||
shouldAccessAdvertisingID:(BOOL)shouldAccessAdvertisingID;
|
||||
@ -55,5 +58,7 @@ typedef NS_ENUM(NSUInteger, FBSDKAppEventsFlushReason)
|
||||
+ (BOOL)validateIdentifier:(NSString *)identifier;
|
||||
+ (id)getVariable:(NSString *)variableName fromInstance:(NSObject *)instance;
|
||||
+ (NSNumber *)getNumberValue:(NSString *)text;
|
||||
+ (BOOL)isDebugBuild;
|
||||
+ (BOOL)isSensitiveUserData:(NSString *)text;
|
||||
|
||||
@end
|
||||
|
||||
@ -30,7 +30,6 @@
|
||||
#import "FBSDKError.h"
|
||||
#import "FBSDKInternalUtility.h"
|
||||
#import "FBSDKLogger.h"
|
||||
#import "FBSDKMacros.h"
|
||||
#import "FBSDKSettings.h"
|
||||
#import "FBSDKTimeSpentData.h"
|
||||
|
||||
@ -46,8 +45,10 @@
|
||||
NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
|
||||
parameters[@"event"] = eventCategory;
|
||||
|
||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
|
||||
NSString *attributionID = [[self class] attributionID]; // Only present on iOS 6 and below.
|
||||
[FBSDKInternalUtility dictionary:parameters setObject:attributionID forKey:@"attribution"];
|
||||
#endif
|
||||
|
||||
if (!implicitEventsOnly && shouldAccessAdvertisingID) {
|
||||
NSString *advertiserID = [[self class] advertiserID];
|
||||
@ -59,10 +60,10 @@
|
||||
FBSDKAdvertisingTrackingStatus advertisingTrackingStatus = [[self class] advertisingTrackingStatus];
|
||||
if (advertisingTrackingStatus != FBSDKAdvertisingTrackingUnspecified) {
|
||||
BOOL allowed = (advertisingTrackingStatus == FBSDKAdvertisingTrackingAllowed);
|
||||
parameters[@"advertiser_tracking_enabled"] = [@(allowed) stringValue];
|
||||
parameters[@"advertiser_tracking_enabled"] = @(allowed).stringValue;
|
||||
}
|
||||
|
||||
parameters[@"application_tracking_enabled"] = [@(!FBSDKSettings.limitEventAndDataUsage) stringValue];
|
||||
parameters[@"application_tracking_enabled"] = @(!FBSDKSettings.limitEventAndDataUsage).stringValue;
|
||||
|
||||
NSString *userID = [FBSDKAppEvents userID];
|
||||
if (userID) {
|
||||
@ -81,8 +82,8 @@
|
||||
dispatch_once(&fetchBundleOnce, ^{
|
||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||
urlSchemes = [[NSMutableArray alloc] init];
|
||||
for (NSDictionary *fields in [mainBundle objectForInfoDictionaryKey:@"CFBundleURLTypes"]) {
|
||||
NSArray *schemesForType = [fields objectForKey:@"CFBundleURLSchemes"];
|
||||
for (NSDictionary<NSString *, id> *fields in [mainBundle objectForInfoDictionaryKey:@"CFBundleURLTypes"]) {
|
||||
NSArray<NSString *> *schemesForType = fields[@"CFBundleURLSchemes"];
|
||||
if (schemesForType) {
|
||||
[urlSchemes addObjectsFromArray:schemesForType];
|
||||
}
|
||||
@ -90,8 +91,7 @@
|
||||
});
|
||||
|
||||
if (urlSchemes.count > 0) {
|
||||
[parameters setObject:[FBSDKInternalUtility JSONStringForObject:urlSchemes error:NULL invalidObjectHandler:NULL]
|
||||
forKey:@"url_schemes"];
|
||||
parameters[@"url_schemes"] = [FBSDKInternalUtility JSONStringForObject:urlSchemes error:NULL invalidObjectHandler:NULL];
|
||||
}
|
||||
|
||||
return parameters;
|
||||
@ -99,12 +99,16 @@
|
||||
|
||||
+ (NSString *)advertiserID
|
||||
{
|
||||
if (![[FBSDKSettings advertiserIDCollectionEnabled] boolValue]) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSString *result = nil;
|
||||
|
||||
Class ASIdentifierManagerClass = fbsdkdfl_ASIdentifierManagerClass();
|
||||
if ([ASIdentifierManagerClass class]) {
|
||||
ASIdentifierManager *manager = [ASIdentifierManagerClass sharedManager];
|
||||
result = [[manager advertisingIdentifier] UUIDString];
|
||||
result = manager.advertisingIdentifier.UUIDString;
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -121,7 +125,7 @@
|
||||
if ([ASIdentifierManagerClass class]) {
|
||||
ASIdentifierManager *manager = [ASIdentifierManagerClass sharedManager];
|
||||
if (manager) {
|
||||
status = [manager isAdvertisingTrackingEnabled] ? FBSDKAdvertisingTrackingAllowed : FBSDKAdvertisingTrackingDisallowed;
|
||||
status = manager.advertisingTrackingEnabled ? FBSDKAdvertisingTrackingAllowed : FBSDKAdvertisingTrackingDisallowed;
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -138,7 +142,7 @@
|
||||
// Generate a new anonymous ID. Create as a UUID, but then prepend the fairly
|
||||
// arbitrary 'XZ' to the front so it's easily distinguishable from IDFA's which
|
||||
// will only contain hex.
|
||||
result = [NSString stringWithFormat:@"XZ%@", [[NSUUID UUID] UUIDString]];
|
||||
result = [NSString stringWithFormat:@"XZ%@", [NSUUID UUID].UUIDString];
|
||||
|
||||
[self persistAnonymousID:result];
|
||||
}
|
||||
@ -150,7 +154,7 @@
|
||||
#if TARGET_OS_TV
|
||||
return nil;
|
||||
#else
|
||||
return [[UIPasteboard pasteboardWithName:@"fb_app_attribution" create:NO] string];
|
||||
return [UIPasteboard pasteboardWithName:@"fb_app_attribution" create:NO].string;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -214,7 +218,7 @@
|
||||
}
|
||||
|
||||
[FBSDKLogger singleShotLogEntry:behaviorToLog logEntry:msg];
|
||||
NSError *error = [FBSDKError errorWithCode:FBSDKAppEventsFlushErrorCode message:msg];
|
||||
NSError *error = [NSError fbErrorWithCode:FBSDKErrorAppEventsFlush message:msg];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:FBSDKAppEventsLoggingResultNotification object:error];
|
||||
}
|
||||
|
||||
@ -297,7 +301,7 @@ restOfStringCharacterSet:(NSCharacterSet *)restOfStringCharacterSet
|
||||
{
|
||||
NSSearchPathDirectory directory = NSLibraryDirectory;
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(directory, NSUserDomainMask, YES);
|
||||
NSString *docDirectory = [paths objectAtIndex:0];
|
||||
NSString *docDirectory = paths[0];
|
||||
return [docDirectory stringByAppendingPathComponent:filename];
|
||||
}
|
||||
|
||||
@ -309,7 +313,7 @@ restOfStringCharacterSet:(NSCharacterSet *)restOfStringCharacterSet
|
||||
encoding:NSASCIIStringEncoding
|
||||
error:nil];
|
||||
NSDictionary *results = [FBSDKInternalUtility objectForJSONString:content error:NULL];
|
||||
return [results objectForKey:FBSDK_APPEVENTSUTILITY_ANONYMOUSID_KEY];
|
||||
return results[FBSDK_APPEVENTSUTILITY_ANONYMOUSID_KEY];
|
||||
}
|
||||
|
||||
// Given a candidate token (which may be nil), find the real token to string to use.
|
||||
@ -337,11 +341,11 @@ restOfStringCharacterSet:(NSCharacterSet *)restOfStringCharacterSet
|
||||
|
||||
+ (long)unixTimeNow
|
||||
{
|
||||
return (long)round([[NSDate date] timeIntervalSince1970]);
|
||||
return (long)round([NSDate date].timeIntervalSince1970);
|
||||
}
|
||||
|
||||
+ (id)getVariable:(NSString *)variableName fromInstance:(NSObject *)instance {
|
||||
Ivar ivar = class_getInstanceVariable([instance class], [variableName UTF8String]);
|
||||
Ivar ivar = class_getInstanceVariable([instance class], variableName.UTF8String);
|
||||
if (ivar != NULL) {
|
||||
const char *encoding = ivar_getTypeEncoding(ivar);
|
||||
if (encoding != NULL && encoding[0] == '@') {
|
||||
@ -376,17 +380,95 @@ restOfStringCharacterSet:(NSCharacterSet *)restOfStringCharacterSet
|
||||
|
||||
value = [formatter numberFromString:validText];
|
||||
if (nil == value) {
|
||||
value = @([validText floatValue]);
|
||||
value = @(validText.floatValue);
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
+ (BOOL)isDebugBuild {
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
return YES;
|
||||
#else
|
||||
BOOL isDevelopment = NO;
|
||||
|
||||
// There is no provisioning profile in AppStore Apps.
|
||||
@try
|
||||
{
|
||||
NSData *data = [NSData dataWithContentsOfFile:[NSBundle.mainBundle pathForResource:@"embedded" ofType:@"mobileprovision"]];
|
||||
if (data) {
|
||||
const char *bytes = [data bytes];
|
||||
NSMutableString *profile = [[NSMutableString alloc] initWithCapacity:data.length];
|
||||
for (NSUInteger i = 0; i < data.length; i++) {
|
||||
[profile appendFormat:@"%c", bytes[i]];
|
||||
}
|
||||
// Look for debug value, if detected we're in a development build.
|
||||
NSString *cleared = [[profile componentsSeparatedByCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet] componentsJoinedByString:@""];
|
||||
isDevelopment = ([cleared rangeOfString:@"<key>get-task-allow</key><true/>"].length > 0);
|
||||
}
|
||||
|
||||
return isDevelopment;
|
||||
}
|
||||
@catch(NSException *exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return NO;
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (BOOL)isSensitiveUserData:(NSString *)text
|
||||
{
|
||||
FBSDK_NO_DESIGNATED_INITIALIZER();
|
||||
return nil;
|
||||
if (0 == text.length) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
return [self isEmailAddress:text] || [self isCreditCardNumber:text];
|
||||
}
|
||||
|
||||
+ (BOOL)isCreditCardNumber:(NSString *)text
|
||||
{
|
||||
text = [[text componentsSeparatedByCharactersInSet:[NSCharacterSet.decimalDigitCharacterSet invertedSet]] componentsJoinedByString:@""];
|
||||
|
||||
if (text.doubleValue == 0) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (text.length < 9 || text.length > 21) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
const char *chars = [text cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
if (NULL == chars) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL isOdd = YES;
|
||||
int oddSum = 0;
|
||||
int evenSum = 0;
|
||||
|
||||
for (int i = (int)text.length - 1; i >= 0; i--) {
|
||||
int digit = chars[i] - '0';
|
||||
|
||||
if (isOdd)
|
||||
oddSum += digit;
|
||||
else
|
||||
evenSum += digit / 5 + (2 * digit) % 10;
|
||||
|
||||
isOdd = !isOdd;
|
||||
}
|
||||
|
||||
return ((oddSum + evenSum) % 10 == 0);
|
||||
}
|
||||
|
||||
+ (BOOL)isEmailAddress:(NSString *)text
|
||||
{
|
||||
NSString *pattern = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
|
||||
NSRegularExpression *regex = [[NSRegularExpression alloc] initWithPattern:pattern options:NSRegularExpressionCaseInsensitive error:nil];
|
||||
NSUInteger matches = [regex numberOfMatchesInString:text options:0 range:NSMakeRange(0, [text length])];
|
||||
return matches > 0;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -32,7 +32,7 @@ NSString *const FBSDKAppEventsWKWebViewMessagesPixelReferralParamKey = @"_fb_pix
|
||||
|
||||
if ([message.name isEqualToString:FBSDKAppEventsWKWebViewMessagesHandlerKey]) {
|
||||
NSString *event = message.body[FBSDKAppEventsWKWebViewMessagesEventKey];
|
||||
if ([event length] > 0) {
|
||||
if (event.length > 0) {
|
||||
NSString *stringedParams = message.body[FBSDKAppEventsWKWebViewMessagesParamsKey];
|
||||
NSMutableDictionary <NSObject *, NSObject *> *params = nil;
|
||||
NSError *jsonParseError = nil;
|
||||
@ -52,7 +52,7 @@ NSString *const FBSDKAppEventsWKWebViewMessagesPixelReferralParamKey = @"_fb_pix
|
||||
params = [[NSMutableDictionary alloc] initWithObjectsAndKeys:pixelID, FBSDKAppEventsWKWebViewMessagesPixelReferralParamKey, nil];
|
||||
}
|
||||
else {
|
||||
[params setObject:pixelID forKey: FBSDKAppEventsWKWebViewMessagesPixelReferralParamKey];
|
||||
params[FBSDKAppEventsWKWebViewMessagesPixelReferralParamKey] = pixelID;
|
||||
}
|
||||
[FBSDKAppEvents logEvent:event parameters:params];
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ static NSMutableArray *g_pendingRequestors;
|
||||
return @"";
|
||||
}
|
||||
|
||||
return [inputString length] <= FBSDKMaxParameterValueLength ? inputString : [inputString substringToIndex:FBSDKMaxParameterValueLength];
|
||||
return inputString.length <= FBSDKMaxParameterValueLength ? inputString : [inputString substringToIndex:FBSDKMaxParameterValueLength];
|
||||
}
|
||||
|
||||
- (void)logTransactionEvent:(SKProduct *)product
|
||||
@ -194,7 +194,7 @@ static NSMutableArray *g_pendingRequestors;
|
||||
NSString *transactionID = nil;
|
||||
NSString *transactionDate = nil;
|
||||
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
|
||||
[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ssZ"];
|
||||
formatter.dateFormat = @"yyyy-MM-dd HH:mm:ssZ";
|
||||
switch (self.transaction.transactionState) {
|
||||
case SKPaymentTransactionStatePurchasing:
|
||||
eventName = FBSDKAppEventNameInitiatedCheckout;
|
||||
@ -250,16 +250,16 @@ static NSMutableArray *g_pendingRequestors;
|
||||
case SKProductPeriodUnitYear: unit = @"Y"; break;
|
||||
}
|
||||
NSString *p = [NSString stringWithFormat:@"P%lu%@", (unsigned long)period.numberOfUnits, unit];
|
||||
[eventParameters setObject:p forKey:FBSDKAppEventParameterNameSubscriptionPeriod];
|
||||
[eventParameters setObject:@"subs" forKey:FBSDKAppEventParameterNameInAppPurchaseType];
|
||||
eventParameters[FBSDKAppEventParameterNameSubscriptionPeriod] = p;
|
||||
eventParameters[FBSDKAppEventParameterNameInAppPurchaseType] = @"subs";
|
||||
} else {
|
||||
[eventParameters setObject:@"inapp" forKey:FBSDKAppEventParameterNameInAppPurchaseType];
|
||||
eventParameters[FBSDKAppEventParameterNameInAppPurchaseType] = @"inapp";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if (transactionID) {
|
||||
[eventParameters setObject:transactionID forKey:FBSDKAppEventParameterNameTransactionID];
|
||||
eventParameters[FBSDKAppEventParameterNameTransactionID] = transactionID;
|
||||
}
|
||||
}
|
||||
|
||||
@ -314,7 +314,7 @@ static NSMutableArray *g_pendingRequestors;
|
||||
}
|
||||
}
|
||||
|
||||
[eventParameters setObject:@"1" forKey:FBSDKAppEventParameterImplicitlyLoggedPurchase];
|
||||
eventParameters[FBSDKAppEventParameterImplicitlyLoggedPurchase] = @"1";
|
||||
[FBSDKAppEvents logEvent:eventName
|
||||
valueToSum:valueToSum
|
||||
parameters:eventParameters];
|
||||
@ -328,7 +328,7 @@ static NSMutableArray *g_pendingRequestors;
|
||||
|
||||
// Fetch the current receipt for this application.
|
||||
- (NSData*)fetchDeviceReceipt {
|
||||
NSURL *receiptURL = [[NSBundle bundleForClass:[self class]] appStoreReceiptURL];
|
||||
NSURL *receiptURL = [NSBundle bundleForClass:[self class]].appStoreReceiptURL;
|
||||
NSData *receipt = [NSData dataWithContentsOfURL:receiptURL];
|
||||
return receipt;
|
||||
}
|
||||
|
||||
@ -18,9 +18,7 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <FBSDKCoreKit/FBSDKMacros.h>
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKTimeSpentFilename;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKTimeSpentFilename;
|
||||
|
||||
// Class to encapsulate persisting of time spent data collected by [FBSDKAppEvents activateApp]. The activate app App Event is
|
||||
// logged when restore: is called with sufficient time since the last deactivation.
|
||||
|
||||
@ -192,7 +192,7 @@ static const long INACTIVE_SECONDS_QUANTA[] =
|
||||
if (!content) {
|
||||
|
||||
// Nothing persisted, so this is the first launch.
|
||||
_sessionID = [[NSUUID UUID] UUIDString];
|
||||
_sessionID = [NSUUID UUID].UUIDString;
|
||||
_secondsSpentInCurrentSession = 0;
|
||||
_numInterruptionsInCurrentSession = 0;
|
||||
_lastSuspendTime = 0;
|
||||
@ -205,12 +205,12 @@ static const long INACTIVE_SECONDS_QUANTA[] =
|
||||
|
||||
NSDictionary *results = [FBSDKInternalUtility objectForJSONString:content error:NULL];
|
||||
|
||||
_lastSuspendTime = [[results objectForKey:FBSDKTimeSpentPersistKeyLastSuspendTime] longValue];
|
||||
_lastSuspendTime = [results[FBSDKTimeSpentPersistKeyLastSuspendTime] longValue];
|
||||
|
||||
_timeSinceLastSuspend = now - _lastSuspendTime;
|
||||
_secondsSpentInCurrentSession = [[results objectForKey:FBSDKTimeSpentPersistKeySessionSecondsSpent] intValue];
|
||||
_sessionID = results[FBSDKTimeSpentPersistKeySessionID] ? : [[NSUUID UUID] UUIDString];
|
||||
_numInterruptionsInCurrentSession = [[results objectForKey:FBSDKTimeSpentPersistKeySessionNumInterruptions] intValue];
|
||||
_secondsSpentInCurrentSession = [results[FBSDKTimeSpentPersistKeySessionSecondsSpent] intValue];
|
||||
_sessionID = results[FBSDKTimeSpentPersistKeySessionID] ? : [NSUUID UUID].UUIDString;
|
||||
_numInterruptionsInCurrentSession = [results[FBSDKTimeSpentPersistKeySessionNumInterruptions] intValue];
|
||||
_shouldLogActivateEvent = (_timeSinceLastSuspend > [FBSDKServerConfigurationManager cachedServerConfiguration].sessionTimoutInterval);
|
||||
|
||||
// Other than the first launch, we always log the last session's deactivate with this session's activate.
|
||||
@ -237,7 +237,7 @@ static const long INACTIVE_SECONDS_QUANTA[] =
|
||||
// We've logged the session stats, now reset.
|
||||
_secondsSpentInCurrentSession = 0;
|
||||
_numInterruptionsInCurrentSession = 0;
|
||||
_sessionID = [[NSUUID UUID] UUIDString];
|
||||
_sessionID = [NSUUID UUID].UUIDString;
|
||||
}
|
||||
|
||||
if (_shouldLogActivateEvent) {
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <FBSDKCoreKit/FBSDKMacros.h>
|
||||
|
||||
@interface FBSDKUserDataStore : NSObject
|
||||
|
||||
+ (void)initStore;
|
||||
|
||||
@ -18,10 +18,9 @@
|
||||
|
||||
#import "FBSDKUserDataStore.h"
|
||||
|
||||
#import <FBSDKSettings.h>
|
||||
|
||||
#import "FBSDKAppEventsUtility.h"
|
||||
#import "FBSDKLogger.h"
|
||||
#import "FBSDKSettings.h"
|
||||
#import "FBSDKUtility.h"
|
||||
|
||||
#define USER_DATA_KEY @"com.facebook.appevents.UserDataStore.userData"
|
||||
@ -144,7 +143,7 @@ static volatile bool initialized = false;
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSMutableDictionary *encryptUserData = [NSMutableDictionary dictionaryWithCapacity:[ud count]];
|
||||
NSMutableDictionary<NSString *, id> *encryptUserData = [NSMutableDictionary dictionaryWithCapacity:ud.count];
|
||||
|
||||
for (NSString *key in ud){
|
||||
NSString *const value = ud[key];
|
||||
@ -174,7 +173,7 @@ static volatile bool initialized = false;
|
||||
|
||||
+ (NSString *)encryptData:(NSString *)data
|
||||
{
|
||||
if (data == nil || [data length] == 0){
|
||||
if (data == nil || data.length == 0){
|
||||
return nil;
|
||||
}
|
||||
return [FBSDKUtility SHA256Hash:data];
|
||||
@ -186,7 +185,7 @@ static volatile bool initialized = false;
|
||||
|| [type isEqualToString:FBSDKLastName] || [type isEqualToString:FBSDKCity]
|
||||
|| [type isEqualToString:FBSDKState] || [type isEqualToString:FBSDKCountry]) {
|
||||
normalizedData = [data stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
normalizedData = [normalizedData lowercaseString];
|
||||
normalizedData = normalizedData.lowercaseString;
|
||||
} else if ([type isEqualToString:FBSDKPhone]){
|
||||
NSError *error = nil;
|
||||
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"[^0-9]"
|
||||
@ -195,13 +194,13 @@ static volatile bool initialized = false;
|
||||
];
|
||||
normalizedData = [regex stringByReplacingMatchesInString:data
|
||||
options:0
|
||||
range:NSMakeRange(0, [data length])
|
||||
range:NSMakeRange(0, data.length)
|
||||
withTemplate:@""
|
||||
];
|
||||
} else if ([type isEqualToString:FBSDKGender]){
|
||||
NSString *temp = [data stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
temp = [temp lowercaseString];
|
||||
normalizedData = [temp length] > 0 ? [temp substringToIndex:1]: @"";
|
||||
temp = temp.lowercaseString;
|
||||
normalizedData = temp.length > 0 ? [temp substringToIndex:1]: @"";
|
||||
}
|
||||
|
||||
return normalizedData;
|
||||
@ -210,7 +209,7 @@ static volatile bool initialized = false;
|
||||
+ (BOOL)maybeSHA256Hashed:(NSString *)data
|
||||
{
|
||||
NSRange range = [data rangeOfString:@"[A-Fa-f0-9]{64}" options:NSRegularExpressionSearch];
|
||||
return ([data length] == 64) && (range.location != NSNotFound);
|
||||
return (data.length == 64) && (range.location != NSNotFound);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -21,7 +21,16 @@
|
||||
#import "FBSDKAppEvents+Internal.h"
|
||||
#import "FBSDKTimeSpentData.h"
|
||||
|
||||
static NSString *const BoltsMeasurementEventNotificationName = @"com.parse.bolts.measurement_event";
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
|
||||
|
||||
static NSNotificationName const BoltsMeasurementEventNotification = @"com.parse.bolts.measurement_event";
|
||||
|
||||
#else
|
||||
|
||||
static NSString *const BoltsMeasurementEventNotification = @"com.parse.bolts.measurement_event";
|
||||
|
||||
#endif
|
||||
|
||||
static NSString *const BoltsMeasurementEventName = @"event_name";
|
||||
static NSString *const BoltsMeasurementEventArgs = @"event_args";
|
||||
static NSString *const BoltsMeasurementEventPrefix = @"bf_";
|
||||
@ -37,7 +46,7 @@ static NSString *const BoltsMeasurementEventPrefix = @"bf_";
|
||||
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
|
||||
[center addObserver:defaultListener
|
||||
selector:@selector(logFBAppEventForNotification:)
|
||||
name:BoltsMeasurementEventNotificationName
|
||||
name:BoltsMeasurementEventNotification
|
||||
object:nil];
|
||||
});
|
||||
return defaultListener;
|
||||
@ -59,7 +68,7 @@ static NSString *const BoltsMeasurementEventPrefix = @"bf_";
|
||||
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"[^0-9a-zA-Z _-]" options:0 error:&error];
|
||||
NSString *safeKey = [regex stringByReplacingMatchesInString:key
|
||||
options:0
|
||||
range:NSMakeRange(0, [key length])
|
||||
range:NSMakeRange(0, key.length)
|
||||
withTemplate:@"-"];
|
||||
safeKey = [safeKey stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@" -"]];
|
||||
logData[safeKey] = eventArgs[key];
|
||||
|
||||
@ -18,12 +18,7 @@
|
||||
|
||||
#import "FBSDKBase64.h"
|
||||
|
||||
#import "FBSDKMacros.h"
|
||||
|
||||
@implementation FBSDKBase64
|
||||
{
|
||||
BOOL _optionsEnabled;
|
||||
}
|
||||
|
||||
static FBSDKBase64 *_decoder;
|
||||
static FBSDKBase64 *_encoder;
|
||||
@ -33,11 +28,8 @@ static FBSDKBase64 *_encoder;
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self == [FBSDKBase64 class]) {
|
||||
BOOL optionsEnabled;
|
||||
optionsEnabled = [NSData instancesRespondToSelector:@selector(initWithBase64EncodedString:options:)];
|
||||
_decoder = [[FBSDKBase64 alloc] initWithOptionsEnabled:optionsEnabled];
|
||||
optionsEnabled = [NSData instancesRespondToSelector:@selector(base64EncodedStringWithOptions:)];
|
||||
_encoder = [[FBSDKBase64 alloc] initWithOptionsEnabled:optionsEnabled];
|
||||
_decoder = [[FBSDKBase64 alloc] init];
|
||||
_encoder = [[FBSDKBase64 alloc] init];
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,20 +55,6 @@ static FBSDKBase64 *_encoder;
|
||||
|
||||
#pragma mark - Object Lifecycle
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
FBSDK_NOT_DESIGNATED_INITIALIZER(initWithOptionsEnabled:);
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (instancetype)initWithOptionsEnabled:(BOOL)optionsEnabled
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
_optionsEnabled = optionsEnabled;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Implementation Methods
|
||||
|
||||
- (NSData *)decodeAsData:(NSString *)string
|
||||
@ -91,14 +69,8 @@ static FBSDKBase64 *_encoder;
|
||||
needPadding = 4 - needPadding;
|
||||
string = [string stringByPaddingToLength:string.length+needPadding withString:@"=" startingAtIndex:0];
|
||||
}
|
||||
if (_optionsEnabled) {
|
||||
return [[NSData alloc] initWithBase64EncodedString:string options:NSDataBase64DecodingIgnoreUnknownCharacters];
|
||||
} else {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
return [[NSData alloc] initWithBase64Encoding:string];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
return [[NSData alloc] initWithBase64EncodedString:string options:NSDataBase64DecodingIgnoreUnknownCharacters];
|
||||
}
|
||||
|
||||
- (NSString *)decodeAsString:(NSString *)string
|
||||
@ -115,14 +87,8 @@ static FBSDKBase64 *_encoder;
|
||||
if (!data) {
|
||||
return nil;
|
||||
}
|
||||
if (_optionsEnabled) {
|
||||
return [data base64EncodedStringWithOptions:0];
|
||||
} else {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
return [data base64Encoding];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
return [data base64EncodedStringWithOptions:0];
|
||||
}
|
||||
|
||||
- (NSString *)encodeString:(NSString *)string
|
||||
|
||||
@ -22,6 +22,9 @@
|
||||
|
||||
@interface FBSDKBridgeAPICrypto : NSObject
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
|
||||
+ (void)addCipherKeyToQueryParameters:(NSMutableDictionary *)queryParameters;
|
||||
+ (NSDictionary *)decryptResponseForRequest:(FBSDKBridgeAPIRequest *)request
|
||||
queryParameters:(NSDictionary *)queryParameters
|
||||
|
||||
@ -23,7 +23,6 @@
|
||||
#import "FBSDKCrypto.h"
|
||||
#import "FBSDKError.h"
|
||||
#import "FBSDKInternalUtility.h"
|
||||
#import "FBSDKMacros.h"
|
||||
#import "FBSDKSettings.h"
|
||||
#import "FBSDKUtility.h"
|
||||
|
||||
@ -58,7 +57,7 @@ static NSString *g_cipherKey = nil;
|
||||
NSDictionary *userInfo = @{
|
||||
FBSDKErrorArgumentValueKey: queryParameters,
|
||||
};
|
||||
*errorRef = [FBSDKError errorWithCode:FBSDKEncryptionErrorCode
|
||||
*errorRef = [NSError fbErrorWithCode:FBSDKErrorEncryption
|
||||
userInfo:userInfo
|
||||
message:@"Error decrypting incoming query parameters."
|
||||
underlyingError:nil];
|
||||
@ -66,7 +65,7 @@ static NSString *g_cipherKey = nil;
|
||||
return nil;
|
||||
}
|
||||
NSArray *additionalSignedDataArray = @[
|
||||
[[NSBundle mainBundle] bundleIdentifier],
|
||||
[NSBundle mainBundle].bundleIdentifier,
|
||||
[FBSDKSettings appID] ?: @"",
|
||||
@"bridge",
|
||||
request.methodName ?: @"",
|
||||
@ -88,7 +87,7 @@ static NSString *g_cipherKey = nil;
|
||||
@"version": additionalSignedDataArray[4],
|
||||
},
|
||||
};
|
||||
*errorRef = [FBSDKError errorWithCode:FBSDKEncryptionErrorCode
|
||||
*errorRef = [NSError fbErrorWithCode:FBSDKErrorEncryption
|
||||
userInfo:userInfo
|
||||
message:@"Error decrypting incoming query parameters."
|
||||
underlyingError:nil];
|
||||
@ -107,14 +106,6 @@ static NSString *g_cipherKey = nil;
|
||||
[self _resetCipherKey];
|
||||
}
|
||||
|
||||
#pragma mark - Object Lifecycle
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
FBSDK_NO_DESIGNATED_INITIALIZER();
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - Helper Methods
|
||||
|
||||
+ (NSString *)_cipherKey
|
||||
|
||||
@ -18,15 +18,13 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <FBSDKCoreKit/FBSDKMacros.h>
|
||||
|
||||
#import "FBSDKBridgeAPIProtocolType.h"
|
||||
|
||||
@class FBSDKBridgeAPIRequest;
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKBridgeAPIAppIDKey;
|
||||
FBSDK_EXTERN NSString *const FBSDKBridgeAPISchemeSuffixKey;
|
||||
FBSDK_EXTERN NSString *const FBSDKBridgeAPIVersionKey;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKBridgeAPIAppIDKey;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKBridgeAPISchemeSuffixKey;
|
||||
FOUNDATION_EXPORT NSString *const FBSDKBridgeAPIVersionKey;
|
||||
|
||||
@protocol FBSDKBridgeAPIProtocol <NSObject>
|
||||
|
||||
|
||||
@ -24,6 +24,8 @@
|
||||
|
||||
@interface FBSDKBridgeAPIRequest : NSObject <FBSDKCopying>
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
+ (instancetype)bridgeAPIRequestWithProtocolType:(FBSDKBridgeAPIProtocolType)protocolType
|
||||
scheme:(NSString *)scheme
|
||||
methodName:(NSString *)methodName
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
#import "FBSDKBridgeAPIProtocolWebV1.h"
|
||||
#import "FBSDKBridgeAPIProtocolWebV2.h"
|
||||
#import "FBSDKInternalUtility.h"
|
||||
#import "FBSDKMacros.h"
|
||||
#import "FBSDKSettings.h"
|
||||
#import "FBSDKUtility.h"
|
||||
|
||||
@ -94,23 +93,11 @@ NSString *const FBSDKBridgeAPIVersionKey = @"version";
|
||||
_parameters = [parameters copy];
|
||||
_userInfo = [userInfo copy];
|
||||
|
||||
_actionID = [[NSUUID UUID] UUIDString];
|
||||
_actionID = [NSUUID UUID].UUIDString;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
FBSDK_NOT_DESIGNATED_INITIALIZER(initWithProtocol:protocolType:scheme:methodName:methodVersion:parameters:userInfo:);
|
||||
return [self initWithProtocol:nil
|
||||
protocolType:FBSDKBridgeAPIProtocolTypeWeb
|
||||
scheme:nil
|
||||
methodName:nil
|
||||
methodVersion:nil
|
||||
parameters:nil
|
||||
userInfo:nil];
|
||||
}
|
||||
|
||||
#pragma mark - Public Methods
|
||||
|
||||
- (NSURL *)requestURL:(NSError *__autoreleasing *)errorRef
|
||||
|
||||
@ -24,6 +24,9 @@
|
||||
|
||||
@interface FBSDKBridgeAPIResponse : NSObject <FBSDKCopying>
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
|
||||
+ (instancetype)bridgeAPIResponseWithRequest:(FBSDKBridgeAPIRequest *)request error:(NSError *)error;
|
||||
+ (instancetype)bridgeAPIResponseWithRequest:(FBSDKBridgeAPIRequest *)request
|
||||
responseURL:(NSURL *)responseURL
|
||||
|
||||
@ -23,7 +23,6 @@
|
||||
#import "FBSDKBridgeAPIProtocolType.h"
|
||||
#import "FBSDKBridgeAPIRequest+Private.h"
|
||||
#import "FBSDKInternalUtility.h"
|
||||
#import "FBSDKMacros.h"
|
||||
#import "FBSDKTypeUtility.h"
|
||||
#import "FBSDKUtility.h"
|
||||
|
||||
@ -119,12 +118,6 @@ NS_DESIGNATED_INITIALIZER;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
FBSDK_NOT_DESIGNATED_INITIALIZER(initWithRequest:responseParameters:cancelled:error:);
|
||||
return [self initWithRequest:nil responseParameters:nil cancelled:NO error:nil];
|
||||
}
|
||||
|
||||
#pragma mark - NSCopying
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <FBSDKCoreKit/FBSDKMacros.h>
|
||||
|
||||
#import "FBSDKBridgeAPIProtocol.h"
|
||||
|
||||
typedef struct
|
||||
@ -28,7 +26,7 @@ typedef struct
|
||||
__unsafe_unretained NSString *methodArgs;
|
||||
__unsafe_unretained NSString *methodVersion;
|
||||
} FBSDKBridgeAPIProtocolNativeV1OutputKeysStruct;
|
||||
FBSDK_EXTERN const FBSDKBridgeAPIProtocolNativeV1OutputKeysStruct FBSDKBridgeAPIProtocolNativeV1OutputKeys;
|
||||
FOUNDATION_EXPORT const FBSDKBridgeAPIProtocolNativeV1OutputKeysStruct FBSDKBridgeAPIProtocolNativeV1OutputKeys;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -37,24 +35,27 @@ typedef struct
|
||||
__unsafe_unretained NSString *appName;
|
||||
__unsafe_unretained NSString *sdkVersion;
|
||||
} FBSDKBridgeAPIProtocolNativeV1BridgeParameterOutputKeysStruct;
|
||||
FBSDK_EXTERN const FBSDKBridgeAPIProtocolNativeV1BridgeParameterOutputKeysStruct FBSDKBridgeAPIProtocolNativeV1BridgeParameterOutputKeys;
|
||||
FOUNDATION_EXPORT const FBSDKBridgeAPIProtocolNativeV1BridgeParameterOutputKeysStruct FBSDKBridgeAPIProtocolNativeV1BridgeParameterOutputKeys;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
__unsafe_unretained NSString *bridgeArgs;
|
||||
__unsafe_unretained NSString *methodResults;
|
||||
} FBSDKBridgeAPIProtocolNativeV1InputKeysStruct;
|
||||
FBSDK_EXTERN const FBSDKBridgeAPIProtocolNativeV1InputKeysStruct FBSDKBridgeAPIProtocolNativeV1InputKeys;
|
||||
FOUNDATION_EXPORT const FBSDKBridgeAPIProtocolNativeV1InputKeysStruct FBSDKBridgeAPIProtocolNativeV1InputKeys;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
__unsafe_unretained NSString *actionID;
|
||||
__unsafe_unretained NSString *error;
|
||||
} FBSDKBridgeAPIProtocolNativeV1BridgeParameterInputKeysStruct;
|
||||
FBSDK_EXTERN const FBSDKBridgeAPIProtocolNativeV1BridgeParameterInputKeysStruct FBSDKBridgeAPIProtocolNativeV1BridgeParameterInputKeys;
|
||||
FOUNDATION_EXPORT const FBSDKBridgeAPIProtocolNativeV1BridgeParameterInputKeysStruct FBSDKBridgeAPIProtocolNativeV1BridgeParameterInputKeys;
|
||||
|
||||
@interface FBSDKBridgeAPIProtocolNativeV1 : NSObject <FBSDKBridgeAPIProtocol>
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
|
||||
- (instancetype)initWithAppScheme:(NSString *)appScheme;
|
||||
- (instancetype)initWithAppScheme:(NSString *)appScheme
|
||||
pasteboard:(UIPasteboard *)pasteboard
|
||||
|
||||
@ -20,8 +20,6 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <FBSDKCoreKit/FBSDKMacros.h>
|
||||
|
||||
#import "FBSDKApplicationDelegate+Internal.h"
|
||||
#import "FBSDKBase64.h"
|
||||
#import "FBSDKBridgeAPIRequest.h"
|
||||
@ -125,12 +123,6 @@ static const struct
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
FBSDK_NOT_DESIGNATED_INITIALIZER(initWithAppScheme:);
|
||||
return [self initWithAppScheme:nil];
|
||||
}
|
||||
|
||||
#pragma mark - FBSDKBridgeAPIProtocol
|
||||
|
||||
- (NSURL *)requestURLWithActionID:(NSString *)actionID
|
||||
@ -140,28 +132,33 @@ static const struct
|
||||
parameters:(NSDictionary *)parameters
|
||||
error:(NSError *__autoreleasing *)errorRef
|
||||
{
|
||||
NSString *host = @"dialog";
|
||||
NSString *path = [@"/" stringByAppendingString:methodName];
|
||||
NSString *const host = @"dialog";
|
||||
NSString *const path = [@"/" stringByAppendingString:methodName];
|
||||
|
||||
NSMutableDictionary *queryParameters = [[NSMutableDictionary alloc] init];
|
||||
NSMutableDictionary<NSString *, id> *const queryParameters = [[NSMutableDictionary alloc] init];
|
||||
[FBSDKInternalUtility dictionary:queryParameters setObject:methodVersion
|
||||
forKey:FBSDKBridgeAPIProtocolNativeV1OutputKeys.methodVersion];
|
||||
|
||||
if ([parameters count]) {
|
||||
NSString *parametersString = [self _JSONStringForObject:parameters enablePasteboard:YES error:errorRef];
|
||||
if (parameters.count) {
|
||||
NSString *const parametersString = [self _JSONStringForObject:parameters enablePasteboard:YES error:errorRef];
|
||||
if (!parametersString) {
|
||||
return nil;
|
||||
}
|
||||
NSString *const escapedParametersString = [parametersString stringByReplacingOccurrencesOfString:@"&"
|
||||
withString:@"%26"
|
||||
options:NSCaseInsensitiveSearch
|
||||
range:NSMakeRange(0,
|
||||
parametersString.length)];
|
||||
[FBSDKInternalUtility dictionary:queryParameters
|
||||
setObject:parametersString
|
||||
setObject:escapedParametersString
|
||||
forKey:FBSDKBridgeAPIProtocolNativeV1OutputKeys.methodArgs];
|
||||
}
|
||||
|
||||
NSDictionary *bridgeParameters = [self _bridgeParametersWithActionID:actionID error:errorRef];
|
||||
NSDictionary<NSString *, id> *const bridgeParameters = [self _bridgeParametersWithActionID:actionID error:errorRef];
|
||||
if (!bridgeParameters) {
|
||||
return nil;
|
||||
}
|
||||
NSString *bridgeParametersString = [self _JSONStringForObject:bridgeParameters enablePasteboard:NO error:errorRef];
|
||||
NSString *const bridgeParametersString = [self _JSONStringForObject:bridgeParameters enablePasteboard:NO error:errorRef];
|
||||
if (!bridgeParametersString) {
|
||||
return nil;
|
||||
}
|
||||
@ -194,7 +191,7 @@ static const struct
|
||||
bridgeParameters = [FBSDKTypeUtility dictionaryValue:bridgeParameters];
|
||||
if (!bridgeParameters) {
|
||||
if (error && (errorRef != NULL)) {
|
||||
*errorRef = [FBSDKError invalidArgumentErrorWithName:FBSDKBridgeAPIProtocolNativeV1InputKeys.bridgeArgs
|
||||
*errorRef = [NSError fbInvalidArgumentErrorWithName:FBSDKBridgeAPIProtocolNativeV1InputKeys.bridgeArgs
|
||||
value:bridgeParametersJSON
|
||||
message:@"Invalid bridge_args."
|
||||
underlyingError:error];
|
||||
@ -219,7 +216,7 @@ static const struct
|
||||
NSDictionary *resultParameters = [FBSDKInternalUtility objectForJSONString:resultParametersJSON error:&error];
|
||||
if (!resultParameters) {
|
||||
if (errorRef != NULL) {
|
||||
*errorRef = [FBSDKError invalidArgumentErrorWithName:FBSDKBridgeAPIProtocolNativeV1InputKeys.methodResults
|
||||
*errorRef = [NSError fbInvalidArgumentErrorWithName:FBSDKBridgeAPIProtocolNativeV1InputKeys.methodResults
|
||||
value:resultParametersJSON
|
||||
message:@"Invalid method_results."
|
||||
underlyingError:error];
|
||||
@ -243,7 +240,7 @@ static const struct
|
||||
NSArray *files = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIcons"]
|
||||
[@"CFBundlePrimaryIcon"]
|
||||
[@"CFBundleIconFiles"];
|
||||
if (![files count]) {
|
||||
if (!files.count) {
|
||||
return nil;
|
||||
}
|
||||
return [UIImage imageNamed:files[0]];
|
||||
@ -271,7 +268,7 @@ static const struct
|
||||
NSString *domain = [FBSDKTypeUtility stringValue:dictionary[FBSDKBridgeAPIProtocolNativeV1ErrorKeys.domain]] ?:
|
||||
FBSDKErrorDomain;
|
||||
NSInteger code = [FBSDKTypeUtility integerValue:dictionary[FBSDKBridgeAPIProtocolNativeV1ErrorKeys.code]] ?:
|
||||
FBSDKUnknownErrorCode;
|
||||
FBSDKErrorUnknown;
|
||||
NSDictionary *userInfo = [FBSDKTypeUtility dictionaryValue:dictionary[FBSDKBridgeAPIProtocolNativeV1ErrorKeys.userInfo]];
|
||||
return [NSError errorWithDomain:domain code:code userInfo:userInfo];
|
||||
}
|
||||
@ -315,7 +312,7 @@ static const struct
|
||||
}
|
||||
return dictionary;
|
||||
} else if ([invalidObject isKindOfClass:[NSURL class]]) {
|
||||
return [(NSURL *)invalidObject absoluteString];
|
||||
return ((NSURL *)invalidObject).absoluteString;
|
||||
}
|
||||
return invalidObject;
|
||||
}];
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
#import "FBSDKBridgeAPIRequest.h"
|
||||
#import "FBSDKError.h"
|
||||
#import "FBSDKInternalUtility.h"
|
||||
#import "FBSDKMacros.h"
|
||||
#import "FBSDKSettings.h"
|
||||
#import "FBSDKTypeUtility.h"
|
||||
|
||||
@ -82,7 +81,7 @@
|
||||
}
|
||||
default:{
|
||||
if (errorRef != NULL) {
|
||||
*errorRef = [FBSDKError errorWithCode:errorCode
|
||||
*errorRef = [NSError fbErrorWithCode:errorCode
|
||||
message:[FBSDKTypeUtility stringValue:queryParameters[@"error_message"]]];
|
||||
}
|
||||
return nil;
|
||||
@ -95,7 +94,7 @@
|
||||
NSDictionary *bridgeParameters = [FBSDKInternalUtility objectForJSONString:bridgeParametersJSON error:&error];
|
||||
if (!bridgeParameters) {
|
||||
if (error && (errorRef != NULL)) {
|
||||
*errorRef = [FBSDKError invalidArgumentErrorWithName:FBSDK_BRIDGE_API_PROTOCOL_WEB_V1_BRIDGE_ARGS_KEY
|
||||
*errorRef = [NSError fbInvalidArgumentErrorWithName:FBSDK_BRIDGE_API_PROTOCOL_WEB_V1_BRIDGE_ARGS_KEY
|
||||
value:bridgeParametersJSON
|
||||
message:nil
|
||||
underlyingError:error];
|
||||
|
||||
@ -83,7 +83,7 @@
|
||||
FBSDKDialogConfiguration *dialogConfiguration = [serverConfiguration dialogConfigurationForDialogName:methodName];
|
||||
if (!dialogConfiguration) {
|
||||
if (errorRef != NULL) {
|
||||
*errorRef = [FBSDKError errorWithCode:FBSDKDialogUnavailableErrorCode message:nil];
|
||||
*errorRef = [NSError fbErrorWithCode:FBSDKErrorDialogUnavailable message:nil];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
@ -98,7 +98,7 @@
|
||||
}
|
||||
|
||||
NSMutableDictionary *queryParameters = [[FBSDKUtility dictionaryWithQueryString:requestURL.query] mutableCopy];
|
||||
queryParameters[@"ios_bundle_id"] = [[NSBundle mainBundle] bundleIdentifier];
|
||||
queryParameters[@"ios_bundle_id"] = [NSBundle mainBundle].bundleIdentifier;
|
||||
NSURL *redirectURL = [self _redirectURLWithActionID:nil methodName:methodName error:errorRef];
|
||||
if (!redirectURL) {
|
||||
return nil;
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
static const uint8_t kFBSDK_CRYPTO_CURRENT_VERSION = 1;
|
||||
static const uint8_t kFBSDK_CRYPTO_CURRENT_MASTER_KEY_LENGTH = 16;
|
||||
|
||||
FBSDK_STATIC_INLINE void FBSDKCryptoWriteIntBigEndian(uint8_t *buffer, uint32_t value)
|
||||
static inline void FBSDKCryptoWriteIntBigEndian(uint8_t *buffer, uint32_t value)
|
||||
{
|
||||
buffer[3] = (uint8_t)(value & 0xff);
|
||||
buffer[2] = (uint8_t)((value >> 8) & 0xff);
|
||||
@ -36,7 +36,7 @@ FBSDK_STATIC_INLINE void FBSDKCryptoWriteIntBigEndian(uint8_t *buffer, uint32_t
|
||||
buffer[0] = (uint8_t)((value >> 24) & 0xff);
|
||||
}
|
||||
|
||||
FBSDK_STATIC_INLINE void FBSDKCryptoBlankData(NSData *data)
|
||||
static inline void FBSDKCryptoBlankData(NSData *data)
|
||||
{
|
||||
if (!data) {
|
||||
return;
|
||||
@ -45,7 +45,7 @@ FBSDK_STATIC_INLINE void FBSDKCryptoBlankData(NSData *data)
|
||||
}
|
||||
|
||||
// Note: the following simple derivation function is NOT suitable for passwords or weak keys
|
||||
FBSDK_STATIC_INLINE NSData *FBSDKCryptoMakeSubKey(uint8_t *key, size_t len, uint32_t idx)
|
||||
static inline NSData *FBSDKCryptoMakeSubKey(uint8_t *key, size_t len, uint32_t idx)
|
||||
{
|
||||
if (!key || len < 10) {
|
||||
return nil;
|
||||
@ -78,7 +78,7 @@ FBSDK_STATIC_INLINE NSData *FBSDKCryptoMakeSubKey(uint8_t *key, size_t len, uint
|
||||
NSData *masterKeyData = [FBSDKCrypto randomBytes:kFBSDK_CRYPTO_CURRENT_MASTER_KEY_LENGTH + 1];
|
||||
|
||||
// force the first byte to be the crypto version
|
||||
uint8_t *first = (uint8_t *) [masterKeyData bytes];
|
||||
uint8_t *first = (uint8_t *)masterKeyData.bytes;
|
||||
*first = kFBSDK_CRYPTO_CURRENT_VERSION;
|
||||
|
||||
NSString *masterKey = [FBSDKBase64 encodeData:masterKeyData];
|
||||
@ -111,8 +111,8 @@ FBSDK_STATIC_INLINE NSData *FBSDKCryptoMakeSubKey(uint8_t *key, size_t len, uint
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
NSData *masterKeyData = [FBSDKBase64 decodeAsData:masterKey];
|
||||
NSUInteger len = [masterKeyData length];
|
||||
uint8_t *first = (uint8_t *) [masterKeyData bytes];
|
||||
NSUInteger len = masterKeyData.length;
|
||||
uint8_t *first = (uint8_t *)masterKeyData.bytes;
|
||||
|
||||
if (len == 0 || first == nil || *first != kFBSDK_CRYPTO_CURRENT_VERSION) {
|
||||
// only one version supported at the moment
|
||||
|
||||
@ -25,9 +25,9 @@
|
||||
|
||||
+ (instancetype)recoveryAttempterFromConfiguration:(FBSDKErrorRecoveryConfiguration *)configuration
|
||||
{
|
||||
if (configuration.errorCategory == FBSDKGraphRequestErrorCategoryTransient) {
|
||||
if (configuration.errorCategory == FBSDKGraphRequestErrorTransient) {
|
||||
return [[_FBSDKTemporaryErrorRecoveryAttempter alloc] init];
|
||||
} else if (configuration.errorCategory == FBSDKGraphRequestErrorCategoryOther) {
|
||||
} else if (configuration.errorCategory == FBSDKGraphRequestErrorOther) {
|
||||
return nil;
|
||||
}
|
||||
if ([configuration.recoveryActionName isEqualToString:@"login"]) {
|
||||
|
||||
@ -19,11 +19,18 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <FBSDKCoreKit/FBSDKApplicationDelegate.h>
|
||||
#import <FBSDKCoreKit/FBSDKMacros.h>
|
||||
|
||||
#import "FBSDKCoreKit+Internal.h"
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKApplicationDidBecomeActiveNotification;
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
|
||||
|
||||
FOUNDATION_EXPORT NSNotificationName const FBSDKApplicationDidBecomeActiveNotification;
|
||||
|
||||
#else
|
||||
|
||||
FOUNDATION_EXPORT NSString *const FBSDKApplicationDidBecomeActiveNotification;
|
||||
|
||||
#endif
|
||||
|
||||
@class FBSDKApplicationCall;
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@
|
||||
{
|
||||
NSURL *fileURL = [self _fileURL:errorRef];
|
||||
|
||||
if (![_fileManager fileExistsAtPath:[fileURL path]]) {
|
||||
if (![_fileManager fileExistsAtPath:fileURL.path]) {
|
||||
NSData *data = [[self class] data];
|
||||
if (![data writeToURL:fileURL options:NSDataWritingAtomic error:errorRef]) {
|
||||
return NO;
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#if !TARGET_OS_TV
|
||||
#import "AppEvents/Codeless/FBSDKViewHierarchy.h"
|
||||
#import "AppEvents/Codeless/FBSDKCodelessMacros.h"
|
||||
#import "AppEvents/Codeless/FBSDKCodelessIndexer.h"
|
||||
#import "BridgeAPI/FBSDKBridgeAPIProtocol.h"
|
||||
#import "BridgeAPI/FBSDKBridgeAPIProtocolType.h"
|
||||
#import "BridgeAPI/FBSDKBridgeAPIRequest.h"
|
||||
|
||||
@ -54,9 +54,8 @@ static NSMapTable *g_mdnsAdvertisementServices;
|
||||
struct utsname systemInfo;
|
||||
uname(&systemInfo);
|
||||
NSDictionary *deviceInfo = @{
|
||||
FBSDK_DEVICE_INFO_DEVICE: [NSString stringWithCString:systemInfo.machine
|
||||
encoding:NSUTF8StringEncoding],
|
||||
FBSDK_DEVICE_INFO_MODEL: [[UIDevice currentDevice] model],
|
||||
FBSDK_DEVICE_INFO_DEVICE: @(systemInfo.machine),
|
||||
FBSDK_DEVICE_INFO_MODEL: [UIDevice currentDevice].model,
|
||||
};
|
||||
NSError *err;
|
||||
NSData *jsonDeviceInfo = [NSJSONSerialization dataWithJSONObject:deviceInfo
|
||||
|
||||
@ -20,8 +20,6 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
#import <FBSDKCoreKit/FBSDKMacros.h>
|
||||
|
||||
/**
|
||||
|
||||
This class provides a way to load constants and methods from Apple Frameworks in a dynamic
|
||||
@ -32,6 +30,9 @@
|
||||
*/
|
||||
@interface FBSDKDynamicFrameworkLoader : NSObject
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
|
||||
#pragma mark - Security Constants
|
||||
|
||||
/**
|
||||
@ -130,105 +131,105 @@
|
||||
#pragma mark - Security APIs
|
||||
|
||||
// These are local wrappers around the corresponding methods in Security/SecRandom.h
|
||||
FBSDK_EXTERN int fbsdkdfl_SecRandomCopyBytes(SecRandomRef rnd, size_t count, uint8_t *bytes);
|
||||
FOUNDATION_EXPORT int fbsdkdfl_SecRandomCopyBytes(SecRandomRef rnd, size_t count, uint8_t *bytes);
|
||||
|
||||
// These are local wrappers around Keychain API
|
||||
FBSDK_EXTERN OSStatus fbsdkdfl_SecItemUpdate(CFDictionaryRef query, CFDictionaryRef attributesToUpdate);
|
||||
FBSDK_EXTERN OSStatus fbsdkdfl_SecItemAdd(CFDictionaryRef attributes, CFTypeRef *result);
|
||||
FBSDK_EXTERN OSStatus fbsdkdfl_SecItemCopyMatching(CFDictionaryRef query, CFTypeRef *result);
|
||||
FBSDK_EXTERN OSStatus fbsdkdfl_SecItemDelete(CFDictionaryRef query);
|
||||
FOUNDATION_EXPORT OSStatus fbsdkdfl_SecItemUpdate(CFDictionaryRef query, CFDictionaryRef attributesToUpdate);
|
||||
FOUNDATION_EXPORT OSStatus fbsdkdfl_SecItemAdd(CFDictionaryRef attributes, CFTypeRef *result);
|
||||
FOUNDATION_EXPORT OSStatus fbsdkdfl_SecItemCopyMatching(CFDictionaryRef query, CFTypeRef *result);
|
||||
FOUNDATION_EXPORT OSStatus fbsdkdfl_SecItemDelete(CFDictionaryRef query);
|
||||
|
||||
#pragma mark - Social Constants
|
||||
|
||||
FBSDK_EXTERN NSString *fbsdkdfl_SLServiceTypeFacebook(void);
|
||||
FBSDK_EXTERN NSString *fbsdkdfl_SLServiceTypeTwitter(void);
|
||||
FOUNDATION_EXPORT NSString *fbsdkdfl_SLServiceTypeFacebook(void);
|
||||
FOUNDATION_EXPORT NSString *fbsdkdfl_SLServiceTypeTwitter(void);
|
||||
|
||||
#pragma mark - Social Classes
|
||||
|
||||
FBSDK_EXTERN Class fbsdkdfl_SLComposeViewControllerClass(void);
|
||||
FOUNDATION_EXPORT Class fbsdkdfl_SLComposeViewControllerClass(void);
|
||||
|
||||
#pragma mark - MessageUI Classes
|
||||
|
||||
FBSDK_EXTERN Class fbsdkdfl_MFMailComposeViewControllerClass(void);
|
||||
FBSDK_EXTERN Class fbsdkdfl_MFMessageComposeViewControllerClass(void);
|
||||
FOUNDATION_EXPORT Class fbsdkdfl_MFMailComposeViewControllerClass(void);
|
||||
FOUNDATION_EXPORT Class fbsdkdfl_MFMessageComposeViewControllerClass(void);
|
||||
|
||||
#pragma mark - QuartzCore Classes
|
||||
|
||||
FBSDK_EXTERN Class fbsdkdfl_CATransactionClass(void);
|
||||
FOUNDATION_EXPORT Class fbsdkdfl_CATransactionClass(void);
|
||||
|
||||
#pragma mark - QuartzCore APIs
|
||||
|
||||
// These are local wrappers around the corresponding transform methods from QuartzCore.framework/CATransform3D.h
|
||||
FBSDK_EXTERN CATransform3D fbsdkdfl_CATransform3DMakeScale (CGFloat sx, CGFloat sy, CGFloat sz);
|
||||
FBSDK_EXTERN CATransform3D fbsdkdfl_CATransform3DMakeTranslation (CGFloat tx, CGFloat ty, CGFloat tz);
|
||||
FBSDK_EXTERN CATransform3D fbsdkdfl_CATransform3DConcat (CATransform3D a, CATransform3D b);
|
||||
FOUNDATION_EXPORT CATransform3D fbsdkdfl_CATransform3DMakeScale (CGFloat sx, CGFloat sy, CGFloat sz);
|
||||
FOUNDATION_EXPORT CATransform3D fbsdkdfl_CATransform3DMakeTranslation (CGFloat tx, CGFloat ty, CGFloat tz);
|
||||
FOUNDATION_EXPORT CATransform3D fbsdkdfl_CATransform3DConcat (CATransform3D a, CATransform3D b);
|
||||
|
||||
FBSDK_EXTERN const CATransform3D fbsdkdfl_CATransform3DIdentity;
|
||||
FOUNDATION_EXPORT const CATransform3D fbsdkdfl_CATransform3DIdentity;
|
||||
|
||||
#pragma mark - AudioToolbox APIs
|
||||
|
||||
// These are local wrappers around the corresponding methods in AudioToolbox/AudioToolbox.h
|
||||
FBSDK_EXTERN OSStatus fbsdkdfl_AudioServicesCreateSystemSoundID(CFURLRef inFileURL, SystemSoundID *outSystemSoundID);
|
||||
FBSDK_EXTERN OSStatus fbsdkdfl_AudioServicesDisposeSystemSoundID(SystemSoundID inSystemSoundID);
|
||||
FBSDK_EXTERN void fbsdkdfl_AudioServicesPlaySystemSound(SystemSoundID inSystemSoundID);
|
||||
FOUNDATION_EXPORT OSStatus fbsdkdfl_AudioServicesCreateSystemSoundID(CFURLRef inFileURL, SystemSoundID *outSystemSoundID);
|
||||
FOUNDATION_EXPORT OSStatus fbsdkdfl_AudioServicesDisposeSystemSoundID(SystemSoundID inSystemSoundID);
|
||||
FOUNDATION_EXPORT void fbsdkdfl_AudioServicesPlaySystemSound(SystemSoundID inSystemSoundID);
|
||||
|
||||
#pragma mark - AdSupport Classes
|
||||
|
||||
FBSDK_EXTERN Class fbsdkdfl_ASIdentifierManagerClass(void);
|
||||
FOUNDATION_EXPORT Class fbsdkdfl_ASIdentifierManagerClass(void);
|
||||
|
||||
#pragma mark - SafariServices Classes
|
||||
|
||||
FBSDK_EXTERN Class fbsdkdfl_SFSafariViewControllerClass(void);
|
||||
FBSDK_EXTERN Class fbsdkdfl_SFAuthenticationSessionClass(void);
|
||||
FOUNDATION_EXPORT Class fbsdkdfl_SFSafariViewControllerClass(void);
|
||||
FOUNDATION_EXPORT Class fbsdkdfl_SFAuthenticationSessionClass(void);
|
||||
|
||||
#pragma mark - Accounts Constants
|
||||
|
||||
FBSDK_EXTERN NSString *fbsdkdfl_ACFacebookAppIdKey(void);
|
||||
FBSDK_EXTERN NSString *fbsdkdfl_ACFacebookAudienceEveryone(void);
|
||||
FBSDK_EXTERN NSString *fbsdkdfl_ACFacebookAudienceFriends(void);
|
||||
FBSDK_EXTERN NSString *fbsdkdfl_ACFacebookAudienceKey(void);
|
||||
FBSDK_EXTERN NSString *fbsdkdfl_ACFacebookAudienceOnlyMe(void);
|
||||
FBSDK_EXTERN NSString *fbsdkdfl_ACFacebookPermissionsKey(void);
|
||||
FOUNDATION_EXPORT NSString *fbsdkdfl_ACFacebookAppIdKey(void);
|
||||
FOUNDATION_EXPORT NSString *fbsdkdfl_ACFacebookAudienceEveryone(void);
|
||||
FOUNDATION_EXPORT NSString *fbsdkdfl_ACFacebookAudienceFriends(void);
|
||||
FOUNDATION_EXPORT NSString *fbsdkdfl_ACFacebookAudienceKey(void);
|
||||
FOUNDATION_EXPORT NSString *fbsdkdfl_ACFacebookAudienceOnlyMe(void);
|
||||
FOUNDATION_EXPORT NSString *fbsdkdfl_ACFacebookPermissionsKey(void);
|
||||
|
||||
#pragma mark - Accounts Classes
|
||||
|
||||
FBSDK_EXTERN Class fbsdkdfl_ACAccountStoreClass(void);
|
||||
FOUNDATION_EXPORT Class fbsdkdfl_ACAccountStoreClass(void);
|
||||
|
||||
#pragma mark - StoreKit classes
|
||||
|
||||
FBSDK_EXTERN Class fbsdkdfl_SKPaymentQueueClass(void);
|
||||
FBSDK_EXTERN Class fbsdkdfl_SKProductsRequestClass(void);
|
||||
FOUNDATION_EXPORT Class fbsdkdfl_SKPaymentQueueClass(void);
|
||||
FOUNDATION_EXPORT Class fbsdkdfl_SKProductsRequestClass(void);
|
||||
|
||||
#pragma mark - AssetsLibrary Classes
|
||||
|
||||
FBSDK_EXTERN Class fbsdkdfl_ALAssetsLibraryClass(void);
|
||||
FOUNDATION_EXPORT Class fbsdkdfl_ALAssetsLibraryClass(void);
|
||||
|
||||
#pragma mark - CoreTelephony Classes
|
||||
|
||||
FBSDK_EXTERN Class fbsdkdfl_CTTelephonyNetworkInfoClass(void);
|
||||
FOUNDATION_EXPORT Class fbsdkdfl_CTTelephonyNetworkInfoClass(void);
|
||||
|
||||
#pragma mark - CoreImage
|
||||
|
||||
FBSDK_EXTERN Class fbsdkdfl_CIImageClass(void);
|
||||
FBSDK_EXTERN Class fbsdkdfl_CIFilterClass(void);
|
||||
FBSDK_EXTERN NSString *fbsdkdfl_kCIInputImageKey(void);
|
||||
FBSDK_EXTERN NSString *fbsdkdfl_kCIInputRadiusKey(void);
|
||||
FBSDK_EXTERN NSString *fbsdkdfl_kCIOutputImageKey(void);
|
||||
FOUNDATION_EXPORT Class fbsdkdfl_CIImageClass(void);
|
||||
FOUNDATION_EXPORT Class fbsdkdfl_CIFilterClass(void);
|
||||
FOUNDATION_EXPORT NSString *fbsdkdfl_kCIInputImageKey(void);
|
||||
FOUNDATION_EXPORT NSString *fbsdkdfl_kCIInputRadiusKey(void);
|
||||
FOUNDATION_EXPORT NSString *fbsdkdfl_kCIOutputImageKey(void);
|
||||
|
||||
#pragma mark - Photos.framework
|
||||
|
||||
FBSDK_EXTERN Class fbsdkdfl_PHPhotoLibrary(void);
|
||||
FBSDK_EXTERN Class fbsdkdfl_PHAssetChangeRequest(void);
|
||||
FOUNDATION_EXPORT Class fbsdkdfl_PHPhotoLibrary(void);
|
||||
FOUNDATION_EXPORT Class fbsdkdfl_PHAssetChangeRequest(void);
|
||||
|
||||
#pragma mark - MobileCoreServices
|
||||
|
||||
FBSDK_EXTERN CFStringRef fbsdkdfl_UTTypeCopyPreferredTagWithClass(CFStringRef inUTI,
|
||||
FOUNDATION_EXPORT CFStringRef fbsdkdfl_UTTypeCopyPreferredTagWithClass(CFStringRef inUTI,
|
||||
CFStringRef inTagClass);
|
||||
FBSDK_EXTERN CFStringRef fbsdkdfl_kUTTagClassMIMEType(void);
|
||||
FBSDK_EXTERN CFStringRef fbsdkdfl_kUTTypeJPEG(void);
|
||||
FBSDK_EXTERN CFStringRef fbsdkdfl_kUTTypePNG(void);
|
||||
FOUNDATION_EXPORT CFStringRef fbsdkdfl_kUTTagClassMIMEType(void);
|
||||
FOUNDATION_EXPORT CFStringRef fbsdkdfl_kUTTypeJPEG(void);
|
||||
FOUNDATION_EXPORT CFStringRef fbsdkdfl_kUTTypePNG(void);
|
||||
|
||||
#pragma mark - WebKit Classes
|
||||
|
||||
FBSDK_EXTERN Class fbsdkdfl_WKWebViewClass(void);
|
||||
FBSDK_EXTERN Class fbsdkdfl_WKUserScriptClass(void);
|
||||
FOUNDATION_EXPORT Class fbsdkdfl_WKWebViewClass(void);
|
||||
FOUNDATION_EXPORT Class fbsdkdfl_WKUserScriptClass(void);
|
||||
|
||||
@ -18,39 +18,76 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface FBSDKError : NSObject
|
||||
@interface NSError (FBSDKError)
|
||||
|
||||
+ (NSString *)errorDomain;
|
||||
+ (NSError *)fbErrorWithCode:(NSInteger)code message:(NSString *)message;
|
||||
+ (NSError *)fbErrorWithDomain:(NSErrorDomain)domain
|
||||
code:(NSInteger)code
|
||||
message:(NSString *)message;
|
||||
|
||||
+ (BOOL)errorIsNetworkError:(NSError *)error;
|
||||
+ (NSError *)fbErrorWithCode:(NSInteger)code
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError;
|
||||
|
||||
+ (NSError *)errorWithCode:(NSInteger)code message:(NSString *)message;
|
||||
+ (NSError *)errorWithCode:(NSInteger)code message:(NSString *)message underlyingError:(NSError *)underlyingError;
|
||||
+ (NSError *)errorWithCode:(NSInteger)code
|
||||
userInfo:(NSDictionary *)userInfo
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError;
|
||||
+ (NSError *)fbErrorWithDomain:(NSErrorDomain)domain
|
||||
code:(NSInteger)code
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError;
|
||||
|
||||
+ (NSError *)invalidArgumentErrorWithName:(NSString *)name value:(id)value message:(NSString *)message;
|
||||
+ (NSError *)invalidArgumentErrorWithName:(NSString *)name
|
||||
value:(id)value
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError;
|
||||
+ (NSError *)invalidCollectionErrorWithName:(NSString *)name
|
||||
collection:(id<NSFastEnumeration>)collection
|
||||
item:(id)item
|
||||
+ (NSError *)fbErrorWithCode:(NSInteger)code
|
||||
userInfo:(NSDictionary<NSErrorUserInfoKey, id> *)userInfo
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError;
|
||||
|
||||
+ (NSError *)fbErrorWithDomain:(NSErrorDomain)domain
|
||||
code:(NSInteger)code
|
||||
userInfo:(NSDictionary<NSErrorUserInfoKey, id> *)userInfo
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError;
|
||||
|
||||
+ (NSError *)fbInvalidArgumentErrorWithName:(NSString *)name
|
||||
value:(id)value
|
||||
message:(NSString *)message;
|
||||
+ (NSError *)invalidCollectionErrorWithName:(NSString *)name
|
||||
collection:(id<NSFastEnumeration>)collection
|
||||
item:(id)item
|
||||
|
||||
+ (NSError *)fbInvalidArgumentErrorWithDomain:(NSErrorDomain)domain
|
||||
name:(NSString *)name
|
||||
value:(id)value
|
||||
message:(NSString *)message;
|
||||
|
||||
+ (NSError *)fbInvalidArgumentErrorWithName:(NSString *)name
|
||||
value:(id)value
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError;
|
||||
|
||||
+ (NSError *)requiredArgumentErrorWithName:(NSString *)name message:(NSString *)message;
|
||||
+ (NSError *)requiredArgumentErrorWithName:(NSString *)name
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError;
|
||||
+ (NSError *)fbInvalidArgumentErrorWithDomain:(NSErrorDomain)domain
|
||||
name:(NSString *)name
|
||||
value:(id)value
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError;
|
||||
|
||||
+ (NSError *)unknownErrorWithMessage:(NSString *)message;
|
||||
+ (NSError *)fbInvalidCollectionErrorWithName:(NSString *)name
|
||||
collection:(id<NSFastEnumeration>)collection
|
||||
item:(id)item
|
||||
message:(NSString *)message;
|
||||
|
||||
+ (NSError *)fbInvalidCollectionErrorWithName:(NSString *)name
|
||||
collection:(id<NSFastEnumeration>)collection
|
||||
item:(id)item
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError;
|
||||
|
||||
+ (NSError *)fbRequiredArgumentErrorWithName:(NSString *)name message:(NSString *)message;
|
||||
+ (NSError *)fbRequiredArgumentErrorWithDomain:(NSErrorDomain)domain
|
||||
name:(NSString *)name
|
||||
message:(NSString *)message;
|
||||
|
||||
+ (NSError *)fbRequiredArgumentErrorWithName:(NSString *)name
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError;
|
||||
|
||||
+ (NSError *)fbUnknownErrorWithMessage:(NSString *)message;
|
||||
|
||||
@property (nonatomic, assign, readonly, getter=isNetworkError) BOOL networkError
|
||||
NS_SWIFT_NAME(isNetworkError);
|
||||
|
||||
@end
|
||||
|
||||
@ -22,27 +22,18 @@
|
||||
#import "FBSDKInternalUtility.h"
|
||||
#import "FBSDKTypeUtility.h"
|
||||
|
||||
@implementation FBSDKError
|
||||
@implementation NSError (FBSDKError)
|
||||
|
||||
#pragma mark - Class Methods
|
||||
|
||||
+ (NSString *)errorDomain
|
||||
- (BOOL)isNetworkError
|
||||
{
|
||||
return FBSDKErrorDomain;
|
||||
}
|
||||
|
||||
+ (BOOL)errorIsNetworkError:(NSError *)error
|
||||
{
|
||||
if (error == nil) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSError *innerError = error.userInfo[NSUnderlyingErrorKey];
|
||||
if ([self errorIsNetworkError:innerError]) {
|
||||
NSError *innerError = self.userInfo[NSUnderlyingErrorKey];
|
||||
if (innerError && innerError.isNetworkError) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
switch (error.code) {
|
||||
switch (self.code) {
|
||||
case NSURLErrorTimedOut:
|
||||
case NSURLErrorCannotFindHost:
|
||||
case NSURLErrorCannotConnectToHost:
|
||||
@ -58,37 +49,85 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSError *)errorWithCode:(NSInteger)code message:(NSString *)message
|
||||
+ (NSError *)fbErrorWithCode:(NSInteger)code message:(NSString *)message
|
||||
{
|
||||
return [self errorWithCode:code message:message underlyingError:nil];
|
||||
return [self fbErrorWithCode:code message:message underlyingError:nil];
|
||||
}
|
||||
|
||||
+ (NSError *)errorWithCode:(NSInteger)code message:(NSString *)message underlyingError:(NSError *)underlyingError
|
||||
+ (NSError *)fbErrorWithDomain:(NSErrorDomain)domain
|
||||
code:(NSInteger)code
|
||||
message:(NSString *)message
|
||||
{
|
||||
return [self errorWithCode:code userInfo:nil message:message underlyingError:underlyingError];
|
||||
return [self fbErrorWithDomain:domain code:code message:message underlyingError:nil];
|
||||
}
|
||||
|
||||
+ (NSError *)errorWithCode:(NSInteger)code
|
||||
userInfo:(NSDictionary *)userInfo
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError
|
||||
+ (NSError *)fbErrorWithCode:(NSInteger)code message:(NSString *)message underlyingError:(NSError *)underlyingError
|
||||
{
|
||||
return [self fbErrorWithCode:code userInfo:nil message:message underlyingError:underlyingError];
|
||||
}
|
||||
|
||||
+ (NSError *)fbErrorWithDomain:(NSErrorDomain)domain
|
||||
code:(NSInteger)code
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError
|
||||
{
|
||||
return [self fbErrorWithDomain:domain code:code userInfo:@{} message:message underlyingError:underlyingError];
|
||||
}
|
||||
|
||||
+ (NSError *)fbErrorWithCode:(NSInteger)code
|
||||
userInfo:(NSDictionary<NSErrorUserInfoKey, id> *)userInfo
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError
|
||||
{
|
||||
return [self fbErrorWithDomain:FBSDKErrorDomain code:code userInfo:userInfo message:message underlyingError:underlyingError];
|
||||
}
|
||||
|
||||
+ (NSError *)fbErrorWithDomain:(NSErrorDomain)domain
|
||||
code:(NSInteger)code
|
||||
userInfo:(NSDictionary<NSErrorUserInfoKey,id> *)userInfo
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError
|
||||
{
|
||||
NSMutableDictionary *fullUserInfo = [[NSMutableDictionary alloc] initWithDictionary:userInfo];
|
||||
[FBSDKInternalUtility dictionary:fullUserInfo setObject:message forKey:FBSDKErrorDeveloperMessageKey];
|
||||
[FBSDKInternalUtility dictionary:fullUserInfo setObject:underlyingError forKey:NSUnderlyingErrorKey];
|
||||
userInfo = ([fullUserInfo count] ? [fullUserInfo copy] : nil);
|
||||
return [[NSError alloc] initWithDomain:[self errorDomain] code:code userInfo:userInfo];
|
||||
userInfo = fullUserInfo.count ? [fullUserInfo copy] : nil;
|
||||
return [[NSError alloc] initWithDomain:domain code:code userInfo:userInfo];
|
||||
}
|
||||
|
||||
+ (NSError *)invalidArgumentErrorWithName:(NSString *)name value:(id)value message:(NSString *)message
|
||||
+ (NSError *)fbInvalidArgumentErrorWithName:(NSString *)name value:(id)value message:(NSString *)message
|
||||
{
|
||||
return [self invalidArgumentErrorWithName:name value:value message:message underlyingError:nil];
|
||||
return [self fbInvalidArgumentErrorWithName:name value:value message:message underlyingError:nil];
|
||||
}
|
||||
|
||||
+ (NSError *)invalidArgumentErrorWithName:(NSString *)name
|
||||
value:(id)value
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError
|
||||
+ (NSError *)fbInvalidArgumentErrorWithDomain:(NSErrorDomain)domain
|
||||
name:(NSString *)name
|
||||
value:(id)value
|
||||
message:(NSString *)message
|
||||
{
|
||||
return [self fbInvalidArgumentErrorWithDomain:domain
|
||||
name:name
|
||||
value:value
|
||||
message:message
|
||||
underlyingError:nil];
|
||||
}
|
||||
|
||||
+ (NSError *)fbInvalidArgumentErrorWithName:(NSString *)name
|
||||
value:(id)value
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError
|
||||
{
|
||||
return [self fbInvalidArgumentErrorWithDomain:FBSDKErrorDomain
|
||||
name:name
|
||||
value:value
|
||||
message:message
|
||||
underlyingError:underlyingError];
|
||||
}
|
||||
+ (NSError *)fbInvalidArgumentErrorWithDomain:(NSErrorDomain)domain
|
||||
name:(NSString *)name
|
||||
value:(id)value
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError
|
||||
{
|
||||
if (!message) {
|
||||
message = [[NSString alloc] initWithFormat:@"Invalid value for %@: %@", name, value];
|
||||
@ -96,25 +135,26 @@
|
||||
NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] init];
|
||||
[FBSDKInternalUtility dictionary:userInfo setObject:name forKey:FBSDKErrorArgumentNameKey];
|
||||
[FBSDKInternalUtility dictionary:userInfo setObject:value forKey:FBSDKErrorArgumentValueKey];
|
||||
return [self errorWithCode:FBSDKInvalidArgumentErrorCode
|
||||
userInfo:userInfo
|
||||
message:message
|
||||
underlyingError:underlyingError];
|
||||
return [self fbErrorWithDomain:domain
|
||||
code:FBSDKErrorInvalidArgument
|
||||
userInfo:userInfo
|
||||
message:message
|
||||
underlyingError:underlyingError];
|
||||
}
|
||||
|
||||
+ (NSError *)invalidCollectionErrorWithName:(NSString *)name
|
||||
collection:(id<NSFastEnumeration>)collection
|
||||
item:(id)item
|
||||
message:(NSString *)message
|
||||
+ (NSError *)fbInvalidCollectionErrorWithName:(NSString *)name
|
||||
collection:(id<NSFastEnumeration>)collection
|
||||
item:(id)item
|
||||
message:(NSString *)message
|
||||
{
|
||||
return [self invalidCollectionErrorWithName:name collection:collection item:item message:message underlyingError:nil];
|
||||
return [self fbInvalidCollectionErrorWithName:name collection:collection item:item message:message underlyingError:nil];
|
||||
}
|
||||
|
||||
+ (NSError *)invalidCollectionErrorWithName:(NSString *)name
|
||||
collection:(id<NSFastEnumeration>)collection
|
||||
item:(id)item
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError
|
||||
+ (NSError *)fbInvalidCollectionErrorWithName:(NSString *)name
|
||||
collection:(id<NSFastEnumeration>)collection
|
||||
item:(id)item
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError
|
||||
{
|
||||
if (!message) {
|
||||
message = [[NSString alloc] initWithFormat:@"Invalid item (%@) found in collection for %@: %@", item, name, collection];
|
||||
@ -123,41 +163,43 @@
|
||||
[FBSDKInternalUtility dictionary:userInfo setObject:name forKey:FBSDKErrorArgumentNameKey];
|
||||
[FBSDKInternalUtility dictionary:userInfo setObject:item forKey:FBSDKErrorArgumentValueKey];
|
||||
[FBSDKInternalUtility dictionary:userInfo setObject:collection forKey:FBSDKErrorArgumentCollectionKey];
|
||||
return [self errorWithCode:FBSDKInvalidArgumentErrorCode
|
||||
userInfo:userInfo
|
||||
message:message
|
||||
underlyingError:underlyingError];
|
||||
return [self fbErrorWithCode:FBSDKErrorInvalidArgument
|
||||
userInfo:userInfo
|
||||
message:message
|
||||
underlyingError:underlyingError];
|
||||
}
|
||||
|
||||
+ (NSError *)requiredArgumentErrorWithName:(NSString *)name message:(NSString *)message
|
||||
+ (NSError *)fbRequiredArgumentErrorWithName:(NSString *)name message:(NSString *)message
|
||||
{
|
||||
return [self requiredArgumentErrorWithName:name message:message underlyingError:nil];
|
||||
return [self fbRequiredArgumentErrorWithName:name message:message underlyingError:nil];
|
||||
}
|
||||
|
||||
+ (NSError *)requiredArgumentErrorWithName:(NSString *)name
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError
|
||||
+ (NSError *)fbRequiredArgumentErrorWithDomain:(NSErrorDomain)domain
|
||||
name:(NSString *)name
|
||||
message:(NSString *)message
|
||||
{
|
||||
if (!message) {
|
||||
message = [[NSString alloc] initWithFormat:@"Value for %@ is required.", name];
|
||||
}
|
||||
return [self invalidArgumentErrorWithName:name value:nil message:message underlyingError:underlyingError];
|
||||
return [self fbInvalidArgumentErrorWithDomain:domain name:name value:nil message:message underlyingError:nil];
|
||||
}
|
||||
|
||||
+ (NSError *)unknownErrorWithMessage:(NSString *)message
|
||||
+ (NSError *)fbRequiredArgumentErrorWithName:(NSString *)name
|
||||
message:(NSString *)message
|
||||
underlyingError:(NSError *)underlyingError
|
||||
{
|
||||
return [self errorWithCode:FBSDKUnknownErrorCode
|
||||
userInfo:nil
|
||||
message:message
|
||||
underlyingError:nil];
|
||||
if (!message) {
|
||||
message = [[NSString alloc] initWithFormat:@"Value for %@ is required.", name];
|
||||
}
|
||||
return [self fbInvalidArgumentErrorWithName:name value:nil message:message underlyingError:underlyingError];
|
||||
}
|
||||
|
||||
#pragma mark - Object Lifecycle
|
||||
|
||||
- (instancetype)init
|
||||
+ (NSError *)fbUnknownErrorWithMessage:(NSString *)message
|
||||
{
|
||||
FBSDK_NO_DESIGNATED_INITIALIZER();
|
||||
return nil;
|
||||
return [self fbErrorWithCode:FBSDKErrorUnknown
|
||||
userInfo:nil
|
||||
message:message
|
||||
underlyingError:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -36,6 +36,9 @@ typedef NS_ENUM(int32_t, FBSDKUIKitVersion)
|
||||
|
||||
@interface FBSDKInternalUtility : NSObject
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
Constructs the scheme for apps that come to the current app through the bridge.
|
||||
*/
|
||||
@ -344,6 +347,11 @@ setJSONStringForObject:(id)object
|
||||
*/
|
||||
+ (BOOL)areAllPermissionsPublishPermissions:(NSSet *)permissions;
|
||||
|
||||
/*
|
||||
Checks if the app is Unity.
|
||||
*/
|
||||
+ (BOOL)isUnity;
|
||||
|
||||
#pragma mark - FB Apps Installed
|
||||
|
||||
+ (BOOL)isFacebookAppInstalled;
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
#import "FBSDKCoreKit+Internal.h"
|
||||
#import "FBSDKError.h"
|
||||
#import "FBSDKMacros.h"
|
||||
#import "FBSDKSettings+Internal.h"
|
||||
#import "FBSDKSettings.h"
|
||||
#import "FBSDKUtility.h"
|
||||
|
||||
@ -103,9 +103,9 @@ typedef NS_ENUM(NSUInteger, FBSDKInternalUtilityVersionShift)
|
||||
+ (id)convertRequestValue:(id)value
|
||||
{
|
||||
if ([value isKindOfClass:[NSNumber class]]) {
|
||||
value = [(NSNumber *)value stringValue];
|
||||
value = ((NSNumber *)value).stringValue;
|
||||
} else if ([value isKindOfClass:[NSURL class]]) {
|
||||
value = [(NSURL *)value absoluteString];
|
||||
value = ((NSURL *)value).absoluteString;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
@ -136,7 +136,7 @@ setJSONStringForObject:(id)object
|
||||
+ (void)dictionary:(NSMutableDictionary *)dictionary setObject:(id)object forKey:(id<NSCopying>)key
|
||||
{
|
||||
if (object && key) {
|
||||
[dictionary setObject:object forKey:key];
|
||||
dictionary[key] = object;
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,23 +177,23 @@ setJSONStringForObject:(id)object
|
||||
defaultVersion:(NSString *)defaultVersion
|
||||
error:(NSError *__autoreleasing *)errorRef
|
||||
{
|
||||
if ([hostPrefix length] && ![hostPrefix hasSuffix:@"."]) {
|
||||
if (hostPrefix.length && ![hostPrefix hasSuffix:@"."]) {
|
||||
hostPrefix = [hostPrefix stringByAppendingString:@"."];
|
||||
}
|
||||
|
||||
NSString *host = @"facebook.com";
|
||||
NSString *domainPart = [FBSDKSettings facebookDomainPart];
|
||||
if ([domainPart length]) {
|
||||
if (domainPart.length) {
|
||||
host = [[NSString alloc] initWithFormat:@"%@.%@", domainPart, host];
|
||||
}
|
||||
host = [NSString stringWithFormat:@"%@%@", hostPrefix ?: @"", host ?: @""];
|
||||
|
||||
NSString *version = defaultVersion ?: [FBSDKSettings graphAPIVersion];
|
||||
if ([version length]) {
|
||||
if (version.length) {
|
||||
version = [@"/" stringByAppendingString:version];
|
||||
}
|
||||
|
||||
if ([path length]) {
|
||||
if (path.length) {
|
||||
NSScanner *versionScanner = [[NSScanner alloc] initWithString:path];
|
||||
if ([versionScanner scanString:@"/v" intoString:NULL] &&
|
||||
[versionScanner scanInteger:NULL] &&
|
||||
@ -220,7 +220,7 @@ setJSONStringForObject:(id)object
|
||||
|
||||
+ (BOOL)isBrowserURL:(NSURL *)URL
|
||||
{
|
||||
NSString *scheme = [URL.scheme lowercaseString];
|
||||
NSString *scheme = URL.scheme.lowercaseString;
|
||||
return ([scheme isEqualToString:@"http"] || [scheme isEqualToString:@"https"]);
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ setJSONStringForObject:(id)object
|
||||
static dispatch_once_t getVersionOnce;
|
||||
dispatch_once(&getVersionOnce, ^{
|
||||
int32_t linkTimeVersion = NSVersionOfLinkTimeLibrary("UIKit");
|
||||
linkTimeMajorVersion = ((MAX(linkTimeVersion, 0) & FBSDKInternalUtilityMajorVersionMask) >> FBSDKInternalUtilityMajorVersionShift);
|
||||
linkTimeMajorVersion = [self getMajorVersionFromFullLibraryVersion:linkTimeVersion];
|
||||
});
|
||||
return (version <= linkTimeMajorVersion);
|
||||
}
|
||||
@ -258,11 +258,24 @@ setJSONStringForObject:(id)object
|
||||
static dispatch_once_t getVersionOnce;
|
||||
dispatch_once(&getVersionOnce, ^{
|
||||
int32_t runTimeVersion = NSVersionOfRunTimeLibrary("UIKit");
|
||||
runTimeMajorVersion = ((MAX(runTimeVersion, 0) & FBSDKInternalUtilityMajorVersionMask) >> FBSDKInternalUtilityMajorVersionShift);
|
||||
runTimeMajorVersion = [self getMajorVersionFromFullLibraryVersion:runTimeVersion];
|
||||
});
|
||||
return (version <= runTimeMajorVersion);
|
||||
}
|
||||
|
||||
+ (int32_t)getMajorVersionFromFullLibraryVersion:(int32_t)version
|
||||
{
|
||||
// Negative values returned by NSVersionOfRunTimeLibrary/NSVersionOfLinkTimeLibrary
|
||||
// are still valid version numbers, as long as it's not -1.
|
||||
// After bitshift by 16, the negatives become valid positive major version number.
|
||||
// We ran into this first time with iOS 12.
|
||||
if (version != -1) {
|
||||
return ((version & FBSDKInternalUtilityMajorVersionMask) >> FBSDKInternalUtilityMajorVersionShift);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSString *)JSONStringForObject:(id)object
|
||||
error:(NSError *__autoreleasing *)errorRef
|
||||
invalidObjectHandler:(id(^)(id object, BOOL *stop))invalidObjectHandler
|
||||
@ -271,7 +284,7 @@ setJSONStringForObject:(id)object
|
||||
object = [self _convertObjectToJSONObject:object invalidObjectHandler:invalidObjectHandler stop:NULL];
|
||||
if (![NSJSONSerialization isValidJSONObject:object]) {
|
||||
if (errorRef != NULL) {
|
||||
*errorRef = [FBSDKError invalidArgumentErrorWithName:@"object"
|
||||
*errorRef = [NSError fbInvalidArgumentErrorWithName:@"object"
|
||||
value:object
|
||||
message:@"Invalid object for JSON serialization."];
|
||||
}
|
||||
@ -348,7 +361,7 @@ setJSONStringForObject:(id)object
|
||||
NSMutableString *queryString = [[NSMutableString alloc] init];
|
||||
__block BOOL hasParameters = NO;
|
||||
if (dictionary) {
|
||||
NSMutableArray *keys = [[dictionary allKeys] mutableCopy];
|
||||
NSMutableArray<NSString *> *keys = [dictionary.allKeys mutableCopy];
|
||||
// remove non-string keys, as they are not valid
|
||||
[keys filterUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
|
||||
return [evaluatedObject isKindOfClass:[NSString class]];
|
||||
@ -379,7 +392,7 @@ setJSONStringForObject:(id)object
|
||||
if (errorRef != NULL) {
|
||||
*errorRef = nil;
|
||||
}
|
||||
return ([queryString length] ? [queryString copy] : nil);
|
||||
return (queryString.length ? [queryString copy] : nil);
|
||||
}
|
||||
|
||||
+ (BOOL)shouldManuallyAdjustOrientation
|
||||
@ -399,13 +412,13 @@ setJSONStringForObject:(id)object
|
||||
}
|
||||
|
||||
NSString *queryString = nil;
|
||||
if ([queryParameters count]) {
|
||||
if (queryParameters.count) {
|
||||
NSError *queryStringError;
|
||||
queryString = [@"?" stringByAppendingString:[FBSDKUtility queryStringWithDictionary:queryParameters
|
||||
error:&queryStringError]];
|
||||
if (!queryString) {
|
||||
if (errorRef != NULL) {
|
||||
*errorRef = [FBSDKError invalidArgumentErrorWithName:@"queryParameters"
|
||||
*errorRef = [NSError fbInvalidArgumentErrorWithName:@"queryParameters"
|
||||
value:queryParameters
|
||||
message:nil
|
||||
underlyingError:queryStringError];
|
||||
@ -424,7 +437,7 @@ setJSONStringForObject:(id)object
|
||||
if (URL) {
|
||||
*errorRef = nil;
|
||||
} else {
|
||||
*errorRef = [FBSDKError unknownErrorWithMessage:@"Unknown error building URL."];
|
||||
*errorRef = [NSError fbUnknownErrorWithMessage:@"Unknown error building URL."];
|
||||
}
|
||||
}
|
||||
return URL;
|
||||
@ -451,7 +464,7 @@ static NSMapTable *_transientObjects;
|
||||
if (!_transientObjects) {
|
||||
_transientObjects = [[NSMapTable alloc] init];
|
||||
}
|
||||
NSUInteger count = [(NSNumber *)[_transientObjects objectForKey:object] unsignedIntegerValue];
|
||||
NSUInteger count = ((NSNumber *)[_transientObjects objectForKey:object]).unsignedIntegerValue;
|
||||
[_transientObjects setObject:@(count + 1) forKey:object];
|
||||
}
|
||||
|
||||
@ -461,7 +474,7 @@ static NSMapTable *_transientObjects;
|
||||
return;
|
||||
}
|
||||
NSAssert([NSThread isMainThread], @"Must be called from the main thread!");
|
||||
NSUInteger count = [(NSNumber *)[_transientObjects objectForKey:object] unsignedIntegerValue];
|
||||
NSUInteger count = ((NSNumber *)[_transientObjects objectForKey:object]).unsignedIntegerValue;
|
||||
if (count == 1) {
|
||||
[_transientObjects removeObjectForKey:object];
|
||||
} else if (count != 0) {
|
||||
@ -514,14 +527,6 @@ static NSMapTable *_transientObjects;
|
||||
return [self _canOpenURLScheme:FBSDK_CANOPENURL_MSQRD_PLAYER];
|
||||
}
|
||||
|
||||
#pragma mark - Object Lifecycle
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
FBSDK_NO_DESIGNATED_INITIALIZER();
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - Helper Methods
|
||||
|
||||
+ (NSComparisonResult)_compareOperatingSystemVersion:(NSOperatingSystemVersion)version1
|
||||
@ -552,7 +557,7 @@ static NSMapTable *_transientObjects;
|
||||
if ([object isKindOfClass:[NSString class]] || [object isKindOfClass:[NSNumber class]]) {
|
||||
// good to go, keep the object
|
||||
} else if ([object isKindOfClass:[NSURL class]]) {
|
||||
object = [(NSURL *)object absoluteString];
|
||||
object = ((NSURL *)object).absoluteString;
|
||||
} else if ([object isKindOfClass:[NSDictionary class]]) {
|
||||
NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
|
||||
[(NSDictionary *)object enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *dictionaryStop) {
|
||||
@ -684,7 +689,7 @@ static NSMapTable *_transientObjects;
|
||||
static NSArray *urlTypes = nil;
|
||||
|
||||
dispatch_once(&fetchBundleOnce, ^{
|
||||
urlTypes = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleURLTypes"];
|
||||
urlTypes = [[NSBundle mainBundle].infoDictionary valueForKey:@"CFBundleURLTypes"];
|
||||
});
|
||||
for (NSDictionary *urlType in urlTypes) {
|
||||
NSArray *urlSchemes = [urlType valueForKey:@"CFBundleURLSchemes"];
|
||||
@ -724,7 +729,7 @@ static NSMapTable *_transientObjects;
|
||||
static NSArray *schemes = nil;
|
||||
|
||||
dispatch_once(&fetchBundleOnce, ^{
|
||||
schemes = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"LSApplicationQueriesSchemes"];
|
||||
schemes = [[NSBundle mainBundle].infoDictionary valueForKey:@"LSApplicationQueriesSchemes"];
|
||||
});
|
||||
|
||||
return [schemes containsObject:urlScheme];
|
||||
@ -772,4 +777,13 @@ static NSMapTable *_transientObjects;
|
||||
return clazz;
|
||||
}
|
||||
|
||||
+ (BOOL)isUnity
|
||||
{
|
||||
NSString *userAgentSuffix = [FBSDKSettings userAgentSuffix];
|
||||
if (userAgentSuffix != nil && [userAgentSuffix rangeOfString:@"Unity"].location != NSNotFound) {
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -87,7 +87,7 @@ static NSMutableDictionary *g_startTimesWithTags = nil;
|
||||
|
||||
- (void)appendKey:(NSString *)key value:(NSString *)value
|
||||
{
|
||||
if (_isActive && [value length]) {
|
||||
if (_isActive && value.length) {
|
||||
[_internalContents appendFormat:@" %@:\t%@\n", key, value];
|
||||
}
|
||||
}
|
||||
@ -98,7 +98,7 @@ static NSMutableDictionary *g_startTimesWithTags = nil;
|
||||
|
||||
for (NSString *key in [g_stringsToReplace keyEnumerator]) {
|
||||
[_internalContents replaceOccurrencesOfString:key
|
||||
withString:[g_stringsToReplace objectForKey:key]
|
||||
withString:g_stringsToReplace[key]
|
||||
options:NSLiteralSearch
|
||||
range:NSMakeRange(0, _internalContents.length)];
|
||||
}
|
||||
@ -158,8 +158,8 @@ static NSMutableDictionary *g_startTimesWithTags = nil;
|
||||
// Start time of this "timestampTag" is stashed in the dictionary.
|
||||
// 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.
|
||||
NSNumber *tagAsNumber = [NSNumber numberWithUnsignedLong:(unsigned long)(__bridge void *)timestampTag];
|
||||
NSNumber *startTimeNumber = [g_startTimesWithTags objectForKey:tagAsNumber];
|
||||
NSNumber *tagAsNumber = @((unsigned long)(__bridge void *)timestampTag);
|
||||
NSNumber *startTimeNumber = g_startTimesWithTags[tagAsNumber];
|
||||
|
||||
// Only log if there's been an associated start time.
|
||||
if (startTimeNumber) {
|
||||
@ -193,8 +193,7 @@ static NSMutableDictionary *g_startTimesWithTags = nil;
|
||||
// Treat the incoming object tag simply as an address, since it's only used to identify during lifetime. If
|
||||
// we send in as an object, the dictionary will try to copy it.
|
||||
unsigned long tagAsNumber = (unsigned long)(__bridge void *)timestampTag;
|
||||
[g_startTimesWithTags setObject:@(currTime)
|
||||
forKey:[NSNumber numberWithUnsignedLong:tagAsNumber]];
|
||||
g_startTimesWithTags[@(tagAsNumber)] = @(currTime);
|
||||
}
|
||||
}
|
||||
|
||||
@ -204,7 +203,7 @@ static NSMutableDictionary *g_startTimesWithTags = nil;
|
||||
|
||||
// Strings sent in here never get cleaned up, but that's OK, don't ever expect too many.
|
||||
|
||||
if ([[FBSDKSettings loggingBehavior] count] > 0) { // otherwise there's no logging.
|
||||
if ([FBSDKSettings loggingBehavior].count > 0) { // otherwise there's no logging.
|
||||
|
||||
if (!g_stringsToReplace) {
|
||||
g_stringsToReplace = [[NSMutableDictionary alloc] init];
|
||||
|
||||
@ -21,6 +21,9 @@
|
||||
|
||||
@interface FBSDKMath : NSObject
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
|
||||
+ (CGPoint)ceilForPoint:(CGPoint)value;
|
||||
+ (CGSize)ceilForSize:(CGSize)value;
|
||||
+ (CGPoint)floorForPoint:(CGPoint)value;
|
||||
|
||||
@ -25,8 +25,6 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "FBSDKMacros.h"
|
||||
|
||||
@implementation FBSDKMath
|
||||
|
||||
#pragma mark - Class Methods
|
||||
@ -148,12 +146,4 @@
|
||||
return hash;
|
||||
}
|
||||
|
||||
#pragma mark - Object Lifecycle
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
FBSDK_NO_DESIGNATED_INITIALIZER();
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -191,9 +191,9 @@ static void (*fb_swizzledMethods[MAX_ARGS - MIN_ARGS + 1])() = {fb_swizzledMetho
|
||||
IMP swizzledMethod = (IMP)fb_swizzledMethods[numArgs - 2];
|
||||
// Check whether the first parameter is integer
|
||||
if (4 == numArgs) {
|
||||
NSString *firstType = [NSString stringWithUTF8String:method_copyArgumentType(aMethod, 2)];
|
||||
NSString *firstType = @(method_copyArgumentType(aMethod, 2));
|
||||
NSString *integerTypes = @"islq";
|
||||
if ([integerTypes containsString:[firstType lowercaseString]]) {
|
||||
if ([integerTypes containsString:firstType.lowercaseString]) {
|
||||
swizzledMethod = (IMP)fb_swizzleMethod_4_io;
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,6 +30,28 @@ typedef void (^FBSDKGraphRequestAccessToAccountsHandler)(NSString *oauthToken, N
|
||||
*/
|
||||
@interface FBSDKSystemAccountStoreAdapter : NSObject
|
||||
|
||||
/*
|
||||
s gets the oauth token stored in the account store credential, if available. If not empty,
|
||||
this implies user has granted access.
|
||||
*/
|
||||
@property (nonatomic, readonly, copy) NSString *accessTokenString;
|
||||
|
||||
/*
|
||||
Gets or sets the flag indicating if the next requestAccess call should block
|
||||
on a renew call.
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL forceBlockingRenew;
|
||||
|
||||
/*
|
||||
A convenience getter to the Facebook account type in the account store, if available.
|
||||
*/
|
||||
@property (strong, nonatomic, readonly) ACAccountType *accountType;
|
||||
|
||||
/*
|
||||
The singleton instance.
|
||||
*/
|
||||
@property (class, nonatomic, strong) FBSDKSystemAccountStoreAdapter *sharedInstance;
|
||||
|
||||
/*
|
||||
Requests access to the device's Facebook account for the given parameters.
|
||||
@param permissions the permissions
|
||||
@ -51,31 +73,4 @@ typedef void (^FBSDKGraphRequestAccessToAccountsHandler)(NSString *oauthToken, N
|
||||
*/
|
||||
- (void)renewSystemAuthorization:(void(^)(ACAccountCredentialRenewResult result, NSError *error))handler;
|
||||
|
||||
/*
|
||||
s gets the oauth token stored in the account store credential, if available. If not empty,
|
||||
this implies user has granted access.
|
||||
*/
|
||||
- (NSString *)accessTokenString;
|
||||
|
||||
/*
|
||||
Gets the singleton instance.
|
||||
*/
|
||||
+ (FBSDKSystemAccountStoreAdapter *)sharedInstance;
|
||||
|
||||
/*
|
||||
Sets the singleton instance, typically only for unit tests
|
||||
*/
|
||||
+ (void)setSharedInstance:(FBSDKSystemAccountStoreAdapter *)instance;
|
||||
|
||||
/*
|
||||
Gets or sets the flag indicating if the next requestAccess call should block
|
||||
on a renew call.
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL forceBlockingRenew;
|
||||
|
||||
/*
|
||||
A convenience getter to the Facebook account type in the account store, if available.
|
||||
*/
|
||||
@property (strong, nonatomic, readonly) ACAccountType *accountType;
|
||||
|
||||
@end
|
||||
|
||||
@ -99,7 +99,7 @@ static FBSDKSystemAccountStoreAdapter *_singletonInstance = nil;
|
||||
if (self.accountType && self.accountType.accessGranted) {
|
||||
NSArray *fbAccounts = [self.accountStore accountsWithAccountType:self.accountType];
|
||||
if (fbAccounts.count > 0) {
|
||||
id account = [fbAccounts objectAtIndex:0];
|
||||
id account = fbAccounts[0];
|
||||
id credential = [account credential];
|
||||
|
||||
return [credential oauthToken];
|
||||
@ -137,11 +137,9 @@ static FBSDKSystemAccountStoreAdapter *_singletonInstance = nil;
|
||||
}
|
||||
|
||||
// construct access options
|
||||
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
appID, fbsdkdfl_ACFacebookAppIdKey(),
|
||||
[permissions allObjects], fbsdkdfl_ACFacebookPermissionsKey(),
|
||||
defaultAudience, fbsdkdfl_ACFacebookAudienceKey(), // must end on this key/value due to audience possibly being nil
|
||||
nil];
|
||||
NSDictionary<NSString *, id> *options = @{fbsdkdfl_ACFacebookAppIdKey(): appID,
|
||||
fbsdkdfl_ACFacebookPermissionsKey(): permissions.allObjects,
|
||||
fbsdkdfl_ACFacebookAudienceKey(): defaultAudience};
|
||||
|
||||
if (self.forceBlockingRenew
|
||||
&& [self.accountStore accountsWithAccountType:self.accountType].count > 0) {
|
||||
@ -171,7 +169,7 @@ static FBSDKSystemAccountStoreAdapter *_singletonInstance = nil;
|
||||
{
|
||||
if (!self.accountType) {
|
||||
if (handler) {
|
||||
handler(nil, [FBSDKError errorWithCode:FBSDKUnknownErrorCode message:@"Invalid request to account store"]);
|
||||
handler(nil, [NSError fbErrorWithCode:FBSDKErrorUnknown message:@"Invalid request to account store"]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -200,7 +198,7 @@ static FBSDKSystemAccountStoreAdapter *_singletonInstance = nil;
|
||||
if (granted) {
|
||||
NSArray *fbAccounts = [self.accountStore accountsWithAccountType:self.accountType];
|
||||
if (fbAccounts.count > 0) {
|
||||
account = [fbAccounts objectAtIndex:0];
|
||||
account = fbAccounts[0];
|
||||
|
||||
id credential = [account credential];
|
||||
|
||||
@ -233,11 +231,11 @@ static FBSDKSystemAccountStoreAdapter *_singletonInstance = nil;
|
||||
if (self.accountStore && self.accountType && self.accountType.accessGranted) {
|
||||
NSArray *fbAccounts = [self.accountStore accountsWithAccountType:self.accountType];
|
||||
id account;
|
||||
if (fbAccounts && [fbAccounts count] > 0 &&
|
||||
(account = [fbAccounts objectAtIndex:0])) {
|
||||
if (fbAccounts && fbAccounts.count > 0 &&
|
||||
(account = fbAccounts[0])) {
|
||||
|
||||
FBSDKAccessToken *currentToken = [FBSDKAccessToken currentAccessToken];
|
||||
if (![currentToken.tokenString isEqualToString:[self accessTokenString]]) {
|
||||
if (![currentToken.tokenString isEqualToString:self.accessTokenString]) {
|
||||
currentToken = nil;
|
||||
}
|
||||
[self.accountStore renewCredentialsForAccount:account completion:^(ACAccountCredentialRenewResult renewResult, NSError *error) {
|
||||
@ -252,8 +250,9 @@ static FBSDKSystemAccountStoreAdapter *_singletonInstance = nil;
|
||||
[currentToken isEqual:[FBSDKAccessToken currentAccessToken]]) {
|
||||
// account store renewals can change the stored oauth token so we need to update the currentAccessToken
|
||||
// so future comparisons to -[ accessTokenString] work correctly (e.g., error recovery).
|
||||
FBSDKAccessToken *updatedToken = [[FBSDKAccessToken alloc] initWithTokenString:[self accessTokenString]
|
||||
permissions:[currentToken.permissions allObjects] declinedPermissions:[currentToken.declinedPermissions allObjects]
|
||||
FBSDKAccessToken *updatedToken = [[FBSDKAccessToken alloc] initWithTokenString:self.accessTokenString
|
||||
permissions:currentToken.permissions.allObjects
|
||||
declinedPermissions:currentToken.declinedPermissions.allObjects
|
||||
appID:currentToken.appID
|
||||
userID:currentToken.userID
|
||||
expirationDate:[NSDate distantFuture]
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <FBSDKCoreKit/FBSDKMacros.h>
|
||||
|
||||
typedef NS_ENUM(NSInteger, FBSDKTriStateBOOL)
|
||||
{
|
||||
FBSDKTriStateBOOLValueUnknown = -1,
|
||||
@ -27,6 +25,6 @@ typedef NS_ENUM(NSInteger, FBSDKTriStateBOOL)
|
||||
FBSDKTriStateBOOLValueYES = 1,
|
||||
};
|
||||
|
||||
FBSDK_EXTERN FBSDKTriStateBOOL FBSDKTriStateBOOLFromBOOL(BOOL value);
|
||||
FBSDK_EXTERN FBSDKTriStateBOOL FBSDKTriStateBOOLFromNSNumber(NSNumber *value);
|
||||
FBSDK_EXTERN BOOL BOOLFromFBSDKTriStateBOOL(FBSDKTriStateBOOL value, BOOL defaultValue);
|
||||
FOUNDATION_EXPORT FBSDKTriStateBOOL FBSDKTriStateBOOLFromBOOL(BOOL value);
|
||||
FOUNDATION_EXPORT FBSDKTriStateBOOL FBSDKTriStateBOOLFromNSNumber(NSNumber *value);
|
||||
FOUNDATION_EXPORT BOOL BOOLFromFBSDKTriStateBOOL(FBSDKTriStateBOOL value, BOOL defaultValue);
|
||||
|
||||
@ -26,7 +26,7 @@ FBSDKTriStateBOOL FBSDKTriStateBOOLFromBOOL(BOOL value)
|
||||
FBSDKTriStateBOOL FBSDKTriStateBOOLFromNSNumber(NSNumber *value)
|
||||
{
|
||||
return ([value isKindOfClass:[NSNumber class]] ?
|
||||
FBSDKTriStateBOOLFromBOOL([value boolValue]) :
|
||||
FBSDKTriStateBOOLFromBOOL(value.boolValue) :
|
||||
FBSDKTriStateBOOLValueUnknown);
|
||||
}
|
||||
|
||||
|
||||
@ -20,6 +20,9 @@
|
||||
|
||||
@interface FBSDKTypeUtility : NSObject
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
|
||||
+ (NSArray *)arrayValue:(id)object;
|
||||
+ (BOOL)boolValue:(id)object;
|
||||
+ (NSDictionary *)dictionaryValue:(id)object;
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
|
||||
#import "FBSDKTypeUtility.h"
|
||||
|
||||
#import "FBSDKMacros.h"
|
||||
|
||||
@implementation FBSDKTypeUtility
|
||||
|
||||
#pragma mark - Class Methods
|
||||
@ -33,10 +31,10 @@
|
||||
{
|
||||
if ([object isKindOfClass:[NSNumber class]]) {
|
||||
// @0 or @NO returns NO, otherwise YES
|
||||
return [(NSNumber *)object boolValue];
|
||||
return ((NSNumber *)object).boolValue;
|
||||
} else if ([object isKindOfClass:[NSString class]]) {
|
||||
// Returns YES on encountering one of "Y", "y", "T", "t", or a digit 1-9, otherwise NO
|
||||
return [(NSString *)object boolValue];
|
||||
return ((NSString *)object).boolValue;
|
||||
} else {
|
||||
return ([self objectValue:object] != nil);
|
||||
}
|
||||
@ -50,9 +48,9 @@
|
||||
+ (NSInteger)integerValue:(id)object
|
||||
{
|
||||
if ([object isKindOfClass:[NSNumber class]]) {
|
||||
return [(NSNumber *)object integerValue];
|
||||
return ((NSNumber *)object).integerValue;
|
||||
} else if ([object isKindOfClass:[NSString class]]) {
|
||||
return [(NSString *)object integerValue];
|
||||
return ((NSString *)object).integerValue;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@ -68,9 +66,9 @@
|
||||
if ([object isKindOfClass:[NSString class]]) {
|
||||
return (NSString *)object;
|
||||
} else if ([object isKindOfClass:[NSNumber class]]) {
|
||||
return [(NSNumber *)object stringValue];
|
||||
return ((NSNumber *)object).stringValue;
|
||||
} else if ([object isKindOfClass:[NSURL class]]) {
|
||||
return [(NSURL *)object absoluteString];
|
||||
return ((NSURL *)object).absoluteString;
|
||||
} else {
|
||||
return nil;
|
||||
}
|
||||
@ -79,9 +77,9 @@
|
||||
+ (NSTimeInterval)timeIntervalValue:(id)object
|
||||
{
|
||||
if ([object isKindOfClass:[NSNumber class]]) {
|
||||
return [(NSNumber *)object doubleValue];
|
||||
return ((NSNumber *)object).doubleValue;
|
||||
} else if ([object isKindOfClass:[NSString class]]) {
|
||||
return [(NSString *)object doubleValue];
|
||||
return ((NSString *)object).doubleValue;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@ -90,7 +88,7 @@
|
||||
+ (NSUInteger)unsignedIntegerValue:(id)object
|
||||
{
|
||||
if ([object isKindOfClass:[NSNumber class]]) {
|
||||
return [(NSNumber *)object unsignedIntegerValue];
|
||||
return ((NSNumber *)object).unsignedIntegerValue;
|
||||
} else {
|
||||
// there is no direct support for strings containing unsigned values > NSIntegerMax - not worth writing ourselves
|
||||
// right now, so just cap unsigned values at NSIntegerMax until we have a need for larger
|
||||
@ -113,14 +111,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Object Lifecycle
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
FBSDK_NO_DESIGNATED_INITIALIZER();
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - Helper Methods
|
||||
|
||||
+ (id)_objectValue:(id)object ofClass:(Class)expectedClass
|
||||
|
||||
@ -46,8 +46,9 @@ typedef NS_OPTIONS(NSUInteger, FBSDKGraphRequestFlags)
|
||||
// out of context of any user action.
|
||||
@property (nonatomic, assign) FBSDKGraphRequestFlags flags;
|
||||
|
||||
- (BOOL)isGraphErrorRecoveryDisabled;
|
||||
- (BOOL)hasAttachments;
|
||||
@property (nonatomic, readonly, getter=isGraphErrorRecoveryDisabled) BOOL graphErrorRecoveryDisabled;
|
||||
@property (nonatomic, readonly) BOOL hasAttachments;
|
||||
|
||||
+ (BOOL)isAttachment:(id)item;
|
||||
+ (NSString *)serializeURL:(NSString *)baseUrl
|
||||
params:(NSDictionary *)params
|
||||
|
||||
@ -18,22 +18,24 @@
|
||||
|
||||
#import "FBSDKGraphRequestBody.h"
|
||||
|
||||
#import "FBSDKCrypto.h"
|
||||
#import "FBSDKGraphRequestDataAttachment.h"
|
||||
#import "FBSDKLogger.h"
|
||||
#import "FBSDKSettings.h"
|
||||
|
||||
#define kStringBoundary @"3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f"
|
||||
#define kNewline @"\r\n"
|
||||
|
||||
@implementation FBSDKGraphRequestBody
|
||||
{
|
||||
NSMutableData *_data;
|
||||
NSMutableDictionary *_json;
|
||||
NSString *_stringBoundary;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
_stringBoundary = [FBSDKCrypto randomString:32];
|
||||
_data = [[NSMutableData alloc] init];
|
||||
_json = [NSMutableDictionary dictionary];
|
||||
}
|
||||
@ -46,14 +48,14 @@
|
||||
if (_json) {
|
||||
return @"application/json";
|
||||
} else {
|
||||
return [NSString stringWithFormat:@"multipart/form-data; boundary=%@",kStringBoundary];
|
||||
return [NSString stringWithFormat:@"multipart/form-data; boundary=%@", _stringBoundary];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)appendUTF8:(NSString *)utf8
|
||||
{
|
||||
if (![_data length]) {
|
||||
NSString *headerUTF8 = [NSString stringWithFormat:@"--%@%@", kStringBoundary, kNewline];
|
||||
if (!_data.length) {
|
||||
NSString *headerUTF8 = [NSString stringWithFormat:@"--%@%@", _stringBoundary, kNewline];
|
||||
NSData *headerData = [headerUTF8 dataUsingEncoding:NSUTF8StringEncoding];
|
||||
[_data appendData:headerData];
|
||||
}
|
||||
@ -69,7 +71,7 @@
|
||||
[self appendUTF8:value];
|
||||
}];
|
||||
if (key && value) {
|
||||
[_json setObject:value forKey:key];
|
||||
_json[key] = value;
|
||||
}
|
||||
[logger appendFormat:@"\n %@:\t%@", key, (NSString *)value];
|
||||
}
|
||||
@ -83,7 +85,7 @@
|
||||
[self->_data appendData:data];
|
||||
}];
|
||||
_json = nil;
|
||||
[logger appendFormat:@"\n %@:\t<Image - %lu kB>", key, (unsigned long)([data length] / 1024)];
|
||||
[logger appendFormat:@"\n %@:\t<Image - %lu kB>", key, (unsigned long)(data.length / 1024)];
|
||||
}
|
||||
|
||||
- (void)appendWithKey:(NSString *)key
|
||||
@ -94,7 +96,7 @@
|
||||
[self->_data appendData:data];
|
||||
}];
|
||||
_json = nil;
|
||||
[logger appendFormat:@"\n %@:\t<Data - %lu kB>", key, (unsigned long)([data length] / 1024)];
|
||||
[logger appendFormat:@"\n %@:\t<Data - %lu kB>", key, (unsigned long)(data.length / 1024)];
|
||||
}
|
||||
|
||||
- (void)appendWithKey:(NSString *)key
|
||||
@ -108,7 +110,7 @@
|
||||
[self->_data appendData:data];
|
||||
}];
|
||||
_json = nil;
|
||||
[logger appendFormat:@"\n %@:\t<Data - %lu kB>", key, (unsigned long)([data length] / 1024)];
|
||||
[logger appendFormat:@"\n %@:\t<Data - %lu kB>", key, (unsigned long)(data.length / 1024)];
|
||||
}
|
||||
|
||||
- (NSData *)data
|
||||
@ -147,7 +149,7 @@
|
||||
if (contentBlock != NULL) {
|
||||
contentBlock();
|
||||
}
|
||||
[self appendUTF8:[[NSString alloc] initWithFormat:@"%@--%@%@", kNewline, kStringBoundary, kNewline]];
|
||||
[self appendUTF8:[[NSString alloc] initWithFormat:@"%@--%@%@", kNewline, _stringBoundary, kNewline]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -29,6 +29,9 @@
|
||||
@property (nonatomic, copy) FBSDKGraphRequestHandler completionHandler;
|
||||
@property (nonatomic, copy) NSDictionary *batchParameters;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
|
||||
- (instancetype)initWithRequest:(FBSDKGraphRequest *)request
|
||||
completionHandler:(FBSDKGraphRequestHandler)handler
|
||||
batchParameters:(NSDictionary *)batchParameters
|
||||
|
||||
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