Skip to content

Commit

Permalink
Facebook iOS SDK 4.27
Browse files Browse the repository at this point in the history
  • Loading branch information
abeatte committed Sep 26, 2017
1 parent b7a6d08 commit 86f7b48
Show file tree
Hide file tree
Showing 45 changed files with 1,198 additions and 75 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Expand Up @@ -2,12 +2,13 @@ AccountKit/**/AccountKitServerSnapshotTests.xcworkspace/*
AccountKit/**/AccountKitServerSnapshotTests.xcodeproj/*
ads/samples/AdUnitsSample/AdUnitsSample.xcodeproj/*
ads/samples/AdUnitsSample/AdUnitsSample.xcworkspace/*
ads/samples/InstreamAdSample/InstreamAdSample.xcodeproj/*
ads/samples/InstreamAdSample/InstreamAdSample.xcworkspace/*
ads/samples/NativeAdSample/NativeAdSample.xcodeproj/*
ads/samples/NativeAdSample/NativeAdSample.xcworkspace/*
ads/internal/samples/Hackvertising/Hackvertising.xcodeproj/*
ads/src/FBAudienceNetwork.xcworkspace/*
ads/src/FBAudienceNetwork/FBAudienceNetworkWorkspace.xcworkspace/*
ads/src/FBAudienceNetwork/FBAudienceNetwork.xcodeproj/*
ads/src/FBAudienceNetwork/FBAudienceNetwork.xcworkspace/*
internal/testing/IpaSizeTestApp/**/*.xcworkspace/*
internal/testing/IpaSizeTestApp/**/*.xcodeproj/*
samples/Hackbook/build/
Expand Down
2 changes: 1 addition & 1 deletion Bolts-IOS
3 changes: 1 addition & 2 deletions Configurations/Version.xcconfig
Expand Up @@ -17,6 +17,5 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

// The versions for FBSDK and Messenger SDK.
FBSDK_PROJECT_VERSION=4.26.0
FBSDK_PROJECT_VERSION=4.27.0
MNSDK_PROJECT_VERSION=TODO_SUPPORT_MNSDK

4 changes: 2 additions & 2 deletions FBSDKCoreKit.podspec
Expand Up @@ -3,7 +3,7 @@
Pod::Spec.new do |s|

s.name = "FBSDKCoreKit"
s.version = "4.26.0"
s.version = "4.27.0"
s.summary = "Official Facebook SDK for iOS to access Facebook Platform's core features"

s.description = <<-DESC
Expand All @@ -22,7 +22,7 @@ Pod::Spec.new do |s|
s.tvos.deployment_target = '9.0'

s.source = { :git => "https://github.com/facebook/facebook-ios-sdk.git",
:tag => "sdk-version-4.26.0"
:tag => "sdk-version-4.27.0"
}

s.ios.weak_frameworks = 'Accounts', 'CoreLocation', 'Social', 'Security', 'QuartzCore', 'CoreGraphics', 'UIKit', 'Foundation', 'AudioToolbox'
Expand Down
1 change: 1 addition & 0 deletions FBSDKCoreKit/FBSDKCoreKit/FBSDKAppEvents.m
Expand Up @@ -177,6 +177,7 @@
NSString *const FBSDKAppEventsDialogShareContentTypeStatus = @"Status";
NSString *const FBSDKAppEventsDialogShareContentTypePhoto = @"Photo";
NSString *const FBSDKAppEventsDialogShareContentTypeVideo = @"Video";
NSString *const FBSDKAppEventsDialogShareContentTypeCamera = @"Camera";
NSString *const FBSDKAppEventsDialogShareContentTypeUnknown = @"Unknown";

NSString *const FBSDKAppEventsLoggingResultNotification = @"com.facebook.sdk:FBSDKAppEventsLoggingResultNotification";
Expand Down
1 change: 1 addition & 0 deletions FBSDKCoreKit/FBSDKCoreKit/FBSDKAppLinkResolver.m
Expand Up @@ -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"
Expand Down
39 changes: 37 additions & 2 deletions FBSDKCoreKit/FBSDKCoreKit/FBSDKApplicationDelegate.m
Expand Up @@ -172,6 +172,12 @@ - (BOOL)application:(UIApplication *)application
completion:completePendingOpenURLBlock];
_safariViewController = nil;
} else {
#ifdef __IPHONE_11_0
if (_authenticationSession != nil) {
[_authenticationSession cancel];
_authenticationSession = nil;
}
#endif
completePendingOpenURLBlock();
}
if ([pendingURLOpen canOpenURL:url
Expand All @@ -196,6 +202,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
// fetch app settings
[FBSDKServerConfigurationManager loadServerConfigurationWithCompletionBlock:NULL];

[self _logSDKInitialize];
#if !TARGET_OS_TV
FBSDKProfile *cachedProfile = [FBSDKProfile fetchCachedProfile];
[FBSDKProfile setCurrentProfile:cachedProfile];
Expand Down Expand Up @@ -234,7 +241,11 @@ - (void)applicationDidBecomeActive:(NSNotification *)notification
// _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;
#ifdef __IPHONE_11_0
notExpectingBackground = notExpectingBackground && !_authenticationSession;
#endif
if (notExpectingBackground) {
_active = YES;
#if !TARGET_OS_TV
[_pendingURLOpen applicationDidBecomeActive:[notification object]];
Expand Down Expand Up @@ -338,7 +349,6 @@ - (void)openURLWithSafariViewController:(NSURL *)url
if ([sender isAuthenticationURL:url]) {
Class SFAuthenticationSessionClass = fbsdkdfl_SFAuthenticationSessionClass();
if (SFAuthenticationSessionClass != nil) {
_expectingBackground = YES;
_authenticationSession = [[SFAuthenticationSessionClass alloc] initWithURL:url callbackURLScheme:[FBSDKInternalUtility appURLScheme] completionHandler:^ (NSURL *aURL, NSError *error) {
handler(error == nil, error);
if (error == nil) {
Expand Down Expand Up @@ -475,6 +485,31 @@ - (void)_logIfAppLinkEvent:(NSURL *)url
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
Expand Down
2 changes: 1 addition & 1 deletion FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit.h
Expand Up @@ -44,5 +44,5 @@
#import <FBSDKCoreKit/FBSDKDeviceViewControllerBase.h>
#endif

#define FBSDK_VERSION_STRING @"4.26.0"
#define FBSDK_VERSION_STRING @"4.27.0"
#define FBSDK_TARGET_PLATFORM_VERSION @"v2.10"
7 changes: 4 additions & 3 deletions FBSDKCoreKit/FBSDKCoreKit/FBSDKSettings.m
Expand Up @@ -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) \
Expand All @@ -44,7 +45,7 @@ + (void)SETTER:(TYPE *)value { \
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";
Expand Down Expand Up @@ -177,12 +178,12 @@ - (instancetype)init

#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;
Expand Down
Expand Up @@ -120,6 +120,7 @@ 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 FBSDKAppEventsDialogShareContentTypeUnknown;


Expand Down
Expand Up @@ -60,7 +60,8 @@ + (NSDictionary *)protocolMap
_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-api20140430"],
FBSDK_CANOPENURL_MSQRD_PLAYER:[[FBSDKBridgeAPIProtocolNativeV1 alloc] initWithAppScheme:@"msqrdplayer-api20170208"]
},
@(FBSDKBridgeAPIProtocolTypeWeb): @{
@"https": [[FBSDKBridgeAPIProtocolWebV1 alloc] init],
Expand Down
1 change: 1 addition & 0 deletions FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKCoreKit+Internal.h
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKInternalUtility.h
Expand Up @@ -22,6 +22,7 @@
#define FBSDK_CANOPENURL_FACEBOOK @"fbauth2"
#define FBSDK_CANOPENURL_FBAPI @"fbapi"
#define FBSDK_CANOPENURL_MESSENGER @"fb-messenger-api"
#define FBSDK_CANOPENURL_MSQRD_PLAYER @"msqrdplayer"
#define FBSDK_CANOPENURL_SHARE_EXTENSION @"fbshareextension"

typedef NS_ENUM(int32_t, FBSDKUIKitVersion)
Expand Down Expand Up @@ -347,6 +348,7 @@ setJSONStringForObject:(id)object

+ (BOOL)isFacebookAppInstalled;
+ (BOOL)isMessengerAppInstalled;
+ (BOOL)isMSQRDPlayerAppInstalled;
+ (void)checkRegisteredCanOpenURLScheme:(NSString *)urlScheme;
+ (BOOL)isRegisteredCanOpenURLScheme:(NSString *)urlScheme;

Expand Down
28 changes: 18 additions & 10 deletions FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKInternalUtility.m
Expand Up @@ -493,11 +493,7 @@ + (BOOL)isFacebookAppInstalled
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
Expand All @@ -506,12 +502,16 @@ + (BOOL)isMessengerAppInstalled
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
Expand Down Expand Up @@ -583,6 +583,14 @@ + (id)_convertObjectToJSONObject:(id)object
return object;
}

+ (BOOL)_canOpenURLScheme:(NSString *)scheme
{
NSURLComponents *components = [[NSURLComponents alloc] init];
components.scheme = scheme;
components.path = @"/";
return [[UIApplication sharedApplication] canOpenURL:components.URL];
}

+ (void)validateAppID
{
if (![FBSDKSettings appID]) {
Expand Down
9 changes: 5 additions & 4 deletions FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKSettings+Internal.h
Expand Up @@ -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;

Expand Down
Expand Up @@ -18,6 +18,7 @@

#import "FBSDKSystemAccountStoreAdapter.h"

#import "FBSDKAccessToken.h"
#import "FBSDKConstants.h"
#import "FBSDKDynamicFrameworkLoader.h"
#import "FBSDKError.h"
Expand Down
4 changes: 2 additions & 2 deletions FBSDKLoginKit.podspec
Expand Up @@ -3,7 +3,7 @@
Pod::Spec.new do |s|

s.name = "FBSDKLoginKit"
s.version = "4.26.0"
s.version = "4.27.0"
s.summary = "Official Facebook SDK for iOS to access Facebook Platform with features like Login, Share and Message Dialog, App Links, and Graph API"

s.description = <<-DESC
Expand All @@ -21,7 +21,7 @@ Pod::Spec.new do |s|
s.ios.deployment_target = "7.0"

s.source = { :git => "https://github.com/facebook/facebook-ios-sdk.git",
:tag => "sdk-version-4.26.0"
:tag => "sdk-version-4.27.0"
}

s.weak_frameworks = "Accounts", "CoreLocation", "Social", "Security", "QuartzCore", "CoreGraphics", "UIKit", "Foundation", "AudioToolbox"
Expand Down
2 changes: 1 addition & 1 deletion FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManager.m
Expand Up @@ -596,7 +596,7 @@ - (BOOL)canOpenURL:(NSURL *)url
BOOL isFacebookURL = [[url scheme] hasPrefix:[NSString stringWithFormat:@"fb%@", [FBSDKSettings appID]]] &&
[[url host] isEqualToString:@"authorize"];

BOOL isExpectedSourceApplication = [sourceApplication hasPrefix:@"com.facebook"] || [sourceApplication hasPrefix:@"com.apple"];
BOOL isExpectedSourceApplication = [sourceApplication hasPrefix:@"com.facebook"] || [sourceApplication hasPrefix:@"com.apple"] || [sourceApplication hasPrefix:@"com.burbn"];

return isFacebookURL && isExpectedSourceApplication;
}
Expand Down
4 changes: 2 additions & 2 deletions FBSDKPlacesKit.podspec
Expand Up @@ -3,7 +3,7 @@
Pod::Spec.new do |s|

s.name = "FBSDKPlacesKit"
s.version = "4.26.0"
s.version = "4.27.0"
s.summary = "Official Facebook SDK for iOS to access Facebook Places"

s.description = <<-DESC
Expand All @@ -20,7 +20,7 @@ Pod::Spec.new do |s|
s.ios.deployment_target = "7.0"

s.source = { :git => "https://github.com/facebook/facebook-ios-sdk.git",
:tag => "sdk-version-4.26.0"
:tag => "sdk-version-4.27.0"
}

s.weak_frameworks = "Accounts", "CoreLocation", "Social", "Security", "Foundation"
Expand Down
4 changes: 2 additions & 2 deletions FBSDKShareKit.podspec
Expand Up @@ -3,7 +3,7 @@
Pod::Spec.new do |s|

s.name = "FBSDKShareKit"
s.version = "4.26.0"
s.version = "4.27.0"
s.summary = "Official Facebook SDK for iOS to access Facebook Platform's Sharing Features"

s.description = <<-DESC
Expand All @@ -22,7 +22,7 @@ Pod::Spec.new do |s|
s.tvos.deployment_target = '9.0'

s.source = { :git => "https://github.com/facebook/facebook-ios-sdk.git",
:tag => "sdk-version-4.26.0"
:tag => "sdk-version-4.27.0"
}

s.ios.weak_frameworks = 'Accounts', 'AudioToolbox', 'CoreGraphics', 'CoreLocation', 'Foundation', 'QuartzCore', 'Security', 'Social', 'UIKit'
Expand Down

0 comments on commit 86f7b48

Please sign in to comment.