- add getEnvironment in PNObjectConfig
This commit is contained in:
1 parent
f42c646dcb
commit
872d8a78dd
123 files changed
+11697
-3828
No files matched your search
@@ -97,6 +97,14 @@ FBSDK_EXTERN NSString *const FBSDKAppEventNameViewedContent;
|
||||
of methods on `FBSDKAppEvents`. Common event names are provided in the `FBAppEventName*` constants.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Parameter key used to specify data for the one or more pieces of content being logged about.
|
||||
* Data should be a JSON encoded string.
|
||||
* Example:
|
||||
* "[{\"id\": \"1234\", \"quantity\": 2, \"item_price\": 5.99}, {\"id\": \"5678\", \"quantity\": 1, \"item_price\": 9.99}]"
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameContent;
|
||||
|
||||
/** Parameter key used to specify an ID for the specific piece of content being logged about. Could be an EAN, article identifier, etc., depending on the nature of the app. */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameContentID;
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ NSString *const FBSDKAppEventNameSpentCredits = @"fb_mobile_spent_cre
|
||||
NSString *const FBSDKAppEventParameterNameCurrency = @"fb_currency";
|
||||
NSString *const FBSDKAppEventParameterNameRegistrationMethod = @"fb_registration_method";
|
||||
NSString *const FBSDKAppEventParameterNameContentType = @"fb_content_type";
|
||||
NSString *const FBSDKAppEventParameterNameContent = @"fb_content";
|
||||
NSString *const FBSDKAppEventParameterNameContentID = @"fb_content_id";
|
||||
NSString *const FBSDKAppEventParameterNameSearchString = @"fb_search_string";
|
||||
NSString *const FBSDKAppEventParameterNameSuccess = @"fb_success";
|
||||
@@ -153,6 +154,8 @@ NSString *const FBSDKAppEventParameterDialogOutcome = @"fb_dialog_
|
||||
NSString *const FBSDKAppEventParameterDialogErrorMessage = @"fb_dialog_outcome_error_message";
|
||||
NSString *const FBSDKAppEventParameterDialogMode = @"fb_dialog_mode";
|
||||
NSString *const FBSDKAppEventParameterDialogShareContentType = @"fb_dialog_share_content_type";
|
||||
NSString *const FBSDKAppEventParameterDialogShareContentUUID = @"fb_dialog_share_content_uuid";
|
||||
NSString *const FBSDKAppEventParameterDialogShareContentPageID = @"fb_dialog_share_content_page_id";
|
||||
NSString *const FBSDKAppEventParameterShareTrayActivityName = @"fb_share_tray_activity";
|
||||
NSString *const FBSDKAppEventParameterShareTrayResult = @"fb_share_tray_result";
|
||||
NSString *const FBSDKAppEventParameterLogTime = @"_logTime";
|
||||
@@ -173,11 +176,15 @@ NSString *const FBSDKAppEventsDialogShareModeFeedBrowser = @"FeedBrowser";
|
||||
NSString *const FBSDKAppEventsDialogShareModeFeedWeb = @"FeedWeb";
|
||||
NSString *const FBSDKAppEventsDialogShareModeUnknown = @"Unknown";
|
||||
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeOpenGraph = @"OpenGraph";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeStatus = @"Status";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypePhoto = @"Photo";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeVideo = @"Video";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeUnknown = @"Unknown";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeOpenGraph = @"OpenGraph";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeStatus = @"Status";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypePhoto = @"Photo";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeVideo = @"Video";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeCamera = @"Camera";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeMessengerGenericTemplate = @"GenericTemplate";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeMessengerMediaTemplate = @"MediaTemplate";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeMessengerOpenGraphMusicTemplate = @"OpenGraphMusicTemplate";
|
||||
NSString *const FBSDKAppEventsDialogShareContentTypeUnknown = @"Unknown";
|
||||
|
||||
NSString *const FBSDKAppEventsLoggingResultNotification = @"com.facebook.sdk:FBSDKAppEventsLoggingResultNotification";
|
||||
|
||||
@@ -328,7 +335,7 @@ static NSString *g_overrideAppID = nil;
|
||||
[[FBSDKAppEvents singleton] instanceLogEvent:eventName
|
||||
valueToSum:valueToSum
|
||||
parameters:parameters
|
||||
isImplicitlyLogged:NO
|
||||
isImplicitlyLogged:(BOOL)parameters[FBSDKAppEventParameterImplicitlyLogged]
|
||||
accessToken:accessToken];
|
||||
}
|
||||
|
||||
@@ -685,7 +692,6 @@ static NSString *g_overrideAppID = nil;
|
||||
if (isImplicitlyLogged) {
|
||||
eventDictionary[FBSDKAppEventParameterImplicitlyLogged] = @"1";
|
||||
}
|
||||
[FBSDKInternalUtility dictionary:eventDictionary setObject:_userID forKey:@"_app_user_id"];
|
||||
|
||||
NSString *currentViewControllerName;
|
||||
if ([NSThread isMainThread]) {
|
||||
@@ -783,6 +789,7 @@ static NSString *g_overrideAppID = nil;
|
||||
[FBSDKAppEventsUtility ensureOnMainThread:NSStringFromSelector(_cmd) className:NSStringFromClass([self class])];
|
||||
|
||||
[self fetchServerConfiguration:^(void) {
|
||||
NSString *receipt_data = [appEventsState extractReceiptData];
|
||||
NSString *JSONString = [appEventsState JSONStringForEvents:_serverConfiguration.implicitLoggingEnabled];
|
||||
NSData *encodedEvents = [JSONString dataUsingEncoding:NSUTF8StringEncoding];
|
||||
if (!encodedEvents) {
|
||||
@@ -794,6 +801,11 @@ static NSString *g_overrideAppID = nil;
|
||||
activityParametersDictionaryForEvent:@"CUSTOM_APP_EVENTS"
|
||||
implicitEventsOnly:appEventsState.areAllEventsImplicit
|
||||
shouldAccessAdvertisingID:_serverConfiguration.advertisingIDEnabled];
|
||||
NSInteger length = [receipt_data length];
|
||||
if (length > 0) {
|
||||
postParameters[@"receipt_data"] = receipt_data;
|
||||
}
|
||||
|
||||
postParameters[@"custom_events_file"] = encodedEvents;
|
||||
if (appEventsState.numSkipped > 0) {
|
||||
postParameters[@"num_skipped_events"] = [NSString stringWithFormat:@"%lu", (unsigned long)appEventsState.numSkipped];
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#import <Bolts/BFTask.h>
|
||||
#import <Bolts/BFTaskCompletionSource.h>
|
||||
|
||||
#import "FBSDKAccessToken.h"
|
||||
#import "FBSDKGraphRequest+Internal.h"
|
||||
#import "FBSDKGraphRequestConnection.h"
|
||||
#import "FBSDKInternalUtility.h"
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@
|
||||
- Parameter annotation: The annotation as passed to [UIApplicationDelegate application:openURL:sourceApplication:annotation:].
|
||||
|
||||
- Returns: YES if the url was intended for the Facebook SDK, NO if not.
|
||||
*/
|
||||
*/
|
||||
- (BOOL)application:(UIApplication *)application
|
||||
openURL:(NSURL *)url
|
||||
sourceApplication:(NSString *)sourceApplication
|
||||
|
||||
+39
-1
@@ -172,6 +172,12 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
completion:completePendingOpenURLBlock];
|
||||
_safariViewController = nil;
|
||||
} else {
|
||||
#ifdef __IPHONE_11_0
|
||||
if (_authenticationSession != nil) {
|
||||
[_authenticationSession cancel];
|
||||
_authenticationSession = nil;
|
||||
}
|
||||
#endif
|
||||
completePendingOpenURLBlock();
|
||||
}
|
||||
if ([pendingURLOpen canOpenURL:url
|
||||
@@ -196,6 +202,7 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
// fetch app settings
|
||||
[FBSDKServerConfigurationManager loadServerConfigurationWithCompletionBlock:NULL];
|
||||
|
||||
[self _logSDKInitialize];
|
||||
#if !TARGET_OS_TV
|
||||
FBSDKProfile *cachedProfile = [FBSDKProfile fetchCachedProfile];
|
||||
[FBSDKProfile setCurrentProfile:cachedProfile];
|
||||
@@ -234,7 +241,13 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
// _expectingBackground can be YES if the caller started doing work (like login)
|
||||
// within the app delegate's lifecycle like openURL, in which case there
|
||||
// might have been a "didBecomeActive" event pending that we want to ignore.
|
||||
if (!_expectingBackground && !_safariViewController && !_isDismissingSafariViewController) {
|
||||
BOOL notExpectingBackground = !_expectingBackground && !_safariViewController && !_isDismissingSafariViewController;
|
||||
#if !TARGET_OS_TV
|
||||
#ifdef __IPHONE_11_0
|
||||
notExpectingBackground = notExpectingBackground && !_authenticationSession;
|
||||
#endif
|
||||
#endif
|
||||
if (notExpectingBackground) {
|
||||
_active = YES;
|
||||
#if !TARGET_OS_TV
|
||||
[_pendingURLOpen applicationDidBecomeActive:[notification object]];
|
||||
@@ -474,6 +487,31 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
accessToken:nil];
|
||||
}
|
||||
|
||||
- (void)_logSDKInitialize
|
||||
{
|
||||
NSMutableDictionary *params = [NSMutableDictionary new];
|
||||
[params setObject:@1 forKey:@"core_lib_included"];
|
||||
if (objc_lookUpClass("FBSDKShareDialog") != nil) {
|
||||
[params setObject:@1 forKey:@"share_lib_included"];
|
||||
}
|
||||
if (objc_lookUpClass("FBSDKLoginManager") != nil) {
|
||||
[params setObject:@1 forKey:@"login_lib_included"];
|
||||
}
|
||||
if (objc_lookUpClass("FBSDKPlacesManager") != nil) {
|
||||
[params setObject:@1 forKey:@"places_lib_included"];
|
||||
}
|
||||
if (objc_lookUpClass("FBSDKMessengerButton") != nil) {
|
||||
[params setObject:@1 forKey:@"messenger_lib_included"];
|
||||
}
|
||||
if (objc_lookUpClass("FBSDKMessengerButton") != nil) {
|
||||
[params setObject:@1 forKey:@"messenger_lib_included"];
|
||||
}
|
||||
if (objc_lookUpClass("FBSDKTVInterfaceFactory.m") != nil) {
|
||||
[params setObject:@1 forKey:@"tv_lib_included"];
|
||||
}
|
||||
[FBSDKAppEvents logEvent:@"fb_sdk_initialize" parameters:params];
|
||||
}
|
||||
|
||||
#pragma mark -- (non-tvos)
|
||||
#if !TARGET_OS_TV
|
||||
- (BOOL)_handleBridgeAPIResponseURL:(NSURL *)responseURL sourceApplication:(NSString *)sourceApplication
|
||||
|
||||
@@ -148,7 +148,7 @@ FBSDK_EXTERN NSString *const FBSDKErrorArgumentCollectionKey;
|
||||
FBSDK_EXTERN NSString *const FBSDKErrorArgumentNameKey;
|
||||
|
||||
/**
|
||||
The userInfo key for the invalid argument value for errors with FBSDKInvalidArgumentErrorCode.
|
||||
The userInfo key for the invalid argument value for errors with FBSDKInvalidArgumentErrorCode.
|
||||
*/
|
||||
FBSDK_EXTERN NSString *const FBSDKErrorArgumentValueKey;
|
||||
|
||||
|
||||
@@ -44,5 +44,5 @@
|
||||
#import <FBSDKCoreKit/FBSDKDeviceViewControllerBase.h>
|
||||
#endif
|
||||
|
||||
#define FBSDK_VERSION_STRING @"4.26.0"
|
||||
#define FBSDK_TARGET_PLATFORM_VERSION @"v2.10"
|
||||
#define FBSDK_VERSION_STRING @"4.29.0"
|
||||
#define FBSDK_TARGET_PLATFORM_VERSION @"v2.11"
|
||||
+2
-2
@@ -87,7 +87,7 @@ NSURLSessionDataDelegate
|
||||
@property (nonatomic, retain) NSMutableArray *requests;
|
||||
@property (nonatomic, assign) FBSDKGraphRequestConnectionState state;
|
||||
@property (nonatomic, strong) FBSDKLogger *logger;
|
||||
@property (nonatomic, assign) unsigned long requestStartTime;
|
||||
@property (nonatomic, assign) uint64_t requestStartTime;
|
||||
|
||||
@end
|
||||
|
||||
@@ -540,7 +540,7 @@ NSURLSessionDataDelegate
|
||||
error = [FBSDKError errorWithCode:FBSDKGraphRequestProtocolMismatchErrorCode
|
||||
message:@"Unexpected number of results returned from server."];
|
||||
} else {
|
||||
[_logger appendFormat:@"Response <#%lu>\nDuration: %lu msec\nSize: %lu kB\nResponse Body:\n%@\n\n",
|
||||
[_logger appendFormat:@"Response <#%lu>\nDuration: %llu msec\nSize: %lu kB\nResponse Body:\n%@\n\n",
|
||||
(unsigned long)[_logger loggerSerialNumber],
|
||||
[FBSDKInternalUtility currentTimeInMilliseconds] - _requestStartTime,
|
||||
(unsigned long)[data length],
|
||||
|
||||
@@ -88,7 +88,7 @@ static FBSDKProfile *g_currentProfile;
|
||||
{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
NSString *path = [self imagePathForPictureMode:FBSDKProfilePictureModeNormal size:size];
|
||||
NSString *path = [self imagePathForPictureMode:mode size:size];
|
||||
#pragma clang diagnostic pop
|
||||
return [FBSDKInternalUtility facebookURLWithHostPrefix:@"graph"
|
||||
path:path
|
||||
@@ -278,9 +278,14 @@ static FBSDKProfile *g_currentProfile;
|
||||
{
|
||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
NSData *data = [userDefaults objectForKey:FBSDKProfileUserDefaultsKey];
|
||||
return (data != nil)
|
||||
? [NSKeyedUnarchiver unarchiveObjectWithData:data]
|
||||
: nil;
|
||||
if (data != nil) {
|
||||
@try {
|
||||
return [NSKeyedUnarchiver unarchiveObjectWithData:data];
|
||||
} @catch (NSException *exception) {
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#import "FBSDKSettings+Internal.h"
|
||||
|
||||
#import "FBSDKAccessTokenCache.h"
|
||||
#import "FBSDKCoreKit.h"
|
||||
|
||||
#define FBSDKSETTINGS_PLIST_CONFIGURATION_SETTING_IMPL(TYPE, PLIST_KEY, GETTER, SETTER, DEFAULT_VALUE) \
|
||||
@@ -44,7 +45,7 @@ NSString *const FBSDKLoggingBehaviorGraphAPIDebugWarning = @"graph_api_debug_war
|
||||
NSString *const FBSDKLoggingBehaviorGraphAPIDebugInfo = @"graph_api_debug_info";
|
||||
NSString *const FBSDKLoggingBehaviorNetworkRequests = @"network_requests";
|
||||
|
||||
static FBSDKAccessTokenCache *g_tokenCache;
|
||||
static NSObject<FBSDKAccessTokenCaching> *g_tokenCache;
|
||||
static NSMutableSet *g_loggingBehavior;
|
||||
static NSString *g_legacyUserDefaultTokenInformationKeyName = @"FBAccessTokenInformationKey";
|
||||
static NSString *const FBSDKSettingsLimitEventAndDataUsage = @"com.facebook.sdk:FBSDKSettingsLimitEventAndDataUsage";
|
||||
@@ -177,12 +178,12 @@ FBSDKSETTINGS_PLIST_CONFIGURATION_SETTING_IMPL(NSNumber, FacebookAutoLogAppEvent
|
||||
|
||||
#pragma mark - Internal
|
||||
|
||||
+ (FBSDKAccessTokenCache *)accessTokenCache
|
||||
+ (NSObject<FBSDKAccessTokenCaching> *)accessTokenCache
|
||||
{
|
||||
return g_tokenCache;
|
||||
}
|
||||
|
||||
- (void)setAccessTokenCache:(FBSDKAccessTokenCache *)cache
|
||||
+ (void)setAccessTokenCache:(NSObject<FBSDKAccessTokenCaching> *)cache
|
||||
{
|
||||
if (g_tokenCache != cache) {
|
||||
g_tokenCache = cache;
|
||||
|
||||
Generated
+6
@@ -105,6 +105,8 @@ FBSDK_EXTERN NSString *const FBSDKAppEventNameFBSDKEventAppInviteShareDialogShow
|
||||
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogMode;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogShareContentType;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogShareContentUUID;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterDialogShareContentPageID;
|
||||
|
||||
/*! Use to log parameters for share tray use */
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventParameterShareTrayActivityName;
|
||||
@@ -120,6 +122,10 @@ FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeOpenGraph;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeStatus;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypePhoto;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeVideo;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeCamera;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeMessengerGenericTemplate;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeMessengerMediaTemplate;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeMessengerOpenGraphMusicTemplate;
|
||||
FBSDK_EXTERN NSString *const FBSDKAppEventsDialogShareContentTypeUnknown;
|
||||
|
||||
|
||||
|
||||
Generated
+1
@@ -34,5 +34,6 @@
|
||||
- (BOOL)isCompatibleWithAppEventsState:(FBSDKAppEventsState *)appEventsState;
|
||||
- (BOOL)isCompatibleWithTokenString:(NSString *)tokenString appID:(NSString *)appID;
|
||||
- (NSString *)JSONStringForEvents:(BOOL)includeImplicitEvents;
|
||||
- (NSString *)extractReceiptData;
|
||||
|
||||
@end
|
||||
Generated
+28
-1
@@ -29,6 +29,8 @@
|
||||
#define FBSDK_APPEVENTSSTATE_EVENTS_KEY @"events"
|
||||
#define FBSDK_APPEVENTSSTATE_NUMSKIPPED_KEY @"numSkipped"
|
||||
#define FBSDK_APPEVENTSSTATE_TOKENSTRING_KEY @"tokenString"
|
||||
#define FBSDK_APPEVENTSTATE_RECEIPTDATA_KEY @"receipt_data"
|
||||
#define FBSDK_APPEVENTSTATE_RECEIPTID_KEY @"receipt_id"
|
||||
|
||||
@implementation FBSDKAppEventsState
|
||||
{
|
||||
@@ -122,6 +124,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)extractReceiptData {
|
||||
NSMutableString *receipts_string = [NSMutableString string];
|
||||
NSInteger transactionId = 1;
|
||||
for (NSMutableDictionary* events in _mutableEvents) {
|
||||
NSMutableDictionary *event = events[@"event"];
|
||||
|
||||
NSString* receipt = event[@"receipt_data"];
|
||||
// Add receipt id as the identifier for receipt data in event parameter.
|
||||
// Receipt data will be sent as post parameter rather than the event parameter
|
||||
if (receipt) {
|
||||
NSString* idKey = [NSString stringWithFormat:@"receipt_%ld", (long)transactionId];
|
||||
event[FBSDK_APPEVENTSTATE_RECEIPTID_KEY] = idKey;
|
||||
NSString* receiptWithId = [NSString stringWithFormat:@"%@::%@;;;", idKey, receipt];
|
||||
[receipts_string appendString:receiptWithId];
|
||||
transactionId++;
|
||||
}
|
||||
}
|
||||
return receipts_string;
|
||||
}
|
||||
|
||||
- (BOOL)areAllEventsImplicit
|
||||
{
|
||||
for (NSDictionary *event in _mutableEvents) {
|
||||
@@ -153,9 +175,14 @@
|
||||
if (!includeImplicitEvents && [eventAndImplicitFlag[FBSDK_APPEVENTSTATE_ISIMPLICIT_KEY] boolValue]) {
|
||||
continue;
|
||||
}
|
||||
[events addObject:eventAndImplicitFlag[@"event"]];
|
||||
NSMutableDictionary *event = eventAndImplicitFlag[@"event"];
|
||||
NSAssert(event != nil, @"event cannot be nil");
|
||||
[event removeObjectForKey:FBSDK_APPEVENTSTATE_RECEIPTDATA_KEY];
|
||||
|
||||
[events addObject:event];
|
||||
}
|
||||
|
||||
return [FBSDKInternalUtility JSONStringForObject:events error:NULL invalidObjectHandler:NULL];
|
||||
}
|
||||
|
||||
@end
|
||||
Generated
+5
@@ -62,6 +62,11 @@
|
||||
|
||||
parameters[@"application_tracking_enabled"] = [@(!FBSDKSettings.limitEventAndDataUsage) stringValue];
|
||||
|
||||
NSString *userID = [FBSDKAppEvents userID];
|
||||
if (userID) {
|
||||
parameters[@"app_user_id"] = userID;
|
||||
}
|
||||
|
||||
[FBSDKAppEventsDeviceInfo extendDictionaryWithDeviceInfo:parameters];
|
||||
|
||||
static dispatch_once_t fetchBundleOnce;
|
||||
|
||||
Generated
+31
-11
@@ -25,7 +25,7 @@
|
||||
#import "FBSDKLogger.h"
|
||||
#import "FBSDKSettings.h"
|
||||
|
||||
static NSString *const FBSDKAppEventParameterImplicitlyLoggedPurchase = @"_implicitlyLoggedPurchaseEvent";
|
||||
static NSString *const FBSDKAppEventParameterImplicitlyLoggedPurchase = @"_implicitlyLogged";
|
||||
static NSString *const FBSDKAppEventNamePurchaseFailed = @"fb_mobile_purchase_failed";
|
||||
static NSString *const FBSDKAppEventParameterNameProductTitle = @"fb_content_title";
|
||||
static NSString *const FBSDKAppEventParameterNameTransactionID = @"fb_transaction_id";
|
||||
@@ -121,6 +121,10 @@ static NSMutableArray *g_pendingRequestors;
|
||||
|
||||
- (void)handleTransaction:(SKPaymentTransaction *)transaction
|
||||
{
|
||||
// Ignore restored transaction
|
||||
if (transaction.originalTransaction != nil) {
|
||||
return;
|
||||
}
|
||||
FBSDKPaymentProductRequestor *productRequest = [[FBSDKPaymentProductRequestor alloc] initWithTransaction:transaction];
|
||||
[productRequest resolveProducts];
|
||||
}
|
||||
@@ -207,18 +211,18 @@ static NSMutableArray *g_pendingRequestors;
|
||||
|
||||
SKPayment *payment = self.transaction.payment;
|
||||
NSMutableDictionary *eventParameters = [NSMutableDictionary dictionaryWithDictionary: @{
|
||||
FBSDKAppEventParameterNameContentID: payment.productIdentifier ?: @"",
|
||||
FBSDKAppEventParameterNameNumItems: @(payment.quantity),
|
||||
}];
|
||||
FBSDKAppEventParameterNameContentID: payment.productIdentifier ?: @"",
|
||||
FBSDKAppEventParameterNameNumItems: @(payment.quantity),
|
||||
}];
|
||||
double totalAmount = 0;
|
||||
if (product) {
|
||||
totalAmount = payment.quantity * product.price.doubleValue;
|
||||
[eventParameters addEntriesFromDictionary: @{
|
||||
FBSDKAppEventParameterNameCurrency: [product.priceLocale objectForKey:NSLocaleCurrencyCode],
|
||||
FBSDKAppEventParameterNameNumItems: @(payment.quantity),
|
||||
FBSDKAppEventParameterNameProductTitle: [self getTruncatedString:product.localizedTitle],
|
||||
FBSDKAppEventParameterNameDescription: [self getTruncatedString:product.localizedDescription],
|
||||
}];
|
||||
FBSDKAppEventParameterNameCurrency: [product.priceLocale objectForKey:NSLocaleCurrencyCode],
|
||||
FBSDKAppEventParameterNameNumItems: @(payment.quantity),
|
||||
FBSDKAppEventParameterNameProductTitle: [self getTruncatedString:product.localizedTitle],
|
||||
FBSDKAppEventParameterNameDescription: [self getTruncatedString:product.localizedDescription],
|
||||
}];
|
||||
if (transactionID) {
|
||||
[eventParameters setObject:transactionID forKey:FBSDKAppEventParameterNameTransactionID];
|
||||
}
|
||||
@@ -266,10 +270,19 @@ static NSMutableArray *g_pendingRequestors;
|
||||
valueToSum:(double)valueToSum
|
||||
parameters:(NSDictionary *)parameters {
|
||||
NSMutableDictionary *eventParameters = [NSMutableDictionary dictionaryWithDictionary:parameters];
|
||||
[eventParameters setObject:@"1" forKey:FBSDKAppEventParameterImplicitlyLoggedPurchase];
|
||||
|
||||
if ([eventName isEqualToString:FBSDKAppEventNamePurchased]) {
|
||||
NSData* receipt = [self fetchDeviceReceipt];
|
||||
if (receipt) {
|
||||
NSString *base64encodedReceipt = [receipt base64EncodedStringWithOptions:0];
|
||||
eventParameters[@"receipt_data"] = base64encodedReceipt;
|
||||
}
|
||||
}
|
||||
|
||||
[eventParameters setObject:@"1"forKey:FBSDKAppEventParameterImplicitlyLoggedPurchase];
|
||||
[FBSDKAppEvents logEvent:eventName
|
||||
valueToSum:valueToSum
|
||||
parameters:parameters];
|
||||
parameters:eventParameters];
|
||||
|
||||
// Unless the behavior is set to only allow explicit flushing, we go ahead and flush, since purchase events
|
||||
// are relatively rare and relatively high value and worth getting across on wire right away.
|
||||
@@ -278,4 +291,11 @@ static NSMutableArray *g_pendingRequestors;
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch the current receipt for this application.
|
||||
- (NSData*)fetchDeviceReceipt {
|
||||
NSURL *receiptURL = [[NSBundle bundleForClass:[self class]] appStoreReceiptURL];
|
||||
NSData *receipt = [NSData dataWithContentsOfURL:receiptURL];
|
||||
return receipt;
|
||||
}
|
||||
|
||||
@end
|
||||
Generated
+2
-1
@@ -60,7 +60,8 @@ NSString *const FBSDKBridgeAPIVersionKey = @"version";
|
||||
_protocolMap = @{
|
||||
@(FBSDKBridgeAPIProtocolTypeNative): @{
|
||||
FBSDK_CANOPENURL_FACEBOOK:[[FBSDKBridgeAPIProtocolNativeV1 alloc] initWithAppScheme:@"fbapi20130214"],
|
||||
FBSDK_CANOPENURL_MESSENGER:[[FBSDKBridgeAPIProtocolNativeV1 alloc] initWithAppScheme:@"fb-messenger-api20140430"]
|
||||
FBSDK_CANOPENURL_MESSENGER:[[FBSDKBridgeAPIProtocolNativeV1 alloc] initWithAppScheme:@"fb-messenger-share-api"],
|
||||
FBSDK_CANOPENURL_MSQRD_PLAYER:[[FBSDKBridgeAPIProtocolNativeV1 alloc] initWithAppScheme:@"msqrdplayer-api20170208"]
|
||||
},
|
||||
@(FBSDKBridgeAPIProtocolTypeWeb): @{
|
||||
@"https": [[FBSDKBridgeAPIProtocolWebV1 alloc] init],
|
||||
|
||||
+1
@@ -61,6 +61,7 @@
|
||||
#import "FBSDKInternalUtility.h"
|
||||
#import "FBSDKLogger.h"
|
||||
#import "FBSDKMath.h"
|
||||
#import "FBSDKSettings+Internal.h"
|
||||
#import "FBSDKTypeUtility.h"
|
||||
#import "Network/FBSDKGraphRequest+Internal.h"
|
||||
#import "Network/FBSDKGraphRequestConnection+Internal.h"
|
||||
|
||||
+4
-2
@@ -21,7 +21,8 @@
|
||||
|
||||
#define FBSDK_CANOPENURL_FACEBOOK @"fbauth2"
|
||||
#define FBSDK_CANOPENURL_FBAPI @"fbapi"
|
||||
#define FBSDK_CANOPENURL_MESSENGER @"fb-messenger-api"
|
||||
#define FBSDK_CANOPENURL_MESSENGER @"fb-messenger-share-api"
|
||||
#define FBSDK_CANOPENURL_MSQRD_PLAYER @"msqrdplayer"
|
||||
#define FBSDK_CANOPENURL_SHARE_EXTENSION @"fbshareextension"
|
||||
|
||||
typedef NS_ENUM(int32_t, FBSDKUIKitVersion)
|
||||
@@ -88,7 +89,7 @@ typedef NS_ENUM(int32_t, FBSDKUIKitVersion)
|
||||
Changes in the system clock will affect this value.
|
||||
- Returns: The number of milliseconds since the Unix Epoch.
|
||||
*/
|
||||
+ (unsigned long)currentTimeInMilliseconds;
|
||||
+ (uint64_t)currentTimeInMilliseconds;
|
||||
|
||||
/**
|
||||
Sets an object for a key in a dictionary if it is not nil.
|
||||
@@ -347,6 +348,7 @@ setJSONStringForObject:(id)object
|
||||
|
||||
+ (BOOL)isFacebookAppInstalled;
|
||||
+ (BOOL)isMessengerAppInstalled;
|
||||
+ (BOOL)isMSQRDPlayerAppInstalled;
|
||||
+ (void)checkRegisteredCanOpenURLScheme:(NSString *)urlScheme;
|
||||
+ (BOOL)isRegisteredCanOpenURLScheme:(NSString *)urlScheme;
|
||||
|
||||
|
||||
+20
-12
@@ -110,11 +110,11 @@ typedef NS_ENUM(NSUInteger, FBSDKInternalUtilityVersionShift)
|
||||
return value;
|
||||
}
|
||||
|
||||
+ (unsigned long)currentTimeInMilliseconds
|
||||
+ (uint64_t)currentTimeInMilliseconds
|
||||
{
|
||||
struct timeval time;
|
||||
gettimeofday(&time, NULL);
|
||||
return (time.tv_sec * 1000) + (time.tv_usec / 1000);
|
||||
return ((uint64_t)time.tv_sec * 1000) + (time.tv_usec / 1000);
|
||||
}
|
||||
|
||||
+ (BOOL)dictionary:(NSMutableDictionary *)dictionary
|
||||
@@ -493,11 +493,7 @@ static NSMapTable *_transientObjects;
|
||||
dispatch_once(&onceToken, ^{
|
||||
[FBSDKInternalUtility checkRegisteredCanOpenURLScheme:FBSDK_CANOPENURL_FACEBOOK];
|
||||
});
|
||||
NSURLComponents *components = [[NSURLComponents alloc] init];
|
||||
components.scheme = FBSDK_CANOPENURL_FACEBOOK;
|
||||
components.path = @"/";
|
||||
return [[UIApplication sharedApplication]
|
||||
canOpenURL:components.URL];
|
||||
return [self _canOpenURLScheme:FBSDK_CANOPENURL_FACEBOOK];
|
||||
}
|
||||
|
||||
+ (BOOL)isMessengerAppInstalled
|
||||
@@ -506,12 +502,16 @@ static NSMapTable *_transientObjects;
|
||||
dispatch_once(&onceToken, ^{
|
||||
[FBSDKInternalUtility checkRegisteredCanOpenURLScheme:FBSDK_CANOPENURL_MESSENGER];
|
||||
});
|
||||
NSURLComponents *components = [[NSURLComponents alloc] init];
|
||||
components.scheme = FBSDK_CANOPENURL_MESSENGER;
|
||||
components.path = @"/";
|
||||
return [[UIApplication sharedApplication]
|
||||
canOpenURL:components.URL];
|
||||
return [self _canOpenURLScheme:FBSDK_CANOPENURL_MESSENGER];
|
||||
}
|
||||
|
||||
+ (BOOL)isMSQRDPlayerAppInstalled
|
||||
{
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
[FBSDKInternalUtility checkRegisteredCanOpenURLScheme:FBSDK_CANOPENURL_MSQRD_PLAYER];
|
||||
});
|
||||
return [self _canOpenURLScheme:FBSDK_CANOPENURL_MSQRD_PLAYER];
|
||||
}
|
||||
|
||||
#pragma mark - Object Lifecycle
|
||||
@@ -583,6 +583,14 @@ static NSMapTable *_transientObjects;
|
||||
return object;
|
||||
}
|
||||
|
||||
+ (BOOL)_canOpenURLScheme:(NSString *)scheme
|
||||
{
|
||||
NSURLComponents *components = [[NSURLComponents alloc] init];
|
||||
components.scheme = scheme;
|
||||
components.path = @"/";
|
||||
return [[UIApplication sharedApplication] canOpenURL:components.URL];
|
||||
}
|
||||
|
||||
+ (void)validateAppID
|
||||
{
|
||||
if (![FBSDKSettings appID]) {
|
||||
|
||||
+4
-4
@@ -163,11 +163,11 @@ static NSMutableDictionary *g_startTimesWithTags = nil;
|
||||
|
||||
// Only log if there's been an associated start time.
|
||||
if (startTimeNumber) {
|
||||
unsigned long elapsed = [FBSDKInternalUtility currentTimeInMilliseconds] - startTimeNumber.unsignedLongValue;
|
||||
uint64_t elapsed = [FBSDKInternalUtility currentTimeInMilliseconds] - startTimeNumber.unsignedLongLongValue;
|
||||
[g_startTimesWithTags removeObjectForKey:tagAsNumber]; // served its purpose, remove
|
||||
|
||||
// Log string is appended with "%d msec", with nothing intervening. This gives the most control to the caller.
|
||||
logString = [NSString stringWithFormat:@"%@%lu msec", logString, elapsed];
|
||||
logString = [NSString stringWithFormat:@"%@%llu msec", logString, elapsed];
|
||||
|
||||
[self singleShotLogEntry:loggingBehavior logEntry:logString];
|
||||
}
|
||||
@@ -188,12 +188,12 @@ static NSMutableDictionary *g_startTimesWithTags = nil;
|
||||
@"Unexpectedly large number of outstanding perf logging start times, something is likely wrong."];
|
||||
}
|
||||
|
||||
unsigned long currTime = [FBSDKInternalUtility currentTimeInMilliseconds];
|
||||
uint64_t currTime = [FBSDKInternalUtility currentTimeInMilliseconds];
|
||||
|
||||
// Treat the incoming object tag simply as an address, since it's only used to identify during lifetime. If
|
||||
// we send in as an object, the dictionary will try to copy it.
|
||||
unsigned long tagAsNumber = (unsigned long)(__bridge void *)timestampTag;
|
||||
[g_startTimesWithTags setObject:[NSNumber numberWithUnsignedLong:currTime]
|
||||
[g_startTimesWithTags setObject:@(currTime)
|
||||
forKey:[NSNumber numberWithUnsignedLong:tagAsNumber]];
|
||||
}
|
||||
}
|
||||
|
||||
+5
-4
@@ -16,14 +16,15 @@
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#import "FBSDKAccessTokenCache.h"
|
||||
#import "FBSDKSettings.h"
|
||||
#import <FBSDKCoreKit/FBSDKSettings.h>
|
||||
|
||||
@protocol FBSDKAccessTokenCaching;
|
||||
|
||||
@interface FBSDKSettings(Internal)
|
||||
|
||||
+ (FBSDKAccessTokenCache *)accessTokenCache;
|
||||
+ (NSObject<FBSDKAccessTokenCaching> *)accessTokenCache;
|
||||
|
||||
- (void)setAccessTokenCache;
|
||||
+ (void)setAccessTokenCache:(NSObject<FBSDKAccessTokenCaching> *)accessTokenCache;
|
||||
|
||||
+ (NSString *)graphAPIDebugParamValue;
|
||||
|
||||
|
||||
Generated
+1
@@ -18,6 +18,7 @@
|
||||
|
||||
#import "FBSDKSystemAccountStoreAdapter.h"
|
||||
|
||||
#import "FBSDKAccessToken.h"
|
||||
#import "FBSDKConstants.h"
|
||||
#import "FBSDKDynamicFrameworkLoader.h"
|
||||
#import "FBSDKError.h"
|
||||
|
||||
+2
-2
@@ -29,7 +29,7 @@
|
||||
@property (nonatomic, retain) NSMutableData *data;
|
||||
@property (nonatomic, copy) FBSDKURLConnectionHandler handler;
|
||||
@property (nonatomic, retain) NSURLResponse *response;
|
||||
@property (nonatomic) unsigned long requestStartTime;
|
||||
@property (nonatomic, assign) uint64_t requestStartTime;
|
||||
@property (nonatomic, readonly) NSUInteger loggerSerialNumber;
|
||||
|
||||
@end
|
||||
@@ -83,7 +83,7 @@
|
||||
responseData:(NSData *)responseData {
|
||||
// Basic FBSDKURLConnection logging just prints out the URL. FBSDKGraphRequest logging provides more details.
|
||||
NSString *mimeType = [response MIMEType];
|
||||
NSMutableString *mutableLogEntry = [NSMutableString stringWithFormat:@"FBSDKURLConnection <#%lu>:\n Duration: %lu msec\nResponse Size: %lu kB\n MIME type: %@\n",
|
||||
NSMutableString *mutableLogEntry = [NSMutableString stringWithFormat:@"FBSDKURLConnection <#%lu>:\n Duration: %llu msec\nResponse Size: %lu kB\n MIME type: %@\n",
|
||||
(unsigned long)self.loggerSerialNumber,
|
||||
[FBSDKInternalUtility currentTimeInMilliseconds] - self.requestStartTime,
|
||||
(unsigned long)[responseData length] / 1024,
|
||||
|
||||
Generated
+2
-2
@@ -27,7 +27,7 @@
|
||||
|
||||
@property (nonatomic, strong) NSURLSessionTask *task;
|
||||
@property (nonatomic, copy) FBSDKURLSessionTaskHandler handler;
|
||||
@property (nonatomic, assign) unsigned long requestStartTime;
|
||||
@property (nonatomic, assign) uint64_t requestStartTime;
|
||||
@property (nonatomic, assign, readonly) NSUInteger loggerSerialNumber;
|
||||
|
||||
@end
|
||||
@@ -85,7 +85,7 @@
|
||||
responseData:(NSData *)responseData {
|
||||
// Basic FBSDKURLSessionTask logging just prints out the URL. FBSDKGraphRequest logging provides more details.
|
||||
NSString *mimeType = [response MIMEType];
|
||||
NSMutableString *mutableLogEntry = [NSMutableString stringWithFormat:@"FBSDKURLSessionTask <#%lu>:\n Duration: %lu msec\nResponse Size: %lu kB\n MIME type: %@\n",
|
||||
NSMutableString *mutableLogEntry = [NSMutableString stringWithFormat:@"FBSDKURLSessionTask <#%lu>:\n Duration: %llu msec\nResponse Size: %lu kB\n MIME type: %@\n",
|
||||
(unsigned long)self.loggerSerialNumber,
|
||||
[FBSDKInternalUtility currentTimeInMilliseconds] - self.requestStartTime,
|
||||
(unsigned long)[responseData length] / 1024,
|
||||
|
||||
Reference in new issue
Block a user