Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adds global migration bundle support

Summary:
Adds support for global migration bundles, which means -
1) By default all requests pass a migration bundle
2) For internal requests (pickers, etc.) the migration bundle is not changeable
3) For app owned requests, the bundle can be removed, or changed from the default

Test Plan:
Manual testing debugging the server to confirm bundles trigger the right code on the
server in the following situations -
1) no bundle
2) an existing bundle
3) a non existing bundle
4) a bundle with all expired migrations
5) bundle parameter with empty value (e.g. migration_bundle=)

Reviewers: clang, mmarucheck

Reviewed By: mmarucheck

CC: gregschechte, ekoneil, msdkexp@

Differential Revision: https://phabricator.fb.com/D573365

Task ID: 1464508
  • Loading branch information...
commit 0f3ac30a7df0760bfe16236c397f44aa4d9d1971 1 parent 901e296
@onebit onebit authored
View
2  scripts/build_framework.sh
@@ -171,5 +171,5 @@ fi
# Done
#
-progress_message "Framework version:" `perl -pe "s/.*@//" < $FB_SDK_SRC/FBSDKVersion-generated.h`
+progress_message "Framework version info:" `perl -pe "s/.*@//" < $FB_SDK_SRC/FBSDKVersion.h`
common_success
View
9 src/FBProfilePictureView.m
@@ -18,6 +18,7 @@
#import "FBURLConnection.h"
#import "FBRequest.h"
#import "FBUtility.h"
+#import "FBSDKVersion.h"
@interface FBProfilePictureView()
@@ -103,10 +104,10 @@ - (NSString *)imageQueryParamString {
int width = (int)(self.bounds.size.width * screenScaleFactor);
if (self.pictureCropping == FBProfilePictureCroppingSquare) {
- // Note: final query param is escaped form of 'migration_overrides={october_2012:true}'. Once the
- // October 2012 migration has completed, this can be removed.
- return [NSString stringWithFormat:@"width=%d&height=%d&migration_overrides=%%7boctober_2012:true%%7d",
- width, width];
+ return [NSString stringWithFormat:@"width=%d&height=%d&migration_bundle=%@",
+ width,
+ width,
+ FB_IOS_SDK_MIGRATION_BUNDLE];
}
// For non-square images, we choose between three variants knowing that the small profile picture is
View
47 src/FBRequest.m
@@ -17,6 +17,7 @@
#import "Facebook.h"
#import "FBUtility.h"
#import "FBSession+Internal.h"
+#import "FBSDKVersion.h"
// constants
NSString *const FBGraphBasePath = @"https://graph." FB_BASE_URL;
@@ -52,29 +53,6 @@ - (id)initWithSession:(FBSession*)session
HTTPMethod:nil];
}
-- (id)initWithSession:(FBSession*)session
- graphPath:(NSString *)graphPath
- parameters:(NSDictionary *)parameters
- HTTPMethod:(NSString *)HTTPMethod
-{
- if (self = [super init]) {
- // set default for nil
- if (!HTTPMethod) {
- HTTPMethod = kGetHTTPMethod;
- }
-
- self.session = session;
- self.graphPath = graphPath;
- self.HTTPMethod = HTTPMethod;
-
- _parameters = [[NSMutableDictionary alloc] init];
- if (parameters) {
- [self.parameters addEntriesFromDictionary:parameters];
- }
- }
- return self;
-}
-
- (id)initForPostWithSession:(FBSession*)session
graphPath:(NSString *)graphPath
graphObject:(id<FBGraphObject>)graphObject {
@@ -93,6 +71,22 @@ - (id)initWithSession:(FBSession*)session
parameters:(NSDictionary *)parameters
HTTPMethod:(NSString *)HTTPMethod
{
+ // reusing the more common initializer...
+ self = [self initWithSession:session
+ graphPath:nil // but assuring a nil graphPath for the rest case
+ parameters:parameters
+ HTTPMethod:HTTPMethod];
+ if (self = [super init]) {
+ self.restMethod = restMethod;
+ }
+ return self;
+}
+
+- (id)initWithSession:(FBSession*)session
+ graphPath:(NSString *)graphPath
+ parameters:(NSDictionary *)parameters
+ HTTPMethod:(NSString *)HTTPMethod
+{
if (self = [super init]) {
// set default for nil
if (!HTTPMethod) {
@@ -100,11 +94,14 @@ - (id)initWithSession:(FBSession*)session
}
self.session = session;
- self.restMethod = restMethod;
+ self.graphPath = graphPath;
self.HTTPMethod = HTTPMethod;
- _parameters = [[NSMutableDictionary alloc] init];
+ // all request objects start life with a migration bundle set for the SDK
+ _parameters = [[NSMutableDictionary alloc]
+ initWithObjectsAndKeys:FB_IOS_SDK_MIGRATION_BUNDLE, @"migration_bundle", nil];
if (parameters) {
+ // but the incoming dictionary's migration bundle trumps the default one, if present
[self.parameters addEntriesFromDictionary:parameters];
}
}
View
4 src/FBRequestConnection.m
@@ -30,9 +30,7 @@
#import "FBLogger.h"
#import "FBUtility.h"
#import "FBDataDiskCache.h"
-
-// Note: This file is auto-generated by a Run Script build step.
-#import "FBSDKVersion-generated.h"
+#import "FBSDKVersion.h"
// URL construction constants
NSString *const kGraphURL = @"https://graph." FB_BASE_URL;
View
1  src/FBSDKVersion-generated.h → src/FBSDKVersion.h
@@ -1 +1,2 @@
#define FB_IOS_SDK_VERSION_STRING @"3.0.8-6-g932f4a1"
+#define FB_IOS_SDK_MIGRATION_BUNDLE @"fbsdk:20120913"
View
23 src/facebook-ios-sdk.xcodeproj/project.pbxproj
@@ -23,7 +23,7 @@
843D2DD81547C33000873F7C /* FBUtility.h in Headers */ = {isa = PBXBuildFile; fileRef = 843D2DD61547C33000873F7C /* FBUtility.h */; };
843D2DD91547C33000873F7C /* FBUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = 843D2DD71547C33000873F7C /* FBUtility.m */; };
843D2DDA1547C33000873F7C /* FBUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = 843D2DD71547C33000873F7C /* FBUtility.m */; };
- 8440A81615E3F2B800565452 /* FBSDKVersion-generated.h in Headers */ = {isa = PBXBuildFile; fileRef = 8440A81515E3F2B800565452 /* FBSDKVersion-generated.h */; };
+ 8440A81615E3F2B800565452 /* FBSDKVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = 8440A81515E3F2B800565452 /* FBSDKVersion.h */; };
8446FDA6151BC5C2000BE007 /* FBSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 8446FDA5151BC5C2000BE007 /* FBSession.m */; };
8446FDAD151CDB0B000BE007 /* FBSessionTokenCachingStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = 8446FDAB151CDB0B000BE007 /* FBSessionTokenCachingStrategy.h */; settings = {ATTRIBUTES = (Public, ); }; };
8446FDAE151CDB0B000BE007 /* FBSessionTokenCachingStrategy.m in Sources */ = {isa = PBXBuildFile; fileRef = 8446FDAC151CDB0B000BE007 /* FBSessionTokenCachingStrategy.m */; };
@@ -179,7 +179,7 @@
84137157152B94B000B2C0E1 /* FBSessionManualTokenCachingStrategy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBSessionManualTokenCachingStrategy.m; sourceTree = "<group>"; };
843D2DD61547C33000873F7C /* FBUtility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBUtility.h; sourceTree = "<group>"; };
843D2DD71547C33000873F7C /* FBUtility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBUtility.m; sourceTree = "<group>"; };
- 8440A81515E3F2B800565452 /* FBSDKVersion-generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "FBSDKVersion-generated.h"; sourceTree = "<group>"; };
+ 8440A81515E3F2B800565452 /* FBSDKVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBSDKVersion.h; sourceTree = "<group>"; };
8446FDA5151BC5C2000BE007 /* FBSession.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = FBSession.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
8446FDAB151CDB0B000BE007 /* FBSessionTokenCachingStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBSessionTokenCachingStrategy.h; sourceTree = "<group>"; };
8446FDAC151CDB0B000BE007 /* FBSessionTokenCachingStrategy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBSessionTokenCachingStrategy.m; sourceTree = "<group>"; };
@@ -369,7 +369,7 @@
84E0CA07153619D400778DA4 /* Facebook.h */,
84E0CA08153619D400778DA4 /* Facebook.m */,
84E0CA03153618E500778DA4 /* FacebookSDK.h */,
- 8440A81515E3F2B800565452 /* FBSDKVersion-generated.h */,
+ 8440A81515E3F2B800565452 /* FBSDKVersion.h */,
84D0A64B1581A0CF00A2FA5E /* FBCacheDescriptor.h */,
84D0A64C1581A0CF00A2FA5E /* FBCacheDescriptor.m */,
B9C6E1301525219600E46808 /* FBCacheIndex.h */,
@@ -572,7 +572,7 @@
85E4AC7D15B63CC500F17346 /* FBViewController.h in Headers */,
2A68590615C1E37E001D4EDD /* FBSettings+Internal.h in Headers */,
85F99E3F15C3751100D807A5 /* FBViewController+Internal.h in Headers */,
- 8440A81615E3F2B800565452 /* FBSDKVersion-generated.h in Headers */,
+ 8440A81615E3F2B800565452 /* FBSDKVersion.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -602,7 +602,6 @@
isa = PBXNativeTarget;
buildConfigurationList = 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "facebook-ios-sdk" */;
buildPhases = (
- 8592BE0315802E7B00056680 /* Run Script */,
D2AAC07A0554694100DB518D /* Headers */,
D2AAC07B0554694100DB518D /* Sources */,
D2AAC07C0554694100DB518D /* Frameworks */,
@@ -658,20 +657,6 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
- 8592BE0315802E7B00056680 /* Run Script */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- inputPaths = (
- );
- name = "Run Script";
- outputPaths = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "VERSION_HEADER_PATH=$SRCROOT/FBSDKVersion-generated.h\n\n# default\necho '#define FB_IOS_SDK_VERSION_STRING @\"Unknown\"' > $VERSION_HEADER_PATH\n\nGIT_DESCRIBE=`(cd $SRCROOT; git describe --match=\"sdk-version-*\" --tags 2>/dev/null)`\nif [ \"$?\" -eq \"0\" ]; then\t\n # If we have git and are in a working copy, use the version part of git-describe's output.\n echo '#define FB_IOS_SDK_VERSION_STRING @\"'`echo $GIT_DESCRIBE | perl -pe \"s/sdk-version-//\"`'\"' > $VERSION_HEADER_PATH\nfi\n\n";
- };
B9CBC517152537270036AA71 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Please sign in to comment.
Something went wrong with that request. Please try again.