Permalink
Browse files

Fixes breaking change introduced by (e79d072)

Summary:
The problem is that e79d072 fixes odd behavior in Hackbook,
which had support in the SDK code’s logout function. Prior to e79d072
Hackbook was more convoluted, and the logout behavior broke
encapsulation. The solution is to put back a deprecated logout method that
matches the original signature, and keeps most of the original behavior
(though it does not break encapsulation, which was badness.)

Test Plan:
Manually modify Hackbook, and whitebox test each of the following
permutations:
* login with no delegate (call the cached delegate)
* login with a delegate matching the cached delegate (call the cached delegate)
* login with a delegate different from the cached delegate (call both)

Reviewers: yariv, caabernathy, mmarucheck, vijaye

Reviewed By: yariv

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

Task ID: 905137
  • Loading branch information...
1 parent daed6b2 commit 8ed244aaf689d3f4fe843e3129b26e2a87895278 @onebit onebit committed Feb 8, 2012
Showing with 21 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +2 −0 src/Facebook.h
  3. +16 −0 src/Facebook.m
View
@@ -20,3 +20,6 @@ test/UnitTest/build/
*~
*#
.arcconfig
+.DS_Store
+project.xcworkspace
+xcuserdata
View
@@ -63,6 +63,8 @@
- (void)logout;
+- (void)logout:(id<FBSessionDelegate>)delegate;
+
- (FBRequest*)requestWithParams:(NSMutableDictionary *)params
andDelegate:(id <FBRequestDelegate>)delegate;
View
@@ -473,6 +473,22 @@ - (void)logout {
}
/**
+ * Invalidate the current user session by removing the access token in
+ * memory and clearing the browser cookie.
+ *
+ * @deprecated Use of a single session delegate, set at app init, is preferred
+ */
+- (void)logout:(id<FBSessionDelegate>)delegate {
+ [self logout];
+ // preserve deprecated callback behavior, but leave cached delegate intact
+ // avoid calling twice if the passed and cached delegates are the same
+ if (delegate != self.sessionDelegate &&
+ [delegate respondsToSelector:@selector(fbDidLogout)]) {
+ [delegate fbDidLogout];
+ }
+}
+
+/**
* Make a request to Facebook's REST API with the given
* parameters. One of the parameter keys must be "method" and its value
* should be a valid REST server API method.

0 comments on commit 8ed244a

Please sign in to comment.